aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java14
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java21
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java24
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java100
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java61
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java4
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java30
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java38
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java49
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java11
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java37
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java107
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql3
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql47
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java1
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java370
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json1
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java24
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java56
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java24
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java28
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java92
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java17
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java189
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java41
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java91
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql1
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql12
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql21
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt128
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml5
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java7
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java16
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java18
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java27
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java104
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java55
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java26
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java49
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java55
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java51
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java52
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java22
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java40
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java45
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java36
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java13
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java6
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java8
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java12
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java994
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java3
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java31
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java5
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java31
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java59
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java10
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java219
-rw-r--r--asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json47
-rw-r--r--asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csarbin0 -> 55786 bytes
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json173
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csarbin0 -> 96398 bytes
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml1186
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env10
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml103
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json25
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml1
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml1
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env9
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml109
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml1
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml1
-rw-r--r--asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json25
-rw-r--r--asdc-controller/src/test/resources/schema.sql5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java71
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java25
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java30
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy135
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java65
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java96
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json10
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json8
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json22
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java407
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java1
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java4
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java29
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java241
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java12
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java6
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12bin0 -> 4095 bytes
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jksbin0 -> 1413 bytes
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java176
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java14
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java27
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn6
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy24
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy32
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy40
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy64
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy28
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java35
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java96
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java60
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java56
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIEntityNotFoundException.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnf.json57
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnfWithVservers.json434
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverFullQueryResponse.json13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverQueryResponse.json6
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java2
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java6
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java4
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java8
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java10
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java19
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java6
-rw-r--r--common/pom.xml11
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java14
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java12
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java10
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java6
-rw-r--r--common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java9
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java1
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java13
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java14
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java23
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/__.java2
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java7
-rw-r--r--common/src/main/java/org/onap/so/listener/ListenerRunner.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/ListenerRunner.java)8
-rw-r--r--common/src/main/java/org/onap/so/listener/Skip.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/Skip.java)2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java13
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java46
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java46
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntities.java4
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java16
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java12
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java7
-rw-r--r--common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java37
-rw-r--r--common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java61
-rw-r--r--common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java65
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/test-request.json6
-rw-r--r--common/src/test/resources/__files/aai/singletransaction/sample-request.json6
-rw-r--r--docs/api/apis/consumed-apis.rst (renamed from docs/api/apis/SO_Interface.rst)1324
-rw-r--r--docs/api/apis/e2eServiceInstances-api.rst185
-rw-r--r--docs/api/apis/serviceInstances-api.rst1192
-rw-r--r--docs/api/offered_consumed_apis.rst13
-rw-r--r--docs/developer_info/developer_information.rst5
-rw-r--r--docs/developer_info/instantiate/index.rst31
-rw-r--r--docs/developer_info/instantiate/instantiation/index.rst28
-rw-r--r--docs/developer_info/instantiate/instantiation/nbi/index.rst97
-rw-r--r--docs/developer_info/instantiate/instantiation/pnf_instance/index.rst107
-rw-r--r--docs/developer_info/instantiate/instantiation/so1/index.rst366
-rw-r--r--docs/developer_info/instantiate/instantiation/so2/index.rst197
-rw-r--r--docs/developer_info/instantiate/instantiation/uui/index.rst14
-rw-r--r--docs/developer_info/instantiate/instantiation/vid/index.rst13
-rw-r--r--docs/developer_info/instantiate/pre_instantiation/index.rst225
-rw-r--r--docs/release-notes.rst6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java61
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GenericStringConverter.java33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java157
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheck.java84
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConfig.java83
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConverter.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckResponse.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java)30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckStatus.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckStatus.java)4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckSubsystem.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckResponse.java116
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java45
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java27
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java242
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SoSubsystems.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoSubsystems.java)6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Subsystem.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java111
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java85
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java88
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java80
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java182
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java24
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql5
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java7
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql8
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java4
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java1
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java16
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java18
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java114
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java5
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java136
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java13
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java19
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java1
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql1
-rw-r--r--packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml26
-rw-r--r--version.properties2
-rw-r--r--vnfm-simulator/vnfm-service/pom.xml5
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java8
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java8
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java28
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java49
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java31
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java36
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java92
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java82
-rw-r--r--vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java112
362 files changed, 11083 insertions, 5538 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index e821d806dd..2a17656f1d 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -478,12 +478,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
boolean timedOut = false;
int cancelTimeout = timeout; // TODO: For now, just use same timeout
- String status = cancelExecution.getStatus();
-
+ String status = null;
+ if (cancelExecution != null) {
+ status = cancelExecution.getStatus();
+ }
// Poll for completion. Create a reusable cloudify query request
GetExecution queryExecution = cloudify.executions().byId(executionId);
- while (!timedOut && !status.equals(CANCELLED)) {
+ while (!timedOut && !CANCELLED.equals(status)) {
// workflow is still running; check for timeout
if (cancelTimeout <= 0) {
logger.debug("Cancel timeout for workflow {} on deployment {}", workflowId, deploymentId);
@@ -497,11 +499,13 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("pollTimeout remaining: {}", cancelTimeout);
execution = queryExecution.execute();
- status = execution.getStatus();
+ if (execution != null) {
+ status = execution.getStatus();
+ }
}
// Broke the loop. Check again for a terminal state
- if (status.equals(CANCELLED)) {
+ if (CANCELLED.equals(status)) {
// Finished cancelling. Return the original exception
logger.debug("Cancel workflow {} completed on deployment {}", workflowId, deploymentId);
throw new MsoCloudifyException(-1, "", "", savedException);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java
index b0c2d9430a..71cdcf6078 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java
@@ -22,7 +22,6 @@
package org.onap.so.openstack.utils;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +41,7 @@ public class CinderClientImpl extends MsoCommonUtils {
/**
* Gets the Cinder client.
*
- * @param cloudSite the cloud site
+ * @param cloudSiteId the cloud site
* @param tenantId the tenant id
* @return the glance client
* @throws MsoException the mso exception
@@ -62,15 +61,12 @@ public class CinderClientImpl extends MsoCommonUtils {
* @param cloudSiteId the cloud site id
* @param tenantId the tenant id
* @param limit limits the number of records returned
- * @param visibility visibility in the image in openstack
* @param marker the last viewed record
- * @param name the image names
* @return the list of images in openstack
- * @throws MsoCloudSiteNotFound the mso cloud site not found
* @throws CinderClientException the glance client exception
*/
public Volumes queryVolumes(String cloudSiteId, String tenantId, int limit, String marker)
- throws MsoCloudSiteNotFound, CinderClientException {
+ throws CinderClientException {
try {
Cinder cinderClient = getCinderClient(cloudSiteId, tenantId);
// list is set to false, otherwise an invalid URL is appended
@@ -78,22 +74,23 @@ public class CinderClientImpl extends MsoCommonUtils {
cinderClient.volumes().list(false).queryParam("limit", limit).queryParam("marker", marker);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
- logger.error("Error building Cinder Client", e);
- throw new CinderClientException("Error building Cinder Client", e);
+ String errorMsg = "Error building Cinder Client";
+ logger.error(errorMsg, e);
+ throw new CinderClientException(errorMsg, e);
}
}
- public Volume queryVolume(String cloudSiteId, String tenantId, String volumeId)
- throws MsoCloudSiteNotFound, CinderClientException {
+ public Volume queryVolume(String cloudSiteId, String tenantId, String volumeId) throws CinderClientException {
try {
Cinder cinderClient = getCinderClient(cloudSiteId, tenantId);
// list is set to false, otherwise an invalid URL is appended
OpenStackRequest<Volume> request = cinderClient.volumes().show(volumeId);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
- logger.error("Error building Cinder Client", e);
- throw new CinderClientException("Error building Cinder Client", e);
+ String errorMsg = "Error building Cinder Client";
+ logger.error(errorMsg, e);
+ throw new CinderClientException(errorMsg, e);
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
index 8cacf8526a..47ba076e0e 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
@@ -132,14 +132,14 @@ public class MsoHeatEnvironmentEntry {
}
public boolean hasResources() {
- if (this.resources != null && this.resources.size() > 0) {
+ if (this.resources != null && !this.resources.isEmpty()) {
return true;
}
return false;
}
public boolean hasParameters() {
- if (this.parameters != null && this.parameters.size() > 0) {
+ if (this.parameters != null && !this.parameters.isEmpty()) {
return true;
}
return false;
@@ -147,7 +147,7 @@ public class MsoHeatEnvironmentEntry {
public boolean containsParameter(String paramName) {
boolean contains = false;
- if (this.parameters == null || this.parameters.size() < 1) {
+ if (this.parameters == null || this.parameters.isEmpty()) {
return false;
}
if (this.parameters.contains(new MsoHeatEnvironmentParameter(paramName))) {
@@ -246,22 +246,4 @@ public class MsoHeatEnvironmentEntry {
sb.append(this.rawEntry.substring(indexOf));
return sb;
}
-
- public void setHPAParameters(StringBuilder hpasb) {
- try {
- MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(hpasb.toString().getBytes());
- Set<MsoHeatEnvironmentParameter> hpaParams = yaml.getParameterListFromEnvt();
- for (MsoHeatEnvironmentParameter hpaparam : hpaParams) {
- for (MsoHeatEnvironmentParameter param : this.parameters) {
- if (param.getName() == hpaparam.getName()) {
- param.setValue(hpaparam.getValue());
- }
- }
- }
- } catch (Exception e) {
- logger.debug("Exception:", e);
- this.errorString = e.getMessage();
- // e.printStackTrace();
- }
- }
}
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 1d75892138..b5a97f7559 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
@@ -44,7 +44,6 @@ 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.cloud.CloudConfig;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
@@ -108,10 +107,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
"{} Create Stack: Nested exception rolling back stack: {} ";
public static final String IN_PROGRESS = "in_progress";
- // Fetch cloud configuration each time (may be cached in CloudConfig class)
- @Autowired
- protected CloudConfig cloudConfig;
-
@Autowired
private Environment environment;
@@ -134,7 +129,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
protected static final String CREATE_POLL_INTERVAL_DEFAULT = "15";
private static final String DELETE_POLL_INTERVAL_DEFAULT = "15";
- private static final String pollingMultiplierDefault = "60";
+ private static final String POLLING_MULTIPLIER_DEFAULT = "60";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
@@ -200,7 +195,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
* @param cloudOwner the cloud owner of the cloud site in which to create the stack
* @param tenantId The Openstack ID of the tenant in which to create the Stack
* @param stackName The name of the stack to create
- * @param vduModelInfo contains information about the vdu model (added for plugin adapter)
+ * @param vduModel contains information about the vdu model (added for plugin adapter)
* @param heatTemplate The Heat template
* @param stackInputs A map of key/value inputs
* @param pollForCompletion Indicator that polling should be handled in Java vs. in the client
@@ -287,42 +282,41 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
String cloudSiteId, String tenantId, CreateStackParam stackCreate) throws MsoException {
if (stack == null) {
throw new StackCreationException("Unknown Error in Stack Creation");
- } else {
- logger.info("Performing post processing backout: {} cleanUpKeyPair: {}, stack {}", backout, cleanUpKeyPair,
- stack);
- if (!CREATE_COMPLETE.equals(stack.getStackStatus())) {
- if (cleanUpKeyPair && !Strings.isNullOrEmpty(stack.getStackStatusReason())
- && isKeyPairFailure(stack.getStackStatusReason())) {
- return handleKeyPairConflict(cloudSiteId, tenantId, stackCreate, timeoutMinutes, backout, stack);
- }
- if (!backout) {
- logger.info("Status is not CREATE_COMPLETE, stack deletion suppressed");
- throw new StackCreationException("Stack rollback suppressed, stack not deleted");
- } else {
- logger.info("Status is not CREATE_COMPLETE, stack deletion will be executed");
- String errorMessage = "Stack Creation Failed Openstack Status: " + stack.getStackStatus()
- + " Status Reason: " + stack.getStackStatusReason();
- try {
- Stack deletedStack =
- handleUnknownCreateStackFailure(stack, timeoutMinutes, cloudSiteId, tenantId);
- errorMessage = errorMessage + " , Rollback of Stack Creation completed with status: "
- + deletedStack.getStackStatus() + " Status Reason: "
- + deletedStack.getStackStatusReason();
- } catch (MsoException e) {
- logger.error("Sync Error Deleting Stack during rollback", e);
- if (e instanceof StackRollbackException) {
- errorMessage = errorMessage + e.getMessage();
- } else {
- errorMessage = errorMessage + " , Rollback of Stack Creation failed with sync error: "
- + e.getMessage();
- }
- }
- throw new StackCreationException(errorMessage);
- }
+ }
+
+ logger.info("Performing post processing backout: {} cleanUpKeyPair: {}, stack {}", backout, cleanUpKeyPair,
+ stack);
+ if (!CREATE_COMPLETE.equals(stack.getStackStatus())) {
+ if (cleanUpKeyPair && !Strings.isNullOrEmpty(stack.getStackStatusReason())
+ && isKeyPairFailure(stack.getStackStatusReason())) {
+ return handleKeyPairConflict(cloudSiteId, tenantId, stackCreate, timeoutMinutes, backout, stack);
+ }
+ if (!backout) {
+ logger.info("Status is not CREATE_COMPLETE, stack deletion suppressed");
+ throw new StackCreationException("Stack rollback suppressed, stack not deleted");
} else {
- return stack;
+ logger.info("Status is not CREATE_COMPLETE, stack deletion will be executed");
+ String errorMessage = "Stack Creation Failed Openstack Status: " + stack.getStackStatus()
+ + " Status Reason: " + stack.getStackStatusReason();
+ try {
+ Stack deletedStack = handleUnknownCreateStackFailure(stack, timeoutMinutes, cloudSiteId, tenantId);
+ errorMessage = errorMessage + " , Rollback of Stack Creation completed with status: "
+ + deletedStack.getStackStatus() + " Status Reason: " + deletedStack.getStackStatusReason();
+ } catch (StackRollbackException se) {
+ logger.error("Sync Error Deleting Stack during rollback process", se);
+ errorMessage = errorMessage + se.getMessage();
+ } catch (MsoException e) {
+ logger.error("Sync Error Deleting Stack during rollback", e);
+
+ errorMessage =
+ errorMessage + " , Rollback of Stack Creation failed with sync error: " + e.getMessage();
+ }
+ throw new StackCreationException(errorMessage);
}
+ } else {
+ return stack;
}
+
}
protected Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId,
@@ -330,23 +324,27 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
int pollingFrequency =
Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollingMultiplier =
- Integer.parseInt(this.environment.getProperty(pollingMultiplierProp, pollingMultiplierDefault));
+ Integer.parseInt(this.environment.getProperty(pollingMultiplierProp, POLLING_MULTIPLIER_DEFAULT));
int numberOfPollingAttempts = Math.floorDiv((timeoutMinutes * pollingMultiplier), pollingFrequency);
Heat heatClient = getHeatClient(cloudSiteId, tenantId);
- Stack latestStack = null;
while (true) {
- latestStack = queryHeatStack(heatClient, stack.getStackName() + "/" + stack.getId());
- statusHandler.updateStackStatus(latestStack);
- logger.debug("Polling: {} ({})", latestStack.getStackStatus(), latestStack.getStackName());
- if (stackStatus.equals(latestStack.getStackStatus())) {
- if (numberOfPollingAttempts <= 0) {
- logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus());
+ Stack latestStack = queryHeatStack(heatClient, stack.getStackName() + "/" + stack.getId());
+ if (latestStack != null) {
+ statusHandler.updateStackStatus(latestStack);
+ logger.debug("Polling: {} ({})", latestStack.getStackStatus(), latestStack.getStackName());
+ if (stackStatus.equals(latestStack.getStackStatus())) {
+ if (numberOfPollingAttempts <= 0) {
+ logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus());
+ return latestStack;
+ }
+ sleep(pollingFrequency * 1000L);
+ numberOfPollingAttempts -= 1;
+ } else {
return latestStack;
}
- sleep(pollingFrequency * 1000L);
- numberOfPollingAttempts -= 1;
} else {
- return latestStack;
+ logger.error("latestStack is null");
+ return null;
}
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index 49ba336e3f..c75aa9a67e 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -22,10 +22,6 @@
package org.onap.so.openstack.utils;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.woorea.openstack.heat.model.CreateStackParam;
-import com.woorea.openstack.heat.model.Stack;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
@@ -52,7 +48,6 @@ 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.exceptions.MsoAdapterException;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.onap.so.openstack.mappers.StackInfoMapper;
@@ -62,7 +57,11 @@ 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.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableSet;
+import com.woorea.openstack.heat.model.CreateStackParam;
+import com.woorea.openstack.heat.model.Stack;
@Component
public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
@@ -299,7 +298,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
responseBody = getQueryBody((java.io.InputStream) response.getEntity());
if (responseBody != null) {
if (logger.isDebugEnabled()) {
- logger.debug("Multicloud Create Response Body: " + responseBody.toString());
+ logger.debug("Multicloud Create Response Body: {}", responseBody);
}
Stack workloadStack = getWorkloadStack(responseBody.getWorkloadStatusReason());
if (workloadStack != null && !responseBody.getWorkloadStatus().equals("GET_FAILED")
@@ -354,7 +353,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
}
}
if (workloadStack != null)
- logger.debug("Multicloud getWorkloadStack() returning Stack Object: {} ", workloadStack.toString());
+ logger.debug("Multicloud getWorkloadStack() returning Stack Object: {} ", workloadStack);
return workloadStack;
}
@@ -457,8 +456,8 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
Response response = multicloudClient.post(multicloudRequest);
if (response.getStatus() != Response.Status.ACCEPTED.getStatusCode()) {
if (logger.isDebugEnabled())
- logger.debug(
- "Multicloud AAI update request failed: " + response.getStatus() + response.getStatusInfo());
+ logger.debug("Multicloud AAI update request failed: {} {}", response.getStatus(),
+ response.getStatusInfo());
return;
}
@@ -470,14 +469,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollTimeout = (timeoutMinutes * 60) + updatePollInterval;
boolean updateTimedOut = false;
- logger.debug("updatePollInterval=" + updatePollInterval + ", pollTimeout=" + pollTimeout);
+ logger.debug("updatePollInterval={}, pollTimeout={}", updatePollInterval, pollTimeout);
StackInfo stackInfo = null;
while (true) {
try {
stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, workloadId);
if (logger.isDebugEnabled())
- logger.debug(stackInfo.getStatus() + " (" + workloadId + ")");
+ logger.debug("{} ({})", stackInfo.getStatus(), workloadId);
if (HeatStatus.UPDATING.equals(stackInfo.getStatus())) {
if (pollTimeout <= 0) {
@@ -494,7 +493,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
pollTimeout -= updatePollInterval;
if (logger.isDebugEnabled())
- logger.debug("pollTimeout remaining: " + pollTimeout);
+ logger.debug("pollTimeout remaining: {}", pollTimeout);
} else {
break;
}
@@ -508,15 +507,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
if (updateTimedOut) {
if (logger.isDebugEnabled())
logger.debug("Multicloud AAI update request failed: {} {}", response.getStatus(),
- response.getStatusInfo().toString());
+ response.getStatusInfo());
} else if (!HeatStatus.UPDATED.equals(stackInfo.getStatus())) {
if (logger.isDebugEnabled())
logger.debug("Multicloud AAI update request failed: {} {}", response.getStatus(),
- response.getStatusInfo().toString());
+ response.getStatusInfo());
} else {
if (logger.isDebugEnabled())
- logger.debug("Multicloud AAI update successful: {} {}", response.getStatus(),
- response.getStatusInfo().toString());
+ logger.debug("Multicloud AAI update successful: {} {}", response.getStatus(), response.getStatusInfo());
}
}
@@ -543,12 +541,12 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
int deletePollTimeout = pollTimeout;
boolean createTimedOut = false;
StringBuilder stackErrorStatusReason = new StringBuilder("");
- logger.debug("createPollInterval=" + createPollInterval + ", pollTimeout=" + pollTimeout);
+ logger.debug("createPollInterval={}, pollTimeout={} ", createPollInterval, pollTimeout);
while (true) {
try {
stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
- logger.debug(stackInfo.getStatus() + " (" + instanceId + ")");
+ logger.debug("{} ({})", stackInfo.getStatus(), instanceId);
if (HeatStatus.BUILDING.equals(stackInfo.getStatus())) {
// Stack creation is still running.
@@ -567,7 +565,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
sleep(createPollInterval * 1000L);
pollTimeout -= createPollInterval;
- logger.debug("pollTimeout remaining: " + pollTimeout);
+ logger.debug("pollTimeout remaining: {}", pollTimeout);
} else {
// save off the status & reason msg before we attempt delete
stackErrorStatusReason
@@ -596,7 +594,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
while (!deleted) {
try {
StackInfo queryInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
- logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus());
+ logger.debug("Deleting {}, status: {}", instanceId, queryInfo.getStatus());
if (HeatStatus.DELETING.equals(queryInfo.getStatus())) {
if (deletePollTimeout <= 0) {
logger.error(String.format("%s %s %s %s %s %s %s %s %d %s",
@@ -610,7 +608,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
deletePollTimeout -= deletePollInterval;
}
} else if (HeatStatus.NOTFOUND.equals(queryInfo.getStatus())) {
- logger.debug("DELETE_COMPLETE for " + instanceId);
+ logger.debug("DELETE_COMPLETE for {}", instanceId);
deleted = true;
continue;
} else {
@@ -664,7 +662,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
while (!deleted) {
try {
StackInfo queryInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
- logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus());
+ logger.debug("Deleting {}, status: {}", instanceId, queryInfo.getStatus());
if (HeatStatus.DELETING.equals(queryInfo.getStatus())) {
if (deletePollTimeout <= 0) {
logger.error(String.format("%s %s %s %s %s %s %s %s %d %s",
@@ -678,7 +676,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
deletePollTimeout -= deletePollInterval;
}
} else if (HeatStatus.NOTFOUND.equals(queryInfo.getStatus())) {
- logger.debug("DELETE_COMPLETE for " + instanceId);
+ logger.debug("DELETE_COMPLETE for {}", instanceId);
deleted = true;
continue;
} else {
@@ -730,7 +728,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
} else {
// Get initial status, since it will have been null after the create.
stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
- logger.debug("Multicloud stack query status is: " + stackInfo.getStatus());
+ logger.debug("Multicloud stack query status is: {}", stackInfo.getStatus());
}
return stackInfo;
}
@@ -769,7 +767,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
try {
return new ObjectMapper().readerFor(MulticloudCreateResponse.class).readValue(body);
} catch (Exception e) {
- logger.debug("Exception retrieving multicloud vfModule POST response body " + e);
+ logger.debug("Exception retrieving multicloud vfModule POST response body ", e);
}
return null;
}
@@ -786,7 +784,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
try {
return new ObjectMapper().readerFor(MulticloudQueryResponse.class).readValue(body);
} catch (Exception e) {
- logger.debug("Exception retrieving multicloud workload query response body " + e);
+ logger.debug("Exception retrieving multicloud workload query response body ", e);
}
return null;
}
@@ -828,14 +826,11 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
client.addAdditionalHeader("Project", tenantId);
}
} catch (MalformedURLException e) {
- logger.debug(
- String.format("Encountered malformed URL error getting multicloud rest client %s", e.getMessage()));
+ logger.debug("Encountered malformed URL error getting multicloud rest client ", e);
} catch (IllegalArgumentException e) {
- logger.debug(
- String.format("Encountered illegal argument getting multicloud rest client %s", e.getMessage()));
+ logger.debug("Encountered illegal argument getting multicloud rest client ", e);
} catch (UriBuilderException e) {
- logger.debug(
- String.format("Encountered URI builder error getting multicloud rest client %s", e.getMessage()));
+ logger.debug("Encountered URI builder error getting multicloud rest client ", e);
}
return client;
}
@@ -989,7 +984,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
// There are lots of HeatStatus values, so this is a bit long...
HeatStatus heatStatus = stackInfo.getStatus();
String statusMessage = stackInfo.getStatusMessage();
- logger.debug("HeatStatus = " + heatStatus + " msg = " + statusMessage);
+ logger.debug("HeatStatus = {} msg = {}", heatStatus, statusMessage);
if (logger.isDebugEnabled()) {
logger.debug(String.format("Stack Status: %s", heatStatus.toString()));
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 069c6c7c5b..44fc620b07 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
@@ -130,13 +130,13 @@ public class MsoNeutronUtils extends MsoCommonUtils {
network.setAdminStateUp(true);
if (type == NetworkType.PROVIDER) {
- if (provider != null && vlans != null && vlans.size() > 0) {
+ if (provider != null && vlans != null && !vlans.isEmpty()) {
network.setProviderPhysicalNetwork(provider);
network.setProviderNetworkType("vlan");
network.setProviderSegmentationId(vlans.get(0));
}
} else if (type == NetworkType.MULTI_PROVIDER) {
- if (provider != null && vlans != null && vlans.size() > 0) {
+ if (provider != null && vlans != null && !vlans.isEmpty()) {
List<Segment> segments = new ArrayList<>(vlans.size());
for (int vlan : vlans) {
Segment segment = new Segment();
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
index ad37b39f30..c575304ade 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
@@ -40,7 +40,7 @@ public class MulticloudQueryResponse implements Serializable {
@JsonProperty("workload_status")
private String workloadStatus;
@JsonProperty("workload_status_reason")
- private JsonNode workloadStatusReason;
+ private transient JsonNode workloadStatusReason;
@JsonCreator
public MulticloudQueryResponse(@JsonProperty("template_type") String templateType,
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index e840d5affd..e68364eab8 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -322,8 +322,8 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
CreateStackParam createStackParam = new CreateStackParam();
createStackParam.setStackName("stackName");
- doReturn(mockResources).when(heatUtils).queryStackResources(cloudSiteId, tenantId, "stackName", 2);
- doNothing().when(novaClient).deleteKeyPair(cloudSiteId, tenantId, "KeypairName");
+ // doReturn(mockResources).when(heatUtils).queryStackResources(cloudSiteId, tenantId, "stackName", 2);
+ // doNothing().when(novaClient).deleteKeyPair(cloudSiteId, tenantId, "KeypairName");
doReturn(null).when(heatUtils).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
doReturn(createdStack).when(heatUtils).createStack(createStackParam, cloudSiteId, tenantId);
doReturn(createdStack).when(heatUtils).processCreateStack(cloudSiteId, tenantId, 120, true, createdStack,
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java
index c9f42d1550..1b8372291d 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java
@@ -59,20 +59,6 @@ public class SDNCServiceRequest extends SDNCRequestCommon implements Serializabl
// The SDNC service data specified by SDNC "agnostic" API
private String sdncServiceData;
- public SDNCServiceRequest() {}
-
- public SDNCServiceRequest(String bpNotificationUrl, String bpTimeout, String sdncRequestId, String sdncService,
- String sdncOperation, RequestInformation requestInformation, ServiceInformation serviceInformation,
- String sdncServiceDataType, String sndcServiceData) {
- super(bpNotificationUrl, bpTimeout, sdncRequestId);
- this.requestInformation = requestInformation;
- this.serviceInformation = serviceInformation;
- this.sdncService = sdncService;
- this.sdncOperation = sdncOperation;
- this.sdncServiceDataType = sdncServiceDataType;
- this.sdncServiceData = sndcServiceData;
- }
-
@JsonProperty("requestInformation")
@XmlElement(name = "requestInformation")
public RequestInformation getRequestInformation() {
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
index 469a7ad7e4..354c3d07f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
@@ -9,9 +9,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.
@@ -67,35 +67,35 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
public void migrate(Connection connection) throws Exception {
logger.debug("Starting migration for CloudConfig");
- CloudConfig cloudConfig = null;
+ CloudConfig cloudConfiguration = null;
// Try the override file
String configLocation = System.getProperty("spring.config.additional-location");
if (configLocation != null) {
try (InputStream stream = new FileInputStream(Paths.get(configLocation).normalize().toString())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
} catch (Exception e) {
logger.warn("Error Loading override.yaml", e);
}
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", configLocation);
// Try the application.yaml file
try (InputStream stream = R__CloudConfigMigration.class.getResourceAsStream(getApplicationYamlName())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", getApplicationYamlName());
}
}
- if (cloudConfig != null) {
- migrateCloudIdentity(cloudConfig.getIdentityServices().values(), connection);
- migrateCloudSite(cloudConfig.getCloudSites().values(), connection);
- migrateCloudifyManagers(cloudConfig.getCloudifyManagers().values(), connection);
+ if (cloudConfiguration != null) {
+ migrateCloudIdentity(cloudConfiguration.getIdentityServices().values(), connection);
+ migrateCloudSite(cloudConfiguration.getCloudSites().values(), connection);
+ migrateCloudifyManagers(cloudConfiguration.getCloudifyManagers().values(), connection);
}
}
@@ -110,13 +110,13 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
private CloudConfig loadCloudConfig(InputStream stream) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
R__CloudConfigMigration cloudConfigMigration = mapper.readValue(stream, R__CloudConfigMigration.class);
- CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig();
+ CloudConfig cloudConfiguration = cloudConfigMigration.getCloudConfig();
- if (cloudConfig != null) {
- cloudConfig.populateId();
+ if (cloudConfiguration != null) {
+ cloudConfiguration.populateId();
}
- return cloudConfig;
+ return cloudConfiguration;
}
private String getApplicationYamlName() {
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
index 79aad1ad1a..b43447f5c4 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
@@ -25,6 +25,7 @@ import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest;
import org.onap.so.adapters.catalogdb.rest.ServiceRestImpl;
+import org.onap.so.adapters.catalogdb.rest.VnfRestImpl;
import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
import org.springframework.context.annotation.Configuration;
import io.swagger.jaxrs.config.BeanConfig;
@@ -42,6 +43,7 @@ public class JerseyConfiguration extends ResourceConfig {
register(SwaggerSerializers.class);
register(JaxRsFilterLogging.class);
register(ServiceRestImpl.class);
+ register(VnfRestImpl.class);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.2");
beanConfig.setSchemes(new String[] {"https"});
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java
new file mode 100644
index 0000000000..f8a7ba6da4
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java
@@ -0,0 +1,14 @@
+package org.onap.so.adapters.catalogdb.rest;
+
+public class CatalogEntityNotFoundException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -300157844846680791L;
+
+ public CatalogEntityNotFoundException(String errorMessage) {
+ super(errorMessage);
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java
new file mode 100644
index 0000000000..c42eaabea7
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 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.catalogdb.rest;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Provider
+public class CatalogEntityNotFoundExceptionMapper implements ExceptionMapper<CatalogEntityNotFoundException> {
+
+ private static final Logger logger = LoggerFactory.getLogger(CatalogEntityNotFoundExceptionMapper.class);
+
+ @Override
+ public Response toResponse(CatalogEntityNotFoundException e) {
+ return Response.status(Response.Status.NOT_FOUND).entity(e).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 dd18767762..e74663dbba 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
@@ -22,9 +22,11 @@ package org.onap.so.adapters.catalogdb.rest;
import java.util.ArrayList;
import java.util.List;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.rest.catalog.beans.Cvnfc;
import org.onap.so.rest.catalog.beans.Service;
import org.onap.so.rest.catalog.beans.VfModule;
import org.onap.so.rest.catalog.beans.Vnf;
@@ -39,16 +41,23 @@ public class ServiceMapper {
public Service mapService(org.onap.so.db.catalog.beans.Service service, int depth) {
Service restService = new Service();
- restService.setCategory(service.getCategory());
+ if (service.getCategory() != null) {
+ restService.setCategory(service.getCategory());
+ }
restService.setCreated(service.getCreated());
restService.setDescription(service.getDescription());
- restService.setDistrobutionStatus(service.getDistrobutionStatus());
+
+ if (service.getDistrobutionStatus() != null) {
+ restService.setDistrobutionStatus(service.getDistrobutionStatus());
+ }
restService.setEnvironmentContext(service.getEnvironmentContext());
restService.setModelInvariantId(service.getModelInvariantUUID());
restService.setModelName(service.getModelName());
restService.setModelVersionId(service.getModelUUID());
restService.setModelVersion(service.getModelVersion());
- restService.setServiceRole(service.getServiceRole());
+ if (service.getServiceRole() != null) {
+ restService.setServiceRole(service.getServiceRole());
+ }
restService.setServiceType(service.getServiceType());
restService.setWorkloadContext(service.getWorkloadContext());
if (depth > 0)
@@ -63,7 +72,7 @@ public class ServiceMapper {
return vnfs;
}
- private Vnf mapVnf(org.onap.so.db.catalog.beans.VnfResourceCustomization vnfResourceCustomization, int depth) {
+ protected Vnf mapVnf(org.onap.so.db.catalog.beans.VnfResourceCustomization vnfResourceCustomization, int depth) {
Vnf vnf = new Vnf();
vnf.setAvailabilityZoneMaxCount(vnfResourceCustomization.getAvailabilityZoneMaxCount());
vnf.setCategory(vnfResourceCustomization.getVnfResources().getCategory());
@@ -81,9 +90,12 @@ public class ServiceMapper {
vnf.setNfFunction(vnfResourceCustomization.getNfFunction());
vnf.setNfNamingCode(vnfResourceCustomization.getNfNamingCode());
vnf.setNfRole(vnfResourceCustomization.getNfRole());
+ vnf.setNfType(vnfResourceCustomization.getNfType());
+ vnf.setNfDataValid(vnfResourceCustomization.getNfDataValid());
vnf.setOrchestrationMode(vnfResourceCustomization.getVnfResources().getOrchestrationMode());
vnf.setSubCategory(vnfResourceCustomization.getVnfResources().getSubCategory());
vnf.setToscaNodeType(vnfResourceCustomization.getVnfResources().getToscaNodeType());
+
if (depth > 1) {
vnf.setVfModule(mapVfModules(vnfResourceCustomization, depth));
}
@@ -93,11 +105,11 @@ public class ServiceMapper {
private List<VfModule> mapVfModules(VnfResourceCustomization vnfResourceCustomization, int depth) {
List<VfModule> vfModules = new ArrayList<>();
vnfResourceCustomization.getVfModuleCustomizations().parallelStream()
- .forEach(vfModule -> vfModules.add(mapVfModule(vfModule)));
+ .forEach(vfModule -> vfModules.add(mapVfModule(vfModule, depth)));
return vfModules;
}
- private VfModule mapVfModule(VfModuleCustomization vfModuleCust) {
+ private VfModule mapVfModule(VfModuleCustomization vfModuleCust, int depth) {
VfModule vfModule = new VfModule();
vfModule.setAvailabilityZoneCount(vfModuleCust.getAvailabilityZoneCount());
vfModule.setCreated(vfModuleCust.getCreated());
@@ -113,9 +125,34 @@ public class ServiceMapper {
vfModule.setModelName(vfModuleCust.getVfModule().getModelName());
vfModule.setModelVersionId(vfModuleCust.getVfModule().getModelUUID());
vfModule.setModelVersion(vfModuleCust.getVfModule().getModelVersion());
+ if (depth > 3) {
+ vfModule.setVnfc(mapCvnfcs(vfModuleCust));
+ }
return vfModule;
}
+ private List<Cvnfc> mapCvnfcs(VfModuleCustomization vfModuleCustomization) {
+ List<Cvnfc> cvnfcs = new ArrayList<>();
+ vfModuleCustomization.getCvnfcCustomization().parallelStream()
+ .forEach(cvnfcCust -> cvnfcs.add(mapCvnfcCus(cvnfcCust)));
+ return cvnfcs;
+ }
+
+ private Cvnfc mapCvnfcCus(CvnfcCustomization cvnfcCust) {
+ Cvnfc cvnfc = new Cvnfc();
+ cvnfc.setCreated(cvnfcCust.getCreated());
+ cvnfc.setDescription(cvnfcCust.getDescription());
+ cvnfc.setModelCustomizationId(cvnfcCust.getModelCustomizationUUID());
+ cvnfc.setModelInstanceName(cvnfcCust.getModelInstanceName());
+ cvnfc.setModelInvariantId(cvnfcCust.getModelInvariantUUID());
+ cvnfc.setModelName(cvnfcCust.getModelName());
+ cvnfc.setModelVersion(cvnfcCust.getModelVersion());
+ cvnfc.setModelVersionId(cvnfcCust.getModelUUID());
+ cvnfc.setNfcFunction(cvnfcCust.getNfcFunction());
+ cvnfc.setNfcNamingCode(cvnfcCust.getNfcNamingCode());
+ return cvnfc;
+ }
+
private boolean getIsVolumeGroup(VfModuleCustomization vfModuleCust) {
boolean isVolumeGroup = false;
HeatEnvironment envt = vfModuleCust.getVolumeHeatEnv();
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
index 520de4d38c..6f556edfa1 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
@@ -38,7 +38,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
-@Api(value = "/v1/services", tags = "model")
+@Api(value = "/v1", tags = "model")
@Path("/v1/services")
@Component
public class ServiceRestImpl {
@@ -49,18 +49,21 @@ public class ServiceRestImpl {
@Autowired
private ServiceMapper serviceMapper;
+
@GET
@Path("/{modelUUID}")
@Produces({MediaType.APPLICATION_JSON})
@Transactional(readOnly = true)
public Service findService(@PathParam("modelUUID") String modelUUID, @QueryParam("depth") int depth) {
org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(modelUUID);
+ if (service == null) {
+ new CatalogEntityNotFoundException("Unable to find Service " + modelUUID);
+ }
return serviceMapper.mapService(service, depth);
}
@GET
- @ApiOperation(value = "Find Service Models", response = Service.class, responseContainer = "List",
- notes = "If no query parameters are sent an empty list will be returned")
+ @ApiOperation(value = "Find Service Models", response = Service.class, responseContainer = "List")
@Produces({MediaType.APPLICATION_JSON})
@Transactional(readOnly = true)
public List<Service> queryServices(
@@ -74,6 +77,8 @@ public class ServiceRestImpl {
serviceFromDB = serviceRepo.findByModelNameAndDistrobutionStatus(modelName, distributionStatus);
} else if (!Strings.isNullOrEmpty(modelName)) {
serviceFromDB = serviceRepo.findByModelName(modelName);
+ } else {
+ serviceFromDB = serviceRepo.findAll();
}
serviceFromDB.stream().forEach(serviceDB -> services.add(serviceMapper.mapService(serviceDB, depth)));
return services;
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java
new file mode 100644
index 0000000000..52a8ccb5a7
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java
@@ -0,0 +1,37 @@
+package org.onap.so.adapters.catalogdb.rest;
+
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.rest.catalog.beans.Vnf;
+import org.springframework.stereotype.Component;
+import com.google.common.base.Strings;
+
+@Component
+public class VnfMapper {
+
+ public VnfResourceCustomization mapVnf(VnfResourceCustomization vnfCust, Vnf vnf) {
+
+ vnfCust.setAvailabilityZoneMaxCount(vnf.getAvailabilityZoneMaxCount());
+ vnfCust.setMaxInstances(vnf.getMaxInstances());
+ vnfCust.setMinInstances(vnf.getMinInstances());
+ vnfCust.setModelCustomizationUUID(vnf.getModelCustomizationId());
+ vnfCust.setModelInstanceName(vnf.getModelInstanceName());
+ vnfCust.setMultiStageDesign(vnf.getMultiStageDesign());
+ vnfCust.setNfDataValid(vnf.getNfDataValid());
+ vnfCust.setNfFunction(Strings.nullToEmpty(vnf.getNfFunction()));
+ vnfCust.setNfNamingCode(Strings.nullToEmpty(vnf.getNfNamingCode()));
+ vnfCust.setNfRole(Strings.nullToEmpty(vnf.getNfRole()));
+ vnfCust.setNfType(Strings.nullToEmpty(vnf.getNfType()));
+
+ VnfResource vnfRes = vnfCust.getVnfResources();
+ vnfRes.setOrchestrationMode(Strings.nullToEmpty(vnfRes.getOrchestrationMode()));
+ vnfRes.setSubCategory(Strings.nullToEmpty(vnfRes.getSubCategory()));
+ vnfRes.setToscaNodeType(Strings.nullToEmpty(vnfRes.getToscaNodeType()));
+ vnfRes.setModelInvariantUUID(vnfRes.getModelInvariantId());
+ vnfRes.setModelName(vnfRes.getModelName());
+ vnfRes.setModelUUID(vnfRes.getModelUUID());
+ vnfRes.setModelVersion(vnfRes.getModelVersion());
+ return vnfCust;
+ }
+
+}
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
new file mode 100644
index 0000000000..4353526872
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
@@ -0,0 +1,107 @@
+/*-
+ * ============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.catalogdb.rest;
+
+import java.util.List;
+import java.util.stream.Collectors;
+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;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+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.Vnf;
+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;
+
+@Api(value = "/v1/services/{modelUUID}/vnfs", tags = "model")
+@Path("/v1/services/{modelUUID}/vnfs")
+@Component
+public class VnfRestImpl {
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private ServiceMapper serviceMapper;
+
+ @Autowired
+ private VnfMapper vnfMapper;
+
+ @Autowired
+ private VnfCustomizationRepository vnfCustRepo;
+
+ @GET
+ @ApiOperation(value = "Find a VNF model contained within a service", response = Vnf.class)
+ @Path("/{modelCustomizationUUID}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Vnf findService(@PathParam("modelUUID") String serviceModelUUID,
+ @PathParam("modelCustomizationUUID") String modelCustomizationUUID, @QueryParam("depth") int depth) {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(serviceModelUUID);
+ if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
+ throw new WebApplicationException("Vnf Not Found", 404);
+ }
+ List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream()
+ .filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID))
+ .collect(Collectors.toList());
+ if (vnfCustom.isEmpty() || vnfCustom == null) {
+ return null;
+ } else if (vnfCustom.size() > 1) {
+ throw new RuntimeException(
+ "More than one Vnf model returned with model Customization UUID: " + modelCustomizationUUID);
+ }
+ return serviceMapper.mapVnf(vnfCustom.get(0), depth);
+ }
+
+ @PUT
+ @ApiOperation(value = "Update a VNF model contained within a service", response = Vnf.class)
+ @Path("/{modelCustomizationUUID}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional
+ public Response findService(@PathParam("modelUUID") String serviceModelUUID,
+ @PathParam("modelCustomizationUUID") String modelCustomizationUUID, Vnf vnf) {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(serviceModelUUID);
+ List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream()
+ .filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID))
+ .collect(Collectors.toList());
+ if (vnfCustom.isEmpty() || vnfCustom == null) {
+ throw new RuntimeException("No Vnf Found");
+ } else if (vnfCustom.size() > 1) {
+ throw new RuntimeException(
+ "More than one Vnf model returned with model Customization UUID: " + modelCustomizationUUID);
+ }
+ VnfResourceCustomization vnfCust = vnfMapper.mapVnf(vnfCustom.get(0), vnf);
+ vnfCustRepo.save(vnfCust);
+ return Response.ok().build();
+ }
+
+}
+
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 486b53cf8a..13d736e747 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
@@ -813,3 +813,5 @@ VALUES
('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM');
UPDATE rainy_day_handler_macro SET reg_ex_error_message = '*' WHERE reg_ex_error_message IS null;
+
+UPDATE rainy_day_handler_macro SET SERVICE_ROLE = '*' WHERE SERVICE_ROLE IS null;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
index 5d940fb9ea..8e52fbeeaf 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
@@ -30,3 +30,8 @@ resources:
INSERT INTO `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`, `HEAT_TEMPLATE_ARTIFACT_UUID`,`AIC_VERSION_MIN` , `AIC_VERSION_MAX` )
VALUES ('Generic NeutronNet','efee1d84-b8ec-11e7-abc4-cec278b6b50a','2.0','3.0');
+INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`)
+VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'network_name', 0, 'String', NULL);
+
+INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`)
+VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'shared', 0, 'Boolean', NULL);
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql
new file mode 100644
index 0000000000..8fe3caf88f
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql
@@ -0,0 +1,2 @@
+use catalogdb;
+ALTER TABLE rainy_day_handler_macro ADD COLUMN IF NOT EXISTS SERVICE_ROLE varchar(300) DEFAULT NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql
new file mode 100644
index 0000000000..93dde1341e
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql
@@ -0,0 +1,5 @@
+USE catalogdb;
+
+ALTER TABLE vnf_resource_customization
+ADD IF NOT EXISTS NF_DATA_VALID tinyint(1) DEFAULT 0;
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql
new file mode 100644
index 0000000000..6f61b830f2
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql
@@ -0,0 +1,3 @@
+USE catalogdb;
+
+ALTER TABLE controller_selection_reference MODIFY ACTION_CATEGORY VARCHAR(50) NOT NULL;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql
new file mode 100644
index 0000000000..30b5010c7c
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql
@@ -0,0 +1,47 @@
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE)
+VALUES
+
+('CONFIGURATION', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('CONFIGURATION', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('CONFIGURATION', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('CONFIGURATION', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+
+('NETWORK', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('NETWORK', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('NETWORK', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('NETWORK', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('NETWORK', 'ACTIVATED', 'CREATE', 'SILENT_SUCCESS'),
+('NETWORK', 'ACTIVATED', 'DELETE', 'FAIL'),
+('NETWORK', 'ACTIVATED', 'UPDATE', 'CONTINUE'),
+('NETWORK_COLLECTION', 'ACTIVATED', 'CREATE', 'FAIL'),
+('NETWORK_COLLECTION', 'ACTIVATED', 'DELETE', 'CONTINUE'),
+('NETWORK_COLLECTION', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+
+('NO_VALIDATE', 'ACTIVATED', 'CUSTOM', 'CONTINUE'),
+
+('SERVICE', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('SERVICE', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('SERVICE', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('SERVICE', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('SERVICE', 'ACTIVATED', 'CHANGE_MODEL', 'CONTINUE'),
+
+('VF_MODULE', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('VF_MODULE', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('VF_MODULE', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('VF_MODULE', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('VF_MODULE', 'ACTIVATED', 'CHANGE_MODEL', 'CONTINUE'),
+('VF_MODULE', 'ACTIVATED', 'CREATE', 'SILENT_SUCCESS'),
+('VF_MODULE', 'ACTIVATED', 'DELETE', 'FAIL'),
+
+('VNF', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('VNF', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('VNF', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('VNF', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('VNF', 'ACTIVATED', 'CHANGE_MODEL', 'CONTINUE'),
+
+('VOLUME_GROUP', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('VOLUME_GROUP', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('VOLUME_GROUP', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('VOLUME_GROUP', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('VOLUME_GROUP', 'ACTIVATED', 'CREATE', 'SILENT_SUCCESS'),
+('VOLUME_GROUP', 'ACTIVATED', 'DELETE', 'FAIL'); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
index 8decd77656..d46fd9c7ba 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
@@ -67,6 +67,7 @@ public class ServiceMapperTest {
testService.setModelVersion("modelVersion");
testService.setServiceType("serviceType");
testService.setServiceRole("serviceRole");
+
testService.getVnfCustomizations().add(getTestVnfCustomization());
return testService;
}
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 f65f521605..f82c7acd38 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
@@ -22,15 +22,14 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.UUID;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.so.adapters.catalogdb.CatalogDBApplication;
import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.AuthenticationType;
import org.onap.so.db.catalog.beans.CloudIdentity;
@@ -56,10 +55,7 @@ import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@@ -74,6 +70,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Autowired
CatalogDbClientPortChanger client;
+
+
@Before
public void initialize() {
client.wiremockPort = String.valueOf(port);
@@ -87,114 +85,115 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void testGetRainyDayHandler_Regex() {
RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
- "*", "*", "*", "The Flavor ID (nd.c6r16d20) could not be found.");
- Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
+ "*", "*", "*", "The Flavor ID (nd.c6r16d20) could not be found.", "*");
+ assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
@Test
public void testGetRainyDayHandler__Encoding_Regex() {
RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
"*", "*", "*",
- "resources.lba_0_dmz_vmi_0: Unknown id: Error: oper 1 url /fqname-to-id body {\"fq_name\": [\"zrdm6bvota05-dmz_sec_group\"], \"type\": \"security-group\"} response Name ['zrdm6bvota05-dmz_sec_group'] not found");
- Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
+ "resources.lba_0_dmz_vmi_0: Unknown id: Error: oper 1 url /fqname-to-id body {\"fq_name\": [\"zrdm6bvota05-dmz_sec_group\"], \"type\": \"security-group\"} response Name ['zrdm6bvota05-dmz_sec_group'] not found",
+ "*");
+ assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
@Test
public void testGetCloudSiteHappyPath() throws Exception {
CloudSite cloudSite = client.getCloudSite(MTN13);
- Assert.assertNotNull(cloudSite);
- Assert.assertNotNull(cloudSite.getIdentityService());
- Assert.assertEquals("MDT13", cloudSite.getClli());
- Assert.assertEquals("mtn13", cloudSite.getRegionId());
- Assert.assertEquals("MTN13", cloudSite.getIdentityServiceId());
+ assertNotNull(cloudSite);
+ assertNotNull(cloudSite.getIdentityService());
+ assertEquals("MDT13", cloudSite.getClli());
+ assertEquals("mtn13", cloudSite.getRegionId());
+ assertEquals("MTN13", cloudSite.getIdentityServiceId());
}
@Test
public void testGetCloudSiteNotFound() throws Exception {
CloudSite cloudSite = client.getCloudSite(UUID.randomUUID().toString());
- Assert.assertNull(cloudSite);
+ assertNull(cloudSite);
}
@Test
public void testGetCloudifyManagerHappyPath() throws Exception {
CloudifyManager cloudifyManager = client.getCloudifyManager("mtn13");
- Assert.assertNotNull(cloudifyManager);
- Assert.assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
+ assertNotNull(cloudifyManager);
+ assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
}
@Test
public void testGetCloudifyManagerNotFound() throws Exception {
CloudifyManager cloudifyManager = client.getCloudifyManager(UUID.randomUUID().toString());
- Assert.assertNull(cloudifyManager);
+ assertNull(cloudifyManager);
}
@Test
public void testGetCloudSiteByClliAndAicVersionHappyPath() throws Exception {
CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "2.5");
- Assert.assertNotNull(cloudSite);
+ assertNotNull(cloudSite);
}
@Test
public void testGetCloudSiteByClliAndAicVersionNotFound() throws Exception {
CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "232496239746328");
- Assert.assertNull(cloudSite);
+ assertNull(cloudSite);
}
@Test
public void testGetServiceByID() throws Exception {
Service serviceByID = client.getServiceByID("5df8b6de-2083-11e7-93ae-92361f002671");
- Assert.assertNotNull(serviceByID);
- Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
- Assert.assertEquals("NA", serviceByID.getServiceType());
- Assert.assertEquals("NA", serviceByID.getServiceRole());
+ assertNotNull(serviceByID);
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
+ assertEquals("NA", serviceByID.getServiceType());
+ assertEquals("NA", serviceByID.getServiceRole());
}
@Test
public void testGetServiceByIDNotFound() throws Exception {
Service serviceByID = client.getServiceByID(UUID.randomUUID().toString());
- Assert.assertNull(serviceByID);
+ assertNull(serviceByID);
}
@Test
public void testGetVfModuleByModelUUID() throws Exception {
VfModule vfModule = client.getVfModuleByModelUUID("20c4431c-246d-11e7-93ae-92361f002671");
- Assert.assertNotNull(vfModule);
- Assert.assertNotNull(vfModule.getVfModuleCustomization());
- Assert.assertEquals("78ca26d0-246d-11e7-93ae-92361f002671", vfModule.getModelInvariantUUID());
- Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
+ assertNotNull(vfModule);
+ assertNotNull(vfModule.getVfModuleCustomization());
+ assertEquals("78ca26d0-246d-11e7-93ae-92361f002671", vfModule.getModelInvariantUUID());
+ assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
}
@Test
public void testGetVfModuleByModelUUIDNotFound() throws Exception {
VfModule vfModule = client.getVfModuleByModelUUID(UUID.randomUUID().toString());
- Assert.assertNull(vfModule);
+ assertNull(vfModule);
}
@Test
public void testGetVnfResourceByModelUUID() throws Exception {
VnfResource vnfResource = client.getVnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
- Assert.assertNotNull(vnfResource);
- Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
+ assertNotNull(vnfResource);
+ assertEquals("vSAMP10a", vnfResource.getModelName());
}
@Test
public void testGetVnfResourceByModelUUIDNotFound() throws Exception {
VnfResource vnfResource = client.getVnfResourceByModelUUID(UUID.randomUUID().toString());
- Assert.assertNull(vnfResource);
+ assertNull(vnfResource);
}
@Test
public void testGetVnfResourceCustomizationByModelCustomizationUUID() {
VnfResourceCustomization vnfResourceCustomization =
client.getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
- Assert.assertNotNull(vnfResourceCustomization);
- Assert.assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
- Assert.assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
- Assert.assertNotNull(vnfResourceCustomization.getVnfResources());
- Assert.assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
- Assert.assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
+ assertNotNull(vnfResourceCustomization);
+ assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
+ assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
+ assertNotNull(vnfResourceCustomization.getVnfResources());
+ assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
+ assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
assertTrue("skip post instantiation configuration", vnfResourceCustomization.isSkipPostInstConf());
}
@@ -202,15 +201,15 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void testGetVnfResourceCustomizationByModelCustomizationUUINotFound() {
VnfResourceCustomization vnfResourceCustomization =
client.getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(vnfResourceCustomization);
+ assertNull(vnfResourceCustomization);
}
@Test
public void testGetInstanceGroupByModelUUID() {
InstanceGroup instanceGroup = client.getInstanceGroupByModelUUID("0c8692ef-b9c0-435d-a738-edf31e71f38b");
- Assert.assertNotNull(instanceGroup);
- Assert.assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
- Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806",
+ assertNotNull(instanceGroup);
+ assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
+ assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806",
instanceGroup.getToscaNodeType().toString());
}
@@ -218,33 +217,33 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void testGetVfModuleCustomizationByModelCuztomizationUUID() {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
- Assert.assertNotNull(vfModuleCustomization);
- Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
- Assert.assertEquals("base", vfModuleCustomization.getLabel());
+ assertNotNull(vfModuleCustomization);
+ assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
+ assertEquals("base", vfModuleCustomization.getLabel());
}
@Test
public void testGetVfModuleCustomizationByModelCuztomizationUUIDNotFound() {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(vfModuleCustomization);
+ assertNull(vfModuleCustomization);
}
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUID() {
NetworkResourceCustomization networkResourceCustomization =
client.getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac");
- Assert.assertNotNull(networkResourceCustomization);
- Assert.assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
- Assert.assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
- Assert.assertNotNull(networkResourceCustomization.getNetworkResource());
+ assertNotNull(networkResourceCustomization);
+ assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
+ assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
+ assertNotNull(networkResourceCustomization.getNetworkResource());
}
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUIDNotFound() {
NetworkResourceCustomization networkResourceCustomization =
client.getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(networkResourceCustomization);
+ assertNull(networkResourceCustomization);
}
@Test
@@ -252,10 +251,10 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
"cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672");
- Assert.assertNotNull(vfModuleCustomization);
- Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
- Assert.assertNotNull(vfModuleCustomization.getVfModule());
- Assert.assertEquals("base", vfModuleCustomization.getLabel());
+ assertNotNull(vfModuleCustomization);
+ assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
+ assertNotNull(vfModuleCustomization.getVfModule());
+ assertEquals("base", vfModuleCustomization.getLabel());
}
@Test
@@ -263,44 +262,43 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
"cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString());
- Assert.assertNull(vfModuleCustomization);
+ assertNull(vfModuleCustomization);
}
@Test
public void testGetFirstByServiceModelUUIDAndAction() {
ServiceRecipe serviceRecipe =
client.getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance");
- Assert.assertNotNull(serviceRecipe);
- Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
- Assert.assertNotNull(serviceRecipe.getAction());
- Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
- serviceRecipe.getOrchestrationUri());
- Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
+ assertNotNull(serviceRecipe);
+ assertNotNull(serviceRecipe.getServiceModelUUID());
+ assertNotNull(serviceRecipe.getAction());
+ assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testGetFirstByServiceModelUUIDAndActionNotFound() {
ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671",
UUID.randomUUID().toString());
- Assert.assertNull(serviceRecipe);
+ assertNull(serviceRecipe);
}
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersion() {
VnfResource vnfResource = client
.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0");
- Assert.assertNotNull(vnfResource);
- Assert.assertNotNull(vnfResource.getModelInvariantId());
- Assert.assertNotNull(vnfResource.getModelVersion());
- Assert.assertNotNull(vnfResource.getHeatTemplates());
- Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
+ assertNotNull(vnfResource);
+ assertNotNull(vnfResource.getModelInvariantId());
+ assertNotNull(vnfResource.getModelVersion());
+ assertNotNull(vnfResource.getHeatTemplates());
+ assertEquals("vSAMP10a", vnfResource.getModelName());
}
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersionNotFound() {
VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(
"2fff5b20-214b-11e7-93ae-92361f002671", UUID.randomUUID().toString());
- Assert.assertNull(vnfResource);
+ assertNull(vnfResource);
}
@Test
@@ -309,29 +307,28 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
vnfr.setModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources =
client.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr);
- Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
- Assert.assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
- Assert.assertEquals("vSAMP10a 1",
+ assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
+ assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
+ assertEquals("vSAMP10a 1",
firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName());
- Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
- Assert.assertNotNull(
- firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
+ assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
+ assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
}
@Test
public void testGetFirstVnfRecipeByNfRoleAndAction() {
VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction("GR-API-DEFAULT", "createInstance");
- Assert.assertNotNull(vnfRecipe);
- Assert.assertNotNull(vnfRecipe.getNfRole());
- Assert.assertNotNull(vnfRecipe.getAction());
- Assert.assertEquals("Gr api recipe to create vnf", vnfRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfRecipe.getOrchestrationUri());
+ assertNotNull(vnfRecipe);
+ assertNotNull(vnfRecipe.getNfRole());
+ assertNotNull(vnfRecipe.getAction());
+ assertEquals("Gr api recipe to create vnf", vnfRecipe.getDescription());
+ assertEquals("/mso/async/services/WorkflowActionBB", vnfRecipe.getOrchestrationUri());
}
@Test
public void testGetFirstVnfRecipeByNfRoleAndActionNotFound() {
VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction(UUID.randomUUID().toString(), "createInstance");
- Assert.assertNull(vnfRecipe);
+ assertNull(vnfRecipe);
}
@Test
@@ -339,12 +336,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VnfComponentsRecipe vnfComponentsRecipe =
client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
"20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance");
- Assert.assertNotNull(vnfComponentsRecipe);
- Assert.assertNotNull(vnfComponentsRecipe.getAction());
- Assert.assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
- Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
- Assert.assertEquals("Gr api recipe to create volume-group", vnfComponentsRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfComponentsRecipe.getOrchestrationUri());
+ assertNotNull(vnfComponentsRecipe);
+ assertNotNull(vnfComponentsRecipe.getAction());
+ assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
+ assertNotNull(vnfComponentsRecipe.getVnfComponentType());
+ assertEquals("Gr api recipe to create volume-group", vnfComponentsRecipe.getDescription());
+ assertEquals("/mso/async/services/WorkflowActionBB", vnfComponentsRecipe.getOrchestrationUri());
}
@@ -354,80 +351,79 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VnfComponentsRecipe vnfComponentsRecipe =
client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
UUID.randomUUID().toString(), "volumeGroup", "createInstance");
- Assert.assertNull(vnfComponentsRecipe);
+ assertNull(vnfComponentsRecipe);
}
@Test
public void testGetFirstVnfComponentsRecipeByVnfComponentTypeAndAction() {
VnfComponentsRecipe vnfComponentsRecipe =
client.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance");
- Assert.assertNotNull(vnfComponentsRecipe);
- Assert.assertNotNull(vnfComponentsRecipe.getAction());
- Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
- Assert.assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1",
- vnfComponentsRecipe.getOrchestrationUri());
+ assertNotNull(vnfComponentsRecipe);
+ assertNotNull(vnfComponentsRecipe.getAction());
+ assertNotNull(vnfComponentsRecipe.getVnfComponentType());
+ assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
+ assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri());
}
@Test
public void testGetServiceByModelVersionAndModelInvariantUUID() {
Service service =
client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
- Assert.assertNotNull(service);
- Assert.assertNotNull(service.getModelVersion());
- Assert.assertNotNull(service.getModelInvariantUUID());
- Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
- Assert.assertEquals("NA", service.getServiceRole());
+ assertNotNull(service);
+ assertNotNull(service.getModelVersion());
+ assertNotNull(service.getModelInvariantUUID());
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
+ assertEquals("NA", service.getServiceRole());
}
@Test
public void testGetServiceByModelVersionAndModelInvariantUUIDNotFound() {
Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", UUID.randomUUID().toString());
- Assert.assertNull(service);
+ assertNull(service);
}
@Test
public void testGetVfModuleByModelInvariantUUIDAndModelVersion() {
VfModule vfModule =
client.getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2");
- Assert.assertNotNull(vfModule);
- Assert.assertNotNull(vfModule.getModelVersion());
- Assert.assertNotNull(vfModule.getModelInvariantUUID());
- Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
- Assert.assertEquals("vSAMP10a DEV Base", vfModule.getDescription());
+ assertNotNull(vfModule);
+ assertNotNull(vfModule.getModelVersion());
+ assertNotNull(vfModule.getModelInvariantUUID());
+ assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
+ assertEquals("vSAMP10a DEV Base", vfModule.getDescription());
}
@Test
public void testGetVfModuleByModelInvariantUUIDAndModelVersionNotFound() {
VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion(UUID.randomUUID().toString(), "2");
- Assert.assertNull(vfModule);
+ assertNull(vfModule);
}
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDesc() {
List<Service> serviceList =
client.getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
- Assert.assertFalse(serviceList.isEmpty());
- Assert.assertEquals(2, serviceList.size());
+ assertFalse(serviceList.isEmpty());
+ assertEquals(2, serviceList.size());
Service service = serviceList.get(0);
- Assert.assertEquals("2.0", service.getModelVersion());
+ assertEquals("2.0", service.getModelVersion());
}
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDescNotFound() {
List<Service> serviceList =
client.getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString());
- Assert.assertTrue(serviceList.isEmpty());
+ assertTrue(serviceList.isEmpty());
}
@Test
public void testGetVfModuleByModelInvariantUUIDOrderByModelVersionDesc() {
List<VfModule> moduleList =
client.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671");
- Assert.assertFalse(moduleList.isEmpty());
- Assert.assertEquals(2, moduleList.size());
+ assertFalse(moduleList.isEmpty());
+ assertEquals(2, moduleList.size());
VfModule module = moduleList.get(0);
- Assert.assertEquals("vSAMP10a DEV Base", module.getDescription());
+ assertEquals("vSAMP10a DEV Base", module.getDescription());
}
@Test
@@ -453,20 +449,20 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
cloudSite.setIdentityService(cloudIdentity);
localClient.postCloudSite(cloudSite);
CloudSite getCloudSite = this.client.getCloudSite("MTN6");
- Assert.assertNotNull(getCloudSite);
- Assert.assertNotNull(getCloudSite.getIdentityService());
- Assert.assertEquals("TESTCLLI", getCloudSite.getClli());
- Assert.assertEquals("regionId", getCloudSite.getRegionId());
- Assert.assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
+ assertNotNull(getCloudSite);
+ assertNotNull(getCloudSite.getIdentityService());
+ assertEquals("TESTCLLI", getCloudSite.getClli());
+ assertEquals("regionId", getCloudSite.getRegionId());
+ assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
}
@Test
public void testGetHomingInstance() {
HomingInstance homingInstance = client.getHomingInstance("5df8b6de-2083-11e7-93ae-92361f232671");
- Assert.assertNotNull(homingInstance);
- Assert.assertNotNull(homingInstance.getCloudOwner());
- Assert.assertNotNull(homingInstance.getCloudRegionId());
- Assert.assertNotNull(homingInstance.getOofDirectives());
+ assertNotNull(homingInstance);
+ assertNotNull(homingInstance.getCloudOwner());
+ assertNotNull(homingInstance.getCloudRegionId());
+ assertNotNull(homingInstance.getOofDirectives());
}
@Test
@@ -490,43 +486,43 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
+ "\"id\": \"vsink\"\n" + "}\n" + "]\n" + "}");
localClient.postHomingInstance(homingInstance);
HomingInstance getHomingInstance = this.client.getHomingInstance("5df8d6be-2083-11e7-93ae-92361f232671");
- Assert.assertNotNull(getHomingInstance);
- Assert.assertNotNull(getHomingInstance.getCloudRegionId());
- Assert.assertNotNull(getHomingInstance.getCloudOwner());
- Assert.assertEquals("CloudOwner-1", getHomingInstance.getCloudOwner());
- Assert.assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId());
+ assertNotNull(getHomingInstance);
+ assertNotNull(getHomingInstance.getCloudRegionId());
+ assertNotNull(getHomingInstance.getCloudOwner());
+ assertEquals("CloudOwner-1", getHomingInstance.getCloudOwner());
+ assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId());
}
@Test
public void testGetServiceByModelName() {
Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service");
- Assert.assertNotNull(service);
- Assert.assertNotNull(service.getModelVersion());
- Assert.assertNotNull(service.getModelInvariantUUID());
- Assert.assertEquals("MSOTADevInfra_Test_Service", service.getModelName());
- Assert.assertEquals("NA", service.getServiceRole());
+ assertNotNull(service);
+ assertNotNull(service.getModelVersion());
+ assertNotNull(service.getModelInvariantUUID());
+ assertEquals("MSOTADevInfra_Test_Service", service.getModelName());
+ assertEquals("NA", service.getServiceRole());
}
@Test
public void testGetServiceByModelNameNotFound() {
Service service = client.getServiceByModelName("Not_Found");
- Assert.assertNull(service);
+ assertNull(service);
}
@Test
public void testGetServiceByModelUUID() {
Service service = client.getServiceByModelUUID("5df8b6de-2083-11e7-93ae-92361f002679");
- Assert.assertNotNull(service);
- Assert.assertNotNull(service.getModelVersion());
- Assert.assertNotNull(service.getModelInvariantUUID());
- Assert.assertEquals("5df8b6de-2083-11e7-93ae-92361f002679", service.getModelUUID());
- Assert.assertEquals("NA", service.getServiceRole());
+ assertNotNull(service);
+ assertNotNull(service.getModelVersion());
+ assertNotNull(service.getModelInvariantUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002679", service.getModelUUID());
+ assertEquals("NA", service.getServiceRole());
}
@Test
public void testGetServiceByModelUUIDNotFound() {
Service service = client.getServiceByModelUUID("Not_Found");
- Assert.assertNull(service);
+ assertNull(service);
}
@Test
@@ -538,53 +534,52 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
northBoundRequest.setCloudOwner("my-custom-cloud-owner");
client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true,
"my-custom-cloud-owner");
- Assert.assertNotNull(northBoundRequest);
- Assert.assertEquals("createService", northBoundRequest.getAction());
- Assert.assertEquals("service", northBoundRequest.getRequestScope());
- Assert.assertEquals(true, northBoundRequest.getIsAlacarte());
- Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner());
+ assertNotNull(northBoundRequest);
+ assertEquals("createService", northBoundRequest.getAction());
+ assertEquals("service", northBoundRequest.getRequestScope());
+ assertEquals(true, northBoundRequest.getIsAlacarte());
+ assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner());
}
@Test
public void testFindServiceRecipeByActionAndServiceModelUUID() {
ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance",
"4694a55f-58b3-4f17-92a5-796d6f5ffd0d");
- Assert.assertNotNull(serviceRecipe);
- Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
- Assert.assertNotNull(serviceRecipe.getAction());
- Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
- serviceRecipe.getOrchestrationUri());
- Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
+ assertNotNull(serviceRecipe);
+ assertNotNull(serviceRecipe.getServiceModelUUID());
+ assertNotNull(serviceRecipe.getAction());
+ assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testFindServiceRecipeByActionAndServiceModelUUIDNotFound() {
ServiceRecipe serviceRecipe =
client.findServiceRecipeByActionAndServiceModelUUID("not_found", "5df8b6de-2083-11e7-93ae-test");
- Assert.assertNull(serviceRecipe);
+ assertNull(serviceRecipe);
}
@Test
public void testFindExternalToInternalServiceByServiceName() {
ExternalServiceToInternalService externalServiceToInternalService =
client.findExternalToInternalServiceByServiceName("MySpecialServiceName");
- Assert.assertNotNull(externalServiceToInternalService);
- Assert.assertNotNull(externalServiceToInternalService.getServiceName());
- Assert.assertNotNull(externalServiceToInternalService.getServiceModelUUID());
- Assert.assertEquals("MySpecialServiceName", externalServiceToInternalService.getServiceName());
+ assertNotNull(externalServiceToInternalService);
+ assertNotNull(externalServiceToInternalService.getServiceName());
+ assertNotNull(externalServiceToInternalService.getServiceModelUUID());
+ assertEquals("MySpecialServiceName", externalServiceToInternalService.getServiceName());
}
@Test
public void testFindExternalToInternalServiceByServiceNameNotFound() {
ExternalServiceToInternalService externalServiceToInternalService =
client.findExternalToInternalServiceByServiceName("Not_Found");
- Assert.assertNull(externalServiceToInternalService);
+ assertNull(externalServiceToInternalService);
}
@Test
public void getPnfResourceByModelUUID_validUuid_expectedOutput() {
PnfResource pnfResource = client.getPnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002680");
- Assert.assertNotNull(pnfResource);
+ assertNotNull(pnfResource);
assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
pnfResource.getModelInvariantUUID());
@@ -595,7 +590,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getPnfResourceByModelUUID_invalidUuid_NullOutput() {
PnfResource pnfResource = client.getPnfResourceByModelUUID(UUID.randomUUID().toString());
- Assert.assertNull(pnfResource);
+ assertNull(pnfResource);
}
@Test
@@ -619,7 +614,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void getPnfResourceCustomizationByModelCustomizationUUID_invalidUuid_nullOutput() {
PnfResourceCustomization pnfResourceCustomization =
client.getPnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(pnfResourceCustomization);
+ assertNull(pnfResourceCustomization);
}
@Test
@@ -650,6 +645,53 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
@Test
+ public void testGetServiceTopologyById() throws Exception {
+ org.onap.so.rest.catalog.beans.Service serviceByID =
+ client.getServiceModelInformation("5df8b6de-2083-11e7-93ae-92361f002671", "2");
+ assertNotNull(serviceByID);
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
+ assertEquals("NA", serviceByID.getServiceType());
+ assertEquals("NA", serviceByID.getServiceRole());
+ }
+
+ @Test
+ public void testGetServices() throws Exception {
+ List<org.onap.so.rest.catalog.beans.Service> services = client.getServices();
+ assertEquals(false, services.isEmpty());
+ }
+
+ @Test
+ public void testVnf() throws Exception {
+ org.onap.so.rest.catalog.beans.Vnf vnf = client.getVnfModelInformation("5df8b6de-2083-11e7-93ae-92361f002671",
+ "68dc9a92-214c-11e7-93ae-92361f002671", "0");
+ assertNotNull(vnf);
+ assertEquals("vSAMP10a", vnf.getModelName());
+ assertEquals(false, vnf.getNfDataValid());
+ assertEquals("vSAMP", vnf.getNfFunction());
+ assertEquals("vSAMP", vnf.getNfNamingCode());
+ assertEquals("vSAMP", vnf.getNfRole());
+ assertEquals("vSAMP", vnf.getNfType());
+
+ vnf.setNfDataValid(true);
+ vnf.setNfFunction("nfFunction");
+ vnf.setNfRole("nfRole");
+ vnf.setNfType("nfType");
+ vnf.setNfNamingCode("nfNamingCode");
+
+ client.updateVnf("5df8b6de-2083-11e7-93ae-92361f002671", vnf);
+ vnf = client.getVnfModelInformation("5df8b6de-2083-11e7-93ae-92361f002671",
+ "68dc9a92-214c-11e7-93ae-92361f002671", "0");
+ assertEquals("vSAMP10a", vnf.getModelName());
+ assertEquals(true, vnf.getNfDataValid());
+ assertEquals("nfFunction", vnf.getNfFunction());
+ assertEquals("nfNamingCode", vnf.getNfNamingCode());
+ assertEquals("nfRole", vnf.getNfRole());
+ assertEquals("nfType", vnf.getNfType());
+
+
+ }
+
+ @Test
public void getWorkflowByArtifactUUID_validUuid_expectedOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID("5b0c4322-643d-4c9f-b184-4516049e99b1");
assertEquals("artifactName", "testingWorkflow.bpmn", workflow.getArtifactName());
@@ -658,7 +700,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowByArtifactUUID_invalidUuid_nullOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID(UUID.randomUUID().toString());
- Assert.assertNull(workflow);
+ assertNull(workflow);
}
@Test
@@ -673,7 +715,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowByModelUUID_invalidUuid_nullOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID(UUID.randomUUID().toString());
- Assert.assertNull(workflow);
+ assertNull(workflow);
}
@Test
@@ -688,7 +730,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowBySource_invalidSource_nullOutput() {
List<Workflow> workflow = client.findWorkflowBySource("abc");
- Assert.assertNull(workflow);
+ assertNull(workflow);
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json
index cc5145f0e3..2dc83c8963 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json
@@ -23,6 +23,7 @@
"toscaNodeType": "toscaNodeType",
"nfFunction": "nfFunction",
"nfRole": "nfRole",
+ "nfType": "nfType",
"nfNamingCode": "nfNamingCode",
"multiStageDesign": "multiStageDesign",
"orchestrationMode": "orchestrationMode",
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 58b2983f82..32c51293c2 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
@@ -184,8 +184,8 @@ VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459',
'testVnfcCustomizationDescription',
'2018-07-17 14:05:08');
-INSERT INTO `rainy_day_handler_macro` (`FLOW_NAME`,`SERVICE_TYPE`,`VNF_TYPE`,`ERROR_CODE`,`WORK_STEP`,`POLICY`,`SECONDARY_POLICY`,`REG_EX_ERROR_MESSAGE`)
-VALUES ('AssignServiceInstanceBB','*','*','*','*','Rollback','Rollback','The Flavor ID.*could not be found.');
+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 ('AssignServiceInstanceBB','*','*','*','*','Rollback','Rollback','The Flavor ID.*could not be found.','*');
INSERT INTO `cvnfc_customization`
(`id`,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
index 8edce124ec..493ac4a54f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
@@ -22,19 +22,17 @@
package org.onap.so.adapters.audit;
import java.util.Optional;
-import org.camunda.bpm.client.task.ExternalTask;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.onap.so.utils.ExternalTaskUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public abstract class AbstractAuditService {
+public abstract class AbstractAuditService extends ExternalTaskUtils {
private static final Logger logger = LoggerFactory.getLogger(AbstractAuditService.class);
@@ -82,22 +80,4 @@ public abstract class AbstractAuditService {
}
}
- protected String[] getRetrySequence() {
- return env.getProperty("mso.workflow.topics.retrySequence", String[].class);
- }
-
- protected void setupMDC(ExternalTask externalTask) {
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- String msoRequestId = externalTask.getVariable("mso-request-id");
- if (msoRequestId != null && !msoRequestId.isEmpty()) {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
- }
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
- }
-
- protected long calculateRetryDelay(int currentRetries) {
- int retrySequence = getRetrySequence().length - currentRetries;
- long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier", "6000"));
- return Integer.parseInt(getRetrySequence()[retrySequence]) * retryMultiplier;
- }
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
index 1e5b6de857..d03c86ac30 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
@@ -34,7 +34,6 @@ import org.onap.so.objects.audit.AAIObjectAuditList;
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
@@ -45,9 +44,6 @@ public class AuditCreateStackService extends AbstractAuditService {
@Autowired
public HeatStackAudit heatStackAudit;
- @Autowired
- public Environment environment;
-
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
index 999d27335b..fb7e925d88 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
@@ -20,13 +20,9 @@
package org.onap.so.adapters.audit;
-import java.security.GeneralSecurityException;
import javax.annotation.PostConstruct;
import org.camunda.bpm.client.ExternalTaskClient;
-import org.camunda.bpm.client.backoff.ExponentialBackoffStrategy;
-import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
-import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
-import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.ExternalTaskServiceUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,6 +36,10 @@ public class AuditStackService {
private static final Logger logger = LoggerFactory.getLogger(AuditStackService.class);
+ private static final String DEFAULT_AUDIT_LOCK_TIME = "60000";
+
+ private static final String DEFAULT_MAX_CLIENTS_FOR_TOPIC = "10";
+
@Autowired
public Environment env;
@@ -52,59 +52,37 @@ public class AuditStackService {
@Autowired
private AuditQueryStackService auditQueryStack;
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
@PostConstruct
public void auditAddAAIInventory() throws Exception {
- for (int i = 0; i < getMaxClients(); i++) {
- ExternalTaskClient client = createExternalTaskClient();
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
client.subscribe("InventoryAddAudit")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditCreateStack::executeExternalTask).open();
}
}
@PostConstruct
public void auditDeleteAAIInventory() throws Exception {
- for (int i = 0; i < getMaxClients(); i++) {
- ExternalTaskClient client = createExternalTaskClient();
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
client.subscribe("InventoryDeleteAudit")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditDeleteStack::executeExternalTask).open();
}
}
@PostConstruct
public void auditQueryInventory() throws Exception {
- for (int i = 0; i < getMaxClients(); i++) {
- ExternalTaskClient client = createExternalTaskClient();
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
client.subscribe("InventoryQueryAudit")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditQueryStack::executeExternalTask).open();
}
}
- protected ExternalTaskClient createExternalTaskClient() throws Exception {
- ClientRequestInterceptor interceptor = createClientRequestInterceptor();
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- return client;
- }
-
- protected ClientRequestInterceptor createClientRequestInterceptor() {
- String auth = "";
- try {
- auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
- } catch (IllegalStateException | GeneralSecurityException e) {
- logger.error("Error Decrypting Password", e);
- }
- ClientRequestInterceptor interceptor =
- new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- return interceptor;
- }
-
- protected int getMaxClients() {
- return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "10"));
- }
-
-
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
index 89e0320615..35008b6120 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
@@ -84,8 +84,9 @@ public class AuditVServer extends AbstractAudit {
try {
logger.debug("Vserver to Audit: {}", objectMapper.getMapper().writeValueAsString(vserver));
} catch (JsonProcessingException e) {
-
+ logger.error("Json parse exception: ", e);
}
+
});
AAIObjectAuditList auditList = new AAIObjectAuditList();
vServersToAudit.stream().forEach(vServer -> auditList.getAuditList()
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
index 49a9e7e171..c1cc7428ee 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
@@ -20,13 +20,9 @@
package org.onap.so.adapters.inventory.create;
-import java.security.GeneralSecurityException;
import javax.annotation.PostConstruct;
import org.camunda.bpm.client.ExternalTaskClient;
-import org.camunda.bpm.client.backoff.ExponentialBackoffStrategy;
-import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
-import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
-import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.ExternalTaskServiceUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,19 +42,13 @@ public class CreateInventoryService {
@Autowired
private CreateInventoryTask createInventory;
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
@PostConstruct
- public void auditAAIInventory() {
- String auth = "";
- try {
- auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
- } catch (IllegalStateException | GeneralSecurityException e) {
- logger.error("Error Decrypting Password", e);
- }
- ClientRequestInterceptor interceptor =
- new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
+ public void auditAAIInventory() throws Exception {
+
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
client.subscribe("InventoryCreate")
.lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
.handler(createInventory::executeExternalTask).open();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
index a6c61704ad..29d0ef633f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
@@ -27,15 +27,14 @@ 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.objects.audit.AAIObjectAuditList;
+import org.onap.so.utils.ExternalTaskUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class CreateInventoryTask {
+public class CreateInventoryTask extends ExternalTaskUtils {
private static final String UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI = "Unable to write all inventory to A&AI";
@@ -46,9 +45,6 @@ public class CreateInventoryTask {
@Autowired
CreateAAIInventory createInventory;
- @Autowired
- public Environment env;
-
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
setupMDC(externalTask);
boolean success = true;
@@ -107,25 +103,5 @@ public class CreateInventoryTask {
}
}
- private void setupMDC(ExternalTask externalTask) {
- try {
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
- String msoRequestId = externalTask.getVariable("mso-request-id");
- if (msoRequestId != null && !msoRequestId.isEmpty())
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
- } catch (Exception e) {
- logger.error("Error in setting up MDC", e);
- }
- }
-
- protected long calculateRetryDelay(int currentRetries) {
- int retrySequence = getRetrySequence().length - currentRetries;
- long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier", "6000"));
- return Integer.parseInt(getRetrySequence()[retrySequence]) * retryMultiplier;
- }
- public String[] getRetrySequence() {
- return env.getProperty("mso.workflow.topics.retrySequence", String[].class);
- }
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
index a9af3683f5..e95e9a3a83 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -11,9 +11,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.
@@ -370,8 +370,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
notifyPort.deleteNetworkNotification(messageId, false, exCat, eMsg, null);
} catch (Exception e1) {
- logger.error("{} {} Error sending createNetwork notification {} ",
- MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1);
+ logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
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 c934291246..013c7f8a84 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
@@ -90,6 +90,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NETWORK_FQDN = "network_fqdn";
private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork";
private static final String NEUTRON_MODE = "NEUTRON";
+ private static final String CLOUD_OWNER = "CloudOwner";
+ private static final String LOG_DEBUG_MSG = "Got Network definition from Catalog: {}";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@@ -291,7 +293,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
- logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString());
+ logger.debug("Got HEAT Template from DB: {}", heatTemplate);
// "Fix" the template if it has CR/LF (getting this from Oracle)
String template = heatTemplate.getHeatTemplate();
@@ -310,7 +312,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryNetworkStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
logger.error("{} {} Create Network (heat): query network {} in {}/{}: ",
@@ -424,7 +426,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
if (backout == null)
backout = true;
- heatStack = heat.createStack(cloudSiteId, "CloudOwner", tenantId, networkName, null, template,
+ heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template,
stackParams, true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue());
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
@@ -461,13 +463,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
}
+ 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.setNeutronNetworkId((String) heatStack.getOutputs().get(NETWORK_ID));
networkRollback.setNetworkCreated(true);
networkRollback.setNetworkType(networkType);
@@ -607,7 +609,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -655,7 +657,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
- logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString());
+ logger.debug("Got HEAT Template from DB: {}", heatTemplate);
// "Fix" the template if it has CR/LF (getting this from Oracle)
String template = heatTemplate.getHeatTemplate();
@@ -727,7 +729,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Ignore MsoStackNotFound exception because we already checked.
long updateStackStarttime = System.currentTimeMillis();
try {
- heatStack = heatWithUpdate.updateStack(cloudSiteId, "CloudOwner", tenantId, networkId, template,
+ heatStack = heatWithUpdate.updateStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId, template,
stackParams, true, heatTemplate.getTimeoutMinutes());
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
@@ -797,12 +799,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
if (networkCust != null) {
- logger.debug("Got Network Customization definition from Catalog: {}", networkCust.toString());
+ logger.debug("Got Network Customization definition from Catalog: {}", networkCust);
networkResource = networkCust.getNetworkResource();
} else if (collectionNetworkCust != null) {
- logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}",
- collectionNetworkCust.toString());
+ logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}", collectionNetworkCust);
networkResource = collectionNetworkCust.getNetworkResource();
}
if (networkResource == null) {
@@ -813,7 +814,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
- logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
+ logger.debug(LOG_DEBUG_MSG, networkResource);
String mode = networkResource.getOrchestrationMode();
NetworkType neutronNetworkType = NetworkType.valueOf(networkResource.getNeutronNetworkType());
@@ -841,8 +842,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} else {
String error = String.format(
"Network Type:%s Version_Min:%s Version_Max:%s not supported on Cloud:%s with AIC_Version:%s",
- networkType, networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(),
- cloudSiteId, cloudSite.getCloudVersion());
+ networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(), cloudSiteId,
+ cloudSite.getCloudVersion());
logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -914,12 +915,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Use MsoNeutronUtils for all NEUTRON commands
String mode;
- String neutronId;
+ String neutronId = null;
// Try Heat first, since networks may be named the same as the Heat stack
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkNameOrId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkNameOrId);
} catch (MsoException me) {
me.addContext("QueryNetwork");
logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -930,12 +931,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Populate the outputs based on the returned Stack information
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
// Found it. Get the neutronNetworkId for further query
+ Map<String, String> sMap = new HashMap<>();
Map<String, Object> outputs = heatStack.getOutputs();
- neutronId = (String) outputs.get(NETWORK_ID);
mode = "HEAT";
-
- Map<String, String> sMap = new HashMap<>();
if (outputs != null) {
+ neutronId = (String) outputs.get(NETWORK_ID);
+
for (String key : outputs.keySet()) {
if (key != null && key.startsWith("subnet_id_")) // multiples subnet_%aaid% outputs
{
@@ -1044,7 +1045,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
String mode = "";
if (networkResource != null) {
- logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
+ logger.debug(LOG_DEBUG_MSG, networkResource);
mode = networkResource.getOrchestrationMode();
}
@@ -1072,9 +1073,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// was deleted.
// So query first to report back if stack WAS deleted or just NOTOFUND
StackInfo heatStack = null;
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId);
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
networkDeleted.value = true;
} else {
networkDeleted.value = false;
@@ -1131,7 +1132,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String mode = "";
if (networkResource != null) {
- logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
+ logger.debug(LOG_DEBUG_MSG, networkResource);
mode = networkResource.getOrchestrationMode();
}
@@ -1157,7 +1158,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
// The deleteStack function in MsoHeatUtils returns success if the stack
// was not found. So don't bother to query first.
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
} catch (MsoException me) {
me.addContext("RollbackNetwork");
logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
@@ -1387,9 +1388,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Resource Property
List<ContrailSubnet> cslist = new ArrayList<>();
for (Subnet subnet : subnets) {
- logger.debug("Input Subnet:{}", subnet.toString());
+ logger.debug("Input Subnet:{}", subnet);
ContrailSubnet cs = new ContrailSubnetMapper(subnet).map();
- logger.debug("Contrail Subnet:{}", cs.toString());
+ logger.debug("Contrail Subnet:{}", cs);
cslist.add(cs);
}
@@ -1476,13 +1477,19 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
if (subnet.getAllocationPools() != null) {
- curR = curR + " allocation_pools:\n";
+ StringBuilder tempBuf = new StringBuilder();
+ tempBuf.append(curR);
+ tempBuf.append(" allocation_pools:\n");
for (Pool pool : subnet.getAllocationPools()) {
if (!commonUtils.isNullOrEmpty(pool.getStart()) && !commonUtils.isNullOrEmpty(pool.getEnd())) {
- curR = curR + " - start: " + pool.getStart() + "\n";
- curR = curR + " end: " + pool.getEnd() + "\n";
+ tempBuf.append(" - start: ");
+ tempBuf.append(pool.getStart());
+ tempBuf.append("\n end: ");
+ tempBuf.append(pool.getEnd());
+ tempBuf.append("\n");
}
}
+ curR = tempBuf.toString();
}
resourcesBuf.append(curR);
@@ -1491,7 +1498,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curO = curO.replace("%subnetId%", subnet.getSubnetId());
outputsBuf.append(curO);
-
}
// append resources and outputs in heatTemplate
logger.debug("Tempate initial:{}", heatTemplate);
@@ -1515,30 +1521,34 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Subnet_Ipam Output JSON String:{} {}", obj.getClass(), jStr);
JsonNode rootNode = mapper.readTree(jStr);
- for (JsonNode sNode : rootNode.path("ipam_subnets")) {
- logger.debug("Output Subnet Node {}", sNode.toString());
- String name = sNode.path("subnet_name").textValue();
- String uuid = sNode.path("subnet_uuid").textValue();
- String aaiId = name; // default
- // try to find aaiId for name in input subnetList
- if (subnets != null) {
- for (Subnet subnet : subnets) {
- if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) {
- if (subnet.getSubnetName().equals(name)) {
+ if (rootNode != null) {
+ for (JsonNode sNode : rootNode.path("ipam_subnets")) {
+ logger.debug("Output Subnet Node {}", sNode);
+ String name = sNode.path("subnet_name").textValue();
+ String uuid = sNode.path("subnet_uuid").textValue();
+ String aaiId = name; // default
+ // try to find aaiId for name in input subnetList
+ if (subnets != null) {
+ for (Subnet subnet : subnets) {
+ if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())
+ && subnet.getSubnetName().equals(name)) {
aaiId = subnet.getSubnetId();
break;
}
}
}
+ sMap.put(aaiId, uuid); // bpmn needs aaid to uuid map
}
- sMap.put(aaiId, uuid); // bpmn needs aaid to uuid map
+ } else {
+ logger.error("{} {} null rootNode - cannot get subnet-uuids", MessageEnum.RA_MARSHING_ERROR,
+ ErrorCode.DataError.getValue());
}
} catch (Exception e) {
logger.error("{} {} Exception getting subnet-uuids ", MessageEnum.RA_MARSHING_ERROR,
ErrorCode.DataError.getValue(), e);
}
- logger.debug("Return sMap {}", sMap.toString());
+ logger.debug("Return sMap {}", sMap);
return sMap;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
index df2c3a2973..4eb5d5637f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -90,6 +90,7 @@ public class NetworkAdapterRest {
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;
@@ -207,8 +208,8 @@ public class NetworkAdapterRest {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -228,8 +229,8 @@ public class NetworkAdapterRest {
}
if (params.containsKey(SHARED))
shared = params.get(SHARED);
- if (params.containsKey("external"))
- external = params.get("external");
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkName(),
req.getProviderVlanNetwork().getPhysicalNetworkName(),
@@ -603,8 +604,8 @@ public class NetworkAdapterRest {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -624,8 +625,8 @@ public class NetworkAdapterRest {
if (params.containsKey(SHARED)) {
shared = params.get(SHARED);
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
}
adapter.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(),
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
index 3c073af6ba..d75824357f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
@@ -50,7 +50,6 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
-import org.onap.so.client.RestTemplateConfig;
import javax.inject.Provider;
@Component
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java
deleted file mode 100644
index 7786b872ef..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java
+++ /dev/null
@@ -1,189 +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 java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-import org.onap.so.adapters.vdu.VduArtifact;
-import org.onap.so.adapters.vdu.VduArtifact.ArtifactType;
-import org.onap.so.adapters.vdu.VduModelInfo;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import com.google.common.io.Files;
-
-/**
- * The purpose of this class is to create a CSAR byte array from Vdu inputs for the purpose of forwarding to a TOSCA
- * orchestrator.
- *
- * @author DeWayne
- *
- */
-public class CSAR {
- private static final String MANIFEST_FILENAME = "MANIFEST.MF";
- private VduModelInfo vduModel;
-
- public CSAR(VduModelInfo model) {
- this.vduModel = model;
- }
-
- /**
- * Creates a byte array representation of a CSAR corresponding to the VduBlueprint arg in the constructor.
- *
- * @return
- * @throws VnfException
- */
- public byte[] create() {
- File dir = Files.createTempDir();
-
- /**
- * Create subdir
- */
- File metadir = new File(dir.getAbsolutePath() + "/TOSCA-Metadata");
- if (!metadir.mkdir()) {
- throw new RuntimeException("CSAR TOSCA-Metadata directory create failed");
- }
-
- /**
- * Organize model info for consumption
- */
- VduArtifact mainTemplate = null;
- List<VduArtifact> extraFiles = new ArrayList<>();
- for (VduArtifact artifact : vduModel.getArtifacts()) {
- if (artifact.getType() == ArtifactType.MAIN_TEMPLATE) {
- mainTemplate = artifact;
- } else {
- extraFiles.add(artifact);
- }
- }
-
- if (mainTemplate == null) { // make a dummy to avoid null pointers
- mainTemplate = new VduArtifact("", new byte[0], null);
- }
-
- /**
- * Write template files
- */
- try (OutputStream ofs = new FileOutputStream(new File(dir, mainTemplate.getName()));
- PrintStream mfstream =
- new PrintStream(new File(metadir.getAbsolutePath() + '/' + MANIFEST_FILENAME));) {
- ofs.write(mainTemplate.getContent());
-
- /**
- * Write other files
- */
- if (!extraFiles.isEmpty()) {
- for (VduArtifact artifact : extraFiles) {
- try (OutputStream out = new FileOutputStream(new File(dir, artifact.getName()));) {
- out.write(artifact.getContent());
- }
- }
- }
-
-
- /**
- * Create manifest
- */
- mfstream.println("TOSCA-Meta-File-Version: 1.0");
- mfstream.println("CSAR-Version: 1.1");
- mfstream.println("Created-by: ONAP");
- mfstream.println("Entry-Definitions: " + mainTemplate.getName());
-
- /**
- * ZIP it up
- */
- ByteArrayOutputStream zipbytes = new ByteArrayOutputStream();
- ZipOutputStream zos = new ZipOutputStream(zipbytes);
- compressTree(zos, "", dir, dir);
- zos.close();
- return zipbytes.toByteArray();
-
- } catch (Exception e) {
- throw new RuntimeException("Failed to create CSAR: " + e.getMessage());
- } finally {
- /**
- * Clean up tmpdir
- */
- deleteDirectory(dir);
- }
- }
-
- /**
- * Private methods
- */
-
- /**
- * Compresses (ZIPs) a directory tree
- *
- * @param dir
- * @throws IOException
- */
- private void compressTree(ZipOutputStream zos, String path, File basedir, File dir) throws IOException {
- if (!dir.isDirectory())
- return;
-
- for (File f : dir.listFiles()) {
- if (f.isDirectory()) {
- String newpath = path + f.getName() + '/';
- ZipEntry entry = new ZipEntry(newpath);
- zos.putNextEntry(entry);
- zos.closeEntry();
- compressTree(zos, newpath, basedir, f);
- } else {
- ZipEntry ze = new ZipEntry(
- f.getAbsolutePath().substring(basedir.getAbsolutePath().length() + 1).replaceAll("\\\\", "/"));
- zos.putNextEntry(ze);
- // read the file and write to ZipOutputStream
- try (FileInputStream fis = new FileInputStream(f);) {
- byte[] buffer = new byte[1024];
- int len;
- while ((len = fis.read(buffer)) > 0) {
- zos.write(buffer, 0, len);
- }
- }
- zos.closeEntry();
- }
- }
- }
-
- private boolean deleteDirectory(File directory) {
- if (directory.exists()) {
- File[] files = directory.listFiles();
- if (null != files) {
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- deleteDirectory(files[i]);
- } else {
- files[i].delete();
- }
- }
- }
- }
- return (directory.delete());
- }
-}
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 1d73bf21c9..af2fa24ff9 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
@@ -640,7 +640,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
StackInfo heatStack = null;
try {
- heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
+ if (heat != null) {
+ heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
+ } else {
+ throw new MsoHeatNotFoundException();
+ }
} catch (MsoException me) {
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
index 96e5db7ce7..f09fa34cb9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -854,7 +854,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Include aliases.
String alias = htp.getParamAlias();
- if (alias != null && !alias.equals("") && !params.containsKey(alias)) {
+ if (alias != null && !"".equals(alias) && !params.containsKey(alias)) {
params.put(alias, htp);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index 70fb0b3857..41bcc8c481 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -323,7 +323,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String type = templateParam.getParamType();
logger.debug("Parameter: {} is of type ", templateParam.getParamName(), type);
- if (type.equalsIgnoreCase("number")) {
+ if ("number".equalsIgnoreCase(type)) {
try {
return Integer.valueOf(inputValue.toString());
} catch (Exception e) {
@@ -616,7 +616,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
vnfResource = vfModuleCust.getVfModule().getVnfResources();
} catch (Exception e) {
- logger.debug("unhandled exception in create VF - [Query]" + e.getMessage());
+ logger.debug("unhandled exception in create VF - [Query] {}", e.getMessage());
throw new VnfException("Exception during create VF " + e.getMessage());
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
index 3432e4a8b6..2109fb289f 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
@@ -170,47 +170,6 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
}
@Test
- public void retry_sequence_calculation_Test() {
- long firstRetry = auditStackService.calculateRetryDelay(8);
- assertEquals(6000L, firstRetry);
- long secondRetry = auditStackService.calculateRetryDelay(7);
- assertEquals(6000L, secondRetry);
- long thirdRetry = auditStackService.calculateRetryDelay(6);
- assertEquals(12000L, thirdRetry);
- long fourthRetry = auditStackService.calculateRetryDelay(5);
- assertEquals(18000L, fourthRetry);
- long fifthRetry = auditStackService.calculateRetryDelay(4);
- assertEquals(30000L, fifthRetry);
- long sixRetry = auditStackService.calculateRetryDelay(3);
- assertEquals(48000L, sixRetry);
- long seventhRetry = auditStackService.calculateRetryDelay(2);
- assertEquals(78000L, seventhRetry);
- long eigthRetry = auditStackService.calculateRetryDelay(1);
- assertEquals(120000L, eigthRetry);
- }
-
- @Test
- public void retry_sequence_Test() {
- long firstRetry = auditStackService.calculateRetryDelay(8);
- assertEquals(6000L, firstRetry);
- long secondRetry = auditStackService.calculateRetryDelay(7);
- assertEquals(6000L, secondRetry);
- long thirdRetry = auditStackService.calculateRetryDelay(6);
- assertEquals(12000L, thirdRetry);
- long fourthRetry = auditStackService.calculateRetryDelay(5);
- assertEquals(18000L, fourthRetry);
- long fifthRetry = auditStackService.calculateRetryDelay(4);
- assertEquals(30000L, fifthRetry);
- long sixRetry = auditStackService.calculateRetryDelay(3);
- assertEquals(48000L, sixRetry);
- long seventhRetry = auditStackService.calculateRetryDelay(2);
- assertEquals(78000L, seventhRetry);
- long eigthRetry = auditStackService.calculateRetryDelay(1);
- assertEquals(120000L, eigthRetry);
- }
-
-
- @Test
public void determineAuditResult_Test() throws Exception {
boolean actual = auditStackService.didCreateAuditFail(auditListOptSuccess);
assertEquals(false, actual);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
deleted file mode 100644
index c9aef950f7..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 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.audit;
-
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import org.camunda.bpm.client.ExternalTaskClient;
-import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
-import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.utils.CryptoUtils;
-import org.springframework.core.env.Environment;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AuditStackServiceTest {
-
- @Spy
- @InjectMocks
- AuditStackService auditStackService;
-
- @Mock
- Environment mockEnvironment;
-
-
- @Before
- public void before() {
- Mockito.doReturn("5").when(mockEnvironment).getProperty("workflow.topics.maxClients", "10");
- Mockito.doReturn("6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436")
- .when(mockEnvironment).getRequiredProperty("mso.auth");
- Mockito.doReturn("07a7159d3bf51a0e53be7a8f89699be7").when(mockEnvironment).getRequiredProperty("mso.msoKey");
- Mockito.doReturn("something").when(mockEnvironment).getRequiredProperty("mso.config.cadi.aafId");
- Mockito.doReturn("host.com").when(mockEnvironment).getRequiredProperty("mso.workflow.endpoint");
- }
-
- @Test
- public void testGetMaxClients() throws Exception {
- int actual = auditStackService.getMaxClients();
- assertEquals(5, actual);
- }
-
- @Test
- public void testCreateClientRequestInterceptor() throws Exception {
- String auth = CryptoUtils.decrypt(
- "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436",
- "07a7159d3bf51a0e53be7a8f89699be7");
- ClientRequestInterceptor expected = new BasicAuthProvider("something", auth);
- ClientRequestInterceptor actual = auditStackService.createClientRequestInterceptor();
- assertThat(actual, sameBeanAs(expected));
-
- }
-
- @Test
- public void testCreateExternalTaskClient() throws Exception {
- String auth = CryptoUtils.decrypt(
- "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436",
- "07a7159d3bf51a0e53be7a8f89699be7");
- ClientRequestInterceptor inter = new BasicAuthProvider("something", auth);
- Mockito.doReturn(inter).when(auditStackService).createClientRequestInterceptor();
- ExternalTaskClient actual = auditStackService.createExternalTaskClient();
- assertNotNull(actual);
- Mockito.verify(auditStackService, Mockito.times(1)).createClientRequestInterceptor();
-
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index 7b3ffd7d30..9406bc445d 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -1109,6 +1109,7 @@ CREATE TABLE `vnf_resource_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
`VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql
new file mode 100644
index 0000000000..eac9a65f65
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql
@@ -0,0 +1,12 @@
+use requestdb;
+
+DROP INDEX `infra_active_requests__aic_cloud_region_idx` on `infra_active_requests`;
+
+ALTER TABLE
+ `infra_active_requests` CHANGE AIC_CLOUD_REGION CLOUD_REGION varchar(50) DEFAULT NULL;
+
+ALTER TABLE
+ `archived_infra_requests` CHANGE AIC_CLOUD_REGION CLOUD_REGION VARCHAR(50) NULL DEFAULT NULL;
+
+ALTER TABLE `infra_active_requests`
+ ADD INDEX IF NOT EXISTS `infra_active_requests__cloud_region_idx` (`CLOUD_REGION` ASC);
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql
new file mode 100644
index 0000000000..2f7438c1d3
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4__Add_Indexes_to_Infra_Active_Requests_Table.sql
@@ -0,0 +1,21 @@
+ALTER TABLE `requestdb`.`infra_active_requests`
+ADD INDEX IF NOT EXISTS `infra_active_requests__service_instance_id_idx` (`SERVICE_INSTANCE_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__service_instance_name_idx` (`SERVICE_INSTANCE_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__vnf_id_idx` (`VNF_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__vnf_name_name_idx` (`VNF_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__vf_module_id_idx` (`VF_MODULE_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__vf_module_name_idx` (`VF_MODULE_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__volume_group_id_idx` (`VOLUME_GROUP_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__volume_group_name_idx` (`VOLUME_GROUP_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__network_id_idx` (`NETWORK_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__network_name_idx` (`NETWORK_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__configuration_id_idx` (`CONFIGURATION_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__configuration_name_idx` (`CONFIGURATION_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__instance_group_id_idx` (`INSTANCE_GROUP_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__instance_group_name_idx` (`INSTANCE_GROUP_NAME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__aic_cloud_region_idx` (`AIC_CLOUD_REGION` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__tenant_id_idx` (`TENANT_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__request_scope_idx` (`REQUEST_SCOPE` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__requestor_id_idx` (`REQUESTOR_ID` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__start_time_idx` (`START_TIME` ASC),
+ADD INDEX IF NOT EXISTS `infra_active_requests__end_time_idx` (`END_TIME` ASC); \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 9c2ea6d3bf..65fac11d41 100644
--- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -4,7 +4,7 @@ insert into operation_status(service_id, operation_id, service_name, user_id, re
('serviceid', 'operationid', 'servicename', 'userid', 'result', 'operationcontent', 'progress', 'reason', '2016-11-24 13:19:10', '2016-11-24 13:19:10');
-insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, aic_cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name, request_url) values
+insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name, request_url) values
('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"vSAMP10aDEV::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"mtn6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'vSAMP10aDEV::base::module-0', null, 'mtn6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_vSAMP10a_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"requestDetails":{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_vSAMP10a_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_vSAMP10a_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarteSet":true,"alaCarte":true}}}', null, 'APIH', '2016-12-22 19:00:28', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_vSAMP10a_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<vnf-request xmlns=\"http://org.onap.so/mso/infra/vnf-request/v1\">\n <request-info>\n <request-id>001619d2-a297-4a4b-a9f5-e2823c88458f</request-id>\n <action>CREATE_VF_MODULE</action>\n <source>PORTAL</source>\n </request-info>\n <vnf-inputs>\n <vnf-name>test-vscp</vnf-name>\n <vf-module-name>moduleName</vf-module-name>\n <vnf-type>elena_test21</vnf-type>\n <vf-module-model-name>moduleModelName</vf-module-model-name>\n <asdc-service-model-version>1.0</asdc-service-model-version>\n <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>\n <aic-cloud-region>mtn9</aic-cloud-region>\n <tenant-id>381b9ff6c75e4625b7a4182f90fc68d3</tenant-id>\n <persona-model-id></persona-model-id>\n <persona-model-version></persona-model-version>\n <is-base-vf-module>false</is-base-vf-module>\n </vnf-inputs>\n <vnf-params xmlns:tns=\"http://org.onap.so/mso/infra/vnf-request/v1\"/>\n</vnf-request>\n', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
new file mode 100644
index 0000000000..66876311db
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
@@ -0,0 +1,128 @@
+The following describes how to configure authentication for the VNFM adapter.
+
+
+==========================================
+To confgure TLS
+==========================================
+
+---------------
+VNFM Adapter
+---------------
+The following parameters can be set to configure the certificate for the VNFM adapter
+server:
+ ssl:
+ key-alias: so@so.onap.org
+ key--store-password: 'I,re7WWEJR$e]x370wRgx?qE'
+ key-store: classpath:org.onap.so.p12
+ key-store-type: PKCS12
+The values shown above relate to the certificate included in the VNFM adapter jar which has been generated from AAF. If a different certificate is to be used then these values should be changed accordingly.
+
+The following paramters can be set to configure the trust store for the VNFM adapter:
+http:
+ client:
+ ssl:
+ trust-store: org.onap.so.trust.jks
+ trust-store-password: NyRD](z:EJJNIt?},QgM3o7H
+The values shown above relate to the trust store included in the VNFM adapter jar which has been generated from AAI. If a different trust store is to be used then these values should be changed accordingly.
+
+Ensure the value for the below parameter uses https instead of http
+vnfmadapter:
+ endpoint: http://so-vnfm-adapter.onap:9092
+
+---------------
+bpmn-infra
+---------------
+For bpmn-infra, ensure the value for the below parameter uses https instead of http
+so:
+ vnfm:
+ adapter:
+ url: https://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/
+
+
+==========================================
+To use two way TLS
+==========================================
+
+Ensure the value for username and password are empty in the AAI entry for the VNFM (The VNFM adapter will use oauth instead of two way TLS if the username/password is set).
+Ensure TLS has been configuered as detailed above.
+
+---------------
+VNFM adapter
+---------------
+Set the following parameter for the VNFM adapter:
+server:
+ ssl:
+ client-auth: need
+
+---------------
+bpmn-infra:
+---------------
+Set the following paramters for bpmn-infra:
+rest:
+ http:
+ client:
+ configuration:
+ ssl:
+ keyStore: classpath:org.onap.so.p12
+ keyStorePassword: 'RLe5ExMWW;Kd6GTSt0WQz;.Y'
+ trustStore: classpath:org.onap.so.trust.jks
+ trustStorePassword: '6V%8oSU$,%WbYp3IUe;^mWt4'
+Ensure the value for the below parameter uses https instead of http
+so:
+ vnfm:
+ adapter:
+ url: https://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/
+
+---------------
+VNFM simulator:
+---------------
+Set the following parameters for the VNFM simulator (if used):
+server:
+ ssl:
+ client-auth: need
+ request:
+ grant:
+ auth: twowaytls
+
+==========================================
+To use oauth token base authentication
+==========================================
+
+---------------
+VNFM adapter:
+---------------
+Ensure the value for username and password set set in the AAI entry for the VNFM. The VNFM adapter will use this username/password as the client credentials in the request for a token for the VNFM. The token endpoint
+for the VNFM will by default will be derived from the service url for the VNFM in AAI as follows: <base of service url>/oauth/token, e.g. if the service url is https://so-vnfm-simulator.onap/vnflcm/v1 then the token url will
+be taken to be https://so-vnfm-simulator.onap/oauth/token. This can be overriden using the following parameter for the VNFM adapter:
+vnfmadapter:
+ temp:
+ vnfm:
+ oauth:
+ endpoint:
+
+The VNFM adapter exposes a token point at url: https://<hostname>:<port>/oauth/token e.g. https://so-vnfm-adapter.onap:9092/oauth/token. The VNFM can request a token from this endpoint for use in grant requests and notifications
+to the VNFM adapter. The username/password to be used in the token request are passed to the VNFM in a subscription request. The username/password sent by the VNFM adpater in the subscription request can be configuered using the
+following parameter:
+vnfmadapter:
+ auth: <encoded value>
+where <encoded value> is '<username>:<password>' encoded using org.onap.so.utils.CryptoUtils with the key set by the paramter:
+mso:
+ key: <key>
+The default username:password is vnfm-adapter:123456 when vnfm-adapter.auth is not set.
+
+---------------
+VNFM simulator:
+---------------
+Set the following parameters for the simulator:
+spring:
+ profiles:
+ active: oauth-authentication
+server:
+ request:
+ grant:
+ auth: oauth
+
+==========================================
+To use basic auth for notifications
+==========================================
+The same username/password is used as for oauth token requests as describe above and passed to the VNFM in the subscription request. \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
index e2dd64d0f4..bc491a6fc5 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -108,6 +108,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.springframework.security.oauth</groupId>
+ <artifactId>spring-security-oauth2</artifactId>
+ <version>2.3.6.RELEASE</version>
+ </dependency>
+ <dependency>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-adapters-rest-interface</artifactId>
<version>${project.version}</version>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
index d99b68846e..32c22356b3 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
@@ -20,14 +20,16 @@
package org.onap.so.adapters.vnfmadapter;
import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import java.util.ArrayList;
import java.util.Collection;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
+import org.onap.so.adapters.vnfmadapter.oauth.OAuth2AccessTokenAdapter;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
/**
* Configures message converter
@@ -38,7 +40,8 @@ public class MessageConverterConfiguration {
@Bean
public HttpMessageConverters customConverters() {
final Collection<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
- final Gson gson = new JSON().getGson();
+ final Gson gson = new GsonBuilder()
+ .registerTypeHierarchyAdapter(OAuth2AccessToken.class, new OAuth2AccessTokenAdapter()).create();
final GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter(gson);
messageConverters.add(gsonHttpMessageConverter);
return new HttpMessageConverters(true, messageConverters);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
index f0830139b7..792002354b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
@@ -22,6 +22,7 @@ package org.onap.so.adapters.vnfmadapter;
import org.onap.so.security.MSOSpringFirewall;
import org.onap.so.security.WebSecurityConfig;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -34,13 +35,18 @@ import org.springframework.util.StringUtils;
@EnableWebSecurity
public class WebSecurityConfigImpl extends WebSecurityConfig {
+ @Value("${server.ssl.client-auth:none}")
+ private String clientAuth;
+
@Override
protected void configure(final HttpSecurity http) throws Exception {
- http.csrf().disable().authorizeRequests()
- .antMatchers("/manage/health", "/manage/info", Constants.BASE_URL + "/lcn/**",
- Constants.BASE_URL + "/grants/**")
- .permitAll().antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ","))
- .and().httpBasic();
+ if (("need").equalsIgnoreCase(clientAuth)) {
+ http.csrf().disable().authorizeRequests().anyRequest().permitAll();
+ } else {
+ http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+ .httpBasic();
+ }
}
@Override
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/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
index 249cf74cb2..7c22020287 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
@@ -41,6 +41,7 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRe
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;
@@ -194,14 +195,25 @@ public class VnfmHelper {
}
private SubscriptionsAuthentication getSubscriptionsAuthentication() throws GeneralSecurityException {
- final SubscriptionsAuthenticationParamsBasic basicAuthParams = new SubscriptionsAuthenticationParamsBasic();
+ final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
+
final String[] decrypedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoEncryptionKey).split(":");
+
+ SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthParams =
+ new SubscriptionsAuthenticationParamsOauth2ClientCredentials();
+ oauthParams.setTokenEndpoint(vnfmAdapterEndoint + "/oauth/token");
+ oauthParams.clientId(decrypedAuth[0]);
+ oauthParams.setClientPassword(decrypedAuth[1]);
+ authentication.addAuthTypeItem(AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS);
+ authentication.paramsOauth2ClientCredentials(oauthParams);
+
+ final SubscriptionsAuthenticationParamsBasic basicAuthParams = new SubscriptionsAuthenticationParamsBasic();
basicAuthParams.setUserName(decrypedAuth[0]);
basicAuthParams.setPassword(decrypedAuth[1]);
-
- final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
authentication.addAuthTypeItem(AuthTypeEnum.BASIC);
authentication.paramsBasic(basicAuthParams);
+
+ authentication.addAuthTypeItem(AuthTypeEnum.TLS_CERT);
return authentication;
}
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/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
index 7a0df0fdba..cb8c7c4e56 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
@@ -21,6 +21,7 @@
package org.onap.so.adapters.vnfmadapter.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;
@@ -37,63 +38,67 @@ public interface VnfmServiceProvider {
/**
* Invoke a get request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to the VNF in the VNFM
* @return the VNF from the VNFM
*/
- Optional<InlineResponse201> getVnf(final String vnfSelfLink);
+ Optional<InlineResponse201> getVnf(final EsrVnfm vnfm, final String vnfSelfLink);
/**
* Invoke an instantiate request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to he VNF on the VNFM
* @param instantiateVnfRequest the instantiate request
* @return the operation ID of the instantiation operation
*/
- String instantiateVnf(final String vnfSelfLink, final InstantiateVnfRequest instantiateVnfRequest);
+ String instantiateVnf(final EsrVnfm vnfm, final String vnfSelfLink,
+ final InstantiateVnfRequest instantiateVnfRequest);
/**
* Invoke a notification subscription request to a VNFM.
*
- * @param vnfmId the ID of the VNFM
+ * @param vnfm the VNFM in AAI
* @param subscriptionRequest
* @return the response to the subscription request
*/
- InlineResponse2001 subscribeForNotifications(final String vnfmId,
- final LccnSubscriptionRequest subscriptionRequest);
+ InlineResponse2001 subscribeForNotifications(final EsrVnfm vnfm, final LccnSubscriptionRequest subscriptionRequest);
/**
* Invoke a terminate request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to he VNF on the VNFM
* @param terminateVnfRequest the terminate request
* @return the operation ID of the termination operation
*/
- String terminateVnf(final String vnfSelfLink, final TerminateVnfRequest terminateVnfRequest);
+ String terminateVnf(final EsrVnfm vnfm, final String vnfSelfLink, final TerminateVnfRequest terminateVnfRequest);
/**
* Invoke a delete request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to he VNF on the VNFM
* @return the operation ID of the instantiation operation
*/
- void deleteVnf(final String vnfSelfLink);
+ void deleteVnf(final EsrVnfm vnfm, final String vnfSelfLink);
/**
* Invoke a get request for a VNFM operation.
*
- * @param vnfmId the id of the VNFM in AAI
+ * @param vnfm the VNFM in AAI
* @param operationId the id of the operation on the VNFM
* @return the operation from the VNFM
*/
- Optional<InlineResponse200> getOperation(final String vnfmId, final String operationId);
+ Optional<InlineResponse200> getOperation(final EsrVnfm vnfm, final String operationId);
/**
* Invoke a create request to a VNFM
*
- * @param vnfmId the id of the VNFM in AAI
+ * @param vnfm the VNFM in AAI
* @param createVnfRequest the parameters for creating a VNF
* @return the newly created VNF
*/
- Optional<InlineResponse201> createVnf(final String vnfmId, final CreateVnfRequest createVnfRequest);
+ Optional<InlineResponse201> createVnf(final EsrVnfm vnfm, final CreateVnfRequest createVnfRequest);
}
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/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index ab631837db..93312cfa64 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -24,20 +24,25 @@ import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import com.google.gson.Gson;
import java.io.IOException;
import java.security.KeyManagementException;
+import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.Iterator;
-import java.util.ListIterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
import javax.net.ssl.SSLContext;
+import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
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.vnfm.lcn.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.slf4j.Logger;
@@ -45,14 +50,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
+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.security.oauth2.client.OAuth2RestTemplate;
+import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
import org.springframework.web.client.RestTemplate;
/**
@@ -62,26 +68,67 @@ import org.springframework.web.client.RestTemplate;
public class VnfmServiceProviderConfiguration {
private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderConfiguration.class);
+ private Map<String, HttpRestServiceProvider> mapOfVnfmIdToHttpRestServiceProvider = new ConcurrentHashMap<>();
@Value("${http.client.ssl.trust-store:#{null}}")
- private Resource keyStore;
+ private Resource trustStore;
@Value("${http.client.ssl.trust-store-password:#{null}}")
+ private String trustStorePassword;
+
+ @Value("${server.ssl.key-store:#{null}}")
+ private Resource keyStoreResource;
+ @Value("${server.ssl.key--store-password:#{null}}")
private String keyStorePassword;
- @Bean(name = "vnfmServiceProvider")
- public HttpRestServiceProvider httpRestServiceProvider(
- @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate) {
- return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider());
+ /**
+ * This property is only intended to be temporary until the AAI schema is updated to support setting the endpoint
+ */
+ @Value("${vnfmadapter.temp.vnfm.oauth.endpoint:#{null}}")
+ private String oauthEndpoint;
+
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ @Autowired()
+ private RestTemplate defaultRestTemplate;
+
+ public HttpRestServiceProvider getHttpRestServiceProvider(final EsrVnfm vnfm) {
+ if (!mapOfVnfmIdToHttpRestServiceProvider.containsKey(vnfm.getVnfmId())) {
+ mapOfVnfmIdToHttpRestServiceProvider.put(vnfm.getVnfmId(), createHttpRestServiceProvider(vnfm));
+ }
+ return mapOfVnfmIdToHttpRestServiceProvider.get(vnfm.getVnfmId());
}
- private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
- final HttpHeadersProvider httpHeadersProvider) {
+ private HttpRestServiceProvider createHttpRestServiceProvider(final EsrVnfm vnfm) {
+ final RestTemplate restTemplate = createRestTemplate(vnfm);
setGsonMessageConverter(restTemplate);
- if (keyStore != null) {
+ if (trustStore != null) {
setTrustStore(restTemplate);
}
- removeSpringClientFilter(restTemplate);
- return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
+ return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider());
+ }
+
+ private RestTemplate createRestTemplate(final EsrVnfm vnfm) {
+ if (vnfm != null) {
+ for (final EsrSystemInfo esrSystemInfo : vnfm.getEsrSystemInfoList().getEsrSystemInfo()) {
+ if (!StringUtils.isEmpty(esrSystemInfo.getUserName())
+ && !StringUtils.isEmpty(esrSystemInfo.getPassword())) {
+ return createOAuth2RestTemplate(esrSystemInfo);
+ }
+ }
+ }
+ return defaultRestTemplate;
+ }
+
+ private OAuth2RestTemplate createOAuth2RestTemplate(final EsrSystemInfo esrSystemInfo) {
+ logger.debug("Getting OAuth2RestTemplate ...");
+ final ClientCredentialsResourceDetails resourceDetails = new ClientCredentialsResourceDetails();
+ resourceDetails.setId(UUID.randomUUID().toString());
+ resourceDetails.setClientId(esrSystemInfo.getUserName());
+ resourceDetails.setClientSecret(esrSystemInfo.getPassword());
+ resourceDetails.setAccessTokenUri(
+ oauthEndpoint == null ? esrSystemInfo.getServiceUrl().replace("vnflcm/v1", "oauth/token")
+ : oauthEndpoint);
+ resourceDetails.setGrantType("client_credentials");
+ return new OAuth2RestTemplate(resourceDetails);
}
private void setGsonMessageConverter(final RestTemplate restTemplate) {
@@ -98,27 +145,26 @@ public class VnfmServiceProviderConfiguration {
private void setTrustStore(final RestTemplate restTemplate) {
SSLContext sslContext;
try {
- sslContext = new SSLContextBuilder().loadTrustMaterial(keyStore.getURL(), keyStorePassword.toCharArray())
- .build();
- logger.info("Setting truststore: {}", keyStore.getURL());
+ if (keyStoreResource != null) {
+ KeyStore keystore = KeyStore.getInstance("pkcs12");
+ keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
+ sslContext =
+ new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray())
+ .loadKeyMaterial(keystore, keyStorePassword.toCharArray()).build();
+ } else {
+ sslContext = new SSLContextBuilder()
+ .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build();
+ }
+ logger.info("Setting truststore: {}", trustStore.getURL());
final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
final HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
final HttpComponentsClientHttpRequestFactory factory =
new HttpComponentsClientHttpRequestFactory(httpClient);
- restTemplate.setRequestFactory(factory);
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
- | IOException exception) {
+ | IOException | UnrecoverableKeyException exception) {
logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception);
}
}
- private void removeSpringClientFilter(final RestTemplate restTemplate) {
- ListIterator<ClientHttpRequestInterceptor> interceptorIterator = restTemplate.getInterceptors().listIterator();
- while (interceptorIterator.hasNext()) {
- if (interceptorIterator.next() instanceof SpringClientFilter) {
- interceptorIterator.remove();
- }
- }
- }
-
}
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/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
index c470008d08..948f5fc269 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
@@ -21,6 +21,7 @@
package org.onap.so.adapters.vnfmadapter.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;
@@ -33,7 +34,6 @@ import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@@ -42,28 +42,29 @@ import org.springframework.stereotype.Service;
public class VnfmServiceProviderImpl implements VnfmServiceProvider {
private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderImpl.class);
- private final HttpRestServiceProvider httpServiceProvider;
+ private final VnfmServiceProviderConfiguration vnfmServiceProviderConfiguration;
private final VnfmUrlProvider urlProvider;
@Autowired
public VnfmServiceProviderImpl(final VnfmUrlProvider urlProvider,
- @Qualifier("vnfmServiceProvider") final HttpRestServiceProvider httpServiceProvider) {
- this.httpServiceProvider = httpServiceProvider;
+ VnfmServiceProviderConfiguration vnfmServiceProviderConfiguration) {
+ this.vnfmServiceProviderConfiguration = vnfmServiceProviderConfiguration;
this.urlProvider = urlProvider;
}
@Override
- public Optional<InlineResponse201> getVnf(final String vnfSelfLink) {
- return httpServiceProvider.get(vnfSelfLink, InlineResponse201.class);
+ public Optional<InlineResponse201> getVnf(final EsrVnfm vnfm, final String vnfSelfLink) {
+ return getHttpServiceProvider(vnfm).get(vnfSelfLink, InlineResponse201.class);
}
@Override
- public String instantiateVnf(final String vnfSelfLink, final InstantiateVnfRequest instantiateVnfRequest) {
+ public String instantiateVnf(final EsrVnfm vnfm, final String vnfSelfLink,
+ final InstantiateVnfRequest instantiateVnfRequest) {
logger.debug("Sending instantiate request " + instantiateVnfRequest + " to : " + vnfSelfLink);
ResponseEntity<Void> response = null;
try {
- response = httpServiceProvider.postHttpRequest(instantiateVnfRequest, vnfSelfLink + "/instantiate",
+ response = getHttpServiceProvider(vnfm).postHttpRequest(instantiateVnfRequest, vnfSelfLink + "/instantiate",
Void.class);
} catch (final Exception exception) {
final String errorMessage =
@@ -82,22 +83,22 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public InlineResponse2001 subscribeForNotifications(final String vnfmId,
+ public InlineResponse2001 subscribeForNotifications(final EsrVnfm vnfm,
final LccnSubscriptionRequest subscriptionRequest) {
logger.info("Subscribing for notifications {}", subscriptionRequest);
- final String url = urlProvider.getSubscriptionsUrl(vnfmId);
+ final String url = urlProvider.getSubscriptionsUrl(vnfm.getVnfmId());
ResponseEntity<InlineResponse2001> response = null;
try {
- response = httpServiceProvider.postHttpRequest(subscriptionRequest, url, InlineResponse2001.class);
+ response = getHttpServiceProvider(vnfm).postHttpRequest(subscriptionRequest, url, InlineResponse2001.class);
logger.info("Subscribing for notifications response {}", response);
} catch (final Exception exception) {
final String errorMessage =
- "Subscription to VNFM " + vnfmId + " resulted in exception" + subscriptionRequest;
+ "Subscription to VNFM " + vnfm.getVnfmId() + " resulted in exception" + subscriptionRequest;
logger.error(errorMessage, exception);
throw new VnfmRequestFailureException(errorMessage, exception);
}
if (response.getStatusCode() != HttpStatus.CREATED) {
- final String errorMessage = "Subscription to VNFM " + vnfmId + " returned status code: "
+ final String errorMessage = "Subscription to VNFM " + vnfm.getVnfmId() + " returned status code: "
+ response.getStatusCode() + ", request: " + subscriptionRequest;
logger.error(errorMessage);
throw new VnfmRequestFailureException(errorMessage);
@@ -106,12 +107,14 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public String terminateVnf(final String vnfSelfLink, final TerminateVnfRequest terminateVnfRequest) {
+ public String terminateVnf(final EsrVnfm vnfm, final String vnfSelfLink,
+ final TerminateVnfRequest terminateVnfRequest) {
logger.debug("Sending terminate request " + terminateVnfRequest + " to : " + vnfSelfLink);
ResponseEntity<Void> response = null;
try {
- response = httpServiceProvider.postHttpRequest(terminateVnfRequest, vnfSelfLink + "/terminate", Void.class);
+ response = getHttpServiceProvider(vnfm).postHttpRequest(terminateVnfRequest, vnfSelfLink + "/terminate",
+ Void.class);
} catch (final Exception exception) {
final String errorMessage =
"Terminate request to " + vnfSelfLink + " resulted in exception" + terminateVnfRequest;
@@ -130,9 +133,9 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public void deleteVnf(final String vnfSelfLink) {
+ public void deleteVnf(final EsrVnfm vnfm, final String vnfSelfLink) {
logger.debug("Sending delete request to : " + vnfSelfLink);
- final ResponseEntity<Void> response = httpServiceProvider.deleteHttpRequest(vnfSelfLink, Void.class);
+ final ResponseEntity<Void> response = getHttpServiceProvider(vnfm).deleteHttpRequest(vnfSelfLink, Void.class);
if (response.getStatusCode() != HttpStatus.NO_CONTENT) {
throw new VnfmRequestFailureException(
"Delete request to " + vnfSelfLink + " return status code: " + response.getStatusCode());
@@ -140,23 +143,27 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public Optional<InlineResponse200> getOperation(final String vnfmId, final String operationId) {
- final String url = urlProvider.getOperationUrl(vnfmId, operationId);
- return httpServiceProvider.get(url, InlineResponse200.class);
+ public Optional<InlineResponse200> getOperation(final EsrVnfm vnfm, final String operationId) {
+ final String url = urlProvider.getOperationUrl(vnfm.getVnfmId(), operationId);
+ return getHttpServiceProvider(vnfm).get(url, InlineResponse200.class);
}
@Override
- public Optional<InlineResponse201> createVnf(final String vnfmId, final CreateVnfRequest createVnfRequest) {
- final String url = urlProvider.getCreationUrl(vnfmId);
+ public Optional<InlineResponse201> createVnf(final EsrVnfm vnfm, final CreateVnfRequest createVnfRequest) {
+ final String url = urlProvider.getCreationUrl(vnfm.getVnfmId());
logger.debug("Sending create request {} to : {}", createVnfRequest, url);
try {
- return httpServiceProvider.post(createVnfRequest, url, InlineResponse201.class);
+ return getHttpServiceProvider(vnfm).post(createVnfRequest, url, InlineResponse201.class);
} catch (final Exception exception) {
final String errorMessage =
- "Create request to vnfm:" + vnfmId + " resulted in exception" + createVnfRequest;
+ "Create request to vnfm:" + vnfm.getVnfmId() + " resulted in exception" + createVnfRequest;
logger.error(errorMessage, exception);
throw new VnfmRequestFailureException(errorMessage, exception);
}
}
+ private HttpRestServiceProvider getHttpServiceProvider(final EsrVnfm vnfm) {
+ return vnfmServiceProviderConfiguration.getHttpRestServiceProvider(vnfm);
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
index 537bb77b32..68fdb79444 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
@@ -25,6 +25,7 @@ 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;
@@ -45,10 +46,12 @@ public class JobManager {
private static Logger logger = getLogger(JobManager.class);
private final Map<String, VnfmOperation> mapOfJobIdToVnfmOperation = Maps.newConcurrentMap();
private final VnfmServiceProvider vnfmServiceProvider;
+ private final AaiServiceProvider aaiServiceProvider;
@Autowired
- JobManager(final VnfmServiceProvider vnfmServiceProvider) {
+ JobManager(final VnfmServiceProvider vnfmServiceProvider, final AaiServiceProvider aaiServiceProvider) {
this.vnfmServiceProvider = vnfmServiceProvider;
+ this.aaiServiceProvider = aaiServiceProvider;
}
/**
@@ -90,16 +93,15 @@ public class JobManager {
}
try {
- final Optional<InlineResponse200> operationOptional =
- vnfmServiceProvider.getOperation(vnfmOperation.getVnfmId(), vnfmOperation.getOperationId());
+ final Optional<InlineResponse200> operationOptional = vnfmServiceProvider.getOperation(
+ aaiServiceProvider.invokeGetVnfm(vnfmOperation.getVnfmId()), vnfmOperation.getOperationId());
if (!operationOptional.isPresent()) {
return response.operationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.OPERATION_NOT_FOUND);
}
final InlineResponse200 operation = operationOptional.get();
- logger.debug(
- "Job Id: " + jobId + ", operationId: " + operation.getId() + ", operation details: " + operation);
+ logger.debug("Job Id: {} operationId: {} operation details: {} ", jobId, operation.getId(), operation);
if (operation.getOperationState() == null) {
return response.operationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
@@ -124,15 +126,16 @@ public class JobManager {
private OperationStateEnum getOperationState(final VnfmOperation vnfmOperation,
final InlineResponse200 operationResponse) {
switch (vnfmOperation.getNotificationStatus()) {
- case NOTIFICATION_PROCESSING_NOT_REQUIRED:
- default:
- return OperationStateEnum.fromValue(operationResponse.getOperationState().getValue());
case NOTIFICATION_PROCESSING_PENDING:
return org.onap.vnfmadapter.v1.model.OperationStateEnum.PROCESSING;
case NOTIFICATION_PROCEESING_SUCCESSFUL:
return org.onap.vnfmadapter.v1.model.OperationStateEnum.COMPLETED;
case NOTIFICATION_PROCESSING_FAILED:
return org.onap.vnfmadapter.v1.model.OperationStateEnum.FAILED;
+ default:
+ if (operationResponse == null || operationResponse.getOperationState() == null)
+ return null;
+ return OperationStateEnum.fromValue(operationResponse.getOperationState().getValue());
}
}
@@ -145,7 +148,8 @@ public class JobManager {
if (relatedOperation.isPresent()) {
relatedOperation.get().setNotificationProcessed(notificationProcessingWasSuccessful);
} else {
- logger.debug("No operation found for operation ID " + operationId);
+ logger.debug("No operation found for operation ID {} ", operationId);
+
}
}
@@ -154,9 +158,9 @@ public class JobManager {
final java.util.Optional<VnfmOperation> relatedOperation = mapOfJobIdToVnfmOperation.values().stream()
.filter(operation -> operation.getOperationId().equals(operationId)).findFirst();
if (relatedOperation.isPresent()) {
- relatedOperation.get().setVnfDeleted();;
+ relatedOperation.get().setVnfDeleted();
} else {
- logger.debug("No operation found for operation ID " + operationId);
+ logger.debug("No operation found for operation ID {} ", operationId);
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
index fa2fa30b4a..0aad91e5be 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
@@ -82,16 +82,15 @@ public class LifecycleManager {
*/
public CreateVnfResponse createVnf(final String vnfIdInAai, final CreateVnfRequest request) {
final GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
- checkIfVnfAlreadyExistsInVnfm(genericVnf);
-
EsrVnfm vnfm = aaiHelper.getAssignedVnfm(genericVnf);
+ checkIfVnfAlreadyExistsInVnfm(vnfm, genericVnf);
+
if (vnfm == null) {
vnfm = aaiHelper.selectVnfm(genericVnf);
aaiHelper.addRelationshipFromGenericVnfToVnfm(genericVnf, vnfm.getVnfmId());
}
aaiHelper.addRelationshipFromGenericVnfToTenant(genericVnf, request.getTenant());
- final InlineResponse201 vnfmResponse =
- sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm.getVnfmId());
+ final InlineResponse201 vnfmResponse = sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm);
logger.info("Create response: {}", vnfmResponse);
@@ -102,8 +101,8 @@ public class LifecycleManager {
final OamIpAddressSource oamIpAddressSource = extractOamIpAddressSource(request);
aaiHelper.setOamIpAddressSource(vnfIdInVnfm, oamIpAddressSource);
- createNotificationSubscription(vnfm.getVnfmId(), vnfIdInVnfm);
- final String operationId = sendInstantiateRequestToVnfm(vnfm, genericVnf, request, vnfIdInAai, vnfIdInVnfm);
+ createNotificationSubscription(vnfm, vnfIdInVnfm);
+ final String operationId = sendInstantiateRequestToVnfm(vnfm, genericVnf, request);
final String jobId = jobManager.createJob(vnfm.getVnfmId(), operationId, false);
final CreateVnfResponse response = new CreateVnfResponse();
@@ -133,11 +132,11 @@ public class LifecycleManager {
}
}
- private void checkIfVnfAlreadyExistsInVnfm(final GenericVnf genericVnf) {
- if (genericVnf.getSelflink() != null && !genericVnf.getSelflink().isEmpty()) {
+ private void checkIfVnfAlreadyExistsInVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf) {
+ if (genericVnf.getSelflink() != null && !genericVnf.getSelflink().isEmpty() && vnfm != null) {
Optional<InlineResponse201> response = Optional.absent();
try {
- response = vnfmServiceProvider.getVnf(genericVnf.getSelflink());
+ response = vnfmServiceProvider.getVnf(vnfm, genericVnf.getSelflink());
} catch (final Exception exception) {
logger.debug("Ignoring invalid self link in generic vnf", exception);
}
@@ -149,7 +148,7 @@ public class LifecycleManager {
}
private InlineResponse201 sendCreateRequestToVnfm(final CreateVnfRequest aaiRequest, final GenericVnf genericVnf,
- final String vnfIdInAai, final String vnfmId) {
+ 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();
@@ -159,7 +158,7 @@ public class LifecycleManager {
vnfmRequest.setVnfInstanceName(aaiRequest.getName().replaceAll(" ", "_"));
vnfmRequest.setVnfInstanceDescription(vnfIdInAai);
- final Optional<InlineResponse201> optionalResponse = vnfmServiceProvider.createVnf(vnfmId, vnfmRequest);
+ final Optional<InlineResponse201> optionalResponse = vnfmServiceProvider.createVnf(vnfm, vnfmRequest);
try {
return optionalResponse.get();
@@ -170,24 +169,24 @@ public class LifecycleManager {
}
}
- private void createNotificationSubscription(final String vnfmId, final String vnfId) {
+ private void createNotificationSubscription(final EsrVnfm vnfm, final String vnfId) {
try {
final LccnSubscriptionRequest subscriptionRequest = vnfmHelper.createNotificationSubscriptionRequest(vnfId);
- vnfmServiceProvider.subscribeForNotifications(vnfmId, subscriptionRequest);
+ vnfmServiceProvider.subscribeForNotifications(vnfm, subscriptionRequest);
} catch (final Exception exception) {
- logger.warn("Subscription for notifications to VNFM: " + vnfmId + " for VNF " + vnfId
+ logger.warn("Subscription for notifications to VNFM: " + vnfm.getVnfmId() + " for VNF " + vnfId
+ " failed. AAI will not be updated unless the VNFM is configured by other means to send notifications relating to this VNF",
exception);
}
}
private String sendInstantiateRequestToVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf,
- final CreateVnfRequest createVnfRequest, final String vnfIdInAai, final String vnfIdInVnfm) {
+ final CreateVnfRequest createVnfRequest) {
final InstantiateVnfRequest instantiateVnfRequest =
vnfmHelper.createInstantiateRequest(createVnfRequest.getTenant(), createVnfRequest,
packageProvider.getFlavourId(genericVnf.getModelVersionId()));
- final String jobId = vnfmServiceProvider.instantiateVnf(genericVnf.getSelflink(), instantiateVnfRequest);
+ final String jobId = vnfmServiceProvider.instantiateVnf(vnfm, genericVnf.getSelflink(), instantiateVnfRequest);
logger.info("Instantiate VNF request successfully sent to " + genericVnf.getSelflink());
return jobId;
@@ -201,18 +200,18 @@ public class LifecycleManager {
*/
public DeleteVnfResponse deleteVnf(final String vnfIdInAai) {
final GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
- final String vnfmId = getIdOfAssignedVnfm(genericVnf);
+ final EsrVnfm vnfm = getAssignedVnfm(genericVnf);
- final String operationId = sendTerminateRequestToVnfm(genericVnf);
- final String jobId = jobManager.createJob(vnfmId, operationId, true);
+ final String operationId = sendTerminateRequestToVnfm(vnfm, genericVnf);
+ final String jobId = jobManager.createJob(vnfm.getVnfmId(), operationId, true);
return new DeleteVnfResponse().jobId(jobId);
}
- private String sendTerminateRequestToVnfm(final GenericVnf genericVnf) {
+ private String sendTerminateRequestToVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf) {
final TerminateVnfRequest terminateVnfRequest = new TerminateVnfRequest();
terminateVnfRequest.setTerminationType(TerminationTypeEnum.FORCEFUL);
- return vnfmServiceProvider.terminateVnf(genericVnf.getSelflink(), terminateVnfRequest);
+ return vnfmServiceProvider.terminateVnf(vnfm, genericVnf.getSelflink(), terminateVnfRequest);
}
private GenericVnf getGenericVnfFromAai(final String vnfIdInAai) {
@@ -224,11 +223,11 @@ public class LifecycleManager {
return genericVnf;
}
- private String getIdOfAssignedVnfm(final GenericVnf genericVnf) {
- final String vnfmId = aaiHelper.getIdOfAssignedVnfm(genericVnf);
- if (vnfmId == null) {
+ private EsrVnfm getAssignedVnfm(final GenericVnf genericVnf) {
+ final EsrVnfm vnfm = aaiHelper.getAssignedVnfm(genericVnf);
+ if (vnfm == null) {
throw new VnfmNotFoundException("No VNFM found in AAI for VNF " + genericVnf.getVnfId());
}
- return vnfmId;
+ return vnfm;
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
index 93c7ea91ff..eb912c8775 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
@@ -156,7 +156,7 @@ public class NotificationHandler implements Runnable {
boolean deleteSuccessful = false;
try {
- vnfmServiceProvider.deleteVnf(genericVnf.getSelflink());
+ vnfmServiceProvider.deleteVnf(aaiHelper.getAssignedVnfm(genericVnf), genericVnf.getSelflink());
deleteSuccessful = true;
} finally {
jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId(),
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java
new file mode 100644
index 0000000000..7f71b2e9d6
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.vnfmadapter.oauth;
+
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
+
+@Configuration
+@EnableAuthorizationServer
+/**
+ * Configures the authorization server for oauth token based authentication.
+ */
+public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
+
+ private static final int ONE_DAY = 60 * 60 * 24;
+
+ @Value("${vnfmadapter.auth:E39823AAB2739CC654C4E92B52C05BC34149342D0A46451B00CA508C8EDC62242CE4E9DA9445D3C01A3F13}")
+ private String vnfmAdapterAuth;
+
+ @Value("${mso.key}")
+ private String msoEncryptionKey;
+
+ @Override
+ public void configure(final ClientDetailsServiceConfigurer clients) throws Exception {
+ final String[] decrypedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoEncryptionKey).split(":");
+ 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/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java
new file mode 100644
index 0000000000..2f51406e23
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java
@@ -0,0 +1,51 @@
+/*-
+ * ============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.vnfmadapter.oauth;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import java.lang.reflect.Type;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+public class OAuth2AccessTokenAdapter implements JsonSerializer<OAuth2AccessToken> {
+
+ @Override
+ public JsonElement serialize(final OAuth2AccessToken src, final Type typeOfSrc,
+ final JsonSerializationContext context) {
+ final JsonObject obj = new JsonObject();
+ obj.addProperty(OAuth2AccessToken.ACCESS_TOKEN, src.getValue());
+ obj.addProperty(OAuth2AccessToken.TOKEN_TYPE, src.getTokenType());
+ if (src.getRefreshToken() != null) {
+ obj.addProperty(OAuth2AccessToken.REFRESH_TOKEN, src.getRefreshToken().getValue());
+ }
+ obj.addProperty(OAuth2AccessToken.EXPIRES_IN, src.getExpiresIn());
+ final JsonArray scopeObj = new JsonArray();
+ for (final String scope : src.getScope()) {
+ scopeObj.add(scope);
+ }
+ obj.add(OAuth2AccessToken.SCOPE, scopeObj);
+
+ return obj;
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java
new file mode 100644
index 0000000000..1f0594e811
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java
@@ -0,0 +1,52 @@
+/*-
+ * ============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.vnfmadapter.oauth;
+
+import javax.servlet.http.HttpServletRequest;
+import org.onap.so.adapters.vnfmadapter.Constants;
+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;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+import org.springframework.security.web.util.matcher.RequestMatcher;
+
+@Configuration
+@EnableResourceServer
+/**
+ * Enforces oauth token based authentication when a token is provided in the request.
+ */
+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();
+ }
+
+ private static class OAuth2ResourceServerRequestMatcher implements RequestMatcher {
+ @Override
+ public boolean matches(HttpServletRequest request) {
+ String auth = request.getHeader("Authorization");
+ String uri = request.getRequestURI();
+ return (auth != null && auth.startsWith("Bearer") && (uri.contains("/grants") || uri.contains("/lcn/")));
+ }
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
index 9cb09e6261..f97822a0cd 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
@@ -20,6 +20,14 @@
package org.onap.so.adapters.vnfmadapter.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.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;
@@ -39,12 +47,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-import javax.ws.rs.core.MediaType;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
-import static org.slf4j.LoggerFactory.getLogger;
/**
* Controller for handling notifications from the VNFM (Virtual Network Function Manager).
@@ -118,8 +120,12 @@ public class Sol003LcnContoller {
private InlineResponse201 getVnfInstance(
final VnfLcmOperationOccurrenceNotification vnfLcmOperationOccurrenceNotification) {
- return vnfmServiceProvider.getVnf(vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref())
- .get();
+ GenericVnf vnfInAai = aaiServiceProvider
+ .invokeQueryGenericVnf(vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref())
+ .getGenericVnf().get(0);
+ 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/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
index aeb7cd3540..89a2c102f4 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
@@ -46,6 +46,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.hamcrest.MockitoHamcrest;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Relationship;
@@ -169,6 +171,7 @@ public class Sol003LcnControllerTest {
.andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON));
final GenericVnf genericVnf = createGenericVnf("vnfmType1");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
final List<GenericVnf> listOfGenericVnfs = new ArrayList<>();
listOfGenericVnfs.add(genericVnf);
final GenericVnfs genericVnfs = new GenericVnfs();
@@ -176,6 +179,12 @@ 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();
+ vnfm.setVnfmId("vnfm1");
+ final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
+ vnfm.setEsrSystemInfoList(esrSystemInfoList);
+ doReturn(Optional.of(vnfm)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1?depth=1")));
final ResponseEntity<Void> response =
controller.lcnVnfLcmOperationOccurrenceNotificationPost(vnfLcmOperationOccurrenceNotification);
@@ -226,6 +235,7 @@ public class Sol003LcnControllerTest {
.andRespond(withStatus(HttpStatus.NO_CONTENT).contentType(MediaType.APPLICATION_JSON));
final GenericVnf genericVnf = createGenericVnf("vnfmType1");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
genericVnf.setSelflink("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm");
final List<GenericVnf> listOfGenericVnfs = new ArrayList<>();
listOfGenericVnfs.add(genericVnf);
@@ -236,6 +246,12 @@ 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();
+ vnfm.setVnfmId("vnfm1");
+ final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
+ vnfm.setEsrSystemInfoList(esrSystemInfoList);
+ doReturn(Optional.of(vnfm)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1?depth=1")));
final ResponseEntity<Void> response =
controller.lcnVnfLcmOperationOccurrenceNotificationPost(vnfLcmOperationOccurrenceNotification);
@@ -323,6 +339,22 @@ public class Sol003LcnControllerTest {
return genericVnf;
}
+ private void addRelationshipFromGenericVnfToVnfm(final GenericVnf genericVnf, final String vnfmId) {
+ final Relationship relationshipToVnfm = new Relationship();
+ relationshipToVnfm.setRelatedLink("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/" + vnfmId);
+ relationshipToVnfm.setRelatedTo("esr-vnfm");
+ final RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipKey("esr-vnfm.vnfm-id");
+ relationshipData.setRelationshipValue(vnfmId);
+ relationshipToVnfm.getRelationshipData().add(relationshipData);
+
+ if (genericVnf.getRelationshipList() == null) {
+ final RelationshipList relationshipList = new RelationshipList();
+ genericVnf.setRelationshipList(relationshipList);
+ }
+ genericVnf.getRelationshipList().getRelationship().add(relationshipToVnfm);
+ }
+
private void addRelationshipFromGenericVnfToVserver(final GenericVnf genericVnf, final String vserverId) {
final Relationship relationshipToVserver = new Relationship();
relationshipToVserver.setRelatedTo("vserver");
@@ -343,9 +375,11 @@ public class Sol003LcnControllerTest {
relationshipData4.setRelationshipValue(TENANT_ID);
relationshipToVserver.getRelationshipData().add(relationshipData4);
- final RelationshipList relationshipList = new RelationshipList();
- relationshipList.getRelationship().add(relationshipToVserver);
- genericVnf.setRelationshipList(relationshipList);
+ if (genericVnf.getRelationshipList() == null) {
+ final RelationshipList relationshipList = new RelationshipList();
+ genericVnf.setRelationshipList(relationshipList);
+ }
+ genericVnf.getRelationshipList().getRelationship().add(relationshipToVserver);
}
private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
index b48de30f88..fe55907420 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -133,7 +133,7 @@ public class VnfmAdapterControllerTest {
setUpVimInMockAai();
final String expectedsubscriptionRequest =
- "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"BASIC\"],\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"password1$\"}}}";
+ "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"OAUTH2_CLIENT_CREDENTIALS\", \"BASIC\", \"TLS_CERT\"],\"paramsOauth2ClientCredentials\":{\"clientId\":\"vnfm\",\"clientPassword\":\"password1$\",\"tokenEndpoint\":\"https://so-vnfm-adapter.onap:30406/oauth/token\"},\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"password1$\"}}}";
final InlineResponse2001 subscriptionResponse = new InlineResponse2001();
final InlineResponse201 createResponse = createCreateResponse();
@@ -214,6 +214,8 @@ public class VnfmAdapterControllerTest {
final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType1");
addSelfLinkToGenericVnf(genericVnf);
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ setUpVnfmsInMockAai();
final InlineResponse201 reponse = new InlineResponse201();
mockRestServer.expect(requestTo(new URI("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm")))
@@ -239,7 +241,7 @@ public class VnfmAdapterControllerTest {
final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType2");
- addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm2");
setUpVnfmsInMockAai();
setUpVimInMockAai();
@@ -279,24 +281,25 @@ public class VnfmAdapterControllerTest {
public void deleteVnf_ValidRequest_Returns202AndJobId() throws Exception {
final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
- final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType");
+ final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType1");
addSelfLinkToGenericVnf(genericVnf);
- addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ setUpVnfmsInMockAai();
mockRestServer.expect(requestTo("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm/terminate"))
.andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON)
- .location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/1234567")));
+ .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);
- mockRestServer.expect(requestTo("http://vnfm:8080/vnf_lcm_op_occs/1234567"))
+ 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);
- mockRestServer.expect(requestTo("http://vnfm:8080/vnf_lcm_op_occs/1234567"))
+ mockRestServer.expect(requestTo("http://vnfm1:8080/vnf_lcm_op_occs/1234567"))
.andRespond(withSuccess(gson.toJson(secondOperationQueryReponse), MediaType.APPLICATION_JSON));
final RequestEntity<Void> request = RequestEntity
@@ -308,16 +311,6 @@ public class VnfmAdapterControllerTest {
assertEquals(202, deleteVnfResponse.getStatusCode().value());
assertNotNull(deleteVnfResponse.getBody().getJobId());
- final EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
- esrSystemInfo.setServiceUrl("http://vnfm:8080");
- esrSystemInfo.setType("vnfmType");
- esrSystemInfo.setSystemType("VNFM");
- final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- esrSystemInfoList.getEsrSystemInfo().add(esrSystemInfo);
-
- doReturn(Optional.of(esrSystemInfoList)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/...")));
-
final ResponseEntity<QueryJobResponse> firstJobQueryResponse =
controller.jobQuery(deleteVnfResponse.getBody().getJobId(), "", "so", "1213");
assertEquals(OperationEnum.TERMINATE, firstJobQueryResponse.getBody().getOperation());
@@ -367,9 +360,10 @@ public class VnfmAdapterControllerTest {
public void deleteVnf_ErrorStatusCodeFromVnfm_Returns500() throws Exception {
final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
- final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType");
+ final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType1");
addSelfLinkToGenericVnf(genericVnf);
- addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ setUpVnfmsInMockAai();
mockRestServer.expect(requestTo("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm/terminate"))
.andRespond(withStatus(HttpStatus.BAD_REQUEST).contentType(MediaType.APPLICATION_JSON));
@@ -419,12 +413,7 @@ public class VnfmAdapterControllerTest {
private void addRelationshipFromGenericVnfToVnfm(final GenericVnf genericVnf, final String vnfmId) {
final Relationship relationshipToVnfm = new Relationship();
- relationshipToVnfm.setRelatedLink(
- "/aai/v15/external-system/esr-vnfm-li// final InlineResponse201 vnfInstance = new InlineResponse201();\n"
- + "// vnfInstance.setInstantiationState(InstantiationStateEnum.NOT_INSTANTIATED);\n"
- + "// mockRestServer.expect(requestTo(\"http://dummy.value/until/create/implememted/vnfId\"))\n"
- + "// .andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON));st/esr-vnfm/"
- + vnfmId);
+ relationshipToVnfm.setRelatedLink("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/" + vnfmId);
relationshipToVnfm.setRelatedTo("esr-vnfm");
final RelationshipData relationshipData = new RelationshipData();
relationshipData.setRelationshipKey("esr-vnfm.vnfm-id");
@@ -465,6 +454,12 @@ public class VnfmAdapterControllerTest {
esrVnfmList.getEsrVnfm().add(esrVnfm1);
esrVnfmList.getEsrVnfm().add(esrVnfm2);
+ doReturn(Optional.of(esrVnfm1)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1?depth=1")));
+
+ doReturn(Optional.of(esrVnfm2)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm2?depth=1")));
+
doReturn(Optional.of(esrVnfmList)).when(aaiResourcesClient).get(eq(EsrVnfmList.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list")));
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 325ba913f8..7f1c1968c1 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -20,6 +20,8 @@
package org.onap.so.asdc.activity;
+import java.net.HttpURLConnection;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.onap.so.logger.LoggingAnchor;
@@ -27,6 +29,7 @@ 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 org.apache.http.HttpStatus;
import org.onap.so.asdc.activity.beans.ActivitySpec;
import org.onap.so.asdc.activity.beans.Input;
import org.onap.so.asdc.activity.beans.Output;
@@ -59,6 +62,11 @@ public class DeployActivitySpecs {
String hostname = env.getProperty(SDC_ENDPOINT);
logger.debug("{} {}", "SDC ActivitySpec endpoint: ", hostname);
if (hostname == null || hostname.isEmpty()) {
+ logger.warn("The hostname for SDC activities deployment is not configured in SO");
+ return;
+ }
+ if (!checkHttpOk(hostname)) {
+ logger.warn("The sdc end point is not alive");
return;
}
List<org.onap.so.db.catalog.beans.ActivitySpec> activitySpecsFromCatalog = activitySpecRepository.findAll();
@@ -92,15 +100,13 @@ public class DeployActivitySpecs {
private void mapCategoryList(List<ActivitySpecActivitySpecCategories> activitySpecActivitySpecCategories,
ActivitySpec activitySpec) {
- if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.size() == 0) {
+ if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.isEmpty()) {
return;
}
List<String> categoryList = new ArrayList<>();
for (ActivitySpecActivitySpecCategories activitySpecCat : activitySpecActivitySpecCategories) {
- if (activitySpecCat != null) {
- if (activitySpecCat.getActivitySpecCategories() != null) {
- categoryList.add(activitySpecCat.getActivitySpecCategories().getName());
- }
+ if (activitySpecCat != null && activitySpecCat.getActivitySpecCategories() != null) {
+ categoryList.add(activitySpecCat.getActivitySpecCategories().getName());
}
}
activitySpec.setCategoryList(categoryList);
@@ -108,7 +114,7 @@ public class DeployActivitySpecs {
private void mapInputsAndOutputs(List<ActivitySpecActivitySpecParameters> activitySpecActivitySpecParameters,
ActivitySpec activitySpec) {
- if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.size() == 0) {
+ if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.isEmpty()) {
return;
}
List<Input> inputs = new ArrayList<>();
@@ -137,4 +143,22 @@ public class DeployActivitySpecs {
activitySpec.setOutputs(outputs);
return;
}
+
+ public boolean checkHttpOk(String host) {
+ URL url = null;
+ boolean isOk = false;
+
+ int responseCode = 0;
+ try {
+ url = new URL(host);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ responseCode = connection.getResponseCode();
+ } catch (Exception e) {
+ logger.warn("Exception on connecting to SDC WFD endpoint: " + e.getMessage());
+ }
+ if (responseCode == HttpStatus.SC_OK) {
+ isOk = true;
+ }
+ return isOk;
+ }
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 3b9406a697..90116ad4f5 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -37,6 +37,7 @@ import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
import org.onap.so.logger.LoggingAnchor;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
@@ -71,6 +72,7 @@ import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
@@ -588,6 +590,10 @@ public class ASDCController {
logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(),
String.valueOf(noOfArtifacts), iNotif.getServiceUUID(), "ASDC");
try {
+
+ if (iNotif.getDistributionID() != null && !iNotif.getDistributionID().isEmpty()) {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, iNotif.getDistributionID());
+ }
logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(),
"ASDC", "treatNotification");
@@ -736,8 +742,7 @@ public class ASDCController {
logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID());
- if ("VF".equals(resourceType) && resource.getArtifacts() != null
- && !resource.getArtifacts().isEmpty()) {
+ if ("VF".equals(resourceType)) {
resourceStructure = new VfResourceStructure(iNotif, resource);
} else if ("PNF".equals(resourceType)) {
resourceStructure = new PnfResourceStructure(iNotif, resource);
@@ -755,8 +760,8 @@ public class ASDCController {
logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: "
+ resourceStructure.getResourceInstance().getResourceUUID());
- if ("VF".equals(resourceType) && resource.getArtifacts() != null
- && !resource.getArtifacts().isEmpty()) {
+
+ if ("VF".equals(resourceType)) {
hasVFResource = true;
for (IArtifactInfo artifact : resource.getArtifacts()) {
IDistributionClientDownloadResult resultArtifact =
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java
index 8be3d6ba06..f2c6b2f16a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java
@@ -61,7 +61,7 @@ public abstract class ResourceStructure {
/**
* Number of resources provided by the resource structure.
*/
- protected int NumberOfResources;
+ protected int numberOfResources;
/**
* The list of artifacts existing in this resource hashed by UUID.
@@ -142,11 +142,11 @@ public abstract class ResourceStructure {
}
public int getNumberOfResources() {
- return NumberOfResources;
+ return numberOfResources;
}
public void setNumberOfResources(int numberOfResources) {
- NumberOfResources = numberOfResources;
+ this.numberOfResources = numberOfResources;
}
public Map<String, VfModuleArtifact> getArtifactsMapByUUID() {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
index 095741c19b..195aa7e302 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -33,7 +33,6 @@ import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
-import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
@@ -49,6 +48,7 @@ import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.HttpClientBuilder;
import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -71,9 +71,8 @@ public class BpmnInstaller {
public void installBpmn(String csarFilePath) {
logger.info("Deploying BPMN files from {}", csarFilePath);
- try {
- ZipInputStream csarFile =
- new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()));
+ try (ZipInputStream csarFile =
+ new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()))) {
ZipEntry entry = csarFile.getNextEntry();
while (entry != null) {
@@ -103,7 +102,6 @@ public class BpmnInstaller {
}
entry = csarFile.getNextEntry();
}
- csarFile.close();
} catch (IOException ex) {
logger.debug("Exception :", ex);
logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
index 46c440db0d..ef4dfa24aa 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
@@ -52,7 +52,7 @@ import org.springframework.stereotype.Component;
public class WorkflowResource {
protected static final Logger logger = LoggerFactory.getLogger(WorkflowResource.class);
- private static final String pattern = ".*\\\"activity:(.*)\\\" .*";
+ private static final String PATTERN = ".*\\\"activity:(.*)\\\" .*";
private static final String TARGET_RESOURCE_VNF = "vnf";
private static final String SOURCE_SDC = "sdc";
private static final String BPMN_SUFFIX = ".bpmn";
@@ -140,7 +140,7 @@ public class WorkflowResource {
VnfResourceWorkflow vnfResourceWorkflow = new VnfResourceWorkflow();
vnfResourceWorkflow.setVnfResourceModelUUID(vfResourceModelUuid);
vnfResourceWorkflow.setWorkflow(workflow);
- List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<VnfResourceWorkflow>();
+ List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<>();
vnfResourceWorkflows.add(vnfResourceWorkflow);
workflow.setVnfResourceWorkflow(vnfResourceWorkflows);
@@ -174,9 +174,9 @@ public class WorkflowResource {
}
protected List<String> getActivityNameList(String bpmnContent) {
- List<String> activityNameList = new ArrayList<String>();
+ List<String> activityNameList = new ArrayList<>();
- Pattern p = Pattern.compile(pattern);
+ Pattern p = Pattern.compile(PATTERN);
Matcher m = p.matcher(bpmnContent);
while (m.find()) {
activityNameList.add(m.group(1));
@@ -186,10 +186,10 @@ public class WorkflowResource {
protected List<WorkflowActivitySpecSequence> getWorkflowActivitySpecSequence(List<String> activityNames,
Workflow workflow) throws Exception {
- if (activityNames == null || activityNames.size() == 0) {
+ if (activityNames == null || activityNames.isEmpty()) {
return null;
}
- List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<WorkflowActivitySpecSequence>();
+ List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<>();
int seqNo = 1;
for (String activityName : activityNames) {
ActivitySpec activitySpec = activityRepo.findByName(activityName);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index e4c95f6290..e8e068a71a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -26,6 +26,7 @@ package org.onap.so.asdc.installer.heat;
import java.sql.Timestamp;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -47,7 +48,9 @@ import org.onap.sdc.api.notification.IStatusData;
import org.onap.sdc.tosca.parser.api.IEntityDetails;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.elements.queries.EntityQuery;
+import org.onap.sdc.tosca.parser.elements.queries.EntityQuery.EntityQueryBuilder;
import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery;
+import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery.TopologyTemplateQueryBuilder;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
import org.onap.sdc.toscaparser.api.*;
@@ -432,17 +435,26 @@ public class ToscaResourceInstaller {
Service service = toscaResourceStruct.getCatalogService();
List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
- for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
- Metadata metadata = nodeTemplate.getMetaData();
- String vfCustomizationCategory = toscaResourceStruct.getSdcCsarHelper()
- .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY);
- processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata,
- vfCustomizationCategory);
+ List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct,
+ EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+ List<IEntityDetails> arEntityDetails = new ArrayList<IEntityDetails>();
+
+ for (IEntityDetails vfEntityDetails : vfEntityList) {
+
+ Metadata metadata = vfEntityDetails.getMetadata();
+ String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+
+ if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) {
+ arEntityDetails.add(vfEntityDetails);
+ }
+
+ processVfModules(vfEntityDetails, vfNodeTemplatesList.get(0), toscaResourceStruct, vfResourceStructure,
+ service, metadata);
}
processResourceSequence(toscaResourceStruct, service);
- List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
- processAllottedResources(toscaResourceStruct, service, allottedResourceList);
+ processAllottedResources(arEntityDetails, toscaResourceStruct, service);
processNetworks(toscaResourceStruct, service);
// process Network Collections
processNetworkCollections(toscaResourceStruct, service);
@@ -569,7 +581,8 @@ public class ToscaResourceInstaller {
String outInput;
String defaultValue = null;
if (value instanceof Map) {
- outInput = ((LinkedHashMap) value).values().toArray()[0].toString();
+ Collection values = ((LinkedHashMap) value).values();
+ outInput = (values.size() > 0) ? values.toArray()[0].toString() : "";
} else if (value instanceof GetInput) {
String inputName = ((GetInput) value).getInputName();
Optional<Input> inputOptional =
@@ -629,7 +642,8 @@ public class ToscaResourceInstaller {
protected void processNetworks(ToscaResourceStructure toscaResourceStruct, Service service)
throws ArtifactInstallerException {
- List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, SdcTypes.VL, SdcTypes.SERVICE);
+ List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.VL),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
if (vlEntityList != null) {
for (IEntityDetails vlEntity : vlEntityList) {
@@ -645,7 +659,10 @@ public class ToscaResourceInstaller {
NetworkResourceCustomization networkCustomization = createNetwork(vlEntity, toscaResourceStruct,
heatTemplate, tempNetworkLookUp.getAicVersionMax(),
tempNetworkLookUp.getAicVersionMin(), service);
- service.getNetworkCustomizations().add(networkCustomization);
+ // only insert unique entries
+ if (!service.getNetworkCustomizations().contains(networkCustomization)) {
+ service.getNetworkCustomizations().add(networkCustomization);
+ }
} else {
throw new ArtifactInstallerException("No HeatTemplate found for artifactUUID: "
+ tempNetworkLookUp.getHeatTemplateArtifactUuid());
@@ -653,6 +670,8 @@ public class ToscaResourceInstaller {
} else {
NetworkResourceCustomization networkCustomization =
createNetwork(vlEntity, toscaResourceStruct, null, null, null, service);
+ networkCustomization.setResourceInput(
+ getResourceInput(toscaResourceStruct, networkCustomization.getModelCustomizationUUID()));
service.getNetworkCustomizations().add(networkCustomization);
logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for "
+ networkResourceModelName);
@@ -662,12 +681,32 @@ public class ToscaResourceInstaller {
}
}
- protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service,
- List<NodeTemplate> allottedResourceList) {
- if (allottedResourceList != null) {
- for (NodeTemplate allottedNode : allottedResourceList) {
- service.getAllottedCustomizations()
- .add(createAllottedResource(allottedNode, toscaResourceStruct, service));
+ protected void processAllottedResources(List<IEntityDetails> arEntityDetails,
+ ToscaResourceStructure toscaResourceStruct, Service service) throws ArtifactInstallerException {
+
+ List<IEntityDetails> pnfAREntityList = getEntityDetails(toscaResourceStruct,
+ EntityQuery.newBuilder(SdcTypes.PNF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+ for (IEntityDetails pnfEntity : pnfAREntityList) {
+
+ Metadata metadata = pnfEntity.getMetadata();
+ String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) {
+ arEntityDetails.add(pnfEntity);
+ }
+
+ }
+
+ if (arEntityDetails != null) {
+ for (IEntityDetails arEntity : arEntityDetails) {
+ AllottedResourceCustomization allottedResource =
+ createAllottedResource(arEntity, toscaResourceStruct, service);
+ String resourceInput =
+ getResourceInput(toscaResourceStruct, allottedResource.getModelCustomizationUUID());
+ if (!"{}".equals(resourceInput)) {
+ allottedResource.setResourceInput(resourceInput);
+ }
+ service.getAllottedCustomizations().add(allottedResource);
}
}
}
@@ -802,13 +841,13 @@ public class ToscaResourceInstaller {
protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) {
- List<NodeTemplate> networkCollectionList =
- toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
+ List<IEntityDetails> crEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.CR),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
- if (networkCollectionList != null) {
- for (NodeTemplate crNode : networkCollectionList) {
+ if (crEntityList != null) {
+ for (IEntityDetails ncEntity : crEntityList) {
- createNetworkCollection(crNode, toscaResourceStruct, service);
+ createNetworkCollection(ncEntity, toscaResourceStruct, service);
collectionRepo.saveAndFlush(toscaResourceStruct.getCatalogCollectionResource());
List<NetworkInstanceGroup> networkInstanceGroupList =
@@ -952,34 +991,37 @@ public class ToscaResourceInstaller {
return String.valueOf(value);
}
- protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure,
- Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory)
- throws Exception {
+ protected void processVfModules(IEntityDetails vfEntityDetails, NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure, Service service,
+ Metadata metadata) throws Exception {
+
+ String vfCustomizationCategory =
+ vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
logger.debug("VF Category is : " + vfCustomizationCategory);
- if (vfResourceStructure.getVfModuleStructure() != null
- && !vfResourceStructure.getVfModuleStructure().isEmpty()) {
+ String vfCustomizationUUID =
+ vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper().getMetadataPropertyValue(metadata,
- SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
+ logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
- IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance();
+ IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance();
- // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before
- // comparing their VF Modules UUID's
- logger.debug("Checking if Notification VF ResourceCustomizationUUID: "
- + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: "
- + vfCustomizationUUID);
+ // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before
+ // comparing their VF Modules UUID's
+ logger.debug("Checking if Notification VF ResourceCustomizationUUID: "
+ + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: "
+ + vfCustomizationUUID);
- if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
+ if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
- logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
- + " matches vfNotificationResource CustomizationUUID");
+ logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
+ + " matches vfNotificationResource CustomizationUUID");
- VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
+ VnfResourceCustomization vnfResource = createVnfResource(vfEntityDetails, toscaResourceStruct, service);
+ if (vfResourceStructure.getVfModuleStructure() != null
+ && !vfResourceStructure.getVfModuleStructure().isEmpty()) {
Set<CvnfcCustomization> existingCvnfcSet = new HashSet<>();
Set<VnfcCustomization> existingVnfcSet = new HashSet<>();
List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom = new ArrayList<>();
@@ -987,14 +1029,19 @@ public class ToscaResourceInstaller {
for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
- List<org.onap.sdc.toscaparser.api.Group> vfGroups =
- toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
+
+ List<IEntityDetails> vfModuleEntityList =
+ getEntityDetails(toscaResourceStruct,
+ EntityQuery.newBuilder("org.openecomp.groups.VfModule"), TopologyTemplateQuery
+ .newBuilder(SdcTypes.SERVICE).customizationUUID(vfCustomizationUUID),
+ false);
+
IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : "
+ vfMetadata.getVfModuleModelCustomizationUUID());
- Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream()
+ Optional<IEntityDetails> matchingObject = vfModuleEntityList.stream()
.peek(group -> logger.debug("To Csar Group VFModuleModelCustomizationUUID "
+ group.getMetadata().getValue("vfModuleModelCustomizationUUID")))
.filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID")
@@ -1002,7 +1049,7 @@ public class ToscaResourceInstaller {
.findFirst();
if (matchingObject.isPresent()) {
VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(),
- nodeTemplate, toscaResourceStruct, vfResourceStructure, vfMetadata, vnfResource,
+ toscaResourceStruct, vfResourceStructure, vfMetadata, vnfResource, service,
existingCvnfcSet, existingVnfcSet, existingCvnfcConfigurationCustom);
vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources());
} else
@@ -1011,113 +1058,121 @@ public class ToscaResourceInstaller {
+ vfMetadata.getVfModuleModelCustomizationUUID());
}
+ }
- // Check for VNFC Instance Group info and add it if there is
- List<Group> groupList =
- toscaResourceStruct.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(
- nodeTemplate, "org.openecomp.groups.VfcInstanceGroup");
+ // Check for VNFC Instance Group info and add it if there is
+ List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStruct,
+ EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF).customizationUUID(vfCustomizationUUID), false);
- for (Group group : groupList) {
- VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization =
- createVNFCInstanceGroup(nodeTemplate, group, vnfResource, toscaResourceStruct);
- vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization);
- }
- List<String> seqResult = processVNFCGroupSequence(toscaResourceStruct, groupList);
- if (!CollectionUtils.isEmpty(seqResult)) {
- String resultStr = seqResult.stream().collect(Collectors.joining(","));
- vnfResource.setVnfcInstanceGroupOrder(resultStr);
- logger.debug(
- "vnfcGroupOrder result for service uuid(" + service.getModelUUID() + ") : " + resultStr);
- }
- // add this vnfResource with existing vnfResource for this service
- addVnfCustomization(service, vnfResource);
- } else {
- logger.debug("Notification VF ResourceCustomizationUUID: "
- + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match "
- + "Tosca VF Customization UUID: " + vfCustomizationUUID);
+ for (IEntityDetails groupEntity : vfcEntityList) {
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization =
+ createVNFCInstanceGroup(groupEntity, nodeTemplate, vnfResource, toscaResourceStruct);
+ vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization);
}
+
+ List<String> seqResult = processVNFCGroupSequence(toscaResourceStruct, vfcEntityList);
+ if (!CollectionUtils.isEmpty(seqResult)) {
+ String resultStr = seqResult.stream().collect(Collectors.joining(","));
+ vnfResource.setVnfcInstanceGroupOrder(resultStr);
+ logger.debug("vnfcGroupOrder result for service uuid(" + service.getModelUUID() + ") : " + resultStr);
+ }
+ // add this vnfResource with existing vnfResource for this service
+ addVnfCustomization(service, vnfResource);
+ } else {
+ logger.debug("Notification VF ResourceCustomizationUUID: "
+ + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match "
+ + "Tosca VF Customization UUID: " + vfCustomizationUUID);
}
}
private List<String> processVNFCGroupSequence(ToscaResourceStructure toscaResourceStructure,
- List<Group> groupList) {
- if (CollectionUtils.isEmpty(groupList)) {
+ List<IEntityDetails> groupEntityDetails) {
+ if (CollectionUtils.isEmpty(groupEntityDetails)) {
return Collections.emptyList();
}
ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper();
- List<String> strSequence = new ArrayList<>(groupList.size());
- List<Group> tempGroupList = new ArrayList<>(groupList.size());
- List<NodeTemplate> nodes = new ArrayList<>();
- tempGroupList.addAll(groupList);
+ List<String> strSequence = new ArrayList<>(groupEntityDetails.size());
+ List<IEntityDetails> tempEntityList = new ArrayList<>(groupEntityDetails.size());
+ List<IEntityDetails> entities = new ArrayList<>();
+ tempEntityList.addAll(groupEntityDetails);
+
+ for (IEntityDetails vnfcEntityDetails : groupEntityDetails) {
+
+ List<IEntityDetails> vnfcMemberNodes = vnfcEntityDetails.getMemberNodes();
- for (Group group : groupList) {
- List<NodeTemplate> nodeList = group.getMemberNodes();
boolean hasRequirements = false;
- for (NodeTemplate node : nodeList) {
- RequirementAssignments requirements = iSdcCsarHelper.getRequirementsOf(node);
- if (requirements != null && requirements.getAll() != null && !requirements.getAll().isEmpty()) {
+ for (IEntityDetails vnfcDetails : vnfcMemberNodes) {
+
+ Map<String, RequirementAssignment> requirements = vnfcDetails.getRequirements();
+
+ if (requirements != null && !requirements.isEmpty()) {
hasRequirements = true;
break;
}
}
if (!hasRequirements) {
- strSequence.add(group.getName());
- tempGroupList.remove(group);
- nodes.addAll(nodeList);
+ strSequence.add(vnfcEntityDetails.getName());
+ tempEntityList.remove(vnfcEntityDetails);
+ entities.addAll(vnfcMemberNodes);
}
}
- getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper);
+ getVNFCGroupSequenceList(strSequence, tempEntityList, entities, iSdcCsarHelper);
return strSequence;
}
- private void getVNFCGroupSequenceList(List<String> strSequence, List<Group> groupList, List<NodeTemplate> nodes,
- ISdcCsarHelper iSdcCsarHelper) {
- if (CollectionUtils.isEmpty(groupList)) {
+ private void getVNFCGroupSequenceList(List<String> strSequence, List<IEntityDetails> vnfcGroupDetails,
+ List<IEntityDetails> vnfcMemberNodes, ISdcCsarHelper iSdcCsarHelper) {
+ if (CollectionUtils.isEmpty(vnfcGroupDetails)) {
return;
}
- List<Group> tempGroupList = new ArrayList<>();
- tempGroupList.addAll(groupList);
+ List<IEntityDetails> tempGroupList = new ArrayList<>();
+ tempGroupList.addAll(vnfcGroupDetails);
+
+ for (IEntityDetails vnfcGroup : vnfcGroupDetails) {
+ List<IEntityDetails> members = vnfcGroup.getMemberNodes();
+ for (IEntityDetails memberNode : members) {
+ boolean isAllExists = true;
- for (Group group : groupList) {
- boolean isAllExists = true;
- ArrayList<NodeTemplate> members = group.getMemberNodes();
- for (NodeTemplate memberNode : members) {
- RequirementAssignments requirements = iSdcCsarHelper.getRequirementsOf(memberNode);
- if (requirements == null || requirements.getAll() == null || requirements.getAll().isEmpty()) {
+
+ Map<String, RequirementAssignment> requirements = memberNode.getRequirements();
+
+ if (requirements == null || requirements.isEmpty()) {
continue;
}
- List<RequirementAssignment> rqaList = requirements.getAll();
- for (RequirementAssignment rqa : rqaList) {
+
+
+ for (Map.Entry<String, RequirementAssignment> entry : requirements.entrySet()) {
+ RequirementAssignment rqa = entry.getValue();
String name = rqa.getNodeTemplateName();
- Optional<NodeTemplate> findNode =
- nodes.stream().filter(node -> node.getName().equals(name)).findFirst();
- if (!findNode.isPresent()) {
- isAllExists = false;
- break;
+ for (IEntityDetails node : vnfcMemberNodes) {
+ if (name.equals(node.getName())) {
+ break;
+ }
}
- }
- if (!isAllExists) {
+
+ isAllExists = false;
break;
}
- }
- if (isAllExists) {
- strSequence.add(group.getName());
- tempGroupList.remove(group);
- nodes.addAll(group.getMemberNodes());
+ if (isAllExists) {
+ strSequence.add(vnfcGroup.getName());
+ tempGroupList.remove(vnfcGroupDetails);
+ vnfcMemberNodes.addAll(vnfcGroupDetails);
+ }
}
- }
- if (tempGroupList.size() != 0 && tempGroupList.size() < groupList.size()) {
- getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper);
+ if (!tempGroupList.isEmpty() && tempGroupList.size() < vnfcGroupDetails.size()) {
+ getVNFCGroupSequenceList(strSequence, tempGroupList, vnfcMemberNodes, iSdcCsarHelper);
+ }
}
}
@@ -1338,7 +1393,14 @@ public class ToscaResourceInstaller {
Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
- Service service = new Service();
+ List<Service> services =
+ serviceRepo.findByModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ Service service;
+ if (!services.isEmpty() && services.size() > 0) {
+ service = services.get(0);
+ } else {
+ service = new Service();
+ }
if (serviceMetadata != null) {
@@ -1432,10 +1494,10 @@ public class ToscaResourceInstaller {
return configCustomizationResource;
}
- protected ConfigurationResource createFabricConfiguration(NodeTemplate nodeTemplate,
+ protected ConfigurationResource createFabricConfiguration(IEntityDetails fabricEntity,
ToscaResourceStructure toscaResourceStructure) {
- Metadata fabricMetadata = nodeTemplate.getMetaData();
+ Metadata fabricMetadata = fabricEntity.getMetadata();
ConfigurationResource configResource = new ConfigurationResource();
@@ -1444,19 +1506,26 @@ public class ToscaResourceInstaller {
configResource.setModelUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
configResource.setModelVersion(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
configResource.setDescription(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- configResource.setToscaNodeType(nodeTemplate.getType());
+ configResource.setToscaNodeType(fabricEntity.getToscaType());
return configResource;
}
protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) {
- ToscaCsar toscaCsar = new ToscaCsar();
+ Optional<ToscaCsar> toscaCsarOpt =
+ toscaCsarRepo.findById(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
+ ToscaCsar toscaCsar;
+ if (!toscaCsarOpt.isPresent()) {
+ toscaCsar = new ToscaCsar();
+ toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
+ } else {
+ toscaCsar = toscaCsarOpt.get();
+ }
if (toscaResourceStructure.getToscaArtifact().getArtifactChecksum() != null) {
toscaCsar.setArtifactChecksum(toscaResourceStructure.getToscaArtifact().getArtifactChecksum());
} else {
toscaCsar.setArtifactChecksum(MANUAL_RECORD);
}
- toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
toscaCsar.setName(toscaResourceStructure.getToscaArtifact().getArtifactName());
toscaCsar.setVersion(toscaResourceStructure.getToscaArtifact().getArtifactVersion());
toscaCsar.setDescription(toscaResourceStructure.getToscaArtifact().getArtifactDescription());
@@ -1475,7 +1544,6 @@ public class ToscaResourceInstaller {
if (vnfcCustomization == null)
vnfcCustomization = vnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID);
- // vnfcCustomization = new VnfcCustomization();
return vnfcCustomization;
}
@@ -1610,7 +1678,7 @@ public class ToscaResourceInstaller {
return networkResource;
}
- protected CollectionNetworkResourceCustomization createNetworkCollection(NodeTemplate networkNodeTemplate,
+ protected CollectionNetworkResourceCustomization createNetworkCollection(IEntityDetails cnrEntity,
ToscaResourceStructure toscaResourceStructure, Service service) {
CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
@@ -1619,33 +1687,26 @@ public class ToscaResourceInstaller {
// **** Build Object to populate Collection_Resource table
CollectionResource collectionResource = new CollectionResource();
+ collectionResource.setModelName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
collectionResource
- .setModelName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- collectionResource.setModelInvariantUUID(
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- collectionResource
- .setModelUUID(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- collectionResource
- .setModelVersion(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- collectionResource
- .setDescription(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- collectionResource.setToscaNodeType(networkNodeTemplate.getType());
+ .setModelInvariantUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ collectionResource.setModelUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ collectionResource.setModelVersion(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ collectionResource.setDescription(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ collectionResource.setToscaNodeType(cnrEntity.getToscaType());
toscaResourceStructure.setCatalogCollectionResource(collectionResource);
// **** Build object to populate Collection_Resource_Customization table
NetworkCollectionResourceCustomization ncfc = new NetworkCollectionResourceCustomization();
- ncfc.setFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- "cr_function"));
- ncfc.setRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- "cr_role"));
- ncfc.setType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- "cr_type"));
+ ncfc.setFunction(getLeafPropertyValue(cnrEntity, "cr_function"));
+ ncfc.setRole(getLeafPropertyValue(cnrEntity, "cr_role"));
+ ncfc.setType(getLeafPropertyValue(cnrEntity, "cr_type"));
- ncfc.setModelInstanceName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ ncfc.setModelInstanceName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
ncfc.setModelCustomizationUUID(
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
Set<CollectionNetworkResourceCustomization> networkResourceCustomizationSet = new HashSet<>();
networkResourceCustomizationSet.add(collectionNetworkResourceCustomization);
@@ -1656,25 +1717,28 @@ public class ToscaResourceInstaller {
toscaResourceStructure.setCatalogCollectionResourceCustomization(ncfc);
// *** Build object to populate the Instance_Group table
- List<Group> groupList =
- toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(
- networkNodeTemplate, "org.openecomp.groups.NetworkCollection");
+ List<IEntityDetails> ncEntityList =
+ getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.NetworkCollection"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(
+ cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
List<NetworkInstanceGroup> networkInstanceGroupList = new ArrayList<>();
List<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationList =
new ArrayList<>();
- for (Group group : groupList) {
+ for (IEntityDetails ncGroupEntity : ncEntityList) {
NetworkInstanceGroup networkInstanceGroup = new NetworkInstanceGroup();
- Metadata instanceMetadata = group.getMetadata();
+ Metadata instanceMetadata = ncGroupEntity.getMetadata();
networkInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
networkInstanceGroup
.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
networkInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
networkInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- networkInstanceGroup.setToscaNodeType(group.getType());
+ networkInstanceGroup.setToscaNodeType(ncGroupEntity.getToscaType());
networkInstanceGroup.setRole(SubType.SUB_INTERFACE.toString()); // Set
// Role
networkInstanceGroup.setType(InstanceGroupType.L3_NETWORK); // Set
@@ -1688,27 +1752,26 @@ public class ToscaResourceInstaller {
crInstanceGroupCustomization.setInstanceGroup(networkInstanceGroup);
crInstanceGroupCustomization.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
crInstanceGroupCustomization.setModelCustomizationUUID(
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
// Loop through the template policy to find the subinterface_network_quantity property name. Then extract
// the value for it.
- List<Policy> policyList =
- toscaResourceStructure.getSdcCsarHelper().getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(
- networkNodeTemplate, "org.openecomp.policies.scaling.Fixed");
+ List<IEntityDetails> policyEntityList = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.policies.scaling.Fixed"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), true);
- if (policyList != null) {
- for (Policy policy : policyList) {
- for (String policyNetworkCollection : policy.getTargets()) {
+ if (policyEntityList != null) {
+ for (IEntityDetails policyEntity : policyEntityList) {
+ for (String policyNetworkCollection : policyEntity.getTargets()) {
- if (policyNetworkCollection.equalsIgnoreCase(group.getName())) {
+ if (policyNetworkCollection.equalsIgnoreCase(ncGroupEntity.getName())) {
- Map<String, Object> propMap = policy.getPolicyProperties();
+ Map<String, Property> propMap = policyEntity.getProperties();
if (propMap.get("quantity") != null) {
- String quantity = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- getPropertyInput(propMap.get("quantity").toString()));
+ String quantity = getLeafPropertyValue(cnrEntity,
+ getPropertyInput(propMap.get("quantity").toString()));
if (quantity != null) {
crInstanceGroupCustomization
@@ -1723,13 +1786,12 @@ public class ToscaResourceInstaller {
}
crInstanceGroupCustomization.setDescription(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
- + "_network_collection_description"));
- crInstanceGroupCustomization.setFunction(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
- + "_network_collection_function"));
+ getLeafPropertyValue(cnrEntity, instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
+ + "_network_collection_description"));
+
+ crInstanceGroupCustomization.setFunction(getLeafPropertyValue(cnrEntity,
+ instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) + "_network_collection_function"));
+
crInstanceGroupCustomization.setCollectionResourceCust(ncfc);
collectionResourceInstanceGroupCustomizationList.add(crInstanceGroupCustomization);
@@ -1741,18 +1803,21 @@ public class ToscaResourceInstaller {
toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList);
- List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplateBySdcType(networkNodeTemplate, SdcTypes.VL);
+ List<IEntityDetails> networkEntityList =
+ getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.VL),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(
+ cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
List<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationList = new ArrayList<>();
// *****Build object to populate the NetworkResource table
NetworkResource networkResource = new NetworkResource();
- for (NodeTemplate vlNodeTemplate : vlNodeList) {
+ for (IEntityDetails networkEntity : networkEntityList) {
- String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
+ String providerNetwork = getLeafPropertyValue(networkEntity,
+ SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
if ("true".equalsIgnoreCase(providerNetwork)) {
networkResource.setNeutronNetworkType(PROVIDER);
@@ -1760,22 +1825,20 @@ public class ToscaResourceInstaller {
networkResource.setNeutronNetworkType(BASIC);
}
- networkResource
- .setModelName(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ networkResource.setModelName(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
networkResource.setModelInvariantUUID(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- networkResource
- .setModelUUID(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ networkResource.setModelUUID(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
networkResource
- .setModelVersion(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ .setModelVersion(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
networkResource.setAicVersionMax(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
TempNetworkHeatTemplateLookup tempNetworkLookUp =
tempNetworkLookupRepo.findFirstBynetworkResourceModelName(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
if (tempNetworkLookUp != null) {
@@ -1787,29 +1850,28 @@ public class ToscaResourceInstaller {
}
- networkResource.setToscaNodeType(vlNodeTemplate.getType());
+ networkResource.setToscaNodeType(networkEntity.getToscaType());
networkResource.setDescription(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
networkResource.setOrchestrationMode(HEAT);
// Build object to populate the
// Collection_Network_Resource_Customization table
- for (NodeTemplate memberNode : group.getMemberNodes()) {
- collectionNetworkResourceCustomization.setModelInstanceName(memberNode.getName());
+ for (IEntityDetails networkMemberEntity : ncGroupEntity.getMemberNodes()) {
+ collectionNetworkResourceCustomization.setModelInstanceName(networkMemberEntity.getName());
}
collectionNetworkResourceCustomization.setModelCustomizationUUID(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
collectionNetworkResourceCustomization.setNetworkTechnology(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNodeTemplate,
- SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
- collectionNetworkResourceCustomization.setNetworkType(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
- collectionNetworkResourceCustomization.setNetworkRole(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
- collectionNetworkResourceCustomization.setNetworkScope(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
+ getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
+ collectionNetworkResourceCustomization.setNetworkType(
+ getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
+ collectionNetworkResourceCustomization.setNetworkRole(
+ getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
+ collectionNetworkResourceCustomization.setNetworkScope(
+ getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
collectionNetworkResourceCustomization.setInstanceGroup(networkInstanceGroup);
collectionNetworkResourceCustomization.setNetworkResource(networkResource);
collectionNetworkResourceCustomization.setNetworkResourceCustomization(ncfc);
@@ -1822,24 +1884,26 @@ public class ToscaResourceInstaller {
return collectionNetworkResourceCustomization;
}
- protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(NodeTemplate vnfcNodeTemplate, Group group,
- VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure) {
+ protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(IEntityDetails vfcInstanceEntity,
+ NodeTemplate vnfcNodeTemplate, VnfResourceCustomization vnfResourceCustomization,
+ ToscaResourceStructure toscaResourceStructure) {
- Metadata instanceMetadata = group.getMetadata();
+ Metadata instanceMetadata = vfcInstanceEntity.getMetadata();
InstanceGroup existingInstanceGroup =
instanceGroupRepo.findByModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup();
+ VFCInstanceGroup vfcInstanceGroup;
if (existingInstanceGroup == null) {
// Populate InstanceGroup
+ vfcInstanceGroup = new VFCInstanceGroup();
vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
vfcInstanceGroup
.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- vfcInstanceGroup.setToscaNodeType(group.getType());
+ vfcInstanceGroup.setToscaNodeType(vfcInstanceEntity.getToscaType());
vfcInstanceGroup.setRole("SUB-INTERFACE"); // Set Role
vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type
} else {
@@ -1858,45 +1922,66 @@ public class ToscaResourceInstaller {
vfcInstanceGroupCustom.setDescription(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
String getInputName = null;
- String groupProperty = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- "vfc_instance_group_function");
- if (groupProperty != null) {
- int getInputIndex = groupProperty.indexOf("{get_input=");
- if (getInputIndex > -1) {
- getInputName = groupProperty.substring(getInputIndex + 11, groupProperty.length() - 1);
+
+ Map<String, Property> groupProperties = vfcInstanceEntity.getProperties();
+
+ for (String key : groupProperties.keySet()) {
+ Property property = groupProperties.get(key);
+
+ String vfcName = property.getName();
+
+ if (vfcName != null) {
+ if (vfcName.equals("vfc_instance_group_function")) {
+
+ String vfcValue = property.getValue().toString();
+ int getInputIndex = vfcValue.indexOf("{get_input=");
+ if (getInputIndex > -1) {
+ getInputName = vfcValue.substring(getInputIndex + 11, vfcValue.length() - 1);
+ }
+
+ }
}
+
}
- vfcInstanceGroupCustom.setFunction(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vnfcNodeTemplate, getInputName));
+
+ List<IEntityDetails> serviceEntityList = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VF)
+ .customizationUUID(vnfResourceCustomization.getModelCustomizationUUID()),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+ if (serviceEntityList != null && !serviceEntityList.isEmpty()) {
+ vfcInstanceGroupCustom.setFunction(getLeafPropertyValue(serviceEntityList.get(0), getInputName));
+ }
+
vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
ArrayList<Input> inputs = vnfcNodeTemplate.getSubMappingToscaTemplate().getInputs();
- createVFCInstanceGroupMembers(vfcInstanceGroupCustom, group, inputs);
+ createVFCInstanceGroupMembers(vfcInstanceGroupCustom, vfcInstanceEntity, inputs);
return vfcInstanceGroupCustom;
-
}
- private void createVFCInstanceGroupMembers(VnfcInstanceGroupCustomization vfcInstanceGroupCustom, Group group,
- List<Input> inputList) {
- List<NodeTemplate> members = group.getMemberNodes();
+ private void createVFCInstanceGroupMembers(VnfcInstanceGroupCustomization vfcInstanceGroupCustom,
+ IEntityDetails vfcModuleEntity, List<Input> inputList) {
+ List<IEntityDetails> members = vfcModuleEntity.getMemberNodes();
if (!CollectionUtils.isEmpty(members)) {
- for (NodeTemplate vfcTemplate : members) {
+ for (IEntityDetails vfcEntity : members) {
VnfcCustomization vnfcCustomization = new VnfcCustomization();
- Metadata metadata = vfcTemplate.getMetaData();
+ Metadata metadata = vfcEntity.getMetadata();
vnfcCustomization
.setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- vnfcCustomization.setModelInstanceName(vfcTemplate.getName());
+ vnfcCustomization.setModelInstanceName(vfcEntity.getName());
vnfcCustomization.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
vnfcCustomization
.setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
vnfcCustomization.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
vnfcCustomization.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType()));
+ vnfcCustomization.setToscaNodeType(testNull(vfcEntity.getToscaType()));
vnfcCustomization
.setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcTemplate, inputList));
+ vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcEntity, inputList));
+ vnfcCustomization.setVnfcInstanceGroupCustomization(vfcInstanceGroupCustom);
List<VnfcCustomization> vnfcCustomizations = vfcInstanceGroupCustom.getVnfcCustomizations();
if (vnfcCustomizations == null) {
@@ -1908,9 +1993,9 @@ public class ToscaResourceInstaller {
}
}
- public String getVnfcResourceInput(NodeTemplate vfcTemplate, List<Input> inputList) {
+ public String getVnfcResourceInput(IEntityDetails vfcEntity, List<Input> inputList) {
Map<String, String> resouceRequest = new HashMap<>();
- LinkedHashMap<String, Property> vfcTemplateProperties = vfcTemplate.getProperties();
+ Map<String, Property> vfcTemplateProperties = vfcEntity.getProperties();
for (String key : vfcTemplateProperties.keySet()) {
Property property = vfcTemplateProperties.get(key);
String resourceValue = getValue(property.getValue(), inputList);
@@ -1918,7 +2003,7 @@ public class ToscaResourceInstaller {
}
String resourceCustomizationUuid =
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
String jsonStr = null;
try {
@@ -1935,22 +2020,26 @@ public class ToscaResourceInstaller {
return jsonStr;
}
- protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate,
+ protected VfModuleCustomization createVFModuleResource(IEntityDetails vfModuleEntityDetails,
ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure,
- IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Set<CvnfcCustomization> existingCvnfcSet,
- Set<VnfcCustomization> existingVnfcSet,
+ IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service,
+ Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet,
List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom) {
VfModuleCustomization vfModuleCustomization =
findExistingVfModuleCustomization(vnfResource, vfModuleData.getVfModuleModelCustomizationUUID());
+
if (vfModuleCustomization == null) {
+
VfModule vfModule = findExistingVfModule(vnfResource,
- vfTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
- Metadata vfMetadata = group.getMetadata();
+ vfModuleEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+
+ Metadata vfMetadata = vfModuleEntityDetails.getMetadata();
if (vfModule == null)
- vfModule = createVfModule(group, toscaResourceStructure, vfModuleData, vfMetadata);
+ vfModule = createVfModule(vfModuleEntityDetails, toscaResourceStructure, vfModuleData, vfMetadata);
- vfModuleCustomization = createVfModuleCustomization(group, toscaResourceStructure, vfModule, vfModuleData);
+ vfModuleCustomization =
+ createVfModuleCustomization(vfModuleEntityDetails, toscaResourceStructure, vfModule, vfModuleData);
vfModuleCustomization.setVnfCustomization(vnfResource);
setHeatInformationForVfModule(toscaResourceStructure, vfResourceStructure, vfModule, vfModuleCustomization,
vfMetadata);
@@ -1970,43 +2059,55 @@ public class ToscaResourceInstaller {
Set<VnfcCustomization> vnfcCustomizations = new HashSet<>();
// Only set the CVNFC if this vfModule group is a member of it.
- List<NodeTemplate> groupMembers =
- toscaResourceStructure.getSdcCsarHelper().getMembersOfVfModule(vfTemplate, group);
- String vfModuleMemberName = null;
- for (NodeTemplate node : groupMembers) {
- vfModuleMemberName = node.getName();
- }
+ List<IEntityDetails> groupMembers = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.VfModule")
+ .uUID(vfModuleCustomization.getVfModule().getModelUUID()),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
+
+ String vfModuleMemberName = null;
// Extract CVFC lists
- List<NodeTemplate> cvfcList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC);
+ List<IEntityDetails> cvnfcEntityList = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CVFC), TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
+
- for (NodeTemplate cvfcTemplate : cvfcList) {
+ for (IEntityDetails cvfcEntity : cvnfcEntityList) {
boolean cvnfcVfModuleNameMatch = false;
- for (NodeTemplate node : groupMembers) {
- vfModuleMemberName = node.getName();
+ for (IEntityDetails entity : groupMembers) {
+
+ List<IEntityDetails> groupMembersNodes = entity.getMemberNodes();
+ for (IEntityDetails groupMember : groupMembersNodes) {
+
+ vfModuleMemberName = groupMember.getName();
+
+ if (vfModuleMemberName.equalsIgnoreCase(cvfcEntity.getName())) {
+ cvnfcVfModuleNameMatch = true;
+ break;
+ }
- if (vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName())) {
- cvnfcVfModuleNameMatch = true;
- break;
}
}
+
if (vfModuleMemberName != null && cvnfcVfModuleNameMatch) {
// Extract associated VFC - Should always be just one
- List<NodeTemplate> vfcList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
+ List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VFC),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(
+ cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
- for (NodeTemplate vfcTemplate : vfcList) {
+
+ for (IEntityDetails vfcEntity : vfcEntityList) {
VnfcCustomization vnfcCustomization = new VnfcCustomization();
VnfcCustomization existingVnfcCustomization = null;
existingVnfcCustomization = findExistingVfc(existingVnfcSet,
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
if (existingVnfcCustomization == null) {
vnfcCustomization = new VnfcCustomization();
@@ -2015,23 +2116,24 @@ public class ToscaResourceInstaller {
}
// Only Add Abstract VNFC's to our DB, ignore all others
- if (existingVnfcCustomization == null && vfcTemplate.getMetaData()
+ if (existingVnfcCustomization == null && vfcEntity.getMetadata()
.getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY).equalsIgnoreCase("Abstract")) {
+
vnfcCustomization.setModelCustomizationUUID(
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- vnfcCustomization.setModelInstanceName(vfcTemplate.getName());
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vnfcCustomization.setModelInstanceName(vfcEntity.getName());
vnfcCustomization.setModelInvariantUUID(
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
vnfcCustomization
- .setModelName(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ .setModelName(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
vnfcCustomization
- .setModelUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ .setModelUUID(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
vnfcCustomization.setModelVersion(
- testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- vnfcCustomization.setDescription(testNull(
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType()));
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ vnfcCustomization.setDescription(
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ vnfcCustomization.setToscaNodeType(testNull(vfcEntity.getToscaType()));
vnfcCustomizations.add(vnfcCustomization);
existingVnfcSet.add(vnfcCustomization);
@@ -2043,20 +2145,20 @@ public class ToscaResourceInstaller {
if (vnfcCustomization.getModelCustomizationUUID() != null) {
CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
cvnfcCustomization.setModelCustomizationUUID(
- cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName());
+ cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ cvnfcCustomization.setModelInstanceName(cvfcEntity.getName());
cvnfcCustomization.setModelInvariantUUID(
- cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
cvnfcCustomization
- .setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ .setModelName(cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
cvnfcCustomization
- .setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ .setModelUUID(cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
cvnfcCustomization.setModelVersion(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ testNull(cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
cvnfcCustomization.setDescription(testNull(
- cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType()));
+ cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ cvnfcCustomization.setToscaNodeType(testNull(cvfcEntity.getToscaType()));
if (existingVnfcCustomization != null) {
cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization);
@@ -2064,44 +2166,52 @@ public class ToscaResourceInstaller {
cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
}
- cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_function"));
- cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code"));
- cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+ cvnfcCustomization.setNfcFunction(getLeafPropertyValue(cvfcEntity, "nfc_function"));
+ cvnfcCustomization.setNfcNamingCode(getLeafPropertyValue(cvfcEntity, "nfc_naming_code"));
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
// *****************************************************************************************************************************************
// * Extract Fabric Configuration
// *****************************************************************************************************************************************
- List<NodeTemplate> fabricConfigList = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplateBySdcType(vfTemplate, SdcTypes.CONFIGURATION);
+ List<IEntityDetails> fabricEntityList =
+ getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.CONFIGURATION),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
- for (NodeTemplate fabricTemplate : fabricConfigList) {
+ for (IEntityDetails fabricEntity : fabricEntityList) {
- ConfigurationResource fabricConfig = null;
+ Map<String, RequirementAssignment> requirements = fabricEntity.getRequirements();
- ConfigurationResource existingConfig =
- findExistingConfiguration(existingCvnfcConfigurationCustom,
- fabricTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ for (RequirementAssignment requirement : requirements.values()) {
- if (existingConfig == null) {
+ if (requirement.getNodeTemplateName().equals(cvfcEntity.getName())) {
- fabricConfig = createFabricConfiguration(fabricTemplate, toscaResourceStructure);
+ ConfigurationResource fabricConfig = null;
- } else {
- fabricConfig = existingConfig;
- }
+ ConfigurationResource existingConfig = findExistingConfiguration(
+ existingCvnfcConfigurationCustom,
+ fabricEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- CvnfcConfigurationCustomization cvnfcConfigurationCustomization =
- createCvnfcConfigurationCustomization(fabricTemplate, toscaResourceStructure,
- vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig,
- vfTemplate, vfModuleMemberName);
+ if (existingConfig == null) {
- cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization);
+ fabricConfig = createFabricConfiguration(fabricEntity, toscaResourceStructure);
- existingCvnfcConfigurationCustom.add(cvnfcConfigurationCustomization);
+ } else {
+ fabricConfig = existingConfig;
+ }
+
+ CvnfcConfigurationCustomization cvnfcConfigurationCustomization =
+ createCvnfcConfigurationCustomization(fabricEntity, toscaResourceStructure,
+ vnfResource, vfModuleCustomization, cvnfcCustomization,
+ fabricConfig, vfModuleMemberName);
+
+ cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization);
+
+ existingCvnfcConfigurationCustom.add(cvnfcConfigurationCustomization);
+
+ }
+ }
}
cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations);
@@ -2119,12 +2229,12 @@ public class ToscaResourceInstaller {
return vfModuleCustomization;
}
- protected CvnfcConfigurationCustomization createCvnfcConfigurationCustomization(NodeTemplate fabricTemplate,
+ protected CvnfcConfigurationCustomization createCvnfcConfigurationCustomization(IEntityDetails fabricEntity,
ToscaResourceStructure toscaResourceStruct, VnfResourceCustomization vnfResource,
VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization,
- ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) {
+ ConfigurationResource configResource, String vfModuleMemberName) {
- Metadata fabricMetadata = fabricTemplate.getMetaData();
+ Metadata fabricMetadata = fabricEntity.getMetadata();
CvnfcConfigurationCustomization cvnfcConfigurationCustomization = new CvnfcConfigurationCustomization();
@@ -2134,34 +2244,33 @@ public class ToscaResourceInstaller {
cvnfcConfigurationCustomization
.setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- cvnfcConfigurationCustomization.setModelInstanceName(fabricTemplate.getName());
+ cvnfcConfigurationCustomization.setModelInstanceName(fabricEntity.getName());
+
+ List<IEntityDetails> policyList =
+ getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder("org.openecomp.policies.External"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF), true);
- List<Policy> policyList = toscaResourceStruct.getSdcCsarHelper()
- .getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(vfTemplate, "org.openecomp.policies.External");
if (policyList != null) {
- for (Policy policy : policyList) {
+ for (IEntityDetails policyEntity : policyList) {
- for (String policyCvfcTarget : policy.getTargets()) {
+ for (String policyCvfcTarget : policyEntity.getTargets()) {
if (policyCvfcTarget.equalsIgnoreCase(vfModuleMemberName)) {
- Map<String, Object> propMap = policy.getPolicyProperties();
+ String policyType = getLeafPropertyValue(policyEntity, "type");
- if (propMap.get("type").toString().equalsIgnoreCase("Fabric Policy")) {
- cvnfcConfigurationCustomization.setPolicyName(propMap.get("name").toString());
+ if (policyType != null && policyType.equalsIgnoreCase("Fabric Policy")) {
+ cvnfcConfigurationCustomization.setPolicyName(getLeafPropertyValue(policyEntity, "name"));
}
}
}
}
}
- cvnfcConfigurationCustomization.setConfigurationFunction(
- toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "function"));
- cvnfcConfigurationCustomization.setConfigurationRole(
- toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "role"));
- cvnfcConfigurationCustomization.setConfigurationType(
- toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "type"));
+ cvnfcConfigurationCustomization.setConfigurationFunction(getLeafPropertyValue(fabricEntity, "function"));
+ cvnfcConfigurationCustomization.setConfigurationRole(getLeafPropertyValue(fabricEntity, "role"));
+ cvnfcConfigurationCustomization.setConfigurationType(getLeafPropertyValue(fabricEntity, "type"));
return cvnfcConfigurationCustomization;
}
@@ -2217,7 +2326,7 @@ public class ToscaResourceInstaller {
return vfModule;
}
- protected VfModuleCustomization createVfModuleCustomization(Group group,
+ protected VfModuleCustomization createVfModuleCustomization(IEntityDetails vfModuleEntityDetails,
ToscaResourceStructure toscaResourceStructure, VfModule vfModule, IVfModuleData vfModuleData) {
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
@@ -2225,62 +2334,64 @@ public class ToscaResourceInstaller {
vfModuleCustomization.setVfModule(vfModule);
- String initialCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT);
+ String initialCount = getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT);
+
+
if (initialCount != null && initialCount.length() > 0) {
vfModuleCustomization.setInitialCount(Integer.valueOf(initialCount));
}
- vfModuleCustomization.setInitialCount(Integer.valueOf(toscaResourceStructure.getSdcCsarHelper()
- .getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT)));
+ String availabilityZoneCount =
+ getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT);
- String availabilityZoneCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT);
if (availabilityZoneCount != null && availabilityZoneCount.length() > 0) {
vfModuleCustomization.setAvailabilityZoneCount(Integer.valueOf(availabilityZoneCount));
}
- vfModuleCustomization.setLabel(toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL));
+ vfModuleCustomization
+ .setLabel(getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL));
+
+ String maxInstances =
+ getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES);
- String maxInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES);
if (maxInstances != null && maxInstances.length() > 0) {
vfModuleCustomization.setMaxInstances(Integer.valueOf(maxInstances));
}
- String minInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES);
+ String minInstances =
+ getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES);
+
if (minInstances != null && minInstances.length() > 0) {
vfModuleCustomization.setMinInstances(Integer.valueOf(minInstances));
}
return vfModuleCustomization;
}
- protected VfModule createVfModule(Group group, ToscaResourceStructure toscaResourceStructure,
+ protected VfModule createVfModule(IEntityDetails groupEntityDetails, ToscaResourceStructure toscaResourceStructure,
IVfModuleData vfModuleData, Metadata vfMetadata) {
VfModule vfModule = new VfModule();
String vfModuleModelUUID = vfModuleData.getVfModuleModelUUID();
if (vfModuleModelUUID == null) {
- vfModuleModelUUID = testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+
+ vfModuleModelUUID = testNull(
+ groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+
} else if (vfModuleModelUUID.indexOf('.') > -1) {
vfModuleModelUUID = vfModuleModelUUID.substring(0, vfModuleModelUUID.indexOf('.'));
}
- vfModule.setModelInvariantUUID(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
- vfModule.setModelName(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
+ vfModule.setModelInvariantUUID(
+ groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID));
+ vfModule.setModelName(
+ groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME));
vfModule.setModelUUID(vfModuleModelUUID);
- vfModule.setModelVersion(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
- vfModule.setDescription(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ vfModule.setModelVersion(
+ groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION));
+ vfModule.setDescription(groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+
+ String vfModuleType = getLeafPropertyValue(groupEntityDetails, SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE);
- String vfModuleType = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE);
if (vfModuleType != null && "Base".equalsIgnoreCase(vfModuleType)) {
vfModule.setIsBase(true);
} else {
@@ -2385,26 +2496,26 @@ public class ToscaResourceInstaller {
}
}
- protected VnfResourceCustomization createVnfResource(NodeTemplate vfNodeTemplate,
+ protected VnfResourceCustomization createVnfResource(IEntityDetails entityDetails,
ToscaResourceStructure toscaResourceStructure, Service service) throws ArtifactInstallerException {
VnfResourceCustomization vnfResourceCustomization = null;
if (vnfResourceCustomization == null) {
+
VnfResource vnfResource = findExistingVnfResource(service,
- vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
if (vnfResource == null) {
- vnfResource = createVnfResource(vfNodeTemplate);
+ vnfResource = createVnfResource(entityDetails);
}
vnfResourceCustomization =
- createVnfResourceCustomization(vfNodeTemplate, toscaResourceStructure, vnfResource);
+ createVnfResourceCustomization(entityDetails, toscaResourceStructure, vnfResource);
vnfResourceCustomization.setVnfResources(vnfResource);
vnfResourceCustomization.setService(service);
// setting resource input for vnf customization
vnfResourceCustomization.setResourceInput(
getResourceInput(toscaResourceStructure, vnfResourceCustomization.getModelCustomizationUUID()));
- service.getVnfCustomizations().add(vnfResourceCustomization);
}
return vnfResourceCustomization;
@@ -2424,61 +2535,56 @@ public class ToscaResourceInstaller {
return vnfResource;
}
- protected VnfResourceCustomization createVnfResourceCustomization(NodeTemplate vfNodeTemplate,
+ protected VnfResourceCustomization createVnfResourceCustomization(IEntityDetails entityDetails,
ToscaResourceStructure toscaResourceStructure, VnfResource vnfResource) {
VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
vnfResourceCustomization.setModelCustomizationUUID(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- vnfResourceCustomization.setModelInstanceName(vfNodeTemplate.getName());
+ entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- vnfResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)));
- vnfResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, "nf_naming_code")));
- vnfResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)));
- vnfResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)));
+ vnfResourceCustomization.setModelInstanceName(entityDetails.getName());
+ vnfResourceCustomization
+ .setNfFunction(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ vnfResourceCustomization.setNfNamingCode(getLeafPropertyValue(entityDetails, "nf_naming_code"));
+ vnfResourceCustomization.setNfRole(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ vnfResourceCustomization.setNfType(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
- vnfResourceCustomization.setMultiStageDesign(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, MULTI_STAGE_DESIGN));
+ vnfResourceCustomization.setMultiStageDesign(getLeafPropertyValue(entityDetails, MULTI_STAGE_DESIGN));
+ vnfResourceCustomization.setBlueprintName(getLeafPropertyValue(entityDetails, SDNC_MODEL_NAME));
+ vnfResourceCustomization.setBlueprintVersion(getLeafPropertyValue(entityDetails, SDNC_MODEL_VERSION));
- vnfResourceCustomization.setBlueprintName(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_NAME)));
+ String skipPostInstConfText = getLeafPropertyValue(entityDetails, SKIP_POST_INST_CONF);
- vnfResourceCustomization.setBlueprintVersion(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_VERSION)));
-
- String skipPostInstConfText = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SKIP_POST_INST_CONF);
if (skipPostInstConfText != null) {
- vnfResourceCustomization.setSkipPostInstConf(Boolean.parseBoolean(skipPostInstConfText));
+ vnfResourceCustomization.setSkipPostInstConf(
+ Boolean.parseBoolean(getLeafPropertyValue(entityDetails, SKIP_POST_INST_CONF)));
}
+
vnfResourceCustomization.setVnfResources(vnfResource);
vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger(
- vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
+ entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
- CapabilityAssignments vnfCustomizationCapability =
- toscaResourceStructure.getSdcCsarHelper().getCapabilitiesOf(vfNodeTemplate);
+ entityDetails.getCapabilities().get(SCALABLE);
- if (vnfCustomizationCapability != null) {
- CapabilityAssignment capAssign = vnfCustomizationCapability.getCapabilityByName(SCALABLE);
+
+ if (entityDetails.getCapabilities() != null) {
+
+ CapabilityAssignment capAssign = entityDetails.getCapabilities().get(SCALABLE);
if (capAssign != null) {
- vnfResourceCustomization.setMinInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper()
- .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
- vnfResourceCustomization.setMaxInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper()
- .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ vnfResourceCustomization.setMinInstances(Integer
+ .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ vnfResourceCustomization.setMaxInstances(Integer
+ .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
}
}
if (vnfResourceCustomization.getMinInstances() == null && vnfResourceCustomization.getMaxInstances() == null) {
- vnfResourceCustomization.setMinInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
- vnfResourceCustomization.setMaxInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ vnfResourceCustomization.setMinInstances(Integer
+ .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ vnfResourceCustomization.setMaxInstances(Integer
+ .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
}
toscaResourceStructure.setCatalogVnfResourceCustomization(vnfResourceCustomization);
@@ -2486,44 +2592,44 @@ public class ToscaResourceInstaller {
return vnfResourceCustomization;
}
- protected VnfResource createVnfResource(NodeTemplate vfNodeTemplate) {
+ protected VnfResource createVnfResource(IEntityDetails entityDetails) {
VnfResource vnfResource = new VnfResource();
vnfResource.setModelInvariantUUID(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
- vnfResource.setModelName(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- vnfResource.setModelUUID(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ vnfResource.setModelName(testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ vnfResource.setModelUUID(testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
vnfResource.setModelVersion(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
vnfResource.setDescription(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
vnfResource.setOrchestrationMode(HEAT);
- vnfResource.setToscaNodeType(testNull(vfNodeTemplate.getType()));
+ vnfResource.setToscaNodeType(testNull(entityDetails.getToscaType()));
vnfResource.setAicVersionMax(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
vnfResource.setAicVersionMin(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
- vnfResource.setCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
- vnfResource.setSubCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ vnfResource.setCategory(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ vnfResource.setSubCategory(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
return vnfResource;
}
- protected AllottedResourceCustomization createAllottedResource(NodeTemplate nodeTemplate,
+ protected AllottedResourceCustomization createAllottedResource(IEntityDetails arEntity,
ToscaResourceStructure toscaResourceStructure, Service service) {
AllottedResourceCustomization allottedResourceCustomization =
allottedCustomizationRepo.findOneByModelCustomizationUUID(
- nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
if (allottedResourceCustomization == null) {
AllottedResource allottedResource = findExistingAllottedResource(service,
- nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
if (allottedResource == null)
- allottedResource = createAR(nodeTemplate);
+ allottedResource = createAR(arEntity);
toscaResourceStructure.setAllottedResource(allottedResource);
- allottedResourceCustomization = createAllottedResourceCustomization(nodeTemplate, toscaResourceStructure);
+ allottedResourceCustomization = createAllottedResourceCustomization(arEntity, toscaResourceStructure);
allottedResourceCustomization.setAllottedResource(allottedResource);
allottedResource.getAllotedResourceCustomization().add(allottedResourceCustomization);
}
@@ -2544,73 +2650,81 @@ public class ToscaResourceInstaller {
return allottedResource;
}
- protected AllottedResourceCustomization createAllottedResourceCustomization(NodeTemplate nodeTemplate,
+ protected AllottedResourceCustomization createAllottedResourceCustomization(IEntityDetails arEntity,
ToscaResourceStructure toscaResourceStructure) {
AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
allottedResourceCustomization.setModelCustomizationUUID(
- testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- allottedResourceCustomization.setModelInstanceName(nodeTemplate.getName());
+ testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ allottedResourceCustomization.setModelInstanceName(arEntity.getName());
+
+ allottedResourceCustomization
+ .setNfFunction(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ allottedResourceCustomization.setNfNamingCode(getLeafPropertyValue(arEntity, "nf_naming_code"));
+ allottedResourceCustomization.setNfRole(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ allottedResourceCustomization.setNfType(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+
+ EntityQuery entityQuery = EntityQuery.newBuilder(SdcTypes.VFC).build();
+ TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF)
+ .customizationUUID(allottedResourceCustomization.getModelCustomizationUUID()).build();
- allottedResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)));
- allottedResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(nodeTemplate, "nf_naming_code")));
- allottedResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)));
- allottedResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)));
+ List<IEntityDetails> vfcEntities =
+ toscaResourceStructure.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, false);
- List<NodeTemplate> vfcNodes = toscaResourceStructure.getSdcCsarHelper()
- .getVfcListByVf(allottedResourceCustomization.getModelCustomizationUUID());
- if (vfcNodes != null) {
- for (NodeTemplate vfcNode : vfcNodes) {
+ if (vfcEntities != null) {
+ for (IEntityDetails vfcEntity : vfcEntities) {
- allottedResourceCustomization.setProvidingServiceModelUUID(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_uuid"));
allottedResourceCustomization
- .setProvidingServiceModelInvariantUUID(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_invariant_uuid"));
- allottedResourceCustomization.setProvidingServiceModelName(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_name"));
+ .setProvidingServiceModelUUID(getLeafPropertyValue(vfcEntity, "providing_service_uuid"));
+ allottedResourceCustomization.setProvidingServiceModelInvariantUUID(
+ getLeafPropertyValue(vfcEntity, "providing_service_invariant_uuid"));
+ allottedResourceCustomization
+ .setProvidingServiceModelName(getLeafPropertyValue(vfcEntity, "providing_service_name"));
}
}
+ Map<String, CapabilityAssignment> capAssignmentList = arEntity.getCapabilities();
- CapabilityAssignments arCustomizationCapability =
- toscaResourceStructure.getSdcCsarHelper().getCapabilitiesOf(nodeTemplate);
+ if (capAssignmentList != null) {
- if (arCustomizationCapability != null) {
- CapabilityAssignment capAssign = arCustomizationCapability.getCapabilityByName(SCALABLE);
+ for (Map.Entry<String, CapabilityAssignment> entry : capAssignmentList.entrySet()) {
+ CapabilityAssignment arCapability = entry.getValue();
+
+ if (arCapability != null) {
+
+ String capabilityName = arCapability.getName();
+
+ if (capabilityName.equals(SCALABLE)) {
+
+ allottedResourceCustomization
+ .setMinInstances(Integer.getInteger(getCapabilityLeafPropertyValue(arCapability,
+ SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ allottedResourceCustomization
+ .setMinInstances(Integer.getInteger(getCapabilityLeafPropertyValue(arCapability,
+ SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+
+ }
+ }
- if (capAssign != null) {
- allottedResourceCustomization.setMinInstances(
- Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue(
- capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
- allottedResourceCustomization.setMaxInstances(
- Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue(
- capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
}
}
+
return allottedResourceCustomization;
}
- protected AllottedResource createAR(NodeTemplate nodeTemplate) {
+ protected AllottedResource createAR(IEntityDetails arEntity) {
AllottedResource allottedResource = new AllottedResource();
- allottedResource
- .setModelUUID(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ allottedResource.setModelUUID(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
allottedResource.setModelInvariantUUID(
- testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
- allottedResource
- .setModelName(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ allottedResource.setModelName(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
allottedResource
- .setModelVersion(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- allottedResource.setToscaNodeType(testNull(nodeTemplate.getType()));
- allottedResource.setSubcategory(
- testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
+ .setModelVersion(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ allottedResource.setToscaNodeType(testNull(arEntity.getToscaType()));
allottedResource
- .setDescription(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ .setSubcategory(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
+ allottedResource.setDescription(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
return allottedResource;
}
@@ -2679,33 +2793,32 @@ public class ToscaResourceInstaller {
+ vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
}
- protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, SdcTypes entityType,
- SdcTypes topologyTemplate) {
+ protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct,
+ EntityQueryBuilder entityType, TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) {
- EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build();
- TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build();
+ EntityQuery entityQuery = entityType.build();
+ TopologyTemplateQuery topologyTemplateQuery = topologyTemplateBuilder.build();
List<IEntityDetails> entityDetails =
- toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, false);
+ toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch);
return entityDetails;
}
- protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, String entityType,
- SdcTypes topologyTemplate) {
+ protected String getLeafPropertyValue(IEntityDetails entityDetails, String propName) {
- EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build();
- TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build();
- List<IEntityDetails> entityDetails =
- toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, true);
+ Property leafProperty = entityDetails.getProperties().get(propName);
- return entityDetails;
+ if (leafProperty != null && leafProperty.getValue() != null) {
+ return leafProperty.getValue().toString();
+ }
+ return null;
}
- protected String getLeafPropertyValue(IEntityDetails entityDetails, String propName) {
+ protected String getCapabilityLeafPropertyValue(CapabilityAssignment capAssign, String propName) {
- Property leafProperty = entityDetails.getProperties().get(propName);
+ Property leafProperty = capAssign.getProperties().get(propName);
if (leafProperty != null && leafProperty.getValue() != null) {
return leafProperty.getValue().toString();
@@ -2720,8 +2833,9 @@ public class ToscaResourceInstaller {
if (propertyName != null) {
int getInputIndex = propertyName.indexOf("{get_input=");
+ int getClosingIndex = propertyName.indexOf("}");
if (getInputIndex > -1) {
- inputName = propertyName.substring(getInputIndex + 11, propertyName.length() - 1);
+ inputName = propertyName.substring(getInputIndex + 11, getClosingIndex);
}
}
@@ -2735,10 +2849,18 @@ public class ToscaResourceInstaller {
if (!services.isEmpty()) {
// service exist in db
Service existingService = services.get(0);
- List<VnfResourceCustomization> vnfCustomizations = existingService.getVnfCustomizations();
- vnfCustomizations.forEach(e -> service.getVnfCustomizations().add(e));
+ List<VnfResourceCustomization> existingVnfCustomizations = existingService.getVnfCustomizations();
+ if (existingService != null) {
+ // it is duplicating entries, so added a check
+ for (VnfResourceCustomization existingVnfResourceCustomization : existingVnfCustomizations) {
+ if (!service.getVnfCustomizations().contains(existingVnfResourceCustomization)) {
+ service.getVnfCustomizations().add(existingVnfResourceCustomization);
+ }
+ }
+ }
}
service.getVnfCustomizations().add(vnfResourceCustomization);
+
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
index a154734690..4b069e6ac7 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
@@ -724,6 +724,9 @@ public class ASDCNotificationLogging {
buffer.append("Model Subcategory:");
buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
buffer.append(System.lineSeparator());
+ buffer.append("Model Category:");
+ buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ buffer.append(System.lineSeparator());
buffer.append("Model Description:");
buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
index 81977da278..b41fbaf658 100644
--- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
@@ -22,7 +22,10 @@ package org.onap.asdc.activity;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.verify;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import org.junit.Test;
@@ -73,4 +76,32 @@ public class DeployActivitySpecsITTest extends BaseTest {
deployActivitySpecs.deployActivities();
assertTrue(activitySpecCreateResponse.getId().equals("testActivityId"));
}
+
+ @Test
+ public void deployActivitySpecsIT_SDCEndpointDown_Test() throws Exception {
+ ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
+ activitySpecCreateResponse.setId("testActivityId");
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+
+ ObjectMapper mapper = new ObjectMapper();
+ String body = mapper.writeValueAsString(activitySpecCreateResponse);
+
+ wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body)));
+
+ when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://localhost:8090");
+
+ String urlPath = "/v1.0/activity-spec/testActivityId/versions/latest/actions";
+
+ wireMockServer.stubFor(
+ put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.OK.value())));
+
+ deployActivitySpecs.deployActivities();
+ verify(0, putRequestedFor(urlEqualTo(urlPath)));
+ }
+
}
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
index aae5e5dc53..7a876a67a2 100644
--- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
@@ -30,6 +30,7 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.asdc.activity.ActivitySpecsActions;
import org.onap.so.asdc.activity.DeployActivitySpecs;
@@ -54,6 +55,7 @@ public class DeployActivitySpecsTest {
protected ActivitySpecsActions activitySpecsActions;
@InjectMocks
+ @Spy
private DeployActivitySpecs deployActivitySpecs;
@Test
@@ -68,7 +70,8 @@ public class DeployActivitySpecsTest {
List<org.onap.so.db.catalog.beans.ActivitySpec> catalogActivitySpecList =
new ArrayList<org.onap.so.db.catalog.beans.ActivitySpec>();
catalogActivitySpecList.add(catalogActivitySpec);
- when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("testEndpoint");
+ when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://testEndpoint");
+ doReturn(true).when(deployActivitySpecs).checkHttpOk("http://testEndpoint");
when(activitySpecRepository.findAll()).thenReturn(catalogActivitySpecList);
doReturn("testActivityId").when(activitySpecsActions).createActivitySpec(Mockito.any(), Mockito.any());
doReturn(true).when(activitySpecsActions).certifyActivitySpec(Mockito.any(), Mockito.any());
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
index 0681cd8aed..055968cc95 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
@@ -33,6 +33,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
@@ -55,6 +56,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -277,6 +279,35 @@ public class ASDCControllerITTest extends BaseTest {
}
}
+ /**
+ * Test to check RequestId is being set using the DistributionID.
+ */
+ @Test
+ public void treatNotification_verifyRequestID() {
+
+ String serviceUuid = "efaea486-561f-4159-9191-a8d3cb346728";
+ String serviceInvariantUuid = "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23";
+ distributionId = "bb15de12-166d-4e45-9e5f-4b3f25200d7b";
+
+ initMockAaiServer(serviceUuid, serviceInvariantUuid);
+
+ NotificationDataImpl notificationData = new NotificationDataImpl();
+ notificationData.setServiceUUID(serviceUuid);
+ notificationData.setDistributionID(distributionId);
+ notificationData.setServiceInvariantUUID(serviceInvariantUuid);
+ notificationData.setServiceVersion("1.0");
+
+ try {
+ asdcController.treatNotification(notificationData);
+ logger.info("Verify RequestId : {}", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertEquals("bb15de12-166d-4e45-9e5f-4b3f25200d7b", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+
+ } catch (Exception e) {
+ logger.info(e.getMessage(), e);
+ fail(e.getMessage());
+ }
+ }
+
private ArtifactInfoImpl constructPnfServiceArtifact() {
ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl();
artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
index 2c520a3bba..e1b124775b 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
@@ -43,17 +43,21 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Mockito;
import org.mockito.Spy;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
import org.onap.so.db.catalog.beans.AllottedResource;
import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ToscaCsar;
import org.onap.so.db.catalog.beans.Workflow;
+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.NetworkResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
@@ -67,6 +71,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.test.util.ReflectionTestUtils;
public class ASDCRestInterfaceTest extends BaseTest {
@@ -74,6 +79,9 @@ public class ASDCRestInterfaceTest extends BaseTest {
private AllottedResourceRepository allottedRepo;
@Autowired
+ private AllottedResourceCustomizationRepository allottedCustomRepo;
+
+ @Autowired
private ServiceRepository serviceRepo;
@Autowired
@@ -107,6 +115,7 @@ public class ASDCRestInterfaceTest extends BaseTest {
public void setUp() {
// ASDC Controller writes to this path
System.setProperty("mso.config.path", folder.getRoot().toString());
+ ReflectionTestUtils.setField(toscaInstaller, "toscaCsarRepo", toscaCsarRepo);
}
@Test
@@ -164,7 +173,7 @@ public class ASDCRestInterfaceTest extends BaseTest {
@Test
@Transactional
- public void test_VFW_Distrobution() throws Exception {
+ public void test_VFW_Distribution() throws Exception {
wireMockServer.stubFor(post(urlPathMatching("/aai/.*"))
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")));
@@ -290,6 +299,54 @@ public class ASDCRestInterfaceTest extends BaseTest {
assertEquals("Generic NeutronNet", networkResource.get().getModelName());
}
+ @Test
+ public void test_CCVPN_Distribution() throws Exception {
+ wireMockServer.stubFor(post(urlPathMatching("/aai/.*"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")));
+
+ wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value())));
+
+ String resourceLocation = "src/test/resources/resource-examples/ccvpn/";
+ ObjectMapper mapper = new ObjectMapper();
+ NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demo-ccvpn-notification.json"),
+ NotificationDataImpl.class);
+ headers.add("resource-location", resourceLocation);
+ HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers);
+ ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"),
+ HttpMethod.POST, entity, String.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ Optional<Service> service = serviceRepo.findById("317887d3-a4e4-45cb-8971-2a78426fefac");
+ assertTrue(service.isPresent());
+ assertEquals("CCVPNService", service.get().getModelName());
+ }
+
+ @Test
+ public void test_PublicNS_Distribution() throws Exception {
+ wireMockServer.stubFor(post(urlPathMatching("/aai/.*"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")));
+
+ wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value())));
+
+ String resourceLocation = "src/test/resources/resource-examples/public-ns/";
+ ObjectMapper mapper = new ObjectMapper();
+ NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demo-public-ns-notification.json"),
+ NotificationDataImpl.class);
+ headers.add("resource-location", resourceLocation);
+ HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers);
+ ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"),
+ HttpMethod.POST, entity, String.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ Optional<Service> service = serviceRepo.findById("da28696e-d4c9-4df4-9f91-465c6c09a81e");
+ assertTrue(service.isPresent());
+ assertEquals("PublicNS", service.get().getModelName());
+ }
+
protected String createURLWithPort(String uri) {
return "http://localhost:" + port + uri;
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
index 846eaf47e2..da99efadea 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
@@ -24,6 +24,7 @@ import org.junit.Test;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
+import org.onap.sdc.tosca.parser.api.IEntityDetails;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.Property;
@@ -49,6 +50,9 @@ public class ToscaResourceInputTest {
NodeTemplate nodeTemplate;
@Mock
+ IEntityDetails entityDetails;
+
+ @Mock
Property property;
@Mock
@@ -65,16 +69,16 @@ public class ToscaResourceInputTest {
Map<String, Object> map = new HashMap<>();
map.put("customizationUUID", "69df3303-d2b3-47a1-9d04-41604d3a95fd");
Metadata metadata = new Metadata(map);
- when(nodeTemplate.getProperties()).thenReturn(hashMap);
+ when(entityDetails.getProperties()).thenReturn(hashMap);
when(property.getValue()).thenReturn(getInput);
when(getInput.getInputName()).thenReturn("nameKey");
when(input.getName()).thenReturn("nameKey");
when(input.getDefault()).thenReturn("defaultValue");
when(getInput.toString()).thenReturn("getinput:[sites,INDEX,role]");
- when(nodeTemplate.getMetaData()).thenReturn(metadata);
+ when(entityDetails.getMetadata()).thenReturn(metadata);
List<Input> inputs = new ArrayList<>();
inputs.add(input);
- String resourceInput = toscaResourceInstaller.getVnfcResourceInput(nodeTemplate, inputs);
+ String resourceInput = toscaResourceInstaller.getVnfcResourceInput(entityDetails, inputs);
assertEquals("{\\\"key1\\\":\\\"[sites,INDEX,role]|defaultValue\\\"}", resourceInput);
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index 7534ea645a..ffad137ad7 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -25,16 +25,19 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.hibernate.exception.LockAcquisitionException;
import org.junit.Before;
@@ -54,26 +57,38 @@ import org.onap.sdc.toscaparser.api.Group;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.RequirementAssignment;
import org.onap.sdc.toscaparser.api.RequirementAssignments;
+import org.onap.sdc.toscaparser.api.SubstitutionMappings;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.toscaparser.api.elements.StatefulEntityType;
+import org.onap.sdc.toscaparser.api.parameters.Input;
import org.onap.sdc.utils.DistributionStatusEnum;
import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.client.ResourceInstance;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
import org.onap.so.asdc.client.test.emulators.JsonStatusData;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
+import org.onap.so.asdc.installer.IVfModuleData;
import org.onap.so.asdc.installer.ResourceStructure;
import org.onap.so.asdc.installer.ToscaResourceStructure;
+import org.onap.so.asdc.installer.VfModuleStructure;
+import org.onap.so.asdc.installer.VfResourceStructure;
+import org.onap.so.asdc.installer.bpmn.WorkflowResource;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.ToscaCsar;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
+import org.onap.so.db.catalog.data.repository.VFModuleRepository;
+import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
+import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.springframework.beans.factory.annotation.Autowired;
@@ -111,6 +126,8 @@ public class ToscaResourceInstallerTest extends BaseTest {
@Mock
private ToscaResourceStructure toscaResourceStructure;
@Mock
+ private VfResourceStructure vfResourceStruct;
+ @Mock
private ServiceProxyResourceCustomization spResourceCustomization;
@Mock
private ISdcCsarHelper csarHelper;
@@ -258,6 +275,206 @@ public class ToscaResourceInstallerTest extends BaseTest {
}
@Test
+ public void installTheResourceWithGroupAndVFModulesTest() throws Exception {
+ ToscaResourceInstaller toscaInstaller = new ToscaResourceInstaller();
+ ToscaResourceStructure toscaResourceStructObj = prepareToscaResourceStructure(true, toscaInstaller);
+
+ toscaInstaller.installTheResource(toscaResourceStructObj, vfResourceStruct);
+ assertEquals(true, toscaResourceStructObj.isDeployedSuccessfully());
+ }
+
+ @Test
+ public void installTheResourceGroupWithoutVFModulesTest() throws Exception {
+ ToscaResourceInstaller toscaInstaller = new ToscaResourceInstaller();
+ ToscaResourceStructure toscaResourceStructObj = prepareToscaResourceStructure(false, toscaInstaller);
+
+ toscaInstaller.installTheResource(toscaResourceStructObj, vfResourceStruct);
+ assertEquals(true, toscaResourceStructObj.isDeployedSuccessfully());
+ }
+
+ private ToscaResourceStructure prepareToscaResourceStructure(boolean prepareVFModuleStructures,
+ ToscaResourceInstaller toscaInstaller) throws ArtifactInstallerException {
+
+ Metadata metadata = mock(Metadata.class);
+ IResourceInstance resourceInstance = mock(ResourceInstance.class);
+ NodeTemplate nodeTemplate = mock(NodeTemplate.class);
+ ISdcCsarHelper csarHelper = mock(SdcCsarHelperImpl.class);
+
+ IArtifactInfo inputCsar = mock(IArtifactInfo.class);
+ String artifactUuid = "0122c05e-e13a-4c63-b5d2-475ccf23aa74";
+ String checkSum = "MGUzNjJjMzk3OTBkYzExYzQ0MDg2ZDc2M2E3ZjZiZmY=";
+
+ doReturn(checkSum).when(inputCsar).getArtifactChecksum();
+ doReturn(artifactUuid).when(inputCsar).getArtifactUUID();
+ doReturn("1.0").when(inputCsar).getArtifactVersion();
+ doReturn("TestCsarWithGroupAndVFModule").when(inputCsar).getArtifactName();
+ doReturn("Test Csar data with Group and VF module inputs").when(inputCsar).getArtifactDescription();
+ doReturn("http://localhost/dummy/url/test.csar").when(inputCsar).getArtifactURL();
+
+ ToscaResourceStructure toscaResourceStructObj = new ToscaResourceStructure();
+ toscaResourceStructObj.setToscaArtifact(inputCsar);
+
+ ToscaCsarRepository toscaCsarRepo = spy(ToscaCsarRepository.class);
+
+
+ ToscaCsar toscaCsar = mock(ToscaCsar.class);
+ Optional<ToscaCsar> returnValue = Optional.of(toscaCsar);
+ doReturn(artifactUuid).when(toscaCsar).getArtifactUUID();
+ doReturn(checkSum).when(toscaCsar).getArtifactChecksum();
+ doReturn(returnValue).when(toscaCsarRepo).findById(artifactUuid);
+
+ ReflectionTestUtils.setField(toscaInstaller, "toscaCsarRepo", toscaCsarRepo);
+
+ NotificationDataImpl notificationData = new NotificationDataImpl();
+ notificationData.setDistributionID("testStatusSuccessfulTosca");
+ notificationData.setServiceVersion("1234567");
+ notificationData.setServiceUUID("serviceUUID1");
+ notificationData.setWorkloadContext("workloadContext1");
+
+
+
+ String serviceType = "test-type1";
+ String serviceRole = "test-role1";
+ String category = "Network L3+";
+ String description = "Customer Orderable service description";
+ String name = "Customer_Orderable_Service";
+ String uuid = "72db5868-4575-4804-b546-0b0d3c3b5ac6";
+ String invariantUUID = "6f30bbe3-4590-4185-a7e0-4f9610926c6f";
+ String namingPolicy = "naming Policy1";
+ String ecompGeneratedNaming = "true";
+ String environmentContext = "General_Revenue-Bearing1";
+ String resourceCustomizationUUID = "0177ba22-5547-4e4e-bcf8-178f7f71de3a";
+
+ doReturn(serviceType).when(metadata).getValue("serviceType");
+ doReturn(serviceRole).when(metadata).getValue("serviceRole");
+
+ doReturn(category).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ doReturn(description).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION);
+ doReturn("1.0").when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VERSION);
+ doReturn(name).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
+
+ doReturn(uuid).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
+
+ doReturn(environmentContext).when(metadata).getValue(metadata.getValue("environmentContext"));
+ doReturn(invariantUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID);
+ doReturn(namingPolicy).when(metadata).getValue("namingPolicy");
+ doReturn(ecompGeneratedNaming).when(metadata).getValue("ecompGeneratedNaming");
+ doReturn(resourceCustomizationUUID).when(metadata).getValue("vfModuleModelCustomizationUUID");
+
+ ServiceRepository serviceRepo = spy(ServiceRepository.class);
+
+ VnfResourceRepository vnfRepo = spy(VnfResourceRepository.class);
+ doReturn(null).when(vnfRepo).findResourceByModelUUID(uuid);
+
+ VFModuleRepository vfModuleRepo = spy(VFModuleRepository.class);
+ InstanceGroupRepository instanceGroupRepo = spy(InstanceGroupRepository.class);
+
+ WorkflowResource workflowResource = spy(WorkflowResource.class);
+
+ ReflectionTestUtils.setField(toscaInstaller, "serviceRepo", serviceRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "vnfRepo", vnfRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "vfModuleRepo", vfModuleRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "instanceGroupRepo", instanceGroupRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "workflowResource", workflowResource);
+
+ // doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper();
+ toscaResourceStructObj.setSdcCsarHelper(csarHelper);
+ doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION);
+ doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE);
+ doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE);
+ doReturn(resourceCustomizationUUID).when(csarHelper).getMetadataPropertyValue(metadata,
+ SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ doReturn(uuid).when(csarHelper).getMetadataPropertyValue(metadata,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID);
+
+
+ // vnfc instance group list
+ List<Group> vnfcInstanceGroupList = new ArrayList<>();
+ Group vnfcG1 = mock(Group.class);
+ Map<String, Object> metaProperties = new HashMap<>();
+ metaProperties.put(SdcPropertyNames.PROPERTY_NAME_UUID, "vnfc_group1_uuid");
+ metaProperties.put(SdcPropertyNames.PROPERTY_NAME_NAME, "vnfc_group1_uuid");
+ metaProperties.put(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID, "vnfc_group1_invariantid");
+ metaProperties.put(SdcPropertyNames.PROPERTY_NAME_VERSION, "1.0");
+ Metadata vnfcmetadata = new Metadata(metaProperties);
+
+ doReturn(vnfcmetadata).when(vnfcG1).getMetadata();
+ ArrayList<NodeTemplate> memberList = new ArrayList();
+ doReturn(memberList).when(vnfcG1).getMemberNodes();
+ vnfcInstanceGroupList.add(vnfcG1);
+ SubstitutionMappings submappings = mock(SubstitutionMappings.class);
+ doReturn(new ArrayList<Input>()).when(submappings).getInputs();
+ doReturn(submappings).when(nodeTemplate).getSubMappingToscaTemplate();
+
+ doReturn(vnfcInstanceGroupList).when(csarHelper).getGroupsOfOriginOfNodeTemplateByToscaGroupType(nodeTemplate,
+ "org.openecomp.groups.VfcInstanceGroup");
+
+
+ doReturn(notificationData).when(vfResourceStruct).getNotification();
+ doReturn(resourceInstance).when(vfResourceStruct).getResourceInstance();
+
+ if (prepareVFModuleStructures) {
+
+ // VfModule list
+ List<Group> vfModuleGroups = new ArrayList<>();
+ Group g1 = mock(Group.class);
+ doReturn(metadata).when(g1).getMetadata();
+ vfModuleGroups.add(g1);
+
+ doReturn(vfModuleGroups).when(csarHelper).getVfModulesByVf(resourceCustomizationUUID);
+ doReturn("1").when(csarHelper).getGroupPropertyLeafValue(g1, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT);
+
+ doReturn(metadata).when(nodeTemplate).getMetaData();
+ List<NodeTemplate> nodeList = new ArrayList<>();
+ nodeList.add(nodeTemplate);
+ doReturn(nodeList).when(csarHelper).getServiceVfList();
+
+ IVfModuleData moduleMetadata = mock(IVfModuleData.class);
+ doReturn(name).when(moduleMetadata).getVfModuleModelName();
+ doReturn(invariantUUID).when(moduleMetadata).getVfModuleModelInvariantUUID();
+ doReturn(Collections.<String>emptyList()).when(moduleMetadata).getArtifacts();
+ doReturn(resourceCustomizationUUID).when(moduleMetadata).getVfModuleModelCustomizationUUID();
+ doReturn(uuid).when(moduleMetadata).getVfModuleModelUUID();
+ doReturn("1.0").when(moduleMetadata).getVfModuleModelVersion();
+
+ VfModuleStructure moduleStructure = new VfModuleStructure(vfResourceStruct, moduleMetadata);
+
+ List<VfModuleStructure> moduleStructures = new ArrayList<>();
+ moduleStructures.add(moduleStructure);
+ doReturn(moduleStructures).when(vfResourceStruct).getVfModuleStructure();
+ }
+
+ toscaResourceStructObj.setServiceMetadata(metadata);
+ doReturn("resourceInstanceName1").when(resourceInstance).getResourceInstanceName();
+ doReturn(resourceCustomizationUUID).when(resourceInstance).getResourceCustomizationUUID();
+ doReturn("resourceName1").when(resourceInstance).getResourceName();
+
+ Service service = toscaInstaller.createService(toscaResourceStructObj, vfResourceStruct);
+
+ assertNotNull(service);
+ service.setModelVersion("1.0");
+
+ doReturn(service).when(serviceRepo).save(service);
+
+ WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository =
+ spy(WatchdogComponentDistributionStatusRepository.class);
+ ReflectionTestUtils.setField(toscaInstaller, "watchdogCDStatusRepository", watchdogCDStatusRepository);
+ doReturn(null).when(watchdogCDStatusRepository).save(any(WatchdogComponentDistributionStatus.class));
+
+ VnfcInstanceGroupCustomizationRepository vnfcInstanceGroupCustomizationRepo =
+ spy(VnfcInstanceGroupCustomizationRepository.class);
+ ReflectionTestUtils.setField(toscaInstaller, "vnfcInstanceGroupCustomizationRepo",
+ vnfcInstanceGroupCustomizationRepo);
+ doReturn(null).when(vnfcInstanceGroupCustomizationRepo).save(any(VnfcInstanceGroupCustomization.class));
+ return toscaResourceStructObj;
+ }
+
+
+
+ @Test
public void installTheResourceExceptionTest() throws Exception {
expectedException.expect(ArtifactInstallerException.class);
diff --git a/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json b/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json
new file mode 100644
index 0000000000..1ca96f7dc9
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json
@@ -0,0 +1,47 @@
+{
+ "distributionID": "8a01603d-606d-4e40-8bc4-37107ad97897",
+ "serviceName": "CCVPNService",
+ "serviceVersion": "1.0",
+ "serviceUUID": "317887d3-a4e4-45cb-8971-2a78426fefac",
+ "serviceDescription": "CCVPN",
+ "serviceInvariantUUID": "e43f9b81-3035-44df-b618-a787e1c49427",
+ "resources": [
+ {
+ "resourceInstanceName": "siteResource",
+ "resourceCustomizationUUID": "e9e01777-bb2f-42f0-b825-aef0f4c37ccf",
+ "resourceName": "siteResource",
+ "resourceVersion": "1.0",
+ "resoucreType": "VF",
+ "resourceUUID": "5a641276-443b-45ca-ac9c-a0ee84f5007b",
+ "resourceInvariantUUID": "5338673f-df81-483a-afa4-b9766442ebf1",
+ "category": "Configuration",
+ "subcategory": "Configuration",
+ "artifacts": []
+ },
+ {
+ "resourceInstanceName": "SDWANVPNResource",
+ "resourceCustomizationUUID": "7815f32c-bdbf-41f7-9a18-6f0e6d5a0d0e",
+ "resourceName": "SDWANVPNResource",
+ "resourceVersion": "1.0",
+ "resoucreType": "VF",
+ "resourceUUID": "5f9f2164-f7e4-461d-b8de-3470297ce2b3",
+ "resourceInvariantUUID": "5ca15886-9990-419c-a4bb-f0229eac0926",
+ "category": "Configuration",
+ "subcategory": "Configuration",
+ "artifacts": []
+ }
+ ],
+ "serviceArtifacts": [
+ {
+ "artifactName": "service-Ccvpnservice-csar.csar",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "/service-Ccvpnservice-csar.csar",
+ "artifactChecksum": "NTZlNGU4YTQwNzVkZWMwYWZkODE5M2MwYzcyNzM3M2U\u003d",
+ "artifactDescription": "TOSCA definition package of the asset",
+ "artifactTimeout": 0,
+ "artifactVersion": "2",
+ "artifactUUID": "59f34dcf-ec33-4a88-8dbe-aa7f4571ef59"
+ }
+ ],
+ "workloadContext": "Production"
+} \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar b/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar
new file mode 100644
index 0000000000..ce2ac5e0c9
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json b/asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json
new file mode 100644
index 0000000000..f829bf0246
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json
@@ -0,0 +1,173 @@
+{
+ "distributionID": "2d6c5aa8-b644-4f30-a632-5577801ef954",
+ "serviceName": "PublicNS",
+ "serviceVersion": "1.0",
+ "serviceUUID": "da28696e-d4c9-4df4-9f91-465c6c09a81e",
+ "serviceDescription": "PUblic NS",
+ "serviceInvariantUUID": "e907ce73-7e4d-4bf8-b94a-21bd1a7c7592",
+ "resources": [
+ {
+ "resourceInstanceName": "vCPE 0",
+ "resourceName": "vCPE",
+ "resourceVersion": "1.0",
+ "resoucreType": "VF",
+ "resourceUUID": "a67562cf-1bf3-4450-8b69-3bb1cff43089",
+ "resourceInvariantUUID": "e0b3088d-9ca8-482a-aa5a-a1e6906b2d22",
+ "resourceCustomizationUUID": "ae70c293-8db3-40cd-8cd0-30cde194bea5",
+ "category": "Generic",
+ "subcategory": "Infrastructure",
+ "artifacts": [
+ {
+ "artifactName": "vf-license-model.xml",
+ "artifactType": "VF_LICENSE",
+ "artifactURL": "/vcpe0/vf-license-model.xml",
+ "artifactChecksum": "YjYyYWNiMzUxM2YzMWYxYWVhN2Y5MTM3N2E5YzNhNmU\u003d",
+ "artifactDescription": "VF license file",
+ "artifactTimeout": 120,
+ "artifactUUID": "5c29e823-7114-4988-824f-f670ba9d7b21",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactName": "vcpe0_modules.json",
+ "artifactType": "VF_MODULES_METADATA",
+ "artifactURL": "/vcpe0/vcpe0_modules.json",
+ "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d",
+ "artifactDescription": "Auto-generated VF Modules information artifact",
+ "artifactTimeout": 120,
+ "artifactUUID": "128e4e77-21a4-49c3-ac7a-7ca3b187bddc",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactName": "ar1000v.yaml",
+ "artifactType": "HEAT",
+ "artifactURL": "/vcpe0/ar1000v.yaml",
+ "artifactChecksum": "NWU2NGUwNmNkMGEzYjAxMTAyODkzNTc5YzFmZDBmMzM\u003d",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": 120,
+ "artifactUUID": "12dcc618-20f2-4f15-ab00-c549b96b3910",
+ "artifactVersion": "2"
+ },
+ {
+ "artifactName": "vendor-license-model.xml",
+ "artifactType": "VENDOR_LICENSE",
+ "artifactURL": "/vcpe0/vendor-license-model.xml",
+ "artifactChecksum": "OTRkOTY3YjdjM2ZlNDM3NjNlZjBjODU4YTJmNGZhNGE\u003d",
+ "artifactDescription": " Vendor license file",
+ "artifactTimeout": 120,
+ "artifactUUID": "74c4d1bd-1779-421f-8c9d-774ac4567031",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactName": "ar1000v.env",
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "/vcpe0/ar1000v.env",
+ "artifactChecksum": "YzI4MjlkODk4YzcyOTgzZTg2YjAyM2ZiNWU1N2FmMjI\u003d",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": 120,
+ "artifactUUID": "5821b043-ba50-49ef-b739-61b0896050f2",
+ "artifactVersion": "2",
+ "generatedFromUUID": "12dcc618-20f2-4f15-ab00-c549b96b3910"
+ }
+ ]
+ },
+ {
+ "resourceInstanceName": "vGW 0",
+ "resourceName": "vGW",
+ "resourceVersion": "1.0",
+ "resoucreType": "VF",
+ "resourceUUID": "cd82e255-56cf-4644-858e-36cfc45ef754",
+ "resourceInvariantUUID": "52905e03-0632-43f9-93f2-2ab7d959f633",
+ "resourceCustomizationUUID": "fd8595de-1081-4e39-a401-24ffebaa9ed8",
+ "category": "Generic",
+ "subcategory": "Infrastructure",
+ "artifacts": [
+ {
+ "artifactName": "vf-license-model.xml",
+ "artifactType": "VF_LICENSE",
+ "artifactURL": "/vgw0/vf-license-model.xml",
+ "artifactChecksum": "YTdlMDhmYjMzODg5NmI3ODgwNjA0MmUyOWU2N2I2MGM\u003d",
+ "artifactDescription": "VF license file",
+ "artifactTimeout": 120,
+ "artifactUUID": "f2db3ba5-190f-4214-90fd-93407caf10c1",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactName": "vgw0_modules.json",
+ "artifactType": "VF_MODULES_METADATA",
+ "artifactURL": "/vgw0/vgw0_modules.json",
+ "artifactChecksum": "OTQwY2ZlZThjMjNlYjAyNzU4NDUyZDVhY2VjNTIwZTk\u003d",
+ "artifactDescription": "Auto-generated VF Modules information artifact",
+ "artifactTimeout": 120,
+ "artifactUUID": "8730baa0-1b8c-4ac3-bc5c-d49c5b88f111",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactName": "gateway.yaml",
+ "artifactType": "HEAT",
+ "artifactURL": "/vgw0/gateway.yaml",
+ "artifactChecksum": "NGNiMGRjMWViNGRkMGQzM2ZjNDNjMjQ5OGMwMjI2MjM\u003d",
+ "artifactDescription": "created from csar",
+ "artifactTimeout": 120,
+ "artifactUUID": "60d55796-212c-4c66-8af5-63964d636ae4",
+ "artifactVersion": "2"
+ },
+ {
+ "artifactName": "vendor-license-model.xml",
+ "artifactType": "VENDOR_LICENSE",
+ "artifactURL": "/vgw0/vendor-license-model.xml",
+ "artifactChecksum": "OTRkOTY3YjdjM2ZlNDM3NjNlZjBjODU4YTJmNGZhNGE\u003d",
+ "artifactDescription": " Vendor license file",
+ "artifactTimeout": 120,
+ "artifactUUID": "019bdcbf-03fc-4ec2-8d39-c09f808722e9",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactName": "gateway.env",
+ "artifactType": "HEAT_ENV",
+ "artifactURL": "/vgw0/gateway.env",
+ "artifactChecksum": "Y2Y4ZDgzMDg3NDBiMDhkODZiMmE1MGUyYjU2ZGFlZDU\u003d",
+ "artifactDescription": "Auto-generated HEAT Environment deployment artifact",
+ "artifactTimeout": 120,
+ "artifactUUID": "9df0452f-826c-4287-9a2d-ca0095339866",
+ "artifactVersion": "2",
+ "generatedFromUUID": "60d55796-212c-4c66-8af5-63964d636ae4"
+ }
+ ]
+ },
+ {
+ "resourceInstanceName": "Generic NeutronNet 0",
+ "resourceName": "Generic NeutronNet",
+ "resourceVersion": "1.0",
+ "resoucreType": "VL",
+ "resourceUUID": "4069be99-5d9a-427b-a427-04fe16ccbf38",
+ "resourceInvariantUUID": "f3ed1133-c1bb-4735-82d4-8e041265fad6",
+ "resourceCustomizationUUID": "c8a1a81d-d836-4f33-9d0e-91e9417f812a",
+ "category": "Generic",
+ "subcategory": "Network Elements",
+ "artifacts": []
+ }
+ ],
+ "serviceArtifacts": [
+ {
+ "artifactName": "service-Publicns-template.yml",
+ "artifactType": "TOSCA_TEMPLATE",
+ "artifactURL": "/service-Publicns-template.yml",
+ "artifactChecksum": "NTUzMDU5YzM3MTk4OGNiNjQ2OGRlMWY2YjU3MjE2YjM\u003d",
+ "artifactDescription": "TOSCA representation of the asset",
+ "artifactTimeout": 0,
+ "artifactUUID": "2617d0ca-54f0-4222-b659-c12e292d94dd",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactName": "service-Publicns-csar.csar",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "/service-Publicns-csar.csar",
+ "artifactChecksum": "ZTRhOGI0M2UxN2ZhYjQ0ODI5ZDZhZTExZTFkMGU3N2Y\u003d",
+ "artifactDescription": "TOSCA definition package of the asset",
+ "artifactTimeout": 0,
+ "artifactUUID": "26a323ff-b97b-4b86-96b1-25a80c0876e5",
+ "artifactVersion": "1"
+ }
+ ],
+ "workloadContext": "Production"
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar
new file mode 100644
index 0000000000..d5ea949cdc
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml
new file mode 100644
index 0000000000..2e6f29360f
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml
@@ -0,0 +1,1186 @@
+tosca_definitions_version: tosca_simple_yaml_1_1
+metadata:
+ invariantUUID: e907ce73-7e4d-4bf8-b94a-21bd1a7c7592
+ UUID: da28696e-d4c9-4df4-9f91-465c6c09a81e
+ name: PublicNS
+ description: PUblic NS
+ type: Service
+ category: E2E Service
+ serviceType: ''
+ serviceRole: ''
+ instantiationType: A-la-carte
+ serviceEcompNaming: true
+ ecompGeneratedNaming: true
+ namingPolicy: ''
+ environmentContext: General_Revenue-Bearing
+imports:
+- nodes:
+ file: nodes.yml
+- datatypes:
+ file: data.yml
+- capabilities:
+ file: capabilities.yml
+- relationships:
+ file: relationships.yml
+- groups:
+ file: groups.yml
+- policies:
+ file: policies.yml
+- annotations:
+ file: annotations.yml
+- service-PublicNS-interface:
+ file: service-Publicns-template-interface.yml
+- resource-vCPE:
+ file: resource-Vcpe-template.yml
+- resource-vCPE-interface:
+ file: resource-Vcpe-template-interface.yml
+- resource-vGW:
+ file: resource-Vgw-template.yml
+- resource-vGW-interface:
+ file: resource-Vgw-template-interface.yml
+- resource-Generic NeutronNet:
+ file: resource-GenericNeutronnet-template.yml
+topology_template:
+ node_templates:
+ vCPE 0:
+ type: org.openecomp.resource.vf.Vcpe
+ metadata:
+ invariantUUID: e0b3088d-9ca8-482a-aa5a-a1e6906b2d22
+ UUID: 32edc5e6-34f7-4d62-92f8-c38817280eb9
+ customizationUUID: ae70c293-8db3-40cd-8cd0-30cde194bea5
+ version: '1.0'
+ name: vCPE
+ description: vCPE
+ type: VF
+ category: Generic
+ subcategory: Infrastructure
+ resourceVendor: huawei
+ resourceVendorRelease: '1.0'
+ resourceVendorModelNumber: ''
+ properties:
+ vf_module_id: vCPEAR1000V
+ private_subnet_lan_id: 265e1457-8eb7-4fe8-a580-fb547656aad1
+ vcpe_image_name: vCPE_images
+ skip_post_instantiation_configuration: true
+ nf_naming:
+ ecomp_generated_naming: true
+ multi_stage_design: 'false'
+ availability_zone_max_count: 1
+ private_net_id: 1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d
+ vcpe_name: ar1000v
+ private_subnet_wan_id: 86048e4e-861e-47c9-ae55-a5531b747e36
+ vnf_id: vCPE_huaweicloud
+ vcpe_flavor_name: vCPE_flavor
+ vcpe_private_ip_lan: 192.168.10.250
+ requirements:
+ - abstract_vcpe.link_vcpe_vcpe_private_lan_port:
+ capability: virtual_linkable
+ node: Generic NeutronNet 0
+ - abstract_vcpe.link_vcpe_vcpe_private_wan_port:
+ capability: virtual_linkable
+ node: Generic NeutronNet 0
+ capabilities:
+ abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_lan_port:
+ properties:
+ unit: B/s
+ description: Average rate of outgoing bytes
+ type: Gauge
+ category: network
+ abstract_vcpe.scalable_vcpe:
+ properties:
+ max_instances: 1
+ min_instances: 1
+ abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_lan_port:
+ properties:
+ unit: B
+ description: Number of outgoing bytes
+ type: Cumulative
+ category: network
+ abstract_vcpe.disk.read.requests_vcpe:
+ properties:
+ unit: request
+ description: Number of read requests
+ type: Cumulative
+ category: compute
+ abstract_vcpe.disk.device.write.requests.rate_vcpe:
+ properties:
+ unit: request/s
+ description: Average rate of write requests
+ type: Gauge
+ category: disk
+ abstract_vcpe.disk.read.bytes.rate_vcpe:
+ properties:
+ unit: B/s
+ description: Average rate of reads
+ type: Gauge
+ category: compute
+ abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_wan_port:
+ properties:
+ unit: B/s
+ description: Average rate of outgoing bytes
+ type: Gauge
+ category: network
+ abstract_vcpe.disk.device.read.requests_vcpe:
+ properties:
+ unit: request
+ description: Number of read requests
+ type: Cumulative
+ category: disk
+ abstract_vcpe.disk.device.capacity_vcpe:
+ properties:
+ unit: B
+ description: The amount of disk per device that the instance can see
+ type: Gauge
+ category: disk
+ abstract_vcpe.cpu.delta_vcpe:
+ properties:
+ unit: ns
+ description: CPU time used since previous datapoint
+ type: Delta
+ category: compute
+ abstract_vcpe.port_mirroring_vcpe_vcpe_private_lan_port:
+ properties:
+ connection_point:
+ network_role:
+ get_input: port_vcpe_private_lan_port_network_role
+ nfc_naming_code: vcpe
+ abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_lan_port:
+ properties:
+ unit: B/s
+ description: Average rate of incoming bytes
+ type: Gauge
+ category: network
+ abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_lan_port:
+ properties:
+ unit: packet/s
+ description: Average rate of incoming packets
+ type: Gauge
+ category: network
+ abstract_vcpe.port_mirroring_vcpe_vcpe_private_wan_port:
+ properties:
+ connection_point:
+ network_role:
+ get_input: port_vcpe_private_wan_port_network_role
+ nfc_naming_code: vcpe
+ abstract_vcpe.cpu_vcpe:
+ properties:
+ unit: ns
+ description: CPU time used
+ type: Cumulative
+ category: compute
+ abstract_vcpe.disk.latency_vcpe:
+ properties:
+ unit: ms
+ description: Average disk latency
+ type: Gauge
+ category: disk
+ abstract_vcpe.disk.device.read.bytes_vcpe:
+ properties:
+ unit: B
+ description: Volume of reads
+ type: Cumulative
+ category: disk
+ abstract_vcpe.disk.write.bytes_vcpe:
+ properties:
+ unit: B
+ description: Volume of writes
+ type: Cumulative
+ category: compute
+ abstract_vcpe.disk.device.read.requests.rate_vcpe:
+ properties:
+ unit: request/s
+ description: Average rate of read requests
+ type: Gauge
+ category: disk
+ abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_wan_port:
+ properties:
+ unit: B
+ description: Number of outgoing bytes
+ type: Cumulative
+ category: network
+ abstract_vcpe.disk.root.size_vcpe:
+ properties:
+ unit: GB
+ description: Size of root disk
+ type: Gauge
+ category: compute
+ abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_lan_port:
+ properties:
+ unit: B
+ description: Number of incoming bytes
+ type: Cumulative
+ category: network
+ abstract_vcpe.disk.iops_vcpe:
+ properties:
+ unit: count/s
+ description: Average disk iops
+ type: Gauge
+ category: disk
+ abstract_vcpe.endpoint_vcpe:
+ properties:
+ secure: true
+ abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_lan_port:
+ properties:
+ unit: packet
+ description: Number of outgoing packets
+ type: Cumulative
+ category: network
+ abstract_vcpe.disk.device.write.requests_vcpe:
+ properties:
+ unit: request
+ description: Number of write requests
+ type: Cumulative
+ category: disk
+ abstract_vcpe.disk.write.bytes.rate_vcpe:
+ properties:
+ unit: B/s
+ description: Average rate of writes
+ type: Gauge
+ category: compute
+ abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_wan_port:
+ properties:
+ unit: packet/s
+ description: Average rate of outgoing packets
+ type: Gauge
+ category: network
+ abstract_vcpe.disk.capacity_vcpe:
+ properties:
+ unit: B
+ description: The amount of disk that the instance can see
+ type: Gauge
+ category: disk
+ abstract_vcpe.cpu_util_vcpe:
+ properties:
+ unit: '%'
+ description: Average CPU utilization
+ type: Gauge
+ category: compute
+ abstract_vcpe.disk.write.requests_vcpe:
+ properties:
+ unit: request
+ description: Number of write requests
+ type: Cumulative
+ category: compute
+ abstract_vcpe.disk.read.bytes_vcpe:
+ properties:
+ unit: B
+ description: Volume of reads
+ type: Cumulative
+ category: compute
+ abstract_vcpe.disk.device.write.bytes_vcpe:
+ properties:
+ unit: B
+ description: Volume of writes
+ type: Cumulative
+ category: disk
+ abstract_vcpe.disk.device.write.bytes.rate_vcpe:
+ properties:
+ unit: B/s
+ description: Average rate of writes
+ type: Gauge
+ category: disk
+ abstract_vcpe.vcpus_vcpe:
+ properties:
+ unit: vcpu
+ description: Number of virtual CPUs allocated to the instance
+ type: Gauge
+ category: compute
+ abstract_vcpe.disk.allocation_vcpe:
+ properties:
+ unit: B
+ description: The amount of disk occupied by the instance on the host machine
+ type: Gauge
+ category: disk
+ abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_wan_port:
+ properties:
+ unit: packet
+ description: Number of incoming packets
+ type: Cumulative
+ category: network
+ abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_wan_port:
+ properties:
+ unit: B/s
+ description: Average rate of incoming bytes
+ type: Gauge
+ category: network
+ abstract_vcpe.memory_vcpe:
+ properties:
+ unit: MB
+ description: Volume of RAM allocated to the instance
+ type: Gauge
+ category: compute
+ abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_lan_port:
+ properties:
+ unit: packet
+ description: Number of incoming packets
+ type: Cumulative
+ category: network
+ abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_wan_port:
+ properties:
+ unit: packet/s
+ description: Average rate of incoming packets
+ type: Gauge
+ category: network
+ abstract_vcpe.disk.device.read.bytes.rate_vcpe:
+ properties:
+ unit: B/s
+ description: Average rate of reads
+ type: Gauge
+ category: disk
+ abstract_vcpe.memory.usage_vcpe:
+ properties:
+ unit: MB
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ type: Gauge
+ category: compute
+ abstract_vcpe.disk.device.iops_vcpe:
+ properties:
+ unit: count/s
+ description: Average disk iops per device
+ type: Gauge
+ category: disk
+ abstract_vcpe.disk.device.allocation_vcpe:
+ properties:
+ unit: B
+ description: The amount of disk per device occupied by the instance on the host machine
+ type: Gauge
+ category: disk
+ abstract_vcpe.disk.usage_vcpe:
+ properties:
+ unit: B
+ description: The physical size in bytes of the image container on the host
+ type: Gauge
+ category: disk
+ abstract_vcpe.disk.device.latency_vcpe:
+ properties:
+ unit: ms
+ description: Average disk latency per device
+ type: Gauge
+ category: disk
+ abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_wan_port:
+ properties:
+ unit: packet
+ description: Number of outgoing packets
+ type: Cumulative
+ category: network
+ abstract_vcpe.disk.write.requests.rate_vcpe:
+ properties:
+ unit: request/s
+ description: Average rate of write requests
+ type: Gauge
+ category: compute
+ abstract_vcpe.instance_vcpe:
+ properties:
+ unit: instance
+ description: Existence of instance
+ type: Gauge
+ category: compute
+ abstract_vcpe.disk.device.usage_vcpe:
+ properties:
+ unit: B
+ description: The physical size in bytes of the image container on the host per device
+ type: Gauge
+ category: disk
+ abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_wan_port:
+ properties:
+ unit: B
+ description: Number of incoming bytes
+ type: Cumulative
+ category: network
+ abstract_vcpe.disk.ephemeral.size_vcpe:
+ properties:
+ unit: GB
+ description: Size of ephemeral disk
+ type: Gauge
+ category: compute
+ abstract_vcpe.memory.resident_vcpe:
+ properties:
+ unit: MB
+ description: Volume of RAM used by the instance on the physical machine
+ type: Gauge
+ category: compute
+ abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_lan_port:
+ properties:
+ unit: packet/s
+ description: Average rate of outgoing packets
+ type: Gauge
+ category: network
+ Generic NeutronNet 0:
+ type: org.openecomp.resource.vl.GenericNeutronNet
+ metadata:
+ invariantUUID: f3ed1133-c1bb-4735-82d4-8e041265fad6
+ UUID: 24ec2ed8-a072-4f86-9a58-3a4fe220862e
+ customizationUUID: c8a1a81d-d836-4f33-9d0e-91e9417f812a
+ version: '1.0'
+ name: Generic NeutronNet
+ description: Generic NeutronNet
+ type: VL
+ category: Generic
+ subcategory: Network Elements
+ resourceVendor: ONAP (Tosca)
+ resourceVendorRelease: 1.0.0.wd03
+ resourceVendorModelNumber: ''
+ properties:
+ network_assignments:
+ is_external_network: false
+ is_trunked: false
+ ipv4_subnet_default_assignment:
+ min_subnets_count: 1
+ ecomp_generated_network_assignment: false
+ ipv6_subnet_default_assignment:
+ min_subnets_count: 1
+ exVL_naming:
+ ecomp_generated_naming: true
+ network_flows:
+ is_network_policy: false
+ is_bound_to_vpn: false
+ network_ecomp_naming:
+ ecomp_generated_naming: true
+ network_type: NEUTRON
+ network_technology: NEUTRON
+ network_homing:
+ ecomp_selected_instance_node_target: false
+ vGW 0:
+ type: org.openecomp.resource.vf.Vgw
+ metadata:
+ invariantUUID: 52905e03-0632-43f9-93f2-2ab7d959f633
+ UUID: 4f442b9c-237d-4d2d-b549-ee1bdb9842b3
+ customizationUUID: fd8595de-1081-4e39-a401-24ffebaa9ed8
+ version: '1.0'
+ name: vGW
+ description: vGW
+ type: VF
+ category: Generic
+ subcategory: Infrastructure
+ resourceVendor: huawei
+ resourceVendorRelease: '1.0'
+ resourceVendorModelNumber: ''
+ properties:
+ vf_module_id: CCVPNvGW
+ gateway_image_name: gateway_image
+ private_subnet_lan_id: 265e1457-8eb7-4fe8-a580-fb547656aad1
+ skip_post_instantiation_configuration: true
+ nf_naming:
+ ecomp_generated_naming: true
+ multi_stage_design: 'false'
+ availability_zone_max_count: 1
+ vnf_id: vGW_huaweicloud
+ private_net_id: 1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d
+ gateway_flavor_name: s3.large.4
+ gateway_private_ip_lan: 192.168.10.200
+ gateway_name: gateway-vm
+ requirements:
+ - abstract_gateway.link_gateway_gateway_private_lan_port:
+ capability: virtual_linkable
+ node: Generic NeutronNet 0
+ capabilities:
+ abstract_gateway.network.incoming.bytes.rate_gateway_gateway_private_lan_port:
+ properties:
+ unit: B/s
+ description: Average rate of incoming bytes
+ type: Gauge
+ category: network
+ abstract_gateway.disk.device.read.bytes.rate_gateway:
+ properties:
+ unit: B/s
+ description: Average rate of reads
+ type: Gauge
+ category: disk
+ abstract_gateway.disk.capacity_gateway:
+ properties:
+ unit: B
+ description: The amount of disk that the instance can see
+ type: Gauge
+ category: disk
+ abstract_gateway.scalable_gateway:
+ properties:
+ max_instances: 1
+ min_instances: 1
+ abstract_gateway.disk.read.bytes_gateway:
+ properties:
+ unit: B
+ description: Volume of reads
+ type: Cumulative
+ category: compute
+ abstract_gateway.disk.allocation_gateway:
+ properties:
+ unit: B
+ description: The amount of disk occupied by the instance on the host machine
+ type: Gauge
+ category: disk
+ abstract_gateway.disk.device.write.requests_gateway:
+ properties:
+ unit: request
+ description: Number of write requests
+ type: Cumulative
+ category: disk
+ abstract_gateway.disk.device.read.bytes_gateway:
+ properties:
+ unit: B
+ description: Volume of reads
+ type: Cumulative
+ category: disk
+ abstract_gateway.cpu.delta_gateway:
+ properties:
+ unit: ns
+ description: CPU time used since previous datapoint
+ type: Delta
+ category: compute
+ abstract_gateway.network.outgoing.packets.rate_gateway_gateway_private_lan_port:
+ properties:
+ unit: packet/s
+ description: Average rate of outgoing packets
+ type: Gauge
+ category: network
+ abstract_gateway.cpu_gateway:
+ properties:
+ unit: ns
+ description: CPU time used
+ type: Cumulative
+ category: compute
+ abstract_gateway.disk.device.allocation_gateway:
+ properties:
+ unit: B
+ description: The amount of disk per device occupied by the instance on the host machine
+ type: Gauge
+ category: disk
+ abstract_gateway.disk.latency_gateway:
+ properties:
+ unit: ms
+ description: Average disk latency
+ type: Gauge
+ category: disk
+ abstract_gateway.disk.device.read.requests_gateway:
+ properties:
+ unit: request
+ description: Number of read requests
+ type: Cumulative
+ category: disk
+ abstract_gateway.disk.device.read.requests.rate_gateway:
+ properties:
+ unit: request/s
+ description: Average rate of read requests
+ type: Gauge
+ category: disk
+ abstract_gateway.disk.write.requests.rate_gateway:
+ properties:
+ unit: request/s
+ description: Average rate of write requests
+ type: Gauge
+ category: compute
+ abstract_gateway.disk.device.write.bytes.rate_gateway:
+ properties:
+ unit: B/s
+ description: Average rate of writes
+ type: Gauge
+ category: disk
+ abstract_gateway.cpu_util_gateway:
+ properties:
+ unit: '%'
+ description: Average CPU utilization
+ type: Gauge
+ category: compute
+ abstract_gateway.instance_gateway:
+ properties:
+ unit: instance
+ description: Existence of instance
+ type: Gauge
+ category: compute
+ abstract_gateway.network.outpoing.packets_gateway_gateway_private_lan_port:
+ properties:
+ unit: packet
+ description: Number of outgoing packets
+ type: Cumulative
+ category: network
+ abstract_gateway.disk.root.size_gateway:
+ properties:
+ unit: GB
+ description: Size of root disk
+ type: Gauge
+ category: compute
+ abstract_gateway.memory.usage_gateway:
+ properties:
+ unit: MB
+ description: Volume of RAM used by the instance from the amount of its allocated memory
+ type: Gauge
+ category: compute
+ abstract_gateway.network.outgoing.bytes_gateway_gateway_private_lan_port:
+ properties:
+ unit: B
+ description: Number of outgoing bytes
+ type: Cumulative
+ category: network
+ abstract_gateway.network.outgoing.bytes.rate_gateway_gateway_private_lan_port:
+ properties:
+ unit: B/s
+ description: Average rate of outgoing bytes
+ type: Gauge
+ category: network
+ abstract_gateway.disk.device.capacity_gateway:
+ properties:
+ unit: B
+ description: The amount of disk per device that the instance can see
+ type: Gauge
+ category: disk
+ abstract_gateway.disk.iops_gateway:
+ properties:
+ unit: count/s
+ description: Average disk iops
+ type: Gauge
+ category: disk
+ abstract_gateway.disk.write.requests_gateway:
+ properties:
+ unit: request
+ description: Number of write requests
+ type: Cumulative
+ category: compute
+ abstract_gateway.disk.device.write.bytes_gateway:
+ properties:
+ unit: B
+ description: Volume of writes
+ type: Cumulative
+ category: disk
+ abstract_gateway.disk.ephemeral.size_gateway:
+ properties:
+ unit: GB
+ description: Size of ephemeral disk
+ type: Gauge
+ category: compute
+ abstract_gateway.disk.device.write.requests.rate_gateway:
+ properties:
+ unit: request/s
+ description: Average rate of write requests
+ type: Gauge
+ category: disk
+ abstract_gateway.network.incoming.packets.rate_gateway_gateway_private_lan_port:
+ properties:
+ unit: packet/s
+ description: Average rate of incoming packets
+ type: Gauge
+ category: network
+ abstract_gateway.disk.device.iops_gateway:
+ properties:
+ unit: count/s
+ description: Average disk iops per device
+ type: Gauge
+ category: disk
+ abstract_gateway.endpoint_gateway:
+ properties:
+ secure: true
+ abstract_gateway.disk.device.latency_gateway:
+ properties:
+ unit: ms
+ description: Average disk latency per device
+ type: Gauge
+ category: disk
+ abstract_gateway.vcpus_gateway:
+ properties:
+ unit: vcpu
+ description: Number of virtual CPUs allocated to the instance
+ type: Gauge
+ category: compute
+ abstract_gateway.memory_gateway:
+ properties:
+ unit: MB
+ description: Volume of RAM allocated to the instance
+ type: Gauge
+ category: compute
+ abstract_gateway.network.incoming.bytes_gateway_gateway_private_lan_port:
+ properties:
+ unit: B
+ description: Number of incoming bytes
+ type: Cumulative
+ category: network
+ abstract_gateway.disk.read.bytes.rate_gateway:
+ properties:
+ unit: B/s
+ description: Average rate of reads
+ type: Gauge
+ category: compute
+ abstract_gateway.disk.read.requests_gateway:
+ properties:
+ unit: request
+ description: Number of read requests
+ type: Cumulative
+ category: compute
+ abstract_gateway.port_mirroring_gateway_gateway_private_lan_port:
+ properties:
+ connection_point:
+ network_role:
+ get_input: port_gateway_private_lan_port_network_role
+ nfc_naming_code: gateway
+ abstract_gateway.disk.device.usage_gateway:
+ properties:
+ unit: B
+ description: The physical size in bytes of the image container on the host per device
+ type: Gauge
+ category: disk
+ abstract_gateway.disk.write.bytes.rate_gateway:
+ properties:
+ unit: B/s
+ description: Average rate of writes
+ type: Gauge
+ category: compute
+ abstract_gateway.network.incoming.packets_gateway_gateway_private_lan_port:
+ properties:
+ unit: packet
+ description: Number of incoming packets
+ type: Cumulative
+ category: network
+ abstract_gateway.memory.resident_gateway:
+ properties:
+ unit: MB
+ description: Volume of RAM used by the instance on the physical machine
+ type: Gauge
+ category: compute
+ abstract_gateway.disk.usage_gateway:
+ properties:
+ unit: B
+ description: The physical size in bytes of the image container on the host
+ type: Gauge
+ category: disk
+ abstract_gateway.disk.write.bytes_gateway:
+ properties:
+ unit: B
+ description: Volume of writes
+ type: Cumulative
+ category: compute
+ groups:
+ vcpe0..Vcpe..ar1000v..module-0:
+ type: org.openecomp.groups.VfModule
+ metadata:
+ vfModuleModelName: Vcpe..ar1000v..module-0
+ vfModuleModelInvariantUUID: d7719964-c045-4ed3-84d6-20a01db7612f
+ vfModuleModelUUID: c84ade8a-6e4b-49c7-86e8-0e4fc009f4cd
+ vfModuleModelVersion: '1'
+ vfModuleModelCustomizationUUID: 8caeefbd-ab71-40c9-9387-8729d7d9c2de
+ properties:
+ min_vf_module_instances: 1
+ vf_module_label: ar1000v
+ max_vf_module_instances: 1
+ vf_module_type: Base
+ isBase: true
+ initial_count: 1
+ volume_group: false
+ vgw0..Vgw..gateway..module-0:
+ type: org.openecomp.groups.VfModule
+ metadata:
+ vfModuleModelName: Vgw..gateway..module-0
+ vfModuleModelInvariantUUID: 8c8c936c-e71c-4bc4-94f7-c5680c9dbc00
+ vfModuleModelUUID: ddda7e87-8113-463f-aa27-a60112a4e438
+ vfModuleModelVersion: '1'
+ vfModuleModelCustomizationUUID: ea551d60-f9c9-48f2-9757-b01eb2d26d13
+ properties:
+ min_vf_module_instances: 1
+ vf_module_label: gateway
+ max_vf_module_instances: 1
+ vf_module_type: Base
+ isBase: true
+ initial_count: 1
+ volume_group: false
+ substitution_mappings:
+ node_type: org.openecomp.service.Publicns
+ capabilities:
+ vgw0.abstract_gateway.disk.allocation_gateway:
+ - vGW 0
+ - abstract_gateway.disk.allocation_gateway
+ vgw0.abstract_gateway.memory.usage_gateway:
+ - vGW 0
+ - abstract_gateway.memory.usage_gateway
+ vcpe0.abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_wan_port
+ vgw0.abstract_gateway.disk.device.write.bytes.rate_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.write.bytes.rate_gateway
+ vgw0.abstract_gateway.disk.device.latency_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.latency_gateway
+ vgw0.abstract_gateway.network.incoming.bytes.rate_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.network.incoming.bytes.rate_gateway_gateway_private_lan_port
+ vgw0.abstract_gateway.scalable_gateway:
+ - vGW 0
+ - abstract_gateway.scalable_gateway
+ vcpe0.abstract_vcpe.host_vcpe:
+ - vCPE 0
+ - abstract_vcpe.host_vcpe
+ vcpe0.abstract_vcpe.disk.latency_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.latency_vcpe
+ vcpe0.abstract_vcpe.scalable_vcpe:
+ - vCPE 0
+ - abstract_vcpe.scalable_vcpe
+ vcpe0.abstract_vcpe.disk.device.write.bytes.rate_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.write.bytes.rate_vcpe
+ vgw0.abstract_gateway.disk.write.requests.rate_gateway:
+ - vGW 0
+ - abstract_gateway.disk.write.requests.rate_gateway
+ vcpe0.abstract_vcpe.feature_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.feature_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_lan_port
+ vcpe0.abstract_vcpe.disk.iops_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.iops_vcpe
+ vcpe0.abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.feature_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.feature_vcpe_vcpe_private_lan_port
+ vgw0.abstract_gateway.host_gateway:
+ - vGW 0
+ - abstract_gateway.host_gateway
+ vgw0.abstract_gateway.disk.device.write.requests.rate_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.write.requests.rate_gateway
+ vcpe0.abstract_vcpe.port_mirroring_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.port_mirroring_vcpe_vcpe_private_lan_port
+ vcpe0.abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_lan_port
+ vcpe0.abstract_vcpe.disk.device.capacity_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.capacity_vcpe
+ vcpe0.abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.os_vcpe:
+ - vCPE 0
+ - abstract_vcpe.os_vcpe
+ vgw0.abstract_gateway.disk.usage_gateway:
+ - vGW 0
+ - abstract_gateway.disk.usage_gateway
+ vcpe0.abstract_vcpe.binding_vcpe:
+ - vCPE 0
+ - abstract_vcpe.binding_vcpe
+ vgw0.abstract_gateway.network.outgoing.bytes_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.network.outgoing.bytes_gateway_gateway_private_lan_port
+ vcpe0.abstract_vcpe.binding_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.binding_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.memory.resident_vcpe:
+ - vCPE 0
+ - abstract_vcpe.memory.resident_vcpe
+ vgw0.abstract_gateway.disk.write.bytes_gateway:
+ - vGW 0
+ - abstract_gateway.disk.write.bytes_gateway
+ vgw0.abstract_gateway.disk.read.bytes.rate_gateway:
+ - vGW 0
+ - abstract_gateway.disk.read.bytes.rate_gateway
+ vcpe0.abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_lan_port
+ vgw0.abstract_gateway.disk.root.size_gateway:
+ - vGW 0
+ - abstract_gateway.disk.root.size_gateway
+ vcpe0.abstract_vcpe.disk.write.requests_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.write.requests_vcpe
+ vcpe0.abstract_vcpe.disk.device.write.bytes_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.write.bytes_vcpe
+ vcpe0.abstract_vcpe.feature_vcpe:
+ - vCPE 0
+ - abstract_vcpe.feature_vcpe
+ vcpe0.abstract_vcpe.disk.device.latency_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.latency_vcpe
+ vgw0.abstract_gateway.cpu_util_gateway:
+ - vGW 0
+ - abstract_gateway.cpu_util_gateway
+ vgw0.abstract_gateway.network.incoming.packets_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.network.incoming.packets_gateway_gateway_private_lan_port
+ vgw0.abstract_gateway.disk.device.read.requests.rate_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.read.requests.rate_gateway
+ vgw0.abstract_gateway.network.incoming.packets.rate_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.network.incoming.packets.rate_gateway_gateway_private_lan_port
+ vcpe0.abstract_vcpe.port_mirroring_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.port_mirroring_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.disk.write.bytes_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.write.bytes_vcpe
+ vgw0.abstract_gateway.disk.capacity_gateway:
+ - vGW 0
+ - abstract_gateway.disk.capacity_gateway
+ vgw0.abstract_gateway.memory_gateway:
+ - vGW 0
+ - abstract_gateway.memory_gateway
+ vcpe0.abstract_vcpe.cpu_util_vcpe:
+ - vCPE 0
+ - abstract_vcpe.cpu_util_vcpe
+ vgw0.abstract_gateway.disk.device.write.requests_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.write.requests_gateway
+ vgw0.abstract_gateway.vcpus_gateway:
+ - vGW 0
+ - abstract_gateway.vcpus_gateway
+ vcpe0.abstract_vcpe.disk.ephemeral.size_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.ephemeral.size_vcpe
+ vgw0.abstract_gateway.disk.device.read.bytes_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.read.bytes_gateway
+ vgw0.abstract_gateway.disk.device.allocation_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.allocation_gateway
+ vgw0.abstract_gateway.disk.device.capacity_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.capacity_gateway
+ vcpe0.abstract_vcpe.disk.write.requests.rate_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.write.requests.rate_vcpe
+ vcpe0.abstract_vcpe.disk.usage_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.usage_vcpe
+ vgw0.abstract_gateway.disk.device.iops_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.iops_gateway
+ vcpe0.abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_lan_port
+ vgw0.abstract_gateway.endpoint_gateway:
+ - vGW 0
+ - abstract_gateway.endpoint_gateway
+ vcpe0.abstract_vcpe.disk.device.read.bytes.rate_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.read.bytes.rate_vcpe
+ vcpe0.abstract_vcpe.disk.read.requests_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.read.requests_vcpe
+ vcpe0.abstract_vcpe.disk.read.bytes.rate_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.read.bytes.rate_vcpe
+ vcpe0.abstract_vcpe.disk.device.read.bytes_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.read.bytes_vcpe
+ vgw0.abstract_gateway.binding_gateway:
+ - vGW 0
+ - abstract_gateway.binding_gateway
+ vcpe0.abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_lan_port
+ vcpe0.abstract_vcpe.cpu.delta_vcpe:
+ - vCPE 0
+ - abstract_vcpe.cpu.delta_vcpe
+ vcpe0.abstract_vcpe.disk.device.write.requests.rate_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.write.requests.rate_vcpe
+ vgw0.abstract_gateway.instance_gateway:
+ - vGW 0
+ - abstract_gateway.instance_gateway
+ vgw0.abstract_gateway.memory.resident_gateway:
+ - vGW 0
+ - abstract_gateway.memory.resident_gateway
+ vcpe0.abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_wan_port
+ vgw0.abstract_gateway.disk.read.bytes_gateway:
+ - vGW 0
+ - abstract_gateway.disk.read.bytes_gateway
+ vcpe0.abstract_vcpe.disk.device.iops_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.iops_vcpe
+ vgw0.abstract_gateway.binding_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.binding_gateway_gateway_private_lan_port
+ vgw0.abstract_gateway.disk.ephemeral.size_gateway:
+ - vGW 0
+ - abstract_gateway.disk.ephemeral.size_gateway
+ vgw0.abstract_gateway.feature_gateway:
+ - vGW 0
+ - abstract_gateway.feature_gateway
+ vcpe0.abstract_vcpe.forwarder_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.forwarder_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.disk.device.allocation_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.allocation_vcpe
+ vgw0.abstract_gateway.disk.read.requests_gateway:
+ - vGW 0
+ - abstract_gateway.disk.read.requests_gateway
+ vcpe0.abstract_vcpe.disk.device.write.requests_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.write.requests_vcpe
+ vgw0.abstract_gateway.disk.device.usage_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.usage_gateway
+ vgw0.abstract_gateway.cpu.delta_gateway:
+ - vGW 0
+ - abstract_gateway.cpu.delta_gateway
+ vgw0.abstract_gateway.network.outgoing.packets.rate_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.network.outgoing.packets.rate_gateway_gateway_private_lan_port
+ vgw0.abstract_gateway.port_mirroring_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.port_mirroring_gateway_gateway_private_lan_port
+ vcpe0.abstract_vcpe.forwarder_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.forwarder_vcpe_vcpe_private_lan_port
+ vcpe0.abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_lan_port
+ vcpe0.abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_lan_port
+ vgw0.abstract_gateway.disk.latency_gateway:
+ - vGW 0
+ - abstract_gateway.disk.latency_gateway
+ vcpe0.abstract_vcpe.disk.read.bytes_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.read.bytes_vcpe
+ vcpe0.abstract_vcpe.attachment_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.attachment_vcpe_vcpe_private_wan_port
+ vgw0.abstract_gateway.cpu_gateway:
+ - vGW 0
+ - abstract_gateway.cpu_gateway
+ vcpe0.abstract_vcpe.instance_vcpe:
+ - vCPE 0
+ - abstract_vcpe.instance_vcpe
+ vcpe0.abstract_vcpe.memory_vcpe:
+ - vCPE 0
+ - abstract_vcpe.memory_vcpe
+ vgw0.abstract_gateway.feature_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.feature_gateway_gateway_private_lan_port
+ vgw0.abstract_gateway.disk.device.write.bytes_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.write.bytes_gateway
+ vcpe0.abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_wan_port
+ vgw0.abstract_gateway.disk.device.read.requests_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.read.requests_gateway
+ vgw0.abstract_gateway.disk.write.requests_gateway:
+ - vGW 0
+ - abstract_gateway.disk.write.requests_gateway
+ vgw0.abstract_gateway.os_gateway:
+ - vGW 0
+ - abstract_gateway.os_gateway
+ vgw0.abstract_gateway.network.outgoing.bytes.rate_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.network.outgoing.bytes.rate_gateway_gateway_private_lan_port
+ vgw0.abstract_gateway.network.outpoing.packets_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.network.outpoing.packets_gateway_gateway_private_lan_port
+ vcpe0.abstract_vcpe.disk.write.bytes.rate_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.write.bytes.rate_vcpe
+ vgw0.abstract_gateway.disk.write.bytes.rate_gateway:
+ - vGW 0
+ - abstract_gateway.disk.write.bytes.rate_gateway
+ vcpe0.abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.cpu_vcpe:
+ - vCPE 0
+ - abstract_vcpe.cpu_vcpe
+ vcpe0.abstract_vcpe.disk.allocation_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.allocation_vcpe
+ vcpe0.abstract_vcpe.disk.device.read.requests.rate_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.read.requests.rate_vcpe
+ vgw0.abstract_gateway.network.incoming.bytes_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.network.incoming.bytes_gateway_gateway_private_lan_port
+ vcpe0.abstract_vcpe.disk.device.read.requests_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.read.requests_vcpe
+ vgw0.abstract_gateway.disk.device.read.bytes.rate_gateway:
+ - vGW 0
+ - abstract_gateway.disk.device.read.bytes.rate_gateway
+ vcpe0.abstract_vcpe.binding_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.binding_vcpe_vcpe_private_lan_port
+ vgw0.abstract_gateway.forwarder_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.forwarder_gateway_gateway_private_lan_port
+ genericneutronnet0.virtual_linkable:
+ - Generic NeutronNet 0
+ - virtual_linkable
+ vcpe0.abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.disk.device.usage_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.device.usage_vcpe
+ genericneutronnet0.feature:
+ - Generic NeutronNet 0
+ - feature
+ vcpe0.abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_lan_port
+ vcpe0.abstract_vcpe.disk.root.size_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.root.size_vcpe
+ vcpe0.abstract_vcpe.vcpus_vcpe:
+ - vCPE 0
+ - abstract_vcpe.vcpus_vcpe
+ vcpe0.abstract_vcpe.endpoint_vcpe:
+ - vCPE 0
+ - abstract_vcpe.endpoint_vcpe
+ vgw0.abstract_gateway.attachment_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.attachment_gateway_gateway_private_lan_port
+ vcpe0.abstract_vcpe.attachment_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.attachment_vcpe_vcpe_private_lan_port
+ vcpe0.abstract_vcpe.memory.usage_vcpe:
+ - vCPE 0
+ - abstract_vcpe.memory.usage_vcpe
+ vcpe0.abstract_vcpe.disk.capacity_vcpe:
+ - vCPE 0
+ - abstract_vcpe.disk.capacity_vcpe
+ vgw0.abstract_gateway.disk.iops_gateway:
+ - vGW 0
+ - abstract_gateway.disk.iops_gateway
+ requirements:
+ vcpe0.abstract_vcpe.dependency_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.dependency_vcpe_vcpe_private_wan_port
+ vcpe0.abstract_vcpe.link_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.link_vcpe_vcpe_private_lan_port
+ vgw0.abstract_gateway.local_storage_gateway:
+ - vGW 0
+ - abstract_gateway.local_storage_gateway
+ genericneutronnet0.dependency:
+ - Generic NeutronNet 0
+ - dependency
+ vcpe0.abstract_vcpe.local_storage_vcpe:
+ - vCPE 0
+ - abstract_vcpe.local_storage_vcpe
+ vcpe0.abstract_vcpe.dependency_vcpe_vcpe_private_lan_port:
+ - vCPE 0
+ - abstract_vcpe.dependency_vcpe_vcpe_private_lan_port
+ vgw0.abstract_gateway.dependency_gateway:
+ - vGW 0
+ - abstract_gateway.dependency_gateway
+ vcpe0.abstract_vcpe.dependency_vcpe:
+ - vCPE 0
+ - abstract_vcpe.dependency_vcpe
+ vgw0.abstract_gateway.dependency_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.dependency_gateway_gateway_private_lan_port
+ vcpe0.abstract_vcpe.link_vcpe_vcpe_private_wan_port:
+ - vCPE 0
+ - abstract_vcpe.link_vcpe_vcpe_private_wan_port
+ vgw0.abstract_gateway.link_gateway_gateway_private_lan_port:
+ - vGW 0
+ - abstract_gateway.link_gateway_gateway_private_lan_port
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env
new file mode 100644
index 0000000000..f0cc985078
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env
@@ -0,0 +1,10 @@
+parameters:
+ private_net_id: "1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d"
+ private_subnet_lan_id: "265e1457-8eb7-4fe8-a580-fb547656aad1"
+ private_subnet_wan_id: "86048e4e-861e-47c9-ae55-a5531b747e36"
+ vcpe_flavor_name: "vCPE_flavor"
+ vcpe_image_name: "vCPE_images"
+ vcpe_name: "ar1000v"
+ vcpe_private_ip_lan: "192.168.10.250"
+ vf_module_id: "vCPEAR1000V"
+ vnf_id: "vCPE_huaweicloud"
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml
new file mode 100644
index 0000000000..b4d0fa7a6b
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml
@@ -0,0 +1,103 @@
+##########################################################################
+#
+#==================LICENSE_START==========================================
+#
+#
+# Copyright 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============================================
+
+heat_template_version: 2013-05-23
+
+description: Heat template to deploy Huawei AR1000V vCPE
+
+##############
+# #
+# PARAMETERS #
+# #
+##############
+
+parameters:
+ vcpe_name:
+ type: string
+ label: name
+ description: name to be used for compute instance
+ vcpe_image_name:
+ type: string
+ label: Image name or ID
+ description: Image to be used for compute instance
+ vcpe_flavor_name:
+ type: string
+ label: Flavor
+ description: Type of instance (flavor) to be used
+ private_net_id:
+ type: string
+ label: Private oam network name or ID
+ description: Private network that enables remote connection to VNF
+ private_subnet_wan_id:
+ type: string
+ label: Private wan sub-network name or ID
+ description: Private wan sub-network that enables remote connection to VNF
+ private_subnet_lan_id:
+ type: string
+ label: Private lan sub-network name or ID
+ description: Private lan sub-network that enables remote connection to VNF
+ vcpe_private_ip_lan:
+ type: string
+ label: vCPE lan private IP address
+ description: Private IP address that is assigned to the vCPE lan port
+ vnf_id:
+ type: string
+ label: VNF ID
+ description: The VNF ID is provided by ECOMP
+ vf_module_id:
+ type: string
+ label: VF module id
+ description: the vf module id is provided by ECOMP
+#############
+# #
+# RESOURCES #
+# #
+#############
+
+resources:
+# For the floating IP in Public cloud , floating_network_id is not needed
+ vCPE_oam_floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network_id: { get_param: private_net_id}
+ port_id: { get_resource: vcpe_private_wan_port}
+
+ vcpe_private_wan_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: private_net_id }
+ fixed_ips: [{"subnet": { get_param: private_subnet_wan_id }}]
+
+ vcpe_private_lan_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: private_net_id }
+ fixed_ips: [{"subnet": { get_param: private_subnet_lan_id }, "ip_address": { get_param: vcpe_private_ip_lan }}]
+
+ ar_1000v:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: vcpe_image_name }
+ flavor: { get_param: vcpe_flavor_name }
+ name: { get_param: vcpe_name }
+ networks:
+ - port: { get_resource: vcpe_private_wan_port }
+ - port: { get_resource: vcpe_private_lan_port }
+ metadata: { vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json
new file mode 100644
index 0000000000..3376b1bf40
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json
@@ -0,0 +1,25 @@
+[
+ {
+ "vfModuleModelName": "Vcpe..ar1000v..module-0",
+ "vfModuleModelInvariantUUID": "d7719964-c045-4ed3-84d6-20a01db7612f",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelUUID": "c84ade8a-6e4b-49c7-86e8-0e4fc009f4cd",
+ "vfModuleModelCustomizationUUID": "8caeefbd-ab71-40c9-9387-8729d7d9c2de",
+ "isBase": true,
+ "artifacts": [
+ "12dcc618-20f2-4f15-ab00-c549b96b3910",
+ "5821b043-ba50-49ef-b739-61b0896050f2"
+ ],
+ "properties": {
+ "min_vf_module_instances": "1",
+ "vf_module_label": "ar1000v",
+ "max_vf_module_instances": "1",
+ "vfc_list": "",
+ "vf_module_description": "",
+ "vf_module_type": "Base",
+ "availability_zone_count": "",
+ "volume_group": "false",
+ "initial_count": "1"
+ }
+ }
+] \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml
new file mode 100644
index 0000000000..a10a5b2bb1
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml
@@ -0,0 +1 @@
+<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><version>1.0</version><name>test</name><description/><increments/><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>test</name><description/><type>One_Time</type><increments/><manufacturerReferenceNumber>123</manufacturerReferenceNumber><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list></vendor-license-model> \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml
new file mode 100644
index 0000000000..ed1575b7f5
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml
@@ -0,0 +1 @@
+<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><vf-id>c1aad4e55922438f956ff97b91c5446d</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>test</name><description/><increments/><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>test</name><description/><type>One_Time</type><increments/><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><manufacturer-reference-number>123</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list><name>testgroup</name><feature-group-uuid>ae361d4e44ca48e68f734abb531e19af</feature-group-uuid><description/><part-number>123</part-number></feature-group></feature-group-list></vf-license-model> \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env
new file mode 100644
index 0000000000..a995d16b31
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env
@@ -0,0 +1,9 @@
+parameters:
+ gateway_flavor_name: "s3.large.4"
+ gateway_image_name: "gateway_image"
+ gateway_name: "gateway-vm"
+ gateway_private_ip_lan: "192.168.10.200"
+ private_net_id: "1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d"
+ private_subnet_lan_id: "265e1457-8eb7-4fe8-a580-fb547656aad1"
+ vf_module_id: "CCVPNvGW"
+ vnf_id: "vGW_huaweicloud"
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml
new file mode 100644
index 0000000000..2d72a1c183
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml
@@ -0,0 +1,109 @@
+##########################################################################
+#
+#==================LICENSE_START==========================================
+#
+#
+# Copyright 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============================================
+
+heat_template_version: 2013-05-23
+
+description: Heat template to deploy CCVPN gateway instance
+
+##############
+# #
+# PARAMETERS #
+# #
+##############
+
+parameters:
+ gateway_name:
+ type: string
+ label: name
+ description: name to be used for compute instance
+ gateway_image_name:
+ type: string
+ label: Image name or ID
+ description: Image to be used for compute instance
+ gateway_flavor_name:
+ type: string
+ label: Flavor
+ description: Type of instance (flavor) to be used
+ private_net_id:
+ type: string
+ label: Private oam network name or ID
+ description: Private network that enables remote connection to VNF
+# private_subnet_wan_id:
+# type: string
+# label: Private wan sub-network name or ID
+# description: Private wan sub-network that enables remote connection to VNF
+ private_subnet_lan_id:
+ type: string
+ label: Private lan sub-network name or ID
+ description: Private lan sub-network that enables remote connection to VNF
+ gateway_private_ip_lan:
+ type: string
+ label: gateway lan private IP address
+ description: Private IP address that is assigned to the gateway lan port
+ vnf_id:
+ type: string
+ label: VNF ID
+ description: The VNF ID is provided by ECOMP
+ vf_module_id:
+ type: string
+ label: VF module id
+ description: the vf module id is provided by ECOMP
+#############
+# #
+# RESOURCES #
+# #
+#############
+
+resources:
+# For the floating IP in Public cloud , floating_network_id is not needed
+ gateway_oam_floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network_id: { get_param: private_net_id}
+ port_id: { get_resource: gateway_private_lan_port}
+
+ #gateway_private_wan_port:
+ # type: OS::Neutron::Port
+ # properties:
+ # network: { get_param: private_net_id }
+ # fixed_ips: [{"subnet": { get_param: private_subnet_wan_id }}]
+
+ gateway_private_lan_port:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: private_net_id }
+ fixed_ips: [{"subnet": { get_param: private_subnet_lan_id }, "ip_address": { get_param: gateway_private_ip_lan }}]
+
+ gateway_instacne:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: gateway_image_name }
+ flavor: { get_param: gateway_flavor_name }
+ name: { get_param: gateway_name }
+ networks:
+ #- port: { get_resource: gateway_private_wan_port }
+ - port: { get_resource: gateway_private_lan_port }
+ metadata: { vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
+ user_data: |
+ #!/bin/bash
+ docker start msb_consul
+ docker start msb_discovery
+ docker start msb_internal_apigateway
+ #user_data_format: HEAT_CFNTOOLS/RAW \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml
new file mode 100644
index 0000000000..a10a5b2bb1
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml
@@ -0,0 +1 @@
+<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><version>1.0</version><name>test</name><description/><increments/><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>test</name><description/><type>One_Time</type><increments/><manufacturerReferenceNumber>123</manufacturerReferenceNumber><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list></vendor-license-model> \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml
new file mode 100644
index 0000000000..a4a84cc4c0
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml
@@ -0,0 +1 @@
+<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><vf-id>8c1c2b40525942aca038a4528ce3bb4e</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>test</name><description/><increments/><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>test</name><description/><type>One_Time</type><increments/><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><manufacturer-reference-number>123</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list><name>testgroup</name><feature-group-uuid>ae361d4e44ca48e68f734abb531e19af</feature-group-uuid><description/><part-number>123</part-number></feature-group></feature-group-list></vf-license-model> \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json
new file mode 100644
index 0000000000..1a1badec5e
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json
@@ -0,0 +1,25 @@
+[
+ {
+ "vfModuleModelName": "Vgw..gateway..module-0",
+ "vfModuleModelInvariantUUID": "8c8c936c-e71c-4bc4-94f7-c5680c9dbc00",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelUUID": "ddda7e87-8113-463f-aa27-a60112a4e438",
+ "vfModuleModelCustomizationUUID": "ea551d60-f9c9-48f2-9757-b01eb2d26d13",
+ "isBase": true,
+ "artifacts": [
+ "60d55796-212c-4c66-8af5-63964d636ae4",
+ "9df0452f-826c-4287-9a2d-ca0095339866"
+ ],
+ "properties": {
+ "min_vf_module_instances": "1",
+ "vf_module_label": "gateway",
+ "max_vf_module_instances": "1",
+ "vfc_list": "",
+ "vf_module_description": "",
+ "vf_module_type": "Base",
+ "availability_zone_count": "",
+ "volume_group": "false",
+ "initial_count": "1"
+ }
+ }
+] \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 652fc8f0de..f2c04802a5 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -1113,6 +1113,7 @@ CREATE TABLE `vnf_resource_customization` (
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
`VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
@@ -1446,7 +1447,7 @@ CREATE TABLE `infra_active_requests` (
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
`AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
@@ -1499,7 +1500,7 @@ CREATE TABLE `archived_infra_requests` (
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
`AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
index 64567a349e..5525c2642b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -40,11 +40,11 @@ class ExternalAPIUtil {
String Prefix="EXTAPI_"
- private static final Logger logger = LoggerFactory.getLogger( ExternalAPIUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger( ExternalAPIUtil.class)
- private final HttpClientFactory httpClientFactory;
- private final MsoUtils utils;
- private final ExceptionUtil exceptionUtil;
+ private final HttpClientFactory httpClientFactory
+ private final MsoUtils utils
+ private final ExceptionUtil exceptionUtil
public static final String PostServiceOrderRequestsTemplate =
"{\n" +
@@ -107,22 +107,22 @@ class ExternalAPIUtil {
// }
public String setTemplate(String template, Map<String, String> valueMap) {
- logger.debug("ExternalAPIUtil setTemplate", true);
- StringBuffer result = new StringBuffer();
+ logger.debug("ExternalAPIUtil setTemplate", true)
+ StringBuffer result = new StringBuffer()
- String pattern = "<.*>";
- Pattern r = Pattern.compile(pattern);
- Matcher m = r.matcher(template);
+ String pattern = "<.*>"
+ Pattern r = Pattern.compile(pattern)
+ Matcher m = r.matcher(template)
- logger.debug("ExternalAPIUtil template:" + template, true);
+ logger.debug("ExternalAPIUtil template:" + template, true)
while (m.find()) {
- String key = template.substring(m.start() + 1, m.end() - 1);
- logger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true);
- m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\""));
+ String key = template.substring(m.start() + 1, m.end() - 1)
+ logger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true)
+ m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\""))
}
- m.appendTail(result);
- logger.debug("ExternalAPIUtil return:" + result.toString(), true);
- return result.toString();
+ m.appendTail(result)
+ logger.debug("ExternalAPIUtil return:" + result.toString(), true)
+ return result.toString()
}
/**
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy
index e7f46464ee..549267eec1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Nokia.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
index f013fa8698..db39358ccd 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -22,9 +22,9 @@
package org.onap.so.bpmn.common.scripts
-import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.ErrorCode
import java.text.SimpleDateFormat
@@ -39,7 +39,7 @@ import static org.apache.commons.lang3.StringUtils.*
// SDNC Adapter Request/Response processing
public class SDNCAdapter extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( SDNCAdapter.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapter.class)
def Prefix="SDNCA_"
@@ -77,7 +77,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
} catch (IOException ex) {
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Unable to encode username password string", "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
}
// TODO Use variables instead of passing xml request - Huh?
@@ -238,9 +238,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest")
logger.debug("sdncAdapterCallbackRequest :" + sdnccallbackreq)
if (sdnccallbackreq==null){
- execution.setVariable("callbackResponseReceived",false);
+ execution.setVariable("callbackResponseReceived",false)
}else{
- execution.setVariable("callbackResponseReceived",true);
+ execution.setVariable("callbackResponseReceived",true)
}
}
@@ -303,10 +303,10 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
}
public String generateCurrentTimeInUtc(){
- final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
- final String utcTime = sdf.format(new Date());
- return utcTime;
+ final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"))
+ final String utcTime = sdf.format(new Date())
+ return utcTime
}
public void toggleSuccessIndicator(DelegateExecution execution){
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index 449f4e3222..c30d807bf3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -53,7 +53,7 @@ import org.onap.so.utils.TargetEntity
class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV1.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -88,7 +88,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -109,7 +109,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -124,7 +124,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -141,7 +141,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -157,7 +157,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
@@ -166,7 +166,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", ErrorCode.UnknownError.getValue(), ex);
+ "BPMN", ErrorCode.UnknownError.getValue(), ex)
}
}
@@ -176,7 +176,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout")
// in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
- String timerRegex = "PT[0-9]+[HMS]";
+ String timerRegex = "PT[0-9]+[HMS]"
if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
@@ -197,7 +197,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -221,7 +221,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest')
logger.debug("SDNC Rest Request is: " + sdncAdapterRequest)
- URL url = new URL(sdncAdapterUrl);
+ URL url = new URL(sdncAdapterUrl)
HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER)
httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
@@ -245,7 +245,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -259,7 +259,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg, e)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -330,7 +330,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
}
// Note: the mapping function handles a null or empty responseCode
- int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode));
+ int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode))
exceptionUtil.buildWorkflowException(execution, mappedResponseCode, "Received " + responseType +
" from SDNCAdapter:" + info)
} catch (Exception e) {
@@ -370,7 +370,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -396,12 +396,12 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
public Logger getLogger() {
- return logger;
+ return logger
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
index 62c7bb5adf..ba5145d19b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory
* any non-final response received from SDNC.
*/
class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
- private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV2.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV2.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -87,7 +87,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -108,7 +108,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -123,7 +123,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -134,7 +134,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -153,7 +153,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
@@ -162,7 +162,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", ErrorCode.UnknownError.getValue(), ex);
+ "BPMN", ErrorCode.UnknownError.getValue(), ex)
}
}
@@ -172,7 +172,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout")
// in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
- String timerRegex = "PT[0-9]+[HMS]";
+ String timerRegex = "PT[0-9]+[HMS]"
if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
@@ -193,7 +193,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -297,6 +297,6 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
}
public Logger getLogger() {
- return logger;
+ return logger
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java
index 68cda5c22b..69151ff74f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java
@@ -27,9 +27,9 @@ import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.listener.ListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.listener.ListenerRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
index 5f4dc871fb..ea7de687ee 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
@@ -27,8 +27,8 @@ import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.listener.ListenerRunner;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.listener.ListenerRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java
index 040522b576..02cddf3655 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java
@@ -28,9 +28,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
-import org.onap.so.bpmn.common.listener.ListenerRunner;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.listener.ListenerRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -47,6 +49,9 @@ public abstract class FlowValidatorRunner<S extends FlowValidator, E extends Flo
private static Logger logger = LoggerFactory.getLogger(FlowValidatorRunner.class);
+ @Autowired
+ protected ExceptionBuilder exceptionBuilder;
+
protected List<S> preFlowValidators;
protected List<E> postFlowValidators;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
index b1173bbf95..3a4df68f02 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
@@ -68,7 +68,7 @@ public class InstanceResourceList {
public static List<Resource> getInstanceResourceList(final VnfResource vnfResource, final String uuiRequest) {
- List<Resource> sequencedResourceList = new ArrayList<Resource>();
+ List<Resource> sequencedResourceList = new ArrayList<>();
Gson gson = new Gson();
JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class);
JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters")
@@ -108,11 +108,16 @@ public class InstanceResourceList {
sequencedResourceList.add(vnfResource);
}
+ // check if the resource contains vf-module
+ if (vnfResource != null && vnfResource.getVfModules() != null) {
+ sequencedResourceList.addAll(vnfResource.getVfModules());
+ }
+
return sequencedResourceList;
}
private static List<Resource> getGroupResourceInstanceList(VnfResource vnfResource, JsonObject vfObj) {
- List<Resource> sequencedResourceList = new ArrayList<Resource>();
+ List<Resource> sequencedResourceList = new ArrayList<>();
if (vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder())) {
String[] grpSequence = vnfResource.getGroupOrder().split(",");
for (String grpType : grpSequence) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 8d02fa3e4f..2c1d36273d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -118,7 +118,7 @@ public class ResourceRequestBuilder {
logger.info("resource resolved using model uuid");
String uuid = (String) JsonUtils.getJsonValue(eachResource, "resourceUuid");
if ((null != uuid) && uuid.equals(resource.getModelInfo().getModelUuid())) {
- logger.info("found resource uuid" + uuid);
+ logger.info("found resource uuid {}", uuid);
String resourceParameters = JsonUtils.getJsonValue(eachResource, "parameters");
locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints");
}
@@ -133,7 +133,7 @@ public class ResourceRequestBuilder {
Map<String, Object> uuiRequestInputs = null;
if (JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs") != null) {
String uuiRequestInputStr = JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs");
- logger.info("resource input from UUI: " + uuiRequestInputStr);
+ logger.info("resource input from UUI:{} ", uuiRequestInputStr);
if (uuiRequestInputStr == null || uuiRequestInputStr.isEmpty()) {
uuiRequestInputStr = "{}";
}
@@ -371,7 +371,7 @@ public class ResourceRequestBuilder {
int val = Integer.parseInt(inputObj.toString());
return val;
} catch (NumberFormatException e) {
- logger.warn("Unable to parse to int", e.getMessage());
+ logger.warn("Unable to parse to int", e);
}
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
deleted file mode 100644
index dc2b3be073..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
+++ /dev/null
@@ -1,71 +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.bpmn.common.util;
-
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.util.Properties;
-import org.onap.so.utils.CryptoUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CryptoHandler implements ICryptoHandler {
- private static final Logger logger = LoggerFactory.getLogger(CryptoHandler.class);
- private static final String GENERAL_SECURITY_EXCEPTION_PREFIX = "GeneralSecurityException :";
- private static final String MSO_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
- private static final String PROPERTY_KEY = "mso.AaiEncrypted.Pwd";
-
- @Override
- public String getMsoAaiPassword() {
- Properties keyProp = new Properties();
- try {
- keyProp.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("urn.properties"));
- return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY);
- } catch (GeneralSecurityException | IOException e) {
- logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
- return null;
- }
- }
-
-
- @Override
- public String encryptMsoPassword(String plainMsoPwd) {
- try {
- return CryptoUtils.encrypt(plainMsoPwd, MSO_KEY);
- } catch (GeneralSecurityException e) {
- logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
- return null;
- }
- }
-
- @Override
- public String decryptMsoPassword(String encryptedPwd) {
- try {
- return CryptoUtils.decrypt(encryptedPwd, MSO_KEY);
- } catch (GeneralSecurityException e) {
- logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
- return null;
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java
index f56fad3bcf..84b162e1a2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java
@@ -31,7 +31,7 @@ public class Metadata implements Serializable {
private static final long serialVersionUID = 4981393122007858950L;
@JsonProperty("metadatum")
- private List<Metadatum> metadatum = new ArrayList<Metadatum>();
+ private List<Metadatum> metadatum = new ArrayList<>();
public List<Metadatum> getMetadatum() {
return metadatum;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java
index a5eb9d86a7..96a6ab7bd2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java
@@ -36,8 +36,6 @@ public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute>
@Id
@JsonProperty("route-id")
private String routeId;
- @JsonProperty("route-name")
- private String routeName;
@JsonProperty("network-start-address")
private String networkStartAddress;
@JsonProperty("cidr-mask")
@@ -54,14 +52,6 @@ public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute>
this.routeId = routeId;
}
- public String getRouteName() {
- return routeName;
- }
-
- public void setRouteName(String routeName) {
- this.routeName = routeName;
- }
-
public String getNetworkStartAddress() {
return networkStartAddress;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
index 841546b3b1..ebf722ef74 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
@@ -133,7 +133,7 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
@JsonProperty("model-info-generic-vnf")
private ModelInfoGenericVnf modelInfoGenericVnf;
@JsonProperty("instance-groups")
- private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>();
+ private List<InstanceGroup> instanceGroups = new ArrayList<>();
@JsonProperty("call-homing")
private Boolean callHoming;
@JsonProperty("nf-function")
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java
index 387d191409..db2785902a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java
@@ -65,15 +65,15 @@ public class LInterface implements Serializable, ShallowCopy<LInterface> {
@JsonProperty("allowed-address-pairs")
private String allowedAddressPairs;
@JsonProperty("vlans")
- private List<Vlan> vlans = new ArrayList<Vlan>();
+ private List<Vlan> vlans = new ArrayList<>();
@JsonProperty("sriov-vfs")
- private List<SriovVf> sriovVfs = new ArrayList<SriovVf>();
+ private List<SriovVf> sriovVfs = new ArrayList<>();
@JsonProperty("l-interfaces")
- private List<LInterface> lInterfaces = new ArrayList<LInterface>();
+ private List<LInterface> lInterfaces = new ArrayList<>();
@JsonProperty("l3-interface-ipv4-address-list")
- private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>();
+ private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<>();
@JsonProperty("l3-interface-ipv6-address-list")
- private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>();
+ private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<>();
public String getInterfaceName() {
return interfaceName;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java
index d0bf1f588b..f3e28faf44 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java
@@ -41,9 +41,9 @@ public class PServer implements Serializable, ShallowCopy<PServer> {
@JsonProperty("hostname")
private String hostname;
@JsonProperty("physical-links")
- private List<PhysicalLink> physicalLinks = new ArrayList<PhysicalLink>(); // TODO techincally there is a pInterface
- // between (pserver <--> physical-link)
- // but dont really need that pojo
+ private List<PhysicalLink> physicalLinks = new ArrayList<>(); // TODO techincally there is a pInterface
+ // between (pserver <--> physical-link)
+ // but dont really need that pojo
public String getPserverId() {
return pserverId;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
index 0803bed574..6cc8aa368c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
@@ -79,7 +79,7 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
@JsonProperty("instance-groups")
private List<InstanceGroup> instanceGroups = new ArrayList<>();
@JsonProperty("service-proxies")
- private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>();
+ private List<ServiceProxy> serviceProxies = new ArrayList<>();
public void setServiceProxies(List<ServiceProxy> serviceProxies) {
this.serviceProxies = serviceProxies;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java
index 05199b7f37..b677b1efd0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java
@@ -41,7 +41,7 @@ public class ServiceSubscription implements Serializable, ShallowCopy<ServiceSub
@JsonProperty("temp-ub-sub-account-id")
private String tempUbSubAccountId;
@JsonProperty("service-instances")
- private List<ServiceInstance> serviceInstances = new ArrayList<ServiceInstance>();
+ private List<ServiceInstance> serviceInstances = new ArrayList<>();
public String getServiceType() {
return serviceType;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java
index 6951a23630..8c0db18d80 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java
@@ -62,9 +62,9 @@ public class Vlan implements Serializable, ShallowCopy<Vlan> {
@JsonProperty("is-ip-unnumbered")
private Boolean isIpUnnumbered;
@JsonProperty("l3-interface-ipv4-address-list")
- private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>();
+ private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<>();
@JsonProperty("l3-interface-ipv6-address-list")
- private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>();
+ private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<>();
public String getVlanInterface() {
return vlanInterface;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java
index 4ee8213e59..4e5b3557d8 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java
@@ -41,10 +41,10 @@ public class VpnBondingLink implements Serializable, ShallowCopy<VpnBondingLink>
private String vpnBondingLinkId;
@JsonProperty("configurations")
- private List<Configuration> configurations = new ArrayList<Configuration>();
+ private List<Configuration> configurations = new ArrayList<>();
@JsonProperty("service-proxies")
- private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>();
+ private List<ServiceProxy> serviceProxies = new ArrayList<>();
public String getVpnBondingLinkId() {
return vpnBondingLinkId;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java
index c9f7e5e948..93d85daad1 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java
@@ -34,9 +34,9 @@ public class License implements Serializable {
private static final long serialVersionUID = 2345786874755685318L;
@JsonProperty("entitlement-pool-uuids")
- private List<String> entitlementPoolUuids = new ArrayList<String>();
+ private List<String> entitlementPoolUuids = new ArrayList<>();
@JsonProperty("license-key-group-uuids")
- private List<String> licenseKeyGroupUuids = new ArrayList<String>();
+ private List<String> licenseKeyGroupUuids = new ArrayList<>();
public List<String> getEntitlementPoolUuids() {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 9a39334af1..3cf5a60de7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -389,8 +389,11 @@ public class BBInputSetup implements JavaDelegate {
String instanceName, ConfigurationResourceKeys configurationResourceKeys, RequestDetails requestDetails) {
Configuration configuration = null;
for (Configuration configurationTemp : serviceInstance.getConfigurations()) {
- if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId()
- .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
+ if ((bbName.contains("Fabric") && configurationTemp.getConfigurationSubType() != null
+ && configurationTemp.getConfigurationSubType().equalsIgnoreCase("Fabric Config"))
+ || (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId()
+ .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID)))) {
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configurationTemp.getConfigurationId());
configuration = configurationTemp;
org.onap.aai.domain.yang.Configuration aaiConfiguration =
bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
@@ -1388,8 +1391,10 @@ public class BBInputSetup implements JavaDelegate {
vnfs.getInstanceParams(), productFamilyId);
} else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) {
Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources);
- vfModules = vnfsAndVfModules.getValue1();
- vnfs = vnfsAndVfModules.getValue0();
+ if (vnfsAndVfModules != null) {
+ vfModules = vnfsAndVfModules.getValue1();
+ vnfs = vnfsAndVfModules.getValue0();
+ }
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap));
if (vnfs == null) {
throw new Exception("Could not find Vnf to orchestrate VfModule");
@@ -1410,8 +1415,10 @@ public class BBInputSetup implements JavaDelegate {
} else if (bbName.contains(NETWORK)) {
networks = findNetworksByKey(key, resources);
String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
- this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName,
- serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams());
+ if (networks != null) {
+ this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName,
+ serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams());
+ }
} else if (bbName.contains("Configuration")) {
String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
ModelInfo configurationModelInfo = new ModelInfo();
@@ -1608,8 +1615,10 @@ public class BBInputSetup implements JavaDelegate {
protected void mapCatalogNetworkCollectionInstanceGroup(Service service, InstanceGroup instanceGroup, String key) {
CollectionResourceCustomization collectionCust = this.findCatalogNetworkCollection(service, key);
- org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup =
- collectionCust.getCollectionResource().getInstanceGroup();
+ org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = null;
+ if (collectionCust != null) {
+ catalogInstanceGroup = collectionCust.getCollectionResource().getInstanceGroup();
+ }
instanceGroup.setModelInfoInstanceGroup(
mapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup));
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 41cd87e874..ea48c78dc0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Optional;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.AggregateRoute;
import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
@@ -131,6 +132,10 @@ public class BBInputSetupMapperLayer {
return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class);
}
+ protected AggregateRoute mapAAIAggregateRoute(org.onap.aai.domain.yang.AggregateRoute aaiAggregateRoute) {
+ return modelMapper.map(aaiAggregateRoute, AggregateRoute.class);
+ }
+
protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) {
return modelMapper.map(aaiCtagAssignment, CtagAssignment.class);
}
@@ -262,10 +267,21 @@ public class BBInputSetupMapperLayer {
mapAllSubnetsIntoL3Network(aaiL3Network, network);
mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network);
mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network);
+ mapAllAggregateRoutesIntoL3Network(aaiL3Network, network);
network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus()));
return network;
}
+ protected void mapAllAggregateRoutesIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
+ L3Network network) {
+ if (aaiL3Network.getAggregateRoutes() != null) {
+ for (org.onap.aai.domain.yang.AggregateRoute aaiAggregateRoute : aaiL3Network.getAggregateRoutes()
+ .getAggregateRoute()) {
+ network.getAggregateRoutes().add(mapAAIAggregateRoute(aaiAggregateRoute));
+ }
+ }
+ }
+
protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
L3Network network) {
if (aaiL3Network.getSegmentationAssignments() != null) {
@@ -581,6 +597,9 @@ public class BBInputSetupMapperLayer {
protected ModelInfoServiceProxy mapServiceProxyCustomizationToServiceProxy(
ServiceProxyResourceCustomization serviceProxyCustomization) {
- return modelMapper.map(serviceProxyCustomization.getSourceService(), ModelInfoServiceProxy.class);
+ ModelInfoServiceProxy modelInfoServiceProxy =
+ modelMapper.map(serviceProxyCustomization.getSourceService(), ModelInfoServiceProxy.class);
+ modelInfoServiceProxy.setModelInstanceName(serviceProxyCustomization.getModelInstanceName());
+ return modelInfoServiceProxy;
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index fd2054c3d0..be53e505ac 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -104,6 +104,7 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default serviceType value
+ logger.error("Exception in serviceType retrivel", ex);
}
String vnfType = ASTERISK;
try {
@@ -115,6 +116,7 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default vnfType value
+ logger.error("Exception in vnfType retrivel", ex);
}
String errorCode = ASTERISK;
@@ -122,12 +124,14 @@ public class ExecuteBuildingBlockRainyDay {
errorCode = "" + workflowException.getErrorCode();
} catch (Exception ex) {
// keep default errorCode value
+ logger.error("Exception in errorCode retrivel", ex);
}
try {
errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
} catch (Exception ex) {
// keep default errorCode value
+ logger.error("Exception in errorCode retrivel", ex);
}
String workStep = ASTERISK;
@@ -135,6 +139,7 @@ public class ExecuteBuildingBlockRainyDay {
workStep = workflowException.getWorkStep();
} catch (Exception ex) {
// keep default workStep value
+ logger.error("Exception in workStep retrivel", ex);
}
String errorMessage = ASTERISK;
@@ -142,11 +147,23 @@ public class ExecuteBuildingBlockRainyDay {
errorMessage = workflowException.getErrorMessage();
} catch (Exception ex) {
// keep default workStep value
+ logger.error("Exception in errorMessage retrivel", ex);
+ }
+
+ String serviceRole = ASTERISK;
+ try {
+ serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
+ .getModelInfoServiceInstance().getServiceRole();
+ if (serviceRole == null || serviceRole.isEmpty()) {
+ serviceRole = ASTERISK;
+ }
+ } catch (Exception ex) {
+ // keep default serviceRole value
}
RainyDayHandlerStatus rainyDayHandlerStatus;
rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatus(bbName, serviceType, vnfType,
- errorCode, workStep, errorMessage);
+ errorCode, workStep, errorMessage, serviceRole);
if (rainyDayHandlerStatus == null) {
handlingCode = "Abort";
@@ -166,14 +183,14 @@ public class ExecuteBuildingBlockRainyDay {
logger.error("Failed to update Request Db Infra Active Requests with Retry Status", ex);
}
}
- if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) {
+ if ("RollbackToAssigned".equals(handlingCode) && !aLaCarte) {
handlingCode = "Rollback";
}
if (handlingCode.startsWith("Rollback")) {
String targetState = "";
- if (handlingCode.equalsIgnoreCase("RollbackToAssigned")) {
+ if ("RollbackToAssigned".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_ASSIGNED.toString();
- } else if (handlingCode.equalsIgnoreCase("RollbackToCreated")) {
+ } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_CREATED.toString();
} else {
targetState = Status.ROLLED_BACK.toString();
@@ -193,7 +210,7 @@ public class ExecuteBuildingBlockRainyDay {
int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
execution.setVariable("maxRetries", envMaxRetries);
} catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries", ex);
execution.setVariable("maxRetries", 5);
}
}
@@ -236,8 +253,7 @@ public class ExecuteBuildingBlockRainyDay {
request.setLastModifiedBy("CamundaBPMN");
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception e) {
- logger.error("Failed to update Request db with extSystemErrorSource or rollbackExtSystemErrorSource: "
- + e.getMessage());
+ logger.error("Failed to update Request db with extSystemErrorSource or rollbackExtSystemErrorSource: ", e);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
index b2dbd97bfc..aa71ee540f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 2019 Nokia
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,26 +45,15 @@ public class ExtractPojosForBB {
private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class);
public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key) throws BBObjectNotFoundException {
- return extractByKey(execution, key, execution.getLookupMap().get(key));
- }
-
- protected <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value)
- throws BBObjectNotFoundException {
-
Optional<T> result = Optional.empty();
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ String value = execution.getLookupMap().get(key);
try {
ServiceInstance serviceInstance;
GenericVnf vnf;
switch (key) {
case SERVICE_INSTANCE_ID:
- if (gBBInput.getCustomer().getServiceSubscription() == null
- && gBBInput.getServiceInstance() != null) {
- result = Optional.of((T) gBBInput.getServiceInstance());
- } else if (gBBInput.getCustomer().getServiceSubscription() != null) {
- result = lookupObjectInList(
- gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value);
- }
+ result = getServiceInstance(gBBInput, value);
break;
case GENERIC_VNF_ID:
serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
@@ -90,7 +80,6 @@ public class ExtractPojosForBB {
result = lookupObjectInList(serviceInstance.getConfigurations(), value);
break;
case VPN_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value);
break;
case VPN_BONDING_LINK_ID:
@@ -101,31 +90,27 @@ public class ExtractPojosForBB {
serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getInstanceGroups(), value);
break;
- default:
- throw new BBObjectNotFoundException(key, value);
}
- } catch (BBObjectNotFoundException e) { // re-throw parent object not found
- throw e;
} catch (Exception e) { // convert all other exceptions to object not found
- logger.warn("BBObjectNotFoundException in ExtractPojosForBB",
- "BBObject " + key + " was not found in " + "gBBInput using reference value: " + value);
- throw new BBObjectNotFoundException(key, value);
- }
-
- if (result.isPresent()) {
- return result.get();
- } else {
+ logger.warn(
+ "BBObjectNotFoundException in ExtractPojosForBB, BBObject {} was not found in gBBInput using reference value: {} {}",
+ key, value, e);
throw new BBObjectNotFoundException(key, value);
}
+ return result.orElseThrow(() -> new BBObjectNotFoundException(key, value));
}
- protected <T> Optional<T> lookupObject(Object obj, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
- return findValue(obj, value);
+ private <T> Optional<T> getServiceInstance(GeneralBuildingBlock gBBInput, String value) throws Exception {
+ if (gBBInput.getCustomer().getServiceSubscription() == null && gBBInput.getServiceInstance() != null) {
+ return Optional.of((T) gBBInput.getServiceInstance());
+ } else if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ return lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value);
+ }
+ return Optional.empty();
}
- protected <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ private <T> Optional<T> lookupObjectInList(List<?> list, String value)
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
Optional<T> result = Optional.empty();
for (Object obj : list) {
result = findValue(obj, value);
@@ -134,11 +119,10 @@ public class ExtractPojosForBB {
}
}
return result;
-
}
- protected <T> Optional<T> findValue(Object obj, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ private <T> Optional<T> findValue(Object obj, String value)
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
for (Field field : obj.getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(Id.class)) {
String fieldName = field.getName();
@@ -149,7 +133,6 @@ public class ExtractPojosForBB {
}
}
}
-
return Optional.empty();
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
index 9828d11186..c05557a317 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
@@ -78,8 +78,24 @@ public class ApplicationControllerAction {
appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType);
break;
case Snapshot:
+ if (vmIdList.isEmpty()) {
+ logger.warn("vmIdList is Empty in AppCClient");
+ break;
+ }
String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds");
+ if (vmIds == null) {
+ logger.warn("vmIds null in AppCClient");
+ break;
+ }
+ if (vserverIdList.isEmpty()) {
+ logger.warn("vserverIdList is empty in AppCClient");
+ break;
+ }
String vserverIds = JsonUtils.getJsonValue(vserverIdList, "vserverIds");
+ if (vserverIds == null) {
+ logger.warn("vserverIds null in AppCClient");
+ break;
+ }
String vmId = "";
String vserverId = "";
ObjectMapper mapper = new ObjectMapper();
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
index b2e6ead36b..ad94421e5a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
@@ -48,7 +48,7 @@ public class ConfigAssignPropertiesForPnf {
private String pnfCustomizationUuid;
@JsonIgnore
- private Map<String, Object> userParam = new HashMap<String, Object>();
+ private Map<String, Object> userParam = new HashMap<>();
public String getServiceInstanceId() {
return serviceInstanceId;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
index 592b349215..acd60a4004 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
@@ -48,7 +48,7 @@ public class ConfigAssignPropertiesForVnf {
private String vnfCustomizationUuid;
@JsonIgnore
- private Map<String, Object> userParam = new HashMap<String, Object>();
+ private Map<String, Object> userParam = new HashMap<>();
public String getServiceInstanceId() {
return serviceInstanceId;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
index 100887dbbc..729f5c95c4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -244,9 +244,9 @@ public class ExceptionBuilder {
public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) {
logger.debug("Processing Audit Results");
String auditListString = (String) execution.getVariable("auditInventoryResult");
+ String processKey = getProcessKey(execution.getDelegateExecution());
if (auditListString != null) {
StringBuilder errorMessage = new StringBuilder();
- String processKey = getProcessKey(execution.getDelegateExecution());
try {
ExtractPojosForBB extractPojosForBB = getExtractPojosForBB();
VfModule module = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -302,7 +302,13 @@ public class ExceptionBuilder {
}
} else {
- logger.debug("Unable to process audit results due to auditInventoryResult being null");
+ String errorMessage = "Unable to process audit results due to auditInventoryResult being null";
+ WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, TargetEntity.SO);
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("AAIInventoryFailure");
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
index de44caa120..525307a5df 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
@@ -1,22 +1,22 @@
-/*-
- * ============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=========================================================
- */
+/*-
+ * ============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.bpmn.common.scripts
@@ -32,6 +32,7 @@ import org.junit.runner.RunWith
import org.mockito.junit.MockitoJUnitRunner
import org.onap.aai.domain.yang.GenericVnf
import org.onap.so.bpmn.mock.FileUtil
+import org.onap.so.client.HttpClient
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
@@ -47,54 +48,56 @@ abstract class MsoGroovyTest {
@Rule
public ExpectedException thrown = ExpectedException.none()
- protected ExecutionEntity mockExecution
- protected AAIResourcesClient client
+ protected ExecutionEntity mockExecution
+ protected AAIResourcesClient client
protected AllottedResourceUtils allottedResourceUtils_MOCK
- protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA =
- FileUtil.readResourceFile("__files/aai/searchResults.json")
- protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString();
-
- protected void init(String procName){
- mockExecution = setupMock(procName)
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
- client = mock(AAIResourcesClient.class)
- }
-
- protected ExecutionEntity setupMock(String procName) {
- ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
- when(mockProcessDefinition.getKey()).thenReturn(procName)
-
- RepositoryService mockRepositoryService = mock(RepositoryService.class)
- when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
- when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName)
- when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
-
- ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
- when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
-
- return mockExecution
- }
-
- protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) {
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-
- when(mockExecution.getVariable("prefix")).thenReturn(prefix)
-
- ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class)
- RepositoryService repositoryService = mock(RepositoryService.class)
- ProcessDefinition processDefinition = mock(ProcessDefinition.class)
-
- when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices)
- when(processEngineServices.getRepositoryService()).thenReturn(repositoryService)
- when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition)
- when(processDefinition.getKey()).thenReturn(procName)
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
- return mockExecution
- }
-
+ protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA =
+ FileUtil.readResourceFile("__files/aai/searchResults.json")
+ protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString();
+
+ protected void init(String procName){
+ mockExecution = setupMock(procName)
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ client = mock(AAIResourcesClient.class)
+ }
+
+ protected ExecutionEntity setupMock(String procName) {
+ ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
+ when(mockProcessDefinition.getKey()).thenReturn(procName)
+
+ RepositoryService mockRepositoryService = mock(RepositoryService.class)
+ when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
+ when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName)
+ when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
+
+ ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
+ when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
+
+ HttpClient httpClient = mock(HttpClient.class)
+
+ return mockExecution
+ }
+
+ protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) {
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+
+ when(mockExecution.getVariable("prefix")).thenReturn(prefix)
+
+ ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class)
+ RepositoryService repositoryService = mock(RepositoryService.class)
+ ProcessDefinition processDefinition = mock(ProcessDefinition.class)
+
+ when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices)
+ when(processEngineServices.getRepositoryService()).thenReturn(repositoryService)
+ when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition)
+ when(processDefinition.getKey()).thenReturn(procName)
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ return mockExecution
+ }
+
protected <T> Optional<T> getAAIObjectFromJson(Class<T> clazz , String file){
String json = FileUtil.readResourceFile(file)
AAIResultWrapper resultWrapper = new AAIResultWrapper(json)
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java
index 2c0377d11c..f4fe6d7158 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java
@@ -47,7 +47,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ValidationConfig.class})
-public class BuildingBlockValidatorRunnerTest {
+public class BuildingBlockValidatorRunnerTest extends BuildingBlockValidatorRunner {
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java
index 0143e567af..596eced1d1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java
@@ -45,7 +45,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ValidationConfig.class})
-public class WorkflowValidatorRunnerTest {
+public class WorkflowValidatorRunnerTest extends WorkflowValidatorRunner {
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java
index af64ed2de6..544d370a3c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java
@@ -23,8 +23,8 @@ package org.onap.so.bpmn.common.listener.validation;
import java.util.Collections;
import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.listener.Skip;
import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
+import org.onap.so.listener.Skip;
import org.springframework.stereotype.Component;
@Component
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java
index 068f433dd5..a3692a50b7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java
@@ -21,13 +21,13 @@
package org.onap.so.bpmn.common.listener.validation;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.bpmn.common.listener.ListenerRunner;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.listener.ListenerRunner;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
-@ComponentScan(basePackageClasses = {ExceptionBuilder.class, ListenerRunner.class},
+@ComponentScan(basePackageClasses = {ExceptionBuilder.class, ListenerRunner.class, WorkflowValidatorRunner.class},
nameGenerator = DefaultToShortClassNameBeanNameGenerator.class)
public class ValidationConfig {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java
deleted file mode 100644
index 273e9f0e3c..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java
+++ /dev/null
@@ -1,55 +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.bpmn.common.util;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-public class CryptoHandlerTest {
- private static final String plainPswd = "mso0206";
- private CryptoHandler cryptoHandler;
- private static String encryptPwd;
-
-
- @Before
- public void setup() {
- cryptoHandler = new CryptoHandler();
- encryptPwd = cryptoHandler.encryptMsoPassword(plainPswd);
- }
-
- @Test
- @Ignore // ignored until we can mock the properties file.
- public void getMsoAaiPasswordTest() {
- assertEquals(plainPswd, cryptoHandler.getMsoAaiPassword());
- }
-
- @Test
- public void encryptMsoPasswordTest() {
- assertEquals(plainPswd, cryptoHandler.decryptMsoPassword(cryptoHandler.encryptMsoPassword(plainPswd)));
- }
-
- @Test
- public void decryptMsoPasswordTest() {
- assertEquals(plainPswd, cryptoHandler.decryptMsoPassword(encryptPwd));
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index bff13f8dbd..7c136cdee9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -1294,6 +1294,7 @@ public class BBInputSetupTest {
Configuration configuration = new Configuration();
configuration.setConfigurationId("configurationId");
configuration.setConfigurationName("configurationName");
+ configuration.setConfigurationSubType("Fabric Config");
serviceInstance.getConfigurations().add(configuration);
String resourceId = "configurationId";
String vnfcName = "vnfcName";
@@ -2072,6 +2073,7 @@ public class BBInputSetupTest {
expected.setType("TRANSPORT");
expected.setModelInfoServiceProxy(new ModelInfoServiceProxy());
expected.getModelInfoServiceProxy().setModelUuid("modelUUID");
+ expected.getModelInfoServiceProxy().setModelInstanceName("modelInstanceName");
expected.setServiceInstance(new ServiceInstance());
expected.getServiceInstance().setModelInfoServiceInstance(new ModelInfoServiceInstance());
expected.getServiceInstance().getModelInfoServiceInstance().setModelUuid("modelUUID");
@@ -2079,6 +2081,7 @@ public class BBInputSetupTest {
Service service = new Service();
ServiceProxyResourceCustomization serviceProxyCatalog = new ServiceProxyResourceCustomization();
serviceProxyCatalog.setModelCustomizationUUID("modelCustomizationUUID");
+ serviceProxyCatalog.setModelInstanceName("modelInstanceName");
Service sourceService = new Service();
sourceService.setModelUUID("modelUUID");
sourceService.setServiceType("TRANSPORT");
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index 80373eb760..18e08917ed 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -105,7 +105,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
@@ -128,7 +128,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage");
+ "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
assertEquals(5, delegateExecution.getVariable("maxRetries"));
@@ -141,7 +141,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
vnf.setVnfType("vnft1");
delegateExecution.setVariable("aLaCarte", true);
doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class), isA(String.class),
- isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class));
delegateExecution.setVariable("suppressRollback", false);
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -152,7 +152,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
@Test
public void queryRainyDayTableExceptionTest() {
doThrow(RuntimeException.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class),
- isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class),
+ isA(String.class));
delegateExecution.setVariable("aLaCarte", true);
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
delegateExecution.setVariable("suppressRollback", false);
@@ -178,7 +179,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, false);
@@ -203,7 +204,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -229,7 +230,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -255,7 +256,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
- "st1", "vnft1", "7000", "*", "errorMessage");
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -272,4 +273,52 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
}
+ @Test
+ public void queryRainyDayTableServiceRoleNotDefined() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ serviceInstance.getModelInfoServiceInstance().setServiceRole("sr1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("Rollback");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "sr1");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+ assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ }
+
+ @Test
+ public void queryRainyDayTableServiceRoleNC() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ serviceInstance.getModelInfoServiceInstance().setServiceRole("NETWORK-COLLECTION");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("ActivateServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("Abort");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "NETWORK-COLLECTION");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+ assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
index 32db3a7bf6..48c6995715 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
@@ -481,4 +481,100 @@ public class ApplicationControllerActionTest extends BaseTest {
assertEquals(expectedErrorCode, appCAction.getErrorCode());
}
+ @Test
+ public void runAppCCommand_Snapshot_vmIdList_Empty_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", "identityUrl");
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vmId_null_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+
+ JSONObject vmIdListJson = new JSONObject();
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vserverIdList_Empty_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ ArrayList<String> vmIdList = new ArrayList<String>();
+ String vmId = "testlink:testVmId";
+ vmIdList.add(vmId);
+ JSONObject vmIdListJson = new JSONObject();
+ vmIdListJson.put("vmIds", vmIdList);
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vserverId_null_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ ArrayList<String> vmIdList = new ArrayList<String>();
+ String vmId = "testlink:testVmId1";
+ vmIdList.add(vmId);
+ JSONObject vmIdListJson = new JSONObject();
+ vmIdListJson.put("vmIds", vmIdList);
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ JSONObject vserverIdListJson = new JSONObject();
+ payloadInfo.put("vserverIdList", vserverIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json
index 418396f290..9b32a4c446 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json
@@ -69,5 +69,15 @@
}
]
},
+ "aggregateRoutes": {
+ "aggregateRoute": [
+ {
+ "routeId": "routeId",
+ "networkStartAddress": "10.80.12.0",
+ "cidrMask": "23",
+ "ipVersion": "4"
+ }
+ ]
+ },
"relationshipList": null
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json
index ccefe195c9..f65fe17a2e 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json
@@ -52,5 +52,13 @@
"segmentation-id": "segmentationId"
}
],
+ "aggregate-routes": [
+ {
+ "route-id": "routeId",
+ "network-start-address": "10.80.12.0",
+ "cidr-mask": "23",
+ "ip-version": "4"
+ }
+ ],
"model-info-network": null
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json
deleted file mode 100644
index f5ffe38285..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "transactions" : [ {
- "put" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test1/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test2"
- }
- }, {
- "uri" : "/network/generic-vnfs/generic-vnf/test3/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test4"
- }
- } ]
- }, {
- "put" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test5/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test6"
- }
- } ]
- } ]
-} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
deleted file mode 100644
index 2e66493a25..0000000000
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
+++ /dev/null
@@ -1,407 +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.bpmn.core;
-
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.camunda.bpm.engine.delegate.Expression;
-import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.core.internal.VariableNameExtractor;
-
-/**
- * Base class for service tasks.
- */
-public class BaseTask implements JavaDelegate {
-
- /**
- * Get the value of a required field. This method throws MissingInjectedFieldException if the expression is null,
- * and BadInjectedFieldException if the expression evaluates to a null value.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value
- */
- protected Object getField(Expression expression, DelegateExecution execution, String fieldName) {
- return getFieldImpl(expression, execution, fieldName, false);
- }
-
- /**
- * Gets the value of an optional field. There are three conditions in which this method returns null:
- * <p>
- * <ol>
- * <li>The expression itself is null (i.e. the field is missing altogether.</li>
- * <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not been set.</li>
- * </ol>
- * <p>
- * Examples:<br>
- * Expression ${x} when x is null: return null<br>
- * Expression ${x} when x is unset: return null<br>
- * Expression ${x+y} when x and/or y are unset: exception<br>
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value, possibly null
- */
- protected Object getOptionalField(Expression expression, DelegateExecution execution, String fieldName) {
- return getFieldImpl(expression, execution, fieldName, true);
- }
-
- /**
- * Get the value of a required output variable field. This method throws MissingInjectedFieldException if the
- * expression is null, and BadInjectedFieldException if the expression produces a null or illegal variable name.
- * Legal variable names contain only letters, numbers, and the underscore character ('_').
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the output variable name
- */
- protected String getOutputField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, false);
- if (o instanceof String) {
- String variable = (String) o;
- if (!isLegalVariable(variable)) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "'" + variable + "' is not a legal variable name");
- }
- return variable;
- } else {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "expected a variable name string" + ", got object of type " + o.getClass().getName());
- }
- }
-
- /**
- * Get the value of an optional output variable field. This method throws BadInjectedFieldException if the
- * expression produces an illegal variable name. Legal variable names contain only letters, numbers, and the
- * underscore character ('_').
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the output variable name, possibly null
- */
- protected String getOptionalOutputField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, true);
- if (o instanceof String) {
- String variable = (String) o;
- if (!isLegalVariable(variable)) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "'" + variable + "' is not a legal variable name");
- }
- return variable;
- } else if (o == null) {
- return null;
- } else {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "expected a variable name string" + ", got object of type " + o.getClass().getName());
- }
- }
-
- /**
- * Get the value of a required string field. This method throws MissingInjectedFieldException if the expression is
- * null, and BadInjectedFieldException if the expression evaluates to a null value.
- * <p>
- * Note: the result is coerced to a string value, if necessary.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value
- */
- protected String getStringField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, false);
- if (o instanceof String) {
- return (String) o;
- } else {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Integer");
- }
- }
-
- /**
- * Gets the value of an optional string field. There are three conditions in which this method returns null:
- * <p>
- * <ol>
- * <li>The expression itself is null (i.e. the field is missing altogether.</li>
- * <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not been set.</li>
- * </ol>
- * <p>
- * Examples:<br>
- * Expression ${x} when x is null: return null<br>
- * Expression ${x} when x is unset: return null<br>
- * Expression ${x+y} when x and/or y are unset: exception<br>
- * <p>
- * Note: the result is coerced to a string value, if necessary.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value, possibly null
- */
- protected String getOptionalStringField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, true);
- if (o instanceof String) {
- return (String) o;
- } else if (o == null) {
- return null;
- } else {
- return o.toString();
- }
- }
-
- /**
- * Get the value of a required integer field. This method throws MissingInjectedFieldException if the expression is
- * null, and BadInjectedFieldException if the expression evaluates to a null value or a value that cannot be coerced
- * to an integer.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value
- */
- protected Integer getIntegerField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, false);
- if (o instanceof Integer) {
- return (Integer) o;
- } else {
- try {
- return Integer.parseInt(o.toString());
- } catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Integer");
- }
- }
- }
-
- /**
- * Gets the value of an optional integer field. There are three conditions in which this method returns null:
- * <p>
- * <ol>
- * <li>The expression itself is null (i.e. the field is missing altogether.</li>
- * <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not been set.</li>
- * </ol>
- * <p>
- * Examples:<br>
- * Expression ${x} when x is null: return null<br>
- * Expression ${x} when x is unset: return null<br>
- * Expression ${x+y} when x and/or y are unset: exception<br>
- * <p>
- * Note: the result is coerced to an integer value, if necessary. This method throws BadInjectedFieldException if
- * the result cannot be coerced to an integer.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value, possibly null
- */
- protected Integer getOptionalIntegerField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, true);
- if (o instanceof Integer) {
- return (Integer) o;
- } else if (o == null) {
- return null;
- } else {
- try {
- return Integer.parseInt(o.toString());
- } catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Integer");
- }
- }
- }
-
- /**
- * Gets the value of an optional long field. There are three conditions in which this method returns null:
- * <p>
- * <ol>
- * <li>The expression itself is null (i.e. the field is missing altogether.</li>
- * <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not been set.</li>
- * </ol>
- * <p>
- * Examples:<br>
- * Expression ${x} when x is null: return null<br>
- * Expression ${x} when x is unset: return null<br>
- * Expression ${x+y} when x and/or y are unset: exception<br>
- * <p>
- * Note: the result is coerced to a long value, if necessary. This method throws BadInjectedFieldException if the
- * result cannot be coerced to a long.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value, possibly null
- */
- protected Long getOptionalLongField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, true);
- if (o instanceof Long) {
- return (Long) o;
- } else if (o == null) {
- return null;
- } else {
- try {
- return Long.parseLong(o.toString());
- } catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Long");
- }
- }
- }
-
- /**
- * Get the value of a required long field. This method throws MissingInjectedFieldException if the expression is
- * null, and BadInjectedFieldException if the expression evaluates to a null value or a value that cannot be coerced
- * to a long.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value
- */
- protected Long getLongField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, false);
- if (o instanceof Long) {
- return (Long) o;
- } else {
- try {
- return Long.parseLong(o.toString());
- } catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Long");
- }
- }
- }
-
- /**
- * Common implementation for field "getter" methods.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @param optional true if the field is optional
- * @return the field value, possibly null
- */
- private Object getFieldImpl(Expression expression, DelegateExecution execution, String fieldName,
- boolean optional) {
- if (expression == null) {
- if (!optional) {
- throw new MissingInjectedFieldException(fieldName, getTaskName());
- }
- return null;
- }
-
- Object value = null;
-
- try {
- value = expression.getValue(execution);
- } catch (Exception e) {
- if (!optional) {
- throw new BadInjectedFieldException(fieldName, getTaskName(), e.getClass().getSimpleName(), e);
- }
-
- // At this point, we have an exception that occurred while
- // evaluating an expression for an optional field. A common
- // problem is that the expression is a simple reference to a
- // variable which has never been set, e.g. the expression is
- // ${x}. The normal activiti behavior is to throw an exception,
- // but we don't like that, so we have the following workaround,
- // which parses the expression text to see if it is a "simple"
- // variable reference, and if so, returns null. If the
- // expression is anything other than a single variable
- // reference, then an exception is thrown, as it would have
- // been without this workaround.
-
- // Get the expression text so we can parse it
- String s = expression.getExpressionText();
- new VariableNameExtractor(s).extract().ifPresent(name -> {
- if (execution.hasVariable(name)) {
- throw new BadInjectedFieldException(fieldName, getTaskName(), e.getClass().getSimpleName(), e);
- }
- });
- }
-
- if (value == null && !optional) {
- throw new BadInjectedFieldException(fieldName, getTaskName(), "required field has null value");
- }
-
- return value;
- }
-
- /**
- * Tests if a character is a "word" character.
- *
- * @param c the character
- * @return true if the character is a "word" character.
- */
- private static boolean isWordCharacter(char c) {
- return (Character.isLetterOrDigit(c) || c == '_');
- }
-
- /**
- * Tests if the specified string is a legal flow variable name.
- *
- * @param name the string
- * @return true if the string is a legal flow variable name
- */
- private boolean isLegalVariable(String name) {
- if (name == null) {
- return false;
- }
-
- int len = name.length();
-
- if (len == 0) {
- return false;
- }
-
- char c = name.charAt(0);
-
- if (!Character.isLetter(c) && c != '_') {
- return false;
- }
-
- for (int i = 1; i < len; i++) {
- c = name.charAt(i);
- if (!Character.isLetterOrDigit(c) && c != '_') {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Returns the name of the task (normally the java class name).
- *
- * @return the name of the task
- */
- public String getTaskName() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void execute(DelegateExecution execution) throws Exception {}
-}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java
index 7523c378e9..d036ce5f2f 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.core.domain;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
index b0b837b3b9..fad6490df2 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
@@ -22,9 +22,7 @@ package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonRootName;
/**
* This class is used to store instance data of services aka ServiceDecomposition
@@ -46,7 +44,7 @@ public class ServiceInstance extends JsonWrapper implements Serializable {
private ModelInfo modelInfo;
private String environmentContext;
private String workloadContext;
- private Map serviceParams;
+ private transient Map serviceParams;
private Customer customer = new Customer();
private String e2eVpnKey;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
index d3d07f9014..3f10df36ab 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
@@ -323,7 +323,7 @@ public class JsonUtils {
logger.debug("getJsonValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue);
return rawValue.toString();
}
}
@@ -352,7 +352,7 @@ public class JsonUtils {
logger.debug("getJsonNodeValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue);
return rawValue.toString();
}
}
@@ -380,11 +380,10 @@ public class JsonUtils {
return 0;
} else {
if (rawValue instanceof Integer) {
- logger.debug("getJsonIntValue(): the raw value is an Integer Object={}",
- ((String) rawValue).toString());
+ logger.debug("getJsonIntValue(): the raw value is an Integer Object={}", rawValue);
return (Integer) rawValue;
} else {
- logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue.toString());
+ logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue);
return 0;
}
}
@@ -412,8 +411,7 @@ public class JsonUtils {
logger.debug("getJsonBooleanValue(): the raw value is a Boolean Object={}", rawValue);
return (Boolean) rawValue;
} else {
- logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}",
- rawValue.toString());
+ logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}", rawValue);
return false;
}
}
@@ -455,7 +453,7 @@ public class JsonUtils {
return null;
} else {
if (rawValue instanceof JSONArray) {
- logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue.toString());
+ logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue);
int arrayLen = ((JSONArray) rawValue).length();
if (index < 0 || arrayLen < index + 1) {
logger.debug("getJsonParamValue(): index: {} is out of bounds for array size of {}", index,
@@ -464,8 +462,7 @@ public class JsonUtils {
}
int foundCnt = 0;
for (int i = 0; i < arrayLen; i++) {
- logger.debug("getJsonParamValue(): index: {}, value: {}", i,
- ((JSONArray) rawValue).get(i).toString());
+ logger.debug("getJsonParamValue(): index: {}, value: {}", i, ((JSONArray) rawValue).get(i));
if (((JSONArray) rawValue).get(i) instanceof JSONObject) {
JSONObject jsonObj = (JSONObject) ((JSONArray) rawValue).get(i);
String parmValue = jsonObj.get(name).toString();
@@ -482,16 +479,14 @@ public class JsonUtils {
continue;
}
} else {
- logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}",
- rawValue.toString());
+ logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}", rawValue);
return null;
}
}
logger.debug("getJsonParamValue(): content value NOT found for name: {}", name);
return null;
} else {
- logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}",
- rawValue.toString());
+ logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}", rawValue);
return null;
}
}
@@ -1057,13 +1052,13 @@ public class JsonUtils {
JsonValidator validator = factory.getValidator();
ProcessingReport report = validator.validate(schema, document);
- logger.debug("JSON schema validation report: {}", report.toString());
+ logger.debug("JSON schema validation report: {}", report);
return report.toString();
} catch (IOException e) {
- logger.debug("IOException performing JSON schema validation on document: {}", e.toString());
+ logger.debug("IOException performing JSON schema validation on document:", e);
throw new ValidationException(e.getMessage());
} catch (ProcessingException e) {
- logger.debug("ProcessingException performing JSON schema validation on document: {}", e.toString());
+ logger.debug("ProcessingException performing JSON schema validation on document:", e);
throw new ValidationException(e.getMessage());
}
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java
deleted file mode 100644
index a9f33f20c5..0000000000
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java
+++ /dev/null
@@ -1,241 +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.bpmn.core;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RepositoryService;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.camunda.bpm.engine.delegate.Expression;
-import org.camunda.bpm.engine.repository.ProcessDefinition;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-public class BaseTaskTest {
-
- private String prefix = "PRE_";
- private String processKey = "AnyProcessKey";
- private String definitionId = "100";
- private String anyVariable = "anyVariable";
- private String anyValueString = "anyValue";
- private String badValueString = "123abc";
- private int anyValueInt = 123;
- private Integer anyValueInteger = Integer.valueOf(anyValueInt);
- private long anyValuelong = 123L;
- private Long anyValueLong = Long.valueOf(anyValuelong);
-
- private DelegateExecution mockExecution;
- private Expression mockExpression;
- private BaseTask baseTask;
- private Object obj1;
- private Object obj2;
- private Object objectString;
- private Object objectInteger;
- private Object objectLong;
- private Object objectBoolean;
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Before
- public void before() throws Exception {
- baseTask = new BaseTask();
- ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class);
- when(mockProcessDefinition.getKey()).thenReturn(processKey);
- RepositoryService mockRepositoryService = mock(RepositoryService.class);
- when(mockRepositoryService.getProcessDefinition(definitionId)).thenReturn(mockProcessDefinition);
- ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class);
- when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService);
- mockExecution = mock(DelegateExecution.class);
- when(mockExecution.getId()).thenReturn(definitionId);
- when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices);
- when(mockExecution.getProcessEngineServices().getRepositoryService()
- .getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition);
- when(mockExecution.getVariable("prefix")).thenReturn(prefix);
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true");
- mockExpression = mock(Expression.class);
- }
-
- @Test
- public void testExecution() throws Exception {
- baseTask.execute(mockExecution);
- assertEquals("BaseTask", baseTask.getTaskName());
- }
-
- @Test
- public void testGetFieldAndMissingInjectedException() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
-
- expectedException.expect(MissingInjectedFieldException.class);
- obj2 = baseTask.getField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj1 = baseTask.getField(mockExpression, mockExecution, null);
- }
-
- @Test
- public void testGetOptionalField() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getOptionalField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
- }
-
- @Test
- public void testGetStringFieldAndMissingInjectedFieldException() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getStringField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
-
- expectedException.expect(MissingInjectedFieldException.class);
- Object objectBoolean = Boolean.valueOf(true); // bad data
- when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
- obj2 = baseTask.getStringField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetStringFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj1 = baseTask.getStringField(mockExpression, mockExecution, null);
- }
-
- @Test
- public void testGetOptionalStringField() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getOptionalStringField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
- }
-
- @Test
- public void testGetIntegerFieldAndMissingInjectedFieldException() throws Exception {
- objectInteger = Integer.valueOf(anyValueInt);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger);
- obj1 = baseTask.getIntegerField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueInteger, (Integer) obj1);
-
- expectedException.expect(MissingInjectedFieldException.class);
- objectString = new String(badValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj2 = baseTask.getIntegerField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetIntegerFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj1 = baseTask.getIntegerField(mockExpression, mockExecution, null);
- }
-
-
- @Test
- public void testGetOptionalIntegerField() throws Exception {
- objectInteger = Integer.valueOf(anyValueInt);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger);
- obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueInteger, (Integer) obj1);
- }
-
- @Test
- public void testGetOptionalIntegerFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- objectBoolean = Boolean.valueOf(true);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
- obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetLongFieldAndMissingInjectedFieldException() throws Exception {
- objectLong = Long.valueOf(anyValuelong);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectLong);
- obj1 = baseTask.getLongField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueLong, (Long) obj1);
-
- expectedException.expect(MissingInjectedFieldException.class);
- objectString = new String(badValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj2 = baseTask.getLongField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetLongFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj2 = baseTask.getLongField(mockExpression, mockExecution, null);
- }
-
- @Test
- public void testGetOptionalLongField() throws Exception {
- objectLong = Long.valueOf(anyValuelong);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectLong);
- obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueLong, (Long) obj1);
- }
-
- @Test
- public void testGetOptionalLongFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- objectBoolean = Boolean.valueOf(true);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
- obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetOutputAndMissingInjectedFieldException() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getOutputField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
-
- expectedException.expect(MissingInjectedFieldException.class);
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj2 = baseTask.getOutputField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetOutputAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj2 = baseTask.getOutputField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetOptionalOutputField() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getOptionalOutputField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
- }
-
- @Test
- public void testGetOptionalOutputFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- objectBoolean = Boolean.valueOf(true);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
- obj1 = baseTask.getOptionalOutputField(mockExpression, mockExecution, anyVariable);
- }
-
-}
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index ea1a205317..25913eabba 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -134,6 +134,24 @@
</executions>
</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>
<dependencyManagement>
<dependencies>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
index 251464a34d..6de22825b7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -37,8 +37,10 @@ import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
import org.camunda.bpm.engine.impl.util.xml.Element;
import org.camunda.bpm.engine.impl.variable.VariableDeclaration;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -50,6 +52,9 @@ import org.springframework.stereotype.Component;
@Component
public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
+ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
+ public static final String SERVICE_NAME = "ServiceName";
+
@Autowired
private LoggingParseListener loggingParseListener;
@@ -294,6 +299,13 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
String requestId = (String) execution.getVariable("mso-request-id");
String svcid = (String) execution.getVariable("mso-service-instance-id");
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+ MDC.put(SERVICE_INSTANCE_ID, svcid);
+ MDC.put(SERVICE_NAME, processName);
+ } catch (Exception e) {
+ logger.error("Error trying to add variables to MDC", e);
+ }
}
} catch (Exception e) {
logger.error("Exception occurred", e);
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 093fba089d..a4fc6e54b0 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -99,7 +99,7 @@ public class MSOInfrastructureApplication {
DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment();
deployCustomWorkflows(deploymentBuilder);
} catch (Exception e) {
- logger.warn("Unable to invoke deploymentBuilder: " + e.getMessage());
+ logger.warn("Unable to invoke deploymentBuilder ", e);
}
}
@@ -136,11 +136,11 @@ public class MSOInfrastructureApplication {
deploymentBuilder.addString(workflowName, workflowBody);
}
deploymentBuilder.enableDuplicateFiltering(true);
- deploymentBuilder.deploy();
}
+ deploymentBuilder.deploy();
}
} catch (Exception e) {
- logger.warn("Unable to deploy custom workflows, " + e.getMessage());
+ logger.warn("Unable to deploy custom workflows ", e);
}
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12 b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12
new file mode 100644
index 0000000000..79631bf344
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12
Binary files differ
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks
new file mode 100644
index 0000000000..6f8168d896
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks
Binary files differ
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
index 389f931901..93f98a34a6 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -350,10 +350,12 @@ public abstract class WorkflowTest {
*/
try {
- msoRequestId = (String) injectedVariables.get("requestId");
- variables.put("mso-request-id", msoRequestId);
- msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
- variables.put("mso-service-instance-id", msoServiceInstanceId);
+ if (injectedVariables != null) {
+ msoRequestId = (String) injectedVariables.get("requestId");
+ variables.put("mso-request-id", msoRequestId);
+ msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
+ variables.put("mso-service-instance-id", msoServiceInstanceId);
+ }
} catch (Exception e) {
}
if (msoRequestId == null || msoRequestId.trim().equals("")) {
@@ -1382,172 +1384,6 @@ public abstract class WorkflowTest {
}
/**
- * Runs a program to inject sniro workflow messages into the test environment. A program is essentially just a list
- * of keys that identify event data to be injected, in sequence. For more details, see injectSNIROCallbacks(String
- * contentType, String messageType, String content, long timeout)
- *
- * Errors are handled with junit assertions and will cause the test to fail. NOTE: Each callback must have a
- * workflow message type associated with it.
- *
- * @param callbacks an object containing event data for the program
- * @param program the program to execute
- */
- protected void injectSNIROCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String messageType = null;
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No '" + action + "' workflow message callback is defined";
- logger.debug(msg);
- fail(msg);
- }
-
- messageType = callbackData.getMessageType();
-
- if (messageType == null || messageType.trim().equals("")) {
- String msg = "No workflow message type is defined in the '" + action + "' callback";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else {
- String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- }
-
- if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) {
- fail("Failed to inject '" + action + "' workflow message");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of '" + action + "' workflow message");
- }
- }
- }
-
- /**
- * Injects a sniro workflow message. The specified callback response may contain the placeholder strings
- * ((CORRELATOR)) and ((SERVICE_RESOURCE_ID)) The ((CORRELATOR)) is replaced with the actual correlator value from
- * the request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId value from the sniro
- * request. Currently this only works with sniro request that contain only 1 resource.
- *
- * @param contentType the HTTP contentType for the message (possibly null)
- * @param messageType the message type
- * @param content the message content (possibly null)
- * @param timeout the timeout in milliseconds
- * @return true if the message could be injected, false otherwise
- */
- protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) {
- String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", messageType + "_CORRELATOR", timeout);
-
- if (correlator == null) {
- return false;
- }
- if (content != null) {
- content = content.replace("((CORRELATOR))", correlator);
- if (messageType.equalsIgnoreCase("SNIROResponse")) {
- ServiceDecomposition decomp =
- (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout);
- List<Resource> resourceList = decomp.getServiceResources();
- if (resourceList.size() == 1) {
- String resourceId = "";
- for (Resource resource : resourceList) {
- resourceId = resource.getResourceId();
- }
- String homingList = getJsonValue(content, "solutionInfo.placementInfo");
- JSONArray placementArr = null;
- try {
- placementArr = new JSONArray(homingList);
- } catch (Exception e) {
- return false;
- }
- if (placementArr.length() == 1) {
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
- JSONArray licenseArr = null;
- try {
- licenseArr = new JSONArray(licenseInfoList);
- } catch (Exception e) {
- return false;
- }
- if (licenseArr.length() == 1) {
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- } else {
- try {
- String homingList = getJsonValue(content, "solutionInfo.placementInfo");
- String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
- JSONArray placementArr = new JSONArray(homingList);
- JSONArray licenseArr = new JSONArray(licenseInfoList);
- for (Resource resource : resourceList) {
- String resourceModuleName = resource.getModelInfo().getModelInstanceName();
- String resourceId = resource.getResourceId();
-
- for (int i = 0; i < placementArr.length(); i++) {
- JSONObject placementObj = placementArr.getJSONObject(i);
- String placementModuleName = placementObj.getString("resourceModuleName");
- if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
- String placementString = placementObj.toString();
- placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newPlacementObj = new JSONObject(placementString);
- placementArr.put(i, newPlacementObj);
- }
- }
-
- for (int i = 0; i < licenseArr.length(); i++) {
- JSONObject licenseObj = licenseArr.getJSONObject(i);
- String licenseModuleName = licenseObj.getString("resourceModuleName");
- if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
- String licenseString = licenseObj.toString();
- licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newLicenseObj = new JSONObject(licenseString);
- licenseArr.put(i, newLicenseObj);
- }
- }
- }
- String newPlacementInfos = placementArr.toString();
- String newLicenseInfos = licenseArr.toString();
- content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
- content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
- } catch (Exception e) {
- return false;
- }
-
- }
- }
- }
- logger.debug("Injecting " + messageType + " message");
-
- Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
- logger.debug("Workflow response to {} message: {}", messageType, response);
- return true;
- }
-
-
- /**
* Wait for the process to end.
*
* @param businessKey the process business key
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index 3ff240ebc2..91cfa93a34 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -63,7 +63,12 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
- variables.put("resourceInput", getUpdateResInputObj("OLT").toString());
+ ResourceInput ri = getUpdateResInputObj("OLT");
+ if (ri != null) {
+ variables.put("resourceInput", ri.toString());
+ } else {
+ variables.put("resourceInput", null);
+ }
// when
ProcessInstance instance =
runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -82,7 +87,12 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
- variables.put("resourceInput", getUpdateResInputObj("OLT").toString());
+ ResourceInput ri = getUpdateResInputObj("OLT");
+ if (ri != null) {
+ variables.put("resourceInput", ri.toString());
+ } else {
+ variables.put("resourceInput", null);
+ }
// when
ProcessInstance instance =
runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
diff --git a/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
index e4f1998c40..12f30cfa58 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
+++ b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
@@ -31,6 +31,8 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.stereotype.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Component
public class DeployActivitySpecs {
@@ -38,10 +40,12 @@ public class DeployActivitySpecs {
private static final String ACTIVITY_SPEC_URI = "/activityspec-api/v1.0/activity-spec";
private static final String CONTENT_TYPE_JSON = "application/json";
+ private static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class);
+
public static void main(String[] args) throws Exception {
if (args == null || args.length == 0) {
- System.out.println("Please specify hostname argument");
+ logger.info("Please specify hostname argument");
return;
}
@@ -49,20 +53,23 @@ public class DeployActivitySpecs {
File dir = new File(ACTIVITY_FILE_LOCATION);
if (!dir.isDirectory()) {
- System.out.println("ActivitySpec store is not a directory");
+ logger.debug("ActivitySpec store is not a directory");
return;
}
- for (File f : dir.listFiles()) {
- String activitySpecName = f.getName();
- String errorMessage = deployActivitySpec(hostname, activitySpecName);
- if (errorMessage == null) {
- System.out.println("Deployed Activity Spec: " + activitySpecName);
- } else {
- System.out.println("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage);
+ if (dir.listFiles() != null) {
+ for (File f : dir.listFiles()) {
+ String activitySpecName = f.getName();
+ String errorMessage = deployActivitySpec(hostname, activitySpecName);
+ if (errorMessage == null) {
+ logger.debug("Deployed Activity Spec: " + activitySpecName);
+ } else {
+ logger.error("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage);
+ }
}
+ } else {
+ logger.error("Null file list for Activity Specs.");
}
- return;
}
protected static String deployActivitySpec(String hostname, String activitySpecName) throws Exception {
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn
index 0dbe989cb2..d70e103009 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0">
- <bpmn:process id="VNFUnsetInClosedLoopDisabledFlagActivity" name="VNFUnsetInClosedLoopDisabledFlagActivity" isExecutable="true">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+ <bpmn:process id="VNFUnsetClosedLoopDisabledFlagActivity" name="VNFUnsetClosedLoopDisabledFlagActivity" isExecutable="true">
<bpmn:startEvent id="VNFUnsetClosedLoopDisabledFlagActivity_Start">
<bpmn:outgoing>SequenceFlow_19it9ao</bpmn:outgoing>
</bpmn:startEvent>
@@ -15,7 +15,7 @@
<bpmn:sequenceFlow id="SequenceFlow_1en9xbh" sourceRef="TaskVNFUnsetClosedLoopDisabledFlagActivity" targetRef="VNFUnsetClosedLoopDisabledFlagActivity_End" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUnsetInClosedLoopDisabledFlagActivity">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUnsetClosedLoopDisabledFlagActivity">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUnsetClosedLoopDisabledFlagActivity_Start">
<dc:Bounds x="173" y="102" width="36" height="36" />
</bpmndi:BPMNShape>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
index 035d124402..a7be9e69c1 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
@@ -33,7 +33,7 @@ public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest {
@Test
public void sunnyDayVNFUnsetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
ProcessInstance pi =
- runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ runtimeService.startProcessInstanceByKey("VNFUnsetClosedLoopDisabledFlagActivity", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
"TaskVNFUnsetClosedLoopDisabledFlagActivity", "VNFUnsetClosedLoopDisabledFlagActivity_End");
@@ -45,7 +45,7 @@ public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest {
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
.modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
ProcessInstance pi =
- runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ runtimeService.startProcessInstanceByKey("VNFUnsetClosedLoopDisabledFlagActivity", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
.hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
index 30b5cc8567..b855e936d0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory
* flow for SDNC Network Resource Activate
*/
public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( ActivateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( ActivateSDNCNetworkResource.class)
String Prefix = "ACTSDNCRES_"
@@ -57,7 +57,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
MsoUtils msoUtils = new MsoUtils()
- public void preProcessRequest(DelegateExecution execution) {
+ void preProcessRequest(DelegateExecution execution) {
logger.info(" ***** Started preProcessRequest *****")
try {
@@ -106,7 +106,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
}
- public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) {
+ void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) {
logger.info("started prepareUpdateAfterActivateSDNCResource ")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
@@ -135,7 +135,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
}
@@ -148,12 +148,12 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String customizeResourceParam(String networkInputParametersJson) {
List<Map<String, Object>> paramList = new ArrayList()
- JSONObject jsonObject = new JSONObject(networkInputParametersJson);
+ JSONObject jsonObject = new JSONObject(networkInputParametersJson)
Iterator iterator = jsonObject.keys()
while (iterator.hasNext()) {
String key = iterator.next()
HashMap<String, String> hashMap = new HashMap()
- hashMap.put("name", key);
+ hashMap.put("name", key)
hashMap.put("value", jsonObject.get(key))
paramList.add(hashMap)
}
@@ -163,7 +163,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
return new JSONObject(paramMap).toString()
}
- public void prepareSDNCRequest (DelegateExecution execution) {
+ void prepareSDNCRequest (DelegateExecution execution) {
logger.info("Started prepareSDNCRequest ")
try {
@@ -186,7 +186,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion()
String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName()
String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
- String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid();
+ String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid()
String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
@@ -451,7 +451,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.info(" ***** Exit prepareSDNCRequest *****")
}
- public void postActivateSDNCCall(DelegateExecution execution) {
+ void postActivateSDNCCall(DelegateExecution execution) {
logger.info("started postCreateSDNCCall ")
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
@@ -460,7 +460,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
}
- public void sendSyncResponse(DelegateExecution execution) {
+ void sendSyncResponse(DelegateExecution execution) {
logger.info("started sendsyncResp")
try {
@@ -478,4 +478,4 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
logger.info("exited send sync Resp")
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
index 608bf66da9..df11549ff4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -19,9 +19,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -55,7 +55,7 @@ import groovy.json.*
* @param - WorkflowException
*/
public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( CompareModelofE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( CompareModelofE2EServiceInstance.class)
String Prefix="CMPMDSI_"
private static final String DebugFlag = "isDebugEnabled"
@@ -64,7 +64,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- public void preProcessRequest (DelegateExecution execution) {
+ void preProcessRequest (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
String msg = ""
@@ -128,7 +128,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
execution.setVariable("operationType", "CompareModel")
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.info(msg)
@@ -137,7 +137,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
logger.trace("Exit preProcessRequest ")
}
- public void sendSyncResponse (DelegateExecution execution) {
+ void sendSyncResponse (DelegateExecution execution) {
logger.trace("sendSyncResponse ")
try {
@@ -155,7 +155,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
logger.trace("Exit sendSyncResopnse ")
}
- public void sendSyncError (DelegateExecution execution) {
+ void sendSyncError (DelegateExecution execution) {
logger.trace("sendSyncError ")
try {
@@ -182,7 +182,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
}
- public void prepareCompletionRequest (DelegateExecution execution) {
+ void prepareCompletionRequest (DelegateExecution execution) {
logger.trace("prepareCompletion ")
try {
@@ -214,7 +214,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
logger.trace("Exit prepareCompletionRequest ")
}
- public void prepareFalloutRequest(DelegateExecution execution){
+ void prepareFalloutRequest(DelegateExecution execution){
logger.trace("prepareFalloutRequest ")
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
index 8bb48a203b..ced1b928fc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -72,7 +72,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( Create3rdONAPE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( Create3rdONAPE2EServiceInstance.class)
public void checkSPPartnerInfo (DelegateExecution execution) {
logger.info(" ***** Started checkSPPartnerInfo *****")
@@ -312,7 +312,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
// Put TP Link info into serviceParameters
JSONObject inputParameters = new JSONObject(execution.getVariable(Prefix + "ServiceParameters"))
if(inputParameters.has("remote-access-provider-id")) {
- Map<String, Object> crossTPs = new HashMap<String, Object>();
+ Map<String, Object> crossTPs = new HashMap<String, Object>()
crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id"))
crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id"))
crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
index 2abee7caaa..cae629fdf0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
@@ -7,7 +7,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -39,7 +39,7 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
@@ -56,7 +56,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String Prefix="CRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( CreateCustomE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateCustomE2EServiceInstance.class)
public void preProcessRequest (DelegateExecution execution) {
@@ -154,7 +154,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
//execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))
//execution.setVariable("failExists", true)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug(msg)
@@ -332,7 +332,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
}catch(Exception e){
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
logger.trace("finished prepareInitServiceOperationStatus")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index bcd33530b1..4b3c1aa7b4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -55,7 +55,7 @@ import org.slf4j.LoggerFactory
*/
public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( CreateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateSDNCNetworkResource.class)
String Prefix="CRESDNCRES_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -120,20 +120,20 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
String customizeResourceParam(String networkInputParametersJson) {
- List<Map<String, Object>> paramList = new ArrayList();
- JSONObject jsonObject = new JSONObject(networkInputParametersJson);
- Iterator iterator = jsonObject.keys();
+ List<Map<String, Object>> paramList = new ArrayList()
+ JSONObject jsonObject = new JSONObject(networkInputParametersJson)
+ Iterator iterator = jsonObject.keys()
while (iterator.hasNext()) {
- String key = iterator.next();
- HashMap<String, String> hashMap = new HashMap();
- hashMap.put("name", key);
+ String key = iterator.next()
+ HashMap<String, String> hashMap = new HashMap()
+ hashMap.put("name", key)
hashMap.put("value", jsonObject.get(key))
paramList.add(hashMap)
}
- Map<String, List<Map<String, Object>>> paramMap = new HashMap();
- paramMap.put("param", paramList);
+ Map<String, List<Map<String, Object>>> paramMap = new HashMap()
+ paramMap.put("param", paramList)
- return new JSONObject(paramMap).toString();
+ return new JSONObject(paramMap).toString()
}
private List<Metadatum> getMetaDatum(String customerId,
@@ -347,7 +347,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion()
String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName()
String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
- String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid();
+ String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid()
String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
@@ -357,7 +357,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//here convert json string to xml string
String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(networkInputParametersJson)))
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
- String sdncTopologyCreateRequest = "";
+ String sdncTopologyCreateRequest = ""
String modelType = resourceInputObj.getResourceModelInfo().getModelType()
@@ -641,7 +641,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
@@ -674,7 +674,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
}
@@ -724,7 +724,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
try {
String operationStatus = "finished"
// RESTResponse for main flow
- String vnfid=execution.getVariable("resourceInstanceId");
+ String vnfid=execution.getVariable("resourceInstanceId")
String resourceOperationResp = """{"operationStatus":"${operationStatus}","vnf-id":"${vnfid}"}""".trim()
logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
index 433a8d0bb9..901964f465 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -25,7 +25,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.client.HttpClientFactory
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -44,7 +44,7 @@ import org.onap.so.utils.TargetEntity
* flow for VFC Network Service Create
*/
public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( CreateVFCNSResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateVFCNSResource.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -77,7 +77,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId")
logger.info("globalSubscriberId:" + globalSubscriberId)
//set local globalSubscriberId variable
- execution.setVariable("globalSubscriberId", globalSubscriberId);
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
String serviceType = execution.getVariable("serviceType")
logger.info("serviceType:" + serviceType)
@@ -110,9 +110,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
"operationId":"${operationId}",
"nodeTemplateUUID":"${nodeTemplateUUID}"
}"""
- execution.setVariable("nsOperationKey", nsOperationKey);
+ execution.setVariable("nsOperationKey", nsOperationKey)
execution.setVariable("nsParameters", nsParameters)
- execution.setVariable("nsServiceModelUUID", nsServiceModelUUID);
+ execution.setVariable("nsServiceModelUUID", nsServiceModelUUID)
String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
@@ -128,7 +128,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.info(msg)
@@ -143,9 +143,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
public void createNetworkService(DelegateExecution execution) {
logger.trace("createNetworkService ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
- String nsOperationKey = execution.getVariable("nsOperationKey");
- String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID");
- String nsParameters = execution.getVariable("nsParameters");
+ String nsOperationKey = execution.getVariable("nsOperationKey")
+ String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID")
+ String nsParameters = execution.getVariable("nsParameters")
String nsServiceName = execution.getVariable("nsServiceName")
String nsServiceDescription = execution.getVariable("nsServiceDescription")
String locationConstraints = jsonUtil.getJsonValue(nsParameters, "locationConstraints")
@@ -163,7 +163,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
String returnCode = apiResponse.getStatus ()
String aaiResponseAsString = apiResponse.readEntity(String.class)
- String nsInstanceId = "";
+ String nsInstanceId = ""
if(returnCode== "200" || returnCode == "201"){
nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId")
}
@@ -177,8 +177,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
public void instantiateNetworkService(DelegateExecution execution) {
logger.trace("instantiateNetworkService ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
- String nsOperationKey = execution.getVariable("nsOperationKey");
- String nsParameters = execution.getVariable("nsParameters");
+ String nsOperationKey = execution.getVariable("nsOperationKey")
+ String nsParameters = execution.getVariable("nsParameters")
String nsServiceName = execution.getVariable("nsServiceName")
String nsServiceDescription = execution.getVariable("nsServiceDescription")
String reqBody ="""{
@@ -192,7 +192,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
Response apiResponse = postRequest(execution, url, reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
- String jobId = "";
+ String jobId = ""
if(returnCode== "200"|| returnCode == "201"){
jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
}
@@ -207,7 +207,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
logger.trace("queryNSProgress ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
- String nsOperationKey = execution.getVariable("nsOperationKey");
+ String nsOperationKey = execution.getVariable("nsOperationKey")
String url = vfcAdapterUrl + "/jobs/" + jobId
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
@@ -225,9 +225,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void timeDelay(DelegateExecution execution) {
try {
- Thread.sleep(5000);
+ Thread.sleep(5000)
} catch(InterruptedException e) {
- logger.error("Time Delay exception" + e.getMessage());
+ logger.error("Time Delay exception" + e.getMessage())
}
}
@@ -252,7 +252,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
getAAIClient().connect(nsUri,relatedServiceUri)
logger.info("NS relationship to Service added successfully")
}catch(Exception e){
- logger.error("Exception occured while Creating NS relationship."+ e.getMessage());
+ logger.error("Exception occured while Creating NS relationship."+ e.getMessage())
throw new BpmnError("MSOWorkflowException")
}
}
@@ -268,7 +268,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
Response apiResponse = null
try{
- URL url = new URL(urlString);
+ URL url = new URL(urlString)
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
@@ -282,7 +282,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
logger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
}catch(Exception e){
- logger.error("VFC Aatpter Post Call Exception:" + e.getMessage());
+ logger.error("VFC Aatpter Post Call Exception:" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VFC Aatpter Post Call Exception")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
index 097a1be291..1a689d426c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory
* flow for SDNC Network Resource Activate
*/
public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( DeActivateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeActivateSDNCNetworkResource.class)
String Prefix = "DEACTSDNCRES_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -53,7 +53,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
MsoUtils msoUtils = new MsoUtils()
- public void preProcessRequest(DelegateExecution execution) {
+ void preProcessRequest(DelegateExecution execution) {
logger.info(" ***** Started preProcessRequest *****")
@@ -96,7 +96,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
execution.setVariable("mso-request-id", requestId)
execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug(msg)
@@ -104,7 +104,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
}
}
- public void prepareSDNCRequest(DelegateExecution execution) {
+ void prepareSDNCRequest(DelegateExecution execution) {
logger.info(" ***** Started prepareSDNCRequest *****")
try {
@@ -127,7 +127,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion()
String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName()
String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
- String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid();
+ String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid()
String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
@@ -390,7 +390,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
logger.info(" ***** Exit prepareSDNCRequest *****")
}
- public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) {
+ void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) {
String resourceInput = execution.getVariable("resourceInput")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String operType = resourceInputObj.getOperationType()
@@ -418,7 +418,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
}
@@ -429,7 +429,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
execution.setVariable("CVFMI_updateResOperStatusRequest", body)
}
- public void postDeactivateSDNCCall(DelegateExecution execution) {
+ void postDeactivateSDNCCall(DelegateExecution execution) {
logger.info(" ***** Started prepareSDNCRequest *****")
String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
@@ -438,7 +438,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
logger.info(" ***** Exit prepareSDNCRequest *****")
}
- public void sendSyncResponse(DelegateExecution execution) {
+ void sendSyncResponse(DelegateExecution execution) {
logger.debug(" *** sendSyncResponse *** ")
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
index 64ae3dfbef..da486bb1c3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -60,7 +60,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( Delete3rdONAPE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( Delete3rdONAPE2EServiceInstance.class)
public void checkSPPartnerInfoFromAAI (DelegateExecution execution) {
logger.info(" ***** Started checkSPPartnerInfo *****")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
index a9b1fdaac3..2a65ae97a2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
@@ -8,7 +8,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -22,9 +22,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -38,7 +38,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.web.util.UriUtils;
+import org.springframework.web.util.UriUtils
import groovy.json.*
@@ -52,7 +52,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- private static final Logger logger = LoggerFactory.getLogger( DeleteCustomE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteCustomE2EServiceInstance.class)
public void preProcessRequest (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
index 7c8b7eb7cc..61b1250522 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
@@ -67,7 +67,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
MsoUtils msoUtils = new MsoUtils()
- public void preProcessRequest(DelegateExecution execution){
+ void preProcessRequest(DelegateExecution execution){
logger.info(" ***** Started preProcessRequest *****")
try {
@@ -184,7 +184,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
* generate the nsOperationKey
* generate the nsParameters
*/
- public void prepareSDNCRequest (DelegateExecution execution) {
+ void prepareSDNCRequest (DelegateExecution execution) {
logger.info(" ***** Started prepareSDNCRequest *****")
try {
@@ -475,7 +475,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
execution.setVariable("CVFMI_updateResOperStatusRequest", body)
}
- public void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) {
+ void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) {
logger.debug(" *** prepareUpdateBeforeDeleteSDNCResource *** ")
String resourceInput = execution.getVariable(Prefix + "resourceInput");
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
@@ -511,7 +511,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
- public void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) {
+ void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) {
logger.debug(" *** prepareUpdateAfterDeleteSDNCResource *** ")
String resourceInput = execution.getVariable(Prefix + "resourceInput");
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
@@ -546,7 +546,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.debug(" ***** Exit prepareUpdateAfterDeleteSDNCResource *****")
}
- public void postDeleteSDNCCall(DelegateExecution execution){
+ void postDeleteSDNCCall(DelegateExecution execution){
logger.info(" ***** Started postDeleteSDNCCall *****")
String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
@@ -555,7 +555,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.info(" ***** Exit postDeleteSDNCCall *****")
}
- public void sendSyncResponse (DelegateExecution execution) {
+ void sendSyncResponse (DelegateExecution execution) {
logger.debug( " *** sendSyncResponse *** ")
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
index 9b269c734f..642609a970 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
@@ -63,14 +63,14 @@ public class DeleteVFCNSResource extends AbstractServiceTaskProcessor {
logger.info(" ***** end preProcessRequest *****")
}
- public void postProcessRequest (DelegateExecution execution) {
+ void postProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
logger.info(" ***** start postProcessRequest *****")
logger.info(" ***** end postProcessRequest *****")
}
- public void sendSyncResponse (DelegateExecution execution) {
+ void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.debug( " *** sendSyncResponse *** ")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
index fff2503308..324e6b42ba 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -19,9 +19,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.Resource
@@ -52,7 +52,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
String Prefix="DCMPMDV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( DoCompareModelVersions.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCompareModelVersions.class)
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -196,8 +196,8 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")
ServiceDecomposition serviceDecomposition_Original = execution.getVariable("serviceDecomposition_Original")
- List<Resource> allSR_target = serviceDecomposition_Target.getServiceResources();
- List<Resource> allSR_original = serviceDecomposition_Original.getServiceResources();
+ List<Resource> allSR_target = serviceDecomposition_Target.getServiceResources()
+ List<Resource> allSR_original = serviceDecomposition_Original.getServiceResources()
List<Resource> addResourceList = new ArrayList<String>()
List<Resource> delResourceList = new ArrayList<String>()
@@ -214,8 +214,8 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
if(rc_o.getModelInfo().getModelUuid() == muuid
&& rc_o.getModelInfo().getModelInvariantUuid() == mIuuid
&& rc_o.getModelInfo().getModelCustomizationUuid() == mCuuid) {
- addResourceList.remove(rc_t);
- delResourceList.remove(rc_o);
+ addResourceList.remove(rc_t)
+ delResourceList.remove(rc_o)
}
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index 0191439dac..9d8b953f0e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -7,7 +7,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -26,9 +26,9 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.ErrorCode
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import javax.ws.rs.NotFoundException
@@ -83,7 +83,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
*
*/
public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( DoCreateE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateE2EServiceInstance.class)
String Prefix="DCRESI_"
@@ -165,7 +165,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInstanceData", si)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.info(msg)
@@ -210,7 +210,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
//we need a service plugin platform here.
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- String newUuiRequest = ServicePluginFactory.getInstance().preProcessService(serviceDecomposition, uuiRequest);
+ String newUuiRequest = ServicePluginFactory.getInstance().preProcessService(serviceDecomposition, uuiRequest)
execution.setVariable("uuiRequest", newUuiRequest)
}
@@ -218,7 +218,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
//we need a service plugin platform here.
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- String newUuiRequest = ServicePluginFactory.getInstance().doServiceHoming(serviceDecomposition, uuiRequest);
+ String newUuiRequest = ServicePluginFactory.getInstance().doServiceHoming(serviceDecomposition, uuiRequest)
execution.setVariable("uuiRequest", newUuiRequest)
}
@@ -254,7 +254,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
}
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
logger.info(msg)
@@ -276,7 +276,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
client.create(uri, si)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
//start rollback set up
RollbackData rollbackData = new RollbackData()
@@ -310,11 +310,11 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
AAIResultWrapper aaiResult = client.get(uri,NotFoundException.class)
Map<String, Object> result = aaiResult.asMap()
List<Object> resources =
- (List<Object>) result.getOrDefault("result-data", Collections.emptyList());
+ (List<Object>) result.getOrDefault("result-data", Collections.emptyList())
if(resources.size()>0) {
String relationshipUrl = ((Map<String, Object>) resources.get(0)).get("resource-link")
- final Relationship body = new Relationship();
+ final Relationship body = new Relationship()
body.setRelatedLink(relationshipUrl)
createRelationShipInAAI(execution, body)
@@ -329,7 +329,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage()
@@ -349,7 +349,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
client.create(uri, relationship)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
msg = "Exception in DoCreateE2EServiceInstance.createRelationShipInAAI. " + ex.getMessage()
@@ -362,9 +362,9 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
private String isNeedProcessCustomRelationship(String uuiRequest) {
String requestInput = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs")
- Map<String, String> requestInputObject = getJsonObject(requestInput, Map.class);
+ Map<String, String> requestInputObject = getJsonObject(requestInput, Map.class)
if (requestInputObject == null) {
- return null;
+ return null
}
Optional<Map.Entry> firstKey =
@@ -380,15 +380,15 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
private static <T> T getJsonObject(String jsonstr, Class<T> type) {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ ObjectMapper mapper = new ObjectMapper()
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true)
try {
- return mapper.readValue(jsonstr, type);
+ return mapper.readValue(jsonstr, type)
} catch (IOException e) {
logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
- ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e)
}
- return null;
+ return null
}
@@ -409,7 +409,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInstanceName", si.get().getServiceInstanceName())
}catch(BpmnError e) {
- throw e;
+ throw e
}catch(Exception ex) {
String msg = "Internal Error in getServiceInstance: " + ex.getMessage()
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
@@ -449,7 +449,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
}
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
logger.info(msg)
@@ -462,12 +462,12 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("preProcessRollback ")
try {
- Object workflowException = execution.getVariable("WorkflowException");
+ Object workflowException = execution.getVariable("WorkflowException")
if (workflowException instanceof WorkflowException) {
logger.info("Prev workflowException: " + workflowException.getErrorMessage())
- execution.setVariable("prevWorkflowException", workflowException);
- //execution.setVariable("WorkflowException", null);
+ execution.setVariable("prevWorkflowException", workflowException)
+ //execution.setVariable("WorkflowException", null)
}
} catch (BpmnError e) {
logger.info("BPMN Error during preProcessRollback")
@@ -482,15 +482,15 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("postProcessRollback ")
String msg = ""
try {
- Object workflowException = execution.getVariable("prevWorkflowException");
+ Object workflowException = execution.getVariable("prevWorkflowException")
if (workflowException instanceof WorkflowException) {
logger.info("Setting prevException to WorkflowException: ")
- execution.setVariable("WorkflowException", workflowException);
+ execution.setVariable("WorkflowException", workflowException)
}
execution.setVariable("rollbackData", null)
} catch (BpmnError b) {
logger.info("BPMN Error during postProcessRollback")
- throw b;
+ throw b
} catch(Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
logger.info(msg)
@@ -547,19 +547,19 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), e);
+ ErrorCode.UnknownError.getValue(), e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preInitResourcesOperStatus Process ")
}
- // if site location is in local Operator, create all resources in local ONAP;
+ // if site location is in local Operator, create all resources in local ONAP
// if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP
public void doProcessSiteLocation(DelegateExecution execution){
logger.trace("======== Start doProcessSiteLocation Process ======== ")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest);
+ uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest)
execution.setVariable("uuiRequest", uuiRequest)
execution.setVariable("serviceDecomposition", serviceDecomposition)
@@ -571,7 +571,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("======== Start doTPResourcesAllocation Process ======== ")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest);
+ uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest)
execution.setVariable("uuiRequest", uuiRequest)
logger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index b1356b9fb6..bc26aa10ec 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -72,13 +72,13 @@ import java.lang.reflect.Type
* @param - WorkflowException
*/
public class DoCreateResources extends AbstractServiceTaskProcessor{
- private static final Logger logger = LoggerFactory.getLogger( DoCreateResources.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateResources.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
- public void preProcessRequest(DelegateExecution execution) {
+ void preProcessRequest(DelegateExecution execution) {
logger.trace("preProcessRequest ")
String msg = ""
@@ -95,7 +95,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("Exit preProcessRequest ")
}
- public void sequenceResoure(DelegateExecution execution) {
+ void sequenceResoure(DelegateExecution execution) {
logger.trace("Start sequenceResoure Process ")
String incomingRequest = execution.getVariable("uuiRequest")
@@ -170,7 +170,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true"
//if no networkResource, get SDNC config from properties file
if( "false".equals(isContainsWanResource)) {
- String serviceNeedSDNC = "mso.workflow.custom." + serviceModelName + ".sdnc.need";
+ String serviceNeedSDNC = "mso.workflow.custom." + serviceModelName + ".sdnc.need"
isContainsWanResource = BPMNProperties.getProperty(serviceNeedSDNC, isContainsWanResource)
}
@@ -181,7 +181,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("COMPLETED sequenceResoure Process ")
}
- public prepareServiceTopologyRequest(DelegateExecution execution) {
+ void prepareServiceTopologyRequest(DelegateExecution execution) {
logger.trace("======== Start prepareServiceTopologyRequest Process ======== ")
@@ -201,7 +201,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("======== End prepareServiceTopologyRequest Process ======== ")
}
- public void getCurrentResoure(DelegateExecution execution){
+ void getCurrentResoure(DelegateExecution execution){
logger.trace("Start getCurrentResoure Process ")
def currentIndex = execution.getVariable("currentResourceIndex")
List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
@@ -211,7 +211,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("COMPLETED getCurrentResource Process ")
}
- public void parseNextResource(DelegateExecution execution){
+ void parseNextResource(DelegateExecution execution){
logger.trace("Start parseNextResource Process ")
def currentIndex = execution.getVariable("currentResourceIndex")
def nextIndex = currentIndex + 1
@@ -225,7 +225,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("COMPLETED parseNextResource Process ")
}
- public void prepareResourceRecipeRequest(DelegateExecution execution){
+ void prepareResourceRecipeRequest(DelegateExecution execution){
logger.trace("Start prepareResourceRecipeRequest Process ")
ResourceInput resourceInput = new ResourceInput()
String serviceInstanceName = execution.getVariable("serviceInstanceName")
@@ -242,7 +242,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
resourceInput.setServiceType(serviceType)
resourceInput.setServiceInstanceId(serviceInstanceId)
resourceInput.setOperationId(operationId)
- resourceInput.setOperationType(operationType);
+ resourceInput.setOperationType(operationType)
def currentIndex = execution.getVariable("currentResourceIndex")
List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
Resource currentResource = sequencedResourceList.get(currentIndex)
@@ -284,7 +284,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("COMPLETED prepareResourceRecipeRequest Process ")
}
- public void executeResourceRecipe(DelegateExecution execution){
+ void executeResourceRecipe(DelegateExecution execution){
logger.trace("Start executeResourceRecipe Process ")
try {
@@ -338,7 +338,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
}
}
- public void postConfigRequest(DelegateExecution execution){
+ void postConfigRequest(DelegateExecution execution){
//now do noting
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
for (VnfResource resource : serviceDecomposition.vnfResources) {
@@ -346,4 +346,4 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
}
execution.setVariable("serviceDecomposition", serviceDecomposition)
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
index bf52b11de2..64d9827c7c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
@@ -83,7 +83,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
- public void preProcessRequest (DelegateExecution execution) {
+ void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
logger.trace("preProcessRequest")
@@ -286,7 +286,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit preProcessRequest")
}
- public void getAAICustomerById (DelegateExecution execution) {
+ void getAAICustomerById (DelegateExecution execution) {
// https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId}
try {
@@ -306,7 +306,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
}
- public void putServiceInstance(DelegateExecution execution) {
+ void putServiceInstance(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("putServiceInstance")
String msg = ""
@@ -380,7 +380,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit putServiceInstance")
}
- public void preProcessSDNCAssignRequest(DelegateExecution execution) {
+ void preProcessSDNCAssignRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
logger.trace("preProcessSDNCAssignRequest")
@@ -479,7 +479,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit preProcessSDNCAssignRequest")
}
- public void postProcessSDNCAssign (DelegateExecution execution) {
+ void postProcessSDNCAssign (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("postProcessSDNCAssign")
try {
@@ -518,7 +518,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit postProcessSDNCAssign")
}
- public void postProcessAAIGET2(DelegateExecution execution) {
+ void postProcessAAIGET2(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("postProcessAAIGET2")
String msg = ""
@@ -561,7 +561,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit postProcessAAIGET2")
}
- public void preProcessRollback (DelegateExecution execution) {
+ void preProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("preProcessRollback")
try {
@@ -582,7 +582,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit preProcessRollback")
}
- public void postProcessRollback (DelegateExecution execution) {
+ void postProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("postProcessRollback")
String msg = ""
@@ -603,7 +603,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit postProcessRollback")
}
- public void createProject(DelegateExecution execution) {
+ void createProject(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("createProject")
@@ -631,7 +631,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit createProject")
}
- public void createOwningEntity(DelegateExecution execution) {
+ void createOwningEntity(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("createOwningEntity")
String msg = "";
@@ -679,7 +679,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
// Build Error Section
// *******************************
- public void processJavaException(DelegateExecution execution){
+ void processJavaException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try{
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy
index 1eeba493f4..af82bf091a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy
@@ -69,7 +69,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
String Prefix="DCRESIRB_"
- public void preProcessRequest(DelegateExecution execution) {
+ void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
String msg = ""
@@ -139,7 +139,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
logger.trace("Exit preProcessRequest")
}
- public void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
logger.trace("validateSDNCResponse")
String msg = ""
@@ -172,7 +172,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
logger.trace("Exit validateSDNCResponse")
}
- public void postProcessRequest(DelegateExecution execution) {
+ void postProcessRequest(DelegateExecution execution) {
logger.trace("postProcessRequest")
String msg = ""
@@ -206,7 +206,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
}
- public void processRollbackException(DelegateExecution execution){
+ void processRollbackException(DelegateExecution execution){
logger.trace("processRollbackException")
try{
@@ -224,7 +224,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
logger.debug("Exit processRollbackException")
}
- public void processRollbackJavaException(DelegateExecution execution){
+ void processRollbackJavaException(DelegateExecution execution){
logger.trace("processRollbackJavaException")
try{
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
index eab99df9b2..1517a335d9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
@@ -61,7 +61,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
* generate the nsOperationKey
* generate the nsParameters
*/
- public void preProcessRequest (DelegateExecution execution) {
+ void preProcessRequest (DelegateExecution execution) {
String msg = ""
logger.trace("preProcessRequest()")
try {
@@ -130,7 +130,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* create NS task
*/
- public void createNetworkService(DelegateExecution execution) {
+ void createNetworkService(DelegateExecution execution) {
logger.trace("createNetworkService")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
@@ -157,7 +157,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* instantiate NS task
*/
- public void instantiateNetworkService(DelegateExecution execution) {
+ void instantiateNetworkService(DelegateExecution execution) {
logger.trace("instantiateNetworkService")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
@@ -186,7 +186,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* query NS task
*/
- public void queryNSProgress(DelegateExecution execution) {
+ void queryNSProgress(DelegateExecution execution) {
logger.trace("queryNSProgress")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
@@ -206,7 +206,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* delay 5 sec
*/
- public void timeDelay(DelegateExecution execution) {
+ void timeDelay(DelegateExecution execution) {
try {
Thread.sleep(5000);
} catch(InterruptedException e) {
@@ -217,7 +217,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* finish NS task
*/
- public void addNSRelationship(DelegateExecution execution) {
+ void addNSRelationship(DelegateExecution execution) {
logger.trace("addNSRelationship")
String nsInstanceId = execution.getVariable("nsInstanceId")
if(nsInstanceId == null || nsInstanceId == ""){
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
index cf3a0ef56f..a88becad1a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
@@ -7,7 +7,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -25,7 +25,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
@@ -33,8 +33,8 @@ import javax.xml.parsers.DocumentBuilderFactory
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONArray;
-import org.json.JSONObject;
+import org.json.JSONArray
+import org.json.JSONObject
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -44,7 +44,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.web.util.UriUtils;
+import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.Node
@@ -79,7 +79,7 @@ import groovy.json.*
* Rollback - Deferred
*/
public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstance.class)
String Prefix="DDELSI_"
@@ -151,7 +151,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
execution.setVariable("siParamsXml", siParamsXml)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.info(msg)
@@ -271,7 +271,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
logger.info("sdncDelete:\n" + sdncDelete)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch(Exception ex) {
msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
logger.info(msg)
@@ -302,7 +302,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
}
} catch (BpmnError e) {
- throw e;
+ throw e
} catch(Exception ex) {
msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage()
logger.info(msg)
@@ -337,8 +337,8 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
//Confirm there are no related service instances (vnf/network or volume)
if (utils.nodeExists(siData, "relationship-list")) {
logger.info("SI Data relationship-list exists:")
- InputSource source = new InputSource(new StringReader(siData));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ InputSource source = new InputSource(new StringReader(siData))
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance()
DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
Document serviceXml = docBuilder.parse(source)
serviceXml.getDocumentElement().normalize()
@@ -433,7 +433,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
logger.info("Service-instance NOT found in AAI. Silent Success")
}
}catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
logger.info(msg)
@@ -452,7 +452,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
String serviceType = execution.getVariable("serviceType")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- AAIResourcesClient resourceClient = new AAIResourcesClient();
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
resourceClient.delete(serviceInstanceUri)
@@ -535,7 +535,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
}catch(Exception e){
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), e);
+ ErrorCode.UnknownError.getValue(), e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preInitResourcesOperStatus Process ")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index 481a79a7ef..34ea20ba62 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -90,7 +90,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String Prefix="DDEESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( DoDeleteE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteE2EServiceInstance.class)
public void preProcessRequest (DelegateExecution execution) {
@@ -158,7 +158,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("siParamsXml", siParamsXml)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.error(msg)
@@ -243,7 +243,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
// for sp-partner and others
else if (eKey.endsWith("-id")) {
jObj.put("resourceInstanceId", eValue)
- String resourceName = rt + eValue;
+ String resourceName = rt + eValue
jObj.put("resourceType", resourceName)
}
jObj.put("resourceLinkUrl", rl)
@@ -520,12 +520,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) {
resource.setResourceId(obj.get("resourceInstanceId"))
//deleteRealResourceList.add(resource)
- matches = true;
+ matches = true
} else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId")) || modelUuid.equals(obj.get("model-version-id")) ) {
resource.setResourceId(obj.get("resourceInstanceId"))
resource.setResourceInstanceName(obj.get("resourceType"))
//deleteRealResourceList.add(resource)
- matches = true;
+ matches = true
}
return matches
}
@@ -646,7 +646,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceType = execution.getVariable("serviceType")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- AAIResourcesClient resourceClient = new AAIResourcesClient();
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
resourceClient.delete(serviceInstanceUri)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy
index cbeb1d3d69..97eb3b3960 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2017 - 2019 Huawei Intellectual Property. All rights reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -34,7 +34,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
public class HandlePNF extends AbstractServiceTaskProcessor{
- private static final Logger logger = LoggerFactory.getLogger( HandlePNF.class);
+ private static final Logger logger = LoggerFactory.getLogger( HandlePNF.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -95,7 +95,7 @@ public class HandlePNF extends AbstractServiceTaskProcessor{
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
logger.debug("body: "+body)
setProgressUpdateVariables(execution, body)
logger.debug("exit postProcess for HandlePNF")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java
index d401522800..ce53044052 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,13 +25,15 @@ import java.util.Map;
import java.util.Optional;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AAICreateResources extends AAIResource {
+ private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class);
public void createAAIProject(String projectName, String serviceInstance) {
AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName);
@@ -89,6 +91,7 @@ public class AAICreateResources extends AAIResource {
Optional<GenericVnf> vnf = aaiResponse.asBean(GenericVnf.class);
return vnf;
} catch (Exception ex) {
+ logger.error("Exception in getVnfInstance", ex);
return Optional.empty();
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java
index 2526ca5c25..c489ef29ce 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,13 +24,19 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
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.springframework.stereotype.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegate {
+ private static final Logger logger = LoggerFactory.getLogger(AAIDeleteServiceInstance.class);
+
+ private static final String ERROR_MESSAGE =
+ "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI.";
+
ExceptionUtil exceptionUtil = new ExceptionUtil();
public void execute(DelegateExecution execution) throws Exception {
@@ -41,9 +47,8 @@ public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegat
getAaiClient().delete(serviceInstanceURI);
execution.setVariable("GENDS_SuccessIndicator", true);
} catch (Exception ex) {
- String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI."
- + ex.getMessage();
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ logger.error(ERROR_MESSAGE, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ERROR_MESSAGE + ex.getMessage());
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
index 493340c9ef..216f426ec0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
@@ -62,6 +62,7 @@ public class CheckAaiForPnfCorrelationIdDelegate implements JavaDelegate {
logger.debug("AAI entry is found for pnf correlation id {}: {}", PNF_CORRELATION_ID, isEntry);
execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry);
} catch (IOException e) {
+ logger.error("Exception in check AAI for pnf_correlation_id execution", e);
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
index d67e6ef0db..ee86ca4292 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
@@ -45,7 +45,7 @@ public class ConfigCheckerDelegate implements JavaDelegate {
private Logger logger = LoggerFactory.getLogger(ConfigCheckerDelegate.class);
// ERROR CODE for variable not found in the delegation Context
- private static int ERROR_CODE = 601;
+ private static final int ERROR_CODE = 601;
@Autowired
protected ExceptionBuilder exceptionUtil;
@@ -65,7 +65,7 @@ public class ConfigCheckerDelegate implements JavaDelegate {
delegateExecution.setVariable(MODEL_UUID, serviceModelUuid);
List<PnfResourceCustomization> pnfCustomizations =
catalogDbClient.getPnfResourceCustomizationByModelUuid(serviceModelUuid);
- if (pnfCustomizations != null && pnfCustomizations.size() >= 1) {
+ if (pnfCustomizations != null && !pnfCustomizations.isEmpty()) {
PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
boolean skipPostInstantiationConfiguration = pnfResourceCustomization.isSkipPostInstConf();
delegateExecution.setVariable(SKIP_POST_INSTANTIATION_CONFIGURATION,
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
index 6d73b61ab2..781ee5cda4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
@@ -48,6 +48,7 @@ public class CreateRelation implements JavaDelegate {
try {
pnfManagementImpl.createRelation(serviceInstanceId, pnfName);
} catch (Exception e) {
+ logger.error("An exception occurred when making service and pnf relation. Exception:", e);
new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999,
"An exception occurred when making service and pnf relation. Exception: " + e.getMessage());
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 357b571a5c..48061db887 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -90,7 +90,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
@Override
public synchronized Runnable unregister(String pnfCorrelationId) {
logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
- Runnable runnable = runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
+ Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
synchronized (updateInfoMap) {
for (int i = updateInfoMap.size() - 1; i >= 0; i--) {
if (!updateInfoMap.get(i).containsKey("pnfCorrelationId"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 1516f289fe..29dca19820 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -50,6 +50,7 @@ import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -99,11 +100,15 @@ public class ServicePluginFactory {
static {
try (InputStream is = ClassLoader.class.getResourceAsStream("/application.properties")) {
- Properties prop = new Properties();
- prop.load(is);
- OOF_DEFAULT_ENDPOINT = prop.getProperty("oof.default.endpoint");
- THIRD_SP_DEFAULT_ENDPOINT = prop.getProperty("third.sp.default.endpoint");
- INVENTORY_OSS_DEFAULT_ENDPOINT = prop.getProperty("inventory.oss.default.endpoint");
+ if (null != is) {
+ Properties prop = new Properties();
+ prop.load(is);
+ OOF_DEFAULT_ENDPOINT = prop.getProperty("oof.default.endpoint");
+ THIRD_SP_DEFAULT_ENDPOINT = prop.getProperty("third.sp.default.endpoint");
+ INVENTORY_OSS_DEFAULT_ENDPOINT = prop.getProperty("inventory.oss.default.endpoint");
+ } else {
+ logger.error("Failed to load property file, Either property file is missing or empty!");
+ }
} catch (IOException e) {
logger.error("Failed to load property file!");
}
@@ -434,7 +439,7 @@ public class ServicePluginFactory {
}
}
- logger.error("There is no matching logical link for allowed list :" + allowedList.toString());
+ logger.error("There is no matching logical link for allowed list :" + Arrays.toString(allowedList));
return null;
} else {
logger.info("link customization is not required");
@@ -850,31 +855,29 @@ public class ServicePluginFactory {
HttpRequestBase method = null;
HttpResponse httpResponse = null;
- try {
+ try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
int timeout = DEFAULT_TIME_OUT;
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout).build();
- HttpClient client = HttpClientBuilder.create().build();
-
- if ("POST".equals(methodType.toUpperCase())) {
+ if ("POST".equalsIgnoreCase(methodType)) {
HttpPost httpPost = new HttpPost(msbUrl);
httpPost.setConfig(requestConfig);
httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
method = httpPost;
- } else if ("PUT".equals(methodType.toUpperCase())) {
+ } else if ("PUT".equalsIgnoreCase(methodType)) {
HttpPut httpPut = new HttpPut(msbUrl);
httpPut.setConfig(requestConfig);
httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
method = httpPut;
- } else if ("GET".equals(methodType.toUpperCase())) {
+ } else if ("GET".equalsIgnoreCase(methodType)) {
HttpGet httpGet = new HttpGet(msbUrl);
httpGet.setConfig(requestConfig);
httpGet.addHeader("X-FromAppId", "MSO");
httpGet.addHeader("Accept", "application/json");
method = httpGet;
- } else if ("DELETE".equals(methodType.toUpperCase())) {
+ } else if ("DELETE".equalsIgnoreCase(methodType)) {
HttpDelete httpDelete = new HttpDelete(msbUrl);
httpDelete.setConfig(requestConfig);
method = httpDelete;
@@ -897,9 +900,6 @@ public class ServicePluginFactory {
method = null;
return responseContent;
- } catch (SocketTimeoutException | ConnectTimeoutException e) {
- return null;
-
} catch (Exception e) {
return null;
@@ -908,13 +908,14 @@ public class ServicePluginFactory {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch (Exception e) {
+ logger.debug("Exception while executing finally block", e);
}
}
if (method != null) {
try {
method.reset();
} catch (Exception e) {
-
+ logger.debug("Exception while executing finally block", e);
}
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index f7708b69d3..f933277f3c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -27,6 +27,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -41,7 +42,6 @@ import org.json.JSONObject;
import org.onap.msb.sdk.discovery.common.RouteException;
import org.onap.msb.sdk.httpclient.RestServiceCreater;
import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
-import org.onap.so.bpmn.core.BaseTask;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi;
import org.onap.so.db.request.beans.ResourceOperationStatus;
@@ -56,7 +56,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-public abstract class AbstractSdncOperationTask extends BaseTask {
+public abstract class AbstractSdncOperationTask implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class);
@@ -284,7 +284,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.info("exception: AbstractSdncOperationTask.updateProgress fail!");
logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception);
logger.error(LoggingAnchor.FIVE, MessageEnum.GENERAL_EXCEPTION.toString(),
- " updateProgress catch exception: ", this.getTaskName(), ErrorCode.UnknownError.getValue(),
+ " updateProgress catch exception: ", ErrorCode.UnknownError.getValue(),
exception.getClass().toString());
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
index 5b7f3bb432..16bd194f99 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
@@ -22,12 +22,12 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask;
import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.bpmn.core.BaseTask;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import org.springframework.stereotype.Component;
@Component
-public class SdncUnderlayVpnPreprocessTask extends BaseTask {
+public class SdncUnderlayVpnPreprocessTask implements JavaDelegate {
public static final String RESOURCE_OPER_TYPE = "resourceOperType";
@Override
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index 68cfd487b3..bd60fbe38c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -71,6 +71,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import com.google.common.base.Strings;
@Component
public class AAICreateTasks {
@@ -184,24 +185,35 @@ public class AAICreateTasks {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
OwningEntity owningEntity = serviceInstance.getOwningEntity();
- String owningEntityId = owningEntity.getOwningEntityId();
- String owningEntityName = owningEntity.getOwningEntityName();
- if (owningEntityId == null || "".equals(owningEntityId)) {
- String msg = "Exception in AAICreateOwningEntity. OwningEntityId is null.";
+ if (Strings.isNullOrEmpty(owningEntity.getOwningEntityId())
+ && Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
+ String msg = "Exception in AAICreateOwningEntity. OwningEntityId and Name are null.";
execution.setVariable("ErrorCreateOEAAI", msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ } else if (Strings.isNullOrEmpty(owningEntity.getOwningEntityId())
+ && !Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
+ if (aaiSIResources.existsOwningEntityName(owningEntity.getOwningEntityName())) {
+ org.onap.aai.domain.yang.OwningEntity aaiEntity =
+ aaiSIResources.getOwningEntityByName(owningEntity.getOwningEntityName());
+ owningEntity.setOwningEntityId(aaiEntity.getOwningEntityId());
+ owningEntity.setOwningEntityName(owningEntity.getOwningEntityName());
+ aaiSIResources.connectOwningEntityandServiceInstance(owningEntity, serviceInstance);
+ } else {
+ owningEntity.setOwningEntityId(UUID.randomUUID().toString());
+ aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
+ }
} else {
if (aaiSIResources.existsOwningEntity(owningEntity)) {
aaiSIResources.connectOwningEntityandServiceInstance(owningEntity, serviceInstance);
} else {
- if (owningEntityName == null || "".equals(owningEntityName)) {
+ if (Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
String msg =
"Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName.";
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
} else {
- if (aaiSIResources.existsOwningEntityName(owningEntityName)) {
+ if (aaiSIResources.existsOwningEntityName(owningEntity.getOwningEntityName())) {
String msg =
"Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)";
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg,
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
index 18ba91263b..15f8c5e4ef 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -80,6 +80,16 @@ public class AAIDeleteTasks {
@Autowired
private AAIInstanceGroupResources aaiInstanceGroupResources;
+ /**
+ * BPMN access method to delete the VfModule from A&AI.
+ *
+ * It will extract the genericVnf & VfModule from the BBObject.
+ *
+ * Before deleting it set the aaiVfModuleRollback as false & then it will delete the VfModule.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -89,10 +99,21 @@ public class AAIDeleteTasks {
aaiVfModuleResources.deleteVfModule(vfModule, genericVnf);
execution.setVariable("aaiVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteVfModule process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the Vnf from A&AI.
+ *
+ * It will extract the genericVnf from the BBObject.
+ *
+ * Before deleting it set the aaiVnfRollback as false & then it will delete the Vnf.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteVnf(BuildingBlockExecution execution) throws Exception {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -101,79 +122,154 @@ public class AAIDeleteTasks {
aaiVnfResources.deleteVnf(genericVnf);
execution.setVariable("aaiVnfRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the ServiceInstance from A&AI.
+ *
+ * It will extract the serviceInstance from the BBObject.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteServiceInstance(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiSIResources.deleteServiceInstance(serviceInstance);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteServiceInstance process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the l3network from A&AI.
+ *
+ * It will extract the l3network from the BBObject.
+ *
+ * After deleting the l3network it set the isRollbackNeeded as true.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteNetwork(BuildingBlockExecution execution) throws Exception {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.deleteNetwork(l3network);
execution.setVariable("isRollbackNeeded", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteNetwork process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the Collection from A&AI.
+ *
+ * It will extract the serviceInstance from the BBObject.
+ *
+ * Then it will get the collection from serviceinstance.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteCollection(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiNetworkResources.deleteCollection(serviceInstance.getCollection());
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteCollection process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the InstanceGroup from A&AI.
+ *
+ * It will extract the serviceInstance from the BBObject.
+ *
+ * Then it will get the Instance group from serviceInstance.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteInstanceGroup(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiNetworkResources.deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroup process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the VolumeGroup from A&AI.
+ *
+ * It will extract the volumeGroup from the BBObject and cloudRegion from execution object .
+ *
+ * Then it will delete from A&AI.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteVolumeGroup(BuildingBlockExecution execution) {
try {
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteVolumeGroup process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the Configuration from A&AI.
+ *
+ * It will extract the configuration from the BBObject.
+ *
+ * Then it will delete from A&AI.
+ *
+ * @param execution
+ */
public void deleteConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.deleteConfiguration(configuration);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteConfiguration process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the InstanceGroupVnf from A&AI.
+ *
+ * It will extract the instanceGroup from the BBObject.
+ *
+ * Then it will delete from A&AI.
+ *
+ * @param execution
+ */
public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
try {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroupVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
public void deleteNetworkPolicies(BuildingBlockExecution execution) {
try {
String fqdns = execution.getVariable(contrailNetworkPolicyFqdnList);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 20f4443291..86645391b4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -92,6 +92,7 @@ public class AAIUpdateTasks {
OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiServiceInstanceRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedService", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -108,6 +109,7 @@ public class AAIUpdateTasks {
aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveService", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -122,6 +124,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -136,6 +139,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -155,6 +159,7 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -174,6 +179,7 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -193,6 +199,7 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
OrchestrationStatus.CREATED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -215,6 +222,7 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -231,6 +239,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -247,6 +256,7 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
OrchestrationStatus.PENDING_ACTIVATION);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusPendingActivationVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -273,6 +283,9 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
}
} catch (Exception ex) {
+ logger.error(
+ "Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedOrPendingActivationVfModule",
+ ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -281,7 +294,7 @@ public class AAIUpdateTasks {
* BPMN access method to update status of VfModule to Created in AAI
*
* @param execution
- *
+ *
*/
public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
try {
@@ -289,6 +302,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -307,6 +321,7 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED);
execution.setVariable("aaiDeactivateVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -346,6 +361,7 @@ public class AAIUpdateTasks {
L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
updateNetworkAAI(l3Network, status);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -386,6 +402,7 @@ public class AAIUpdateTasks {
aaiCollectionResources.updateCollection(copiedNetworkCollection);
execution.setVariable("aaiNetworkCollectionActivateRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveNetworkCollection", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -403,6 +420,7 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
execution.setVariable("aaiActivateVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -423,6 +441,7 @@ public class AAIUpdateTasks {
vfModule.setHeatStackId(heatStackId);
aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -466,6 +485,7 @@ public class AAIUpdateTasks {
execution.setVariable("aaiNetworkActivateRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateNetworkCreated", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -495,6 +515,7 @@ public class AAIUpdateTasks {
}
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateNetworkUpdated", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -509,6 +530,7 @@ public class AAIUpdateTasks {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.updateNetwork(l3network);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateObjectNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -524,6 +546,7 @@ public class AAIUpdateTasks {
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiServiceInstanceResources.updateServiceInstance(serviceInstance);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateServiceInstance", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -538,6 +561,7 @@ public class AAIUpdateTasks {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateObjectVnf(genericVnf);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateObjectVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -559,6 +583,7 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiDeleteVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeleteVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -574,6 +599,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateModelVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -589,6 +615,7 @@ public class AAIUpdateTasks {
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,
OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignFabricConfiguration", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -603,6 +630,8 @@ public class AAIUpdateTasks {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateFabricConfiguration",
+ ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -618,6 +647,8 @@ public class AAIUpdateTasks {
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,
OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateFabricConfiguration",
+ ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -640,6 +671,7 @@ public class AAIUpdateTasks {
aaiVnfResources.updateObjectVnf(copiedGenericVnf);
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateIpv4OamAddressVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -662,6 +694,7 @@ public class AAIUpdateTasks {
aaiVnfResources.updateObjectVnf(copiedGenericVnf);
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateManagementV6AddressVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -681,6 +714,7 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateContrailServiceInstanceFqdnVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -695,6 +729,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigAssignedVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -704,12 +739,13 @@ public class AAIUpdateTasks {
*
* @param execution
*/
- public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution) {
+ public void updateOrchestrationStatusConfigDeployConfigureVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfigureVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -720,12 +756,13 @@ public class AAIUpdateTasks {
*
* @param execution
*/
- public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution) {
+ public void updateOrchestrationStatusConfigDeployConfiguredVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfiguredVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 638ecefa49..d9c6857ef1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -33,6 +33,7 @@ import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables;
import org.camunda.bpm.engine.variable.VariableMap;
import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure;
import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -59,9 +60,18 @@ public class ExecuteActivity implements JavaDelegate {
private static final String VNF_ID = "vnfId";
private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
private static final String WORKFLOW_SYNC_ACK_SENT = "workflowSyncAckSent";
+ private static final String BUILDING_BLOCK = "buildingBlock";
+ private static final String EXECUTE_BUILDING_BLOCK = "ExecuteBuildingBlock";
+ private static final String RETRY_COUNT = "retryCount";
+ private static final String A_LA_CARTE = "aLaCarte";
+ private static final String SUPPRESS_ROLLBACK = "suppressRollback";
+ private static final String WORKFLOW_EXCEPTION = "WorkflowException";
+ private static final String HANDLING_CODE = "handlingCode";
+ private static final String ABORT_HANDLING_CODE = "Abort";
private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation";
private static final String ACTIVITY_PREFIX = "activity:";
+ private static final String EXECUTE_ACTIVITY_ERROR_MESSAGE = "ExecuteActivityErrorMessage";
private ObjectMapper mapper = new ObjectMapper();
@@ -70,12 +80,15 @@ public class ExecuteActivity implements JavaDelegate {
@Autowired
private ExceptionBuilder exceptionBuilder;
@Autowired
+ private WorkflowActionBBFailure workflowActionBBFailure;
+ @Autowired
private WorkflowActionBBTasks workflowActionBBTasks;
@Override
public void execute(DelegateExecution execution) throws Exception {
final String requestId = (String) execution.getVariable(G_REQUEST_ID);
-
+ WorkflowException workflowException = null;
+ String handlingCode = null;
try {
Boolean workflowSyncAckSent = (Boolean) execution.getVariable(WORKFLOW_SYNC_ACK_SENT);
if (workflowSyncAckSent == null || workflowSyncAckSent == false) {
@@ -95,30 +108,44 @@ public class ExecuteActivity implements JavaDelegate {
ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock);
Map<String, Object> variables = new HashMap<>();
- variables.put("buildingBlock", executeBuildingBlock);
- variables.put(G_REQUEST_ID, requestId);
- variables.put("retryCount", 1);
- variables.put("aLaCarte", true);
- execution.getVariables().forEach((key, value) -> {
- if (value instanceof Serializable) {
- variables.put(key, (Serializable) value);
- }
- });
+ if (execution.getVariables() != null) {
+ execution.getVariables().forEach((key, value) -> {
+ if (value instanceof Serializable) {
+ variables.put(key, (Serializable) value);
+ }
+ });
+ }
+
+ variables.put(BUILDING_BLOCK, executeBuildingBlock);
+ variables.put(G_REQUEST_ID, requestId);
+ variables.put(RETRY_COUNT, 1);
+ variables.put(A_LA_CARTE, true);
+ variables.put(SUPPRESS_ROLLBACK, true);
ProcessInstanceWithVariables buildingBlockResult =
- runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables)
+ runtimeService.createProcessInstanceByKey(EXECUTE_BUILDING_BLOCK).setVariables(variables)
.executeWithVariablesInReturn();
VariableMap variableMap = buildingBlockResult.getVariables();
- WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException");
+ workflowException = (WorkflowException) variableMap.get(WORKFLOW_EXCEPTION);
if (workflowException != null) {
logger.error("Workflow exception is: {}", workflowException.getErrorMessage());
}
- execution.setVariable("WorkflowException", workflowException);
+
+ handlingCode = (String) variableMap.get(HANDLING_CODE);
+ logger.debug("Handling code: " + handlingCode);
+
+ execution.setVariable(WORKFLOW_EXCEPTION, workflowException);
} catch (Exception e) {
buildAndThrowException(execution, e.getMessage());
}
+
+ if (workflowException != null && handlingCode != null && handlingCode.equals(ABORT_HANDLING_CODE)) {
+ logger.debug("Aborting execution of the custom workflow");
+ buildAndThrowException(execution, workflowException.getErrorMessage());
+ }
+
}
protected BuildingBlock buildBuildingBlock(String activityName) {
@@ -154,13 +181,15 @@ public class ExecuteActivity implements JavaDelegate {
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg, ex);
- execution.setVariable("ExecuteActivityErrorMessage", msg);
+ execution.setVariable(EXECUTE_ACTIVITY_ERROR_MESSAGE, msg);
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
protected void buildAndThrowException(DelegateExecution execution, String msg) {
logger.error(msg);
- execution.setVariable("ExecuteActuvityErrorMessage", msg);
+ execution.setVariable(EXECUTE_ACTIVITY_ERROR_MESSAGE, msg);
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
index 9396f9dbfc..4285e9aa84 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -47,6 +47,7 @@ import static org.apache.commons.lang3.StringUtils.*;
@Component
public class VnfAdapterCreateTasks {
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class);
public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_";
private static final String VNFREST_REQUEST = "VNFREST_Request";
@@ -85,7 +86,9 @@ public class VnfAdapterCreateTasks {
+ " exists in gBuildingBlock but does not have a selflink value");
}
} catch (BBObjectNotFoundException bbException) {
- // If there is not a vf module in the general building block (in aLaCarte case), we will not retrieve
+ logger.error("Exception occurred", bbException);
+ // If there is not a vf module in the general building block (in aLaCarte case),
+ // we will not retrieve
// the SDNCQueryResponse and proceed as normal without throwing an error
}
@@ -94,6 +97,7 @@ public class VnfAdapterCreateTasks {
genericVnf, volumeGroup, sdncVfModuleQueryResponse);
execution.setVariable(VNFREST_REQUEST, createVolumeGroupRequest.toXmlString());
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -117,6 +121,8 @@ public class VnfAdapterCreateTasks {
try {
volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch (BBObjectNotFoundException bbException) {
+ logger.error("Exception occurred if bb objrct not found in VnfAdapterCreateTasks createVfModule ",
+ bbException);
}
CloudRegion cloudRegion = gBBInput.getCloudRegion();
RequestContext requestContext = gBBInput.getRequestContext();
@@ -129,9 +135,9 @@ public class VnfAdapterCreateTasks {
volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString());
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
index f5bae2c82a..c3c0047fff 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
@@ -21,14 +21,32 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import javax.net.ssl.SSLContext;
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
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.web.client.RestTemplate;
/**
@@ -40,13 +58,55 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class VnfmAdapterCreateVnfTaskConfiguration {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterCreateVnfTaskConfiguration.class);
+
+ @Value("${rest.http.client.configuration.ssl.trustStore:#{null}}")
+ private Resource trustStore;
+
+ @Value("${rest.http.client.configuration.ssl.trustStorePassword:#{null}}")
+ private String trustStorePassword;
+
+ @Value("${rest.http.client.configuration.ssl.keyStore:#{null}}")
+ private Resource keyStoreResource;
+
+ @Value("${rest.http.client.configuration.ssl.keyStorePassword:#{null}}")
+ private String keyStorePassword;
+
@Bean
public HttpRestServiceProvider databaseHttpRestServiceProvider(
@Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
@Autowired final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
+ if (trustStore != null) {
+ setTrustStore(restTemplate);
+ }
return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(etsiVnfmAdapter.getAuth()));
}
+ private void setTrustStore(final RestTemplate restTemplate) {
+ SSLContext sslContext;
+ try {
+ if (keyStoreResource != null) {
+ KeyStore keystore = KeyStore.getInstance("pkcs12");
+ keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
+ sslContext =
+ new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray())
+ .loadKeyMaterial(keystore, keyStorePassword.toCharArray()).build();
+ } else {
+ sslContext = new SSLContextBuilder()
+ .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build();
+ }
+ logger.info("Setting truststore: {}", trustStore.getURL());
+ final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
+ final HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
+ final HttpComponentsClientHttpRequestFactory factory =
+ new HttpComponentsClientHttpRequestFactory(httpClient);
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
+ } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
+ | IOException | UnrecoverableKeyException exception) {
+ logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception);
+ }
+ }
+
private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
final HttpHeadersProvider httpHeadersProvider) {
return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index 43790544bf..3bf9720036 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -23,8 +23,12 @@
package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.HashMap;
+import java.util.List;
import java.util.Optional;
import org.onap.so.logger.LoggingAnchor;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -33,9 +37,14 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.aai.AAIObjectType;
+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.appc.ApplicationControllerAction;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIVnfResources;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.logger.ErrorCode;
@@ -60,6 +69,8 @@ public class AppcRunTasks {
private CatalogDbClient catalogDbClient;
@Autowired
private ApplicationControllerAction appCClient;
+ @Autowired
+ private AAIVnfResources aaiVnfResources;
public void preProcessActivity(BuildingBlockExecution execution) {
execution.setVariable("actionSnapshot", Action.Snapshot);
@@ -79,6 +90,22 @@ public class AppcRunTasks {
execution.setVariable(ROLLBACK_VNF_STOP, false);
execution.setVariable(ROLLBACK_VNF_LOCK, false);
execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false);
+ execution.setVariable("vmIdList", null);
+ execution.setVariable("vserverIdList", null);
+
+ GenericVnf vnf = null;
+ try {
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists");
+ }
+
+ try {
+ getVserversForAppc(execution, vnf);
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Unable to retrieve vservers");
+ }
+
}
public void runAppcCommand(BuildingBlockExecution execution, Action action) {
@@ -161,7 +188,7 @@ public class AppcRunTasks {
}
protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
- if (appcCode.equals("0") && action != null) {
+ if (appcCode != null && appcCode.equals("0") && action != null) {
if (action.equals(Action.Lock)) {
execution.setVariable(ROLLBACK_VNF_LOCK, true);
} else if (action.equals(Action.Unlock)) {
@@ -190,4 +217,45 @@ public class AppcRunTasks {
payloadInfo.put("vfModuleId", vfModuleId);
return payloadInfo;
}
+
+ protected void getVserversForAppc(BuildingBlockExecution execution, GenericVnf vnf) throws Exception {
+ AAIResultWrapper aaiRW = aaiVnfResources.queryVnfWrapperById(vnf);
+
+ if (aaiRW != null && aaiRW.getRelationships() != null && aaiRW.getRelationships().isPresent()) {
+ Relationships relationships = aaiRW.getRelationships().get();
+ if (relationships != null) {
+ List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
+ JSONArray vserverIds = new JSONArray();
+ JSONArray vserverSelfLinks = new JSONArray();
+ if (vserverUris != null) {
+ for (AAIResourceUri j : vserverUris) {
+ if (j != null) {
+ if (j.getURIKeys() != null) {
+ String vserverId = j.getURIKeys().get("vserver-id");
+ vserverIds.put(vserverId);
+ }
+ Optional<Vserver> oVserver = aaiVnfResources.getVserver(j);
+ if (oVserver.isPresent()) {
+ Vserver vserver = oVserver.get();
+ if (vserver != null) {
+ String vserverSelfLink = vserver.getVserverSelflink();
+ vserverSelfLinks.put(vserverSelfLink);
+ }
+ }
+ }
+ }
+ }
+
+ JSONObject vmidsArray = new JSONObject();
+ JSONObject vserveridsArray = new JSONObject();
+ vmidsArray.put("vmIds", vserverSelfLinks.toString());
+ vserveridsArray.put("vserverIds", vserverIds.toString());
+ logger.debug("vmidsArray is: {}", vmidsArray.toString());
+ logger.debug("vserveridsArray is: {}", vserveridsArray.toString());
+
+ execution.setVariable("vmIdList", vmidsArray.toString());
+ execution.setVariable("vserverIdList", vserveridsArray.toString());
+ }
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
index cdbe0db57c..6a8058938f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
@@ -62,7 +62,7 @@ public class ConfigDeployVnf {
* @param execution
*/
public void updateAAIConfigure(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+ aaiUpdateTask.updateOrchestrationStatusConfigDeployConfigureVnf(execution);
}
@@ -129,7 +129,7 @@ public class ConfigDeployVnf {
* @param execution
*/
public void updateAAIConfigured(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+ aaiUpdateTask.updateOrchestrationStatusConfigDeployConfiguredVnf(execution);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
index 7466df53b2..c9a937b824 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
@@ -30,8 +30,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAINetworkResources;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -61,10 +59,10 @@ public class UnassignNetworkBB {
* @param execution - BuildingBlockExecution
* @param relatedToValue - String, ex: vf-module
* @return void - nothing
- * @throws Exception
+ *
*/
- public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) throws Exception {
+ public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
@@ -85,10 +83,10 @@ public class UnassignNetworkBB {
*
* @param execution - BuildingBlockExecution
* @return void - nothing
- * @throws Exception
+ *
*/
- public void getCloudSdncRegion(BuildingBlockExecution execution) throws Exception {
+ public void getCloudSdncRegion(BuildingBlockExecution execution) {
try {
String cloudRegionSdnc = networkBBUtils.getCloudRegion(execution, SourceSystem.SDNC);
execution.setVariable("cloudRegionSdnc", cloudRegionSdnc);
@@ -107,7 +105,7 @@ public class UnassignNetworkBB {
String msg;
boolean isRollbackNeeded =
execution.getVariable("isRollbackNeeded") != null ? execution.getVariable("isRollbackNeeded") : false;
- if (isRollbackNeeded == true) {
+ if (isRollbackNeeded) {
msg = execution.getVariable("ErrorUnassignNetworkBB") + messageErrorRollback;
} else {
msg = execution.getVariable("ErrorUnassignNetworkBB");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
index e51774c12c..0afca71b99 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
@@ -30,12 +30,15 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component()
public class UnassignVnf {
+ private static final Logger logger = LoggerFactory.getLogger(UnassignVnf.class);
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -45,6 +48,17 @@ public class UnassignVnf {
@Autowired
private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator;
+ /**
+ * BPMN access method to deleting instanceGroup in AAI.
+ *
+ * It will extract the vnf from BBobject ,It will get the instance group from the vnf and add it into a list.
+ *
+ * Then iterate that list and check the ModelInfoInstanceGroup type.
+ *
+ * Then it will delete that.
+ *
+ * @param execution
+ */
public void deleteInstanceGroups(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -56,6 +70,7 @@ public class UnassignVnf {
}
}
} catch (Exception ex) {
+ logger.error("Exception occurred in UnassignVnf deleteInstanceGroups", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
index b85e33144f..f61b40ad23 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
@@ -52,6 +52,7 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCActivateTasks extends AbstractSDNCTask {
+ private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class);
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCVnfResources sdncVnfResources;
@@ -66,6 +67,13 @@ public class SDNCActivateTasks extends AbstractSDNCTask {
@Autowired
private Environment env;
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for activate the vnf.
+ *
+ * @param execution
+ */
public void activateVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -82,13 +90,14 @@ public class SDNCActivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCActivateTasks activateVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to perform Assign action on SDNC for L3Network
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -112,6 +121,13 @@ public class SDNCActivateTasks extends AbstractSDNCTask {
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for activate the activateVfModule.
+ *
+ * @param execution
+ */
public void activateVfModule(BuildingBlockExecution execution) {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
@@ -131,6 +147,7 @@ public class SDNCActivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCActivateTasks activateVfModule process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
index 1dcdfa912c..b8f5c8629d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
@@ -96,6 +96,7 @@ public class SDNCAssignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.SERVICE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -117,7 +118,6 @@ public class SDNCAssignTasks extends AbstractSDNCTask {
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
SDNCRequest sdncRequest = new SDNCRequest();
-
GenericResourceApiVnfOperationInformation req =
sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext,
Boolean.TRUE.equals(vnf.isCallHoming()), buildCallbackURI(sdncRequest));
@@ -125,10 +125,12 @@ public class SDNCAssignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
/**
* BPMN access method to assigning the vfModule in SDNC.
*
@@ -160,6 +162,7 @@ public class SDNCAssignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
index 3c42f76d73..96b656ff95 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
@@ -53,6 +53,7 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCDeactivateTasks extends AbstractSDNCTask {
+ private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class);
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCNetworkResources sdncNetworkResources;
@@ -69,6 +70,12 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
@Autowired
private Environment env;
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object. Which is used for deactivate
+ * VfModule.
+ *
+ * @param execution
+ */
public void deactivateVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -86,13 +93,14 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to perform Service Topology Deactivate action on SDNC for Vnf
- *
+ *
* @param execution
* @throws Exception
*/
@@ -113,15 +121,16 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/*
* BPMN access method to perform Service Topology Deactivate action on SDNC for Service Instance
- *
+ *
* @param execution
- *
+ *
* @throws Exception
*/
public void deactivateServiceInstance(BuildingBlockExecution execution) throws Exception {
@@ -138,13 +147,14 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.SERVICE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateServiceInstance", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to invoke deactivate on a L3Network object
- *
+ *
* @param execution
*/
public void deactivateNetwork(BuildingBlockExecution execution) {
@@ -163,6 +173,7 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.NETWORK);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 7478479a86..080d6d34b1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -40,7 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
- * This class is used for quering the SDNC
+ * This class is used for querying the SDNC.
*/
@Component
public class SDNCQueryTasks {
@@ -78,16 +78,19 @@ public class SDNCQueryTasks {
String response = sdncVnfResources.queryVnf(genericVnf);
execution.setVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId(), response);
} catch (BadResponseException ex) {
+ logger.error("Exception occurred", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
} else {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
+
/**
* BPMN access method to query the SDNC for fetching the VfModule details.
*
@@ -116,12 +119,14 @@ public class SDNCQueryTasks {
+ " exists in gBuildingBlock but does not have a selflink value");
}
} catch (BadResponseException ex) {
+ logger.error("Exception occurred for BadResponse ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
} else {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -144,20 +149,26 @@ public class SDNCQueryTasks {
+ " exists in gBuildingBlock but does not have a selflink value");
}
} catch (BBObjectNotFoundException bbException) {
- // If there is not a vf module in the general building block, we will not call SDNC and proceed as normal
+ logger.error("Error occurred if bb object not found in SDNCQueryTasks queryVfModuleForVolumeGroup ",
+ bbException);
+ // If there is not a vf module in the general building block, we will not call
+ // SDNC and proceed as normal
// without throwing an error
- // If we see a bb object not found exception for something that is not a vf module id, then we should throw
+ // If we see a bb object not found exception for something that is not a vf
+ // module id, then we should throw
// the error as normal
if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO);
}
} catch (BadResponseException ex) {
+ logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
} else {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
index e3c9785ab2..4817ba8b61 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
@@ -53,6 +53,7 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCUnassignTasks extends AbstractSDNCTask {
+ private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class);
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCServiceInstanceResources sdncSIResources;
@@ -69,6 +70,13 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
@Autowired
private Environment env;
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the ServiceInstance.
+ *
+ * @param execution
+ */
public void unassignServiceInstance(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -83,10 +91,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.SERVICE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignServiceInstance", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the VfModule.
+ *
+ * @param execution
+ */
public void unassignVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -102,10 +118,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the Vnf.
+ *
+ * @param execution
+ */
public void unassignVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -122,10 +146,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the Network.
+ *
+ * @param execution
+ */
public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -144,6 +176,7 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.NETWORK);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
index fc3f2aec7a..52d294955a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
@@ -23,10 +23,10 @@ package org.onap.so.bpmn.infrastructure.validations;
import java.util.Optional;
import java.util.regex.Pattern;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.listener.Skip;
import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.listener.Skip;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index 7eaf011c75..64f0072991 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -55,7 +55,6 @@ public class OrchestrationStatusValidator {
private static final String MULTI_STAGE_DESIGN_OFF = "false";
private static final String MULTI_STAGE_DESIGN_ON = "true";
-
@Autowired
private ExtractPojosForBB extractPojosForBB;
@Autowired
@@ -63,6 +62,7 @@ public class OrchestrationStatusValidator {
@Autowired
private CatalogDbClient catalogDbClient;
+
/**
* This method validate's the status of the OrchestrationStatus against the buildingBlockDetail ResourceType
*
@@ -137,7 +137,8 @@ public class OrchestrationStatusValidator {
OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
return;
default:
- // can't currently get here, so not tested. Added in case enum is expanded without a change to this
+ // can't currently get here, so not tested. Added in case enum is expanded
+ // without a change to this
// code
throw new OrchestrationStatusValidationException(
String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName,
@@ -152,16 +153,6 @@ public class OrchestrationStatusValidator {
.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(),
orchestrationStatus, buildingBlockDetail.getTargetAction());
- if (aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType())
- && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction())
- && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) {
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
- extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution,
- previousOrchestrationStatusValidationResult, genericVnf,
- orchestrationStatusStateTransitionDirective);
- }
-
if (orchestrationStatusStateTransitionDirective
.getFlowDirective() == OrchestrationStatusValidationDirective.FAIL) {
throw new OrchestrationStatusValidationException(
@@ -172,6 +163,9 @@ public class OrchestrationStatusValidator {
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
orchestrationStatusStateTransitionDirective.getFlowDirective());
} catch (BBObjectNotFoundException ex) {
+ logger.error(
+ "Error occurred for bb object notfound in OrchestrationStatusValidator validateOrchestrationStatus ",
+ ex);
if (execution.getFlowToBeCalled().contains("Unassign")) {
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
OrchestrationStatusValidationDirective.SILENT_SUCCESS);
@@ -179,26 +173,8 @@ public class OrchestrationStatusValidator {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
}
} catch (Exception e) {
+ logger.error("Exception occurred", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
}
}
-
- private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(
- BuildingBlockExecution execution,
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult,
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf,
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) {
- if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult
- .equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) {
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (genericVnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- }
- }
- return orchestrationStatusStateTransitionDirective;
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 78cb533c9e..1f07166b60 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -93,6 +93,7 @@ public class WorkflowAction {
private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
private static final String SERVICE_INSTANCES = "serviceInstances";
+ private static final String SERVICE_INSTANCE = "serviceInstance";
private static final String VF_MODULES = "vfModules";
private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI =
"WorkflowAction was unable to verify if the instance name already exist in AAI.";
@@ -107,7 +108,7 @@ public class WorkflowAction {
private static final String ASSIGNINSTANCE = "assignInstance";
private static final String CREATEINSTANCE = "createInstance";
private static final String USERPARAMSERVICE = "service";
- private static final String supportedTypes =
+ private static final String SUPPORTEDTYPES =
"vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups";
private static final String HOMINGSOLUTION = "Homing_Solution";
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
@@ -123,6 +124,8 @@ public class WorkflowAction {
private static final String NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID =
"(%s), same parent and different customization id (%s)";
private static final String NAME_EXISTS_WITH_DIFF_PARENT = "(%s) id (%s) and different parent relationship";
+ private static final String CREATENETWORKBB = "CreateNetworkBB";
+ private static final String ACTIVATENETWORKBB = "ActivateNetworkBB";
@Autowired
protected BBInputSetup bbInputSetup;
@@ -183,12 +186,14 @@ public class WorkflowAction {
try {
cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner();
} catch (Exception ex) {
+ logger.error("Exception in getCloundOwner", ex);
cloudOwner = environment.getProperty(defaultCloudOwner);
}
boolean suppressRollback = false;
try {
suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
} catch (Exception ex) {
+ logger.error("Exception in getSuppressRollback", ex);
suppressRollback = false;
}
execution.setVariable("suppressRollback", suppressRollback);
@@ -209,7 +214,7 @@ public class WorkflowAction {
} else {
resourceId = resource.getResourceId();
}
- if ((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE) {
+ if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) {
serviceInstanceId = resourceId;
}
execution.setVariable("resourceId", resourceId);
@@ -300,9 +305,9 @@ public class WorkflowAction {
traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
}
} else if (resourceType == WorkflowType.SERVICE
- && (requestAction.equalsIgnoreCase("activateInstance")
- || requestAction.equalsIgnoreCase("unassignInstance")
- || requestAction.equalsIgnoreCase("deleteInstance")
+ && ("activateInstance".equalsIgnoreCase(requestAction)
+ || "unassignInstance".equalsIgnoreCase(requestAction)
+ || "deleteInstance".equalsIgnoreCase(requestAction)
|| requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
// SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
// SERVICE-MACRO-DELETE
@@ -310,10 +315,10 @@ public class WorkflowAction {
// to query the SI in AAI to find related instances.
traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
} else if (resourceType == WorkflowType.SERVICE
- && requestAction.equalsIgnoreCase("deactivateInstance")) {
+ && "deactivateInstance".equalsIgnoreCase(requestAction)) {
resourceCounter.add(new Resource(WorkflowType.SERVICE, "", false));
- } else if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance")
- || (requestAction.equalsIgnoreCase("recreateInstance")))) {
+ } else if (resourceType == WorkflowType.VNF && ("replaceInstance".equalsIgnoreCase(requestAction)
+ || ("recreateInstance".equalsIgnoreCase(requestAction)))) {
traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(),
workflowResourceIds.getVnfId(), aaiResourceIds);
} else {
@@ -363,7 +368,7 @@ public class WorkflowAction {
sIRequest.getRequestDetails().getRequestParameters().getUserParams();
for (Map<String, Object> params : userParams) {
if (params.containsKey(HOMINGSOLUTION)) {
- if (params.get(HOMINGSOLUTION).equals("none")) {
+ if ("none".equals(params.get(HOMINGSOLUTION))) {
execution.setVariable("homing", false);
} else {
execution.setVariable("homing", true);
@@ -372,7 +377,7 @@ public class WorkflowAction {
}
}
- if (flowsToExecute.isEmpty()) {
+ if (flowsToExecute == null || flowsToExecute.isEmpty()) {
throw new IllegalStateException("Macro did not come up with a valid execution path.");
}
List<String> flowNames = new ArrayList<>();
@@ -447,7 +452,7 @@ public class WorkflowAction {
protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
for (OrchestrationFlow flow : orchFlows) {
- if (flow.getFlowName().contains("Configuration") && !flow.getFlowName().equals("ConfigurationScaleOutBB")) {
+ if (flow.getFlowName().contains(CONFIGURATION) && !"ConfigurationScaleOutBB".equals(flow.getFlowName())) {
return true;
}
}
@@ -715,7 +720,7 @@ public class WorkflowAction {
protected boolean vrfConfigurationAlreadyExists(RelatedInstance relatedVpnBinding, Configuration vrfConfiguration,
AAIResultWrapper configWrapper) throws VrfBondingServiceException {
- if (vrfConfiguration.getConfigurationType().equalsIgnoreCase("VRF-ENTRY")) {
+ if ("VRF-ENTRY".equalsIgnoreCase(vrfConfiguration.getConfigurationType())) {
Optional<Relationships> relationshipsConfigOp = configWrapper.getRelationships();
if (relationshipsConfigOp.isPresent()) {
Optional<VpnBinding> relatedInfraVpnBindingOp =
@@ -752,7 +757,7 @@ public class WorkflowAction {
if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) {
String toscaNodeType = collectionResourceCustomization.getCollectionResource()
.getInstanceGroup().getToscaNodeType();
- if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) {
+ if (toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION)) {
int minNetworks = 0;
org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
collectionResourceCustomization.getCollectionResource().getInstanceGroup();
@@ -885,6 +890,7 @@ public class WorkflowAction {
}
}
} catch (Exception ex) {
+ logger.error("Exception in traverseAAIService", ex);
buildAndThrowException(execution,
"Could not find existing Service Instance or related Instances to execute the request on.");
}
@@ -926,6 +932,7 @@ public class WorkflowAction {
}
}
} catch (Exception ex) {
+ logger.error("Exception in traverseAAIVnf", ex);
buildAndThrowException(execution,
"Could not find existing Vnf or related Instances to execute the request on.");
}
@@ -953,6 +960,7 @@ public class WorkflowAction {
}
}
} catch (Exception ex) {
+ logger.error("Exception in findConfigurationsInsideVfModule", ex);
buildAndThrowException(execution, "Failed to find Configuration object from the vfModule.");
}
}
@@ -1015,8 +1023,8 @@ public class WorkflowAction {
vfModuleCustomizationUUID =
vfModule.getModelInfo().getModelCustomizationUuid();
}
- if (!vnfCustomizationUUID.equals("")
- && !vfModuleCustomizationUUID.equals("")) {
+ if (!vnfCustomizationUUID.isEmpty()
+ && !vfModuleCustomizationUUID.isEmpty()) {
List<CvnfcConfigurationCustomization> configs =
traverseCatalogDbForConfiguration(
validate.getModelInfo().getModelVersionId(),
@@ -1110,7 +1118,7 @@ public class WorkflowAction {
protected Resource extractResourceIdAndTypeFromUri(String uri) {
Pattern patt = Pattern.compile(
- "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
+ "[vV]\\d+.*?(?:(?:/(?<type>" + SUPPORTEDTYPES + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
Matcher m = patt.matcher(uri);
Boolean generated = false;
@@ -1123,15 +1131,15 @@ public class WorkflowAction {
throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri);
}
if (action == null) {
- if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
+ if (type.equals(SERVICE_INSTANCES) && (id == null || "assign".equals(id))) {
id = UUID.randomUUID().toString();
generated = true;
- } else if (type.equals(VF_MODULES) && id.equals("scaleOut")) {
+ } else if (type.equals(VF_MODULES) && "scaleOut".equals(id)) {
id = UUID.randomUUID().toString();
generated = true;
}
} else {
- if (action.matches(supportedTypes)) {
+ if (action.matches(SUPPORTEDTYPES)) {
id = UUID.randomUUID().toString();
generated = true;
type = action;
@@ -1159,7 +1167,7 @@ public class WorkflowAction {
.equalsIgnoreCase(reqDetails.getModelInfo().getModelVersionId())) {
return serviceInstanceAAI.get().getServiceInstanceId();
} else {
- throw new DuplicateNameException("serviceInstance",
+ throw new DuplicateNameException(SERVICE_INSTANCE,
String.format(NAME_EXISTS_WITH_DIFF_VERSION_ID, instanceName,
reqDetails.getModelInfo().getModelVersionId()));
}
@@ -1170,7 +1178,7 @@ public class WorkflowAction {
if (aaiServiceInstances.getServiceInstance() != null
&& !aaiServiceInstances.getServiceInstance().isEmpty()) {
if (aaiServiceInstances.getServiceInstance().size() > 1) {
- throw new DuplicateNameException("serviceInstance",
+ throw new DuplicateNameException(SERVICE_INSTANCE,
String.format(NAME_EXISTS_MULTIPLE, instanceName));
} else {
ServiceInstance si =
@@ -1178,7 +1186,7 @@ public class WorkflowAction {
Map<String, String> keys =
bbInputSetupUtils.getURIKeysFromServiceInstance(si.getServiceInstanceId());
- throw new DuplicateNameException("serviceInstance",
+ throw new DuplicateNameException(SERVICE_INSTANCE,
String.format(NAME_EXISTS_WITH_DIFF_COMBINATION, instanceName,
keys.get("global-customer-id"), keys.get("service-type"),
si.getModelVersionId()));
@@ -1295,7 +1303,7 @@ public class WorkflowAction {
}
protected String convertTypeFromPlural(String type) {
- if (!type.matches(supportedTypes)) {
+ if (!type.matches(SUPPORTEDTYPES)) {
return type;
} else {
if (type.equals(SERVICE_INSTANCES)) {
@@ -1317,31 +1325,31 @@ public class WorkflowAction {
String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey();
sortedOrchFlows.add(ebb);
for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
&& ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
sortedOrchFlows.add(ebb2);
break;
}
- if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
&& ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
sortedOrchFlows.add(ebb2);
break;
}
}
for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)
&& ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
sortedOrchFlows.add(ebb2);
break;
}
- if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)
&& ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
sortedOrchFlows.add(ebb2);
break;
}
}
- } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
- || ebb.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")) {
+ } else if (ebb.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
+ || ebb.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)) {
continue;
} else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) {
sortedOrchFlows.add(ebb);
@@ -1424,7 +1432,7 @@ public class WorkflowAction {
}
} else if (orchFlow.getFlowName().contains(VFMODULE)) {
List<Resource> vfModuleResourcesSorted = null;
- if (requestAction.equals("createInstance") || requestAction.equals("assignInstance")
+ if (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)
|| requestAction.equals("activateInstance")) {
vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream()
.filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList()));
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 073dead8b3..d5798150d1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -40,7 +40,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -65,6 +64,9 @@ public class WorkflowActionBBTasks {
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
+ private static final String COMPLETED = "completed";
+ private static final String HANDLINGCODE = "handlingCode";
+ private static final String ROLLBACKTOCREATED = "RollbackToCreated";
protected String maxRetries = "mso.rainyDay.maxRetries";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@@ -98,9 +100,9 @@ public class WorkflowActionBBTasks {
execution.setVariable("buildingBlock", ebb);
currentSequence++;
if (currentSequence >= flowsToExecute.size()) {
- execution.setVariable("completed", true);
+ execution.setVariable(COMPLETED, true);
} else {
- execution.setVariable("completed", false);
+ execution.setVariable(COMPLETED, false);
}
execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
}
@@ -114,7 +116,8 @@ public class WorkflowActionBBTasks {
}
} catch (Exception ex) {
logger.warn(
- "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.");
+ "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.",
+ ex);
}
}
@@ -236,7 +239,7 @@ public class WorkflowActionBBTasks {
}
public void checkRetryStatus(DelegateExecution execution) {
- String handlingCode = (String) execution.getVariable("handlingCode");
+ String handlingCode = (String) execution.getVariable(HANDLINGCODE);
String requestId = (String) execution.getVariable(G_REQUEST_ID);
String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
@@ -244,11 +247,11 @@ public class WorkflowActionBBTasks {
try {
envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
} catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries", ex);
envMaxRetries = 5;
}
int nextCount = retryCount + 1;
- if (handlingCode.equals("Retry")) {
+ if ("Retry".equals(handlingCode)) {
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
try {
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
@@ -259,8 +262,8 @@ public class WorkflowActionBBTasks {
logger.warn("Failed to update Request Db Infra Active Requests with Retry Status", ex);
}
if (retryCount < envMaxRetries) {
- int currSequence = (int) execution.getVariable("gCurrentSequence");
- execution.setVariable("gCurrentSequence", currSequence - 1);
+ int currSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ execution.setVariable(G_CURRENT_SEQUENCE, currSequence - 1);
execution.setVariable(RETRY_COUNT, nextCount);
} else {
workflowAction.buildAndThrowException(execution,
@@ -287,12 +290,12 @@ public class WorkflowActionBBTasks {
flowsToExecute.remove(i);
} else {
String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
- if (flowName.contains("Assign")) {
- flowName = "Unassign" + flowName.substring(6, flowName.length());
- } else if (flowName.contains("Create")) {
- flowName = "Delete" + flowName.substring(6, flowName.length());
- } else if (flowName.contains("Activate")) {
- flowName = "Deactivate" + flowName.substring(8, flowName.length());
+ if (flowName.startsWith("Assign")) {
+ flowName = flowName.replaceFirst("Assign", "Unassign");
+ } else if (flowName.startsWith("Create")) {
+ flowName = flowName.replaceFirst("Create", "Delete");
+ } else if (flowName.startsWith("Activate")) {
+ flowName = flowName.replaceFirst("Activate", "Deactivate");
} else {
continue;
}
@@ -301,15 +304,15 @@ public class WorkflowActionBBTasks {
}
}
- String handlingCode = (String) execution.getVariable("handlingCode");
+ String handlingCode = (String) execution.getVariable(HANDLINGCODE);
List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
rollbackFlowsFiltered.addAll(rollbackFlows);
- if (handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")) {
+ if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
for (int i = 0; i < rollbackFlows.size(); i++) {
if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")) {
rollbackFlowsFiltered.remove(rollbackFlows.get(i));
} else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
- && handlingCode.equals("RollbackToCreated")) {
+ && ROLLBACKTOCREATED.equals(handlingCode)) {
rollbackFlowsFiltered.remove(rollbackFlows.get(i));
}
}
@@ -321,9 +324,9 @@ public class WorkflowActionBBTasks {
else
execution.setVariable("isRollbackNeeded", true);
execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
- execution.setVariable("handlingCode", "PreformingRollback");
+ execution.setVariable(HANDLINGCODE, "PreformingRollback");
execution.setVariable("isRollback", true);
- execution.setVariable("gCurrentSequence", 0);
+ execution.setVariable(G_CURRENT_SEQUENCE, 0);
execution.setVariable(RETRY_COUNT, 0);
} else {
workflowAction.buildAndThrowException(execution,
@@ -354,6 +357,7 @@ public class WorkflowActionBBTasks {
}
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception ex) {
+ logger.error("Exception in updateInstanceId", ex);
workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
}
}
@@ -361,12 +365,12 @@ public class WorkflowActionBBTasks {
public void postProcessingExecuteBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- String handlingCode = (String) execution.getVariable("handlingCode");
+ String handlingCode = (String) execution.getVariable(HANDLINGCODE);
final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
- if (bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) {
+ if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) {
postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
}
}
@@ -410,16 +414,16 @@ public class WorkflowActionBBTasks {
.forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
executeBB.getBuildingBlock().getBpmnFlowName()));
execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("completed", false);
+ execution.setVariable(COMPLETED, false);
} else {
- logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
+ logger.debug("No cvnfcCustomization found for customizationId: {}", modelCustomizationId);
}
}
} catch (EntityNotFoundException e) {
- logger.debug(e.getMessage() + " Will not be running Fabric Config Building Blocks");
+ logger.debug("Will not be running Fabric Config Building Blocks", e);
} catch (Exception e) {
String errorMessage = "Error occurred in post processing of Vf Module create";
- execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable(HANDLINGCODE, ROLLBACKTOCREATED);
execution.setVariable("WorkflowActionErrorMessage", errorMessage);
logger.error(errorMessage, e);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index f23e5cdb5a..5c69987a54 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -33,6 +33,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Optional;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils;
@@ -210,23 +211,25 @@ public class VnfAdapterVfModuleObjectMapper {
protected void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive,
Map<String, Object> srcMap) throws MissingValueTagException {
StringBuilder directives = new StringBuilder();
- int no_directives_size = 0;
+ int noOfDirectivesSize = 0;
if (directive.equals(MsoMulticloudUtils.USER_DIRECTIVES)
&& srcMap.containsKey(MsoMulticloudUtils.OOF_DIRECTIVES)) {
- no_directives_size = 1;
+ noOfDirectivesSize = 1;
}
- if (srcMap.size() > no_directives_size) {
+ if (srcMap.size() > noOfDirectivesSize) {
directives.append("{ \"attributes\": [ ");
int i = 0;
- for (String attributeName : srcMap.keySet()) {
+ for (Map.Entry<String, Object> attributeEntry : srcMap.entrySet()) {
+ String attributeName = attributeEntry.getKey();
+ Object attributeValue = attributeEntry.getValue();
if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directive)
&& attributeName.equals(MsoMulticloudUtils.OOF_DIRECTIVES))) {
- if (srcMap.get(attributeName) == null) {
+ if (attributeValue == null) {
logger.error("No value tag found for attribute: {}", attributeName);
throw new MissingValueTagException("No value tag found for " + attributeName);
}
- directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString()));
- if (i < (srcMap.size() - 1 + no_directives_size))
+ directives.append(new AttributeNameValue(attributeName, attributeValue.toString()));
+ if (i < (srcMap.size() - 1 + noOfDirectivesSize))
directives.append(", ");
i++;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index 867d80a4ea..8b939940fa 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -52,7 +52,7 @@ public class AAIConfigurationResources {
AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
- injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
+ injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration));
}
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIEntityNotFoundException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIEntityNotFoundException.java
new file mode 100644
index 0000000000..5f65e5d76d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIEntityNotFoundException.java
@@ -0,0 +1,16 @@
+package org.onap.so.client.orchestration;
+
+public class AAIEntityNotFoundException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -107868951852460677L;
+
+ public AAIEntityNotFoundException(String error) {
+ super(error);
+ }
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
index c41f3fa56c..fc1528526c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
@@ -22,7 +22,9 @@
package org.onap.so.client.orchestration;
+import java.util.List;
import java.util.Optional;
+import org.onap.aai.domain.yang.OwningEntities;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
@@ -120,6 +122,25 @@ public class AAIServiceInstanceResources {
return aaiRC.exists(owningEntityUri);
}
+ public org.onap.aai.domain.yang.OwningEntity getOwningEntityByName(String owningEntityName)
+ throws AAIEntityNotFoundException {
+ AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
+ .queryParam("owning-entity-name", owningEntityName);
+ AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
+ Optional<OwningEntities> owningEntities = aaiRC.get(OwningEntities.class, owningEntityUri);
+ if (owningEntities.isPresent()) {
+ List<org.onap.aai.domain.yang.OwningEntity> owningEntityList = owningEntities.get().getOwningEntity();
+ if (owningEntityList.size() > 1) {
+ throw new AAIEntityNotFoundException(
+ "Non unique result returned for owning entity name: " + owningEntityName);
+ } else {
+ return owningEntityList.get(0);
+ }
+ } else {
+ throw new AAIEntityNotFoundException("No result returned for owning entity name: " + owningEntityName);
+ }
+ }
+
public void connectOwningEntityandServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) {
AAIResourceUri owningEntityURI =
AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
index a9635d1e34..7ad74a6d86 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
@@ -24,6 +24,7 @@ package org.onap.so.client.orchestration;
import java.io.IOException;
import java.util.Optional;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -32,14 +33,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -151,6 +152,8 @@ public class AAIVnfResources {
.get(org.onap.aai.domain.yang.GenericVnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
.orElse(new org.onap.aai.domain.yang.GenericVnf());
+ AAIRestClientImpl client = new AAIRestClientImpl();
+ aaiValidatorImpl.setClient(client);
return aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
}
@@ -160,4 +163,14 @@ public class AAIVnfResources {
AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
return injectionHelper.getAaiClient().exists(vnfUri);
}
+
+ public AAIResultWrapper queryVnfWrapperById(GenericVnf vnf) {
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()).depth(Depth.ALL);
+ return injectionHelper.getAaiClient().get(uri);
+ }
+
+ public Optional<Vserver> getVserver(AAIResourceUri uri) {
+ return injectionHelper.getAaiClient().get(uri).asBean(Vserver.class);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
index d4a4cfbd8a..0123eb67be 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
@@ -32,8 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
index b3ea18df58..01511eaccc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
@@ -37,14 +37,11 @@ import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SDNCVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class);
@Autowired
private VfModuleTopologyOperationRequestMapper sdncRM;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
index 6434bfb176..27edeed02a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
@@ -36,8 +36,6 @@ import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
index 62d6a110f6..6a15ca321a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
@@ -34,8 +34,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 2e7877fe3b..07f448e5e1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -29,8 +29,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCProperties;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
index 12d1b0be95..2c8bdd931c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
@@ -36,7 +36,7 @@ public class SDNCRequest implements Serializable {
private SDNCTopology topology;
private String correlationValue = UUID.randomUUID().toString();
private String correlationName = "SDNCCallback";
- private Object SDNCPayload;
+ private transient Object sdncPayload;
public String getTimeOut() {
@@ -72,11 +72,11 @@ public class SDNCRequest implements Serializable {
}
public Object getSDNCPayload() {
- return SDNCPayload;
+ return sdncPayload;
}
public void setSDNCPayload(Object sDNCPayload) {
- SDNCPayload = sDNCPayload;
+ this.sdncPayload = sDNCPayload;
}
@Override
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
index 21c0b971b8..c63cbc0b68 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -37,7 +37,6 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
@Component
@@ -57,10 +56,10 @@ public class SniroClient {
*
* @param homingRequest
* @return
- * @throws JsonProcessingException
+ * @throws BadResponseException
* @throws BpmnError
*/
- public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException, JsonProcessingException {
+ public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException {
logger.trace("Started Sniro Client Post Demands");
String url = managerProperties.getHost() + managerProperties.getUri().get("v2");
logger.debug("Post demands url: {}", url);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
index ed3ec759c3..a8550d8df9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -54,16 +54,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
public class AAICreateTasksTest extends BaseTaskTest {
@@ -272,24 +272,6 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createOwningEntityNullOwningEntityIdTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- serviceInstance.getOwningEntity().setOwningEntityId(null);
-
- aaiCreateTasks.createOwningEntity(execution);
- }
-
- @Test
- public void createOwningEntityEmptyOwningEntityIdTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- serviceInstance.getOwningEntity().setOwningEntityId("");
-
- aaiCreateTasks.createOwningEntity(execution);
- }
-
- @Test
public void createOwningEntityNullOwningEntityNameTest() throws Exception {
expectedException.expect(BpmnError.class);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index 905f244278..c337f7f1b5 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -733,7 +733,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CONFIGURE);
- aaiUpdateTasks.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+ aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfigureVnf(execution);
}
@Test
@@ -741,6 +741,6 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CONFIGURED);
- aaiUpdateTasks.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+ aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfiguredVnf(execution);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
index 56ff813e73..c0056291ef 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
@@ -22,22 +22,41 @@ package org.onap.so.bpmn.infrastructure.activity;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
import java.nio.file.Files;
import java.nio.file.Paths;
+import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.onap.so.client.exception.ExceptionBuilder;
public class ExecuteActivityTest extends BaseTaskTest {
@InjectMocks
protected ExecuteActivity executeActivity = new ExecuteActivity();
+ @InjectMocks
+ @Spy
+ private ExceptionBuilder exceptionBuilder;
+
+ @Mock
+ private WorkflowActionBBFailure workflowActionBBFailure;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
private DelegateExecution execution;
@Before
@@ -72,4 +91,17 @@ public class ExecuteActivityTest extends BaseTaskTest {
assertEquals(ebb.getBuildingBlock(), bb);
}
+ @Test
+ public void buildAndThrowException_Test() throws Exception {
+ doNothing().when(workflowActionBBFailure).updateRequestStatusToFailed(execution);
+ doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
+ thrown.expect(BpmnError.class);
+ executeActivity.buildAndThrowException(execution, "TEST EXCEPTION MSG");
+ String errorMessage = (String) execution.getVariable("ExecuteActivityErrorMessage");
+ assertEquals(errorMessage, "TEST EXCEPTION MSG");
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals(workflowException.getErrorMessage(), "TEST EXCEPTION MSG");
+ assertEquals(workflowException.getErrorCode(), 7000);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java
index e7a8b35db8..8328e0e08b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java
@@ -19,11 +19,17 @@
*/
package org.onap.so.bpmn.infrastructure.appc.tasks;
+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.urlEqualTo;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Optional;
import java.util.UUID;
@@ -39,6 +45,8 @@ import org.springframework.beans.factory.annotation.Autowired;
public class AppcRunTasksIT extends BaseIntegrationTest {
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
@Autowired
private AppcRunTasks appcRunTasks;
@@ -56,8 +64,51 @@ public class AppcRunTasksIT extends BaseIntegrationTest {
}
@Test
- public void preProcessActivityTest() throws Exception {
+ public void preProcessActivityWithVserversTest() throws Exception {
+ final String aaiVnfJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnfWithVservers.json")));
+ wireMockServer.stubFor(
+ get(urlEqualTo("/aai/v15/network/generic-vnfs/generic-vnf/testVnfId1?depth=all")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody(aaiVnfJson).withStatus(200)));
+
+ final String aaiVserverJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverFullQueryResponse.json")));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(aaiVserverJson)
+ .withStatus(200)));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(aaiVserverJson)
+ .withStatus(200)));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(aaiVserverJson)
+ .withStatus(200)));
+
+ appcRunTasks.preProcessActivity(execution);
+ String vserverIdList = execution.getVariable("vserverIdList");
+ String expectedVserverIdList =
+ "{\"vserverIds\":\"[\\\"1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5\\\",\\\"14551849-1e70-45cd-bc5d-a256d49548a2\\\",\\\"48bd7f11-408f-417c-b834-b41c1b98f7d7\\\"]\"}";
+ String vmIdList = execution.getVariable("vmIdList");
+ String expectedVmIdList =
+ "{\"vmIds\":\"[\\\"http://VSERVER-link.com\\\",\\\"http://VSERVER-link.com\\\",\\\"http://VSERVER-link.com\\\"]\"}";
+
+ assertEquals(vserverIdList, expectedVserverIdList);
+ assertEquals(vmIdList, expectedVmIdList);
+ assertEquals(execution.getVariable("actionQuiesceTraffic"), Action.QuiesceTraffic);
+ assertEquals(execution.getVariable("rollbackQuiesceTraffic"), false);
+ }
+
+ @Test
+ public void preProcessActivityNoVserversTest() throws Exception {
+ final String aaiVnfJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnf.json")));
+ wireMockServer.stubFor(
+ get(urlEqualTo("/aai/v15/network/generic-vnfs/generic-vnf/testVnfId1?depth=all")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody(aaiVnfJson).withStatus(200)));
appcRunTasks.preProcessActivity(execution);
+ assertNull(execution.getVariable("vmIdList"));
+ assertNull(execution.getVariable("vServerIdList"));
assertEquals(execution.getVariable("actionQuiesceTraffic"), Action.QuiesceTraffic);
assertEquals(execution.getVariable("rollbackQuiesceTraffic"), false);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
index cf673c5eb5..cc25689358 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
@@ -26,12 +26,17 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Optional;
import org.junit.Test;
import org.mockito.InjectMocks;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -39,11 +44,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class AppcRunTasksTest extends BaseTaskTest {
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
@InjectMocks
private AppcRunTasks appcRunTasks = new AppcRunTasks();
@@ -132,6 +142,32 @@ public class AppcRunTasksTest extends BaseTaskTest {
assertEquals(true, execution.getVariable("rollbackVnfLock"));
}
+ @Test
+ public void getVserversForAppcTest() throws Exception {
+
+ GenericVnf genericVnf = getTestGenericVnf();
+
+ final String aaiVnfJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnfWithVservers.json")));
+ final String aaiVserverJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverQueryResponse.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiVnfJson);
+ ObjectMapper mapper = new ObjectMapper();
+ Vserver vserver = mapper.readValue(aaiVserverJson, Vserver.class);
+ doReturn(aaiResultWrapper).when(aaiVnfResources).queryVnfWrapperById(genericVnf);
+ doReturn(Optional.of(vserver)).when(aaiVnfResources).getVserver(any(AAIResourceUri.class));
+ appcRunTasks.getVserversForAppc(execution, genericVnf);
+ String vserverIdList = execution.getVariable("vserverIdList");
+ String expectedVserverIdList =
+ "{\"vserverIds\":\"[\\\"1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5\\\",\\\"14551849-1e70-45cd-bc5d-a256d49548a2\\\",\\\"48bd7f11-408f-417c-b834-b41c1b98f7d7\\\"]\"}";
+ String vmIdList = execution.getVariable("vmIdList");
+ String expectedVmIdList =
+ "{\"vmIds\":\"[\\\"http://VSERVER-link.com\\\",\\\"http://VSERVER-link.com\\\",\\\"http://VSERVER-link.com\\\"]\"}";
+
+ assertEquals(vserverIdList, expectedVserverIdList);
+ assertEquals(vmIdList, expectedVmIdList);
+ }
+
private void mockReferenceResponse() {
ControllerSelectionReference reference = new ControllerSelectionReference();
reference.setControllerName("TEST-CONTROLLER-NAME");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
index b371e3a48a..ffe48876c4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
@@ -50,7 +51,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.springframework.beans.factory.annotation.Autowired;
-@Ignore
public class OrchestrationStatusValidatorTest extends BaseTaskTest {
@InjectMocks
protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
@@ -72,6 +72,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
@@ -115,6 +122,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ .thenReturn(configuration);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -134,6 +148,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
execution.getVariable("orchestrationStatusValidationResult"));
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -147,6 +162,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception {
expectedException.expect(BpmnError.class);
@@ -178,6 +194,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -228,8 +245,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
- execution.getVariable("orchestrationStatusValidationResult"));
+ assertNull(execution.getVariable("orchestrationStatusValidationResult"));
}
@Test
@@ -247,6 +263,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -257,7 +279,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
orchestrationStatusStateTransitionDirective.setId(1);
orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
@@ -288,6 +310,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -338,6 +366,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -380,6 +414,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -422,6 +462,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -464,6 +510,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -482,4 +534,39 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
}
+
+ @Test
+ public void continueValidationActivatedTest() throws Exception {
+ String flowToBeCalled = "DeactivateVnfBB";
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName(flowToBeCalled);
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.DEACTIVATE);
+ when(catalogDbClient.getBuildingBlockDetail(flowToBeCalled)).thenReturn(buildingBlockDetail);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.DEACTIVATE);
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ACTIVATED,
+ OrchestrationAction.DEACTIVATE);
+
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.CONTINUE,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 68f3d20c82..9855c8587a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -96,14 +96,12 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
public void createConfigurationTest() {
doReturn(new org.onap.aai.domain.yang.Configuration()).when(MOCK_aaiObjectMapper)
.mapConfiguration(configuration);
- doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class),
- isA(org.onap.aai.domain.yang.Configuration.class));
-
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ any(Optional.class));
aaiConfigurationResources.createConfiguration(configuration);
assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus());
- verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class),
- isA(org.onap.aai.domain.yang.Configuration.class));
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
index 0d48a29ca9..425b595686 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
@@ -20,8 +20,10 @@
package org.onap.so.client.orchestration;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -31,6 +33,8 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
@@ -49,16 +53,20 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIVnfResourcesTest extends TestDataSetup {
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
private GenericVnf genericVnf;
private ServiceInstance serviceInstance;
@@ -227,6 +235,7 @@ public class AAIVnfResourcesTest extends TestDataSetup {
boolean isVnfPserversLockedFlag = aaiVnfResources.checkVnfPserversLockedFlag("vnfId");
verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),
isA(AAIResourceUri.class));
+ verify(MOCK_aaiValidatorImpl, times(1)).setClient(isA(AAIRestClientImpl.class));
verify(MOCK_aaiValidatorImpl, times(1)).isPhysicalServerLocked(isA(String.class));
assertTrue(isVnfPserversLockedFlag);
}
@@ -249,4 +258,37 @@ public class AAIVnfResourcesTest extends TestDataSetup {
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
assertFalse(nameInUse);
}
+
+ @Test
+ public void queryVnfWrapperByIdTest() throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId").depth(Depth.ALL);
+ final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnf.json")));
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("vnfId");
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(eq(uri));
+ AAIResultWrapper actualResult = aaiVnfResources.queryVnfWrapperById(genericVnf);
+ assertEquals(actualResult, aaiResultWrapper);
+
+ }
+
+ @Test
+ public void getVserverTest() throws Exception {
+ final String content =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverQueryResponse.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+ Optional<org.onap.aai.domain.yang.Vserver> oVserver = Optional.empty();
+ AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "ModelInvariantUUID",
+ "serviceModelVersionId", "abc", "abc");
+
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ oVserver = aaiVnfResources.getVserver(vserverUri);
+
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+
+ if (oVserver.isPresent()) {
+ org.onap.aai.domain.yang.Vserver vserver = oVserver.get();
+ assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.Vserver.class).get(), sameBeanAs(vserver));
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnf.json
new file mode 100644
index 0000000000..e997db3f69
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnf.json
@@ -0,0 +1,57 @@
+{
+ "closedLoopDisabled":false,
+ "vnf-id":"vnfId1",
+ "vnf-name":"vnfName",
+ "vnf-type":"vnfType",
+ "orchestration-status":"PRECREATED",
+ "vf-modules": {
+ "vf-module": [{
+ "vf-module-id": "lukewarm",
+ "vf-module-name": "testVfModuleNameGWPrim",
+ "heat-stack-id": "fastburn",
+ "is-base-vf-module": true,
+ "orchestration-status": "Created"
+ },
+ {
+ "vf-module-id": "testVfModuleIdGWSec",
+ "vf-module-name": "testVfModuleNameGWSec",
+ "heat-stack-id": "testHeatStackIdGWSec",
+ "orchestration-status": "Created"
+ }]
+ },
+ "volume-groups":[],
+ "line-of-business":null,
+ "platform":null,
+ "cascaded":false,
+ "cloud-params":{},
+ "cloud-context":null,
+ "solution":null,
+ "vnf-name-2":null,
+ "service-id":null,
+ "regional-resource-zone":null,
+ "prov-status":null,
+ "operational-status":null,
+ "equipment-role":null,
+ "management-option":null,
+ "ipv4-oam-address":null,
+ "ipv4-loopback0-address":null,
+ "nm-lan-v6-address":null,
+ "management-v6-address":null,
+ "vcpu":null,
+ "vcpu-units":null,
+ "vmemory":null,
+ "vmemory-units":null,
+ "vdisk":null,
+ "vdisk-units":null,
+ "in-maint":false,
+ "is-closed-loop-disabled":false,
+ "summary-status":null,
+ "encrypted-access-flag":null,
+ "as-number":null,
+ "regional-resource-subzone":null,
+ "self-link":null,
+ "ipv4-oam-gateway-address":null,
+ "ipv4-oam-gateway-address-prefix-length":null,
+ "vlan-id-outer":null,"nm-profile-name":null,
+ "model-info-generic-vnf":null
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnfWithVservers.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnfWithVservers.json
new file mode 100644
index 0000000000..0ad0f054b0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnfWithVservers.json
@@ -0,0 +1,434 @@
+{
+ "vnf-id": "example-vnf-id-val-90603",
+ "vnf-name": "example-vnf-name-val-56838",
+ "vnf-name2": "example-vnf-name2-val-56319",
+ "vnf-type": "example-vnf-type-val-30533",
+ "service-id": "example-service-id-val-28290",
+ "regional-resource-zone": "example-regional-resource-zone-val-11059",
+ "prov-status": "example-prov-status-val-59777",
+ "operational-status": "example-operational-status-val-22513",
+ "in-maint": true,
+
+ "equipment-role": "example-equipment-role-val-23396",
+ "orchestration-status": "example-orchestration-status-val-59435",
+ "heat-stack-id": "example-heat-stack-id-val-96869",
+ "mso-catalog-key": "example-mso-catalog-key-val-30721",
+ "management-option": "example-management-option-val-61927",
+ "ipv4-oam-address": "192.168.10.14",
+ "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-87072",
+ "nm-lan-v6-address": "example-nm-lan-v6-address-val-91063",
+ "management-v6-address": "example-management-v6-address-val-80466",
+ "vcpu": 45837298,
+ "vcpu-units": "example-vcpu-units-val-86249",
+ "vmemory": 57288956,
+ "vmemory-units": "example-vmemory-units-val-13291",
+ "vdisk": 16937143,
+ "vdisk-units": "example-vdisk-units-val-73197",
+
+ "is-closed-loop-disabled": true,
+ "summary-status": "example-summary-status-val-86438",
+ "encrypted-access-flag": true,
+
+
+
+
+ "model-invariant-id": "example-model-invariant-id-val-14704",
+ "model-version-id": "example-model-version-id-val-47847",
+ "model-customization-id": "example-model-customization-id-val-52688",
+ "widget-model-id": "example-widget-model-id-val-20939",
+ "widget-model-version": "example-widget-model-version-val-72210",
+ "as-number": "example-as-number-val-68358",
+ "regional-resource-subzone": "example-regional-resource-subzone-val-34391",
+ "nf-type": "example-nf-type-val-54866",
+ "nf-function": "example-nf-function-val-24790",
+ "nf-role": "example-nf-role-val-4780",
+ "nf-naming-code": "example-nf-naming-code-val-25118",
+ "selflink": "example-selflink-val-68404",
+
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v12/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/2c323333-af4f-4849-af03-c862c0e93e3b",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "e433710f-9217-458d-a79d-1c7aff376d89"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "VIRTUAL USP"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "2c323333-af4f-4849-af03-c862c0e93e3b"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "kjhgfd1"
+ }]
+ },
+ {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn23a"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "e6beab145f6b49098277ac163ac1b4f3"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "comx5000vm003"
+ }]
+ },
+ {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn23a"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "e6beab145f6b49098277ac163ac1b4f3"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "14551849-1e70-45cd-bc5d-a256d49548a2"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "comx5000vm002"
+ }]
+ },
+ {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn23a"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "e6beab145f6b49098277ac163ac1b4f3"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "48bd7f11-408f-417c-b834-b41c1b98f7d7"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "comx5000vm001"
+ }]
+ }
+ ]},
+
+
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "example-interface-name-val-50593",
+ "interface-role": "example-interface-role-val-23375",
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-5921",
+ "selflink": "example-selflink-val-75663",
+ "interface-id": "example-interface-id-val-37465",
+ "macaddr": "example-macaddr-val-62657",
+ "network-name": "example-network-name-val-7252",
+ "management-option": "example-management-option-val-32963",
+ "interface-description": "example-interface-description-val-89453",
+ "is-port-mirrored": true,
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-interface": "example-vlan-interface-val-16684",
+ "vlan-id-inner": 8602916,
+ "vlan-id-outer": 97348542,
+ "speed-value": "example-speed-value-val-90330",
+ "speed-units": "example-speed-units-val-15849",
+ "vlan-description": "example-vlan-description-val-46942",
+ "backdoor-connection": "example-backdoor-connection-val-78445",
+
+ "orchestration-status": "example-orchestration-status-val-44994",
+
+
+
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-90277",
+ "l3-interface-ipv4-prefix-length": 3364150,
+ "vlan-id-inner": 44021171,
+ "vlan-id-outer": 55708677,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-43267",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-62870"
+ }
+ ],
+ "l3-interface-ipv6-address-list": [
+ {
+ "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-45323",
+ "l3-interface-ipv6-prefix-length": 56688923,
+ "vlan-id-inner": 5703071,
+ "vlan-id-outer": 86682265,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-28366",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-53034"
+ }
+ ]
+ }
+ ]
+ },
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "pci-id": "example-pci-id-val-4720",
+ "vf-vlan-filter": "example-vf-vlan-filter-val-42594",
+ "vf-mac-filter": "example-vf-mac-filter-val-13375",
+ "vf-vlan-strip": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-mirrors": "example-vf-mirrors-val-6057",
+ "vf-broadcast-allow": true,
+ "vf-unknown-multicast-allow": true,
+ "vf-unknown-unicast-allow": true,
+ "vf-insert-stag": true,
+ "vf-link-status": "example-vf-link-status-val-81448",
+ "neutron-network-id": "example-neutron-network-id-val-9504"
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "example-interface-name-val-16738",
+ "interface-role": "example-interface-role-val-13943",
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-63173",
+ "selflink": "example-selflink-val-43085",
+ "interface-id": "example-interface-id-val-51379",
+ "macaddr": "example-macaddr-val-16195",
+ "network-name": "example-network-name-val-45683",
+ "management-option": "example-management-option-val-78983",
+ "interface-description": "example-interface-description-val-34414",
+ "is-port-mirrored": true
+ }
+ ]
+ },
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-99078",
+ "l3-interface-ipv4-prefix-length": 55755841,
+ "vlan-id-inner": 81525473,
+ "vlan-id-outer": 90908072,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-47919",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-84236"
+ }
+ ],
+ "l3-interface-ipv6-address-list": [
+ {
+ "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-21939",
+ "l3-interface-ipv6-prefix-length": 50057584,
+ "vlan-id-inner": 75774660,
+ "vlan-id-outer": 4421090,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-46377",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-16585"
+ }
+ ]
+ }
+ ]
+ },
+ "lag-interfaces": {
+ "lag-interface": [
+ {
+ "interface-name": "example-interface-name-val-39234",
+ "interface-description": "example-interface-description-val-1037",
+ "speed-value": "example-speed-value-val-1929",
+ "speed-units": "example-speed-units-val-74937",
+ "interface-id": "example-interface-id-val-91265",
+ "interface-role": "example-interface-role-val-19613",
+
+
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "example-interface-name-val-10722",
+ "interface-role": "example-interface-role-val-95194",
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-24328",
+ "selflink": "example-selflink-val-24987",
+ "interface-id": "example-interface-id-val-75726",
+ "macaddr": "example-macaddr-val-36940",
+ "network-name": "example-network-name-val-65359",
+ "management-option": "example-management-option-val-49521",
+ "interface-description": "example-interface-description-val-70528",
+ "is-port-mirrored": true,
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-interface": "example-vlan-interface-val-70827",
+ "vlan-id-inner": 55659612,
+ "vlan-id-outer": 90335612,
+ "speed-value": "example-speed-value-val-54761",
+ "speed-units": "example-speed-units-val-91398",
+ "vlan-description": "example-vlan-description-val-17018",
+ "backdoor-connection": "example-backdoor-connection-val-4021",
+
+ "orchestration-status": "example-orchestration-status-val-18315",
+
+
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-59336",
+ "l3-interface-ipv4-prefix-length": 57636053,
+ "vlan-id-inner": 34068397,
+ "vlan-id-outer": 48570286,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-69862",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-75795"
+ }
+ ],
+ "l3-interface-ipv6-address-list": [
+ {
+ "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-15038",
+ "l3-interface-ipv6-prefix-length": 42694503,
+ "vlan-id-inner": 15929806,
+ "vlan-id-outer": 87413856,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-52519",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-24471"
+ }
+ ]
+ }
+ ]
+ },
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "pci-id": "example-pci-id-val-44669",
+ "vf-vlan-filter": "example-vf-vlan-filter-val-53436",
+ "vf-mac-filter": "example-vf-mac-filter-val-71902",
+ "vf-vlan-strip": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-mirrors": "example-vf-mirrors-val-54963",
+ "vf-broadcast-allow": true,
+ "vf-unknown-multicast-allow": true,
+ "vf-unknown-unicast-allow": true,
+ "vf-insert-stag": true,
+ "vf-link-status": "example-vf-link-status-val-1546",
+ "neutron-network-id": "example-neutron-network-id-val-92159"
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "example-interface-name-val-9327",
+ "interface-role": "example-interface-role-val-21859",
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-21445",
+ "selflink": "example-selflink-val-6085",
+ "interface-id": "example-interface-id-val-39854",
+ "macaddr": "example-macaddr-val-14433",
+ "network-name": "example-network-name-val-3722",
+ "management-option": "example-management-option-val-64739",
+ "interface-description": "example-interface-description-val-5814",
+ "is-port-mirrored": true
+
+
+
+ }
+ ]
+ },
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-64531",
+ "l3-interface-ipv4-prefix-length": 66545882,
+ "vlan-id-inner": 12194134,
+ "vlan-id-outer": 29589286,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-91108",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-56984"
+ }
+ ],
+ "l3-interface-ipv6-address-list": [
+ {
+ "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-37408",
+ "l3-interface-ipv6-prefix-length": 5116459,
+ "vlan-id-inner": 39229896,
+ "vlan-id-outer": 15091934,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-87700",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-37352"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "example-vf-module-id-val-56249",
+ "vf-module-name": "example-vf-module-name-val-18987",
+ "heat-stack-id": "example-heat-stack-id-val-80110",
+ "orchestration-status": "example-orchestration-status-val-8226",
+ "is-base-vf-module": true,
+ "model-invariant-id": "example-model-invariant-id-val-5071",
+ "model-version-id": "example-model-version-id-val-80793",
+ "model-customization-id": "example-model-customization-id-val-83277",
+ "widget-model-id": "example-widget-model-id-val-99814",
+ "widget-model-version": "example-widget-model-version-val-22799",
+ "contrail-service-instance-fqdn": "example-contrail-service-instance-fqdn-val-52133",
+ "module-index": 1933,
+ "selflink": "example-selflink-val-69992"
+ }
+ ]
+ },
+ "licenses": {
+ "license": [
+ {
+ "group-uuid": "example-group-uuid-val-73012",
+ "resource-uuid": "example-resource-uuid-val-80045"
+ }
+ ]
+ },
+ "entitlements": {
+ "entitlement": [
+ {
+ "group-uuid": "example-group-uuid-val-14874",
+ "resource-uuid": "example-resource-uuid-val-49146"
+ }
+ ]
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverFullQueryResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverFullQueryResponse.json
new file mode 100644
index 0000000000..1c7e1fb970
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverFullQueryResponse.json
@@ -0,0 +1,13 @@
+{
+ "in-maint": null,
+ "is-closed-loop-disabled": null,
+ "linterfaces": null,
+ "prov-status": null,
+ "relationship-list": null,
+ "resource-version": null,
+ "volumes": null,
+ "vserver-id": "VServerId",
+ "vserver-name": "VServerName",
+ "vserver-name2": "VServerName2",
+ "vserver-selflink": "http://VSERVER-link.com"
+ } \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverQueryResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverQueryResponse.json
new file mode 100644
index 0000000000..eca735b810
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverQueryResponse.json
@@ -0,0 +1,6 @@
+{
+ "vserverId": "VServerId",
+ "vserverName": "VServerName",
+ "vserverName2": "VServerName2",
+ "vserverSelflink": "http://VSERVER-link.com"
+ } \ No newline at end of file
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java
index 3bd646fada..d15fbf9322 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java
@@ -135,7 +135,7 @@ public class CloudifyClient {
* @return An object of Class <R>
*/
public <R> CloudifyRequest<R> get(String path, Class<R> returnType) {
- return new CloudifyRequest<R>(this, HttpMethod.GET, path, null, returnType);
+ return new CloudifyRequest<>(this, HttpMethod.GET, path, null, returnType);
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java
index f031f10bb5..652df6ff0d 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,7 @@
package org.onap.so.cloudify.base.client;
-
+@FunctionalInterface
public interface CloudifyClientConnector {
public <T> CloudifyResponse request(CloudifyRequest<T> request);
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java
index 2478557afc..c4dcc89d0b 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java
@@ -59,7 +59,9 @@ public class CloudifyClientTokenProvider implements CloudifyTokenProvider {
tokenRequest.setBasicAuthentication(user, password);
Token newToken = tokenRequest.execute();
- token = newToken.getValue();
+ if (newToken != null) {
+ token = newToken.getValue();
+ }
if (expiration == null) {
expiration = new Date();
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java
index df63bd18d3..006768f2f1 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java
@@ -37,7 +37,7 @@ public class CloudifyRequest<R> {
private StringBuilder path = new StringBuilder();
- private Map<String, List<Object>> headers = new HashMap<String, List<Object>>();
+ private Map<String, List<Object>> headers = new HashMap<>();
private Entity<?> entity;
@@ -100,7 +100,7 @@ public class CloudifyRequest<R> {
}
public <T> Entity<T> entity(T entity, String contentType) {
- return new Entity<T>(entity, contentType);
+ return new Entity<>(entity, contentType);
}
public Entity<?> entity() {
@@ -160,7 +160,7 @@ public class CloudifyRequest<R> {
+ headers + ", entity=" + entity + ", returnType=" + returnType + "]";
}
- private Map<String, List<Object>> queryParams = new LinkedHashMap<String, List<Object>>();
+ private Map<String, List<Object>> queryParams = new LinkedHashMap<>();
public Map<String, List<Object>> queryParams() {
return queryParams;
@@ -171,7 +171,7 @@ public class CloudifyRequest<R> {
List<Object> values = queryParams.get(key);
values.add(value);
} else {
- List<Object> values = new ArrayList<Object>();
+ List<Object> values = new ArrayList<>();
values.add(value);
queryParams.put(key, values);
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java
index 966cc8f144..0ca3212238 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,11 +26,11 @@ public class CloudifyResponseException extends CloudifyBaseException {
private static final long serialVersionUID = 7294957362769575271L;
- protected String message;
- protected int status;
+ private final String message;
+ private final int status;
// Make the response available for exception handling (includes body)
- protected CloudifyResponse response;
+ private final CloudifyResponse response;
public CloudifyResponseException(String message, int status) {
this.message = message;
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
index e1992d98ca..54519bac72 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
@@ -9,9 +9,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.
@@ -94,7 +94,7 @@ public class HttpClientConnector implements CloudifyClientConnector {
public <T> CloudifyResponse request(CloudifyRequest<T> request) {
- CloseableHttpClient httpClient = null; // HttpClients.createDefault();
+ CloseableHttpClient httpClient = null;
if (request.isBasicAuth()) {
// Use Basic Auth for this request.
@@ -211,11 +211,14 @@ public class HttpClientConnector implements CloudifyClientConnector {
} catch (HttpResponseException e) {
// What exactly does this mean? It does not appear to get thrown for
// non-2XX responses as documented.
+ logger.error("Client HttpResponseException", e);
throw new CloudifyResponseException(e.getMessage(), e.getStatusCode());
} catch (UnknownHostException e) {
+ logger.error("Client UnknownHostException", e);
throw new CloudifyConnectException("Unknown Host: " + e.getMessage());
} catch (IOException e) {
// Catch all other IOExceptions and throw as OpenStackConnectException
+ logger.error("Client IOException", e);
throw new CloudifyConnectException(e.getMessage());
} catch (Exception e) {
// Catchall for anything else, must throw as a RuntimeException
@@ -227,13 +230,17 @@ public class HttpClientConnector implements CloudifyClientConnector {
try {
httpResponse.close();
} catch (IOException e) {
- logger.debug("Unable to close HTTP Response: " + e);
+ logger.debug("Unable to close HTTP Response: ", e);
}
}
// Get here on an error response (4XX-5XX)
- throw new CloudifyResponseException(httpResponse.getStatusLine().getReasonPhrase(),
- httpResponse.getStatusLine().getStatusCode(), httpClientResponse);
+ if (httpResponse != null) {
+ throw new CloudifyResponseException(httpResponse.getStatusLine().getReasonPhrase(),
+ httpResponse.getStatusLine().getStatusCode(), httpClientResponse);
+ } else {
+ throw new CloudifyResponseException("Null httpResponse", 0, httpClientResponse);
+ }
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
index a96fdb6b50..f1aa06cb39 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,7 +39,7 @@ public class HttpClientResponse implements CloudifyResponse {
private static Logger logger = LoggerFactory.getLogger(HttpClientResponse.class);
- private HttpResponse response = null;
+ private transient HttpResponse response = null;
private String entityBody = null;
public HttpClientResponse(HttpResponse response) {
diff --git a/common/pom.xml b/common/pom.xml
index a52897170a..1a4ffe13a8 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -186,7 +186,16 @@
<version>${grpc.version}</version>
<scope>test</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.javatuples</groupId>
+ <artifactId>javatuples</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.camunda.bpm</groupId>
+ <artifactId>camunda-external-task-client</artifactId>
+ <version>1.1.1</version>
+ </dependency>
</dependencies>
<dependencyManagement>
<dependencies>
diff --git a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
index 1370bb3fa3..3f9715bdef 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
@@ -116,17 +116,23 @@ public class AAISingleTransactionClient
}
@Override
- public void put(String uri, Object body) {
+ protected void put(String uri, Object body) {
request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body));
}
@Override
- public void delete(String uri, Object body) {
- request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(body));
+ protected void delete(String uri) {
+ request.getOperations()
+ .add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(new Object()));
}
@Override
- public void patch(String uri, Object body) {
+ protected void delete(String uri, Object obj) {
+ request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(obj));
+ }
+
+ @Override
+ protected void patch(String uri, Object body) {
request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri).withBody(body));
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
index 11e458a3da..e621566e5a 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
@@ -169,18 +169,22 @@ public class AAITransactionalClient
}
@Override
- public void put(String uri, Object body) {
+ protected void put(String uri, Object body) {
currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body));
}
@Override
- public void delete(String uri, Object body) {
- currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(body));
+ protected void delete(String uri) {
+ currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(null));
+ }
+ @Override
+ protected void delete(String uri, Object obj) {
+ currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(obj));
}
@Override
- public void patch(String uri, Object body) {
+ protected void patch(String uri, Object body) {
currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body));
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
index 95ed01ee94..96844ff1cb 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
@@ -47,10 +47,12 @@ public class AAIValidatorImpl implements AAIValidator {
List<Pserver> pservers;
boolean isLocked = false;
pservers = client.getPhysicalServerByVnfId(vnfId);
- for (Pserver pserver : pservers) {
- if (pserver.isInMaint()) {
- isLocked = true;
- return isLocked;
+ if (pservers != null) {
+ for (Pserver pserver : pservers) {
+ if (pserver.isInMaint()) {
+ isLocked = true;
+ return isLocked;
+ }
}
}
return isLocked;
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
index f2f99050db..1fe9da984f 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
@@ -21,6 +21,7 @@
package org.onap.so.client.aai.entities.uri;
import java.net.URI;
+import java.util.regex.Pattern;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
@@ -138,4 +139,9 @@ public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
public AAISimpleUri format(Format format) {
return (AAISimpleUri) super.format(format);
}
+
+ @Override
+ protected Pattern getPrefixPattern() {
+ return Pattern.compile("/aai/v\\d+");
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
index 4ca5690188..8ef08057e6 100644
--- a/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
@@ -35,11 +35,12 @@ public class DefaultDmaapPropertiesImpl implements DmaapProperties {
public DefaultDmaapPropertiesImpl() throws IOException {
File initialFile = new File("src/test/resources/dmaap.properties");
- InputStream targetStream = new FileInputStream(initialFile);
Properties properties = new Properties();
- properties.load(targetStream);
- this.properties = new HashMap<>();
- properties.forEach((key, value) -> this.properties.put((String) key, (String) value));
+ try (InputStream targetStream = new FileInputStream(initialFile)) {
+ properties.load(targetStream);
+ this.properties = new HashMap<>();
+ properties.forEach((key, value) -> this.properties.put((String) key, (String) value));
+ }
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
index 72b01c268e..a4f9496d17 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
@@ -40,6 +40,7 @@ public class GraphInventoryCommonObjectMapperProvider extends CommonObjectMapper
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
mapper.enable(MapperFeature.USE_ANNOTATIONS);
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
index 5fc8726427..45ac1f741d 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
@@ -33,8 +33,7 @@ import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel>
- implements TransactionBuilder {
+public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> {
protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class);
@@ -181,7 +180,7 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri.clone())
.orElseThrow(() -> new NotFoundException(uri.build() + " does not exist in " + this.getGraphDBName()));
String resourceVersion = (String) result.get("resource-version");
- this.delete(uri.resourceVersion(resourceVersion).build().toString(), "");
+ this.delete(uri.resourceVersion(resourceVersion).build().toString());
incrementActionAmount();
return (Self) this;
}
@@ -192,6 +191,14 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
protected abstract String getGraphDBName();
+ protected abstract void put(String uri, Object body);
+
+ protected abstract void delete(String uri);
+
+ protected abstract void delete(String uri, Object obj);
+
+ protected abstract void patch(String uri, Object body);
+
/**
* @param obj - can be any object which will marshal into a valid A&AI payload
* @param uri
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
index f7f5d78604..e301edb0fd 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
@@ -32,9 +32,9 @@ public class DSLNodeKey implements QueryStep {
private boolean not = false;
private final StringBuilder query = new StringBuilder();
private final String keyName;
- private final List<String> values;
+ private final List<Object> values;
- public DSLNodeKey(String keyName, String... value) {
+ public DSLNodeKey(String keyName, Object... value) {
this.keyName = keyName;
this.values = Arrays.asList(value);
@@ -54,14 +54,18 @@ public class DSLNodeKey implements QueryStep {
result.append(" !");
}
result.append("('").append(keyName).append("', ");
- List<String> temp = new ArrayList<>();
- for (String item : values) {
+ List<Object> temp = new ArrayList<>();
+ for (Object item : values) {
if ("null".equals(item)) {
temp.add(String.format("' %s '", item));
} else if ("".equals(item)) {
temp.add("' '");
} else {
- temp.add(String.format("'%s'", item));
+ if (item instanceof String) {
+ temp.add(String.format("'%s'", item));
+ } else {
+ temp.add(item);
+ }
}
}
result.append(Joiner.on(", ").join(temp)).append(")");
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
index ffbb86f023..540472a88d 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
@@ -20,12 +20,15 @@
package org.onap.so.client.graphinventory.entities;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.onap.so.client.aai.entities.QueryStep;
import org.onap.so.client.graphinventory.GraphInventoryObjectName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Joiner;
@@ -33,6 +36,7 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
private List<QueryStep> steps = new ArrayList<>();
private String suffix = "";
+ private static final Logger logger = LoggerFactory.getLogger(DSLQueryBuilder.class);
public DSLQueryBuilder() {
@@ -49,8 +53,25 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
}
public DSLQueryBuilder<S, E> output() {
- if (steps.get(steps.size() - 1) instanceof DSLNode) {
+ Object obj = steps.get(steps.size() - 1);
+ if (obj instanceof DSLNode) {
((DSLNode) steps.get(steps.size() - 1)).output();
+ } else if (obj.getClass().getName().contains("$$Lambda$")) {
+ // process lambda expressions
+ for (Field f : obj.getClass().getDeclaredFields()) {
+ f.setAccessible(true);
+ Object o;
+ try {
+ o = f.get(obj);
+ if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNode) {
+ ((DSLNode) ((DSLQueryBuilder) o).steps.get(0)).output();
+ }
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ logger.error("Exception occured", e);
+ }
+ f.setAccessible(false);
+ break;
+ }
}
return this;
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
index 2fdd6574e5..87d4d84cac 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
@@ -45,7 +45,7 @@ public class __ {
return __.<DSLNode>start(new DSLNode(name, key));
}
- public static DSLNodeKey key(String keyName, String... value) {
+ public static DSLNodeKey key(String keyName, Object... value) {
return new DSLNodeKey(keyName, value);
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
index 41ba07ad6c..ffe47c5c51 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
@@ -29,6 +29,7 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.regex.Pattern;
import javax.ws.rs.core.UriBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.onap.so.client.graphinventory.Format;
@@ -61,7 +62,7 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
protected SimpleUri(GraphInventoryObjectType type, URI uri) {
this.type = type;
this.pluralType = null;
- this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll("/aai/v\\d+", ""));
+ this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), ""));
this.values = new Object[0];
}
@@ -174,6 +175,10 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
return build(this.values);
}
+ protected Pattern getPrefixPattern() {
+ return Pattern.compile("/.*?/v\\d+");
+ }
+
protected URI build(Object... values) {
// This is a workaround because resteasy does not encode URIs correctly
final String[] encoded = new String[values.length];
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/ListenerRunner.java b/common/src/main/java/org/onap/so/listener/ListenerRunner.java
index 3c36052dca..a489be6070 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/ListenerRunner.java
+++ b/common/src/main/java/org/onap/so/listener/ListenerRunner.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.listener;
+package org.onap.so.listener;
import java.lang.annotation.Annotation;
import java.util.Comparator;
@@ -27,7 +27,6 @@ import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.annotation.Priority;
-import org.onap.so.client.exception.ExceptionBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@@ -36,10 +35,7 @@ public abstract class ListenerRunner {
@Autowired
protected ApplicationContext context;
- @Autowired
- protected ExceptionBuilder exceptionBuilder;
-
- protected <T> List<T> filterListeners(List<T> validators, Predicate<T> predicate) {
+ public <T> List<T> filterListeners(List<T> validators, Predicate<T> predicate) {
return validators.stream().filter(item -> {
return !item.getClass().isAnnotationPresent(Skip.class) && predicate.test(item);
}).sorted(Comparator.comparing(item -> {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/Skip.java b/common/src/main/java/org/onap/so/listener/Skip.java
index a0543fd3cc..aa3ec2a204 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/Skip.java
+++ b/common/src/main/java/org/onap/so/listener/Skip.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.listener;
+package org.onap.so.listener;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
index 9fceed1641..a72229a25c 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
@@ -57,6 +57,9 @@ public class RequestParameters implements Serializable {
@JsonProperty("rebuildVolumeGroups")
private Boolean rebuildVolumeGroups;
+ @JsonProperty("enforceValidNfValues")
+ private Boolean enforceValidNfValues = false;
+
@Override
public String toString() {
return new ToStringBuilder(this).append("subscriptionServiceType", subscriptionServiceType)
@@ -64,7 +67,15 @@ public class RequestParameters implements Serializable {
.append("usePreload", usePreload).append("autoBuildVfModules", autoBuildVfModules)
.append("cascadeDelete", cascadeDelete).append("testApi", testApi)
.append("retainAssignments", retainAssignments).append("rebuildVolumeGroups", rebuildVolumeGroups)
- .toString();
+ .append("enforceValidNfValues", enforceValidNfValues).toString();
+ }
+
+ public Boolean getEnforceValidNfValues() {
+ return enforceValidNfValues;
+ }
+
+ public void setEnforceValidNfValues(Boolean enforceValidNfValues) {
+ this.enforceValidNfValues = enforceValidNfValues;
}
public String getSubscriptionServiceType() {
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
new file mode 100644
index 0000000000..e43b431821
--- /dev/null
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
@@ -0,0 +1,46 @@
+package org.onap.so.utils;
+
+import java.security.GeneralSecurityException;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
+import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
+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 ExternalTaskServiceUtils {
+
+ @Autowired
+ public Environment env;
+
+ private static final Logger logger = LoggerFactory.getLogger(ExternalTaskServiceUtils.class);
+
+ public ExternalTaskClient createExternalTaskClient() throws Exception {
+ String auth = getAuth();
+ ClientRequestInterceptor interceptor = createClientInterceptor(auth);
+ return ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1)
+ .addInterceptor(interceptor).asyncResponseTimeout(120000).build();
+ }
+
+ protected ClientRequestInterceptor createClientInterceptor(String auth) {
+ return new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
+ }
+
+ protected String getAuth() throws Exception {
+ try {
+ return CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
+ } catch (IllegalStateException | GeneralSecurityException e) {
+ logger.error("Error Decrypting Password", e);
+ throw new Exception("Cannot load password");
+ }
+ }
+
+ public int getMaxClients() {
+ return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "3"));
+ }
+
+
+}
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
new file mode 100644
index 0000000000..349767fc5b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
@@ -0,0 +1,46 @@
+package org.onap.so.utils;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public abstract class ExternalTaskUtils {
+
+ @Autowired
+ Environment env;
+
+ private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class);
+
+ public long calculateRetryDelay(int currentRetries) {
+ int retrySequence = getRetrySequence().length - currentRetries;
+ return Integer.parseInt(getRetrySequence()[retrySequence]) * getRetryMutiplier();
+ }
+
+ protected Long getRetryMutiplier() {
+ return Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier", "6000"));
+ }
+
+ protected String[] getRetrySequence() {
+ String[] seq = {"1", "1", "2", "3", "5", "8", "13", "20"};
+ if (env.getProperty("mso.workflow.topics.retrySequence") != null) {
+ seq = env.getProperty("mso.workflow.topics.retrySequence", String[].class);
+ }
+ return seq;
+ }
+
+ protected void setupMDC(ExternalTask externalTask) {
+ logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
+ String msoRequestId = externalTask.getVariable("mso-request-id");
+ if (msoRequestId != null && !msoRequestId.isEmpty()) {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+ }
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/utils/TargetEntities.java b/common/src/main/java/org/onap/so/utils/TargetEntities.java
index 94385ec8ea..67016a1fa9 100644
--- a/common/src/main/java/org/onap/so/utils/TargetEntities.java
+++ b/common/src/main/java/org/onap/so/utils/TargetEntities.java
@@ -20,6 +20,8 @@
package org.onap.so.utils;
-public interface TargetEntities {
+import java.io.Serializable;
+
+public interface TargetEntities extends Serializable {
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
index 1c49c11382..b07d893adb 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
@@ -24,6 +24,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -32,12 +33,14 @@ import static org.mockito.Mockito.verify;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
+import javax.ws.rs.core.GenericType;
import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Pserver;
@@ -46,7 +49,6 @@ import org.onap.so.client.aai.entities.singletransaction.SingleTransactionReques
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.core.JsonParseException;
@@ -60,11 +62,13 @@ public class AAISingleTransactionClientTest {
private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/singletransaction/";
AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "pserver-hostname");
AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex");
+ AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex2");
ObjectMapper mapper;
public AAIClient client = new AAIClient();
+ @Spy
public AAIResourcesClient aaiClient = new AAIResourcesClient();
@Before
@@ -82,9 +86,11 @@ public class AAISingleTransactionClientTest {
pserver2.setFqdn("patched-fqdn");
Complex complex = new Complex();
complex.setCity("my-city");
- AAISingleTransactionClient singleTransaction =
- aaiClient.beginSingleTransaction().create(uriA, pserver).update(uriA, pserver2).create(uriB, complex);
-
+ Map<String, Object> map = new HashMap<>();
+ map.put("resource-version", "1234");
+ doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriC));
+ AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction().create(uriA, pserver)
+ .update(uriA, pserver2).create(uriB, complex).delete(uriC);
SingleTransactionRequest actual = singleTransaction.getRequest();
diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
index adbdbb419f..305cdf59cc 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
@@ -22,6 +22,7 @@ package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -31,19 +32,19 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import javax.ws.rs.core.GenericType;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -61,11 +62,13 @@ public class AAITransactionalClientTest {
AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test4");
AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test5");
AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test6");
+ AAIResourceUri uriG = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test7");
ObjectMapper mapper;
public AAIClient client = new AAIClient();
+ @Spy
public AAIResourcesClient aaiClient = new AAIResourcesClient();
@Before
@@ -95,9 +98,12 @@ public class AAITransactionalClientTest {
List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>();
uris.add(uriB);
+ Map<String, Object> map = new HashMap<>();
+ map.put("resource-version", "1234");
+ doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriG));
AAIResourceUri uriAClone = uriA.clone();
AAITransactionalClient transactions = aaiClient.beginTransaction().connect(uriA, uris).connect(uriC, uriD)
- .beginNewTransaction().connect(uriE, uriF);
+ .beginNewTransaction().connect(uriE, uriF).beginNewTransaction().delete(uriG);
String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
Map<String, Object> actual =
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
index 5fa2ff0295..b91d0e705a 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
@@ -91,6 +91,13 @@ public class AAIValidatorTest {
}
@Test
+ public void test_IsPhysicalServerLocked_NoServers_False() throws IOException {
+ when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(null);
+ boolean locked = validator.isPhysicalServerLocked(vnfName);
+ assertEquals(false, locked);
+ }
+
+ @Test
public void test_IsVNFLocked_False() {
when(client.getVnfByName(vnfName)).thenReturn(createGenericVnfs(false));
boolean locked = validator.isVNFLocked(vnfName);
diff --git a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
index 6e55fe17fa..fb45652d53 100644
--- a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.onap.so.client.graphinventory.entities.DSLNode;
+import org.onap.so.client.graphinventory.entities.DSLNodeKey;
import org.onap.so.client.graphinventory.entities.DSLQueryBuilder;
import org.onap.so.client.graphinventory.entities.__;
@@ -108,4 +109,40 @@ public class DSLQueryBuilderTest {
builder.equals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')"));
assertTrue(builder.equals(builder));
}
+
+
+ @Test
+ public void mixedTypeTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.CLOUD_REGION,
+ __.key("cloud-owner", "owner"), __.key("cloud-region-id", "id")));
+ builder.to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", 167), __.key("my-boolean", true)).output());
+ assertTrue(builder.equals(
+ "cloud-region('cloud-owner', 'owner')('cloud-region-id', 'id') > vlan-tag*('vlan-id-outer', 167)('my-boolean', true)"));
+ }
+
+ @Test
+ public void outputOnNodeLambdasTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder =
+ new DSLQueryBuilder<>(new DSLNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId")));
+
+ builder.to(AAIObjectType.VSERVER, __.key("vserver-name", "myName")).output().to(AAIObjectType.P_INTERFACE)
+ .output();
+ assertEquals("l-interface('interface-id', 'myId') > vserver*('vserver-name', 'myName') > p-interface*",
+ builder.build());
+ }
+
+ @Test
+ public void skipOutputOnUnionTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder =
+ new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+
+ builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
+ __.node(AAIObjectType.VSERVER)
+ .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output())))
+ .output();
+
+ assertEquals(
+ "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
+ builder.build());
+ }
}
diff --git a/common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java b/common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java
new file mode 100644
index 0000000000..b2db986d02
--- /dev/null
+++ b/common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java
@@ -0,0 +1,61 @@
+package org.onap.so.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.springframework.core.env.Environment;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ExternalTaskServiceUtilsTest {
+
+ @Spy
+ @InjectMocks
+ private ExternalTaskServiceUtils utils = new ExternalTaskServiceUtils();
+
+ @Mock
+ private Environment mockEnv;
+
+ @Mock
+ private ExternalTaskClient mockClient;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ doReturn("3").when(mockEnv).getProperty("workflow.topics.maxClients", "3");
+ doReturn("07a7159d3bf51a0e53be7a8f89699be7").when(mockEnv).getRequiredProperty("mso.msoKey");
+ doReturn("6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436").when(mockEnv)
+ .getRequiredProperty("mso.auth");
+ doReturn("someid").when(mockEnv).getRequiredProperty("mso.config.cadi.aafId");
+ doReturn("http://camunda.com").when(mockEnv).getRequiredProperty("mso.workflow.endpoint");
+ }
+
+ @Test
+ public void testCreateExternalTaskClient() throws Exception {
+ ExternalTaskClient actualClient = utils.createExternalTaskClient();
+ Assert.assertNotNull(actualClient);
+ }
+
+ @Test
+ public void testGetAuth() throws Exception {
+ String actual = utils.getAuth();
+ String expected = "Att32054Life!@";
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testGetMaxClients() throws Exception {
+ int actual = utils.getMaxClients();
+ int expected = 3;
+ assertEquals(expected, actual);
+ }
+
+}
diff --git a/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
new file mode 100644
index 0000000000..f918781b39
--- /dev/null
+++ b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
@@ -0,0 +1,65 @@
+package org.onap.so.utils;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.springframework.core.env.Environment;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ExternalTaskUtilsTest {
+
+ @Mock
+ private Environment mockenv;
+
+ @InjectMocks
+ private ExternalTaskUtils externalTaskUtilsAnony = new ExternalTaskUtils() {
+
+ };
+
+ @Test
+ public void retry_sequence_calculation_Test() {
+ Mockito.when(mockenv.getProperty("mso.workflow.topics.retryMultiplier", "6000")).thenReturn("6000");
+ long firstRetry = externalTaskUtilsAnony.calculateRetryDelay(8);
+ assertEquals(6000L, firstRetry);
+ long secondRetry = externalTaskUtilsAnony.calculateRetryDelay(7);
+ assertEquals(6000L, secondRetry);
+ long thirdRetry = externalTaskUtilsAnony.calculateRetryDelay(6);
+ assertEquals(12000L, thirdRetry);
+ long fourthRetry = externalTaskUtilsAnony.calculateRetryDelay(5);
+ assertEquals(18000L, fourthRetry);
+ long fifthRetry = externalTaskUtilsAnony.calculateRetryDelay(4);
+ assertEquals(30000L, fifthRetry);
+ long sixRetry = externalTaskUtilsAnony.calculateRetryDelay(3);
+ assertEquals(48000L, sixRetry);
+ long seventhRetry = externalTaskUtilsAnony.calculateRetryDelay(2);
+ assertEquals(78000L, seventhRetry);
+ long eigthRetry = externalTaskUtilsAnony.calculateRetryDelay(1);
+ assertEquals(120000L, eigthRetry);
+ }
+
+ @Test
+ public void retry_sequence_Test() {
+ Mockito.when(mockenv.getProperty("mso.workflow.topics.retryMultiplier", "6000")).thenReturn("6000");
+ long firstRetry = externalTaskUtilsAnony.calculateRetryDelay(8);
+ assertEquals(6000L, firstRetry);
+ long secondRetry = externalTaskUtilsAnony.calculateRetryDelay(7);
+ assertEquals(6000L, secondRetry);
+ long thirdRetry = externalTaskUtilsAnony.calculateRetryDelay(6);
+ assertEquals(12000L, thirdRetry);
+ long fourthRetry = externalTaskUtilsAnony.calculateRetryDelay(5);
+ assertEquals(18000L, fourthRetry);
+ long fifthRetry = externalTaskUtilsAnony.calculateRetryDelay(4);
+ assertEquals(30000L, fifthRetry);
+ long sixRetry = externalTaskUtilsAnony.calculateRetryDelay(3);
+ assertEquals(48000L, sixRetry);
+ long seventhRetry = externalTaskUtilsAnony.calculateRetryDelay(2);
+ assertEquals(78000L, seventhRetry);
+ long eigthRetry = externalTaskUtilsAnony.calculateRetryDelay(1);
+ assertEquals(120000L, eigthRetry);
+ }
+
+}
diff --git a/common/src/test/resources/__files/aai/bulkprocess/test-request.json b/common/src/test/resources/__files/aai/bulkprocess/test-request.json
index f5ffe38285..5a2953c632 100644
--- a/common/src/test/resources/__files/aai/bulkprocess/test-request.json
+++ b/common/src/test/resources/__files/aai/bulkprocess/test-request.json
@@ -18,5 +18,9 @@
"related-link" : "/cloud-infrastructure/pservers/pserver/test6"
}
} ]
- } ]
+ }, {
+ "delete" : [ {
+ "uri" : "/network/generic-vnfs/generic-vnf/test7?resource-version=1234"
+ } ]
+ }]
} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/singletransaction/sample-request.json b/common/src/test/resources/__files/aai/singletransaction/sample-request.json
index f0761a07b6..69024dca83 100644
--- a/common/src/test/resources/__files/aai/singletransaction/sample-request.json
+++ b/common/src/test/resources/__files/aai/singletransaction/sample-request.json
@@ -21,6 +21,12 @@
"body": {
"city": "my-city"
}
+ },
+ {
+ "action": "delete",
+ "uri": "/cloud-infrastructure/complexes/complex/my-complex2?resource-version=1234",
+ "body" : {
+ }
}
]
} \ No newline at end of file
diff --git a/docs/api/apis/SO_Interface.rst b/docs/api/apis/consumed-apis.rst
index d1586eb5d0..0ef69c4da1 100644
--- a/docs/api/apis/SO_Interface.rst
+++ b/docs/api/apis/consumed-apis.rst
@@ -2,1154 +2,11 @@
.. http://creativecommons.org/licenses/by/4.0
.. Copyright 2018 Huawei Technologies Co., Ltd.
-SO Interfaces
-=============
+API consumed by SO
+==================
.. image:: ../../images/SO_1.png
-SO APIs
-----------------
-
-North Bound APIs
-----------------
-Create service instance
-+++++++++++++++++++++++
-
-+--------------------+------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+============================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6 |
-+--------------------+------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-
-SubscriberInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|GlobalSubscriberId |String |Global customer Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|SubscriberName |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|SubscriptionServiceType |String |The service type of the Subscription |
-+-------------------------+------------------+-------------------------------------------------+
-|UserParams |Array |The product family Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|aLaCarte |Boolean | aLaCarte |
-+-------------------------+------------------+-------------------------------------------------+
-|autoBuildVfModules |Boolean |autoBuildVfModules |
-+-------------------------+------------------+-------------------------------------------------+
-|cascadeDelete |Boolean |cascadeDelete |
-+-------------------------+------------------+-------------------------------------------------+
-|usePreload |Boolean |usePreload |
-+-------------------------+------------------+-------------------------------------------------+
-|rebuildVolumeGroups |Boolean |rebuildVolumeGroups |
-+-------------------------+------------------+-------------------------------------------------+
-|payload |String |payload |
-+-------------------------+------------------+-------------------------------------------------+
-|controllerType |String |controllerType |
-+-------------------------+------------------+-------------------------------------------------+
-
-UserParams Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|name |String |Tag name of attribute |
-+-------------------------+------------------+-------------------------------------------------+
-|value |String |Value of the tag |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-|aicNodeClli |String |aicNodeClli property |
-+-------------------------+------------------+-------------------------------------------------+
-
-Project Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|projectName |String |Name of the project |
-+-------------------------+------------------+-------------------------------------------------+
-
-OwningEntity Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|owningEntityId |String |owningEntityId of the owingEntity |
-+-------------------------+------------------+-------------------------------------------------+
-|owningEntityName |String |owningEntityName of the owingEntity |
-+-------------------------+------------------+-------------------------------------------------+
-
-Platform Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|platformName |String |Platform Name |
-+-------------------------+------------------+-------------------------------------------------+
-
-LineOfBusiness Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lineOfBusinessName |String |Line Of Business Name |
-+-------------------------+------------------+-------------------------------------------------+
-
-Delete service instance
-+++++++++++++++++++++++
-
-+--------------------+--------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId} |
-+--------------------+--------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+--------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-Create Volume Group
-+++++++++++++++++++
-
-+--------------------+------------------------------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==================================================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups |
-+--------------------+------------------------------------------------------------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+------------------------------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+------------------------------------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-|aicNodeClli |String |aicNodeClli property |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|relatedInstance |Object |relatedInstance Object |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|instanceId |String |instanceId |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInfo |Object |Content of modelInfo object. |
-+-------------------------+------------------+-------------------------------------------------+
-
-Delete Volume Group
-+++++++++++++++++++
-
-+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+============================================================================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volume-groupinstance-id} |
-+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-Create VF Module
-++++++++++++++++
-
-+--------------------+---------------------------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+===============================================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules |
-+--------------------+---------------------------------------------------------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+---------------------------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+---------------------------------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|relatedInstanceList |List |Content of relatedInstanceList. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|InstanceName |String |The instance Name |
-+-------------------------+------------------+-------------------------------------------------+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|SuppressRollback |Boolean |SuppressRollback |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|relatedInstance |Object |relatedInstance Object |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|instanceId |String |instanceId |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInfo |Object |Content of modelInfo object. |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |Name of the instance |
-+-------------------------+------------------+-------------------------------------------------+
-
-Delete VF Module
-++++++++++++++++
-
-+--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================================================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleinstance-id} |
-+--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-Create VNF
-++++++++++
-
-+--------------------+-------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs |
-+--------------------+-------------------------------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+-------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+-------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|relatedInstance |Object |relatedInstance Object |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|instanceId |String |instanceId |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInfo |Object |Content of modelInfo object. |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|UserParams |Array |The product family Id. |
-+-------------------------+------------------+-------------------------------------------------+
-
-UserParams Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|name |String |Tag name of attribute |
-+-------------------------+------------------+-------------------------------------------------+
-|value |String |Value of the tag |
-+-------------------------+------------------+-------------------------------------------------+
-
-Delete VNF
-++++++++++
-
-+--------------------+-----------------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId} |
-+--------------------+-----------------------------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+-----------------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+-----------------------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|UserParams |Array |The product family Id. |
-+-------------------------+------------------+-------------------------------------------------+
-
-UserParams Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|name |String |Tag name of attribute |
-+-------------------------+------------------+-------------------------------------------------+
-|value |String |Value of the tag |
-+-------------------------+------------------+-------------------------------------------------+
-
-GET Orchestration Request
-+++++++++++++++++++++++++
-
-+--------------------+-------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6/{request-id} |
-+--------------------+-------------------------------------------------------------------------------------+
-|Operation Type |GET |
-+--------------------+-------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+-------------------------------------------------------------------------------------+
-
-Response Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|request |M |1 |request Object |Content of request object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-Request Object
-
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+===================+=========+===========+==========================+===========================================+
-|requestId |M |1 |String |Request Id |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|startTime |M |1 |request Object |Start time. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestScope |M |1 |request Object |Scope of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestType |M |1 |request Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestDetails |M |1 |requestDetails Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestStatus |M |1 |requestStatus Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-SubscriberInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|GlobalSubscriberId |String |Global customer Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|SubscriberName |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|SubscriptionServiceType |String |The service type of the Subscription |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestStatus Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|finishTime |String |Time |
-+-------------------------+------------------+-------------------------------------------------+
-|requestState |String |state of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|statusMessage |String |statusMessage |
-+-------------------------+------------------+-------------------------------------------------+
-|percentProgress |String |percentage of progress |
-+-------------------------+------------------+-------------------------------------------------+
-
-GET Orchestration Requests
-++++++++++++++++++++++++++
-
-+--------------------+--------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================+
-|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6 |
-+--------------------+--------------------------------------------------------------+
-|Operation Type |GET |
-+--------------------+--------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------+
-
-Response Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestList |M |1 |Array |Content of request List. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestList :
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|request |M |1 |request Object |Content of request object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-Request Object
-
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+===================+=========+===========+==========================+===========================================+
-|requestId |M |1 |String |Request Id. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|startTime |M |1 |request Object |Start time. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestScope |M |1 |request Object |Scope of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestType |M |1 |request Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestDetails |M |1 |requestDetails Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestStatus |M |1 |requestStatus Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-SubscriberInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|GlobalSubscriberId |String |Global customer Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|SubscriberName |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|SubscriptionServiceType |String |The service type of the Subscription |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestStatus Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|finishTime |String |Time |
-+-------------------------+------------------+-------------------------------------------------+
-|requestState |String |state of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|statusMessage |String |statusMessage |
-+-------------------------+------------------+-------------------------------------------------+
-|percentProgress |String |percentage of progress |
-+-------------------------+------------------+-------------------------------------------------+
SDC Client API
--------------
@@ -1371,181 +228,6 @@ Response:
|Content-Disposition |M |Specifies the name of file to store the downloaded artifact’s payload ( RFC 2183) . |
+--------------------+---------+--------------------------------------------------------------------------------------------------------------------------+
-E2E Service API
----------------
-
-Create E2E service instance
-+++++++++++++++++++++++++++
-
-+--------------------+------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+============================================================+
-|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3 |
-+--------------------+------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+------------------------------------------------------------+
-
-Request Body:
-
-+---------+---------+-----------+--------------------------+-----------------------------+
-|Attribute|Qualifier|Cardinality|Content |Description |
-+=========+=========+===========+==========================+=============================+
-|service |M |1 |Service Object |Content of service object. |
-+---------+---------+-----------+--------------------------+-----------------------------+
-
-Service Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|name |String |Service instance name. |
-+------------------------------+-----------------+------------------------------------+
-|description |String |Service instance description |
-+------------------------------+-----------------+------------------------------------+
-|serviceUuid |String |Model UUID |
-+------------------------------+-----------------+------------------------------------+
-|serviceInvariantUuid |String |Model Invariant UUID |
-+------------------------------+-----------------+------------------------------------+
-|gloabalSubscriberId |String |Customer Id |
-+------------------------------+-----------------+------------------------------------+
-|serviceType |String |service Type |
-+------------------------------+-----------------+------------------------------------+
-|parameters |Object |Parameter Object |
-+------------------------------+-----------------+------------------------------------+
-
-Parameter Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|locationConstraints |List of object |location infor for each vnf |
-+------------------------------+-----------------+------------------------------------+
-|resource |List of Resource |resource of service/resource |
-+------------------------------+-----------------+------------------------------------+
-|requestInputs |key-value map |input of service/resource |
-+------------------------------+-----------------+------------------------------------+
-
-LocationConstraint Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|vnfProfileId |String |Customization id for VNF |
-+------------------------------+-----------------+------------------------------------+
-|locationConstraints |Object |DC location info of VNF |
-+------------------------------+-----------------+------------------------------------+
-
-VnfLocationConstraint Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|vimId |String |VIM id from ESR definition |
-+------------------------------+-----------------+------------------------------------+
-
-Resource Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|resourceName |String |The resource name |
-+------------------------------+-----------------+------------------------------------+
-|resourceInvariantUuid |String |The resource invariant UUID. |
-+------------------------------+-----------------+------------------------------------+
-|resourceUuid |String |The resource UUID. |
-+------------------------------+-----------------+------------------------------------+
-|resourceCustomizationUuid |String |The resource customization UUID. |
-+------------------------------+-----------------+------------------------------------+
-|parameters |Object |Parameter of resource |
-+------------------------------+-----------------+------------------------------------+
-
-Response:
-
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|serviceId |M |1 |String |Service instance ID. |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operationId |M |1 |String |Service Operation ID. |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-
-Delete E2E service instance
-+++++++++++++++++++++++++++
-
-+--------------------+----------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+======================================================================+
-|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}|
-+--------------------+----------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+----------------------------------------------------------------------+
-
-Request Parameters:
-
-+-------------------+---------+-----------+-------+----------------------------------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+===================+=========+===========+=======+========================================+
-|globalSubscriberId |M |1 |String |The subscriber id. It is defined in AAI |
-+-------------------+---------+-----------+-------+----------------------------------------+
-|serviceType |M |1 |String |The service type. It is defined in AAI |
-+-------------------+---------+-----------+-------+----------------------------------------+
-
-Response:
-
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operationId |M |1 |String |The operation id. |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-
-Query E2E service operation result
-++++++++++++++++++++++++++++++++++
-
-+--------------------+-----------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+===============================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}/operations/{operationId}|
-+--------------------+-----------------------------------------------------------------------------------------------+
-|Operation Type |GET |
-+--------------------+-----------------------------------------------------------------------------------------------+
-
-Request Parameters:
-
-+--------------+---------+-----------+-------+--------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+==============+=========+===========+=======+==============+
-|serviceId |M |1 |Service instance ID. |
-+--------------+---------+-----------+-------+--------------+
-|operationId |M |1 |Service Operation ID. |
-+--------------+---------+-----------+-------+--------------+
-
-Response:
-
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operation |M |1 |String |Operation object identify. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operationId |M |1 |String |Operation ID. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operation |M |1 |String |Operation type, create|delete. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|result |M |1 |String |Operation result: finished, error, processing. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|reason |M |1 |String |If failing, need to write fail reason. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|userId |M |1 |String |Operation user ID. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operationContent |M |1 |String |The status detail of current operation which is being executing. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|progress |M |1 |String |Current operation progress. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operateAt |M |1 |String |Time that it starts to execute operation. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|finishedAt |M |1 |String |Time that it finished executing operation. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
Inventory APIs
--------------
@@ -4044,7 +2726,7 @@ Candidates Object
+-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
|identifiers |Y |1..N |List |A list of identifiers. |
+-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
-|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id. |
+|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id. |
+-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
diff --git a/docs/api/apis/e2eServiceInstances-api.rst b/docs/api/apis/e2eServiceInstances-api.rst
new file mode 100644
index 0000000000..08434efdfd
--- /dev/null
+++ b/docs/api/apis/e2eServiceInstances-api.rst
@@ -0,0 +1,185 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2018 Huawei Technologies Co., Ltd.
+
+e2eServiceInstances API
+=======================
+
+This API allows to manage:
+
+- e2eServiceInstances (create and delete)
+- operations on e2eServiceInstances (get)
+
+
+Create E2E service instance
++++++++++++++++++++++++++++
+
++--------------------+------------------------------------------------------------+
+|Interface Definition|Description |
++====================+============================================================+
+|URI |/onap/so/infra/e2eServiceInstances/v3 |
++--------------------+------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+------------------------------------------------------------+
+
+Request Body:
+
++---------+---------+-----------+--------------------------+-----------------------------+
+|Attribute|Qualifier|Cardinality|Content |Description |
++=========+=========+===========+==========================+=============================+
+|service |M |1 |Service Object |Content of service object. |
++---------+---------+-----------+--------------------------+-----------------------------+
+
+Service Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|name |String |Service instance name. |
++------------------------------+-----------------+------------------------------------+
+|description |String |Service instance description |
++------------------------------+-----------------+------------------------------------+
+|serviceUuid |String |Model UUID |
++------------------------------+-----------------+------------------------------------+
+|serviceInvariantUuid |String |Model Invariant UUID |
++------------------------------+-----------------+------------------------------------+
+|gloabalSubscriberId |String |Customer Id |
++------------------------------+-----------------+------------------------------------+
+|serviceType |String |service Type |
++------------------------------+-----------------+------------------------------------+
+|parameters |Object |Parameter Object |
++------------------------------+-----------------+------------------------------------+
+
+Parameter Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|locationConstraints |List of object |location infor for each vnf |
++------------------------------+-----------------+------------------------------------+
+|resource |List of Resource |resource of service/resource |
++------------------------------+-----------------+------------------------------------+
+|requestInputs |key-value map |input of service/resource |
++------------------------------+-----------------+------------------------------------+
+
+LocationConstraint Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|vnfProfileId |String |Customization id for VNF |
++------------------------------+-----------------+------------------------------------+
+|locationConstraints |Object |DC location info of VNF |
++------------------------------+-----------------+------------------------------------+
+
+VnfLocationConstraint Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|vimId |String |VIM id from ESR definition |
++------------------------------+-----------------+------------------------------------+
+
+Resource Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|resourceName |String |The resource name |
++------------------------------+-----------------+------------------------------------+
+|resourceInvariantUuid |String |The resource invariant UUID. |
++------------------------------+-----------------+------------------------------------+
+|resourceUuid |String |The resource UUID. |
++------------------------------+-----------------+------------------------------------+
+|resourceCustomizationUuid |String |The resource customization UUID. |
++------------------------------+-----------------+------------------------------------+
+|parameters |Object |Parameter of resource |
++------------------------------+-----------------+------------------------------------+
+
+Response:
+
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|serviceId |M |1 |String |Service instance ID. |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operationId |M |1 |String |Service Operation ID. |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+
+Delete E2E service instance
++++++++++++++++++++++++++++
+
++--------------------+----------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+======================================================================+
+|URI |/onap/so/infra/e2eServiceInstances/v3/{serviceId} |
++--------------------+----------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+----------------------------------------------------------------------+
+
+Request Parameters:
+
++-------------------+---------+-----------+-------+----------------------------------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++===================+=========+===========+=======+========================================+
+|globalSubscriberId |M |1 |String |The subscriber id. It is defined in AAI |
++-------------------+---------+-----------+-------+----------------------------------------+
+|serviceType |M |1 |String |The service type. It is defined in AAI |
++-------------------+---------+-----------+-------+----------------------------------------+
+
+Response:
+
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operationId |M |1 |String |The operation id. |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+
+Query E2E service operation result
+++++++++++++++++++++++++++++++++++
+
++--------------------+-----------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+===============================================================================================+
+|URI |/onap/so/infra/e2eServiceInstances/v3/{serviceId}/operations/{operationId} |
++--------------------+-----------------------------------------------------------------------------------------------+
+|Operation Type |GET |
++--------------------+-----------------------------------------------------------------------------------------------+
+
+Request Parameters:
+
++--------------+---------+-----------+-------+--------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++==============+=========+===========+=======+==============+
+|serviceId |M |1 |Service instance ID. |
++--------------+---------+-----------+-------+--------------+
+|operationId |M |1 |Service Operation ID. |
++--------------+---------+-----------+-------+--------------+
+
+Response:
+
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operation |M |1 |String |Operation object identify. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operationId |M |1 |String |Operation ID. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operation |M |1 |String |Operation type, create|delete. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|result |M |1 |String |Operation result: finished, error, processing. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|reason |M |1 |String |If failing, need to write fail reason. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|userId |M |1 |String |Operation user ID. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operationContent |M |1 |String |The status detail of current operation which is being executing. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|progress |M |1 |String |Current operation progress. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operateAt |M |1 |String |Time that it starts to execute operation. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|finishedAt |M |1 |String |Time that it finished executing operation. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
diff --git a/docs/api/apis/serviceInstances-api.rst b/docs/api/apis/serviceInstances-api.rst
new file mode 100644
index 0000000000..b3fd2cf47d
--- /dev/null
+++ b/docs/api/apis/serviceInstances-api.rst
@@ -0,0 +1,1192 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2018 Huawei Technologies Co., Ltd.
+
+serviceInstances API
+====================
+
+
+This API allows to generate some requests to manage:
+
+- serviceInstances (create, delete)
+- volumeGroups attached to a vnf instance (create, delete)
+- vfModules attached to a vnf instance (create, delete)
+- vnfs attached to a service instance (create, delete)
+- orchestrationRequests (get)
+
+links:
+
+- :ref:`create_service_instance`
+- :ref:`delete_service_instance`
+- :ref:`create_volume_group`
+- :ref:`delete_volume_group`
+- :ref:`create_vf_module`
+- :ref:`delete_vf_module`
+- :ref:`create_vnf`
+- :ref:`delete_vnf`
+- :ref:`get_orchestration_request_by_id`
+- :ref:`get_orchestration_request_all`
+
+
+.. _create_service_instance:
+
+Create service instance
++++++++++++++++++++++++
+
++--------------------+--------------------------------------------------------+
+|Interface Definition|Description |
++====================+========================================================+
+|URI |/onap/so/infra/serviceInstances/v6 |
++--------------------+--------------------------------------------------------+
+|Operation Type |POST |
++--------------------+--------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+
+SubscriberInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|GlobalSubscriberId |String |Global customer Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|SubscriberName |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|SubscriptionServiceType |String |The service type of the Subscription |
++-------------------------+------------------+-------------------------------------------------+
+|UserParams |Array |The product family Id. |
++-------------------------+------------------+-------------------------------------------------+
+|aLaCarte |Boolean | aLaCarte |
++-------------------------+------------------+-------------------------------------------------+
+|autoBuildVfModules |Boolean |autoBuildVfModules |
++-------------------------+------------------+-------------------------------------------------+
+|cascadeDelete |Boolean |cascadeDelete |
++-------------------------+------------------+-------------------------------------------------+
+|usePreload |Boolean |usePreload |
++-------------------------+------------------+-------------------------------------------------+
+|rebuildVolumeGroups |Boolean |rebuildVolumeGroups |
++-------------------------+------------------+-------------------------------------------------+
+|payload |String |payload |
++-------------------------+------------------+-------------------------------------------------+
+|controllerType |String |controllerType |
++-------------------------+------------------+-------------------------------------------------+
+
+UserParams Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|name |String |Tag name of attribute |
++-------------------------+------------------+-------------------------------------------------+
+|value |String |Value of the tag |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+|aicNodeClli |String |aicNodeClli property |
++-------------------------+------------------+-------------------------------------------------+
+
+Project Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|projectName |String |Name of the project |
++-------------------------+------------------+-------------------------------------------------+
+
+OwningEntity Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|owningEntityId |String |owningEntityId of the owingEntity |
++-------------------------+------------------+-------------------------------------------------+
+|owningEntityName |String |owningEntityName of the owingEntity |
++-------------------------+------------------+-------------------------------------------------+
+
+Platform Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|platformName |String |Platform Name |
++-------------------------+------------------+-------------------------------------------------+
+
+LineOfBusiness Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lineOfBusinessName |String |Line Of Business Name |
++-------------------------+------------------+-------------------------------------------------+
+
+
+.. _delete_service_instance:
+
+Delete service instance
++++++++++++++++++++++++
+
++--------------------+--------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId} |
++--------------------+--------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+--------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+
+.. _create_volume_group:
+
+Create Volume Group
++++++++++++++++++++
+
++--------------------+------------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+==================================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups |
++--------------------+------------------------------------------------------------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+------------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+------------------------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+|aicNodeClli |String |aicNodeClli property |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|relatedInstance |Object |relatedInstance Object |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|instanceId |String |instanceId |
++-------------------------+------------------+-------------------------------------------------+
+|modelInfo |Object |Content of modelInfo object. |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _delete_volume_group:
+
+Delete Volume Group
++++++++++++++++++++
+
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+============================================================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volume-groupinstance-id} |
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++---------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=====================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _create_vf_module:
+
+Create VF Module
+++++++++++++++++
+
++--------------------+---------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+===============================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules |
++--------------------+---------------------------------------------------------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+---------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+---------------------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++---------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=====================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|relatedInstanceList |List |Content of relatedInstanceList. |
++---------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|InstanceName |String |The instance Name |
++-------------------------+------------------+-------------------------------------------------+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|SuppressRollback |Boolean |SuppressRollback |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|relatedInstance |Object |relatedInstance Object |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|instanceId |String |instanceId |
++-------------------------+------------------+-------------------------------------------------+
+|modelInfo |Object |Content of modelInfo object. |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |Name of the instance |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _delete_vf_module:
+
+Delete VF Module
+++++++++++++++++
+
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleinstance-id} |
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++---------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=====================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+
+.. _create_vnf:
+
+Create VNF
+++++++++++
+
++--------------------+-------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs |
++--------------------+-------------------------------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+-------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|relatedInstance |Object |relatedInstance Object |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|instanceId |String |instanceId |
++-------------------------+------------------+-------------------------------------------------+
+|modelInfo |Object |Content of modelInfo object. |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|UserParams |Array |The product family Id. |
++-------------------------+------------------+-------------------------------------------------+
+
+UserParams Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|name |String |Tag name of attribute |
++-------------------------+------------------+-------------------------------------------------+
+|value |String |Value of the tag |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _delete_vnf:
+
+Delete VNF
+++++++++++
+
++--------------------+-----------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId} |
++--------------------+-----------------------------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+-----------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-----------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++---------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=====================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++---------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|UserParams |Array |The product family Id. |
++-------------------------+------------------+-------------------------------------------------+
+
+UserParams Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|name |String |Tag name of attribute |
++-------------------------+------------------+-------------------------------------------------+
+|value |String |Value of the tag |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _get_orchestration_request_by_id:
+
+GET Orchestration Request
++++++++++++++++++++++++++
+
++--------------------+-------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================+
+|URI |/onap/so/infra/orchestrationRequests/v6/{request-id} |
++--------------------+-------------------------------------------------------------------------------------+
+|Operation Type |GET |
++--------------------+-------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-------------------------------------------------------------------------------------+
+
+Response Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|request |M |1 |request Object |Content of request object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+Request Object
+
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++===================+=========+===========+==========================+===========================================+
+|requestId |M |1 |String |Request Id |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|startTime |M |1 |request Object |Start time. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestScope |M |1 |request Object |Scope of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestType |M |1 |request Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestDetails |M |1 |requestDetails Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestStatus |M |1 |requestStatus Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+SubscriberInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|GlobalSubscriberId |String |Global customer Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|SubscriberName |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|SubscriptionServiceType |String |The service type of the Subscription |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestStatus Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|finishTime |String |Time |
++-------------------------+------------------+-------------------------------------------------+
+|requestState |String |state of the request |
++-------------------------+------------------+-------------------------------------------------+
+|statusMessage |String |statusMessage |
++-------------------------+------------------+-------------------------------------------------+
+|percentProgress |String |percentage of progress |
++-------------------------+------------------+-------------------------------------------------+
+
+
+.. _get_orchestration_request_all:
+
+GET Orchestration Requests
+++++++++++++++++++++++++++
+
++--------------------+--------------------------------------------------------------+
+|Interface Definition|Description |
++====================+==============================================================+
+|URI |/onap/so/infra/orchestrationRequests/v6 |
++--------------------+--------------------------------------------------------------+
+|Operation Type |GET |
++--------------------+--------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------------+
+
+Response Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestList |M |1 |Array |Content of request List. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestList :
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|request |M |1 |request Object |Content of request object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+Request Object
+
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++===================+=========+===========+==========================+===========================================+
+|requestId |M |1 |String |Request Id. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|startTime |M |1 |request Object |Start time. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestScope |M |1 |request Object |Scope of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestType |M |1 |request Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestDetails |M |1 |requestDetails Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestStatus |M |1 |requestStatus Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+SubscriberInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|GlobalSubscriberId |String |Global customer Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|SubscriberName |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|SubscriptionServiceType |String |The service type of the Subscription |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestStatus Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|finishTime |String |Time |
++-------------------------+------------------+-------------------------------------------------+
+|requestState |String |state of the request |
++-------------------------+------------------+-------------------------------------------------+
+|statusMessage |String |statusMessage |
++-------------------------+------------------+-------------------------------------------------+
+|percentProgress |String |percentage of progress |
++-------------------------+------------------+-------------------------------------------------+
diff --git a/docs/api/offered_consumed_apis.rst b/docs/api/offered_consumed_apis.rst
index 0caef0a426..1d0a8f005b 100644
--- a/docs/api/offered_consumed_apis.rst
+++ b/docs/api/offered_consumed_apis.rst
@@ -3,7 +3,7 @@
.. Copyright 2018 Huawei Technologies Co., Ltd.
SO Offered and Consumed APIs
-=====================================
+============================
The list of APIs that SO offers can be found in following table:
@@ -22,8 +22,9 @@ The list of APIs that SO offers can be found in following table:
"swagger json file", "html doc", "yaml doc"
":download:`link <swagger/swagger.json>`", ":download:`link <swagger/swagger.html>`", ":download:`link <swagger/swagger.yaml>`"
-
-The list of APIs that SO offerers for monitroing the BPMN flows could be found in the following table:
+
+The list of APIs that SO offerers for monitoring the BPMN flows
+could be found in the following table:
.. csv-table::
:header: "|Swagger-icon|", "|yml-icon|"
@@ -33,11 +34,13 @@ The list of APIs that SO offerers for monitroing the BPMN flows could be found i
":download:`link <swagger/SO_MONITORING_SWAGGER.json>`", ":download:`link <swagger/SO_MONITORING_SWAGGER.yaml>`"
Further Reading
-----------------------------------------
+---------------
Detailed documentation can be found here:
.. toctree::
:maxdepth: 1
- apis/SO_Interface.rst \ No newline at end of file
+ apis/serviceInstances-api.rst
+ apis/e2eServiceInstances-api.rst
+ apis/consumed-apis.rst
diff --git a/docs/developer_info/developer_information.rst b/docs/developer_info/developer_information.rst
index ac1a15b8b9..10ea8360b9 100644
--- a/docs/developer_info/developer_information.rst
+++ b/docs/developer_info/developer_information.rst
@@ -8,14 +8,15 @@ SO Developer Information
.. toctree::
:maxdepth: 1
- Camunda_Modeler.rst
+
Building_SO.rst
Working_with_SO_Docker.rst
Camunda_Cockpit_Community_Edition.rst
Camunda_Cockpit_Enterprise_Edition.rst
- Camunda_Modeler
+ Camunda_Modeler.rst
BPMN_Project_Structure.rst
BPMN_Main_Process_Flows.rst
BPMN_Subprocess_Process_Flows.rst
BPMN_Project_Deployment_Strategy.rst
+ instantiate/index.rst
FAQs.rst
diff --git a/docs/developer_info/instantiate/index.rst b/docs/developer_info/instantiate/index.rst
new file mode 100644
index 0000000000..21177b59ad
--- /dev/null
+++ b/docs/developer_info/instantiate/index.rst
@@ -0,0 +1,31 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2017 AT&T Intellectual Property. All rights reserved.
+
+
+Instantiate
+===========
+The following guides are provided to describe tasks that a user of
+ONAP may need to perform when instantiating a service.
+
+Instantiation includes the following topics:
+
+.. toctree::
+ :maxdepth: 2
+
+ Pre-instantiation operations <./pre_instantiation/index.rst>
+
+ Instantiation operation(s) <./instantiation/index.rst>
+
+
+**e2eServiceInstance** method is a hard-coded approach with dedicated/specific
+service BPMN workflow. That means it is linked to ONAP source code
+and lifecycle.
+
+**A La Carte** method requires the Operations actor to build and send
+a lot of operations. To build those requests, Operator actor needs to
+define/collect by himself all VNF parameters/values.
+
+**Macro** method required the Operations actor to build and send only one
+request and, thanks to CDS Blueprint templates, ONAP will collect and assign
+all required parameters/values by itself.
diff --git a/docs/developer_info/instantiate/instantiation/index.rst b/docs/developer_info/instantiate/instantiation/index.rst
new file mode 100644
index 0000000000..455bdf070e
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/index.rst
@@ -0,0 +1,28 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst:
+
+
+Service Instantiation methods
+=============================
+
+
+Declare PNF instances:
+
+.. toctree::
+ :maxdepth: 2
+
+ Declare PNF instances <./pnf_instance/index.rst>
+
+Instantiate a Service:
+
+.. toctree::
+ :maxdepth: 2
+
+ using ONAP VID Portal with "A La Carte" method <./vid/index.rst>
+ using ONAP UUI Portal with "e2eServiceInstance" method <./uui/index.rst>
+ using ONAP NBI REST API (TM Forum) <./nbi/index.rst>
+ using ONAP SO REST API with "A La Carte" method <./so1/index.rst>
+ using ONAP SO REST API with "Macro" mode method <./so2/index.rst>
diff --git a/docs/developer_info/instantiate/instantiation/nbi/index.rst b/docs/developer_info/instantiate/instantiation/nbi/index.rst
new file mode 100644
index 0000000000..96bbc3a8dd
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/nbi/index.rst
@@ -0,0 +1,97 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst_nbi:
+
+
+Service Instantiation via ONAP NBI API (TM Forum)
+=================================================
+
+ONAP NBI allow you to use a TM Forum standardized API (serviceOrder API)
+
+Additional info in:
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ NBI Guide <../../../../../submodules/externalapi/nbi.git/docs/offeredapis/offeredapis.rst>
+
+
+ONAP NBI will convert that request to ONAP SO request.
+
+
+ServiceOrder management in NBI will support 2 modes:
+
+* E2E integration - NBI calls SO API to perform an End-To-end integration
+* Service-level only integration - NBI will trigger only SO request at
+ serviceInstance level (not at VNF, not at Vf-module level and nothing will
+ be created on cloud platform)
+
+ONAP SO prerequisite: SO must be able to find a BPMN to process service
+fulfillment (integrate VNF, VNF activation in SDNC, VF module)
+
+The choice of the mode is done by NBI depending on information retrieved
+in SDC. If the serviceSpecification is within a Category "E2E Service" ,
+NBI will use E2E SO API, if not only API at service instance level
+will be used.
+
+There is no difference or specific expectation in the service order API
+used by NBI user.
+
+
+Example of serviceOrder to instantiate (=add) a service based on model
+with id=0d463b0c-e559-4def-8d7b-df64cfbd3159
+
+
+::
+
+ curl -X POST \
+ http://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/serviceOrder \
+ -H 'Accept: application/json' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "externalId": "BSS_order_001",
+ "priority": "1",
+ "description": "this is a service order to instantiate a service",
+ "category": "Consumer",
+ "requestedStartDate": "",
+ "requestedCompletionDate": "",
+ "relatedParty": [
+ {
+ "id": "JohnDoe",
+ "role": "ONAPcustomer",
+ "name": "JohnDoe"
+ }
+ ],
+ "orderItem": [
+ {
+ "id": "1",
+ "action": "add",
+ "service": {
+ "name": "my_service_model_instance_01",
+ "serviceState": "active",
+ "serviceSpecification": {
+ "id": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ }
+ ]
+ }'
+
+In the response, you will obtain the serviceOrderId value.
+
+Then you have the possibility to check about the serviceorder
+(here after the serviceOrderId=5d06309da0e46400017b1123).
+
+This will allow you to get the serviceOrder Status (completed, failed...)
+
+::
+
+ curl -X GET \
+ http://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/serviceOrder/5d06309da0e46400017b1123 \
+ -H 'Accept: application/json' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache'
diff --git a/docs/developer_info/instantiate/instantiation/pnf_instance/index.rst b/docs/developer_info/instantiate/instantiation/pnf_instance/index.rst
new file mode 100644
index 0000000000..7fbfdbe79f
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/pnf_instance/index.rst
@@ -0,0 +1,107 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+
+
+Declare PNF instances in ONAP
+=============================
+
+PNF instances can be declared in ONAP inventory (AAI) using REST API
+
+
+An example:
+
+::
+
+ curl -X PUT \
+ https://{{ONAP_LB_IP@}}:30233/aai/v16/network/pnfs/pnf/my_pnf_instance_001 \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Cache-Control: no-cache' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: f5e2aae0-dc1c-4edb-b9e9-a93b05aee5e8' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 999' \
+ -H 'depth: all' \
+ -d '{
+ "pnf-name":" my_pnf_instance_001",
+ "equip-type":" router",
+ "nf-role":"primary",
+ "p-interfaces": {
+ "p-interface": [
+ {
+ "interface-name": "ae1",
+ "port-description": "Link aggregate for trunk between switches"
+ },
+ {
+ "interface-name": "xe-0/0/6",
+ "port-description": "to PNF_instance_002 trunk1"
+ },
+ {
+ "interface-name": "xe-0/0/2",
+ "port-description": "to PNF_instance_003 trunk1"
+ },
+ {
+ "interface-name": "xe-0/0/10",
+ "port-description": "to PNF_instance_004 trunk1"
+ },
+ {
+ "interface-name": "xe-0/0/0",
+ "port-description": "firewall trunk"
+ },
+ {
+ "interface-name": "xe-0/0/14",
+ "port-description": "to PNF_instance_005 trunk1"
+ }
+ ]
+ }
+ }' -k
+
+
+It is possible to declare the location where is deployed the PNF
+(called a "complex" in ONAP AAI)
+
+::
+
+ curl -X PUT \
+ https:// {{ONAP_LB_IP@}}:30233/aai/v11/cloud-infrastructure/complexes/complex/my_complex_name \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Cache-Control: no-cache' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: 43523984-db01-449a-8a58-8888871110bc' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 999' \
+ -H 'depth: all' \
+ -d '{
+ "physical-location-type":"PoP",
+ "physical-location-id":"my_complex_name",
+ "complex-name":"Name of my Complex",
+ "city":"LANNION",
+ "postal-code":"22300",
+ "country":"FRANCE",
+ "street1":"Avenue Pierre Marzin",
+ "region":"Europe"
+ }' -k
+
+
+
+To indicate that a PNF instance is located in a complex, we create a relation
+
+::
+
+ curl -X PUT \
+ https:// {{ONAP_LB_IP@}}:30233/aai/v14/network/pnfs/pnf/my_pnf_instance_001/relationship-list/relationship \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Cache-Control: no-cache' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: 15315304-17c5-4e64-aada-bb149f1af915' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 999' \
+ -H 'depth: all' \
+ -d '{
+ "related-to": "complex",
+ "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/my_complex_name"
+ }' -k
diff --git a/docs/developer_info/instantiate/instantiation/so1/index.rst b/docs/developer_info/instantiate/instantiation/so1/index.rst
new file mode 100644
index 0000000000..86f03bdd38
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/so1/index.rst
@@ -0,0 +1,366 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst_so1:
+
+
+A La Carte mode Service Instantiation via ONAP SO API
+=====================================================
+
+Using ONAP SO API in "A La Carte" mode, you need to send several requests,
+depending on the service model composition.
+
+For example, if your service model is composed of 2 VNF and a Network,
+you will have to build and send :
+
+* a request to SO to create the "service instance" object
+* a request to SO to create the VNF 1 instance object
+* a request to SDNC to declare VNF 1 instance parameters and values
+ (SDNC preload)
+* a request to SO to create the Vf-module 1 instance object
+* a request to SO to create the VNF 2 instance object
+* a request to SDNC to declare VNF 2 instance parameters and values
+ (SDNC preload)
+* a request to SO to create the Vf-module 2 instance object
+* a request to SO to create the Network instance object
+
+
+
+Example to request a service instance directly to ONAP SO
+
+
+TO BE COMPLETED
+
+
+
+In the response, you will obtain the serviceOrderId value.
+
+Then you have the possibility to check about the SO request
+(here after the requestId=e3ad8df6-ea0d-4384-be95-bcb7dd39bbde).
+
+This will allow you to get the serviceOrder Status (completed, failed...)
+
+::
+
+ curl -X GET \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/orchestrationRequests/v6/e3ad8df6-ea0d-4384-be95-bcb7dd39bbde \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache'
+
+
+To instantiate a VNF, you need to build a complex request.
+All necessary parameters are available in the Tosca service template
+generated by SDC when you defined your service model.
+
+::
+
+ curl -X POST \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/vnfs \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "requestInfo": {
+ "productFamilyId": "0d463b0c-e559-4def-8d7b-df64cfbd3159",
+ "instanceName": "my_service_vnf_instance_001",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "test"
+ },
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "4e66bb92-c597-439e-822d-75aaa69b13d4",
+ "modelVersionId": "3b6ba59c-287c-449e-a1da-2db49984a087",
+ "modelName": "my_service_VF",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "",
+ "modelCustomizationName": ""
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "VNF_API"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "my_cloud_site",
+ "tenantId": "5906b9b8fd9642df9ba1c9e290063439"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "test_LOB"
+ },
+ "platform": {
+ "platformName": "test_platform"
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "95762b50-0244-4723-8fde-35f911db9263",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "my-service-model",
+ "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da",
+ "modelVersion": "1.0",
+ "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ }]
+ }
+ }'
+
+To instantiate a VF module, you need to build two complex requests
+All necessary parameters are available in the Tosca service template
+generated by SDC when you defined your service model.
+
+1st request is called a "SDNC-preload" for a VNF object and is used
+to store in SDNC some VNF parameters values
+that will be needed for the instantiation
+
+::
+
+ curl -X POST \
+ http://sdnc.api.simpledemo.onap.org:30202/restconf/operations/VNF-API:preload-vnf-topology-operation \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: API client' \
+ -H 'X-TransactionId: 0a3f6713-ba96-4971-a6f8-c2da85a3176e' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "input": {
+ "request-information": {
+ "notification-url": "onap.org",
+ "order-number": "1",
+ "order-version": "1",
+ "request-action": "PreloadVNFRequest",
+ "request-id": "test"
+ },
+ "sdnc-request-header": {
+ "svc-action": "reserve",
+ "svc-notification-url": "http:\/\/onap.org:8080\/adapters\/rest\/SDNCNotify",
+ "svc-request-id": "test"
+ },
+ "vnf-topology-information": {
+ "vnf-assignments": {
+ "availability-zones": [],
+ "vnf-networks": [],
+ "vnf-vms": []
+ },
+ "vnf-parameters": [],
+ "vnf-topology-identifier": {
+ "generic-vnf-name": "my_service_vnf_instance_001",
+ "generic-vnf-type": "",
+ "service-type": "95762b50-0244-4723-8fde-35f911db9263",
+ "vnf-name": "my_service_vfmodule_001",
+ "vnf-type": ""
+ }
+ }
+ }
+ }'
+
+The 2nd request is to instantiate the VF module via ONAP SO
+(instance name must be identical in both requests)
+
+::
+
+ curl -X POST \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/vnfs/vfModules \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "requestInfo": {
+ "instanceName": "my_vfmodule_001",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "test"
+ },
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelInvariantId": "",
+ "modelVersionId": "",
+ "modelName": "",
+ "modelVersion": "1",
+ "modelCustomizationId": "",
+ "modelCustomizationName": ""
+ },
+ "requestParameters": {
+ "userParams": [],
+ "testApi": "VNF_API",
+ "usePreload": true
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "my_cloud_site",
+ "tenantId": "5906b9b8fd9642df9ba1c9e290063439"
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "95762b50-0244-4723-8fde-35f911db9263",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "my-service-model",
+ "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da",
+ "modelVersion": "1.0",
+ "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelName": "my_service_model_VF",
+ "modelInvariantId": "4e66bb92-c597-439e-822d-75aaa69b13d4",
+ "modelVersion": "1.0",
+ "modelVersionId": "3b6ba59c-287c-449e-a1da-2db49984a087",
+ "modelCustomizationId": "",
+ "modelCustomizationName": ""
+ }
+ }
+ }]
+ }
+ }'
+
+
+
+To instantiate a Neutron Network, you need to build two complex request.
+All necessary parameters are available in the Tosca service template
+generated by SDC when you defined your service model.
+
+
+1st request is the "SDNC-preload" for a network object:
+
+::
+
+ curl -X POST \
+ http://sdnc.api.simpledemo.onap.org:30202/restconf/operations/VNF-API:preload-network-topology-operation \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: API client' \
+ -H 'X-TransactionId: 0a3f6713-ba96-4971-a6f8-c2da85a3176e' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "input": {
+ "request-information": {
+ "request-id": "postman001",
+ "notification-url": "http://so.onap.org",
+ "order-number": "postman001",
+ "request-sub-action": "SUPP",
+ "request-action": "PreloadNetworkRequest",
+ "source": "postman",
+ "order-version": "1.0"
+ },
+ "network-topology-information": {
+ "network-policy": [],
+ "route-table-reference": [],
+ "vpn-bindings": [],
+ "network-topology-identifier": {
+ "network-role": "integration_test_net",
+ "network-technology": "neutron",
+ "service-type": "my-service-2",
+ "network-name": "my_network_01",
+ "network-type": "Generic NeutronNet"
+ },
+ "provider-network-information": {
+ "is-external-network": "false",
+ "is-provider-network": "false",
+ "is-shared-network": "false"
+ },
+ "subnets": [
+ {
+ "subnet-name": "my_subnet_01",
+ "subnet-role": "OAM",
+ "start-address": "192.168.90.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "dhcp-enabled": "Y",
+ "dhcp-start-address": "",
+ "dhcp-end-address": "",
+ "gateway-address": "192.168.90.1",
+ "host-routes":[]
+ }
+ ]
+ },
+ "sdnc-request-header": {
+ "svc-action": "reserve",
+ "svc-notification-url": "http://so.onap.org",
+ "svc-request-id": "postman001"
+ }
+ }
+ }'
+
+
+2nd request is to instantiate the network via ONAP SO
+(instance name must be identical in both requests)
+
+
+::
+
+ curl -X POST \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/networks \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "requestInfo": {
+ "instanceName": "my_network_01",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "demo",
+ "productFamilyId": "b9ac88f7-0e1b-462d-84ac-74c3c533217c"
+ },
+ "modelInfo": {
+ "modelType": "network",
+ "modelInvariantId": "0070b65c-48cb-4985-b4df-7c67ca99cd95",
+ "modelVersionId": "4f738bed-e804-4765-8d22-07bb4d11f14b",
+ "modelName": "Generic NeutronNet",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "95534a95-dc8d-4ffb-89c7-091e2c49b55d",
+ "modelCustomizationName": "Generic NeutronNet 0"
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "VNF_API"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "my_cloud_site",
+ "tenantId": "5906b9b8fd9642df9ba1c9e290063439"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "Test_LOB"
+ },
+ "platform": {
+ "platformName": "Test_platform"
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "95762b50-0244-4723-8fde-35f911db9263",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "my_service_model_name",
+ "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da",
+ "modelVersion": "1.0",
+ "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ }]
+ }
+ }'
diff --git a/docs/developer_info/instantiate/instantiation/so2/index.rst b/docs/developer_info/instantiate/instantiation/so2/index.rst
new file mode 100644
index 0000000000..02a5f70d3c
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/so2/index.rst
@@ -0,0 +1,197 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst_so2:
+
+
+Macro mode Service Instantiation via ONAP SO API
+================================================
+
+Using Macro mode, you have to build and send only one request to ONAP SO
+
+In that request you need to indicate all object instances
+that you want to be instantiated.
+
+Reminder : ONAP SO in Macro mode will perform the VNF parameters/values
+assignment based on CDS Blueprint templates
+that are supposed to be defined during Design and Onboard steps.
+That means ONAP has all information
+to be able to get all necessary values by itself (there is no longer need
+for an Operator to provide "SDNC preload").
+
+Additional info in:
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ CDS Documentation <../../../../../submodules/ccsdk/cds.git/docs/index.rst>
+ CDS vDNS E2E Automation <https://wiki.onap.org/display/DW/vDNS+CDS+Dublin>
+
+
+Request Example :
+
+::
+
+ curl -X POST \
+ 'http://{{k8s}}:30277/onap/so/infra/serviceInstantiation/v7/serviceInstances' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "subscriberInfo": {
+ "globalSubscriberId": "Demonstration"
+ },
+ "requestInfo": {
+ "suppressRollback": false,
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "adt",
+ "instanceName": "{{cds-instance-name}}",
+ "source": "VID"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "fr1",
+ "tenantId": "6270eaa820934710960682c506115453"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "vFW",
+ "userParams": [
+ {
+ "Homing_Solution": "none"
+ },
+ {
+ "service": {
+ "instanceParams": [
+
+ ],
+ "instanceName": "{{cds-instance-name}}",
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "{{vnf-modelinfo-modelcustomizationuuid}}",
+ "modelInstanceName": "{{vnf-modelinfo-modelinstancename}}"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "fr1",
+ "tenantId": "6270eaa820934710960682c506115453"
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "someValue"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "{{vnf-modelinfo-modelinstancename}}",
+ "instanceParams": [
+ {
+ "onap_private_net_id": "olc-private",
+ "onap_private_subnet_id": "olc-private",
+ "pub_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwj7uJMyKiP1ogEsZv5kKDFw9mFNhxI+woR3Tuv8vjfNnqdB1GfSnvTFyNbdpyNdR8BlljkiZ1SlwJLEkvPk0HpOoSVVek/QmBeGC7mxyRcpMB2cNQwjXGfsVrforddXOnOkj+zx1aNdVGMc52Js3pex8B/L00H68kOcwP26BI1o77Uh+AxjOkIEGs+wlWNUmXabLDCH8l8IJk9mCTruKEN9KNj4NRZcaNC+XOz42SyHV9RT3N6efp31FqKzo8Ko63QirvKEEBSOAf9VlJ7mFMrGIGH37AP3JJfFYEHDdOA3N64ZpJLa39y25EWwGZNlWpO/GW5bNjTME04dl4eRyd",
+ "image_name": "Ubuntu 14.04",
+ "flavor_name":"s1.cw.small-1"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-0-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-0-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-0-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-0-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-0-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-1-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-1-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-1-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-1-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-1-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-2-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-2-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-2-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-2-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-2-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-3-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-3-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-3-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-3-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-3-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "{{service-uuid}}",
+ "modelInvariantId": "{{service-invariantUUID}}",
+ "modelName": "{{service-name}}",
+ "modelType": "service"
+ }
+ }
+ }
+ ],
+ "aLaCarte": false
+ },
+ "project": {
+ "projectName": "Project-Demonstration"
+ },
+ "owningEntity": {
+ "owningEntityId": "24ef5425-bec4-4fa3-ab03-c0ecf4eaac96",
+ "owningEntityName": "OE-Demonstration"
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "{{service-uuid}}",
+ "modelInvariantId": "{{service-invariantUUID}}",
+ "modelName": "{{service-name}}",
+ "modelType": "service"
+ }
+ }
+ }'
diff --git a/docs/developer_info/instantiate/instantiation/uui/index.rst b/docs/developer_info/instantiate/instantiation/uui/index.rst
new file mode 100644
index 0000000000..fa57be2717
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/uui/index.rst
@@ -0,0 +1,14 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+
+e2eServiceInstance mode via ONAP UUI Portal
+===========================================
+
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ ../../../../../submodules/usecase-ui.git/docs/platform/installation/user-guide/index.rst
diff --git a/docs/developer_info/instantiate/instantiation/vid/index.rst b/docs/developer_info/instantiate/instantiation/vid/index.rst
new file mode 100644
index 0000000000..307ceb9819
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/vid/index.rst
@@ -0,0 +1,13 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+
+A La Carte mode Service Instantiation via ONAP VID Portal
+=========================================================
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ ../../../../../submodules/vid.git/docs/humaninterfaces.rst
diff --git a/docs/developer_info/instantiate/pre_instantiation/index.rst b/docs/developer_info/instantiate/pre_instantiation/index.rst
new file mode 100644
index 0000000000..ca9af13d7d
--- /dev/null
+++ b/docs/developer_info/instantiate/pre_instantiation/index.rst
@@ -0,0 +1,225 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_pre_ser-inst:
+
+
+Pre Service instantiation Operations
+====================================
+
+Several operations need to be performed after Service model distribution,
+but before instantiating a service.
+
+Those operations are only available via REST API requests.
+
+Various tools can be used to send REST API requests.
+
+Here after are examples using "curl" command line tool that you can use in
+a Unix Terminal.
+
+
+Declare owningEntity, lineOfBusiness, Platform and Project
+----------------------------------------------------------
+
+At one point during Service Instantiation, the user need to select values for
+those 4 parameters
+
+* Owning Entity
+* Line Of Business
+* Platform
+* Project
+
+
+Those parameters and values must be pre-declared in ONAP VID component
+using REST API
+
+Those informations will be available to all service instantiation
+(you only need to declare them once in ONAP)
+
+
+Example for "Owning Entity" named "Test"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/owningEntity \
+ -H 'Accept-Encoding: gzip, deflate' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": ["Test"]
+ }'
+
+Example for "platform" named "Test_Platform"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/platform \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": [""Test_Platform"]
+ }'
+
+Example for "line of business" named "Test_LOB"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/lineOfBusiness \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": ["Test_LOB"]
+ }'
+
+Example for "project" named "Test_project"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/project \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": ["Test_project"]
+ }'
+
+
+
+
+Declare a customer
+------------------
+
+Each time you have a new customer, you will need to perform those operations
+
+This operation is using ONAP AAI REST API
+
+Any service instance need to be linked to a customer
+
+in the query path, you put the customer_name
+
+in the query body you put the customer name again
+
+Here after an example to declare a customer named "my_customer_name"
+
+
+::
+
+ curl -X PUT \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "global-customer-id": "my_customer_name",
+ "subscriber-name": "my_customer_name",
+ "subscriber-type": "INFRA"
+ }' -k
+
+
+check customers in ONAP AAI (you should see if everything ok in the response)
+
+::
+
+ curl -X GET \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' -k
+
+
+Associate Service Model to Customer
+-----------------------------------
+
+
+This operation is using ONAP AAI REST API
+
+in the query path, you put the customer_name and the service model name
+
+in the query body you put the service model UUID
+
+::
+
+ curl -X PUT \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: d4bc4991-a518-4d75-8a87-674ba44bf13a' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "service-id": "11265d8c-2cc2-40e5-95d8-57cad81c18da"
+ }' -k
+
+
+
+
+Associate Cloud Site to Customer
+--------------------------------
+
+in the query path, you put the customer_name and the service model name
+
+in the query body you put the cloud owner name, the cloud site name,
+the tenant id and the tenant name
+
+
+::
+
+ curl -X PUT \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name/relationship-list/relationship \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: 11ea9a9e-0dc8-4d20-8a78-c75cd6928916' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "related-to": "tenant",
+ "related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/my_cloud_owner_name/my_cloud_site_name/tenants/tenant/234a9a2dc4b643be9812915b214cdbbb",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "my_cloud_owner_name"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "my_cloud_site_name"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "234a9a2dc4b643be9812915b214cdbbb"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "my_tenant_name"
+ }
+ ]
+ }' -k
+
+
+check (you should see if everything ok in the response)
+
+::
+
+ curl -X GET \
+ 'https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions?depth=all' \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' -k
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index cdb20c246b..3b2649361e 100644
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -26,6 +26,7 @@ Version: 1.4.4
- onap/so/sdnc-adapter,1.4.4
- onap/so/so-monitoring,1.4.4
- onap/so/vfc-adapter,1.4.4
+ - onap/so/vnfm-adapter,1.4.4
**Release Purpose**
@@ -37,7 +38,7 @@ The main goal of the Dublin release was to:
- Support BroadBand Service Usecase
- SO SOL003 plugin support
- Improve PNF PnP
-
+ - Improve SO internal modularity
**Epics**
@@ -50,7 +51,6 @@ The main goal of the Dublin release was to:
- [`SO-1273 <https://jira.onap.org/browse/SO-1273>`__\ ] - PNF PnP Dublin updates & improvements
- [`SO-1271 <https://jira.onap.org/browse/SO-1271>`__\ ] - PNF PnP Casablanca MR updates
- [`SO-677 <https://jira.onap.org/browse/SO-677>`__\ ] - Improve the issues and findings of the SO Casablanca Release
-- [`SO-166 <https://jira.onap.org/browse/SO-166>`__\ ] - Non-stop operations required.
**Stories**
@@ -220,7 +220,7 @@ The main goal of the Dublin release was to:
Testing Terminate and Delete of ETSI VNFM Adapter is done and has some of the minor issues pending, it will be done in El Alto.
-- [`SO-1742 <https://jira.onap.org/browse/SO-1742>`__\ ] - Test Terminate/Delete VNF with VNFM Adapter
+- [`SO-2013 <https://jira.onap.org/browse/SO-2013>`__\ ] - Test Terminate/Delete VNF with VNFM Adapter
**Upgrade Notes**
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java
index 5dbe44f58b..5ae0cea549 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java
@@ -20,6 +20,8 @@
package org.onap.so.apihandlerinfra;
-public interface Actions {
+import java.io.Serializable;
+
+public interface Actions extends Serializable {
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
index c7f6459482..ab2ce10690 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
@@ -29,7 +29,7 @@ public abstract class ApiException extends Exception {
*
*/
private static final long serialVersionUID = 683162058616691134L;
- private int httpResponseCode;
+ private int httpResponseCode = 500;
private String messageID;
private ErrorLoggerInfo errorLoggerInfo;
@@ -49,6 +49,15 @@ public abstract class ApiException extends Exception {
super(message, cause);
}
+ public ApiException(String message, int httpResponseCode) {
+ super(message);
+ this.httpResponseCode = httpResponseCode;
+ }
+
+ public ApiException(String message) {
+ super(message);
+ }
+
public String getMessageID() {
return messageID;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
index 66b86a6961..6a56b58f04 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
@@ -70,7 +70,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
@Override
public Response toResponse(ApiException exception) {
-
+ logger.error("Error During API Call", exception);
return Response.status(exception.getHttpResponseCode()).entity(buildErrorString(exception)).build();
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
index 42198e2d0c..cbbfa16eaa 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
@@ -22,7 +22,7 @@ package org.onap.so.apihandlerinfra.exceptions;
public class DuplicateRequestException extends ApiException {
- private static final String duplicateFailMessage = "Error: Locked instance - This %s (%s) "
+ private static final String DUPLICATE_FAIL_MESSAGE = "Error: Locked instance - This %s (%s) "
+ "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding.";
private DuplicateRequestException(Builder builder) {
@@ -36,7 +36,7 @@ public class DuplicateRequestException extends ApiException {
public Builder(String requestScope, String instance, String requestStatus, String requestID,
int httpResponseCode, String messageID) {
- super(String.format(duplicateFailMessage, requestScope, instance, requestStatus, requestID),
+ super(String.format(DUPLICATE_FAIL_MESSAGE, requestScope, instance, requestStatus, requestID),
httpResponseCode, messageID);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java
index 577a14674b..a8f868da05 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java
@@ -22,7 +22,7 @@ package org.onap.so.apihandlerinfra.exceptions;
public class RequestDbFailureException extends ApiException {
- private static final String requestDbFailMessage = "Unable to %s due to error contacting requestDb: %s";
+ private static final String REQUEST_DB_FAIL_MESSAGE = "Unable to %s due to error contacting requestDb: %s";
private RequestDbFailureException(Builder builder) {
super(builder);
@@ -32,7 +32,7 @@ public class RequestDbFailureException extends ApiException {
public Builder(String action, String error, int httpResponseCode, String messageID) {
- super(requestDbFailMessage.format(requestDbFailMessage, action, error), httpResponseCode, messageID);
+ super(REQUEST_DB_FAIL_MESSAGE.format(REQUEST_DB_FAIL_MESSAGE, action, error), httpResponseCode, messageID);
}
public RequestDbFailureException build() {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
index 372ed30d8e..ae8256e64f 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
@@ -28,6 +28,11 @@ public class ValidateException extends ApiException {
}
+ public ValidateException(String errorMessage, int httpResponseCode) {
+ super(errorMessage, httpResponseCode);
+ }
+
+
public static class Builder extends ApiException.Builder<Builder> {
public Builder(String message, int httpResponseCode, String messageID) {
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index a3b9827d9f..bb726e68aa 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -18,7 +18,7 @@
<camunda.bpm.assert.version>1.2</camunda.bpm.assert.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <swagger-version>1.3.0</swagger-version>
+ <swagger.version>2.0.8</swagger.version>
<jax-rs-version>1.1.1</jax-rs-version>
<json4s-jackson-version>3.6.0</json4s-jackson-version>
<json4s-core-version>3.6.0</json4s-core-version>
@@ -56,10 +56,16 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${swagger.version}</version>
+ </dependency>
<dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <version>1.5.16</version>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2</artifactId>
+ <version>2.0.6</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java
deleted file mode 100644
index a3ff1ab95d..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.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.apihandler.filters;
-
-import java.io.IOException;
-import java.net.URI;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.PreMatching;
-import javax.ws.rs.core.UriInfo;
-import org.onap.so.apihandlerinfra.Constants;
-
-
-@PreMatching
-public class RequestUriFilter implements ContainerRequestFilter {
-
- private String requestURI;
-
- @Override
- public void filter(ContainerRequestContext context) throws IOException {
- UriInfo uriInfo = context.getUriInfo();
- URI baseURI = uriInfo.getBaseUri();
- requestURI = uriInfo.getPath();
-
- if (requestURI.contains("onap/so/infra/serviceInstances")) {
- requestURI = requestURI.replaceFirst("serviceInstances", "serviceInstantiation");
- if (!requestURI.contains(Constants.SERVICE_INSTANCE_PATH)) {
- // Adds /serviceInstances after the version provided in the URI
- requestURI = new StringBuilder(requestURI)
- .insert(requestURI.indexOf(Constants.SERVICE_INSTANTIATION_PATH) + 24,
- Constants.SERVICE_INSTANCE_PATH)
- .toString();
- }
- requestURI = baseURI + requestURI;
- URI uri = URI.create(requestURI);
- context.setRequestUri(uri);
- }
- }
-
- public String getRequestUri() {
- return requestURI;
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
index 451fa64585..e56eb422d8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
@@ -115,7 +115,7 @@ public class CamundaRequestHandler {
List<HistoricProcessInstanceEntity> historicProcessInstanceList = response.getBody();
- if (historicProcessInstanceList != null) {
+ if (historicProcessInstanceList != null && !historicProcessInstanceList.isEmpty()) {
Collections.reverse(historicProcessInstanceList);
processInstanceId = historicProcessInstanceList.get(0).getId();
} else {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index d3a279fd8e..650922094d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -76,13 +76,19 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/e2eServiceInstances")
-@Api(value = "/onap/so/infra/e2eServiceInstances", description = "API Requests for E2E Service Instances")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/e2eServiceInstances",
+ description = "API Requests for E2E Service Instances"))
+
public class E2EServiceInstances {
private HashMap<String, String> instanceIdMap = new HashMap<>();
@@ -119,7 +125,8 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create an E2E Service Instance on a version provided", response = Response.class)
+ @Operation(description = "Create an E2E Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response createE2EServiceInstance(String request, @PathParam("version") String version) throws ApiException {
return processE2EserviceInstances(request, Action.createInstance, null, version);
@@ -135,8 +142,9 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}/{serviceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update an E2E Service Instance on a version provided and serviceId",
- response = Response.class)
+ @Operation(description = "Update an E2E Service Instance on a version provided and serviceId",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response updateE2EServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceId") String serviceId) throws ApiException {
@@ -155,7 +163,9 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}/{serviceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class)
+ @Operation(description = "Delete E2E Service Instance on a specified version and serviceId",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response deleteE2EServiceInstance(String request, @PathParam("version") String version,
@PathParam(SERVICE_ID) String serviceId) throws ApiException {
@@ -166,8 +176,9 @@ public class E2EServiceInstances {
@GET
@Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
- @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId",
- response = Response.class)
+ @Operation(description = "Find e2eServiceInstances Requests for a given serviceId and operationId",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Produces(MediaType.APPLICATION_JSON)
public Response getE2EServiceInstances(@PathParam(SERVICE_ID) String serviceId,
@PathParam("version") String version, @PathParam("operationId") String operationId) {
@@ -184,7 +195,8 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}/{serviceId}/scale")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Scale E2E Service Instance on a specified version", response = Response.class)
+ @Operation(description = "Scale E2E Service Instance on a specified version", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response scaleE2EServiceInstance(String request, @PathParam("version") String version,
@PathParam(SERVICE_ID) String serviceId) throws ApiException {
@@ -203,9 +215,10 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}/{serviceId}/modeldifferences")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(
- value = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ",
- response = Response.class)
+ @Operation(
+ description = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response compareModelwithTargetVersion(String request, @PathParam("serviceId") String serviceId,
@PathParam("version") String version) throws ApiException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GenericStringConverter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GenericStringConverter.java
new file mode 100644
index 0000000000..80144d8ca1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GenericStringConverter.java
@@ -0,0 +1,33 @@
+package org.onap.so.apihandlerinfra;
+
+import java.net.URI;
+import java.util.Set;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
+import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.core.convert.converter.GenericConverter;
+import org.springframework.stereotype.Component;
+import com.google.common.collect.ImmutableSet;
+
+@Component
+@ConfigurationPropertiesBinding
+public class GenericStringConverter implements GenericConverter {
+
+ @Autowired
+ private HealthCheckConverter converter;
+
+ @Override
+ public Set<ConvertiblePair> getConvertibleTypes() {
+
+ ConvertiblePair[] pairs = new ConvertiblePair[] {new ConvertiblePair(String.class, Subsystem.class),
+ new ConvertiblePair(String.class, URI.class)};
+ return ImmutableSet.copyOf(pairs);
+ }
+
+ @Override
+ public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
+
+ return converter.convert(source, sourceType, targetType);
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
index 3d4b2c76fb..5327211280 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
@@ -25,11 +25,8 @@ package org.onap.so.apihandlerinfra;
import java.net.URI;
import java.util.Collections;
-import org.onap.so.logger.LoggingAnchor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
+import java.util.List;
+import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.transaction.Transactional;
import javax.ws.rs.DefaultValue;
@@ -42,95 +39,96 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
+import org.onap.so.apihandlerinfra.HealthCheckConfig.Endpoint;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
-import org.springframework.http.HttpMethod;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/globalhealthcheck")
-@Api(value = "/globalhealthcheck", description = "APIH Infra Global Health Check")
+@OpenAPIDefinition(info = @Info(title = "/globalhealthcheck", description = "APIH Infra Global Health Check"))
public class GlobalHealthcheckHandler {
private static Logger logger = LoggerFactory.getLogger(GlobalHealthcheckHandler.class);
- private static final String CONTEXTPATH_PROPERTY = "management.context-path";
- private static final String PROPERTY_DOMAIN = "mso.health.endpoints";
- private static final String CATALOGDB_PROPERTY = PROPERTY_DOMAIN + ".catalogdb";
- private static final String REQUESTDB_PROPERTY = PROPERTY_DOMAIN + ".requestdb";
- private static final String SDNC_PROPERTY = PROPERTY_DOMAIN + ".sdnc";
- private static final String OPENSTACK_PROPERTY = PROPERTY_DOMAIN + ".openstack";
- private static final String BPMN_PROPERTY = PROPERTY_DOMAIN + ".bpmn";
- private static final String ASDC_PROPERTY = PROPERTY_DOMAIN + ".asdc";
- private static final String REQUESTDBATTSVC_PROPERTY = PROPERTY_DOMAIN + ".requestdbattsvc";
- private static final String DEFAULT_PROPERTY_VALUE = "";
+ protected static final String CONTEXTPATH_PROPERTY = "management.endpoints.web.base-path";
+ protected static final String PROPERTY_DOMAIN = "mso.health";
+ protected static final String CATALOGDB_PROPERTY = PROPERTY_DOMAIN + ".endpoints.catalogdb";
+ protected static final String REQUESTDB_PROPERTY = PROPERTY_DOMAIN + ".endpoints.requestdb";
+ protected static final String SDNC_PROPERTY = PROPERTY_DOMAIN + ".endpoints.sdnc";
+ protected static final String OPENSTACK_PROPERTY = PROPERTY_DOMAIN + ".endpoints.openstack";
+ protected static final String BPMN_PROPERTY = PROPERTY_DOMAIN + ".endpoints.bpmn";
+ protected static final String ASDC_PROPERTY = PROPERTY_DOMAIN + ".endpoints.asdc";
+ protected static final String REQUESTDBATTSVC_PROPERTY = PROPERTY_DOMAIN + ".endpoints.requestdbattsvc";
+ protected static final String MSO_AUTH_PROPERTY = PROPERTY_DOMAIN + ".auth";
+ protected static final String DEFAULT_PROPERTY_VALUE = "";
// e.g. /manage
private String actuatorContextPath;
- private String endpointCatalogdb;
- private String endpointRequestdb;
- private String endpointSdnc;
- private String endpointOpenstack;
- private String endpointBpmn;
- private String endpointAsdc;
- private String endpointRequestdbAttsvc;
@Autowired
private Environment env;
@Autowired
private RestTemplate restTemplate;
- private final String health = "/health";
+ @Autowired
+ private HealthCheckConfig config;
+
+ private static final String HEALTH = "/health";
+
+ private String msoAuth;
@PostConstruct
protected void init() {
actuatorContextPath = env.getProperty(CONTEXTPATH_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointCatalogdb = env.getProperty(CATALOGDB_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointRequestdb = env.getProperty(REQUESTDB_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointSdnc = env.getProperty(SDNC_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointOpenstack = env.getProperty(OPENSTACK_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointBpmn = env.getProperty(BPMN_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointAsdc = env.getProperty(ASDC_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointRequestdbAttsvc = env.getProperty(REQUESTDBATTSVC_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
+ msoAuth = env.getProperty(MSO_AUTH_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
}
@GET
@Produces("application/json")
- @ApiOperation(value = "Performing global health check", response = Response.class)
+ @Operation(description = "Performing global health check", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response globalHealthcheck(@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn,
@Context ContainerRequestContext requestContext) {
Response HEALTH_CHECK_RESPONSE = null;
// Build internal response object
- HealthcheckResponse rsp = new HealthcheckResponse();
+ HealthCheckResponse rsp = new HealthCheckResponse();
try {
// Generated RequestId
String requestId = requestContext.getProperty("requestId").toString();
logger.info(LoggingAnchor.TWO, MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
- // set APIH status, this is the main entry point
- rsp.setApih(HealthcheckStatus.UP.toString());
- // set BPMN
- rsp.setBpmn(querySubsystemHealth(MsoSubsystems.BPMN));
- // set SDNCAdapter
- rsp.setSdncAdapter(querySubsystemHealth(MsoSubsystems.SDNC));
- // set ASDCController
- rsp.setAsdcController(querySubsystemHealth(MsoSubsystems.ASDC));
- // set CatalogDbAdapter
- rsp.setCatalogdbAdapter(querySubsystemHealth(MsoSubsystems.CATALOGDB));
- // set RequestDbAdapter
- rsp.setRequestdbAdapter(querySubsystemHealth(MsoSubsystems.REQUESTDB));
- // set OpenStackAdapter
- rsp.setOpenstackAdapter(querySubsystemHealth(MsoSubsystems.OPENSTACK));
- // set RequestDbAdapterAttSvc
- rsp.setRequestdbAdapterAttsvc(querySubsystemHealth(MsoSubsystems.REQUESTDBATT));
+ List<Endpoint> endpoints = config.getEndpoints().stream().filter(item -> {
+ if (!enableBpmn && SoSubsystems.BPMN.equals(item.getSubsystem())) {
+ return false;
+ } else {
+ return true;
+ }
+ }).collect(Collectors.toList());
+
+ for (Endpoint endpoint : endpoints) {
+ rsp.getSubsystems().add(querySubsystemHealth(endpoint));
+ }
+
// set Message
rsp.setMessage(String.format("HttpStatus: %s", HttpStatus.SC_OK));
logger.info(rsp.toString());
@@ -149,70 +147,51 @@ public class GlobalHealthcheckHandler {
protected HttpEntity<String> buildHttpEntityForRequest() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
- headers.set("Content-Type", "application/json");
+ headers.set(HttpHeaders.CONTENT_TYPE, "application/json");
+ headers.set(HttpHeaders.AUTHORIZATION, msoAuth);
HttpEntity<String> entity = new HttpEntity<>("parameters", headers);
return entity;
}
- protected String querySubsystemHealth(MsoSubsystems subsystem) {
+ protected HealthCheckSubsystem querySubsystemHealth(Endpoint subsystem) {
+ HealthCheckStatus status = HealthCheckStatus.DOWN;
+ URI uri = subsystem.getUri();
try {
// get port number for the subsystem
- String ept = getEndpointUrlForSubsystemEnum(subsystem);
-
// build final endpoint url
- UriBuilder builder = UriBuilder.fromPath(ept).path(actuatorContextPath).path(health);
- URI uri = builder.build();
- logger.info("Calculated URL: {}", uri.toString());
+ uri = UriBuilder.fromUri(subsystem.getUri()).path(actuatorContextPath).path(HEALTH).build();
+ logger.info("Calculated URL: {}", uri);
ResponseEntity<SubsystemHealthcheckResponse> result = restTemplate.exchange(uri, HttpMethod.GET,
buildHttpEntityForRequest(), SubsystemHealthcheckResponse.class);
- return processResponseFromSubsystem(result, subsystem);
+ status = processResponseFromSubsystem(result, subsystem);
+
} catch (Exception ex) {
logger.error("Exception occured in GlobalHealthcheckHandler.querySubsystemHealth() ", ex);
- return HealthcheckStatus.DOWN.toString();
}
+
+ return new HealthCheckSubsystem(subsystem.getSubsystem(), uri, status);
}
- protected String processResponseFromSubsystem(ResponseEntity<SubsystemHealthcheckResponse> result,
- MsoSubsystems subsystem) {
+ protected HealthCheckStatus processResponseFromSubsystem(ResponseEntity<SubsystemHealthcheckResponse> result,
+ Endpoint endpoint) {
if (result == null || result.getStatusCodeValue() != HttpStatus.SC_OK) {
logger.error(String.format("Globalhealthcheck: checking subsystem: %s failed ! result object is: %s",
- subsystem, result == null ? "NULL" : result));
- return HealthcheckStatus.DOWN.toString();
+ endpoint.getSubsystem(), result == null ? "NULL" : result));
+ return HealthCheckStatus.DOWN;
}
SubsystemHealthcheckResponse body = result.getBody();
String status = body.getStatus();
if ("UP".equalsIgnoreCase(status)) {
- return HealthcheckStatus.UP.toString();
+ return HealthCheckStatus.UP;
} else {
- logger.error("{}, query health endpoint did not return UP status!", subsystem);
- return HealthcheckStatus.DOWN.toString();
+ logger.error("{}, query health endpoint did not return UP status!", endpoint.getSubsystem());
+ return HealthCheckStatus.DOWN;
}
}
-
- protected String getEndpointUrlForSubsystemEnum(MsoSubsystems subsystem) {
- switch (subsystem) {
- case SDNC:
- return this.endpointSdnc;
- case ASDC:
- return this.endpointAsdc;
- case BPMN:
- return this.endpointBpmn;
- case CATALOGDB:
- return this.endpointCatalogdb;
- case OPENSTACK:
- return this.endpointOpenstack;
- case REQUESTDB:
- return this.endpointRequestdb;
- case REQUESTDBATT:
- return this.endpointRequestdbAttsvc;
- default:
- return "";
- }
- }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheck.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheck.java
new file mode 100644
index 0000000000..1899cdd765
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheck.java
@@ -0,0 +1,84 @@
+package org.onap.so.apihandlerinfra;
+
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConfigurationProperties(prefix = "mso.health.enpoints")
+public class HealthCheck {
+
+ private Subsystem subsystem;
+ private URI uri;
+ private HealthCheckStatus status = HealthCheckStatus.DOWN;
+
+ public HealthCheck() {
+
+ }
+
+ public HealthCheck(String subsystem, String uri) {
+ this.subsystem = SoSubsystems.valueOf(subsystem.toUpperCase());
+ this.uri = UriBuilder.fromUri(uri).build();
+ }
+
+ public HealthCheck(Subsystem subsystem, URI uri) {
+ this.subsystem = subsystem;
+ this.uri = uri;
+ }
+
+ public HealthCheck(Subsystem subsystem, URI uri, HealthCheckStatus status) {
+ this.subsystem = subsystem;
+ this.uri = uri;
+ this.status = status;
+ }
+
+ public Subsystem getSubsystem() {
+ return subsystem;
+ }
+
+ public void setSubsystem(Subsystem component) {
+ this.subsystem = component;
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
+ public HealthCheckStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(HealthCheckStatus status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("subsystem", subsystem).append("uri", uri).append("status", status)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof HealthCheck)) {
+ return false;
+ }
+ HealthCheck castOther = (HealthCheck) other;
+ return new EqualsBuilder().append(subsystem, castOther.subsystem).append(uri, castOther.uri)
+ .append(status, castOther.status).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(subsystem).append(uri).append(status).toHashCode();
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConfig.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConfig.java
new file mode 100644
index 0000000000..11fd94bc91
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConfig.java
@@ -0,0 +1,83 @@
+/*-
+ * ============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.apihandlerinfra;
+
+import java.net.URI;
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.validation.annotation.Validated;
+
+@Configuration
+@ConfigurationProperties(prefix = "mso.health")
+@Validated
+public class HealthCheckConfig {
+
+ @NotNull
+ private List<Endpoint> endpoints;
+
+ public List<Endpoint> getEndpoints() {
+ return endpoints;
+ }
+
+ public void setEndpoints(List<Endpoint> endpoints) {
+ this.endpoints = endpoints;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("endpoints", this.endpoints).toString();
+ }
+
+ @Validated
+ public static class Endpoint {
+ @NotNull
+ private Subsystem subsystem;
+ @NotNull
+ private URI uri;
+
+ public Endpoint() {
+
+ }
+
+ public Endpoint(Subsystem subsystem, URI uri) {
+ this.subsystem = subsystem;
+ this.uri = uri;
+ }
+
+ public Subsystem getSubsystem() {
+ return subsystem;
+ }
+
+ public void setSubsystem(Subsystem subsystem) {
+ this.subsystem = subsystem;
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConverter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConverter.java
new file mode 100644
index 0000000000..ed06018e7b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConverter.java
@@ -0,0 +1,22 @@
+package org.onap.so.apihandlerinfra;
+
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
+import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.stereotype.Component;
+
+@Component
+public class HealthCheckConverter {
+
+
+ public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
+ if (sourceType.getType() == String.class && targetType.getType() == Subsystem.class) {
+ return SoSubsystems.valueOf(((String) source).toUpperCase());
+ } else if (sourceType.getType() == String.class && targetType.getType() == URI.class) {
+ return UriBuilder.fromUri((String) source).build();
+ } else {
+ return source;
+ }
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckResponse.java
index 479d2e82bd..5400249c65 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckResponse.java
@@ -17,13 +17,33 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+package org.onap.so.apihandlerinfra;
-package org.onap.so.bpmn.common.util;
+import java.util.ArrayList;
+import java.util.List;
-public interface ICryptoHandler {
- public String getMsoAaiPassword();
+public class HealthCheckResponse {
+
+
+ private List<HealthCheckSubsystem> subsystems = new ArrayList<>();
+ private String message;
+
+
+ public List<HealthCheckSubsystem> getSubsystems() {
+ return subsystems;
+ }
+
+ public void setSubsystems(List<HealthCheckSubsystem> subsystems) {
+ this.subsystems = subsystems;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
- public String encryptMsoPassword(String plainPwd);
- public String decryptMsoPassword(String encryptedPwd);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckStatus.java
index 077a3c2d60..6b31c1f1ed 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckStatus.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckStatus.java
@@ -19,12 +19,12 @@
*/
package org.onap.so.apihandlerinfra;
-public enum HealthcheckStatus {
+public enum HealthCheckStatus {
UP("UP"), DOWN("DOWN");
private String status;
- private HealthcheckStatus(String status) {
+ private HealthCheckStatus(String status) {
this.status = status;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckSubsystem.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckSubsystem.java
new file mode 100644
index 0000000000..e1335b952c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckSubsystem.java
@@ -0,0 +1,40 @@
+package org.onap.so.apihandlerinfra;
+
+import java.net.URI;
+
+public class HealthCheckSubsystem {
+
+ private Subsystem subsystem;
+ private URI uri;
+ private HealthCheckStatus status;
+
+ public HealthCheckSubsystem(Subsystem subsystem, URI uri, HealthCheckStatus status) {
+ this.subsystem = subsystem;
+ this.uri = uri;
+ this.status = status;
+ }
+
+ public Subsystem getSubsystem() {
+ return subsystem;
+ }
+
+ public void setSubsystem(Subsystem subsystem) {
+ this.subsystem = subsystem;
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
+ public HealthCheckStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(HealthCheckStatus status) {
+ this.status = status;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckResponse.java
deleted file mode 100644
index fad3dd4055..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckResponse.java
+++ /dev/null
@@ -1,116 +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.apihandlerinfra;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-public class HealthcheckResponse {
- private String apih;
- private String bpmn;
- private String sdncAdapter;
- private String asdcController;
- private String catalogdbAdapter;
- private String requestdbAdapter;
- private String openstackAdapter;
- private String requestdbAdapterAttsvc;
- private String message = "";
-
- public String getApih() {
- return apih;
- }
-
- public void setApih(String apih) {
- this.apih = apih;
- }
-
- public String getBpmn() {
- return bpmn;
- }
-
- public void setBpmn(String bpmn) {
- this.bpmn = bpmn;
- }
-
- public String getSdncAdapter() {
- return sdncAdapter;
- }
-
- public void setSdncAdapter(String sdncAdapter) {
- this.sdncAdapter = sdncAdapter;
- }
-
- public String getAsdcController() {
- return asdcController;
- }
-
- public void setAsdcController(String asdcController) {
- this.asdcController = asdcController;
- }
-
- public String getCatalogdbAdapter() {
- return catalogdbAdapter;
- }
-
- public void setCatalogdbAdapter(String catalogdbAdapter) {
- this.catalogdbAdapter = catalogdbAdapter;
- }
-
- public String getRequestdbAdapter() {
- return requestdbAdapter;
- }
-
- public void setRequestdbAdapter(String requestdbAdapter) {
- this.requestdbAdapter = requestdbAdapter;
- }
-
- public String getOpenstackAdapter() {
- return openstackAdapter;
- }
-
- public void setOpenstackAdapter(String openstackAdapter) {
- this.openstackAdapter = openstackAdapter;
- }
-
- public String getRequestdbAdapterAttsvc() {
- return requestdbAdapterAttsvc;
- }
-
- public void setRequestdbAdapterAttsvc(String requestdbAdapterAttsvc) {
- this.requestdbAdapterAttsvc = requestdbAdapterAttsvc;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("apih", this.apih).append("pbmn", this.bpmn)
- .append("sdncAdapter", this.sdncAdapter).append("asdcController", this.asdcController)
- .append("catalogdbAdapter", this.catalogdbAdapter).append("requestdbAdapter", this.requestdbAdapter)
- .append("openstackAdapter", this.openstackAdapter)
- .append("requestdbAdapterAttsvc", this.requestdbAdapterAttsvc).append("message", this.message)
- .toString();
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index 554c794e3e..d3bd769386 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -23,8 +23,6 @@
package org.onap.so.apihandlerinfra;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.RequestClientParameter;
@@ -61,10 +59,18 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.util.HashMap;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/instanceManagement")
-@Api(value = "/onap/so/infra/instanceManagement", description = "Infrastructure API Requests for Instance Management")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/instanceManagement",
+ description = "Infrastructure API Requests for Instance Management"))
public class InstanceManagement {
private static Logger logger = LoggerFactory.getLogger(InstanceManagement.class);
@@ -87,7 +93,8 @@ public class InstanceManagement {
@Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/workflows/{workflowUuid}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Execute custom workflow", response = Response.class)
+ @Operation(description = "Execute custom workflow", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response executeCustomWorkflow(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -216,7 +223,7 @@ public class InstanceManagement {
try {
recipeLookupResult = getCustomWorkflowUri(workflowUuid);
- } catch (IOException e) {
+ } catch (Exception e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -243,7 +250,7 @@ public class InstanceManagement {
return recipeLookupResult;
}
- private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) throws IOException {
+ private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) {
String recipeUri = null;
Workflow workflow = catalogDbClient.findWorkflowByArtifactUUID(workflowUuid);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index 00d36b3ff9..2703e1edd3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,12 +20,15 @@
package org.onap.so.apihandlerinfra;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import javax.annotation.PostConstruct;
+import javax.servlet.ServletConfig;
import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Context;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletProperties;
import org.onap.so.apihandler.filters.RequestIdFilter;
-import org.onap.so.apihandler.filters.RequestUriFilter;
import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper;
import org.onap.so.apihandlerinfra.infra.rest.Network;
import org.onap.so.apihandlerinfra.infra.rest.ServiceInstance;
@@ -43,9 +46,13 @@ import org.onap.so.apihandlerinfra.tenantisolation.ModelDistributionRequest;
import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
import org.onap.so.web.exceptions.RuntimeExceptionMapper;
import org.springframework.context.annotation.Configuration;
-import io.swagger.jaxrs.config.BeanConfig;
-import io.swagger.jaxrs.listing.ApiListingResource;
-import io.swagger.jaxrs.listing.SwaggerSerializers;
+import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder;
+import io.swagger.v3.jaxrs2.integration.resources.AcceptHeaderOpenApiResource;
+import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
+import io.swagger.v3.oas.integration.OpenApiConfigurationException;
+import io.swagger.v3.oas.integration.SwaggerConfiguration;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.info.Info;
@Configuration
@ApplicationPath("/")
@@ -68,11 +75,10 @@ public class JerseyConfiguration extends ResourceConfig {
register(JaxRsFilterLogging.class);
register(ManualTasks.class);
register(TasksHandler.class);
- register(ApiListingResource.class);
- register(SwaggerSerializers.class);
+ register(OpenApiResource.class);
+ register(AcceptHeaderOpenApiResource.class);
register(ApiExceptionMapper.class);
register(RuntimeExceptionMapper.class);
- register(RequestUriFilter.class);
register(RequestIdFilter.class);
register(E2EServiceInstances.class);
register(WorkflowSpecificationsHandler.class);
@@ -88,12 +94,21 @@ public class JerseyConfiguration extends ResourceConfig {
register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
register(ModelDistributionRequest.class);
property(ServletProperties.FILTER_FORWARD_ON_404, true);
- BeanConfig beanConfig = new BeanConfig();
- beanConfig.setVersion("1.0.2");
- beanConfig.setSchemes(new String[] {"https"});
- beanConfig.setResourcePackage("org.onap.so.apihandlerinfra");
- beanConfig.setPrettyPrint(true);
- beanConfig.setScan(true);
+
+ OpenAPI oas = new OpenAPI();
+ Info info = new Info();
+ info.title("Swagger apihandlerinfra bootstrap code");
+ info.setVersion("1.0.2");
+
+ SwaggerConfiguration oasConfig = new SwaggerConfiguration().openAPI(oas).prettyPrint(true)
+ .resourcePackages(Stream.of("org.onap.so.apihandlerinfra").collect(Collectors.toSet()));
+
+ try {
+ new JaxrsOpenApiContextBuilder().application(this).openApiConfiguration(oasConfig).buildContext(true);
+ } catch (OpenApiConfigurationException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
index b9b7fcc0d4..4bafb40b32 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
@@ -34,7 +34,6 @@ import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
@@ -52,6 +51,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.Value;
import org.onap.so.apihandlerinfra.tasksbeans.Variables;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,8 +60,11 @@ import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-import io.swagger.annotations.ApiOperation;
-
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("/tasks")
@Component
@@ -85,7 +88,8 @@ public class ManualTasks {
@Path("/{version:[vV]1}/{taskId}/complete")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Complete specified task", response = Response.class)
+ @Operation(description = "Complete specified task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response completeTask(String request, @PathParam("version") String version,
@PathParam("taskId") String taskId, @Context ContainerRequestContext requestContext) throws ApiException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
index 3337c62afd..e56ee24baf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
@@ -22,7 +22,19 @@
package org.onap.so.apihandlerinfra;
-import java.net.UnknownHostException;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.apache.http.HttpStatus;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -30,17 +42,10 @@ import javax.ws.rs.Produces;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
-import org.onap.so.logger.LoggingAnchor;
-import org.apache.http.HttpStatus;
-import org.onap.so.logger.MessageEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import java.net.UnknownHostException;
@Path("/nodehealthcheck")
-@Api(value = "/nodehealthcheck", description = "API Handler Infra Node Health Check")
+@OpenAPIDefinition(info = @Info(title = "/nodehealthcheck", description = "API Handler Infra Node Health Check"))
@Component
public class NodeHealthcheckHandler {
@@ -53,7 +58,8 @@ public class NodeHealthcheckHandler {
@GET
@Produces("text/html")
- @ApiOperation(value = "Performing node health check", response = Response.class)
+ @Operation(description = "Performing node health check", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response nodeHealthcheck(@Context ContainerRequestContext requestContext) throws UnknownHostException {
// Generated RequestId
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index 6f36fb2aff..b49f9b5a8d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -42,6 +42,7 @@ import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.EnumUtils;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.ResponseBuilder;
@@ -72,16 +73,24 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("onap/so/infra/orchestrationRequests")
-@Api(value = "onap/so/infra/orchestrationRequests", description = "API Requests for Orchestration requests")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/orchestrationRequests",
+ description = "API Requests for Orchestration requests"))
+
@Component
public class OrchestrationRequests {
private static Logger logger = LoggerFactory.getLogger(OrchestrationRequests.class);
+ private static final String ERROR_MESSAGE_PREFIX = "Error Source: %s, Error Message: %s";
@Autowired
private RequestsDbClient requestsDbClient;
@@ -97,7 +106,8 @@ public class OrchestrationRequests {
@GET
@Path("/{version:[vV][4-7]}/{requestId}")
- @ApiOperation(value = "Find Orchestrated Requests for a given requestId", response = Response.class)
+ @Operation(description = "Find Orchestrated Requests for a given requestId", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response getOrchestrationRequest(@PathParam("requestId") String requestId,
@@ -162,7 +172,8 @@ public class OrchestrationRequests {
@GET
@Path("/{version:[vV][4-7]}")
- @ApiOperation(value = "Find Orchestrated Requests for a URI Information", response = Response.class)
+ @Operation(description = "Find Orchestrated Requests for a URI Information", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version,
@@ -219,7 +230,8 @@ public class OrchestrationRequests {
@Path("/{version: [vV][4-7]}/{requestId}/unlock")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class)
+ @Operation(description = "Unlock Orchestrated Requests for a given requestId", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId,
@PathParam("version") String version) throws ApiException {
@@ -411,7 +423,11 @@ public class OrchestrationRequests {
protected String mapRequestStatusToRequest(InfraActiveRequests iar, String format) {
if (iar.getRequestStatus() != null) {
- if (!StringUtils.isBlank(format) && OrchestrationRequestFormat.DETAIL.toString().equalsIgnoreCase(format)) {
+ boolean requestFormat = false;
+ if (format != null) {
+ requestFormat = EnumUtils.isValidEnum(OrchestrationRequestFormat.class, format.toUpperCase());
+ }
+ if (requestFormat) {
return iar.getRequestStatus();
} else {
if (Status.ABORTED.toString().equalsIgnoreCase(iar.getRequestStatus())
@@ -444,7 +460,12 @@ public class OrchestrationRequests {
String statusMessages = null;
if (iar.getStatusMessage() != null) {
- statusMessages = "STATUS: " + iar.getStatusMessage();
+ if (StringUtils.isNotBlank(iar.getExtSystemErrorSource())) {
+ statusMessages = "STATUS: "
+ + String.format(ERROR_MESSAGE_PREFIX, iar.getExtSystemErrorSource(), iar.getStatusMessage());
+ } else {
+ statusMessages = "STATUS: " + iar.getStatusMessage();
+ }
}
if (OrchestrationRequestFormat.STATUSDETAIL.toString().equalsIgnoreCase(format)) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index 9ab95a2319..dc38d4eb82 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
@@ -84,7 +85,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
-import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestClientException;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -295,7 +295,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
String instanceName, String requestScope, InfraActiveRequests currentActiveReq) throws ApiException {
InfraActiveRequests dup = null;
try {
- if (!(instanceName == null && requestScope.equals("service") && (action == Action.createInstance
+ if (!(instanceName == null && "service".equals(requestScope) && (action == Action.createInstance
|| action == Action.activateInstance || action == Action.assignInstance))) {
dup = infraActiveRequestsClient.checkInstanceNameDuplicate(instanceIdMap, instanceName, requestScope);
}
@@ -334,7 +334,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
updateStatus(duplicateRecord, Status.COMPLETE, "Request Completed");
}
for (HistoricProcessInstance instance : response.getBody()) {
- if (instance.getState().equals("ACTIVE")) {
+ if (("ACTIVE").equals(instance.getState())) {
return true;
} else {
updateStatus(duplicateRecord, Status.COMPLETE, "Request Completed");
@@ -479,24 +479,11 @@ public class RequestHandlerUtils extends AbstractRestHandler {
boolean isAlaCarte, Actions action) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
- if (msoRawRequest != null) {
- ServiceInstancesRequest sir = mapper.readValue(msoRawRequest, ServiceInstancesRequest.class);
- if (serviceInstRequest != null && serviceInstRequest.getRequestDetails() != null
- && serviceInstRequest.getRequestDetails().getRequestParameters() != null) {
- if (!isAlaCarte && Action.createInstance.equals(action)) {
- sir.getRequestDetails()
- .setCloudConfiguration(serviceInstRequest.getRequestDetails().getCloudConfiguration());
- sir.getRequestDetails().getRequestParameters().setUserParams(
- serviceInstRequest.getRequestDetails().getRequestParameters().getUserParams());
- }
- sir.getRequestDetails().getRequestParameters()
- .setUsePreload(serviceInstRequest.getRequestDetails().getRequestParameters().getUsePreload());
- }
-
- logger.debug("Value as string: {}", mapper.writeValueAsString(sir));
- return mapper.writeValueAsString(sir);
+ if (serviceInstRequest != null) {
+ return mapper.writeValueAsString(serviceInstRequest);
+ } else {
+ return msoRawRequest;
}
- return null;
}
public Optional<String> retrieveModelName(RequestParameters requestParams) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
index ed300d95c2..b462415a43 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
@@ -57,11 +57,17 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("onap/so/infra/orchestrationRequests")
-@Api(value = "onap/so/infra/orchestrationRequests")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/orchestrationRequests"))
+
@Component
public class ResumeOrchestrationRequest {
private static Logger logger = LoggerFactory.getLogger(ResumeOrchestrationRequest.class);
@@ -84,7 +90,8 @@ public class ResumeOrchestrationRequest {
@Path("/{version:[vV][7]}/{requestId}/resume")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Resume request for a given requestId", response = Response.class)
+ @Operation(description = "Resume request for a given requestId", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response resumeOrchestrationRequest(@PathParam("requestId") String requestId,
@PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index 5b827d9cf8..da101a2e6d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -51,6 +51,7 @@ import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
+import org.onap.so.apihandlerinfra.infra.rest.validators.RequestValidatorListenerRunner;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.NetworkResource;
@@ -88,16 +89,19 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
-@Api(value = "/onap/so/infra/serviceInstantiation", description = "Infrastructure API Requests for Service Instances")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/serviceInstantiation",
+ description = "Infrastructure API Requests for Service Instances"))
public class ServiceInstances extends AbstractRestHandler {
private static Logger logger = LoggerFactory.getLogger(MsoRequest.class);
@@ -124,11 +128,15 @@ public class ServiceInstances extends AbstractRestHandler {
@Autowired
private RequestHandlerUtils requestHandlerUtils;
+ @Autowired
+ private RequestValidatorListenerRunner requestValidatorListenerRunner;
+
@POST
@Path("/{version:[vV][5-7]}/serviceInstances")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create a Service Instance on a version provided", response = Response.class)
+ @Operation(description = "Create a Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createServiceInstance(String request, @PathParam("version") String version,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -141,7 +149,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/activate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Activate provided Service Instance", response = Response.class)
+ @Operation(description = "Activate provided Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response activateServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -157,7 +166,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/deactivate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Deactivate provided Service Instance", response = Response.class)
+ @Operation(description = "Deactivate provided Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deactivateServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -173,7 +183,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided Service Instance", response = Response.class)
+ @Operation(description = "Delete provided Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -189,7 +200,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/assign")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Assign Service Instance", response = Response.class)
+ @Operation(description = "Assign Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response assignServiceInstance(String request, @PathParam("version") String version,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -202,7 +214,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/unassign")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Unassign Service Instance", response = Response.class)
+ @Operation(description = "Unassign Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response unassignServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -218,7 +231,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create Port Mirroring Configuration", response = Response.class)
+ @Operation(description = "Create Port Mirroring Configuration", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createPortConfiguration(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -234,7 +248,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided Port", response = Response.class)
+ @Operation(description = "Delete provided Port", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deletePortConfiguration(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -252,7 +267,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/enablePort")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Enable Port Mirroring", response = Response.class)
+ @Operation(description = "Enable Port Mirroring", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response enablePort(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -270,7 +286,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/disablePort")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Disable Port Mirroring", response = Response.class)
+ @Operation(description = "Disable Port Mirroring", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response disablePort(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -288,7 +305,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/activate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Activate Port Mirroring", response = Response.class)
+ @Operation(description = "Activate Port Mirroring", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response activatePort(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -306,7 +324,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/deactivate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Deactivate Port Mirroring", response = Response.class)
+ @Operation(description = "Deactivate Port Mirroring", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deactivatePort(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -324,7 +343,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/addRelationships")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Add Relationships to a Service Instance", response = Response.class)
+ @Operation(description = "Add Relationships to a Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response addRelationships(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -340,7 +360,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/removeRelationships")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Remove Relationships from Service Instance", response = Response.class)
+ @Operation(description = "Remove Relationships from Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response removeRelationships(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -356,7 +377,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create VNF on a specified version and serviceInstance", response = Response.class)
+ @Operation(description = "Create VNF on a specified version and serviceInstance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -377,7 +399,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Replace provided VNF instance", response = Response.class)
+ @Operation(description = "Replace provided VNF instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response replaceVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -394,8 +417,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update VNF on a specified version, serviceInstance and vnfInstance",
- response = Response.class)
+ @Operation(description = "Update VNF on a specified version, serviceInstance and vnfInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -412,7 +436,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/applyUpdatedConfig")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Apply updated configuration", response = Response.class)
+ @Operation(description = "Apply updated configuration", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response applyUpdatedConfig(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -428,7 +453,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/recreate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Recreate VNF Instance", response = Response.class)
+ @Operation(description = "Recreate VNF Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response recreateVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -440,12 +466,12 @@ public class ServiceInstances extends AbstractRestHandler {
requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
}
-
@DELETE
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided VNF instance", response = Response.class)
+ @Operation(description = "Delete provided VNF instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -462,8 +488,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create VfModule on a specified version, serviceInstance and vnfInstance",
- response = Response.class)
+ @Operation(description = "Create VfModule on a specified version, serviceInstance and vnfInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -480,8 +507,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/replace")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create VfModule on a specified version, serviceInstance and vnfInstance",
- response = Response.class)
+ @Operation(description = "Create VfModule on a specified version, serviceInstance and vnfInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response replaceVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -500,8 +528,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule",
- response = Response.class)
+ @Operation(description = "Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -520,7 +549,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/inPlaceSoftwareUpdate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Perform VNF software update", response = Response.class)
+ @Operation(description = "Perform VNF software update", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response inPlaceSoftwareUpdate(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -537,7 +567,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided VfModule instance", response = Response.class)
+ @Operation(description = "Delete provided VfModule instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -556,7 +587,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/deactivateAndCloudDelete")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Deactivate and Cloud Delete VfModule instance", response = Response.class)
+ @Operation(description = "Deactivate and Cloud Delete VfModule instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deactivateAndCloudDeleteVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -576,7 +608,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "VF Auto Scale Out", response = Response.class)
+ @Operation(description = "VF Auto Scale Out", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response scaleOutVfModule(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -589,13 +622,13 @@ public class ServiceInstances extends AbstractRestHandler {
requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
}
-
@POST
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create VolumeGroup on a specified version, serviceInstance, vnfInstance",
- response = Response.class)
+ @Operation(description = "Create VolumeGroup on a specified version, serviceInstance, vnfInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createVolumeGroupInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -612,8 +645,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup",
- response = Response.class)
+ @Operation(description = "Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateVolumeGroupInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -632,7 +666,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided VolumeGroup instance", response = Response.class)
+ @Operation(description = "Delete provided VolumeGroup instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteVolumeGroupInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -651,8 +686,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create NetworkInstance on a specified version and serviceInstance ",
- response = Response.class)
+ @Operation(description = "Create NetworkInstance on a specified version and serviceInstance ",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createNetworkInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -668,8 +704,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update VolumeGroup on a specified version, serviceInstance, networkInstance",
- response = Response.class)
+ @Operation(description = "Update VolumeGroup on a specified version, serviceInstance, networkInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateNetworkInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -687,7 +724,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided Network instance", response = Response.class)
+ @Operation(description = "Delete provided Network instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteNetworkInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -705,7 +743,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/instanceGroups")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create instanceGroups", response = Response.class)
+ @Operation(description = "Create instanceGroups", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createInstanceGroups(String request, @PathParam("version") String version,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -718,7 +757,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete instanceGroup", response = Response.class)
+ @Operation(description = "Delete instanceGroup", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteInstanceGroups(@PathParam("version") String version,
@PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext)
@@ -734,7 +774,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}/addMembers")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Add instanceGroup members", response = Response.class)
+ @Operation(description = "Add instanceGroup members", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response addInstanceGroupMembers(String request, @PathParam("version") String version,
@PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext)
@@ -750,7 +791,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}/removeMembers")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Remove instanceGroup members", response = Response.class)
+ @Operation(description = "Remove instanceGroup members", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response removeInstanceGroupMembers(String request, @PathParam("version") String version,
@PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext)
@@ -762,8 +804,36 @@ public class ServiceInstances extends AbstractRestHandler {
requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
}
+ /**
+ * This method is used for POST a request to the BPEL client (BPMN).
+ *
+ * Convert the requestJson to ServiceInstanceRequest(sir), create the msoRequest object, check whether this request
+ * is already being processed in requestdb for duplicate check.
+ *
+ * Based on the alacarte flag, sir and msoRequest will do the recipe lookup from the service and servicerecipe table
+ * of catalogdb, and get the OrchestrationURI.
+ *
+ * If the present request is not the duplicate request then this request will be saved in the requestdb. and will
+ * POST a request to the BPMN engine at the OrchestrationURI fetched.
+ *
+ * @param requestJSON Json fetched as body in the API call
+ * @param action Type of action to be performed
+ * @param instanceIdMap Map of instance ids of service/vnf/vf/configuration etc..
+ * @param version Supported version of API
+ * @param requestId Unique id for the request
+ * @param requestUri
+ * @return response object
+ * @throws ApiException
+ */
public Response serviceInstances(String requestJSON, Actions action, HashMap<String, String> instanceIdMap,
String version, String requestId, String requestUri) throws ApiException {
+ return serviceInstances(requestJSON, action, instanceIdMap, version, requestId, requestUri, null);
+
+ }
+
+ public Response serviceInstances(String requestJSON, Actions action, HashMap<String, String> instanceIdMap,
+ String version, String requestId, String requestUri, HashMap<String, String> queryParams)
+ throws ApiException {
String serviceInstanceId;
Boolean aLaCarte = null;
ServiceInstancesRequest sir;
@@ -771,6 +841,8 @@ public class ServiceInstances extends AbstractRestHandler {
sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
action = handleReplaceInstance(action, sir);
+ requestValidatorListenerRunner.runValidations(requestUri, instanceIdMap, sir, queryParams);
+
String requestScope = requestHandlerUtils.deriveRequestScope(action, sir, requestUri);
InfraActiveRequests currentActiveReq =
msoRequest.createRequestObject(sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope);
@@ -864,6 +936,7 @@ public class ServiceInstances extends AbstractRestHandler {
try {
infraActiveRequestsClient.save(currentActiveReq);
} catch (Exception e) {
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -877,6 +950,7 @@ public class ServiceInstances extends AbstractRestHandler {
aLaCarte = false;
}
+
RequestClientParameter requestClientParameter = null;
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
@@ -889,6 +963,7 @@ public class ServiceInstances extends AbstractRestHandler {
.setApiVersion(apiVersion).setALaCarte(aLaCarte).setRequestUri(requestUri)
.setInstanceGroupId(instanceGroupId).build();
} catch (IOException e) {
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -914,6 +989,21 @@ public class ServiceInstances extends AbstractRestHandler {
return action;
}
+ /**
+ * This method deletes the Instance Groups.
+ *
+ * This method will check whether the request is not duplicate in requestdb. if its not then will save as a new
+ * request. And will send a POST request to BEPL client to delete the Insatnce Groups.
+ *
+ * @param action
+ * @param instanceIdMap
+ * @param version
+ * @param requestId
+ * @param requestUri
+ * @param requestContext
+ * @return
+ * @throws ApiException
+ */
public Response deleteInstanceGroups(Actions action, HashMap<String, String> instanceIdMap, String version,
String requestId, String requestUri, ContainerRequestContext requestContext) throws ApiException {
String instanceGroupId = instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID);
@@ -967,6 +1057,7 @@ public class ServiceInstances extends AbstractRestHandler {
try {
infraActiveRequestsClient.save(currentActiveReq);
} catch (Exception e) {
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -979,6 +1070,7 @@ public class ServiceInstances extends AbstractRestHandler {
.setRequestAction(action.toString()).setApiVersion(apiVersion).setALaCarte(aLaCarte)
.setRequestUri(requestUri).setInstanceGroupId(instanceGroupId).build();
+
return requestHandlerUtils.postBPELRequest(currentActiveReq, requestClientParameter,
recipeLookupResult.getOrchestrationURI(), requestScope);
}
@@ -992,7 +1084,8 @@ public class ServiceInstances extends AbstractRestHandler {
protected RecipeLookupResult getServiceInstanceOrchestrationURI(ServiceInstancesRequest sir, Actions action,
boolean alaCarteFlag, InfraActiveRequests currentActiveReq) throws ApiException {
RecipeLookupResult recipeLookupResult = null;
- // if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT recipe for the requested action
+ // if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT
+ // recipe for the requested action
ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
// Query MSO Catalog DB
@@ -1008,7 +1101,6 @@ public class ServiceInstances extends AbstractRestHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
ValidateException validateException =
new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
@@ -1027,7 +1119,6 @@ public class ServiceInstances extends AbstractRestHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
ValidateException validateException =
new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
@@ -1045,7 +1136,6 @@ public class ServiceInstances extends AbstractRestHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
ValidateException validateException =
new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
@@ -1062,7 +1152,6 @@ public class ServiceInstances extends AbstractRestHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
RecipeNotFoundException recipeNotFoundExceptionException =
new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.",
HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo)
@@ -1112,7 +1201,8 @@ public class ServiceInstances extends AbstractRestHandler {
}
}
- // if an aLaCarte flag was sent in the request, throw an error if the recipe was not found
+ // if an aLaCarte flag was sent in the request, throw an error if the recipe was
+ // not found
RequestParameters reqParam = requestDetails.getRequestParameters();
if (reqParam != null && alaCarteFlag && recipe == null) {
return null;
@@ -1301,23 +1391,32 @@ public class ServiceInstances extends AbstractRestHandler {
if (modelInfo.getModelType().equals(ModelType.vnf)) {
// a. For a vnf request (only create, no update currently):
- // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate catalog DB has record in
+ // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate
+ // catalog DB has record in
// vnf_resource_customization.model_customization_uuid.
- // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
+ // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is
+ // a pre-1702 ASDC model or
// pre-v3), then modelInfo.modelCustomizationName must have
// been provided (else create request should be rejected). APIH should use the
- // relatedInstance.modelInfo[service].modelVersionId** + modelInfo[vnf].modelCustomizationName
- // to “join�? service_to_resource_customizations with vnf_resource_customization to confirm a
+ // relatedInstance.modelInfo[service].modelVersionId** +
+ // modelInfo[vnf].modelCustomizationName
+ // to “join�? service_to_resource_customizations with
+ // vnf_resource_customization to confirm a
// vnf_resource_customization.model_customization_uuid record exists.
// **If relatedInstance.modelInfo[service].modelVersionId was not provided, use
- // relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to lookup modelVersionId
+ // relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to
+ // lookup modelVersionId
// (MODEL_UUID) in SERVICE table.
- // iii. Regardless of how the value was provided/obtained above, APIH must always populate
- // vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO generated
+ // iii. Regardless of how the value was provided/obtained above, APIH must
+ // always populate
+ // vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO
+ // generated
// during 1707 data migration if VID did not provide it originally on request.
- // iv. Note: continue to construct the “vnf-type�? value and pass to BPMN (must still be populated
+ // iv. Note: continue to construct the “vnf-type�? value and pass to BPMN
+ // (must still be populated
// in A&AI).
- // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to
+ // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use
+ // modelCustomizationId to
// look it up in our catalog to construct vnf-type value to pass to BPMN.
VnfResource vnfResource = null;
@@ -1448,14 +1547,13 @@ public class ServiceInstances extends AbstractRestHandler {
throw new ValidationException("vfModuleCustomization");
} else if (vfModule == null && vfmc != null) {
vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in
- // VfModuleCustomization table
+ // VfModuleCustomization table
}
if (modelInfo.getModelVersionId() == null) {
modelInfo.setModelVersionId(vfModule.getModelUUID());
}
-
recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
vfModule.getModelUUID(), vnfComponentType, action.toString());
if (recipe == null) {
@@ -1518,7 +1616,6 @@ public class ServiceInstances extends AbstractRestHandler {
return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
}
-
private RecipeLookupResult getNetworkUri(ServiceInstancesRequest sir, Actions action) throws ValidationException {
String defaultNetworkType = requestHandlerUtils.getDefaultModel(sir);
@@ -1558,7 +1655,6 @@ public class ServiceInstances extends AbstractRestHandler {
return recipe != null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null;
}
-
private Response configurationRecipeLookup(String requestJSON, Action action, HashMap<String, String> instanceIdMap,
String version, String requestId, String requestUri) throws ApiException {
String serviceInstanceId;
@@ -1597,7 +1693,6 @@ public class ServiceInstances extends AbstractRestHandler {
referencesResponse.setRequestId(requestId);
serviceResponse.setRequestReferences(referencesResponse);
-
String orchestrationUri = env.getProperty(CommonConstants.ALACARTE_ORCHESTRATION);
String timeOut = env.getProperty(CommonConstants.ALACARTE_RECIPE_TIMEOUT);
@@ -1609,7 +1704,6 @@ public class ServiceInstances extends AbstractRestHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
ValidateException validateException = new ValidateException.Builder(error, HttpStatus.SC_NOT_FOUND,
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoSubsystems.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SoSubsystems.java
index 13f1e52068..5842531dc3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoSubsystems.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SoSubsystems.java
@@ -19,18 +19,18 @@
*/
package org.onap.so.apihandlerinfra;
-public enum MsoSubsystems {
+public enum SoSubsystems implements Subsystem {
APIH("API Handler"),
ASDC("ASDC Controller"),
BPMN("BPMN Infra"),
CATALOGDB("CatalogDb Adapter"),
OPENSTACK("Openstack Adapter"),
REQUESTDB("RequestDB Adapter"),
- REQUESTDBATT("RequestDB Adapter ATT Svc"),
SDNC("SDNC Adapter");
+
private String subsystem;
- private MsoSubsystems(String subsystem) {
+ private SoSubsystems(String subsystem) {
this.subsystem = subsystem;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Subsystem.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Subsystem.java
new file mode 100644
index 0000000000..88626f3168
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Subsystem.java
@@ -0,0 +1,5 @@
+package org.onap.so.apihandlerinfra;
+
+public interface Subsystem {
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
index 7bd7f95286..09a1d9e5a6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
@@ -36,7 +36,6 @@ import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.json.JSONArray;
-import org.json.JSONException;
import org.json.JSONObject;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.RequestClient;
@@ -60,11 +59,16 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("onap/so/infra/tasks")
-@Api(value = "onap/so/infra/tasks", description = "Queries of Manual Tasks")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/tasks", description = "Queries of Manual Tasks"))
@Component
public class TasksHandler {
@@ -82,7 +86,8 @@ public class TasksHandler {
@Path("/{version:[vV]1}")
@GET
- @ApiOperation(value = "Finds Manual Tasks", response = Response.class)
+ @Operation(description = "Finds Manual Tasks", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response queryFilters(@QueryParam("taskId") String taskId,
@QueryParam("originalRequestId") String originalRequestId,
@@ -91,7 +96,7 @@ public class TasksHandler {
@QueryParam("originalRequestDate") String originalRequestDate,
@QueryParam("originalRequestorId") String originalRequestorId, @PathParam("version") String version)
throws ApiException {
- Response responseBack = null;
+
String apiVersion = version.substring(1);
// Prepare the query string to /task interface
@@ -159,60 +164,49 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.build();
+ throw new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
-
- ValidateException validateException =
- new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
}
TasksGetResponse trr = new TasksGetResponse();
List<TaskList> taskList = new ArrayList<>();
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) {
- String respBody = respHandler.getResponseBody();
- if (respBody != null) {
- JSONArray data = new JSONArray(respBody);
+ String respBody = respHandler.getResponseBody();
+ if ((bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) && (null != respBody)) {
- for (int i = 0; i < data.length(); i++) {
- JSONObject taskEntry = data.getJSONObject(i);
- String id = taskEntry.getString("id");
- if (taskId != null && !taskId.equals(id)) {
- continue;
- }
- // Get variables info for each task ID
- TaskList taskListEntry = null;
- taskListEntry = getTaskInfo(id);
-
- taskList.add(taskListEntry);
+ JSONArray data = new JSONArray(respBody);
+ for (int i = 0; i < data.length(); i++) {
+ JSONObject taskEntry = data.getJSONObject(i);
+ String id = taskEntry.getString("id");
+ if (taskId != null && !taskId.equals(id)) {
+ continue;
}
- trr.setTaskList(taskList);
+ // Get variables info for each task ID
+ TaskList taskListEntry = null;
+ taskListEntry = getTaskInfo(id);
+
+ taskList.add(taskListEntry);
+
}
+ trr.setTaskList(taskList);
} else {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError)
.build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
- bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
String jsonResponse = null;
@@ -223,14 +217,10 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.build();
+ throw new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
-
- ValidateException validateException =
- new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
}
return builder.buildResponse(HttpStatus.SC_ACCEPTED, "", jsonResponse, apiVersion);
@@ -250,10 +240,8 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
- BPMNFailureException validateException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
- throw validateException;
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
}
ResponseHandler respHandler = new ResponseHandler(getResponse, requestClient.getType());
int bpelStatus = respHandler.getStatus();
@@ -264,14 +252,10 @@ public class TasksHandler {
} else {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
ErrorCode.AvailabilityError).build();
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
+ HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo)
+ .build();
-
-
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
-
- throw bpmnFailureException;
}
} else {
@@ -279,20 +263,15 @@ public class TasksHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
- bpelStatus, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
-
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
}
return taskList;
}
- private TaskList buildTaskList(String taskId, String respBody) throws JSONException {
+ private TaskList buildTaskList(String taskId, String respBody) {
TaskList taskList = new TaskList();
JSONObject variables = new JSONObject(respBody);
@@ -317,7 +296,7 @@ public class TasksHandler {
return taskList;
}
- private String getOptVariableValue(JSONObject variables, String name) throws JSONException {
+ private String getOptVariableValue(JSONObject variables, String name) {
String variableEntry = variables.optString(name);
String value = "";
if (!variableEntry.isEmpty()) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index b57bb5d1d8..925d10179f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -59,11 +59,17 @@ import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("onap/so/infra/workflowSpecifications")
-@Api(value = "onap/so/infra/workflowSpecifications", description = "Queries of Workflow Specifications")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/workflowSpecifications",
+ description = "Queries of Workflow Specifications"))
@Component
public class WorkflowSpecificationsHandler {
@@ -79,7 +85,8 @@ public class WorkflowSpecificationsHandler {
@Path("/{version:[vV]1}/workflows")
@GET
- @ApiOperation(value = "Finds Workflow Specifications", response = Response.class)
+ @Operation(description = "Finds Workflow Specifications", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response queryWorkflowSpecifications(@QueryParam("vnfModelVersionId") String vnfModelVersionId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
new file mode 100644
index 0000000000..344e5438c9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -0,0 +1,85 @@
+package org.onap.so.apihandlerinfra.infra.rest;
+
+import java.util.Optional;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+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.AAIUriFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIDataRetrieval {
+
+ private static final String VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID = "VF Module Not Found In Inventory, VnfId: ";
+
+ private AAIResourcesClient aaiResourcesClient;
+
+ private static final Logger logger = LoggerFactory.getLogger(AAIDataRetrieval.class);
+
+ public ServiceInstance getServiceInstance(String serviceInstanceId) {
+ return this.getAaiResourcesClient()
+ .get(ServiceInstance.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId))
+ .orElseGet(() -> {
+ logger.debug("No Service Instance found in A&AI ServiceInstanceId: {}", serviceInstanceId);
+ return null;
+ });
+ }
+
+
+ public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
+ return this.getAaiResourcesClient()
+ .get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId))
+ .orElseGet(() -> {
+ logger.debug("No Vf Module found in A&AI VnfId: {}" + ", VfModuleId: {}", vnfId, vfModuleId);
+ return null;
+ });
+ }
+
+ public GenericVnf getGenericVnf(String vnfId) {
+ return this.getAaiResourcesClient()
+ .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ .orElseGet(() -> {
+ logger.debug("No Generic VNF found in A&AI VnfId: {}", vnfId);
+ return null;
+ });
+ }
+
+ public VolumeGroup getVolumeGroup(String vnfId, String volumeGroupId) throws AAIEntityNotFound {
+ AAIResultWrapper wrapper =
+ this.getAaiResourcesClient().get(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectType.VOLUME_GROUP, volumeGroupId));
+ Optional<VolumeGroup> volume = wrapper.asBean(VolumeGroup.class);
+ if (volume.isPresent()) {
+ return volume.get();
+ } else {
+ logger.debug("No VolumeGroup in A&AI found: {}", vnfId);
+ return null;
+ }
+ }
+
+ public L3Network getNetwork(String networkId) {
+ return this.getAaiResourcesClient()
+ .get(L3Network.class, AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId))
+ .orElseGet(() -> {
+ logger.debug("No Network found in A&AI NetworkId: {}", networkId);
+ return null;
+ });
+ }
+
+ protected AAIResourcesClient getAaiResourcesClient() {
+ if (aaiResourcesClient == null) {
+ aaiResourcesClient = new AAIResourcesClient();
+ }
+ return aaiResourcesClient;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
index bb5b4edfe4..ee2bb586cf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
@@ -33,10 +33,7 @@ import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -75,17 +72,19 @@ public class BpmnRequestBuilder {
@Autowired
private RequestsDbClient infraActiveRequestsClient;
+ @Autowired
+ private AAIDataRetrieval aaiDataRet;
+
private ObjectMapper mapper = new ObjectMapper();
- private AAIResourcesClient aaiResourcesClient;
public ServiceInstancesRequest buildVFModuleDeleteRequest(String vnfId, String vfModuleId, ModelType modelType)
throws AAIEntityNotFound {
- GenericVnf vnf = getGenericVnf(vnfId);
+ GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
if (vnf == null) {
throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
}
- VfModule vfModule = getAAIVfModule(vnfId, vfModuleId);
+ VfModule vfModule = aaiDataRet.getAAIVfModule(vnfId, vfModuleId);
if (vfModule == null) {
throw new AAIEntityNotFound(VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " vfModuleId: " + vfModuleId);
}
@@ -94,11 +93,11 @@ public class BpmnRequestBuilder {
public ServiceInstancesRequest buildVolumeGroupDeleteRequest(String vnfId, String volumeGroupId)
throws AAIEntityNotFound {
- GenericVnf vnf = getGenericVnf(vnfId);
+ GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
if (vnf == null) {
throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
}
- VolumeGroup volumeGroup = getVolumeGroup(vnfId, volumeGroupId);
+ VolumeGroup volumeGroup = aaiDataRet.getVolumeGroup(vnfId, volumeGroupId);
if (volumeGroup == null) {
throw new AAIEntityNotFound(
VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " volumeGroupId: " + volumeGroupId);
@@ -107,7 +106,7 @@ public class BpmnRequestBuilder {
}
public ServiceInstancesRequest buildServiceDeleteRequest(String serviceInstanceId) throws AAIEntityNotFound {
- ServiceInstance serviceInstance = getServiceInstance(serviceInstanceId);
+ ServiceInstance serviceInstance = aaiDataRet.getServiceInstance(serviceInstanceId);
if (serviceInstance == null) {
throw new AAIEntityNotFound(
"ServiceInstance Not Found In Inventory, ServiceInstanceId: " + serviceInstanceId);
@@ -116,7 +115,7 @@ public class BpmnRequestBuilder {
}
public ServiceInstancesRequest buildVnfDeleteRequest(String vnfId) throws AAIEntityNotFound {
- GenericVnf vnf = getGenericVnf(vnfId);
+ GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
if (vnf == null) {
throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
}
@@ -124,7 +123,7 @@ public class BpmnRequestBuilder {
}
public ServiceInstancesRequest buildNetworkDeleteRequest(String networkId) throws AAIEntityNotFound {
- L3Network network = getNetwork(networkId);
+ L3Network network = aaiDataRet.getNetwork(networkId);
if (network == null) {
throw new AAIEntityNotFound("Network Not Found In Inventory, NetworkId: " + networkId);
}
@@ -407,72 +406,5 @@ public class BpmnRequestBuilder {
return requestParams;
}
- public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
- return this.getAaiResourcesClient()
- .get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId))
- .orElseGet(() -> {
- logger.debug("No Vf Module found in A&AI VnfId: {}" + ", VfModuleId: {}", vnfId, vfModuleId);
- return null;
- });
- }
-
- public GenericVnf getGenericVnf(String vnfId) {
- return this.getAaiResourcesClient()
- .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
- .orElseGet(() -> {
- logger.debug("No Generic VNF found in A&AI VnfId: {}", vnfId);
- return null;
- });
- }
-
- public VolumeGroup getVolumeGroup(String vnfId, String volumeGroupId) throws AAIEntityNotFound {
- GenericVnf vnf = getGenericVnf(vnfId);
- AAIResultWrapper wrapper = new AAIResultWrapper(vnf);
- List<AAIResourceUri> listVserverWrapper;
- Optional<AAIResourceUri> volumeGroupURI;
- if (wrapper.getRelationships().isPresent()) {
- listVserverWrapper = wrapper.getRelationships().get().getRelatedUris(AAIObjectType.VOLUME_GROUP);
- volumeGroupURI = listVserverWrapper.stream()
- .filter(resourceURI -> resourceURI.getURIKeys().get("volume-group-id").equals(volumeGroupId))
- .findFirst();
- } else {
- throw new AAIEntityNotFound(
- VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " volumeGroupId: " + volumeGroupId);
- }
- return this.getAaiResourcesClient().get(VolumeGroup.class, volumeGroupURI.get()).orElseGet(() -> {
- logger.debug("No VolumeGroup in A&AI found: {}", vnfId);
- return null;
- });
- }
-
- public ServiceInstance getServiceInstance(String serviceInstanceId) {
- return this.getAaiResourcesClient()
- .get(ServiceInstance.class,
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId))
- .orElseGet(() -> {
- logger.debug("No Service Instance found in A&AI ServiceInstanceId: {}", serviceInstanceId);
- return null;
- });
- }
-
- public L3Network getNetwork(String networkId) {
- return this.getAaiResourcesClient()
- .get(L3Network.class, AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId))
- .orElseGet(() -> {
- logger.debug("No Network found in A&AI NetworkId: {}", networkId);
- return null;
- });
- }
-
- public AAIResourcesClient getAaiResourcesClient() {
- if (aaiResourcesClient == null) {
- aaiResourcesClient = new AAIResourcesClient();
- }
- return aaiResourcesClient;
- }
-
- public void setAaiResourcesClient(AAIResourcesClient aaiResourcesClient) {
- this.aaiResourcesClient = aaiResourcesClient;
- }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java
index ec3df21fdb..483ac47235 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java
@@ -44,7 +44,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@@ -61,7 +65,8 @@ public class Network {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided Network instance", response = Response.class)
+ @Operation(description = "Delete provided Network instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteNetworkInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java
index 07e8092449..135667d3e4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java
@@ -44,7 +44,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@@ -61,7 +65,8 @@ public class ServiceInstance {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete a Service instance", response = ServiceInstancesResponse.class)
+ @Operation(description = "Delete a Service instance", responses = @ApiResponse(content = @Content(
+ array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteServiceInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java
index 1b9eb1f802..4a86d944cf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java
@@ -45,7 +45,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@@ -62,7 +66,8 @@ public class VfModules {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class)
+ @Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content(
+ array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteVfModuleInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java
index a8ccdeecac..edb09083d4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java
@@ -43,7 +43,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@@ -60,7 +64,8 @@ public class Vnf {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete a Vnf instance", response = ServiceInstancesResponse.class)
+ @Operation(description = "Delete a Vnf instance", responses = @ApiResponse(content = @Content(
+ array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteVnfInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java
index d3e394d6d8..3154c86046 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java
@@ -46,7 +46,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component("VolumesV8")
@Path("/onap/so/infra/serviceInstantiation")
@@ -66,7 +70,8 @@ public class Volumes {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class)
+ @Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content(
+ array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteVfModuleInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
index b5b548a266..20e27a5265 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
@@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.infra.rest.handler;
import java.io.IOException;
import java.net.URL;
import java.sql.Timestamp;
-import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import javax.ws.rs.container.ContainerRequestContext;
import org.apache.http.HttpStatus;
@@ -63,7 +63,7 @@ public abstract class AbstractRestHandler {
private static final Logger logger = LoggerFactory.getLogger(AbstractRestHandler.class);
- public static final String conflictFailMessage = "Error: Locked instance - This %s (%s) "
+ public static final String CONFLICT_FAIL_MESSAGE = "Error: Locked instance - This %s (%s) "
+ "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding.";
@@ -95,26 +95,23 @@ public abstract class AbstractRestHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
- ValidateException validateException =
- new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID",
- HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
+ throw new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID",
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
}
}
- public InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap, long startTime,
+ public InfraActiveRequests duplicateCheck(Actions action, Map<String, String> instanceIdMap, long startTime,
MsoRequest msoRequest, String instanceName, String requestScope, InfraActiveRequests currentActiveReq)
throws ApiException {
return duplicateCheck(action, instanceIdMap, startTime, instanceName, requestScope, currentActiveReq);
}
- public InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap, long startTime,
+ public InfraActiveRequests duplicateCheck(Actions action, Map<String, String> instanceIdMap, long startTime,
String instanceName, String requestScope, InfraActiveRequests currentActiveReq) throws ApiException {
InfraActiveRequests dup = null;
try {
- if (!(instanceName == null && requestScope.equals("service") && (action == Action.createInstance
+ if (!(instanceName == null && "service".equals(requestScope) && (action == Action.createInstance
|| action == Action.activateInstance || action == Action.assignInstance))) {
dup = infraActiveRequestsClient.checkInstanceNameDuplicate(instanceIdMap, instanceName, requestScope);
}
@@ -134,19 +131,19 @@ public abstract class AbstractRestHandler {
public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage)
throws RequestDbFailureException {
- if (aq != null) {
- if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
- aq.setStatusMessage(errorMessage);
- aq.setProgress(100L);
- aq.setRequestStatus(status.toString());
- Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
- aq.setEndTime(endTimeStamp);
- try {
- infraActiveRequestsClient.updateInfraActiveRequests(aq);
- } catch (Exception e) {
- logger.error("Error updating status", e);
- }
+ if ((aq != null) && ((status == Status.FAILED) || (status == Status.COMPLETE))) {
+
+ aq.setStatusMessage(errorMessage);
+ aq.setProgress(100L);
+ aq.setRequestStatus(status.toString());
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ aq.setEndTime(endTimeStamp);
+ try {
+ infraActiveRequestsClient.updateInfraActiveRequests(aq);
+ } catch (Exception e) {
+ logger.error("Error updating status", e);
}
+
}
}
@@ -178,15 +175,15 @@ public abstract class AbstractRestHandler {
selfLinkUrl = Optional.of(new URL(aUrl.getProtocol(), aUrl.getHost(), aUrl.getPort(), selfLinkPath));
} catch (Exception e) {
selfLinkUrl = Optional.empty(); // ignore
- logger.info(e.getMessage());
+ logger.error("Exception in buildSelfLinkUrl", e);
}
return selfLinkUrl;
}
/**
- * @param vfmoduleInstanceId
+ * @param instanceId
* @param requestId
- * @param response
+ * @param requestContext
*/
public ServiceInstancesResponse createResponse(String instanceId, String requestId,
ContainerRequestContext requestContext) {
@@ -202,13 +199,13 @@ public abstract class AbstractRestHandler {
return response;
}
- public void checkDuplicateRequest(HashMap<String, String> instanceIdMap, ModelType modelType, String instanceName,
+ public void checkDuplicateRequest(Map<String, String> instanceIdMap, ModelType modelType, String instanceName,
String requestId) throws RequestConflictedException {
InfraActiveRequests conflictedRequest =
infraActiveRequestsClient.checkInstanceNameDuplicate(instanceIdMap, instanceName, modelType.toString());
if (conflictedRequest != null && !conflictedRequest.getRequestId().equals(requestId)) {
- throw new RequestConflictedException(String.format(conflictFailMessage, modelType.toString(), instanceName,
- conflictedRequest.getRequestStatus(), conflictedRequest.getRequestId()));
+ throw new RequestConflictedException(String.format(CONFLICT_FAIL_MESSAGE, modelType.toString(),
+ instanceName, conflictedRequest.getRequestStatus(), conflictedRequest.getRequestId()));
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
new file mode 100644
index 0000000000..4aa60152dd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 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.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+public interface RequestValidator {
+
+
+ /**
+ * Should this validator run for given request
+ *
+ * @return
+ */
+ public boolean shouldRunFor(String uri, ServiceInstancesRequest request);
+
+
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams);
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
new file mode 100644
index 0000000000..d689c6b7a5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 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.apihandlerinfra.infra.rest.validators;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import javax.annotation.PostConstruct;
+import org.javatuples.Pair;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.listener.ListenerRunner;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RequestValidatorListenerRunner extends ListenerRunner {
+
+ private static Logger logger = LoggerFactory.getLogger(RequestValidatorListenerRunner.class);
+
+ protected List<RequestValidator> requestValidators;
+
+ @PostConstruct
+ protected void init() {
+ requestValidators = new ArrayList<>(
+ Optional.ofNullable(context.getBeansOfType(RequestValidator.class)).orElse(new HashMap<>()).values());
+ }
+
+ public boolean runValidations(String requestURI, Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) throws ApiException {
+ logger.info("Running local validations");
+ List<Pair<String, Optional<String>>> results =
+ runValidations(requestValidators, instanceIdMap, request, queryParams, requestURI);
+ if (!results.isEmpty()) {
+ throw new ValidateException("Failed Validations:\n"
+ + results.stream().map(item -> String.format("%s: %s", item.getValue0(), item.getValue1().get()))
+ .collect(Collectors.joining("\n")),
+ 400);
+ }
+
+ return true;
+ }
+
+ protected List<Pair<String, Optional<String>>> runValidations(List<? extends RequestValidator> validators,
+ Map<String, String> instanceIdMap, ServiceInstancesRequest request, Map<String, String> queryParams,
+ String requestURI) {
+
+ List<? extends RequestValidator> filtered =
+ filterListeners(validators, (item -> item.shouldRunFor(requestURI, request)));
+
+ List<Pair<String, Optional<String>>> results = new ArrayList<>();
+ filtered.forEach(item -> results
+ .add(new Pair<>(item.getClass().getName(), item.validate(instanceIdMap, request, queryParams))));
+
+ return results.stream().filter(item -> item.getValue1().isPresent()).collect(Collectors.toList());
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
index d3fb7986ce..877376cc79 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -61,12 +61,18 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/cloudResources")
-@Api(value = "/onap/so/infra/cloudResources", description = "API Requests for cloud resources - Tenant Isolation")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/cloudResources",
+ description = "API Requests for cloud resources - Tenant Isolation"))
public class CloudOrchestration {
private static Logger logger = LoggerFactory.getLogger(CloudOrchestration.class);
@@ -85,7 +91,8 @@ public class CloudOrchestration {
@Path("/{version:[vV][1]}/operationalEnvironments")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create an Operational Environment", response = Response.class)
+ @Operation(description = "Create an Operational Environment", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createOperationEnvironment(String request, @PathParam("version") String version,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -97,7 +104,8 @@ public class CloudOrchestration {
@Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/activate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Activate an Operational Environment", response = Response.class)
+ @Operation(description = "Activate an Operational Environment", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response activateOperationEnvironment(String request, @PathParam("version") String version,
@PathParam("operationalEnvironmentId") String operationalEnvironmentId,
@@ -112,7 +120,8 @@ public class CloudOrchestration {
@Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/deactivate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Deactivate an Operational Environment", response = Response.class)
+ @Operation(description = "Deactivate an Operational Environment", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deactivateOperationEnvironment(String request, @PathParam("version") String version,
@PathParam("operationalEnvironmentId") String operationalEnvironmentId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
index e9cd303c0b..47d6932730 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
@@ -62,13 +62,18 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("onap/so/infra/cloudResourcesRequests")
-@Api(value = "onap/so/infra/cloudResourcesRequests",
- description = "API GET Requests for cloud resources - Tenant Isolation")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/cloudResourcesRequests",
+ description = "API GET Requests for cloud resources - Tenant Isolation"))
public class CloudResourcesOrchestration {
private static Logger logger = LoggerFactory.getLogger(CloudResourcesOrchestration.class);
@@ -83,7 +88,7 @@ public class CloudResourcesOrchestration {
@Path("/{version: [vV][1]}/{requestId}/unlock")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Unlock CloudOrchestration requests for a specified requestId")
+ @Operation(description = "Unlock CloudOrchestration requests for a specified requestId")
@Transactional
public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId,
@PathParam("version") String version) throws ApiException {
@@ -167,8 +172,9 @@ public class CloudResourcesOrchestration {
@Path("/{version:[vV][1]}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Get status of an Operational Environment based on filter criteria",
- response = Response.class)
+ @Operation(description = "Get status of an Operational Environment based on filter criteria",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version)
throws ApiException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
index 216588432b..2f922220c9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
@@ -55,12 +55,18 @@ import org.springframework.stereotype.Component;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/modelDistributions")
-@Api(value = "/onap/so/infra/modelDistributions", description = "API Requests for Model Distributions")
+@OpenAPIDefinition(
+ info = @Info(title = "/onap/so/infra/modelDistributions", description = "API Requests for Model Distributions"))
public class ModelDistributionRequest {
private static Logger logger = LoggerFactory.getLogger(ModelDistributionRequest.class);
@@ -71,7 +77,8 @@ public class ModelDistributionRequest {
@Path("/{version:[vV][1]}/distributions/{distributionId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update model distribution status", response = Response.class)
+ @Operation(description = "Update model distribution status", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateModelDistributionStatus(String requestJSON, @PathParam("version") String version,
@PathParam("distributionId") String distributionId) throws ApiException {
@@ -137,10 +144,8 @@ public class ModelDistributionRequest {
se.setMessageId(messageId);
se.setText(text);
if (variables != null) {
- if (variables != null) {
- for (String variable : variables) {
- se.getVariables().add(variable);
- }
+ for (String variable : variables) {
+ se.getVariables().add(variable);
}
}
re.setServiceException(se);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
index efdc52b837..6449b0bb75 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
@@ -92,6 +92,7 @@ public class TenantIsolationRequest {
requestJSON = mapper.writeValueAsString(request.getRequestDetails());
} catch (JsonProcessingException e) {
+ logger.error("Exception in JSON processing", e);
throw new ValidationException("Parse ServiceInstanceRequest to JSON string", true);
}
@@ -325,6 +326,7 @@ public class TenantIsolationRequest {
orchestrationFilterParams.put(queryParam, value);
}
} catch (Exception e) {
+ logger.error("Exception in getOrchestrationFilters", e);
throw new ValidationException(e.getMessage(), true);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
index b5ba9281a6..18ca6d3086 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
@@ -50,12 +50,19 @@ public class SDCClientHelper {
private static Logger logger = LoggerFactory.getLogger(SDCClientHelper.class);
private static final String SDC_CONTENT_TYPE = "application/json";
private static final String SDC_ACCEPT_TYPE = "application/json";
- private static String PARTIAL_SDC_URI = "/sdc/v1/catalog/services/";
+ private static final String PARTIAL_SDC_URI = "/sdc/v1/catalog/services/";
- private static String MESSAGE_UNDEFINED_ERROR = "Undefined Error Message!";
- private static String MESSAGE_UNEXPECTED_FORMAT = "Unexpected response format from SDC.";
+ private static final String MESSAGE_UNDEFINED_ERROR = "Undefined Error Message!";
+ private static final String MESSAGE_UNEXPECTED_FORMAT = "Unexpected response format from SDC.";
private final HttpClientFactory httpClientFactory = new HttpClientFactory();
+ private static final String STATUS_CODE = "statusCode";
+ private static final String MESSAGE = "message";
+ private static final String MESSAGE_ID = "messageId";
+ private static final String REQUEST_ERROR = "requestError";
+ private static final String SERVICE_EXCEPTION = "serviceException";
+ private static final String POLICY_EXCEPTION = "policyException";
+
@Value("${mso.sdc.endpoint}")
private String sdcEndpoint;
@Value("${mso.sdc.activate.userid}")
@@ -89,12 +96,11 @@ public class SDCClientHelper {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
.build();
- ValidateException validateException = new ValidateException.Builder(
+
+ throw new ValidateException.Builder(
" SDC credentials 'mso.sdc.client.auth' not setup in properties file!",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo)
.build();
-
- throw validateException;
}
URL url = new URL(urlString);
@@ -114,12 +120,12 @@ public class SDCClientHelper {
sdcResponseJsonObj = enhanceJsonResponse(new JSONObject(responseData), statusCode);
} catch (Exception ex) {
- logger.debug("calling SDC Exception message: {}", ex.getMessage());
+ logger.debug("calling SDC Exception message:", ex);
String errorMessage = " Encountered Error while calling SDC POST Activate. " + ex.getMessage();
logger.debug(errorMessage);
- sdcResponseJsonObj.put("statusCode", String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
- sdcResponseJsonObj.put("messageId", "");
- sdcResponseJsonObj.put("message", errorMessage);
+ sdcResponseJsonObj.put(STATUS_CODE, String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
+ sdcResponseJsonObj.put(MESSAGE_ID, "");
+ sdcResponseJsonObj.put(MESSAGE, errorMessage);
}
return sdcResponseJsonObj;
@@ -139,11 +145,9 @@ public class SDCClientHelper {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
.build();
- ValidateException validateException =
- new ValidateException.Builder("Bad request could not post payload", HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw new ValidateException.Builder("Bad request could not post payload", HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
}
}
@@ -154,7 +158,7 @@ public class SDCClientHelper {
* @param statusCode - int
* @return enhancedAsdcResponseJsonObj - JSONObject object
*/
- public JSONObject enhanceJsonResponse(JSONObject sdcResponseJsonObj, int statusCode) throws JSONException {
+ public JSONObject enhanceJsonResponse(JSONObject sdcResponseJsonObj, int statusCode) {
JSONObject enhancedAsdcResponseJsonObj = new JSONObject();
@@ -163,31 +167,31 @@ public class SDCClientHelper {
if (statusCode == Response.Status.ACCEPTED.getStatusCode()) { // Accepted
enhancedAsdcResponseJsonObj.put("distributionId", sdcResponseJsonObj.get("distributionId"));
- enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
- enhancedAsdcResponseJsonObj.put("messageId", "");
- enhancedAsdcResponseJsonObj.put("message", "Success");
+ enhancedAsdcResponseJsonObj.put(STATUS_CODE, Integer.toString(statusCode));
+ enhancedAsdcResponseJsonObj.put(MESSAGE_ID, "");
+ enhancedAsdcResponseJsonObj.put(MESSAGE, "Success");
} else { // error
- if (sdcResponseJsonObj.has("requestError")) {
- JSONObject requestErrorObj = sdcResponseJsonObj.getJSONObject("requestError");
- if (sdcResponseJsonObj.getJSONObject("requestError").has("serviceException")) {
- message = requestErrorObj.getJSONObject("serviceException").getString("text");
- messageId = requestErrorObj.getJSONObject("serviceException").getString("messageId");
+ if (sdcResponseJsonObj.has(REQUEST_ERROR)) {
+ JSONObject requestErrorObj = sdcResponseJsonObj.getJSONObject(REQUEST_ERROR);
+ if (sdcResponseJsonObj.getJSONObject(REQUEST_ERROR).has(SERVICE_EXCEPTION)) {
+ message = requestErrorObj.getJSONObject(SERVICE_EXCEPTION).getString("text");
+ messageId = requestErrorObj.getJSONObject(SERVICE_EXCEPTION).getString(MESSAGE_ID);
}
- if (sdcResponseJsonObj.getJSONObject("requestError").has("policyException")) {
- message = requestErrorObj.getJSONObject("policyException").getString("text");
- messageId = requestErrorObj.getJSONObject("policyException").getString("messageId");
+ if (sdcResponseJsonObj.getJSONObject(REQUEST_ERROR).has(POLICY_EXCEPTION)) {
+ message = requestErrorObj.getJSONObject(POLICY_EXCEPTION).getString("text");
+ messageId = requestErrorObj.getJSONObject(POLICY_EXCEPTION).getString(MESSAGE_ID);
}
- enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
- enhancedAsdcResponseJsonObj.put("messageId", messageId);
- enhancedAsdcResponseJsonObj.put("message", message);
+ enhancedAsdcResponseJsonObj.put(STATUS_CODE, Integer.toString(statusCode));
+ enhancedAsdcResponseJsonObj.put(MESSAGE_ID, messageId);
+ enhancedAsdcResponseJsonObj.put(MESSAGE, message);
} else {
// unexpected format
- enhancedAsdcResponseJsonObj.put("statusCode",
+ enhancedAsdcResponseJsonObj.put(STATUS_CODE,
String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
- enhancedAsdcResponseJsonObj.put("messageId", MESSAGE_UNDEFINED_ERROR);
- enhancedAsdcResponseJsonObj.put("message", MESSAGE_UNEXPECTED_FORMAT);
+ enhancedAsdcResponseJsonObj.put(MESSAGE_ID, MESSAGE_UNDEFINED_ERROR);
+ enhancedAsdcResponseJsonObj.put(MESSAGE, MESSAGE_UNEXPECTED_FORMAT);
}
}
return enhancedAsdcResponseJsonObj;
@@ -214,7 +218,7 @@ public class SDCClientHelper {
* @return String json
* @throws JSONException
*/
- public String buildJsonWorkloadContext(String workloadContext) throws JSONException {
+ public String buildJsonWorkloadContext(String workloadContext) {
return new JSONObject().put("workloadContext", workloadContext).toString();
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index 3005abaf9b..3226a0c313 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -61,16 +61,14 @@ public class ActivateVnfStatusOperationalEnvironment {
private OperationalEnvServiceModelStatus queryServiceModelResponse = null;
private boolean isOverallSuccess = false;
- private final int RETRY_COUNT_ZERO = 0;
- private final String ERROR_REASON_ABORTED = "ABORTED";
- private final String RECOVERY_ACTION_RETRY = "RETRY";
- private final String RECOVERY_ACTION_ABORT = "ABORT";
- private final String RECOVERY_ACTION_SKIP = "SKIP";
- private final String DISTRIBUTION_STATUS_OK = DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString();
- private final String DISTRIBUTION_STATUS_ERROR = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
- private final String DISTRIBUTION_STATUS_SENT = "SENT";
-
- private final String MESSAGE_UNDEFINED_ID = "Undefined Error Message!";
+ private static final int RETRY_COUNT_ZERO = 0;
+ private static final String ERROR_REASON_ABORTED = "ABORTED";
+ private static final String RECOVERY_ACTION_RETRY = "RETRY";
+ private static final String RECOVERY_ACTION_ABORT = "ABORT";
+ private static final String RECOVERY_ACTION_SKIP = "SKIP";
+ private static final String DISTRIBUTION_STATUS_OK = DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString();
+ private static final String DISTRIBUTION_STATUS_ERROR = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
+ private static final String DISTRIBUTION_STATUS_SENT = "SENT";
@Autowired
private ActivateVnfDBHelper dbHelper;
@@ -130,6 +128,7 @@ public class ActivateVnfStatusOperationalEnvironment {
}
} catch (Exception e) {
+ logger.error("Exception in execute", e);
requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId,
this.queryServiceModelResponse.getVnfOperationalEnvId());
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java
index 71405b0f63..20be2b5a8b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java
@@ -43,7 +43,8 @@ public class PlatformLOBValidation implements ValidationRule {
platform = info.getSir().getRequestDetails().getPlatform();
lineOfBusiness = info.getSir().getRequestDetails().getLineOfBusiness();
- if (reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.createInstance) {
+ if (reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.createInstance
+ && !info.getReqParameters().getEnforceValidNfValues()) {
if (reqVersion > 5 && platform == null) {
throw new ValidationException("platform");
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java
index 584269715a..cebbd6389c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java
@@ -41,10 +41,12 @@ public class ProjectOwningEntityValidation implements ValidationRule {
String requestScope = info.getRequestScope();
Actions action = info.getAction();
+
project = info.getSir().getRequestDetails().getProject();
owningEntity = info.getSir().getRequestDetails().getOwningEntity();
if (reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.service.name())
- && action == Action.createInstance || action == Action.assignInstance) {
+ && !info.getReqParameters().getEnforceValidNfValues() && action == Action.createInstance
+ || action == Action.assignInstance) {
if (reqVersion > 5 && owningEntity == null) {
throw new ValidationException("owningEntity");
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java
deleted file mode 100644
index 276b438529..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java
+++ /dev/null
@@ -1,55 +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.apihandler.filters;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.net.URI;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.core.UriInfo;
-import org.junit.Test;
-import org.onap.so.apihandlerinfra.BaseTest;
-
-
-
-public class RequestUriFilterTest extends BaseTest {
-
- @Test
- public void filterTest() throws IOException {
- RequestUriFilter URIFilter = new RequestUriFilter();
- URI baseURI = URI.create("http://localhost:58879/");
- String requestURI = "onap/so/infra/serviceInstances/v5";
-
- ContainerRequestContext mockContext = mock(ContainerRequestContext.class);
- UriInfo mockInfo = mock(UriInfo.class);
-
- when(mockContext.getUriInfo()).thenReturn(mockInfo);
- when(mockInfo.getBaseUri()).thenReturn(baseURI);
- when(mockInfo.getPath()).thenReturn(requestURI);
-
-
- URIFilter.filter(mockContext);
- assertEquals("http://localhost:58879/onap/so/infra/serviceInstantiation/v5/serviceInstances",
- URIFilter.getRequestUri());
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java
index e6b5163f59..830f38f98b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java
@@ -30,6 +30,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricActivityInstanceEntity;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
@@ -119,7 +120,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getActivityNameTest() throws IOException {
+ public void getActivityNameTest() {
String expectedActivityName = "Last task executed: BB to Execute";
String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
@@ -127,7 +128,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getActivityNameNullActivityNameTest() throws IOException {
+ public void getActivityNameNullActivityNameTest() {
String expectedActivityName = "Task name is null.";
HistoricActivityInstanceEntity activityInstance = new HistoricActivityInstanceEntity();
List<HistoricActivityInstanceEntity> activityInstanceList = new ArrayList<>();
@@ -139,7 +140,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getActivityNameNullListTest() throws IOException {
+ public void getActivityNameNullListTest() {
String expectedActivityName = "No results returned on activityInstance history lookup.";
List<HistoricActivityInstanceEntity> activityInstanceList = null;
String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
@@ -148,7 +149,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getActivityNameEmptyListTest() throws IOException {
+ public void getActivityNameEmptyListTest() {
String expectedActivityName = "No results returned on activityInstance history lookup.";
List<HistoricActivityInstanceEntity> activityInstanceList = new ArrayList<>();
String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
@@ -157,7 +158,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getTaskNameTest() throws IOException, ContactCamundaException {
+ public void getTaskNameTest() throws ContactCamundaException {
doReturn(processInstanceResponse).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
doReturn(activityInstanceResponse).when(camundaRequestHandler)
.getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b", REQUEST_ID);
@@ -170,7 +171,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getTaskNameNullProcessInstanceListTest() throws IOException, ContactCamundaException {
+ public void getTaskNameNullProcessInstanceListTest() throws ContactCamundaException {
ResponseEntity<List<HistoricProcessInstanceEntity>> response = new ResponseEntity<>(null, HttpStatus.OK);
doReturn(response).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
String expected = "No processInstances returned for requestId: " + REQUEST_ID;
@@ -181,7 +182,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getTaskNameNullProcessInstanceIdTest() throws IOException, ContactCamundaException {
+ public void getTaskNameNullProcessInstanceIdTest() throws ContactCamundaException {
HistoricProcessInstanceEntity processInstance = new HistoricProcessInstanceEntity();
List<HistoricProcessInstanceEntity> processInstanceList = new ArrayList<>();
processInstanceList.add(processInstance);
@@ -196,7 +197,19 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getTaskNameProcessInstanceLookupFailureTest() throws IOException, ContactCamundaException {
+ public void getTaskNameEmptyProcessInstanceListTest() throws ContactCamundaException {
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response =
+ new ResponseEntity<>(Collections.emptyList(), HttpStatus.OK);
+ doReturn(response).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
+ String expected = "No processInstances returned for requestId: " + REQUEST_ID;
+
+ String actual = camundaRequestHandler.getTaskName(REQUEST_ID);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void getTaskNameProcessInstanceLookupFailureTest() throws ContactCamundaException {
doThrow(HttpClientErrorException.class).when(camundaRequestHandler)
.getCamundaProcessInstanceHistory(REQUEST_ID);
@@ -205,7 +218,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getCamundaActivityHistoryTest() throws IOException, ContactCamundaException {
+ public void getCamundaActivityHistoryTest() throws ContactCamundaException {
HttpHeaders headers = setHeaders();
HttpEntity<?> requestEntity = new HttpEntity<>(headers);
String targetUrl = "http://localhost:8089/sobpmnengine/history/activity-instance?processInstanceId="
@@ -239,7 +252,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getCamundaProccesInstanceHistoryTest() throws IOException, ContactCamundaException {
+ public void getCamundaProccesInstanceHistoryTest() {
HttpHeaders headers = setHeaders();
HttpEntity<?> requestEntity = new HttpEntity<>(headers);
String targetUrl =
@@ -292,7 +305,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void getCamundaProccesInstanceHistoryFailThenSuccessTest() throws IOException, ContactCamundaException {
+ public void getCamundaProccesInstanceHistoryFailThenSuccessTest() {
HttpHeaders headers = setHeaders();
HttpEntity<?> requestEntity = new HttpEntity<>(headers);
String targetUrl =
@@ -310,7 +323,7 @@ public class CamundaRequestHandlerTest {
}
@Test
- public void setCamundaHeadersTest() throws ContactCamundaException, RequestDbFailureException {
+ public void setCamundaHeadersTest() {
String encryptedAuth = "015E7ACF706C6BBF85F2079378BDD2896E226E09D13DC2784BA309E27D59AB9FAD3A5E039DF0BB8408"; // user:password
String key = "07a7159d3bf51a0e53be7a8f89699be7";
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java
index 928b488f6a..0291cfd2ea 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java
@@ -20,70 +20,67 @@
package org.onap.so.apihandlerinfra;
-import static org.junit.Assert.assertArrayEquals;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyObject;
+import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-import org.springframework.test.util.ReflectionTestUtils;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
import org.json.JSONException;
-import org.junit.Rule;
import org.junit.Test;
-import org.mockito.InjectMocks;
+import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
-import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnit;
-import org.mockito.junit.MockitoRule;
+import org.onap.so.apihandlerinfra.HealthCheckConfig.Endpoint;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.mock.mockito.SpyBean;
+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.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.JsonProcessingException;
+@RunWith(SpringRunner.class)
+@ContextConfiguration(classes = {GenericStringConverter.class, HealthCheckConverter.class},
+ initializers = {ConfigFileApplicationContextInitializer.class})
+@ActiveProfiles("test")
+@EnableConfigurationProperties({HealthCheckConfig.class})
public class GlobalHealthcheckHandlerTest {
- @Mock
- RestTemplate restTemplate;
+ @MockBean
+ private RestTemplate restTemplate;
- @Mock
- ContainerRequestContext requestContext;
+ @MockBean
+ private ContainerRequestContext requestContext;
- @InjectMocks
- @Spy
- GlobalHealthcheckHandler globalhealth;
-
- @Rule
- public MockitoRule mockitoRule = MockitoJUnit.rule();
+ @SpyBean
+ private GlobalHealthcheckHandler globalhealth;
@Test
public void testQuerySubsystemHealthNullResult() {
ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage");
- ReflectionTestUtils.setField(globalhealth, "endpointBpmn", "http://localhost:8080");
Mockito.when(restTemplate.exchange(ArgumentMatchers.any(URI.class), ArgumentMatchers.any(HttpMethod.class),
ArgumentMatchers.<HttpEntity<?>>any(), ArgumentMatchers.<Class<Object>>any())).thenReturn(null);
- String result = globalhealth.querySubsystemHealth(MsoSubsystems.BPMN);
- System.out.println(result);
- assertEquals(HealthcheckStatus.DOWN.toString(), result);
+ HealthCheckSubsystem result = globalhealth
+ .querySubsystemHealth(new Endpoint(SoSubsystems.BPMN, UriBuilder.fromPath("http://localhost").build()));
+ assertEquals(HealthCheckStatus.DOWN, result.getStatus());
}
@Test
public void testQuerySubsystemHealthNotNullResult() {
ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage");
- ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080");
SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse();
subSystemResponse.setStatus("UP");
@@ -92,20 +89,13 @@ public class GlobalHealthcheckHandlerTest {
Mockito.when(restTemplate.exchange(ArgumentMatchers.any(URI.class), ArgumentMatchers.any(HttpMethod.class),
ArgumentMatchers.<HttpEntity<?>>any(), ArgumentMatchers.<Class<Object>>any())).thenReturn(r);
- String result = globalhealth.querySubsystemHealth(MsoSubsystems.ASDC);
- System.out.println(result);
- assertEquals(HealthcheckStatus.UP.toString(), result);
+ HealthCheckSubsystem result = globalhealth
+ .querySubsystemHealth(new Endpoint(SoSubsystems.ASDC, UriBuilder.fromPath("http://localhost").build()));
+ assertEquals(HealthCheckStatus.UP, result.getStatus());
}
private Response globalHealthcheck(String status) {
ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage");
- ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080");
- ReflectionTestUtils.setField(globalhealth, "endpointSdnc", "http://localhost:8081");
- ReflectionTestUtils.setField(globalhealth, "endpointBpmn", "http://localhost:8082");
- ReflectionTestUtils.setField(globalhealth, "endpointCatalogdb", "http://localhost:8083");
- ReflectionTestUtils.setField(globalhealth, "endpointOpenstack", "http://localhost:8084");
- ReflectionTestUtils.setField(globalhealth, "endpointRequestdb", "http://localhost:8085");
- ReflectionTestUtils.setField(globalhealth, "endpointRequestdbAttsvc", "http://localhost:8086");
SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse();
@@ -116,70 +106,41 @@ public class GlobalHealthcheckHandlerTest {
Mockito.when(requestContext.getProperty(anyString())).thenReturn("1234567890");
Response response = globalhealth.globalHealthcheck(true, requestContext);
-
return response;
}
@Test
- public void globalHealthcheckAllUPTest() throws JSONException {
- Response response = globalHealthcheck("UP");
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
- HealthcheckResponse root;
- root = (HealthcheckResponse) response.getEntity();
- String apistatus = root.getApih();
- assertTrue(apistatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String bpmnstatus = root.getBpmn();
- assertTrue(bpmnstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String sdncstatus = root.getSdncAdapter();
- assertTrue(sdncstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
+ public void globalHealthcheckAllUPTest() throws JSONException, JsonProcessingException {
- String asdcstatus = root.getAsdcController();
- assertTrue(asdcstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
+ HealthCheckResponse expected = new HealthCheckResponse();
- String catastatus = root.getCatalogdbAdapter();
- assertTrue(catastatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String reqdbstatus = root.getRequestdbAdapter();
- assertTrue(reqdbstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String openstatus = root.getOpenstackAdapter();
- assertTrue(openstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
+ for (Subsystem system : SoSubsystems.values()) {
+ expected.getSubsystems().add(new HealthCheckSubsystem(system,
+ UriBuilder.fromUri("http://localhost").build(), HealthCheckStatus.UP));
+ }
+ expected.setMessage("HttpStatus: 200");
+ Response response = globalHealthcheck("UP");
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ HealthCheckResponse root;
+ root = (HealthCheckResponse) response.getEntity();
+ assertThat(root, sameBeanAs(expected).ignoring("subsystems.uri").ignoring("subsystems.subsystem"));
- String reqdbattstatus = root.getRequestdbAdapterAttsvc();
- assertTrue(reqdbattstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
}
@Test
public void globalHealthcheckAllDOWNTest() throws JSONException {
+ HealthCheckResponse expected = new HealthCheckResponse();
+
+ for (Subsystem system : SoSubsystems.values()) {
+ expected.getSubsystems().add(new HealthCheckSubsystem(system,
+ UriBuilder.fromUri("http://localhost").build(), HealthCheckStatus.DOWN));
+ }
+ expected.setMessage("HttpStatus: 200");
Response response = globalHealthcheck("DOWN");
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
- HealthcheckResponse root;
- root = (HealthcheckResponse) response.getEntity();
- String apistatus = root.getApih();
- assertTrue(apistatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String bpmnstatus = root.getBpmn();
- assertTrue(bpmnstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String sdncstatus = root.getSdncAdapter();
- assertTrue(sdncstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String asdcstatus = root.getAsdcController();
- assertTrue(asdcstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String catastatus = root.getCatalogdbAdapter();
- assertTrue(catastatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String reqdbstatus = root.getRequestdbAdapter();
- assertTrue(reqdbstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String openstatus = root.getOpenstackAdapter();
- assertTrue(openstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String reqdbattstatus = root.getRequestdbAdapterAttsvc();
- assertTrue(reqdbattstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
+ HealthCheckResponse root;
+ root = (HealthCheckResponse) response.getEntity();
+ assertThat(root, sameBeanAs(expected).ignoring("subsystems.uri").ignoring("subsystems.subsystem"));
}
@Test
@@ -189,40 +150,15 @@ public class GlobalHealthcheckHandlerTest {
assertEquals(MediaType.APPLICATION_JSON, he.getHeaders().getContentType());
}
- @Test
- public void getEndpointUrlForSubsystemEnumTest() {
- ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage");
- ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080");
- ReflectionTestUtils.setField(globalhealth, "endpointSdnc", "http://localhost:8081");
- ReflectionTestUtils.setField(globalhealth, "endpointBpmn", "http://localhost:8082");
- ReflectionTestUtils.setField(globalhealth, "endpointCatalogdb", "http://localhost:8083");
- ReflectionTestUtils.setField(globalhealth, "endpointOpenstack", "http://localhost:8084");
- ReflectionTestUtils.setField(globalhealth, "endpointRequestdb", "http://localhost:8085");
- ReflectionTestUtils.setField(globalhealth, "endpointRequestdbAttsvc", "http://localhost:8086");
-
- String result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.ASDC);
- assertEquals("http://localhost:8080", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.SDNC);
- assertEquals("http://localhost:8081", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.BPMN);
- assertEquals("http://localhost:8082", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.CATALOGDB);
- assertEquals("http://localhost:8083", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.OPENSTACK);
- assertEquals("http://localhost:8084", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.REQUESTDB);
- assertEquals("http://localhost:8085", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.REQUESTDBATT);
- assertEquals("http://localhost:8086", result);
- }
@Test
public void processResponseFromSubsystemTest() {
SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse();
subSystemResponse.setStatus("UP");
ResponseEntity<SubsystemHealthcheckResponse> r = new ResponseEntity<>(subSystemResponse, HttpStatus.OK);
- String result = globalhealth.processResponseFromSubsystem(r, MsoSubsystems.BPMN);
- assertEquals("UP", result);
+ Endpoint endpoint = new Endpoint(SoSubsystems.BPMN, UriBuilder.fromUri("http://localhost").build());
+ HealthCheckStatus result = globalhealth.processResponseFromSubsystem(r, endpoint);
+ assertEquals(HealthCheckStatus.UP, result);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
index 5023155768..627bbc631d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
@@ -25,6 +25,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringUtils;
@@ -232,6 +233,21 @@ public class OrchestrationRequestsUnitTest {
}
@Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestErrorMessageTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ iar.setExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
+ iar.setFlowStatus(null);
+ iar.setStatusMessage("Error retrieving cloud region from AAI");
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+
+ assertTrue(actual.getRequestStatus().getStatusMessage()
+ .contains("Error Source: " + ROLLBACK_EXT_SYSTEM_ERROR_SOURCE));
+ }
+
+ @Test
public void mapRequestStatusAndExtSysErrSrcToRequestFlowStatusSuccessfulCompletionTest() throws ApiException {
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
@@ -295,6 +311,14 @@ public class OrchestrationRequestsUnitTest {
assertEquals(Status.ABORTED.toString(), result);
}
+ @Test
+ public void mapRequestStatusToRequestForFormatStatusDetailTest() throws ApiException {
+ iar.setRequestStatus(Status.ABORTED.toString());
+ String result = orchestrationRequests.mapRequestStatusToRequest(iar, "statusDetail");
+
+ assertEquals(Status.ABORTED.toString(), result);
+ }
+
@Test
public void mapRequestStatusToRequestForFormatEmptyStringTest() throws ApiException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index e28e36d307..48a5343104 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -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.
@@ -285,14 +285,13 @@ public class ServiceInstancesTest extends BaseTest {
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v5", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
- uri = servInstanceUriPrev7 + "v5";
+ uri = servInstanceuri + "v5";
ResponseEntity<String> response =
sendRequest(inputStream("/ServiceInstancePrev7.json"), uri, HttpMethod.POST, headers);
// then
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ assertEquals(404, response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
- assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
@@ -896,7 +895,7 @@ public class ServiceInstancesTest extends BaseTest {
ResponseEntity<String> response =
sendRequest(inputStream("/VnfWithServiceRelatedInstanceFail.json"), uri, HttpMethod.POST);
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
+ assertEquals(404, response.getStatusCode().value());
}
@Test
@@ -2248,14 +2247,12 @@ public class ServiceInstancesTest extends BaseTest {
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v5", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
- uri = servInstanceUriPrev7 + "v5";
+ uri = servInstanceuri + "v5";
ResponseEntity<String> response =
sendRequest(inputStream("/MacroServiceInstance.json"), uri, HttpMethod.POST, headers);
// then
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
- assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
+ assertEquals(404, response.getStatusCode().value());
}
@Test
@@ -2934,15 +2931,5 @@ public class ServiceInstancesTest extends BaseTest {
Actions action = servInstances.handleReplaceInstance(Action.replaceInstance, sir);
assertEquals(Action.replaceInstanceRetainAssignments, action);
}
- /*
- * @Test public void buildSelfLinkUrlTest() throws Exception { // v - version String incomingUrl =
- * "http://localhost:8080/onap/infra/so/serviceInstantiation/v7/serviceInstances"; String expectedSelfLink =
- * "http://localhost:8080/orchestrationRequests/v7/efce3167-5e45-4666-9d4d-22e23648e5d1"; String requestId =
- * "efce3167-5e45-4666-9d4d-22e23648e5d1"; Optional<URL> actualSelfLinkUrl = buildSelfLinkUrl(incomingUrl,
- * requestId); assertEquals(expectedSelfLink, actualSelfLinkUrl.get().toString()); // V - Version String
- * incomingUrlV = "http://localhost:8080/onap/infra/so/serviceInstantiation/V7/serviceInstances"; String
- * expectedSelfLinkV = "http://localhost:8080/orchestrationRequests/V7/efce3167-5e45-4666-9d4d-22e23648e5d1";
- * Optional<URL> actualSelfLinkUrlV = buildSelfLinkUrl(incomingUrlV, requestId); assertEquals(expectedSelfLinkV,
- * actualSelfLinkUrlV.get().toString()); }
- */
}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
index 3644dd8e7f..f73da49e0d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
@@ -23,6 +23,7 @@ package org.onap.so.apihandlerinfra.infra.rest;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
import java.io.File;
import java.util.Optional;
import org.junit.Before;
@@ -32,7 +33,6 @@ import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ServiceInstance;
@@ -40,6 +40,7 @@ import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
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.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -55,15 +56,19 @@ public class BpmnRequestBuilderTest {
@Rule
public ExpectedException exceptionRule = ExpectedException.none();
+
+ @Mock
+ private AAIResourcesClient aaiResourcesClient;
+
@InjectMocks
- @Spy
- BpmnRequestBuilder reqBuilder;
+ private AAIDataRetrieval aaiData = spy(AAIDataRetrieval.class);
@Mock
private RequestsDbClient requestDBClient;
- @Mock
- private AAIResourcesClient aaiResourcesClient;
+ @InjectMocks
+ private BpmnRequestBuilder reqBuilder = spy(BpmnRequestBuilder.class);
+
private ObjectMapper mapper = new ObjectMapper();
@@ -71,8 +76,7 @@ public class BpmnRequestBuilderTest {
@Before
public void setup() {
- reqBuilder.setAaiResourcesClient(aaiResourcesClient);
-
+ // aaiData.setAaiResourcesClient(aaiResourcesClient);
}
@Test
@@ -80,11 +84,11 @@ public class BpmnRequestBuilderTest {
ServiceInstance service =
provider.getMapper().readValue(new File(RESOURCE_PATH + "ServiceInstance.json"), ServiceInstance.class);
- doReturn(service).when(reqBuilder).getServiceInstance("serviceId");
+ doReturn(service).when(aaiData).getServiceInstance("serviceId");
ServiceInstancesRequest expectedRequest = mapper
.readValue(new File(RESOURCE_PATH + "ExpectedServiceRequest.json"), ServiceInstancesRequest.class);
- expectedRequest.getRequestDetails().getModelInfo().setModelId(null);
- // bad getter/setter setting multiple fields
+ expectedRequest.getRequestDetails().getModelInfo().setModelId(null); // bad getter/setter setting multiple
+ // fields
ServiceInstancesRequest actualRequest = reqBuilder.buildServiceDeleteRequest("serviceId");
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
@@ -128,13 +132,16 @@ public class BpmnRequestBuilderTest {
AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
VolumeGroup volumeGroup =
provider.getMapper().readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);
-
- doReturn(Optional.of(volumeGroup)).when(aaiResourcesClient).get(VolumeGroup.class, AAIUriFactory
- .createResourceUri(AAIObjectType.VOLUME_GROUP, "cloudOwner", "regionOne", "volumeGroupId"));
+ AAIResultWrapper wrapper = new AAIResultWrapper(volumeGroup);
+ doReturn(wrapper).when(aaiResourcesClient)
+ .get(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
+ .relatedTo(AAIObjectType.VOLUME_GROUP, "volumeGroupId"));
ServiceInstancesRequest expectedRequest = mapper
.readValue(new File(RESOURCE_PATH + "ExpectedVolumeGroupRequest.json"), ServiceInstancesRequest.class);
ServiceInstancesRequest actualRequest = reqBuilder.buildVolumeGroupDeleteRequest("vnfId", "volumeGroupId");
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
+
}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql
index 6d8e2e8b09..d5575804ae 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql
@@ -1,10 +1,10 @@
-INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
+INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo": {"modelType": "vfModule","modelName": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
-INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
+INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"Infra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json
new file mode 100644
index 0000000000..a6aa3e1c25
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json
@@ -0,0 +1,33 @@
+{
+ "serviceInstanceId":"1882939",
+ "vnfInstanceId":"1882938",
+ "networkInstanceId":"1882937",
+ "volumeGroupInstanceId":"1882935",
+ "vfModuleInstanceId":"1882934",
+ "requestDetails": {
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": "xxxxxx",
+ "instanceName": "testService9"
+ },
+ "requestParameters": {
+ "aLaCarte": true,
+ "autoBuildVfModules": false,
+ "subscriptionServiceType": "test",
+ "disableOwningEntityProject": true
+ },
+ "modelInfo":{
+ "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7965",
+ "modelVersion":"1",
+ "modelVersionId":"10",
+ "modelType":"service",
+ "modelName":"serviceModel",
+ "modelInstanceName":"modelInstanceName",
+ "modelCustomizationId":"f7ce78bb-423b-11e7-93f8-0050569a796"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "someTestId",
+ "subscriberName": "someTestId"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json
index 09f6d81da3..0b03f56caa 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json
@@ -101,7 +101,7 @@
},
{
"relationship-key": "volume-group.volume-group-id",
- "relationship-value": "18b220c8-af84-4b82-a8c0-41bbea6328a6"
+ "relationship-value": "volumeGroupId"
}
]
},
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
index 2e1c6a9bdc..27e1ae90d2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
@@ -9,14 +9,20 @@ server:
mso:
health:
endpoints:
- catalogdb: http://localhost:${wiremock.server.port}
- requestdb: http://localhost:${wiremock.server.port}
- sdnc: http://localhost:${wiremock.server.port}
- openstack: http://localhost:${wiremock.server.port}
- bpmn: http://localhost:${wiremock.server.port}
- asdc: http://localhost:${wiremock.server.port}
- requestdbattsvc: http://localhost:${wiremock.server.port}
-
+ - subsystem: apih
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: asdc
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: bpmn
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: catalogdb
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: openstack
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: requestdb
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: sdnc
+ uri: http://localhost:${wiremock.server.port}
infra-requests:
archived:
period: 180
@@ -118,7 +124,13 @@ mariaDB4j:
port: 3307
databaseName: catalogdb
databaseName2: requestdb
-
+#Actuator
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
org:
onap:
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
index 22f68e0579..72922ae9c1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
@@ -1,12 +1,12 @@
--Changes here should also be made in InfraActiveRequestsReset.sql to be re-inserted after tests
-INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
+INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, null),
('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo": {"modelType": "vfModule","modelName": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
-INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
+INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, null),
('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"Infra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index 731d2bec4d..2129dc2ede 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -1111,6 +1111,7 @@ CREATE TABLE `vnf_resource_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
`VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
@@ -1275,7 +1276,7 @@ CREATE TABLE `infra_active_requests` (
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
`AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
@@ -1328,7 +1329,7 @@ CREATE TABLE `archived_infra_requests` (
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
`AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
index 47f8c6b50e..5a8e2e2f6c 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
@@ -33,7 +33,7 @@ public interface InfraActiveRequestsRepositoryCustom {
public InfraActiveRequests getRequestFromInfraActive(String requestId);
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ public InfraActiveRequests checkInstanceNameDuplicate(Map<String, String> instanceIdMap, String instanceName,
String requestScope);
public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap);
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
index d8c7c8f971..9cf71538b1 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -117,14 +117,11 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
final long startTime = System.currentTimeMillis();
logger.debug("Execute query on infra active request table");
- List<InfraActiveRequests> results = new ArrayList<InfraActiveRequests>();
-
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
crit.where(cb.and(predicates.toArray(new Predicate[0])));
crit.orderBy(order);
- results = entityManager.createQuery(crit).getResultList();
- return results;
+ return entityManager.createQuery(crit).getResultList();
}
/*
@@ -152,7 +149,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
* java.lang.String, java.lang.String)
*/
@Override
- public InfraActiveRequests checkInstanceNameDuplicate(final HashMap<String, String> instanceIdMap,
+ public InfraActiveRequests checkInstanceNameDuplicate(final Map<String, String> instanceIdMap,
final String instanceName, final String requestScope) {
final List<Predicate> predicates = new LinkedList<>();
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql
index 43571e42fc..bfd3d2160a 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql
@@ -4,7 +4,7 @@ insert into operation_status(service_id, operation_id, service_name, user_id, re
('serviceid', 'operationid', 'servicename', 'userid', 'result', 'operationcontent', 'progress', 'reason', '2016-11-24 13:19:10', '2016-11-24 13:19:10');
-insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, aic_cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name, request_url) values
+insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name, request_url) values
('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"vSAMP10aDEV::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"mtn6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'vSAMP10aDEV::base::module-0', null, 'mtn6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_vSAMP10a_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"requestDetails":{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_vSAMP10a_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_vSAMP10a_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarteSet":true,"alaCarte":true}}}', null, 'APIH', '2016-12-22 19:00:28', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_vSAMP10a_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<vnf-request xmlns=\"http://org.onap.so/mso/infra/vnf-request/v1\">\n <request-info>\n <request-id>001619d2-a297-4a4b-a9f5-e2823c88458f</request-id>\n <action>CREATE_VF_MODULE</action>\n <source>PORTAL</source>\n </request-info>\n <vnf-inputs>\n <vnf-name>test-vscp</vnf-name>\n <vf-module-name>moduleName</vf-module-name>\n <vnf-type>elena_test21</vnf-type>\n <vf-module-model-name>moduleModelName</vf-module-model-name>\n <asdc-service-model-version>1.0</asdc-service-model-version>\n <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>\n <aic-cloud-region>mtn9</aic-cloud-region>\n <tenant-id>381b9ff6c75e4625b7a4182f90fc68d3</tenant-id>\n <persona-model-id></persona-model-id>\n <persona-model-version></persona-model-version>\n <is-base-vf-module>false</is-base-vf-module>\n </vnf-inputs>\n <vnf-params xmlns:tns=\"http://org.onap.so/mso/infra/vnf-request/v1\"/>\n</vnf-request>\n', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
index 192e6d55b6..22e84344f7 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
@@ -79,7 +79,7 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS(
VF_MODULE_NAME VARCHAR SELECTIVITY 8,
VF_MODULE_MODEL_NAME VARCHAR SELECTIVITY 3,
AAI_SERVICE_ID VARCHAR SELECTIVITY 1,
- AIC_CLOUD_REGION VARCHAR SELECTIVITY 1,
+ CLOUD_REGION VARCHAR SELECTIVITY 1,
CALLBACK_URL VARCHAR SELECTIVITY 1,
CORRELATOR VARCHAR SELECTIVITY 1,
NETWORK_ID VARCHAR SELECTIVITY 2,
@@ -102,11 +102,11 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS(
ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1
);
-INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
+INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"vSAMP10aDEV::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"mtn6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'vSAMP10aDEV::base::module-0', null, 'mtn6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_vSAMP10a_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_vSAMP10a_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_vSAMP10a_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarteSet":true,"alaCarte":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_vSAMP10a_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, STRINGDECODE('<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<vnf-request xmlns=\"http://org.onap.so/mso/infra/vnf-request/v1\">\n <request-info>\n <request-id>001619d2-a297-4a4b-a9f5-e2823c88458f</request-id>\n <action>CREATE_VF_MODULE</action>\n <source>PORTAL</source>\n </request-info>\n <vnf-inputs>\n <vnf-name>test-vscp</vnf-name>\n <vf-module-name>moduleName</vf-module-name>\n <vnf-type>elena_test21</vnf-type>\n <vf-module-model-name>moduleModelName</vf-module-model-name>\n <asdc-service-model-version>1.0</asdc-service-model-version>\n <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>\n <aic-cloud-region>mtn9</aic-cloud-region>\n <tenant-id>381b9ff6c75e4625b7a4182f90fc68d3</tenant-id>\n <persona-model-id></persona-model-id>\n <persona-model-version></persona-model-version>\n <is-base-vf-module>false</is-base-vf-module>\n </vnf-inputs>\n <vnf-params xmlns:tns=\"http://org.onap.so/mso/infra/vnf-request/v1\"/>\n</vnf-request>\n'), 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
-INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
+INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-MTN6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-MTN6-3100-0927-1', 'md5621', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":false},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
@@ -151,7 +151,7 @@ CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS(
VF_MODULE_NAME VARCHAR SELECTIVITY 8,
VF_MODULE_MODEL_NAME VARCHAR SELECTIVITY 3,
AAI_SERVICE_ID VARCHAR SELECTIVITY 1,
- AIC_CLOUD_REGION VARCHAR SELECTIVITY 1,
+ CLOUD_REGION VARCHAR SELECTIVITY 1,
CALLBACK_URL VARCHAR SELECTIVITY 1,
CORRELATOR VARCHAR SELECTIVITY 1,
NETWORK_ID VARCHAR SELECTIVITY 2,
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
index 464cacb6b0..73e5e16324 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
@@ -117,7 +117,7 @@ public abstract class InfraRequests implements java.io.Serializable {
private String vfModuleModelName;
@Column(name = "AAI_SERVICE_ID", length = 50)
private String aaiServiceId;
- @Column(name = "AIC_CLOUD_REGION", length = 11)
+ @Column(name = "CLOUD_REGION", length = 11)
private String aicCloudRegion;
@Column(name = "CALLBACK_URL", length = 200)
private String callBackUrl;
@@ -161,7 +161,7 @@ public abstract class InfraRequests implements java.io.Serializable {
private String rollbackExtSystemErrorSource;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
- @JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID")
+ @JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID", updatable = false)
private List<CloudApiRequests> cloudApiRequests = new ArrayList<>();
@ResourceId
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 4d16d9c272..9be92ad93a 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -217,7 +217,7 @@ public class RequestsDbClient {
return restTemplate.exchange(uri, HttpMethod.GET, entity, InfraActiveRequests.class).getBody();
}
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ public InfraActiveRequests checkInstanceNameDuplicate(Map<String, String> instanceIdMap, String instanceName,
String requestScope) {
HttpHeaders headers = getHttpHeaders();
URI uri = getUri(checkInstanceNameDuplicate);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
index 548bc25815..169d2353ec 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
@@ -20,28 +20,28 @@
package org.onap.so.db.request.data.controller;
-import java.util.HashMap;
+import java.util.Map;
public class InstanceNameDuplicateCheckRequest {
- private HashMap<String, String> instanceIdMap;
+ private Map<String, String> instanceIdMap;
private String instanceName;
private String requestScope;
public InstanceNameDuplicateCheckRequest() {}
- public InstanceNameDuplicateCheckRequest(HashMap<String, String> instanceIdMap, String instanceName,
+ public InstanceNameDuplicateCheckRequest(Map<String, String> instanceIdMap, String instanceName,
String requestScope) {
this.instanceIdMap = instanceIdMap;
this.instanceName = instanceName;
this.requestScope = requestScope;
}
- public HashMap<String, String> getInstanceIdMap() {
+ public Map<String, String> getInstanceIdMap() {
return instanceIdMap;
}
- public void setInstanceIdMap(HashMap<String, String> instanceIdMap) {
+ public void setInstanceIdMap(Map<String, String> instanceIdMap) {
this.instanceIdMap = instanceIdMap;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java
index 425e0b8bbc..ac0d09b13b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java
@@ -32,7 +32,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
@IdClass(ControllerSelectionReferenceId.class)
@Entity
-@Table(name = "CONTROLLER_SELECTION_REFERENCE")
+@Table(name = "controller_selection_reference")
public class ControllerSelectionReference implements Serializable {
private static final long serialVersionUID = -608098800737567188L;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java
index 93e2992d3f..9691eff5f5 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java
@@ -22,6 +22,7 @@ package org.onap.so.db.catalog.beans;
public enum OrchestrationStatus {
ACTIVE("Active", "active"),
+ ACTIVATED("Activated", "activated"),
ASSIGNED("Assigned", "assigned"),
CREATED("Created", "created"),
INVENTORIED("Inventoried", "inventoried"),
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java
index c2cf2d7cf6..9ec61ff05f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/UserParameters.java
@@ -17,7 +17,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import com.openpojo.business.annotation.BusinessKey;
@Entity
-@Table(name = "USER_PARAMETERS")
+@Table(name = "user_parameters")
public class UserParameters implements Serializable {
private static final long serialVersionUID = -5036895978102778877L;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
index 36c9251d59..aec1c7fb22 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
@@ -23,9 +23,7 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -34,7 +32,6 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
@@ -124,6 +121,9 @@ public class VnfResourceCustomization implements Serializable {
@Column(name = "VNFCINSTANCEGROUP_ORDER")
private String vnfcInstanceGroupOrder;
+ @Column(name = "NF_DATA_VALID")
+ private Boolean nfDataValid;
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof VnfResourceCustomization)) {
@@ -336,4 +336,14 @@ public class VnfResourceCustomization implements Serializable {
public void setVnfcInstanceGroupOrder(String vnfcInstanceGroupOrder) {
this.vnfcInstanceGroupOrder = vnfcInstanceGroupOrder;
}
+
+ public Boolean getNfDataValid() {
+ return nfDataValid;
+ }
+
+ public void setNfDataValid(Boolean nfDataValid) {
+ this.nfDataValid = nfDataValid;
+ }
+
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
index 1882ad5964..39217c75fa 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
@@ -77,12 +77,16 @@ public class RainyDayHandlerStatus implements Serializable {
@Column(name = "SECONDARY_POLICY")
private String secondaryPolicy;
+ @BusinessKey
+ @Column(name = "SERVICE_ROLE")
+ private String serviceRole;
+
@Override
public String toString() {
return new ToStringBuilder(this).append("id", id).append("flowName", flowName)
.append("serviceType", serviceType).append("vnfType", vnfType).append("errorCode", errorCode)
.append("errorMessage", errorMessage).append("workStep", workStep).append("policy", policy)
- .append("secondaryPolicy", secondaryPolicy).toString();
+ .append("secondaryPolicy", secondaryPolicy).append("serviceRole", serviceRole).toString();
}
@Override
@@ -93,13 +97,14 @@ public class RainyDayHandlerStatus implements Serializable {
RainyDayHandlerStatus castOther = (RainyDayHandlerStatus) other;
return new EqualsBuilder().append(flowName, castOther.flowName).append(serviceType, castOther.serviceType)
.append(vnfType, castOther.vnfType).append(errorCode, castOther.errorCode)
- .append(workStep, castOther.workStep).append(policy, castOther.policy).isEquals();
+ .append(workStep, castOther.workStep).append(policy, castOther.policy)
+ .append(serviceRole, castOther.serviceRole).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(flowName).append(serviceType).append(vnfType).append(errorCode)
- .append(workStep).append(policy).toHashCode();
+ .append(workStep).append(policy).append(serviceRole).toHashCode();
}
public Integer getId() {
@@ -174,5 +179,12 @@ public class RainyDayHandlerStatus implements Serializable {
this.errorMessage = errorMessage;
}
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 30801119b6..23539b074d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -27,7 +27,9 @@ import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.persistence.EntityNotFoundException;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
+import org.apache.http.HttpStatus;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -67,13 +69,18 @@ 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.core.ParameterizedTypeReference;
+import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
+import com.google.common.base.Strings;
import uk.co.blackpepper.bowman.Client;
import uk.co.blackpepper.bowman.ClientFactory;
import uk.co.blackpepper.bowman.Configuration;
@@ -137,6 +144,7 @@ public class CatalogDbClient {
private static final String CLOUD_OWNER = "cloudOwner";
private static final String FLOW_NAME = "flowName";
private static final String ERROR_MESSAGE = "errorMessage";
+ private static final String SERVICE_ROLE = "serviceRole";
private static final String SERVICE_TYPE = "serviceType";
private static final String VNF_TYPE = "vnfType";
private static final String ERROR_CODE = "errorCode";
@@ -638,7 +646,7 @@ public class CatalogDbClient {
}
public RainyDayHandlerStatus getRainyDayHandlerStatus(String flowName, String serviceType, String vnfType,
- String errorCode, String workStep, String errorMessage) {
+ String errorCode, String workStep, String errorMessage, String serviceRole) {
logger.debug(
"Get Rainy Day Status - Flow Name {}, Service Type: {} , vnfType {} , errorCode {}, workStep {}, errorMessage {}",
flowName, serviceType, vnfType, errorCode, workStep, errorMessage);
@@ -646,7 +654,8 @@ public class CatalogDbClient {
UriComponentsBuilder.fromUriString(endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findRainyDayHandler)
.queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
.queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
- .queryParam(ERROR_MESSAGE, errorMessage).build().encode().toUri());
+ .queryParam(ERROR_MESSAGE, errorMessage).queryParam(SERVICE_ROLE, serviceRole).build().encode()
+ .toUri());
}
public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action) {
@@ -856,8 +865,7 @@ public class CatalogDbClient {
protected CvnfcCustomization findCvnfcCustomizationInAList(String cvnfcCustomizationUuid,
List<CvnfcCustomization> cvnfcCustomList) {
if (cvnfcCustomizationUuid == null) {
- throw new EntityNotFoundException(
- "a NULL UUID was provided in query to search for CvnfcCustomization" + cvnfcCustomizationUuid);
+ throw new EntityNotFoundException("a NULL UUID was provided in query to search for CvnfcCustomization");
}
List<CvnfcCustomization> filtered = cvnfcCustomList.stream().filter(c -> c.getModelCustomizationUUID() != null)
.filter(cvnfc -> cvnfcCustomizationUuid.equals(cvnfc.getModelCustomizationUUID()))
@@ -887,6 +895,90 @@ public class CatalogDbClient {
"Unable to find CvnfcConfigurationCustomization ModelCustomizationUUID:" + cvnfcCustomizationUuid);
}
+ public org.onap.so.rest.catalog.beans.Service getServiceModelInformation(String serviceModelUUID, String depth) {
+ if (Strings.isNullOrEmpty(serviceModelUUID)) {
+ throw new EntityNotFoundException("Service Model UUID passed as Null or Empty String");
+ }
+ try {
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate.exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/ecomp/mso/catalog/v1/services/" + serviceModelUUID)
+ .queryParam("depth", depth).build().encode().toString(),
+ HttpMethod.GET, entity, org.onap.so.rest.catalog.beans.Service.class).getBody();
+ } catch (HttpClientErrorException e) {
+ logger.warn("Entity Not found in DLP", e);
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find Service with ServiceModelUUID:" + serviceModelUUID);
+ }
+ throw e;
+ }
+ }
+
+ public List<org.onap.so.rest.catalog.beans.Service> getServices() {
+ try {
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate
+ .exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/ecomp/mso/catalog/v1/services").build()
+ .encode().toString(),
+ HttpMethod.GET, entity,
+ new ParameterizedTypeReference<List<org.onap.so.rest.catalog.beans.Service>>() {})
+ .getBody();
+ } catch (HttpClientErrorException e) {
+ logger.error("Error Calling catalog database", e);
+ throw e;
+ }
+ }
+
+ public org.onap.so.rest.catalog.beans.Vnf getVnfModelInformation(String serviceModelUUID,
+ String vnfCustomizationUUID, String depth) {
+ if (Strings.isNullOrEmpty(serviceModelUUID)) {
+ throw new EntityNotFoundException("Service Model UUID passed as Null or Empty String");
+ }
+ if (Strings.isNullOrEmpty(vnfCustomizationUUID)) {
+ throw new EntityNotFoundException("Vnf Customization UUID passed as Null or Empty String");
+ }
+ try {
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate
+ .exchange(
+ UriComponentsBuilder
+ .fromUriString(endpoint + "/ecomp/mso/catalog/v1/services/" + serviceModelUUID
+ + "/vnfs/" + vnfCustomizationUUID)
+ .queryParam("depth", depth).build().encode().toString(),
+ HttpMethod.GET, entity, org.onap.so.rest.catalog.beans.Vnf.class)
+ .getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException(
+ "Unable to find Vnf with Vnf Customization UUID:" + vnfCustomizationUUID);
+ }
+ throw e;
+ }
+ }
+
+ public void updateVnf(String serviceModelUUID, org.onap.so.rest.catalog.beans.Vnf vnf) {
+ if (vnf == null) {
+ throw new EntityNotFoundException("Vnf passed as null");
+ }
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<org.onap.so.rest.catalog.beans.Vnf> entity = new HttpEntity<>(vnf, headers);
+
+ restTemplate.exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/ecomp/mso/catalog/v1/services/" + serviceModelUUID
+ + "/vnfs/" + vnf.getModelCustomizationId()).build().encode().toString(),
+ HttpMethod.PUT, entity, org.onap.so.rest.catalog.beans.Vnf.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException(
+ "Unable to find Vnf with Vnf Customization UUID:" + vnf.getModelCustomizationId());
+ }
+ throw e;
+ }
+ }
+
+
public Workflow findWorkflowByArtifactUUID(String artifactUUID) {
return this.getSingleResource(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByArtifactUUID)
.queryParam(ARTIFACT_UUID, artifactUUID).build().toString()));
@@ -909,4 +1001,18 @@ public class CatalogDbClient {
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
+
+ private HttpHeaders getHttpHeaders() {
+ HttpHeaders headers = new HttpHeaders();
+ headers.set(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
+ headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
+ headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
+ headers.set(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ return headers;
+ }
+
+ private HttpEntity<?> getHttpEntity() {
+ HttpHeaders headers = getHttpHeaders();
+ return new HttpEntity<>(headers);
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
index 6819657b78..efe078bbfc 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
@@ -32,10 +32,11 @@ public interface RainyDayHandlerStatusRepository extends JpaRepository<RainyDayH
@Query(value = "SELECT * FROM rainy_day_handler_macro WHERE (FLOW_NAME = :flowName ) AND SERVICE_TYPE IN (:serviceType ,'*') "
+ " AND VNF_TYPE IN ( :vnfType , '*') AND ERROR_CODE IN (:errorCode ,'*') AND WORK_STEP IN (:workStep , '*' ) "
+ " AND ( :errorMessage REGEXP rainy_day_handler_macro.REG_EX_ERROR_MESSAGE OR REG_EX_ERROR_MESSAGE = '*') "
- + " ORDER BY CASE WHEN :errorMessage REGEXP REG_EX_ERROR_MESSAGE THEN 0 WHEN ERROR_CODE != '*' THEN 1 WHEN VNF_TYPE != '*' THEN 2 WHEN SERVICE_TYPE != '*' THEN 3 ELSE 4 END LIMIT 1;",
+ + " AND SERVICE_ROLE IN ( :serviceRole , '*') "
+ + " ORDER BY CASE WHEN :errorMessage REGEXP REG_EX_ERROR_MESSAGE THEN 0 WHEN ERROR_CODE != '*' THEN 1 WHEN VNF_TYPE != '*' THEN 2 WHEN SERVICE_TYPE != '*' THEN 3 WHEN SERVICE_ROLE != '*' THEN 4 ELSE 5 END LIMIT 1;",
nativeQuery = true)
RainyDayHandlerStatus findRainyDayHandler(@Param("flowName") String flowName,
@Param("serviceType") String serviceType, @Param("vnfType") String vnfType,
@Param("errorCode") String errorCode, @Param("workStep") String workStep,
- @Param("errorMessage") String errorMessage);
+ @Param("errorMessage") String errorMessage, @Param("serviceRole") String serviceRole);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java
new file mode 100644
index 0000000000..e22f366ddf
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java
@@ -0,0 +1,136 @@
+/*-
+ * ============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.rest.catalog.beans;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class Cvnfc {
+
+ private String modelCustomizationId;
+ private String modelInstanceName;
+ private String modelVersionId;
+ private String modelInvariantId;
+ private String modelVersion;
+ private String modelName;
+ private String description;
+ private String nfcFunction;
+ private String nfcNamingCode;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ private Date created;
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getNfcFunction() {
+ return nfcFunction;
+ }
+
+ public void setNfcFunction(String nfcFunction) {
+ this.nfcFunction = nfcFunction;
+ }
+
+ public String getNfcNamingCode() {
+ return nfcNamingCode;
+ }
+
+ public void setNfcNamingCode(String nfcNamingCode) {
+ this.nfcNamingCode = nfcNamingCode;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelCustomizationId", modelCustomizationId)
+ .append("modelInstanceName", modelInstanceName).append("modelVersionId", modelVersionId)
+ .append("modelInvariantId", modelInvariantId).append("modelVersion", modelVersion)
+ .append("modelName", modelName).append("description", description).append("nfcFunction", nfcFunction)
+ .append("nfcNamingCode", nfcNamingCode).append("created", created).toString();
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java
index 1620058e1e..11089046fd 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java
@@ -24,6 +24,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -40,6 +41,7 @@ public class Service implements Serializable {
private String modelInvariantId;
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
private Date created;
private String modelVersion;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java
index 8e18f94faf..f2a2c77aca 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java
@@ -20,9 +20,11 @@
package org.onap.so.rest.catalog.beans;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.onap.so.db.catalog.beans.HeatEnvironment;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -37,6 +39,7 @@ public class VfModule {
private String description;
private Boolean isBase;
private HeatTemplate heatTemplate;
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
private Date created;
private List<HeatFile> heatFile;
@@ -50,9 +53,7 @@ public class VfModule {
private HeatEnvironment heatEnv;
private Boolean isVolumeGroup;
-
- // Add in cvnfcCustomization
-
+ private List<Cvnfc> vnfc = new ArrayList<>();
public String getModelName() {
@@ -191,6 +192,12 @@ public class VfModule {
this.isVolumeGroup = isVolumeGroup;
}
+ public List<Cvnfc> getVnfc() {
+ return vnfc;
+ }
+ public void setVnfc(List<Cvnfc> vnfc) {
+ this.vnfc = vnfc;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java
index 40d701c3c5..febf69baf1 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java
@@ -47,12 +47,14 @@ public class Vnf implements Serializable {
private String nfFunction;
private String nfRole;
private String nfNamingCode;
+ private String nfType;
private String multiStageDesign;
private String orchestrationMode;
private String cloudVersionMin;
private String cloudVersionMax;
private String category;
private String subCategory;
+ private Boolean nfDataValid;
private List<VfModule> vfModule = new ArrayList<>();
public List<VfModule> getVfModule() {
@@ -215,4 +217,21 @@ public class Vnf implements Serializable {
public void setMultiStageDesign(String multiStepDesign) {
this.multiStageDesign = multiStepDesign;
}
+
+ public String getNfType() {
+ return nfType;
+ }
+
+ public void setNfType(String nfType) {
+ this.nfType = nfType;
+ }
+
+ public Boolean getNfDataValid() {
+ return nfDataValid;
+ }
+
+ public void setNfDataValid(Boolean nfDataValid) {
+ this.nfDataValid = nfDataValid;
+ }
+
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
index 612963d35b..8bf47e71d3 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
@@ -37,6 +37,7 @@ public class VnfcCustomizationRepositoryTest extends BaseTest {
private VnfcCustomizationRepository vnfcCustomizationRepository;
@Test
+ @Transactional
public void findAllTest() throws Exception {
List<VnfcCustomization> vnfcCustomizationList = vnfcCustomizationRepository.findAll();
Assert.assertFalse(CollectionUtils.isEmpty(vnfcCustomizationList));
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 7cd13a3780..7468f62ecb 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -1109,6 +1109,7 @@ CREATE TABLE `vnf_resource_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
`VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
index 89482fdcda..e1de3317e7 100644
--- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
+++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
@@ -1,12 +1,12 @@
-<!-- ============LICENSE_START=======================================================
- ECOMP MSO ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License. You may obtain a copy
- of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
+<!-- ============LICENSE_START=======================================================
+ ECOMP MSO ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ use this file except in compliance with the License. You may obtain a copy
+ of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. ============LICENSE_END========================================================= -->
<configuration scan="true" debug="false">
@@ -23,11 +23,11 @@
<property name="metricsLogName" value="metrics" />
<property name="auditLogName" value="audit" />
<property name="debugLogName" value="debug" />
-
+
<property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
<property name="errorPattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" />
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-500}|%X{ErrorDesc}|%msg%n" />
<property name="debugPattern"
value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}| %logger{50} - %msg%n" />
@@ -52,7 +52,7 @@
<appender name="Audit"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>EXIT</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
@@ -80,7 +80,7 @@
<appender name="Metric"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>INVOKE_RETURN</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
diff --git a/version.properties b/version.properties
index 99af34261b..f78f30b18d 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=1
minor=5
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}
diff --git a/vnfm-simulator/vnfm-service/pom.xml b/vnfm-simulator/vnfm-service/pom.xml
index 7beccb6561..1e3244bae4 100644
--- a/vnfm-simulator/vnfm-service/pom.xml
+++ b/vnfm-simulator/vnfm-service/pom.xml
@@ -44,6 +44,11 @@
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>org.springframework.security.oauth</groupId>
+ <artifactId>spring-security-oauth2</artifactId>
+ <version>2.3.6.RELEASE</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
index 32c05ebca8..a1abb05f07 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
@@ -1,6 +1,5 @@
package org.onap.svnfm.simulator.config;
-import java.net.InetAddress;
import java.util.Arrays;
import org.onap.svnfm.simulator.constants.Constant;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +22,9 @@ public class ApplicationConfig implements ApplicationRunner {
@Value("${server.dns.name:so-vnfm-simulator.onap}")
private String serverDnsName;
+ @Value("${server.request.grant.auth:oauth}")
+ private String grantAuth;
+
@Autowired
private Environment environment;
@@ -37,6 +39,10 @@ public class ApplicationConfig implements ApplicationRunner {
return baseUrl;
}
+ public String getGrantAuth() {
+ return grantAuth;
+ }
+
@Bean
public CacheManager cacheManager() {
final Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE);
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java
index d3ff66aed0..2140b57488 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java
@@ -26,7 +26,6 @@ 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.svnfm.simulator.constants.Constant;
import org.onap.svnfm.simulator.repository.VnfmCacheRepository;
@@ -101,13 +100,12 @@ public class SvnfmController {
* @throws InterruptedException
*/
@PostMapping(value = "/vnf_instances/{vnfInstanceId}/instantiate")
- public ResponseEntity<Void> instantiateVnf(@PathVariable("vnfInstanceId") final String vnfId,
- @RequestBody final InstantiateVnfRequest instantiateVNFRequest) {
- LOGGER.info("Start instantiateVNFRequest {} ", instantiateVNFRequest);
+ public ResponseEntity<Void> instantiateVnf(@PathVariable("vnfInstanceId") final String vnfId) {
+ LOGGER.info("Start instantiateVNFRequest for vnf id {} ", vnfId);
final HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
- headers.add(HttpHeaders.LOCATION, svnfmService.instantiateVnf(vnfId, instantiateVNFRequest));
+ headers.add(HttpHeaders.LOCATION, svnfmService.instantiateVnf(vnfId));
return new ResponseEntity<>(headers, HttpStatus.ACCEPTED);
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java
new file mode 100644
index 0000000000..5d2c310635
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java
@@ -0,0 +1,28 @@
+package org.onap.svnfm.simulator.oauth;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
+
+@Configuration
+@EnableAuthorizationServer
+@Profile("oauth-authentication")
+/**
+ * Configures the authorization server for oauth token based authentication when the spring profile
+ * "oauth-authentication" is active
+ */
+public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
+
+ private static final int ONE_DAY = 60 * 60 * 24;
+
+ @Override
+ public void configure(final ClientDetailsServiceConfigurer clients) throws Exception {
+ clients.inMemory().withClient("vnfmadapter")
+ .secret("$2a$10$dHzTlqSBcm8hdO52LBvnX./zNTvUzzJy.lZrc4bCBL5gkln0wX6T6")
+ .authorizedGrantTypes("client_credentials").scopes("write").accessTokenValiditySeconds(ONE_DAY)
+ .refreshTokenValiditySeconds(ONE_DAY);
+ }
+
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java
new file mode 100644
index 0000000000..d6eda28eb6
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.svnfm.simulator.oauth;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.util.ArrayList;
+import java.util.Collection;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.GsonHttpMessageConverter;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+/**
+ * Configures message converter
+ */
+@Configuration
+public class JsonSerializerConfiguration {
+
+ @Bean
+ public HttpMessageConverters customConverters() {
+ final Collection<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
+
+ final Gson gson = new GsonBuilder()
+ .registerTypeHierarchyAdapter(OAuth2AccessToken.class, new OAuth2AccessTokenAdapter()).create();
+ final GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter(gson);
+ messageConverters.add(gsonHttpMessageConverter);
+ return new HttpMessageConverters(true, messageConverters);
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java
new file mode 100644
index 0000000000..7bccffa2e0
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java
@@ -0,0 +1,31 @@
+package org.onap.svnfm.simulator.oauth;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import java.lang.reflect.Type;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+public class OAuth2AccessTokenAdapter implements JsonSerializer<OAuth2AccessToken> {
+
+ @Override
+ public JsonElement serialize(final OAuth2AccessToken src, final Type typeOfSrc,
+ final JsonSerializationContext context) {
+ final JsonObject obj = new JsonObject();
+ obj.addProperty(OAuth2AccessToken.ACCESS_TOKEN, src.getValue());
+ obj.addProperty(OAuth2AccessToken.TOKEN_TYPE, src.getTokenType());
+ if (src.getRefreshToken() != null) {
+ obj.addProperty(OAuth2AccessToken.REFRESH_TOKEN, src.getRefreshToken().getValue());
+ }
+ obj.addProperty(OAuth2AccessToken.EXPIRES_IN, src.getExpiresIn());
+ final JsonArray scopeObj = new JsonArray();
+ for (final String scope : src.getScope()) {
+ scopeObj.add(scope);
+ }
+ obj.add(OAuth2AccessToken.SCOPE, scopeObj);
+
+ return obj;
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java
new file mode 100644
index 0000000000..18fb1a9461
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.svnfm.simulator.oauth;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+
+@Configuration
+@EnableResourceServer
+@Profile("oauth-authentication")
+/**
+ * Enforces oauth token based authentication when the spring profile "oauth-authentication" is active
+ */
+public class OAuth2ResourceServer extends ResourceServerConfigurerAdapter {
+
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
index 83f079c376..6e9478bdeb 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
@@ -1,11 +1,24 @@
package org.onap.svnfm.simulator.services;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
import javax.ws.rs.core.MediaType;
import org.apache.commons.codec.binary.Base64;
import org.modelmapper.ModelMapper;
@@ -30,6 +43,7 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperatio
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsOauth2ClientCredentials;
import org.onap.svnfm.simulator.config.ApplicationConfig;
import org.onap.svnfm.simulator.model.VnfOperation;
import org.onap.svnfm.simulator.model.Vnfds;
@@ -37,12 +51,16 @@ import org.onap.svnfm.simulator.repository.VnfOperationRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
public abstract class OperationProgressor implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(OperationProgressor.class);
private static final String CERTIFICATE_TO_TRUST = "so-vnfm-adapter.crt.pem";
+ private Resource keyStoreResource = new ClassPathResource("so-vnfm-simulator.p12");
+ private String keyStorePassword = "7Em3&j4.19xYiMelhD5?xbQ.";
+
protected final VnfOperation operation;
protected final SvnfmService svnfmService;
private final VnfOperationRepository vnfOperationRepository;
@@ -66,12 +84,14 @@ public abstract class OperationProgressor implements Runnable {
String callBackUrl = subscriptionService.getSubscriptions().iterator().next().getCallbackUri();
callBackUrl = callBackUrl.substring(0, callBackUrl.indexOf("/lcn/"));
apiClient.setBasePath(callBackUrl);
+ apiClient.setKeyManagers(getKeyManagers());
apiClient.setSslCaCert(getCertificateToTrust());
notificationClient = new DefaultApi(apiClient);
final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient grantApiClient =
new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient();
grantApiClient.setBasePath(callBackUrl);
+ grantApiClient.setKeyManagers(getKeyManagers());
grantApiClient.setSslCaCert(getCertificateToTrust());
grantClient = new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api.DefaultApi(grantApiClient);
}
@@ -85,6 +105,22 @@ public abstract class OperationProgressor implements Runnable {
}
}
+ private KeyManager[] getKeyManagers() {
+ KeyStore keystore;
+ try {
+ keystore = KeyStore.getInstance("pkcs12");
+ keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
+ KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
+ keyManagerFactory.init(keystore, keyStorePassword.toCharArray());
+ return keyManagerFactory.getKeyManagers();
+ } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException
+ | UnrecoverableKeyException exception) {
+ LOGGER.error("Error reading certificate, https calls using two way TLS to VNFM adapter will fail",
+ exception);
+ return new KeyManager[0];
+ }
+ }
+
@Override
public void run() {
try {
@@ -187,7 +223,8 @@ public abstract class OperationProgressor implements Runnable {
final String auth =
subscriptionAuthentication.getUserName() + ":" + subscriptionAuthentication.getPassword();
final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
- final String authHeader = "Basic " + new String(encodedAuth);
+ String authHeader = "Basic " + new String(encodedAuth);
+
notificationClient.lcnVnfLcmOperationOccurrenceNotificationPostWithHttpInfo(notification,
MediaType.APPLICATION_JSON, authHeader);
} catch (final ApiException exception) {
@@ -235,8 +272,17 @@ public abstract class OperationProgressor implements Runnable {
private InlineResponse201 sendGrantRequest(final GrantRequest grantRequest) {
LOGGER.info("Sending grant request: {}", grantRequest);
try {
+
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials subscriptionAuthentication =
+ subscriptionService.getSubscriptions().iterator().next().getAuthentication()
+ .getParamsOauth2ClientCredentials();
+
+ final String authHeader = applicationConfig.getGrantAuth().equals("oauth")
+ ? "Bearer " + getToken(notificationClient.getApiClient(), subscriptionAuthentication)
+ : null;
+
final ApiResponse<InlineResponse201> response = grantClient.grantsPostWithHttpInfo(grantRequest,
- MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, "Basic dm5mbTpwYXNzd29yZDEk");
+ MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, authHeader);
LOGGER.info("Grant Response: {}", response);
return response.getData();
} catch (final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiException exception) {
@@ -257,4 +303,46 @@ public abstract class OperationProgressor implements Runnable {
return applicationConfig.getBaseUrl() + "/vnflcm/v1";
}
+ private String getToken(final ApiClient apiClient,
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthClientCredentials) {
+ final String basePath = apiClient.getBasePath().substring(0, apiClient.getBasePath().indexOf("/so/"));
+ final String tokenUrl = basePath + "/oauth/token?grant_type=client_credentials";
+
+ try {
+ URL url = new URL(tokenUrl);
+ HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
+ connection.setRequestMethod("POST");
+ final String authorizationHeader = getAuthorizationHeader(oauthClientCredentials);
+ connection.addRequestProperty("Authorization", authorizationHeader);
+
+ connection.connect();
+
+ return getResponse(connection).get("access_token").getAsString();
+
+ } catch (IOException exception) {
+ LOGGER.error("Error getting token", exception);
+ return null;
+ }
+ }
+
+ private String getAuthorizationHeader(
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthClientCredentials) {
+ final String auth = oauthClientCredentials.getClientId() + ":" + oauthClientCredentials.getClientPassword();
+ final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8));
+ return "Basic " + new String(encodedAuth);
+ }
+
+ private JsonObject getResponse(HttpsURLConnection connection) throws IOException {
+ BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ String line, data = "";
+ while ((line = in.readLine()) != null) {
+ data += line;
+ }
+ in.close();
+ connection.getInputStream().close();
+
+ JsonObject jsonObject = new JsonParser().parse(data).getAsJsonObject();
+ return jsonObject;
+ }
+
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java
index 21bb00dba7..95043d35ed 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java
@@ -32,7 +32,6 @@ 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.InlineResponse201InstantiatedVnfInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.svnfm.simulator.config.ApplicationConfig;
import org.onap.svnfm.simulator.constants.Constant;
@@ -60,36 +59,31 @@ import org.springframework.stereotype.Service;
@Service
public class SvnfmService {
- @Autowired
- VnfmRepository vnfmRepository;
-
- @Autowired
- VnfOperationRepository vnfOperationRepository;
-
- @Autowired
+ private VnfmRepository vnfmRepository;
+ private VnfOperationRepository vnfOperationRepository;
private VnfmHelper vnfmHelper;
-
- @Autowired
- ApplicationConfig applicationConfig;
-
- @Autowired
- CacheManager cacheManager;
-
- @Autowired
- Vnfds vnfds;
-
- @Autowired
- SubscriptionService subscriptionService;
+ private ApplicationConfig applicationConfig;
+ private CacheManager cacheManager;
+ private Vnfds vnfds;
+ private SubscriptionService subscriptionService;
private final ExecutorService executor = Executors.newCachedThreadPool();
private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmService.class);
- /**
- *
- * @param createVNFRequest
- * @return inlineResponse201
- */
+ @Autowired
+ public SvnfmService(VnfmRepository vnfmRepository, VnfOperationRepository vnfOperationRepository,
+ VnfmHelper vnfmHelper, ApplicationConfig applicationConfig, CacheManager cacheManager, Vnfds vnfds,
+ SubscriptionService subscriptionService) {
+ this.vnfmRepository = vnfmRepository;
+ this.vnfOperationRepository = vnfOperationRepository;
+ this.vnfmHelper = vnfmHelper;
+ this.applicationConfig = applicationConfig;
+ this.cacheManager = cacheManager;
+ this.vnfds = vnfds;
+ this.subscriptionService = subscriptionService;
+ }
+
public InlineResponse201 createVnf(final CreateVnfRequest createVNFRequest, final String id) {
InlineResponse201 inlineResponse201 = null;
try {
@@ -106,24 +100,16 @@ public class SvnfmService {
}
@CachePut(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id")
- public InlineResponse201 updateVnf(final InstantiationStateEnum instantiationState,
+ public void updateVnf(final InstantiationStateEnum instantiationState,
final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo, final String id,
final List<InlineResponse201VimConnectionInfo> vimConnectionInfo) {
final InlineResponse201 vnf = getVnf(id);
vnf.setInstantiatedVnfInfo(instantiatedVnfInfo);
vnf.setInstantiationState(instantiationState);
vnf.setVimConnectionInfo(vimConnectionInfo);
- return vnf;
}
- /**
- *
- * @param vnfId
- * @param instantiateVNFRequest
- * @param operationId
- * @throws InterruptedException
- */
- public String instantiateVnf(final String vnfId, final InstantiateVnfRequest instantiateVNFRequest) {
+ public String instantiateVnf(final String vnfId) {
final VnfOperation vnfOperation = buildVnfOperation(InlineResponse200.OperationEnum.INSTANTIATE, vnfId);
vnfOperationRepository.save(vnfOperation);
executor.submit(new InstantiateOperationProgressor(vnfOperation, this, vnfOperationRepository,
@@ -131,13 +117,7 @@ public class SvnfmService {
return vnfOperation.getId();
}
- /**
- * vnfOperationRepository
- *
- * @param vnfId
- * @param instantiateOperationId
- */
- public VnfOperation buildVnfOperation(final InlineResponse200.OperationEnum operation, final String vnfId) {
+ private VnfOperation buildVnfOperation(final InlineResponse200.OperationEnum operation, final String vnfId) {
final VnfOperation vnfOperation = new VnfOperation();
vnfOperation.setId(UUID.randomUUID().toString());
vnfOperation.setOperation(operation);
@@ -146,11 +126,6 @@ public class SvnfmService {
return vnfOperation;
}
- /**
- *
- * @param operationId
- * @throws InterruptedException
- */
public InlineResponse200 getOperationStatus(final String operationId) {
LOGGER.info("Getting operation status with id: {}", operationId);
final Thread instantiationNotification = new Thread(new VnfInstantiationNotification());
@@ -165,14 +140,13 @@ public class SvnfmService {
return null;
}
- /**
- *
- * @param vnfId
- * @return inlineResponse201
- */
public InlineResponse201 getVnf(final String vnfId) {
final Cache ca = cacheManager.getCache(Constant.IN_LINE_RESPONSE_201_CACHE);
+ if (ca == null)
+ return null;
final SimpleValueWrapper wrapper = (SimpleValueWrapper) ca.get(vnfId);
+ if (wrapper == null)
+ return null;
final InlineResponse201 inlineResponse201 = (InlineResponse201) wrapper.get();
if (inlineResponse201 != null) {
LOGGER.info("Cache Read Successful");
@@ -181,10 +155,6 @@ public class SvnfmService {
return null;
}
- /**
- * @param vnfId
- * @return
- */
public String terminateVnf(final String vnfId) {
final VnfOperation vnfOperation = buildVnfOperation(InlineResponse200.OperationEnum.TERMINATE, vnfId);
vnfOperationRepository.save(vnfOperation);
diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java
new file mode 100644
index 0000000000..ed77775421
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.svnfm.simulator.services;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.svnfm.simulator.config.ApplicationConfig;
+import org.onap.svnfm.simulator.constants.Constant;
+import org.onap.svnfm.simulator.model.Vnfds;
+import org.onap.svnfm.simulator.repository.VnfOperationRepository;
+import org.onap.svnfm.simulator.repository.VnfmRepository;
+import org.springframework.cache.Cache;
+import org.springframework.cache.CacheManager;
+import org.springframework.cache.support.SimpleValueWrapper;
+
+public class SvnfmServiceTest {
+
+ private SvnfmService testedObject;
+ private CacheManager cacheManagerMock;
+
+ @Before
+ public void setup() {
+ VnfmRepository vnfmRepositoryMock = mock(VnfmRepository.class);
+ VnfOperationRepository vnfOperationRepositoryMock = mock(VnfOperationRepository.class);
+ VnfmHelper vnfmHelperMock = mock(VnfmHelper.class);
+ ApplicationConfig applicationConfigMock = mock(ApplicationConfig.class);
+ cacheManagerMock = mock(CacheManager.class);
+ Vnfds vnfdsMock = mock(Vnfds.class);
+ SubscriptionService subscriptionServiceMock = mock(SubscriptionService.class);
+
+ testedObject = new SvnfmService(vnfmRepositoryMock, vnfOperationRepositoryMock, vnfmHelperMock,
+ applicationConfigMock, cacheManagerMock, vnfdsMock, subscriptionServiceMock);
+ }
+
+ @Test
+ public void getVnfSuccessful() {
+ // given
+ String vnfId = "vnfId";
+ String vnfInstanceName = "testVnf";
+ Cache cacheMock = mock(Cache.class);
+ SimpleValueWrapper simpleValueWrapperMock = mock(SimpleValueWrapper.class);
+ when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(cacheMock);
+ when(cacheMock.get(vnfId)).thenReturn(simpleValueWrapperMock);
+ when(simpleValueWrapperMock.get()).thenReturn(prepareInlineResponse(vnfId, vnfInstanceName));
+ // when
+ InlineResponse201 result = testedObject.getVnf(vnfId);
+ // then
+ assertThat(result.getVnfdId()).isEqualTo(vnfId);
+ assertThat(result.getVnfInstanceName()).isEqualTo(vnfInstanceName);
+ }
+
+ @Test
+ public void getVnf_ifCacheNullThenReturnNull() {
+ // given
+ when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(null);
+ // then
+ assertThat(testedObject.getVnf("any")).isNull();
+ }
+
+ @Test
+ public void getVnf_ifWrapperNullThenReturnNull() {
+ // given
+ String vnfId = "vnfId";
+ Cache cacheMock = mock(Cache.class);
+ when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(cacheMock);
+ when(cacheMock.get(vnfId)).thenReturn(null);
+ // then
+ assertThat(testedObject.getVnf(vnfId)).isNull();
+ }
+
+ @Test
+ public void getVnf_ifResultIsNullThenReturnNull() {
+ // when
+ String vnfId = "vnfId";
+ Cache cacheMock = mock(Cache.class);
+ SimpleValueWrapper simpleValueWrapperMock = mock(SimpleValueWrapper.class);
+ when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(cacheMock);
+ when(cacheMock.get(vnfId)).thenReturn(simpleValueWrapperMock);
+ when(simpleValueWrapperMock.get()).thenReturn(null);
+ // then
+ assertThat(testedObject.getVnf(vnfId)).isNull();
+ }
+
+ private InlineResponse201 prepareInlineResponse(String vnfId, String vnfInstanceName) {
+ InlineResponse201 response201 = new InlineResponse201();
+ response201.setVnfdId(vnfId);
+ response201.vnfInstanceName(vnfInstanceName);
+ return response201;
+ }
+}