aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java74
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java25
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java26
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java114
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java17
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java24
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java94
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java79
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java65
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/beans/DeploymentInfoBuilderTest.java6
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java11
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java8
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java17
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java34
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java24
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java9
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java9
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java9
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java15
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java15
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java13
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java14
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java16
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java25
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml3
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql32
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql23
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql175
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java30
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java91
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java13
-rw-r--r--adapters/mso-openstack-adapters/pom.xml52
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java44
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java7
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java44
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java149
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java119
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java25
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java21
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java23
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java34
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java7
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java16
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java76
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java356
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java132
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java166
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java31
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java23
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java23
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java128
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java365
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java76
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java41
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java77
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java275
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java120
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java69
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java69
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java37
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java37
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java27
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java74
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java61
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java40
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java6
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java13
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java48
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java28
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java6
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java16
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java15
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java375
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/GetResources.json407
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/stack-resources.json441
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java6
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.4__Add_Vnf_Operational_Env_Id_column.sql3
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java1
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java1
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql12
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java1
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java8
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java8
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java41
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java8
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java14
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java7
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java4
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java8
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java6
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml1
-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/rest/VnfmAdapterController.java89
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java90
-rw-r--r--asdc-controller/pom.xml529
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java1074
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java4
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java4
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/PnfResourceStructure.java50
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java152
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceType.java41
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java47
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java3
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java337
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java10
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java4327
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java59
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java442
-rw-r--r--asdc-controller/src/test/resources/ASDC/.gitignore2
-rw-r--r--asdc-controller/src/test/resources/application-test.yaml4
-rw-r--r--asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csarbin0 -> 35636 bytes
-rw-r--r--asdc-controller/src/test/resources/download/service-Testservice140-csar.csarbin0 -> 35457 bytes
-rw-r--r--asdc-controller/src/test/resources/schema.sql42
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy180
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy39
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy23
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy16
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy177
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy27
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy17
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy16
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy15
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy163
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java192
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java89
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java112
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java112
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java45
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java88
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java87
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java207
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java156
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java148
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java141
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java36
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java23
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java167
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java153
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java149
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java158
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java151
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java152
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java22
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java70
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java70
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java68
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java48
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java51
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java50
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java49
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java41
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java42
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java61
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java36
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java28
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java3
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java9
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java7
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java40
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java8
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckClosedLoopDisabledFlagActivity.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckInMaintFlagActivity.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckPserversLockedFlagActivity.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetClosedLoopDisabledFlagActivity.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AbstractCDSProcessingBB.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn98
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigDeployVnfBB.bpmn116
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn3
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java14
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java55
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java56
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java55
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java55
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java54
-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/CreateNetworkInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy18
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy18
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy51
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy18
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy38
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy42
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy31
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy28
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml312
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java45
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java108
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java45
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java162
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java56
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java89
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java58
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java75
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java81
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProvider.java)14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java161
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java (renamed from bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java)32
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java91
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java113
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java130
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java52
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java89
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java18
-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/AAIDeleteTasksTest.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java125
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java250
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java167
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java181
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java)47
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java78
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java31
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponse.json127
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json47
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json39
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json34
-rw-r--r--common/pom.xml4
-rw-r--r--common/src/main/java/org/onap/so/client/RestTemplateConfig.java36
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java1
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java5
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java11
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java2
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java10
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java2
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProperties.java17
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/BasicHttpHeadersProvider.java54
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpClientConnectionConfiguration.java)34
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/RestTemplateConfiguration.java)30
-rw-r--r--common/src/main/java/org/onap/so/configuration/rest/HttpHeadersProvider.java35
-rw-r--r--common/src/main/java/org/onap/so/logger/ErrorCode.java16
-rw-r--r--common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java13
-rw-r--r--common/src/main/java/org/onap/so/logger/MdcConstants.java13
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoLogger.java1092
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java3
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java2
-rw-r--r--common/src/main/java/org/onap/so/rest/exceptions/InvalidRestRequestException.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/InvalidRestRequestException.java)13
-rw-r--r--common/src/main/java/org/onap/so/rest/exceptions/RestProcessingException.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/RestProcessingException.java)12
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java72
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java (renamed from so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProviderImpl.java)125
-rw-r--r--common/src/main/java/org/onap/so/utils/CryptoUtils.java6
-rw-r--r--common/src/main/java/org/onap/so/utils/XmlMarshaller.java10
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java28
-rw-r--r--common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java8
-rw-r--r--common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java2
-rw-r--r--common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java21
-rw-r--r--common/src/test/java/org/onap/so/configuration/rest/BasicHttpHeadersProviderTest.java58
-rw-r--r--common/src/test/java/org/onap/so/configuration/rest/HttpComponentsClientConfigurationTest.java45
-rw-r--r--common/src/test/java/org/onap/so/rest/service/HttpRestServiceProviderImplTest.java252
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java16
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java18
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java62
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java50
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json27
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql149
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java3
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql1
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java15
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java6
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java1
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java5
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java5
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java32
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java15
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java12
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java2
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java4
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java3
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java133
-rw-r--r--mso-catalog-db/src/test/resources/data.sql8
-rw-r--r--mso-catalog-db/src/test/resources/logback-test.xml7
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql114
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image2
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java49
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java28
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java4
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java37
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java2
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java12
-rw-r--r--so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java19
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java41
-rw-r--r--so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java61
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts356
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html16
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts256
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.spec.ts78
529 files changed, 17292 insertions, 9756 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
index 2e12869c95..3b945ae484 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
@@ -44,7 +44,9 @@ public final class DeploymentInfoBuilder {
}
public DeploymentInfoBuilder withDeploymentOutputs(Map<String, Object> deploymentOutputs) {
- this.deploymentOutputs = deploymentOutputs;
+ if (deploymentOutputs != null) {
+ this.deploymentOutputs = deploymentOutputs;
+ }
return this;
}
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 97e1627fd3..6b16194471 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -85,8 +85,8 @@ import org.onap.so.config.beans.PoConfig;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.db.catalog.beans.HeatTemplateParam;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
@@ -104,7 +104,6 @@ import org.springframework.stereotype.Component;
@Component
public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
- private static final String CLOUDIFY_ERROR = "CloudifyError";
private static final String CLOUDIFY = "Cloudify";
private static final String CREATE_DEPLOYMENT = "CreateDeployment";
private static final String DELETE_DEPLOYMENT = "DeleteDeployment";
@@ -258,11 +257,10 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
if (installWorkflow.getStatus().equals(TERMINATED)) {
// Success!
// Create and return a DeploymentInfo structure. Include the Runtime outputs
- DeploymentOutputs outputs = getDeploymentOutputs (cloudify, deploymentId);
return new DeploymentInfoBuilder()
.withId(deployment.getId())
.withDeploymentInputs(deployment.getInputs())
- .withDeploymentOutputs(outputs.getOutputs())
+ .withDeploymentOutputs(getDeploymentOutputs(cloudify, deploymentId).get())
.fromExecution(installWorkflow)
.build();
}
@@ -271,7 +269,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
if (!backout)
{
logger.warn("{} Deployment installation failed, backout deletion suppressed {} {}",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(),
"Exception in Deployment Installation, backout suppressed");
}
else {
@@ -293,14 +291,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
// Didn't uninstall successfully. Log this error
logger.error("{} Create Deployment: Cloudify error rolling back deployment install: {} {}",
MessageEnum.RA_CREATE_STACK_ERR, installWorkflow.getError(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue());
+ ErrorCode.BusinessProcesssError.getValue());
}
}
catch (Exception e) {
// Catch-all for backout errors trying to uninstall/delete
// Log this error, and return the original exception
logger.error("{} Create Stack: Nested exception rolling back deployment install: {}",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e);
}
}
@@ -316,7 +314,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
if (!backout)
{
logger.warn("{} Deployment installation failed, backout deletion suppressed {}",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue());
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue());
}
else {
// Poll on delete if we rollback - use same values for now
@@ -336,7 +334,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
// Catch-all for backout errors trying to uninstall/delete
// Log this error, and return the original exception
logger.error("{} Create Stack: Nested exception rolling back deployment install: {} ",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e);
}
}
@@ -352,27 +350,32 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
* Get the runtime Outputs of a deployment.
* Return the Map of tag/value outputs.
*/
- private DeploymentOutputs getDeploymentOutputs (Cloudify cloudify, String deploymentId)
+ private Optional<Map<String, Object>> getDeploymentOutputs (Cloudify cloudify, String deploymentId)
throws MsoException
{
// Build and send the Cloudify request
- DeploymentOutputs deploymentOutputs = null;
+ DeploymentOutputs deploymentOutputs;
try {
GetDeploymentOutputs queryDeploymentOutputs = cloudify.deployments().outputsById(deploymentId);
logger.debug(queryDeploymentOutputs.toString());
deploymentOutputs = executeAndRecordCloudifyRequest(queryDeploymentOutputs);
+ if (deploymentOutputs != null) {
+ return Optional.ofNullable(deploymentOutputs.getOutputs());
+ } else {
+ return Optional.empty();
+ }
}
catch (CloudifyConnectException ce) {
// Couldn't connect to Cloudify
logger.error("{} QueryDeploymentOutputs: Cloudify connection failure: {} ",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), ce);
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), ce);
throw new MsoIOException (ce.getMessage(), ce);
}
catch (CloudifyResponseException re) {
if (re.getStatus () == 404) {
// No Outputs
- return null;
+ return Optional.empty();
}
throw new MsoCloudifyException (re.getStatus(), re.getMessage(), re.getLocalizedMessage(), re);
}
@@ -380,8 +383,6 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
// Catch-all
throw new MsoAdapterException (e.getMessage(), e);
}
-
- return deploymentOutputs;
}
/*
@@ -455,36 +456,36 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
// Workflow failed. Log it and return the execution object (don't throw exception here)
logger.error("{} Cloudify workflow failure: {} {} Execute Workflow: Failed: {}",
MessageEnum.RA_CREATE_STACK_ERR, execution.getError(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), execution.getError());
+ ErrorCode.BusinessProcesssError.getValue(), execution.getError());
return execution;
}
else if (status.equals(CANCELLED)){
// Workflow was cancelled, leaving the deployment in an indeterminate state. Log it and return the execution object (don't throw exception here)
logger.error("{} Cloudify workflow cancelled. Deployment is in an indeterminate state {} {} {}",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(),
"Execute Workflow cancelled: ", workflowId);
return execution;
}
else {
// Can only get here after a timeout
logger.error("{} Cloudify workflow timeout {} Execute Workflow: Timed Out", MessageEnum.RA_CREATE_STACK_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue());
+ ErrorCode.BusinessProcesssError.getValue());
}
}
catch (CloudifyConnectException ce) {
logger.error("{} {} Execute Workflow ({} {}): Cloudify connection failure {} ", MessageEnum.RA_CREATE_STACK_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), command, ce);
+ ErrorCode.BusinessProcesssError.getValue(), command, ce);
savedException = ce;
}
catch (CloudifyResponseException re) {
logger.error("{} {} Execute Workflow ({}): Cloudify response error {} ", MessageEnum.RA_CREATE_STACK_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), command, re.getMessage(), re);
+ ErrorCode.BusinessProcesssError.getValue(), command, re.getMessage(), re);
savedException = re;
}
catch (RuntimeException e) {
// Catch-all
logger.error("{} {} Execute Workflow ({}): Internal error {}", MessageEnum.RA_CREATE_STACK_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), command, e.getMessage(), e);
+ ErrorCode.BusinessProcesssError.getValue(), command, e.getMessage(), e);
savedException = e;
}
@@ -545,7 +546,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
}
catch (Exception e) {
// Catch-all. Log the message and throw the original exception
- logger.debug("Cancel workflow {} failed for deployment : {} {}", workflowId, deploymentId, e);
+ logger.debug("Cancel workflow {} failed for deployment {} :", workflowId, deploymentId, e);
MsoCloudifyException exception = new MsoCloudifyException (-1, "", "", savedException);
exception.setPendingWorkflow(true);
throw exception;
@@ -579,16 +580,11 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
// Build and send the Cloudify request
Deployment deployment = new Deployment();
- DeploymentOutputs outputs = null;
try {
GetDeployment queryDeployment = cloudify.deployments().byId(deploymentId);
logger.debug(queryDeployment.toString());
-
-// deployment = queryDeployment.execute();
deployment = executeAndRecordCloudifyRequest(queryDeployment);
- outputs = getDeploymentOutputs (cloudify, deploymentId);
-
// Next look for the latest execution
ListExecutions listExecutions = cloudify.executions().listFiltered ("deployment_id=" + deploymentId, "-created_at");
Executions executions = listExecutions.execute();
@@ -604,7 +600,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
return new DeploymentInfoBuilder()
.withId(deployment.getId())
.withDeploymentInputs(deployment.getInputs())
- .withDeploymentOutputs(outputs.getOutputs())
+ .withDeploymentOutputs(getDeploymentOutputs(cloudify, deploymentId).get())
.fromExecution(executions.getItems().get(0))
.build();
}
@@ -612,7 +608,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
catch (CloudifyConnectException ce) {
// Couldn't connect to Cloudify
logger.error("{} QueryDeployment: Cloudify connection failure: {} ", MessageEnum.RA_CREATE_STACK_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), ce);
+ ErrorCode.BusinessProcesssError.getValue(), ce);
throw new MsoIOException (ce.getMessage(), ce);
}
catch (CloudifyResponseException re) {
@@ -623,7 +619,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
return new DeploymentInfoBuilder()
.withId(deployment.getId())
.withDeploymentInputs(deployment.getInputs())
- .withDeploymentOutputs(outputs.getOutputs())
+ .withDeploymentOutputs(getDeploymentOutputs(cloudify, deploymentId).get())
.build();
} else {
// Deployment not found. Default status of a DeploymentInfo object is NOTFOUND
@@ -670,12 +666,11 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
logger.debug ("Ready to Uninstall/Delete Deployment ({})", deploymentId);
// Query first to save the trouble if deployment not found
- Deployment deployment = null;
- try {
+ try {
GetDeployment queryDeploymentRequest = cloudify.deployments().byId(deploymentId);
logger.debug(queryDeploymentRequest.toString());
- deployment = executeAndRecordCloudifyRequest (queryDeploymentRequest);
+ // deployment = executeAndRecordCloudifyRequest (queryDeploymentRequest);
}
catch (CloudifyResponseException e) {
// Since this came on the 'Create Deployment' command, nothing was changed
@@ -707,7 +702,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
/*
* Query the outputs before deleting so they can be returned as well
*/
- DeploymentOutputs outputs = getDeploymentOutputs (cloudify, deploymentId);
+ //DeploymentOutputs outputs = getDeploymentOutputs (cloudify, deploymentId);
/*
* Next execute the "uninstall" workflow.
@@ -745,6 +740,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
// At this point, the deployment has been successfully uninstalled.
// Next step is to delete the deployment itself
+ Deployment deployment;
try {
DeleteDeployment deleteRequest = cloudify.deployments().deleteByName(deploymentId);
logger.debug(deleteRequest.toString());
@@ -781,7 +777,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
return new DeploymentInfoBuilder()
.withId(deployment.getId())
.withDeploymentInputs(deployment.getInputs())
- .withDeploymentOutputs(outputs.getOutputs())
+ .withDeploymentOutputs(getDeploymentOutputs(cloudify, deploymentId).get())
.fromExecution(uninstallWorkflow)
.build();
}
@@ -1126,7 +1122,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
}
} catch (NumberFormatException e1) {
logger.error("{} No retries. Exception in parsing retry code in config:{} {}",
- MessageEnum.RA_CONFIG_EXC, rCode, MsoLogger.ErrorCode.SchemaError.getValue());
+ MessageEnum.RA_CONFIG_EXC, rCode, ErrorCode.SchemaError.getValue());
throw e;
}
}
@@ -1166,7 +1162,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
// Failed Cloudify calls return an error entity body.
CloudifyError error = re.getResponse ().getErrorEntity (CloudifyError.class);
logger.error("{} {} {} Exception - Cloudify Error on {}: {}", MessageEnum.RA_CONNECTION_EXCEPTION,
- CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), context, error.getErrorCode());
+ CLOUDIFY, ErrorCode.DataError.getValue(), context, error.getErrorCode());
String fullError = error.getErrorCode() + ": " + error.getMessage();
logger.debug(fullError);
me = new MsoCloudifyException (re.getStatus(),
@@ -1175,7 +1171,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
} catch (Exception e2) {
// Couldn't parse the body as a "CloudifyError". Report the original HTTP error.
logger.error("{} {} {} Exception - HTTP Error on {}: {}, {} ", MessageEnum.RA_CONNECTION_EXCEPTION,
- CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2);
+ CLOUDIFY, ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2);
me = new MsoCloudifyException (re.getStatus (), re.getMessage (), "");
}
@@ -1195,7 +1191,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
// Generate an alarm for all connection errors.
logger.error("{} {} {} Cloudify connection error on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION, CLOUDIFY,
- MsoLogger.ErrorCode.DataError.getValue(), context, e);
+ ErrorCode.DataError.getValue(), context, e);
}
return me;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
index bb8aa92281..8da4df28b1 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,6 +34,7 @@ public class VnfRollback {
private String vnfId;
private String tenantId;
private String cloudSiteId;
+ private String cloudOwner;
private boolean tenantCreated = false;
private boolean vnfCreated = false;
private MsoRequest msoRequest;
@@ -51,10 +52,11 @@ public class VnfRollback {
/**
* For backwards compatibility... orchestration mode defaults to HEAT
- *
+ *
* @param vnfId
* @param tenantId
* @param cloudSiteId
+ * @param cloudOwner
* @param tenantCreated
* @param vnfCreated
* @param msoRequest
@@ -63,7 +65,7 @@ public class VnfRollback {
* @param requestType
* @param modelCustomizationUuid
*/
- public VnfRollback(String vnfId, String tenantId, String cloudSiteId,
+ public VnfRollback(String vnfId, String tenantId, String cloudOwner, String cloudSiteId,
boolean tenantCreated, boolean vnfCreated,
MsoRequest msoRequest,
String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) {
@@ -71,6 +73,7 @@ public class VnfRollback {
this.vnfId = vnfId;
this.tenantId = tenantId;
this.cloudSiteId = cloudSiteId;
+ this.cloudOwner = cloudOwner;
this.tenantCreated = tenantCreated;
this.vnfCreated = vnfCreated;
this.msoRequest = msoRequest;
@@ -82,10 +85,11 @@ public class VnfRollback {
/**
* For backwards compatibility... orchestration mode defaults to HEAT
- *
+ *
* @param vnfId
* @param tenantId
* @param cloudSiteId
+ * @param cloudOwner
* @param tenantCreated
* @param vnfCreated
* @param msoRequest
@@ -94,7 +98,7 @@ public class VnfRollback {
* @param requestType
* @param modelCustomizationUuid
*/
- public VnfRollback(String vnfId, String tenantId, String cloudSiteId,
+ public VnfRollback(String vnfId, String tenantId, String cloudOwner, String cloudSiteId,
boolean tenantCreated, boolean vnfCreated,
MsoRequest msoRequest, String volumeGroupName, String volumeGroupId,
String requestType, String modelCustomizationUuid, String orchestrationMode) {
@@ -102,6 +106,7 @@ public class VnfRollback {
this.vnfId = vnfId;
this.tenantId = tenantId;
this.cloudSiteId = cloudSiteId;
+ this.cloudOwner = cloudOwner;
this.tenantCreated = tenantCreated;
this.vnfCreated = vnfCreated;
this.msoRequest = msoRequest;
@@ -131,6 +136,12 @@ public class VnfRollback {
public void setCloudSiteId(String cloudId) {
this.cloudSiteId = cloudId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
public boolean getTenantCreated() {
return tenantCreated;
}
@@ -207,7 +218,7 @@ public class VnfRollback {
}
@Override
public String toString() {
- return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId +
+ return "VnfRollback: cloud=" + cloudSiteId + ", cloudOwner=" + cloudOwner + ", tenant=" + tenantId +
", vnf=" + vnfId + ", tenantCreated=" + tenantCreated +
", vnfCreated=" + vnfCreated + ", requestType = " + requestType
+ ", modelCustomizationUuid=" + this.modelCustomizationUuid
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
index 8cd6b0f65e..5a7f67ea3c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
@@ -39,8 +39,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.onap.so.config.beans.PoConfig;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
@@ -108,7 +108,7 @@ public class MsoCommonUtils {
}
} catch (NumberFormatException e1) {
logger.error("{} No retries. Exception in parsing retry code in config:{} {} {}",
- MessageEnum.RA_CONFIG_EXC, rCode, MsoLogger.ErrorCode.SchemaError.getValue(),
+ MessageEnum.RA_CONFIG_EXC, rCode, ErrorCode.SchemaError.getValue(),
"Exception in parsing retry code in config");
throw e;
}
@@ -160,12 +160,12 @@ public class MsoCommonUtils {
// Failed Keystone calls return an Error entity body.
Error error = re.getResponse ().getErrorEntity (Error.class);
logger.error("{} {} Openstack Keystone Error on {}: {}",
- MessageEnum.RA_CONNECTION_EXCEPTION, MsoLogger.ErrorCode.DataError.getValue(), context, error);
+ MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), context, error);
me = new MsoOpenstackException (error.getCode (), error.getTitle (), error.getMessage ());
} catch (Exception e2) {
// Can't parse the body as an "Error". Report the HTTP error
logger.error("{} {} HTTP Error on {}: {}, {}", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), context, re.getStatus(), re.getMessage(), e2);
+ ErrorCode.DataError.getValue(), context, re.getStatus(), re.getMessage(), e2);
me = new MsoOpenstackException (re.getStatus (), re.getMessage (), "");
}
@@ -184,7 +184,7 @@ public class MsoCommonUtils {
// Generate an alarm for all connection errors.
logger.error("{} {} Openstack Keystone connection error on {}: ", MessageEnum.RA_GENERAL_EXCEPTION_ARG,
- MsoLogger.ErrorCode.DataError.getValue(), context, e);
+ ErrorCode.DataError.getValue(), context, e);
}
return me;
@@ -204,7 +204,7 @@ public class MsoCommonUtils {
// Failed Heat calls return an Explanation entity body.
Explanation explanation = re.getResponse ().getErrorEntity (Explanation.class);
logger.error("{} {} Exception - Openstack Error on {} : {}", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), context, explanation.toString());
+ ErrorCode.DataError.getValue(), context, explanation.toString());
String fullError = explanation.getExplanation() + ", error.type=" + explanation.getError().getType() + ", error.message=" + explanation.getError().getMessage();
logger.debug(fullError);
me = new MsoOpenstackException (explanation.getCode (),
@@ -214,7 +214,7 @@ public class MsoCommonUtils {
} catch (Exception e2) {
// Couldn't parse the body as an "Explanation". Report the original HTTP error.
logger.error("{} {} Exception - HTTP Error on {}: {}, ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2);
+ ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2);
me = new MsoOpenstackException (re.getStatus (), re.getMessage (), "");
}
@@ -234,7 +234,7 @@ public class MsoCommonUtils {
// Generate an alarm for all connection errors.
logger.error("{} {} Openstack Heat connection error on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), context, e);
+ ErrorCode.DataError.getValue(), context, e);
}
return me;
@@ -254,12 +254,12 @@ public class MsoCommonUtils {
// Failed Neutron calls return an NeutronError entity body
NeutronError error = re.getResponse ().getErrorEntity (NeutronError.class);
logger.error("{} {} Openstack Neutron Error on {} {}", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), context, error);
+ ErrorCode.DataError.getValue(), context, error);
me = new MsoOpenstackException (re.getStatus (), error.getType (), error.getMessage ());
} catch (Exception e2) {
// Couldn't parse body as a NeutronError. Report the HTTP error.
logger.error("{} {} Openstack HTTP Error on {}: {}, {}", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2);
+ ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2);
me = new MsoOpenstackException (re.getStatus (), re.getMessage (), null);
}
@@ -279,7 +279,7 @@ public class MsoCommonUtils {
// Generate an alarm for all connection errors.
logger.error("{} {} Openstack Neutron Connection error on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), context, e);
+ ErrorCode.DataError.getValue(), context, e);
}
return me;
@@ -298,7 +298,7 @@ public class MsoCommonUtils {
// Always generate an alarm for internal exceptions
logger.error("{} {} An exception occured on {}: ", MessageEnum.RA_GENERAL_EXCEPTION_ARG,
- MsoLogger.ErrorCode.DataError.getValue(), context, e);
+ ErrorCode.DataError.getValue(), context, e);
return me;
}
@@ -310,7 +310,7 @@ public class MsoCommonUtils {
// Always generate an alarm for internal exceptions
logger.error("{} {} An exception occured on {}: ", MessageEnum.RA_GENERAL_EXCEPTION_ARG,
- MsoLogger.ErrorCode.DataError.getValue(), context, e);
+ ErrorCode.DataError.getValue(), context, e);
return me;
}
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 47ff6c1b5f..054234015f 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
@@ -68,8 +68,8 @@ import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.so.db.catalog.beans.HeatTemplateParam;
import org.onap.so.db.catalog.beans.ServerType;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.exceptions.MsoAdapterException;
@@ -88,24 +88,6 @@ import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.woorea.openstack.base.client.OpenStackConnectException;
-import com.woorea.openstack.base.client.OpenStackRequest;
-import com.woorea.openstack.base.client.OpenStackResponseException;
-import com.woorea.openstack.heat.Heat;
-import com.woorea.openstack.heat.model.CreateStackParam;
-import com.woorea.openstack.heat.model.Resources;
-import com.woorea.openstack.heat.model.Stack;
-import com.woorea.openstack.heat.model.Stack.Output;
-import com.woorea.openstack.heat.model.Stacks;
-import com.woorea.openstack.keystone.Keystone;
-import com.woorea.openstack.keystone.model.Access;
-import com.woorea.openstack.keystone.model.Authentication;
-import com.woorea.openstack.keystone.utils.KeystoneUtils;
-
@Primary
@Component
public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
@@ -132,10 +114,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
@Autowired
private MsoTenantUtilsFactory tenantUtilsFactory;
-
+
@Autowired
private KeystoneV3Authentication keystoneV3Authentication;
-
+
private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtils.class);
// Properties names and variables (with default values)
@@ -153,6 +135,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
* this method does not include environment, files, or heatFiles
*/
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -161,8 +144,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
int timeoutMinutes) throws MsoException {
// Just call the new method with the environment & files variable set to null
return this.createStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
+ null,
heatTemplate,
stackInputs,
pollForCompletion,
@@ -175,6 +160,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// This method has environment, but not files or heatFiles
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -184,8 +170,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
String environment) throws MsoException {
// Just call the new method with the files/heatFiles variables set to null
return this.createStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
+ null,
heatTemplate,
stackInputs,
pollForCompletion,
@@ -198,6 +186,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// This method has environment and files, but not heatFiles.
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -207,8 +196,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
String environment,
Map <String, Object> files) throws MsoException {
return this.createStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
+ null,
heatTemplate,
stackInputs,
pollForCompletion,
@@ -221,6 +212,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// This method has environment, files, heatfiles
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -231,8 +223,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
Map <String, Object> files,
Map <String, Object> heatFiles) throws MsoException {
return this.createStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
+ null,
heatTemplate,
stackInputs,
pollForCompletion,
@@ -269,8 +263,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
* stack. We must combine them before we add them to the stack if they're both non-null.
*
* @param cloudSiteId The cloud (may be a region) in which to create the stack.
+ * @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 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
@@ -285,8 +281,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
@SuppressWarnings("unchecked")
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
+ VduModelInfo vduModel,
String heatTemplate,
Map <String, ?> stackInputs,
boolean pollForCompletion,
@@ -327,7 +325,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
request.header ("X-Auth-Key", CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass ()));
heatStack = executeAndRecordOpenstackRequest (request);
} catch (OpenStackResponseException e) {
- if (e.getStatus () == 409) {
+ if (e.getStatus () == 409) {
MsoStackAlreadyExists me = new MsoStackAlreadyExists (stackName, tenantId, cloudSiteId);
me.addContext (CREATE_STACK);
throw me;
@@ -335,9 +333,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
logger.debug("ERROR STATUS = {},\n{}\n{}", e.getStatus(), e.getMessage(), e.getLocalizedMessage());
throw heatExceptionToMsoException (e, CREATE_STACK);
}
- } catch (OpenStackConnectException e) {
+ } catch (OpenStackConnectException e) {
throw heatExceptionToMsoException (e, CREATE_STACK);
- } catch (RuntimeException e) {
+ } catch (RuntimeException e) {
throw runtimeExceptionToMsoException (e, CREATE_STACK);
}
@@ -345,7 +343,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// Otherwise, simple query by name returns a 302 redirect.
// NOTE: This is specific to the v1 Orchestration API.
String canonicalName = stackName + "/" + heatStack.getId ();
-
+
if (pollForCompletion) {
heatStack = pollStackForCompletion(cloudSiteId, tenantId, stackName, timeoutMinutes, backout, heatClient,
heatStack, canonicalName);
@@ -378,11 +376,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
logger.debug("an error occurred trying to print out the current outputs of the stack", e);
}
- if ("CREATE_IN_PROGRESS".equals (heatStack.getStackStatus ())) {
+ if ("CREATE_IN_PROGRESS".equals (heatStack.getStackStatus ())) {
if (pollTimeout <= 0) {
logger.error("{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Create stack timeout",
MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
- heatStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue());
+ heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue());
createTimedOut = true;
break;
}
@@ -399,7 +397,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
if (!backout)
{
logger.warn("{} Exception in Create Stack, stack deletion suppressed {}",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue());
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue());
}
else
{
@@ -421,7 +419,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
logger.error(
"{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Rollback: DELETE stack timeout",
MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
- heatStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue());
+ heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue());
break;
} else {
sleep(deletePollInterval * 1000L);
@@ -445,13 +443,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
} catch (Exception e3) {
// Just log this one. We will report the original exception.
logger.error("{} Create Stack: Nested exception rolling back stack: {} ",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e3);
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e3);
}
}
} catch (Exception e2) {
// Just log this one. We will report the original exception.
logger.error("{} Create Stack: Nested exception rolling back stack: {} ",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e2);
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e2);
}
}
@@ -464,14 +462,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
if (!"CREATE_COMPLETE".equals (heatStack.getStackStatus ())) {
logger.error("{} Create Stack error: Polling complete with non-success status: {}, {} {} ",
MessageEnum.RA_CREATE_STACK_ERR, heatStack.getStackStatus(), heatStack.getStackStatusReason(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue());
+ ErrorCode.BusinessProcesssError.getValue());
// Rollback the stack creation, since it is in an indeterminate state.
if (!backout)
{
logger.warn(
"{} Create Stack errored, stack deletion suppressed {} Create Stack error, stack deletion suppressed",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue());
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue());
}
else
{
@@ -491,7 +489,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
logger.error(
"{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Rollback: DELETE stack timeout",
MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
- heatStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue());
+ heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue());
break;
} else {
sleep(deletePollInterval * 1000L);
@@ -506,7 +504,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// Warn about this (?) - but still throw the original exception
logger.warn(
"{} Create Stack errored, stack deletion FAILED {} Create Stack error, stack deletion FAILED",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue());
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue());
logger.debug("Stack deletion FAILED on a rollback of a create - {}, status={}, reason={}",
canonicalName, heatStack.getStackStatus(), heatStack.getStackStatusReason());
break;
@@ -526,7 +524,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
logger.debug("Exception thrown trying to delete {} on a create->rollback: {} ", canonicalName,
me2.getContextMessage(), me2);
logger.warn("{} Create Stack errored, then stack deletion FAILED - exception thrown {} {}",
- MessageEnum.RA_CREATE_STACK_ERR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(),
me2.getContextMessage());
}
@@ -545,7 +543,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
} catch (Exception e2) {
// shouldn't happen - but handle
logger.error("{} Create Stack: Nested exception rolling back stack: {} ", MessageEnum.RA_CREATE_STACK_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e2);
+ ErrorCode.BusinessProcesssError.getValue(), e2);
}
}
MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString());
@@ -562,11 +560,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
*
* @param tenantId The Openstack ID of the tenant in which to query
* @param cloudSiteId The cloud identifier (may be a region) in which to query
+ * @param cloudOwner the cloud owner of the cloud site in which to query
* @param stackName The name of the stack to query (may be simple or canonical)
* @return A StackInfo object
* @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
*/
- public StackInfo queryStack (String cloudSiteId, String tenantId, String stackName) throws MsoException {
+ public StackInfo queryStack (String cloudSiteId, String cloudOwner, String tenantId, String stackName) throws MsoException {
logger.debug ("Query HEAT stack: {} in tenant {}", stackName, tenantId);
// Obtain the cloud site information where we will create the stack
@@ -588,7 +587,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
} catch (MsoException me) {
// Got an Openstack error. Propagate it
logger.error("{} {} Openstack Exception on Token request: ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), me);
+ ErrorCode.AvailabilityError.getValue(), me);
me.addContext ("QueryStack");
throw me;
}
@@ -620,6 +619,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
* all or partially deleted, so the resulting stack must be considered invalid.
*
* @param tenantId The Openstack ID of the tenant in which to perform the delete
+ * @param cloudOwner the cloud owner of the cloud site in which to delete the stack
* @param cloudSiteId The cloud identifier (may be a region) from which to delete the stack.
* @param stackName The name/id of the stack to delete. May be simple or canonical
* @param pollForCompletion Indicator that polling should be handled in Java vs. in the client
@@ -628,6 +628,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
* @throws MsoCloudSiteNotFound
*/
public StackInfo deleteStack (String tenantId,
+ String cloudOwner,
String cloudSiteId,
String stackName,
boolean pollForCompletion) throws MsoException {
@@ -650,7 +651,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
} catch (MsoException me) {
// Got an Openstack error. Propagate it
logger.error("{} {} Openstack Exception on Token request: ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), me);
+ ErrorCode.AvailabilityError.getValue(), me);
me.addContext (DELETE_STACK);
throw me;
}
@@ -727,7 +728,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
if (pollTimeout <= 0) {
logger.error("{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Delete Stack Timeout",
MessageEnum.RA_DELETE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
- heatStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue());
+ heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue());
// Throw a 'special case' of MsoOpenstackException to report the Heat status
MsoOpenstackException me = new MsoOpenstackException (0, "", "Stack Deletion Timeout");
@@ -846,7 +847,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// Problem - missing one or more required parameters
String error = "Missing Required inputs for HEAT Template: " + missingParams;
logger.error("{} for HEAT Template {} Missing Required inputs for HEAT Template: {}",
- MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.SchemaError.getValue(), missingParams);
+ MessageEnum.RA_MISSING_PARAM, ErrorCode.SchemaError.getValue(), missingParams);
throw new IllegalArgumentException (error);
}
@@ -865,7 +866,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
if (!extraParams.isEmpty ()) {
logger.warn("{} Heat Stack ({}) extra input params received: {} {}", MessageEnum.RA_GENERAL_WARNING,
- heatTemplate.getTemplateName(), extraParams, MsoLogger.ErrorCode.DataError.getValue());
+ heatTemplate.getTemplateName(), extraParams, ErrorCode.DataError.getValue());
}
return updatedParams;
@@ -904,14 +905,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) {
Keystone keystoneTenantClient = new Keystone (keystoneUrl);
Access access = null;
-
+
Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity);
-
+
OpenStackRequest <Access> request = keystoneTenantClient.tokens ()
.authenticate (credentials).withTenantId (tenantId);
-
+
access = executeAndRecordOpenstackRequest (request);
-
+
try {
// Isolate trying to printout the region IDs
try {
@@ -1016,10 +1017,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
- public Map<String, Object> queryStackForOutputs(String cloudSiteId,
+ public Map<String, Object> queryStackForOutputs(String cloudSiteId, String cloudOwner,
String tenantId, String stackName) throws MsoException {
logger.debug("MsoHeatUtils.queryStackForOutputs)");
- StackInfo heatStack = this.queryStack(cloudSiteId, tenantId, stackName);
+ StackInfo heatStack = this.queryStack(cloudSiteId, cloudOwner, tenantId, stackName);
if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) {
return null;
}
@@ -1198,7 +1199,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
sb.append("[END]");
return sb;
}
-
+
public void copyBaseOutputsToInputs(Map<String, Object> inputs,
Map<String, Object> otherStackOutputs, List<String> paramNames, Map<String, String> aliases) {
@@ -1294,7 +1295,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
Set<HeatTemplateParam> paramSet = template.getParameters();
logger.debug("paramSet has {} entries", paramSet.size());
} catch (Exception e) {
- logger.debug("Exception occurred in convertInputMap:" + e.getMessage(), e);
+ logger.debug("Exception occurred in convertInputMap {} :", e.getMessage(), e);
}
for (HeatTemplateParam htp : template.getParameters()) {
@@ -1527,6 +1528,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
// Translate the VDU ModelInformation structure to that which is needed for
@@ -1552,8 +1554,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
try {
StackInfo stackInfo = createStack (cloudSiteId,
+ cloudOwner,
tenantId,
instanceName,
+ vduModel,
heatTemplate,
inputs,
true, // poll for completion
@@ -1580,11 +1584,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
try {
// Query the Cloudify Deployment object and populate a VduInstance
- StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId);
+ StackInfo stackInfo = queryStack (cloudSiteId, cloudOwner, tenantId, instanceId);
return stackInfoToVduInstance(stackInfo);
}
@@ -1602,11 +1607,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
try {
// Delete the Heat stack
- StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId, true);
+ StackInfo stackInfo = deleteStack (tenantId, cloudOwner, cloudSiteId, instanceId, true);
// Populate a VduInstance based on the deleted Cloudify Deployment object
VduInstance vduInstance = stackInfoToVduInstance(stackInfo);
@@ -1704,7 +1710,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
return vduStatus;
}
-
+
public Resources queryStackResources(String cloudSiteId, String tenantId, String stackName) throws MsoException {
CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId)
.orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
index cbbabc79b3..c378be7d4b 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
@@ -10,9 +10,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,8 +39,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
@@ -68,6 +68,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
*/
public StackInfo updateStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -77,6 +78,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
// Keeping this method to allow compatibility with no environment or files variable sent. In this case,
// simply return the new method with the environment variable set to null.
return this.updateStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -89,6 +91,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
}
public StackInfo updateStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -99,6 +102,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
// Keeping this method to allow compatibility with no environment variable sent. In this case,
// simply return the new method with the files variable set to null.
return this.updateStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -111,6 +115,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
}
public StackInfo updateStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -120,6 +125,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
String environment,
Map <String, Object> files) throws MsoException {
return this.updateStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -165,6 +171,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
*/
public StackInfo updateStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -295,7 +302,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
logger.error(
"{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Update stack timeout",
MessageEnum.RA_UPDATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
- updateStack.getStackStatus(), MsoLogger.ErrorCode.AvailabilityError.getValue());
+ updateStack.getStackStatus(), ErrorCode.AvailabilityError.getValue());
loopAgain = false;
} else {
try {
@@ -324,7 +331,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
if (!"UPDATE_COMPLETE".equals (updateStack.getStackStatus ())) {
logger.error("{} Stack status: {} Stack status reason: {} {} Update Stack error",
MessageEnum.RA_UPDATE_STACK_ERR, updateStack.getStackStatus(), updateStack.getStackStatusReason(),
- MsoLogger.ErrorCode.DataError.getValue());
+ ErrorCode.DataError.getValue());
// TODO: No way to roll back the stack at this point. What to do?
// Throw a 'special case' of MsoOpenstackException to report the Heat status
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
index 56a42e986f..c96cca9f61 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
@@ -42,8 +42,8 @@ import java.util.Optional;
import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.MsoTenant;
import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
@@ -97,7 +97,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite(cloudSiteId);
if (!cloudSiteOpt.isPresent()) {
logger.error("{} MSOCloudSite {} not found {} ", MessageEnum.RA_CREATE_TENANT_ERR, cloudSiteId,
- MsoLogger.ErrorCode.DataError.getValue());
+ ErrorCode.DataError.getValue());
throw new MsoCloudSiteNotFound (cloudSiteId);
}
Keystone keystoneAdminClient = getKeystoneAdminClient(cloudSiteOpt.get());
@@ -109,7 +109,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
if (tenant != null) {
// Tenant already exists. Throw an exception
logger.error("{} Tenant name {} already exists on Cloud site id {}, {}",
- MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, MsoLogger.ErrorCode.DataError.getValue());
+ MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, ErrorCode.DataError.getValue());
throw new MsoTenantAlreadyExists (tenantName, cloudSiteId);
}
@@ -159,7 +159,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
if (!backout)
{
logger.warn("{} Create Tenant errored, Tenant deletion suppressed {} ", MessageEnum.RA_CREATE_TENANT_ERR,
- MsoLogger.ErrorCode.DataError.getValue());
+ ErrorCode.DataError.getValue());
}
else
{
@@ -169,7 +169,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
} catch (Exception e2) {
// Just log this one. We will report the original exception.
logger.error("{} Nested exception rolling back tenant {} ", MessageEnum.RA_CREATE_TENANT_ERR,
- MsoLogger.ErrorCode.DataError.getValue(), e2);
+ ErrorCode.DataError.getValue(), e2);
}
}
@@ -306,7 +306,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
Tenant tenant = findTenantById (keystoneAdminClient, tenantId);
if (tenant == null) {
logger.error("{} Tenant id {} not found on cloud site id {}, {}", MessageEnum.RA_TENANT_NOT_FOUND,
- tenantId, cloudSiteId, MsoLogger.ErrorCode.DataError.getValue());
+ tenantId, cloudSiteId, ErrorCode.DataError.getValue());
return false;
}
@@ -353,7 +353,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
if (tenant == null) {
// OK if tenant already doesn't exist.
logger.error("{} Tenant {} not found on Cloud site id {}, {}", MessageEnum.RA_TENANT_NOT_FOUND,
- tenantName, cloudSiteId, MsoLogger.ErrorCode.DataError.getValue());
+ tenantName, cloudSiteId, ErrorCode.DataError.getValue());
return false;
}
@@ -437,7 +437,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
logger.error("{} Region: {} Cloud identity {} {} Exception in findEndpointURL ",
MessageEnum.IDENTITY_SERVICE_NOT_FOUND, region, cloudIdentity.getId(),
- MsoLogger.ErrorCode.DataError.getValue(), e);
+ ErrorCode.DataError.getValue(), e);
throw new MsoAdapterException (error, e);
}
@@ -493,7 +493,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
return null;
} else {
logger.error("{} {} Openstack Error, GET Tenant by Id ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), tenantId, e);
+ ErrorCode.DataError.getValue(), tenantId, e);
throw e;
}
}
@@ -522,7 +522,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
return null;
} else {
logger.error("{} {} Openstack Error, GET Tenant By Name ({}) ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), tenantName, e);
+ ErrorCode.DataError.getValue(), tenantName, e);
throw e;
}
}
@@ -552,7 +552,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
return findUserByName (adminClient, userNameOrId);
} else {
logger.error("{} {} Openstack Error, GET User ({}) ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), userNameOrId, e);
+ ErrorCode.DataError.getValue(), userNameOrId, e);
throw e;
}
}
@@ -581,7 +581,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
return null;
} else {
logger.error("{} {} Openstack Error, GET User By Name ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), userName, e);
+ ErrorCode.DataError.getValue(), userName, e);
throw e;
}
}
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 49758a1240..fec4a1d16c 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
@@ -47,8 +47,8 @@ import org.onap.so.adapters.vdu.VduStatus;
import org.onap.so.client.HttpClientFactory;
import org.onap.so.client.RestClient;
import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.exceptions.MsoAdapterException;
@@ -67,11 +67,12 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
public static final String OOF_DIRECTIVES = "oof_directives";
public static final String SDNC_DIRECTIVES = "sdnc_directives";
+ public static final String USER_DIRECTIVES = "user_directives";
public static final String VNF_ID = "vnf_id";
public static final String VF_MODULE_ID = "vf_module_id";
public static final String TEMPLATE_TYPE = "template_type";
public static final List<String> MULTICLOUD_INPUTS =
- Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, TEMPLATE_TYPE);
+ Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE);
private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class);
@@ -112,7 +113,8 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
* The nested templates and get_file entries both end up being added to the "files" on the
* stack. We must combine them before we add them to the stack if they're both non-null.
*
- * @param cloudSiteId The cloud (may be a region) in which to create the stack.
+ * @param cloudSiteId The cloud (may be a region) in which to create the stack
+ * @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 heatTemplate The Heat template
@@ -130,8 +132,10 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
@SuppressWarnings("unchecked")
@Override
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
+ VduModelInfo vduModel,
String heatTemplate,
Map <String, ?> stackInputs,
boolean pollForCompletion,
@@ -146,6 +150,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
// Get the directives, if present.
String oofDirectives = "{}";
String sdncDirectives = "{}";
+ String userDirectives = "{}";
String genericVnfId = "";
String vfModuleId = "";
String templateType = "";
@@ -158,6 +163,9 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
if (key == SDNC_DIRECTIVES) {
sdncDirectives = (String) stackInputs.get(key);
}
+ if (key == USER_DIRECTIVES) {
+ sdncDirectives = (String) stackInputs.get(key);
+ }
if (key == TEMPLATE_TYPE) {
templateType = (String) stackInputs.get(key);
}
@@ -182,15 +190,19 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
multicloudRequest.setGenericVnfId(genericVnfId);
multicloudRequest.setVfModuleId(vfModuleId);
+ multicloudRequest.setVfModuleModelInvariantId(vduModel.getModelInvariantUUID());
+ multicloudRequest.setVfModuleModelVersionId(vduModel.getModelUUID());
+ multicloudRequest.setVfModuleModelCustomizationId(vduModel.getModelCustomizationUUID());
multicloudRequest.setTemplateType(templateType);
multicloudRequest.setTemplateData(stack);
multicloudRequest.setOofDirectives(getDirectiveNode(oofDirectives));
multicloudRequest.setSdncDirectives(getDirectiveNode(sdncDirectives));
+ multicloudRequest.setUserDirectives(getDirectiveNode(userDirectives));
if (logger.isDebugEnabled()) {
logger.debug(String.format("Multicloud Request is: %s", multicloudRequest.toString()));
}
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, null);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, null);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
if (multicloudClient == null) {
@@ -213,7 +225,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
if (logger.isDebugEnabled()) {
logger.debug("Multicloud Create Response Body: {}", multicloudResponseBody);
}
- return getStackStatus(cloudSiteId, tenantId, canonicalName, pollForCompletion, timeoutMinutes, backout);
+ return getStackStatus(cloudSiteId, cloudOwner, tenantId, canonicalName, pollForCompletion, timeoutMinutes, backout);
}
StringBuilder stackErrorStatusReason = new StringBuilder(response.getStatusInfo().getReasonPhrase());
if (null != multicloudResponseBody) {
@@ -225,10 +237,10 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
}
@Override
- public Map<String, Object> queryStackForOutputs(String cloudSiteId,
+ public Map<String, Object> queryStackForOutputs(String cloudSiteId, String cloudOwner,
String tenantId, String stackName) throws MsoException {
logger.debug("MsoHeatUtils.queryStackForOutputs)");
- StackInfo heatStack = this.queryStack(cloudSiteId, tenantId, stackName);
+ StackInfo heatStack = this.queryStack(cloudSiteId, cloudOwner, tenantId, stackName);
if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) {
return null;
}
@@ -242,12 +254,13 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
*
* @param tenantId The Openstack ID of the tenant in which to query
* @param cloudSiteId The cloud identifier (may be a region) in which to query
+ * @param cloudOwner cloud owner of the cloud site in which to query
* @param stackId The ID of the stack to query
* @return A StackInfo object
* @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
*/
@Override
- public StackInfo queryStack (String cloudSiteId, String tenantId, String instanceId) throws MsoException {
+ public StackInfo queryStack (String cloudSiteId, String cloudOwner, String tenantId, String instanceId) throws MsoException {
if (logger.isDebugEnabled()) {
logger.debug (String.format("Query multicloud HEAT stack: %s in tenant %s", instanceId, tenantId));
}
@@ -265,7 +278,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
StackInfo returnInfo = new StackInfo();
returnInfo.setName(stackName);
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackId);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
if (multicloudClient != null) {
@@ -295,7 +308,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
return returnInfo;
}
- public StackInfo deleteStack (String cloudSiteId, String tenantId, String instanceId) throws MsoException {
+ public StackInfo deleteStack (String cloudSiteId, String cloudOwner, String tenantId, String instanceId) throws MsoException {
if (logger.isDebugEnabled()) {
logger.debug (String.format("Delete multicloud HEAT stack: %s in tenant %s", instanceId, tenantId));
}
@@ -314,7 +327,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
returnInfo.setName(stackName);
Response response = null;
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackId);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
if (multicloudClient != null) {
@@ -327,7 +340,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
returnInfo.setStatus(HeatStatus.NOTFOUND);
returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase());
} else if (response.getStatus() == Response.Status.NO_CONTENT.getStatusCode()) {
- return getStackStatus(cloudSiteId, tenantId, instanceId);
+ return getStackStatus(cloudSiteId, cloudOwner, tenantId, instanceId);
} else {
returnInfo.setStatus(HeatStatus.FAILED);
returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase());
@@ -355,11 +368,11 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
return HeatStatus.UNKNOWN;
}
- private StackInfo getStackStatus(String cloudSiteId, String tenantId, String instanceId) throws MsoException {
- return getStackStatus(cloudSiteId, tenantId, instanceId, false, 0, false);
+ private StackInfo getStackStatus(String cloudSiteId, String cloudOwner, String tenantId, String instanceId) throws MsoException {
+ return getStackStatus(cloudSiteId, cloudOwner, tenantId, instanceId, false, 0, false);
}
- private StackInfo getStackStatus(String cloudSiteId, String tenantId, String instanceId, boolean pollForCompletion, int timeoutMinutes, boolean backout) throws MsoException {
+ private StackInfo getStackStatus(String cloudSiteId, String cloudOwner, String tenantId, String instanceId, boolean pollForCompletion, int timeoutMinutes, boolean backout) throws MsoException {
StackInfo stackInfo = new StackInfo();
// If client has requested a final response, poll for stack completion
@@ -379,7 +392,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
while (true) {
try {
- stackInfo = queryStack(cloudSiteId, tenantId, instanceId);
+ stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
logger.debug (stackInfo.getStatus() + " (" + instanceId + ")");
if (HeatStatus.BUILDING.equals(stackInfo.getStatus())) {
@@ -388,7 +401,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
if (pollTimeout <= 0) {
// Note that this should not occur, since there is a timeout specified
// in the Openstack (multicloud?) call.
- logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId, stackInfo.getStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError.getValue(), "Create stack timeout"));
+ logger.error(String.format("%s %s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudOwner, cloudSiteId, tenantId, instanceId, stackInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(), "Create stack timeout"));
createTimedOut = true;
break;
}
@@ -406,22 +419,22 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
// Cannot query the stack status. Something is wrong.
// Try to roll back the stack
if (!backout) {
- logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack error, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in Create Stack, stack deletion suppressed"));
+ logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack error, stack deletion suppressed", "", "", ErrorCode.BusinessProcesssError.getValue(), "Exception in Create Stack, stack deletion suppressed"));
} else {
try {
logger.debug("Create Stack error - unable to query for stack status - attempting to delete stack: " + instanceId + " - This will likely fail and/or we won't be able to query to see if delete worked");
- StackInfo deleteInfo = deleteStack(cloudSiteId, tenantId, instanceId);
+ StackInfo deleteInfo = deleteStack(cloudSiteId, cloudOwner, tenantId, instanceId);
// this may be a waste of time - if we just got an exception trying to query the stack - we'll just
// get another one, n'est-ce pas?
boolean deleted = false;
while (!deleted) {
try {
- StackInfo queryInfo = queryStack(cloudSiteId, tenantId, instanceId);
+ StackInfo queryInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus());
if (HeatStatus.DELETING.equals(queryInfo.getStatus())) {
if (deletePollTimeout <= 0) {
- logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId,
- queryInfo.getStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError.getValue(),
+ logger.error(String.format("%s %s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudOwner, cloudSiteId, tenantId, instanceId,
+ queryInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(),
"Rollback: DELETE stack timeout"));
break;
} else {
@@ -438,12 +451,12 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
}
} catch (Exception e3) {
// Just log this one. We will report the original exception.
- logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e3, "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack: Nested exception rolling back stack on error on query"));
+ logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e3, "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack: Nested exception rolling back stack on error on query"));
}
}
} catch (Exception e2) {
// Just log this one. We will report the original exception.
- logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack: Nested exception rolling back stack"));
+ logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack: Nested exception rolling back stack"));
}
}
@@ -455,27 +468,27 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
if (!HeatStatus.CREATED.equals(stackInfo.getStatus())) {
logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack error: Polling complete with non-success status: "
- + stackInfo.getStatus () + ", " + stackInfo.getStatusMessage(), "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack error"));
+ + stackInfo.getStatus () + ", " + stackInfo.getStatusMessage(), "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack error"));
// Rollback the stack creation, since it is in an indeterminate state.
if (!backout) {
- logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack error, stack deletion suppressed"));
+ logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion suppressed", "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack error, stack deletion suppressed"));
}
else
{
try {
logger.debug("Create Stack errored - attempting to DELETE stack: " + instanceId);
logger.debug("deletePollInterval=" + deletePollInterval + ", deletePollTimeout=" + deletePollTimeout);
- StackInfo deleteInfo = deleteStack(cloudSiteId, tenantId, instanceId);
+ StackInfo deleteInfo = deleteStack(cloudSiteId, cloudOwner, tenantId, instanceId);
boolean deleted = false;
while (!deleted) {
try {
- StackInfo queryInfo = queryStack(cloudSiteId, tenantId, instanceId);
+ StackInfo queryInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus());
if (HeatStatus.DELETING.equals(queryInfo.getStatus())) {
if (deletePollTimeout <= 0) {
- logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId,
- queryInfo.getStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError.getValue(),
+ logger.error(String.format("%s %s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudOwner, cloudSiteId, tenantId, instanceId,
+ queryInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(),
"Rollback: DELETE stack timeout"));
break;
} else {
@@ -488,14 +501,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
continue;
} else {
//got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate
- logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion FAILED", "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Create Stack error, stack deletion FAILED"));
+ logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion FAILED", "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack error, stack deletion FAILED"));
logger.debug("Stack deletion FAILED on a rollback of a create - " + instanceId + ", status=" + queryInfo.getStatus() + ", reason=" + queryInfo.getStatusMessage());
break;
}
} catch (MsoException me2) {
// Just log this one. We will report the original exception.
logger.debug("Exception thrown trying to delete " + instanceId + " on a create->rollback: " + me2.getContextMessage(), me2);
- logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), me2.getContextMessage()));
+ logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", ErrorCode.BusinessProcesssError.getValue(), me2.getContextMessage()));
}
}
StringBuilder errorContextMessage;
@@ -511,7 +524,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
}
} catch (MsoException e2) {
// shouldn't happen - but handle
- logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in Create Stack: rolling back stack"));
+ logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", ErrorCode.BusinessProcesssError.getValue(), "Exception in Create Stack: rolling back stack"));
}
}
MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString());
@@ -520,7 +533,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
}
} else {
// Get initial status, since it will have been null after the create.
- stackInfo = queryStack(cloudSiteId, tenantId, instanceId);
+ stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
logger.debug("Multicloud stack query status is: " + stackInfo.getStatus());
}
return stackInfo;
@@ -580,7 +593,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
return null;
}
- private String getMulticloudEndpoint(String cloudSiteId, String workloadId) throws MsoCloudSiteNotFound {
+ private String getMulticloudEndpoint(String cloudSiteId, String cloudOwner, String workloadId) throws MsoCloudSiteNotFound {
CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
String endpoint = cloudSite.getIdentityService().getIdentityUrl();
@@ -621,7 +634,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
logger.error(String.format("%s %s %s %s %d %s",
MessageEnum.RA_CREATE_STACK_ERR.toString(),
"Create Stack: " + e, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Exception in Create Stack: Invalid JSON format of directives" + directives));
MsoException me = new MsoAdapterException("Invalid JSON format of directives parameter: " + directives);
me.addContext(CREATE_STACK);
@@ -645,6 +658,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
// Translate the VDU ModelInformation structure to that which is needed for
@@ -670,8 +684,10 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
try {
StackInfo stackInfo = createStack (cloudSiteId,
+ cloudOwner,
tenantId,
instanceName,
+ vduModel,
heatTemplate,
inputs,
true, // poll for completion
@@ -697,11 +713,12 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
try {
// Query the Cloudify Deployment object and populate a VduInstance
- StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId);
+ StackInfo stackInfo = queryStack (cloudSiteId, cloudOwner, tenantId, instanceId);
return stackInfoToVduInstance(stackInfo);
}
@@ -719,11 +736,12 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
try {
// Delete the Multicloud stack
- StackInfo stackInfo = deleteStack (cloudSiteId, tenantId, instanceId);
+ StackInfo stackInfo = deleteStack (cloudSiteId, cloudOwner, tenantId, instanceId);
// Populate a VduInstance based on the deleted Cloudify Deployment object
VduInstance vduInstance = stackInfoToVduInstance(stackInfo);
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 b904a59ee1..93460ff119 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
@@ -23,21 +23,11 @@
package org.onap.so.openstack.utils;
-import com.woorea.openstack.base.client.OpenStackBaseException;
-import com.woorea.openstack.base.client.OpenStackConnectException;
-import com.woorea.openstack.base.client.OpenStackRequest;
-import com.woorea.openstack.base.client.OpenStackResponseException;
-import com.woorea.openstack.keystone.Keystone;
-import com.woorea.openstack.keystone.model.Access;
-import com.woorea.openstack.keystone.model.Authentication;
-import com.woorea.openstack.keystone.utils.KeystoneUtils;
-import com.woorea.openstack.quantum.Quantum;
-import com.woorea.openstack.quantum.model.Network;
-import com.woorea.openstack.quantum.model.Networks;
-import com.woorea.openstack.quantum.model.Segment;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
+import java.util.Optional;
+
import org.onap.so.cloud.CloudConfig;
import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
@@ -46,8 +36,8 @@ import org.onap.so.cloud.authentication.ServiceEndpointNotFoundException;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.ServerType;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.NetworkInfo;
import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
@@ -62,6 +52,20 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.keystone.Keystone;
+import com.woorea.openstack.keystone.model.Access;
+import com.woorea.openstack.keystone.model.Authentication;
+import com.woorea.openstack.keystone.utils.KeystoneUtils;
+import com.woorea.openstack.quantum.Quantum;
+import com.woorea.openstack.quantum.model.Network;
+import com.woorea.openstack.quantum.model.Networks;
+import com.woorea.openstack.quantum.model.Port;
+import com.woorea.openstack.quantum.model.Segment;
+
@Component
public class MsoNeutronUtils extends MsoCommonUtils
{
@@ -119,7 +123,7 @@ public class MsoNeutronUtils extends MsoCommonUtils
// Network already exists. Throw an exception
logger.error("{} Network {} on Cloud site {} for tenant {} already exists {}",
MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId,
- MsoLogger.ErrorCode.DataError.getValue());
+ ErrorCode.DataError.getValue());
throw new MsoNetworkAlreadyExists (networkName, tenantId, cloudSiteId);
}
@@ -211,6 +215,24 @@ public class MsoNeutronUtils extends MsoCommonUtils
throw me;
}
}
+
+ public Optional<Port> getNeutronPort(String neutronPortId, String tenantId, String cloudSiteId)
+ {
+ try {
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ () -> new MsoCloudSiteNotFound(cloudSiteId));
+ Quantum neutronClient = getNeutronClient (cloudSite, tenantId);
+ Port port = findPortById (neutronClient, neutronPortId);
+ if (port == null) {
+ return Optional.empty();
+ }
+ return Optional.of(port);
+ }
+ catch (RuntimeException | MsoException e) {
+ logger.error("Error retrieving neutron port", e);
+ return Optional.empty();
+ }
+ }
/**
* Delete the specified Network (by ID) in the given cloud.
@@ -296,7 +318,7 @@ public class MsoNeutronUtils extends MsoCommonUtils
if (network == null) {
// Network not found. Throw an exception
logger.error("{} Network {} on Cloud site {} for Tenant {} not found {}", MessageEnum.RA_NETWORK_NOT_FOUND,
- networkId, cloudSiteId, tenantId, MsoLogger.ErrorCode.DataError.getValue());
+ networkId, cloudSiteId, tenantId, ErrorCode.DataError.getValue());
throw new MsoNetworkNotFound (networkId, tenantId, cloudSiteId);
}
@@ -483,11 +505,34 @@ public class MsoNeutronUtils extends MsoCommonUtils
return null;
} else {
logger.error("{} {} Openstack Error, GET Network By ID ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), networkId, e);
+ ErrorCode.DataError.getValue(), networkId, e);
throw e;
}
}
}
+
+
+ private Port findPortById (Quantum neutronClient, String neutronPortId)
+ {
+ if (neutronPortId == null) {
+ return null;
+ }
+
+ try {
+ OpenStackRequest<Port> request = neutronClient.ports().show(neutronPortId);
+ Port port = executeAndRecordOpenstackRequest(request);
+ return port;
+ }
+ catch (OpenStackResponseException e) {
+ if (e.getStatus() == 404) {
+ return null;
+ } else {
+ logger.error("{} {} Openstack Error, GET Neutron Port By ID ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION,
+ ErrorCode.DataError.getValue(), neutronPortId, e);
+ throw e;
+ }
+ }
+ }
/*
* Find a network (or query its existence) by its Name. This method avoids an
@@ -530,7 +575,7 @@ public class MsoNeutronUtils extends MsoCommonUtils
return null;
} else {
logger.error("{} {} Openstack Error, GET Network By Name ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), networkName, e);
+ ErrorCode.DataError.getValue(), networkName, e);
throw e;
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java
index 4204813cec..3689d34204 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
+ * Copyright (C) 2019 Intel Corp. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,8 +33,12 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonPropertyOrder({
"generic-vnf-id",
"vf-module-id",
+ "vf-module-model-invariant-id",
+ "vf-module-model-version-id",
+ "vf-module-model-customization-id",
"oof_directives",
"sdnc_directives",
+ "user_directives",
"template_type",
"template_data"
})
@@ -45,10 +49,18 @@ public class MulticloudRequest implements Serializable {
private String genericVnfId;
@JsonProperty("vf-module-id")
private String vfModuleId;
+ @JsonProperty("vf-module-model-invariant-id")
+ private String vfModuleModelInvariantId;
+ @JsonProperty("vf-module-model-version-id")
+ private String vfModuleModelVersionId;
+ @JsonProperty("vf-module-model-customization-id")
+ private String vfModuleModelCustomizationId;
@JsonProperty("oof_directives")
private JsonNode oofDirectives;
@JsonProperty("sdnc_directives")
private JsonNode sdncDirectives;
+ @JsonProperty("user_directives")
+ private JsonNode userDirectives;
@JsonProperty("template_type")
private String templateType;
@JsonProperty("template_data")
@@ -75,6 +87,36 @@ public class MulticloudRequest implements Serializable {
this.vfModuleId = vfModuleId;
}
+ @JsonProperty("vf-module-model-invariant-id")
+ public String getVfModuleModelInvariantId() {
+ return vfModuleModelInvariantId;
+ }
+
+ @JsonProperty("vf-module-model-invariant-id")
+ public void setVfModuleModelInvariantId(String vfModuleModelInvariantId) {
+ this.vfModuleModelInvariantId = vfModuleModelInvariantId;
+ }
+
+ @JsonProperty("vf-module-model-version-id")
+ public String getVfModuleModelVersionId() {
+ return vfModuleModelVersionId;
+ }
+
+ @JsonProperty("vf-module-model-version-id")
+ public void setVfModuleModelVersionId(String vfModuleModelVersionId) {
+ this.vfModuleModelVersionId = vfModuleModelVersionId;
+ }
+
+ @JsonProperty("vf-module-model-customization-id")
+ public String getVfModuleModelCustomizationId() {
+ return vfModuleModelCustomizationId;
+ }
+
+ @JsonProperty("vf-module-model-customization-id")
+ public void setVfModuleModelCustomizationId(String vfModuleModelCustomizationId) {
+ this.vfModuleModelCustomizationId = vfModuleModelCustomizationId;
+ }
+
@JsonProperty("oof_directives")
public JsonNode getOofDirectives() {
return oofDirectives;
@@ -95,6 +137,16 @@ public class MulticloudRequest implements Serializable {
this.sdncDirectives = sdncDirectives;
}
+ @JsonProperty("user_directives")
+ public JsonNode getUserDirectives() {
+ return userDirectives;
+ }
+
+ @JsonProperty("user_directives")
+ public void setUserDirectives(JsonNode userDirectives) {
+ this.userDirectives = userDirectives;
+ }
+
@JsonProperty("template_type")
public String getTemplateType() {
return templateType;
@@ -117,7 +169,16 @@ public class MulticloudRequest implements Serializable {
@Override
public String toString() {
- return new ToStringBuilder(this).append("genericVnfId", genericVnfId).append("vfModuleId", vfModuleId).append("oofDirectives", oofDirectives).append("sdncDirectives", sdncDirectives).append("templateType", templateType).append("templateData", templateData).toString();
+ return new ToStringBuilder(this).append("genericVnfId", genericVnfId)
+ .append("vfModuleId", vfModuleId)
+ .append("vfModuleModelInvariantId", vfModuleModelInvariantId)
+ .append("vfModuleModelVersionId", vfModuleModelVersionId)
+ .append("vfModuleModelCustomizationId", vfModuleModelCustomizationId)
+ .append("oofDirectives", oofDirectives)
+ .append("sdncDirectives", sdncDirectives)
+ .append("userDirectives", userDirectives)
+ .append("templateType", templateType)
+ .append("templateData", templateData).toString();
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/beans/DeploymentInfoBuilderTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/beans/DeploymentInfoBuilderTest.java
index 8f172b79ca..ce13d98dd1 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/beans/DeploymentInfoBuilderTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/beans/DeploymentInfoBuilderTest.java
@@ -149,6 +149,12 @@ public class DeploymentInfoBuilderTest {
verifyDeploymentInfoConstruction(workflowIdLastAction, status, expectedDeploymentStatus);
}
+ @Test
+ public void shouldSetEmptyOutputsMapWhenInputIsNull() {
+ DeploymentInfo deploymentInfo = new DeploymentInfoBuilder().withDeploymentOutputs(null).build();
+ assertThat(deploymentInfo.getOutputs()).isEmpty();
+ }
+
private void verifyDeploymentInfoConstruction(String workflowIdLastAction, String actionStatus,
DeploymentStatus expectedDeploymentStatus) {
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java
index 163f141c5d..444a9a8e94 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java
@@ -33,6 +33,7 @@ public class VnfRollbackTest extends BaseTest {
private String vnfId = "testVnfId";
private String tenantId = "testTenantId";
+ private String cloudOwner = "testCloudOwner";
private String cloudSiteId = "testCloudSiteId";
private boolean tenantCreated = true;
private boolean vnfCreated = true;
@@ -42,16 +43,17 @@ public class VnfRollbackTest extends BaseTest {
private String requestType = "testRequestType";
private String modelCustomizationUuid = "testModelCustimizationUuid";
private String orchestrationMode = "testOrchestrationMode";
- private static final String VNF_ROLLBACK_STRING = "VnfRollback: cloud=testCloudSiteId, tenant=testTenantId, vnf=testVnfId, "
+ private static final String VNF_ROLLBACK_STRING = "VnfRollback: cloud=testCloudSiteId, cloudOwner=testCloudOwner, tenant=testTenantId, vnf=testVnfId, "
+ "tenantCreated=true, vnfCreated=true, requestType = testRequestType, modelCustomizationUuid=testModelCustimizationUuid, mode=testOrchestrationMode";
@Test
public void VnfRollbackInstantiationTest() {
- vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated,
+ vnfRollback = new VnfRollback(vnfId, tenantId, cloudOwner, cloudSiteId, tenantCreated, vnfCreated,
msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid);
assertEquals(vnfId, vnfRollback.getVnfId());
assertEquals(tenantId, vnfRollback.getTenantId());
+ assertEquals(cloudOwner, vnfRollback.getCloudOwner());
assertEquals(cloudSiteId, vnfRollback.getCloudSiteId());
assertEquals(tenantCreated, vnfRollback.getTenantCreated());
assertEquals(vnfCreated, vnfRollback.getVnfCreated());
@@ -64,11 +66,12 @@ public class VnfRollbackTest extends BaseTest {
@Test
public void VnfRollbackInstantiationOrchestrationModeTest() {
- vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated,
+ vnfRollback = new VnfRollback(vnfId, tenantId, cloudOwner, cloudSiteId, tenantCreated, vnfCreated,
msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode);
assertEquals(vnfId, vnfRollback.getVnfId());
assertEquals(tenantId, vnfRollback.getTenantId());
+ assertEquals(cloudOwner, vnfRollback.getCloudOwner());
assertEquals(cloudSiteId, vnfRollback.getCloudSiteId());
assertEquals(tenantCreated, vnfRollback.getTenantCreated());
assertEquals(vnfCreated, vnfRollback.getVnfCreated());
@@ -82,7 +85,7 @@ public class VnfRollbackTest extends BaseTest {
@Test
public void toStringTest() {
- vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated,
+ vnfRollback = new VnfRollback(vnfId, tenantId, cloudOwner, cloudSiteId, tenantCreated, vnfCreated,
msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode);
assertEquals(VNF_ROLLBACK_STRING, vnfRollback.toString());
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 f9fc9284fe..c771a75976 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
@@ -229,7 +229,7 @@ public class MsoHeatUtilsTest extends BaseTest{
StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json");
StubOpenStack.mockOpenStackGet("TEST-stack/stackId");
- StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "tenantId", "TEST-stack",
+ StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack", null,
"TEST-heat", new HashMap<>(), false, 1, "TEST-env",
new HashMap<>(), new HashMap<>(), false);
assertNotNull(stackInfo);
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
index b735e735c9..5691d9cd69 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
@@ -67,6 +67,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
@InjectMocks
private MsoHeatUtilsWithUpdate heatUtils;
+ private String cloudOwner;
private String cloudSiteId;
private String tenantId;
private String stackName;
@@ -79,6 +80,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
public void before() {
MockitoAnnotations.initMocks(this);
+ cloudOwner = "cloudOwner";
cloudSiteId = "cloudSiteId";
tenantId = "tenantId";
stackName = "stackName";
@@ -104,7 +106,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
- StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, tenantId, stackName,
+ StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, cloudOwner, tenantId, stackName,
heatTemplate, stackInputs, pollForCompletion, timeoutMinutes);
assertThat(actualStackInfo, sameBeanAs(expectedStackInfo));
@@ -129,7 +131,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
- StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, tenantId, stackName,
+ StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, cloudOwner, tenantId, stackName,
heatTemplate, stackInputs, pollForCompletion, timeoutMinutes, environmentString);
assertThat(actualStackInfo, sameBeanAs(expectedStackInfo));
@@ -155,7 +157,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
- StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, tenantId, stackName,
+ StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, cloudOwner, tenantId, stackName,
heatTemplate, stackInputs, pollForCompletion, timeoutMinutes , environmentString, files);
assertThat(actualStackInfo, sameBeanAs(expectedStackInfo));
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
index fcb651e4dd..b2a69ded46 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
@@ -37,6 +37,7 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.BaseTest;
+import org.onap.so.adapters.vdu.VduModelInfo;
import org.onap.so.cloud.CloudConfig;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
@@ -64,9 +65,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(CREATE_STACK_RESPONSE)
.withStatus(HttpStatus.SC_CREATED)));
- StackInfo result = multicloudUtils.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
- new HashMap<>(), new HashMap<>());
+ new HashMap<>(), new HashMap<>(), false);
assertNotNull(result);
assertEquals("TEST-stack", result.getName());
}
@@ -79,9 +80,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
cloudSite.setIdentityService(new CloudIdentity());
when(cloudConfigMock.getCloudSite("MTN13")).
thenReturn(Optional.of(cloudSite));
- multicloudUtilsMock.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ multicloudUtilsMock.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
- new HashMap<>(), new HashMap<>());
+ new HashMap<>(), new HashMap<>(), false);
} catch (MsoException e) {
assertEquals("0 : Multicloud client could not be initialized", e.toString());
return;
@@ -95,9 +96,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
stubFor(post(urlPathEqualTo("/v2.0"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_BAD_REQUEST)));
- multicloudUtils.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
- new HashMap<>(), new HashMap<>());
+ new HashMap<>(), new HashMap<>(), false);
} catch (MsoException e) {
assertEquals("0 : Bad Request", e.toString());
return;
@@ -110,9 +111,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
stubFor(post(urlPathEqualTo("/v2.0"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_CREATED)));
- StackInfo result = multicloudUtils.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
- new HashMap<>(), new HashMap<>());
+ new HashMap<>(), new HashMap<>(), false);
assertNotNull(result);
assertEquals("TEST-stack/", result.getName());
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java
index a56a6929a9..f7db785deb 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,36 +22,44 @@ package org.onap.so.adapters.vdu;
/**
* Cloud information structure for deploying/managing a VDU. Includes the cloud site
- * as well as tenant information within the site. Currently this is defined as a
+ * as well as tenant information within the site. Currently this is defined as a
* cloud site ID. which would map to a CloudConfig entry.
* Perhaps the CloudConfig entry itself should be provided, instead of requiring each
* plug-in to query it.
- *
+ *
* The meaning of 'tenant' may differ by cloud provider, but every cloud supports some
* sort of tenant partitioning.
- *
+ *
*/
public class CloudInfo {
-
+
private String cloudSiteId;
- private String tenantId;
+ private String cloudOwner;
+ private String tenantId;
private String tenantName;//bpmn query and pass
-
+
public CloudInfo() {
}
-
- public CloudInfo (String cloudSiteId, String tenantId, String tenantName) {
+
+ public CloudInfo (String cloudSiteId, String cloudOwner, String tenantId, String tenantName) {
this.cloudSiteId = cloudSiteId;
+ this.cloudOwner = cloudOwner;
this.tenantId = tenantId;
this.tenantName = tenantName;
}
-
+
public String getCloudSiteId() {
return cloudSiteId;
}
public void setCloudSiteId(String cloudSiteId) {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
public String getTenantId() {
return tenantId;
}
@@ -64,6 +72,6 @@ public class CloudInfo {
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
-
-
+
+
} \ No newline at end of file
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java
index 47f4c74aae..a3ce1b5a6c 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,17 +23,31 @@ package org.onap.so.adapters.vdu;
import java.util.ArrayList;
import java.util.List;
-public class VduModelInfo {
+public class VduModelInfo {
private String modelCustomizationUUID;
+ private String modelUUID;
+ private String modelInvariantUUID;
private int timeoutMinutes;
private List<VduArtifact> artifacts = new ArrayList<>();
-
+
public String getModelCustomizationUUID() {
return modelCustomizationUUID;
}
public void setModelCustomizationUUID(String modelCustomizationUUID) {
this.modelCustomizationUUID = modelCustomizationUUID;
}
+ public String getModelUUID() {
+ return modelUUID;
+ }
+ public void setModelUUID(String modelUUID) {
+ this.modelUUID = modelUUID;
+ }
+ public String getModelInvariantUUID() {
+ return modelInvariantUUID;
+ }
+ public void setModelInvariantUUID(String modelInvariantUUID) {
+ this.modelInvariantUUID = modelInvariantUUID;
+ }
public int getTimeoutMinutes() {
return timeoutMinutes;
}
@@ -46,5 +60,5 @@ public class VduModelInfo {
public void setArtifacts(List<VduArtifact> artifacts) {
this.artifacts = artifacts;
}
-
+
} \ No newline at end of file
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
index a136ff778d..80e0a95b27 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
@@ -43,6 +43,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@XmlAccessorType(XmlAccessType.FIELD)
public class CreateVfModuleRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String vnfId;
@@ -75,6 +76,14 @@ public class CreateVfModuleRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
index d402004d57..a1443f569a 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
@@ -39,6 +39,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@XmlAccessorType(XmlAccessType.FIELD)
public class CreateVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String volumeGroupName;
private String volumeGroupId;
@@ -65,6 +66,14 @@ public class CreateVolumeGroupRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java
index 6ce9b2fa4c..d9825ddca2 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java
@@ -37,6 +37,7 @@ public class DeleteVfModuleRequest extends VfRequestCommon implements Serializab
*/
private static final long serialVersionUID = -8504083539107392561L;
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String vnfId;
private String vfModuleId;
@@ -56,6 +57,14 @@ public class DeleteVfModuleRequest extends VfRequestCommon implements Serializab
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java
index d17c5dd0de..aba53a4dd3 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,6 +32,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
@XmlRootElement(name = "deleteVolumeGroupRequest")
public class DeleteVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String volumeGroupId;
private String volumeGroupStackId;
@@ -49,6 +50,14 @@ public class DeleteVolumeGroupRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
@@ -80,7 +89,7 @@ public class DeleteVolumeGroupRequest extends VfRequestCommon {
public void setMsoRequest(MsoRequest msoRequest) {
this.msoRequest = msoRequest;
}
-
+
@Override
public String toString() {
return new ToStringBuilder(this).appendSuper(super.toString()).append("cloudSiteId", cloudSiteId)
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
index bac9eae2c5..a02dc1f94e 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,6 +40,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
public class UpdateVfModuleRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String vnfId;
@@ -62,7 +63,7 @@ public class UpdateVfModuleRequest extends VfRequestCommon {
private String requestType;
private Boolean failIfExists;
private Boolean backout;
-
+
@XmlJavaTypeAdapter(MapAdapter.class)
private Map<String,Object> vfModuleParams = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
@@ -75,6 +76,14 @@ public class UpdateVfModuleRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
index d3b685a1d0..e7c8171d6c 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,6 +39,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@XmlAccessorType(XmlAccessType.FIELD)
public class UpdateVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String volumeGroupId;
private String volumeGroupStackId;
@@ -62,6 +63,14 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
index 0e716e5924..a6a988690c 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,6 +36,7 @@ public class VfModuleRollback {
private String vfModuleStackId;
private boolean vfModuleCreated = false;
private String tenantId;
+ private String cloudOwner;
private String cloudSiteId;
private MsoRequest msoRequest;
private String messageId;
@@ -51,6 +52,7 @@ public class VfModuleRollback {
this.vfModuleStackId = vfModuleStackId;
this.vfModuleCreated = vrb.getVnfCreated();
this.tenantId = vrb.getTenantId();
+ this.cloudOwner = vrb.getCloudOwner();
this.cloudSiteId = vrb.getCloudSiteId();
this.msoRequest = vrb.getMsoRequest();
this.messageId = messageId;
@@ -59,6 +61,7 @@ public class VfModuleRollback {
public VfModuleRollback(String vnfId, String vfModuleId,
String vfModuleStackId, boolean vfModuleCreated, String tenantId,
+ String cloudOwner,
String cloudSiteId,
MsoRequest msoRequest,
String messageId) {
@@ -68,6 +71,7 @@ public class VfModuleRollback {
this.vfModuleStackId = vfModuleStackId;
this.vfModuleCreated = vfModuleCreated;
this.tenantId = tenantId;
+ this.cloudOwner = cloudOwner;
this.cloudSiteId = cloudSiteId;
this.msoRequest = msoRequest;
this.messageId = messageId;
@@ -109,6 +113,12 @@ public class VfModuleRollback {
public void setCloudSiteId(String cloudSiteId) {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
public MsoRequest getMsoRequest() {
return msoRequest;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java
index 2795ba0de3..ea7ce582ad 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,6 +34,7 @@ public class VolumeGroupRollback {
// “volumeGroupId”: “<A&AI_ VOLUME_GROUP_ID>”,
// “volumeGroupStackId”: “<VOLUME_GROUP _STACK_ID>”,
// “tenantId”: “<TENANT_ID>”,
+// "cloudOwnerId"" "<CLOUD_OWNER>",
// “cloudSiteId”: “<CLOUD_CLLI>”,
// “volumeGroupCreated”: TRUE|FALSE,
// “msoRequest”: {
@@ -45,6 +46,7 @@ public class VolumeGroupRollback {
private String volumeGroupId;
private String volumeGroupStackId;
private String tenantId;
+ private String cloudOwnerId;
private String cloudSiteId;
private boolean volumeGroupCreated = false;
private MsoRequest msoRequest;
@@ -58,6 +60,7 @@ public class VolumeGroupRollback {
this.volumeGroupId = vrb.getVolumeGroupId();
this.volumeGroupStackId = volumeGroupStackId;
this.tenantId = vrb.getTenantId();
+ this.cloudOwnerId = vrb.getCloudOwnerId();
this.cloudSiteId = vrb.getCloudSiteId();
this.volumeGroupCreated = vrb.isVolumeGroupCreated();
this.msoRequest = vrb.getMsoRequest();
@@ -69,6 +72,7 @@ public class VolumeGroupRollback {
String volumeGroupStackId,
boolean volumeGroupCreated,
String tenantId,
+ String cloudOwnerId,
String cloudSiteId,
MsoRequest msoRequest,
String messageId)
@@ -78,6 +82,7 @@ public class VolumeGroupRollback {
this.volumeGroupStackId = volumeGroupStackId;
this.volumeGroupCreated = volumeGroupCreated;
this.tenantId = tenantId;
+ this.cloudOwnerId = cloudOwnerId;
this.cloudSiteId = cloudSiteId;
this.msoRequest = msoRequest;
this.messageId = messageId;
@@ -107,7 +112,12 @@ public class VolumeGroupRollback {
public void setCloudSiteId(String cloudSiteId) {
this.cloudSiteId = cloudSiteId;
}
- public boolean isVolumeGroupCreated() {
+ public String getCloudOwnerId() {
+ return cloudOwnerId;
+ }
+ public void setCloudOwnerId(String cloudOwnerId) {
+ this.cloudOwnerId = cloudOwnerId;
+ }public boolean isVolumeGroupCreated() {
return volumeGroupCreated;
}
public void setVolumeGroupCreated(boolean volumeGroupCreated) {
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
index ba7f6532e1..1c7164a0a0 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,6 +31,7 @@ import org.onap.so.entity.MsoRequest;
public class VnfRollback {
private String vnfId;
private String tenantId;
+ private String cloudOwner;
private String cloudSiteId;
private boolean tenantCreated = false;
private boolean vnfCreated = false;
@@ -49,9 +50,10 @@ public class VnfRollback {
/**
* For backwards compatibility... orchestration mode defaults to HEAT
- *
+ *
* @param vnfId
* @param tenantId
+ * @param cloudOwner
* @param cloudSiteId
* @param tenantCreated
* @param vnfCreated
@@ -61,13 +63,14 @@ public class VnfRollback {
* @param requestType
* @param modelCustomizationUuid
*/
- public VnfRollback(String vnfId, String tenantId, String cloudSiteId,
+ public VnfRollback(String vnfId, String tenantId, String cloudOwner, String cloudSiteId,
boolean tenantCreated, boolean vnfCreated,
MsoRequest msoRequest,
String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) {
super();
this.vnfId = vnfId;
this.tenantId = tenantId;
+ this.cloudOwner = cloudOwner;
this.cloudSiteId = cloudSiteId;
this.tenantCreated = tenantCreated;
this.vnfCreated = vnfCreated;
@@ -79,9 +82,10 @@ public class VnfRollback {
}
/**
- *
+ *
* @param vnfId
* @param tenantId
+ * @param cloudOwner
* @param cloudSiteId
* @param tenantCreated
* @param vnfCreated
@@ -91,13 +95,14 @@ public class VnfRollback {
* @param requestType
* @param modelCustomizationUuid
*/
- public VnfRollback(String vnfId, String tenantId, String cloudSiteId,
+ public VnfRollback(String vnfId, String tenantId, String cloudOwner, String cloudSiteId,
boolean tenantCreated, boolean vnfCreated,
MsoRequest msoRequest, String volumeGroupName, String volumeGroupId,
String requestType, String modelCustomizationUuid, String orchestrationMode) {
super();
this.vnfId = vnfId;
this.tenantId = tenantId;
+ this.cloudOwner = cloudOwner;
this.cloudSiteId = cloudSiteId;
this.tenantCreated = tenantCreated;
this.vnfCreated = vnfCreated;
@@ -128,6 +133,12 @@ public class VnfRollback {
public void setCloudSiteId(String cloudId) {
this.cloudSiteId = cloudId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
public boolean getTenantCreated() {
return tenantCreated;
}
@@ -204,7 +215,7 @@ public class VnfRollback {
}
@Override
public String toString() {
- return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId +
+ return "VnfRollback: owner=" + cloudOwner + ", cloud=" + cloudSiteId + ", tenant=" + tenantId +
", vnf=" + vnfId + ", tenantCreated=" + tenantCreated +
", vnfCreated=" + vnfCreated + ", requestType = " + requestType
+ ", modelCustomizationUuid=" + this.modelCustomizationUuid
diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
index 76ba3695f2..1ff24a50f6 100644
--- a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
+++ b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
@@ -1,5 +1,6 @@
<createVfModuleRequest>
<cloudSiteId>RegionOne</cloudSiteId>
+ <cloudOwner>CloudOwner</cloudOwner>
<tenantId>09d8566ea45e43aa974cf447ed591d77</tenantId>
<vnfId>8daea639-82b9-4da6-aec9-5054f006a82d</vnfId>
<vnfName>vcpe_vnf_vcpe_infra_201903101808</vnfName>
@@ -203,4 +204,4 @@
</msoRequest>
<messageId>11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</messageId>
<notificationUrl>http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/VNFAResponse/11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</notificationUrl>
-</createVfModuleRequest> \ No newline at end of file
+</createVfModuleRequest>
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
new file mode 100644
index 0000000000..3d8f68408d
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
@@ -0,0 +1,32 @@
+USE catalogdb;
+DELETE FROM temp_network_heat_template_lookup WHERE HEAT_TEMPLATE_ARTIFACT_UUID = 'efee1d84-b8ec-11e7-abc4-cec278b6b50a';
+DELETE FROM heat_template WHERE ARTIFACT_UUID = 'efee1d84-b8ec-11e7-abc4-cec278b6b50a';
+INSERT INTO `heat_template` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`BODY`,`TIMEOUT_MINUTES`,`DESCRIPTION`,`CREATION_TIMESTAMP`,`ARTIFACT_CHECKSUM`) VALUES
+('efee1d84-b8ec-11e7-abc4-cec278b6b50a','Generic NeutronNet','1','
+heat_template_version: 2013-05-23
+description: A simple Neutron network
+parameters:
+ network_name:
+ type: string
+ description: Name of the Neutron Network
+ default: ONAP-NW1
+ shared:
+ type: boolean
+ description: Shared amongst tenants
+ default: False
+outputs:
+ network_id:
+ description: Openstack network identifier
+ value: { get_resource: network }
+resources:
+ network:
+ type: OS::Neutron::Net
+ properties:
+ name: { get_param: network_name }
+ shared: { get_param: shared }',10,'Generic Neutron Template','2017-10-26 14:44:00', 'MANUAL RECORD');
+
+
+
+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');
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql
new file mode 100644
index 0000000000..f09c7362d5
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6__Fix_CVNFC_Customization.sql
@@ -0,0 +1,23 @@
+use catalogdb;
+
+DROP TABLE vnf_vfmodule_cvnfc_configuration_customization;
+
+CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `CONFIGURATION_TYPE` VARCHAR(200) NULL,
+ `CONFIGURATION_ROLE` VARCHAR(200) NULL,
+ `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
+ `POLICY_NAME` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL,
+ `CVNFC_CUSTOMIZATION_ID` INT(11) DEFAULT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
+
+ CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql
new file mode 100644
index 0000000000..e44a6b97ba
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7__WorkFlowDesignerTables.sql
@@ -0,0 +1,175 @@
+USE catalogdb;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`workflow` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `ARTIFACT_UUID` VARCHAR(200) NOT NULL,
+ `ARTIFACT_NAME` VARCHAR(200) NOT NULL,
+ `NAME` VARCHAR(200) NOT NULL,
+ `OPERATION_NAME` VARCHAR(200) NULL,
+ `VERSION` DOUBLE NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL,
+ `BODY` LONGTEXT NULL,
+ `RESOURCE_TARGET` VARCHAR(200) NOT NULL,
+ `SOURCE` VARCHAR(200) NOT NULL,
+ `TIMEOUT_MINUTES` INT(11) NULL DEFAULT NULL,
+ `ARTIFACT_CHECKSUM` VARCHAR(200) NULL DEFAULT 'MANUAL RECORD',
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_workflow` (`ARTIFACT_UUID` ASC, `NAME` ASC, `VERSION` ASC, `SOURCE` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`vnf_resource_to_workflow` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `VNF_RESOURCE_MODEL_UUID` VARCHAR(200) NOT NULL,
+ `WORKFLOW_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_vnf_resource_to_workflow` (`VNF_RESOURCE_MODEL_UUID` ASC, `WORKFLOW_ID` ASC),
+ INDEX `fk_vnf_resource_to_workflow__workflow1_idx` (`WORKFLOW_ID` ASC),
+ INDEX `fk_vnf_resource_to_workflow__vnf_res_mod_uuid_idx` (`VNF_RESOURCE_MODEL_UUID` ASC),
+ CONSTRAINT `fk_vnf_resource_to_workflow__vnf_resource1`
+ FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`)
+ REFERENCES `catalogdb`.`vnf_resource` (`MODEL_UUID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_vnf_resource_to_workflow__workflow1`
+ FOREIGN KEY (`WORKFLOW_ID`)
+ REFERENCES `catalogdb`.`workflow` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NOT NULL,
+ `VERSION` DOUBLE NOT NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec` (`NAME` ASC, `VERSION` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`user_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ `PAYLOAD_LOCATION` VARCHAR(500) NULL,
+ `LABEL` VARCHAR(200) NOT NULL,
+ `TYPE` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL,
+ `IS_REQUIRED` TINYINT(1) NOT NULL,
+ `MAX_LENGTH` INT(11) NULL,
+ `ALLOWABLE_CHARS` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_user_parameters` (`NAME` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`workflow_activity_spec_sequence` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `WORKFLOW_ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `SEQ_NO` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_workflow_activity_spec_sequence` (`WORKFLOW_ID` ASC, `ACTIVITY_SPEC_ID` ASC, `SEQ_NO` ASC),
+ INDEX `fk_workflow_activity_spec_sequence__activity_spec_idx` (`ACTIVITY_SPEC_ID` ASC),
+ INDEX `fk_workflow_activity_spec_sequence__workflow_actifact_uuid_idx` (`WORKFLOW_ID` ASC),
+ CONSTRAINT `fk_workflow_activity_spec_sequence__activity_spec1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `catalogdb`.`activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_workflow_activity_spec_sequence__workflow1`
+ FOREIGN KEY (`WORKFLOW_ID`)
+ REFERENCES `catalogdb`.`workflow` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NAME` VARCHAR(200) NOT NULL,
+ `TYPE` VARCHAR(200) NOT NULL,
+ `DIRECTION` VARCHAR(200) NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_parameters` (`NAME` ASC, `DIRECTION` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_categories` (
+ `ID` INT(11) NOT NULL,
+ `NAME` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_categories` (`NAME` ASC))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_to_activity_spec_categories` (
+ `ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_CATEGORIES_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_to_activity_spec_categories` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_CATEGORIES_ID` ASC),
+ INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx` (`ACTIVITY_SPEC_CATEGORIES_ID` ASC),
+ INDEX `fk_activity_spec_to_activity_spec_categories__activity_spec_idx1` (`ACTIVITY_SPEC_ID` ASC),
+ CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `catalogdb`.`activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_activity_spec_categories__activity_spec_c1`
+ FOREIGN KEY (`ACTIVITY_SPEC_CATEGORIES_ID`)
+ REFERENCES `catalogdb`.`activity_spec_categories` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_to_activity_spec_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_PARAMETERS_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_activity_spec_to_activity_spec_params__act_sp_param_id_idx` (`ACTIVITY_SPEC_PARAMETERS_ID` ASC),
+ UNIQUE INDEX `UK_activity_spec_to_activity_spec_parameters` (`ACTIVITY_SPEC_ID` ASC, `ACTIVITY_SPEC_PARAMETERS_ID` ASC),
+ INDEX `fk_activity_spec_to_activity_spec_parameters__act_spec_id_idx` (`ACTIVITY_SPEC_ID` ASC),
+ CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activity_spec_1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `catalogdb`.`activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_activity_spec_parameters__activ_spec_param1`
+ FOREIGN KEY (`ACTIVITY_SPEC_PARAMETERS_ID`)
+ REFERENCES `catalogdb`.`activity_spec_parameters` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `catalogdb`.`activity_spec_to_user_parameters` (
+ `ID` INT(11) NOT NULL,
+ `ACTIVITY_SPEC_ID` INT(11) NOT NULL,
+ `USER_PARAMETERS_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_activity_spec_to_user_parameters` (`ACTIVITY_SPEC_ID` ASC, `USER_PARAMETERS_ID` ASC),
+ INDEX `fk_activity_spec_to_user_parameters__user_parameters1_idx` (`USER_PARAMETERS_ID` ASC),
+ INDEX `fk_activity_spec_to_user_parameters__activity_spec1_idx` (`ACTIVITY_SPEC_ID` ASC),
+ CONSTRAINT `fk_activity_spec_to_user_parameters__activity_spec1`
+ FOREIGN KEY (`ACTIVITY_SPEC_ID`)
+ REFERENCES `catalogdb`.`activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_user_parameters__user_parameters1`
+ FOREIGN KEY (`USER_PARAMETERS_ID`)
+ REFERENCES `catalogdb`.`user_parameters` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index 0f5ad6d92f..a97029ef5b 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -21,6 +21,13 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import static org.junit.Assert.*;
+import static org.onap.so.logger.MdcConstants.ENDTIME;
+import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
+import static org.onap.so.logger.MdcConstants.PARTNERNAME;
+import static org.onap.so.logger.MdcConstants.RESPONSECODE;
+import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
+import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
+import static org.onap.so.logger.MdcConstants.STATUSCODE;
import java.io.IOException;
@@ -39,7 +46,6 @@ import org.junit.runner.RunWith;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
-import org.onap.so.logger.MsoLogger;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.springframework.boot.web.server.LocalServerPort;
@@ -833,22 +839,22 @@ public class CatalogDBRestTest {
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("v2/vfModules",mdc.get(SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(STATUSCODE));
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(ENDTIME));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("500",mdc.get(MsoLogger.RESPONSECODE));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("ERROR",mdc.get(MsoLogger.STATUSCODE));
- assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("500",mdc.get(RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("v2/vfModules",mdc.get(SERVICE_NAME));
+ assertEquals("ERROR",mdc.get(STATUSCODE));
+ assertNotNull(mdc.get(RESPONSEDESC));
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
index 89f4824492..898e8eadf1 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
@@ -89,7 +89,7 @@ public class CvnfcCatalogDbQueryTest {
CvnfcCustomization found = foundCvnfcCustomization.get(0);
CvnfcCustomization templateCvnfcCustomization = new CvnfcCustomization();
- BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization");
+ BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization", "vfModuleCustomization", "vnfcCustomization", "vnfResourceCustomization");
assertThat(cvnfcCustomization, sameBeanAs(templateCvnfcCustomization)
.ignoring("id")
@@ -99,86 +99,23 @@ public class CvnfcCatalogDbQueryTest {
}
@Test
- public void getLinkedVnfVfmoduleCvnfcConfigurationCustomizationTest() {
+ public void cVnfcByCustomizationUUID_Test() {
- CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("0c042562-2bac-11e9-b210-d663bd873d93");
-
- VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
- vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
- cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
-
- ConfigurationResource configurationResource = new ConfigurationResource();
- configurationResource.setToscaNodeType("FabricConfiguration");
- configurationResource.setModelInvariantUUID("modelInvariantUUID");
- configurationResource.setModelUUID("modelUUID");
- configurationResource.setModelName("modelName");
- configurationResource.setModelVersion("modelVersion");
- configurationResource.setDescription("description");
- configurationResource.setToscaNodeType("toscaNodeTypeFC");
-
- VnfResource vnfResource = new VnfResource();
- vnfResource.setModelUUID("6f19c5fa-2b19-11e9-b210-d663bd873d93");
- vnfResource.setModelVersion("modelVersion");
- vnfResource.setOrchestrationMode("orchestrationMode");
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization("dadc2c8c-2bab-11e9-b210-d663bd873d93");
+
+ CvnfcCustomization found = client.getCvnfcCustomizationByCustomizationUUID("dadc2c8c-2bab-11e9-b210-d663bd873d93");
+ assertNotNull(found);
- VfModule vfModule = new VfModule();
- vfModule.setModelUUID("98aa2a6e-2b18-11e9-b210-d663bd873d93");
- vfModule.setModelInvariantUUID("9fe57860-2b18-11e9-b210-d663bd873d93");
- vfModule.setIsBase(true);
- vfModule.setModelName("modelName");
- vfModule.setModelVersion("modelVersion");
- vfModule.setVnfResources(vnfResource);
+ CvnfcCustomization templateCvnfcCustomization = new CvnfcCustomization();
+ BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization", "vfModuleCustomization", "vnfcCustomization", "vnfResourceCustomization");
- VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
- vfModuleCustomization.setModelCustomizationUUID("bdbf984a-2b16-11e9-b210-d663bd873d93");
- vfModuleCustomization.setVfModule(vfModule);
- cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
-
- VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
- vnfResourceCustomization.setModelCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93");
- vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
- vnfResourceCustomization.setVnfResources(vnfResource);
- cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
-
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
- vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("configurationFunction");
- vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("64627fec-2b1b-11e9-b210-d663bd873d93");
- vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
- vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
- vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName");
- vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization);
- vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization);
-
- Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
- vnfVfmoduleCvnfcConfigurationCustomizationSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
- cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet);
-
- vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
-
- cvnfcCustomizationRepository.save(cvnfcCustomization);
-
- List<CvnfcCustomization> foundCvnfcCustomization = client.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("6912dd02-2b16-11e9-b210-d663bd873d93","bdbf984a-2b16-11e9-b210-d663bd873d93");
- assertNotNull(foundCvnfcCustomization);
- assertTrue(foundCvnfcCustomization.size() > 0);
- CvnfcCustomization found = foundCvnfcCustomization.get(0);
-
- Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = found.getVnfVfmoduleCvnfcConfigurationCustomization();
- if (vnfVfmoduleCvnfcConfigurationCustomizations.size() > 0){
- for(VnfVfmoduleCvnfcConfigurationCustomization customization : vnfVfmoduleCvnfcConfigurationCustomizations) {
- Assert.assertTrue(customization.getConfigurationResource().getToscaNodeType().equalsIgnoreCase("toscaNodeTypeFC"));
- }
- } else {
- Assert.fail("No linked VnfVfmoduleCvnfcConfigurationCustomization found for CvnfcCustomization");
- }
-
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomizationFound = client.
- getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(
- "6912dd02-2b16-11e9-b210-d663bd873d93",
- "bdbf984a-2b16-11e9-b210-d663bd873d93",
- "0c042562-2bac-11e9-b210-d663bd873d93");
- assertNotNull(vnfVfmoduleCvnfcConfigurationCustomizationFound);
- System.out.println(vnfVfmoduleCvnfcConfigurationCustomizationFound.getModelCustomizationUUID());
+ assertThat(cvnfcCustomization, sameBeanAs(templateCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
}
+
protected CvnfcCustomization setUpCvnfcCustomization(String id){
CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
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 d28784bb93..ea8cb5d616 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
@@ -23,13 +23,9 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.when;
import java.util.List;
import java.util.UUID;
-
-import javax.ws.rs.core.UriBuilder;
-
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -54,20 +50,15 @@ import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
import org.onap.so.db.catalog.beans.VnfRecipe;
import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
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.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.mock.mockito.MockBean;
-import org.springframework.security.core.parameters.P;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
@RunWith(SpringRunner.class)
@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
@@ -201,7 +192,6 @@ public class CatalogDbClientTest {
Assert.assertNotNull(vnfResourceCustomization.getVnfResources());
Assert.assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
Assert.assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
-
}
@Test
@@ -659,7 +649,6 @@ public class CatalogDbClientTest {
pnfResource.getModelInvariantUUID());
assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
-
}
@Test
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index cb35e90860..73f50ed908 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -10,11 +10,13 @@
<packaging>jar</packaging>
<name>mso-openstack-adapters</name>
<description>Consolidate openstack adapters into one Spring Boot project</description>
-
+ <properties>
+ <openfeign.version>10.1.0</openfeign.version>
+ </properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
-
- <plugins>
+
+ <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -211,12 +213,44 @@
<artifactId>janino</artifactId>
<version>2.5.15</version>
</dependency>
-
- <!-- end added for spring boot support -->
-
-
-
- <!-- added for unit testing -->
+
+ <!-- end added for spring boot support -->
+
+ <dependency>
+ <groupId>org.pacesys</groupId>
+ <artifactId>openstack4j-core</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.pacesys.openstack4j.connectors</groupId>
+ <artifactId>openstack4j-httpclient</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.typesafe</groupId>
+ <artifactId>config</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>jsr305</artifactId>
+ <version>1.3.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-validator</groupId>
+ <artifactId>commons-validator</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+
+ <!-- added for unit testing -->
<dependency>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-adapter-utils</artifactId>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
index 19e3ab71f5..72dee07379 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
@@ -34,6 +34,7 @@ import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +44,7 @@ import com.woorea.openstack.heat.model.Link;
import com.woorea.openstack.heat.model.Resource;
import com.woorea.openstack.heat.model.Resources;
import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.quantum.model.Port;
@Component
public class HeatStackAudit {
@@ -55,6 +57,9 @@ public class HeatStackAudit {
protected MsoHeatUtils heat;
@Autowired
+ protected MsoNeutronUtils neutron;
+
+ @Autowired
protected AuditVServer auditVservers;
public boolean auditHeatStackCreate(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) {
@@ -82,8 +87,9 @@ public class HeatStackAudit {
if(novaResources.isEmpty())
return true;
else{
+ List<Optional<Port>> neutronPortDetails = retrieveNeutronPortDetails(resources,cloudRegion,tenantId);
List<Resource> resourceGroups = extractResourceGroups(resources);
- Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources);
+ Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources,neutronPortDetails);
Set<Vserver> vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups,
vserversToAudit);
if(isCreateAudit){
@@ -186,18 +192,16 @@ public class HeatStackAudit {
lInterface.getInterfaceId(),subinterfaceStack.getId());
}
- protected Set<Vserver> createVserverSet(Resources resources, List<Resource> novaResources) {
+ protected Set<Vserver> createVserverSet(Resources resources, List<Resource> novaResources, List<Optional<Port>> neutronPortDetails) {
Set<Vserver> vserversToAudit = new HashSet<>();
for (Resource novaResource : novaResources) {
Vserver auditVserver = new Vserver();
auditVserver.setLInterfaces(new LInterfaces());
auditVserver.setVserverId(novaResource.getPhysicalResourceId());
- Stream<Resource> filteredNeutronNetworks = resources.getList().stream()
- .filter(resource -> resource.getRequiredBy().contains(novaResource.getLogicalResourceId()))
- .filter(resource -> "OS::Neutron::Port".equals(resource.getType()));
- filteredNeutronNetworks.forEach(network -> {
+ Stream<Port> filteredNeutronPorts = filterNeutronPorts(novaResource, neutronPortDetails);
+ filteredNeutronPorts.forEach(port -> {
LInterface lInterface = new LInterface();
- lInterface.setInterfaceId(network.getPhysicalResourceId());
+ lInterface.setInterfaceId(port.getId());
auditVserver.getLInterfaces().getLInterface().add(lInterface);
});
vserversToAudit.add(auditVserver);
@@ -205,6 +209,31 @@ public class HeatStackAudit {
return vserversToAudit;
}
+ /**
+ * @param novaResource Single openstack resource that is of type Nova
+ * @param neutronPorts List of Neutron ports created within the stack
+ * @return Filtered list of neutron ports taht relate to the nova server in openstack
+ */
+ protected Stream<Port> filterNeutronPorts(Resource novaResource, List<Optional<Port>> neutronPorts) {
+ List<Port> filteredNeutronPorts = neutronPorts.stream().filter(Optional::isPresent).map(Optional::get)
+ .collect(Collectors.toList());
+ return filteredNeutronPorts.stream()
+ .filter(port -> port.getDeviceId().equalsIgnoreCase(novaResource.getPhysicalResourceId()));
+ }
+
+ /**
+ * @param resources Resource stream created by the stack in openstack
+ * @param cloudSiteId Unique site id to identify which openstack we talk to
+ * @param tenantId The tenant within the cloud we are talking to where resouces exist
+ * @return List of optional neutron ports found within the cloud site and tenant
+ */
+ protected List<Optional<Port>> retrieveNeutronPortDetails(Resources resources,String cloudSiteId,String tenantId){
+ return resources.getList().stream()
+ .filter(resource -> "OS::Neutron::Port".equals(resource.getType()))
+ .map(resource -> neutron.getNeutronPort(resource.getPhysicalResourceId(),cloudSiteId,tenantId)).collect(Collectors.toList());
+
+ }
+
protected Optional<String> extractResourcePathFromHref(String href) {
try {
Optional<String> stackPath = extractStackPathFromHref(href);
@@ -234,3 +263,4 @@ public class HeatStackAudit {
}
}
+
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java
index 613ab0d2f9..7febf7e9a0 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java
@@ -26,8 +26,8 @@ package org.onap.so.adapters.network;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,7 +49,7 @@ public class ContrailPolicyRef {
catch (Exception e)
{
logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR,
- MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ ErrorCode.SchemaError.getValue(), e);
}
return node;
@@ -66,7 +66,7 @@ public class ContrailPolicyRef {
catch (Exception e)
{
logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR,
- MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ ErrorCode.SchemaError.getValue(), e);
}
return jsonString;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
index 6f80e0ee15..2662cef16e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
@@ -27,8 +27,9 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.List;
+
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.HostRoute;
import org.onap.so.openstack.beans.Pool;
import org.onap.so.openstack.beans.Subnet;
@@ -133,7 +134,7 @@ public class ContrailSubnet {
catch (Exception e)
{
logger.error("{} {} Error creating JsonNode for Contrail Subnet: {} ", MessageEnum.RA_MARSHING_ERROR,
- MsoLogger.ErrorCode.SchemaError.getValue(), subnetName, e);
+ ErrorCode.SchemaError.getValue(), subnetName, e);
}
return node;
@@ -150,7 +151,7 @@ public class ContrailSubnet {
catch (Exception e)
{
logger.error("{} {} Error creating JsonString for Contrail Subnet: {} ", MessageEnum.RA_MARSHING_ERROR,
- MsoLogger.ErrorCode.SchemaError.getValue(), subnetName, e);
+ ErrorCode.SchemaError.getValue(), subnetName, e);
}
return jsonString;
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 d0ffa27027..53fa2f6dc2 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -46,8 +46,8 @@ import org.onap.so.adapters.network.async.client.QueryNetworkNotification;
import org.onap.so.adapters.network.async.client.UpdateNetworkNotification;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.NetworkStatus;
import org.onap.so.openstack.beans.Subnet;
@@ -176,7 +176,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e1);
+ ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -184,7 +184,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
notifyPort.createNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null);
} catch (Exception e1) {
logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1);
+ ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
@@ -203,7 +203,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
copyNrb (networkRollback));
} catch (Exception e) {
logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
+ ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
@@ -294,7 +294,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e1);
+ ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -302,7 +302,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
notifyPort.updateNetworkNotification (messageId, false, exCat, eMsg, null, copyNrb (networkRollback));
} catch (Exception e1) {
logger.error("{} {} Error sending updateNetwork notification {} ",
- MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(),
+ MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(),
e1);
}
@@ -320,7 +320,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
copyNrb (networkRollback));
} catch (Exception e) {
logger.error("{} {} Error sending updateNotification request {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
+ ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
}
@@ -374,7 +374,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e1);
+ ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -382,7 +382,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null);
} catch (Exception e1) {
logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1);
+ ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
}
@@ -403,7 +403,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
copyQuerySubnetIdMap (subnetIdMap));
} catch (Exception e) {
logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
+ ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
}
@@ -456,7 +456,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e1);
+ ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -464,7 +464,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null);
} catch (Exception e1) {
logger.error("{} {} Error sending createNetwork notification {} ",
- MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(),
+ MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(),
e1);
}
@@ -477,7 +477,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
notifyPort.deleteNetworkNotification (messageId, true, null, null, networkDeleted.value);
} catch (Exception e) {
logger.error("{} {} Error sending deleteNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
+ ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
@@ -497,7 +497,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
// rollback may be null (e.g. if network already existed when Create was called)
if (rollback == null) {
logger.warn("{} {} Rollback is null", MessageEnum.RA_ROLLBACK_NULL,
- MsoLogger.ErrorCode.SchemaError.getValue());
+ ErrorCode.SchemaError.getValue());
return;
}
@@ -517,7 +517,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
logger.error("{} {} Exception in get fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e1);
+ ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -525,7 +525,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), false, exCat, eMsg);
} catch (Exception e1) {
logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1);
+ ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
@@ -538,7 +538,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
} catch (Exception e) {
logger
.error("{} {} Error sending rollbackNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
+ ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
@@ -578,17 +578,17 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("NetworkAdapterNotify.wsdl");
} catch (Exception e) {
logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND,
- MsoLogger.ErrorCode.DataError.getValue(), e);
+ ErrorCode.DataError.getValue(), e);
}
if (warWsdlLoc == null) {
logger
- .error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue());
+ .error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, ErrorCode.DataError.getValue());
} else {
try {
logger.debug("NetworkAdpaterNotify.wsdl location: {}", warWsdlLoc.toURI().toString());
} catch (Exception e) {
logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC,
- MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ ErrorCode.SchemaError.getValue(), e);
}
}
@@ -605,7 +605,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
epUrl = new URL (notificationUrl);
} catch (MalformedURLException e1) {
logger.error("{} {} Exception - init notification ", MessageEnum.RA_INIT_NOTIF_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), e1);
+ ErrorCode.DataError.getValue(), e1);
}
if(null != epUrl) {
@@ -628,7 +628,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
headers.put ("Authorization", Collections.singletonList (basicAuth));
} catch (Exception e) {
logger.error("{} {} Unable to set authorization in callback request {} ",
- MessageEnum.RA_SET_CALLBACK_AUTH_EXC, MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
+ MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return notifyPort;
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 fc2fc4844b..2e8c7990db 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
@@ -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.
@@ -49,8 +49,8 @@ import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationReposi
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.NetworkInfo;
import org.onap.so.openstack.beans.NetworkRollback;
@@ -89,7 +89,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork";
private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
private static final String NEUTRON_MODE = "NEUTRON";
-
+
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@Autowired
@@ -104,13 +104,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private MsoHeatUtilsWithUpdate heatWithUpdate;
@Autowired
private MsoCommonUtils commonUtils;
-
- @Autowired
+
+ @Autowired
private NetworkResourceCustomizationRepository networkCustomRepo;
-
+
@Autowired
private CollectionNetworkResourceCustomizationRepository collectionNetworkCustomRepo;
-
+
@Autowired
private NetworkResourceRepository networkResourceRepo;
/**
@@ -288,7 +288,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String error = String
.format("Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration",
networkName, cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -318,7 +318,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
logger.error(
"{} {} Exception while querying network {} for CloudSite {} from Tenant {} from OpenStack ",
- MessageEnum.RA_QUERY_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ MessageEnum.RA_QUERY_NETWORK_EXC, ErrorCode.BusinessProcesssError.getValue(),
networkName, cloudSiteId, tenantId, me);
me.addContext (CREATE_NETWORK_CONTEXT);
throw new NetworkException (me);
@@ -332,7 +332,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
.format("Create Nework: Network %s already exists in %s/%s with ID %s", networkName,
cloudSiteId, tenantId, netInfo.getId());
logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST,
- MsoLogger.ErrorCode.DataError.getValue(), error);
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing network.
@@ -340,7 +340,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
neutronNetworkId.value = netInfo.getId ();
rollback.value = networkRollback; // Default rollback - no updates performed
logger.warn("{} {} Found Existing network, status={} for Neutron mode ",
- MessageEnum.RA_NETWORK_ALREADY_EXIST, MsoLogger.ErrorCode.DataError.getValue(),
+ MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(),
netInfo.getStatus());
}
return;
@@ -357,7 +357,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
logger.error("{} {} Create Network: type {} in {}/{}: ", MessageEnum.RA_CREATE_NETWORK_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), neutronNetworkType, cloudSiteId, tenantId, me);
+ ErrorCode.DataError.getValue(), neutronNetworkType, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -382,7 +382,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (heatTemplate == null) {
String error = String
.format("Network error - undefined Heat Template. Network Type = %s", networkType);
- logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(),
error);
throw new NetworkException (error, MsoExceptionCategory.INTERNAL);
}
@@ -406,11 +406,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryNetworkStarttime = System.currentTimeMillis ();
try {
- heatStack = heat.queryStack (cloudSiteId, tenantId, networkName);
+ heatStack = heat.queryStack (cloudSiteId, "CloudOwner", tenantId, networkName);
} catch (MsoException me) {
me.addContext (CREATE_NETWORK_CONTEXT);
logger.error("{} {} Create Network (heat): query network {} in {}/{}: ",
- MessageEnum.RA_QUERY_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), networkName,
+ MessageEnum.RA_QUERY_NETWORK_EXC, ErrorCode.DataError.getValue(), networkName,
cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -422,7 +422,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
.format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName, cloudSiteId,
tenantId, heatStack.getCanonicalName());
logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST,
- MsoLogger.ErrorCode.DataError.getValue(), error);
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing stack.
@@ -454,7 +454,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
subnetIdMap.value = sMap;
logger.warn("{} {} Found Existing network stack, status={} networkName={} for {}/{}",
- MessageEnum.RA_NETWORK_ALREADY_EXIST, MsoLogger.ErrorCode.DataError.getValue(),
+ MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(),
heatStack.getStatus(), networkName, cloudSiteId, tenantId);
}
return;
@@ -479,7 +479,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (IllegalArgumentException e) {
String error = "Create Network: Configuration Error: " + e.getMessage ();
logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), error,e);
+ ErrorCode.DataError.getValue(), error,e);
// Input parameters were not valid
throw new NetworkException (error, MsoExceptionCategory.INTERNAL);
}
@@ -498,7 +498,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
me.addContext (CREATE_NETWORK_CONTEXT);
logger
.error("{} {} Exception Create Network, merging subnets for network (heat) type {} in {}/{} ",
- MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(),
+ MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(),
neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -510,7 +510,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext (CREATE_NETWORK_CONTEXT);
logger.error("{} {} Exception Create Network, merging policyRefs type {} in {}/{} ",
- MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(),
+ MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(),
neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -522,7 +522,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext (CREATE_NETWORK_CONTEXT);
logger.error("{} {} Exception Create Network, merging routeTableRefs type {} in {}/{} ",
- MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(),
+ MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(),
neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -534,8 +534,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (backout == null)
backout = true;
heatStack = heat.createStack (cloudSiteId,
+ "CloudOwner",
tenantId,
networkName,
+ null,
template,
stackParams,
true,
@@ -548,7 +550,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
me.addContext (CREATE_NETWORK_CONTEXT);
logger
.error("{} {} Exception creating network type {} in {}/{} ", MessageEnum.RA_CREATE_NETWORK_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me);
+ ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -592,7 +594,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Network {} successfully created via HEAT", networkName);
}
-
+
return;
}
@@ -729,14 +731,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String error = String.format(
"UpdateNetwork: Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration",
networkName, cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
-
+
NetworkResource networkResource = networkCheck(
startTime,
networkType,
@@ -763,7 +765,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - queryNetwork query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), networkId, cloudSiteId, tenantId, me);
+ ErrorCode.BusinessProcesssError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
@@ -771,7 +773,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String error = String
.format("Update Nework: Network %s does not exist in %s/%s", networkId, cloudSiteId, tenantId);
logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), error);
+ ErrorCode.BusinessProcesssError.getValue(), error);
// Does not exist. Throw an exception (can't update a non-existent network)
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -786,7 +788,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - updateNetwork {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR,
- MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
+ ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
@@ -807,18 +809,18 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
+ ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) {
String error = String
.format("UpdateNetwork: Stack %s does not exist in %s/%s", networkName, cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(),
error);
// Network stack does not exist. Return an error
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
@@ -838,7 +840,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
previousVlans.add(Integer.parseInt(vlan));
} catch (NumberFormatException e) {
logger.warn("{} {} Exception - VLAN parse for params {} ", MessageEnum.RA_VLAN_PARSE,
- MsoLogger.ErrorCode.DataError.getValue(), vlansParam, e);
+ ErrorCode.DataError.getValue(), vlansParam, e);
}
}
}
@@ -850,7 +852,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
HeatTemplate heatTemplate = networkResource.getHeatTemplate();
if (heatTemplate == null) {
String error = "Network error - undefined Heat Template. Network Type=" + networkType;
- logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(),
error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -863,9 +865,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
boolean aic3template = false;
String aic3nw = AIC3_NW;
-
+
aic3nw = environment.getProperty(AIC3_NW_PROPERTY, AIC3_NW);
-
+
if (template.contains(aic3nw))
aic3template = true;
@@ -885,7 +887,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams = heat.validateStackParams(stackParams, heatTemplate);
} catch (IllegalArgumentException e) {
String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType;
- logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e);
}
@@ -899,7 +901,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - UpdateNetwork mergeSubnets for network type {} in {}/{} ",
- MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(),
+ MessageEnum.RA_UPDATE_NETWORK_ERR, ErrorCode.DataError.getValue(),
neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
@@ -911,7 +913,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - UpdateNetwork mergePolicyRefs type {} in {}/{} ",
- MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(),
+ MessageEnum.RA_UPDATE_NETWORK_ERR, ErrorCode.DataError.getValue(),
neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
@@ -923,7 +925,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - UpdateNetwork mergeRouteTableRefs type {} in {}/{} ",
- MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(),
+ MessageEnum.RA_UPDATE_NETWORK_ERR, ErrorCode.DataError.getValue(),
neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
@@ -934,6 +936,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long updateStackStarttime = System.currentTimeMillis();
try {
heatStack = heatWithUpdate.updateStack(cloudSiteId,
+ "CloudOwner",
tenantId,
networkId,
template,
@@ -943,7 +946,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - update network {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR,
- MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
+ ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
@@ -1026,7 +1029,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String error = String.format(
"Create/UpdateNetwork: Unable to get network resource with NetworkType: %s or ModelCustomizationUUID:%s",
networkType, modelCustomizationUuid);
- logger.error("{} {} {} ", MessageEnum.RA_UNKOWN_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {} ", MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -1040,7 +1043,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (!("HEAT".equals(mode) || NEUTRON_MODE.equals(mode))) {
String error = "CreateNetwork: Configuration Error: Network Type = " + networkType;
logger.error("{} {} {}", MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
- MsoLogger.ErrorCode.DataError.getValue(), error);
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -1063,7 +1066,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
.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());
- logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -1072,11 +1075,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkName, physicalNetworkName, vlans, routeTargets);
if (!missing.isEmpty()) {
String error = "Create Network: Missing parameters: " + missing;
- logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
-
+
return networkResource;
}
@@ -1157,7 +1160,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
|| commonUtils.isNullOrEmpty(networkNameOrId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException (error, MsoExceptionCategory.USERDATA);
}
@@ -1167,7 +1170,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String error = String
.format("Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration",
networkNameOrId, cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException (error, MsoExceptionCategory.USERDATA);
}
@@ -1180,11 +1183,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis ();
try {
- heatStack = heat.queryStack (cloudSiteId, tenantId, networkNameOrId);
+ heatStack = heat.queryStack (cloudSiteId, "CloudOwner", tenantId, networkNameOrId);
} catch (MsoException me) {
me.addContext ("QueryNetwork");
logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me);
+ ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -1252,7 +1255,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext ("QueryNetwork");
logger.error("{} {} Exception - Query Network (neutron): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me);
+ ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
return;
@@ -1290,18 +1293,18 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
-
+
if (commonUtils.isNullOrEmpty (cloudSiteId)
|| commonUtils.isNullOrEmpty(tenantId)
|| commonUtils.isNullOrEmpty(networkId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException (error, MsoExceptionCategory.USERDATA);
}
// Retrieve the Network Resource definition
NetworkResource networkResource = null;
-
+
if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) {
if (!commonUtils.isNullOrEmpty(networkType)) {
networkResource = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
@@ -1312,7 +1315,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkResource = nrc.getNetworkResource();
}
}
-
+
String mode = "";
if (networkResource != null) {
logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
@@ -1332,7 +1335,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext ("DeleteNetwork");
logger.error("{} {} Delete Network (neutron): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
+ ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
} else { // DEFAULT to ("HEAT".equals (mode))
@@ -1342,10 +1345,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// The deleteStack function in MsoHeatUtils returns NOTFOUND if the stack was not found or if the stack was deleted.
// So query first to report back if stack WAS deleted or just NOTOFUND
StackInfo heatStack = null;
- heatStack = heat.queryStack(cloudSiteId, tenantId, networkId);
+ heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkId);
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND)
{
- heat.deleteStack (tenantId, cloudSiteId, networkId, true);
+ heat.deleteStack (tenantId, "CloudOwner", cloudSiteId, networkId, true);
networkDeleted.value = true;
}
else
@@ -1355,11 +1358,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext ("DeleteNetwork");
logger.error("{} {} Delete Network (heat): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC,
- MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
+ ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
}
-
+
// On success, nothing is returned.
return;
@@ -1381,7 +1384,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (rollback == null) {
logger
- .error("{} {} rollback is null", MessageEnum.RA_ROLLBACK_NULL, MsoLogger.ErrorCode.DataError.getValue());
+ .error("{} {} rollback is null", MessageEnum.RA_ROLLBACK_NULL, ErrorCode.DataError.getValue());
return;
}
@@ -1398,7 +1401,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Retrieve the Network Resource definition
NetworkResource networkResource = null;
if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) {
- networkResource = networkCustomRepo.findOneByNetworkType(networkType).getNetworkResource();
+ networkResource = networkCustomRepo.findOneByNetworkType(networkType).getNetworkResource();
} else {
networkResource = networkCustomRepo.findOneByModelCustomizationUUID(modelCustomizationUuid).getNetworkResource();
}
@@ -1422,7 +1425,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} catch (MsoException me) {
me.addContext ("RollbackNetwork");
logger.error("{} {} Exception - Rollback Network (neutron): {} in {}/{} ",
- MessageEnum.RA_DELETE_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcesssError.getValue(),
networkId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -1431,11 +1434,11 @@ 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, cloudSiteId, networkId, true);
+ heat.deleteStack (tenantId, "CloudOwner", cloudSiteId, networkId, true);
} catch (MsoException me) {
me.addContext ("RollbackNetwork");
logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
- MessageEnum.RA_DELETE_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcesssError.getValue(),
networkId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -1505,7 +1508,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams.put (VLANS, csl);
}
if (routeTargets != null) {
-
+
String rtGlobal = "";
String rtImport = "";
String rtExport = "";
@@ -1528,7 +1531,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Input RT:{}", rt);
String role = rt.getRouteTargetRole();
String rtValue = rt.getRouteTarget();
-
+
if ("IMPORT".equalsIgnoreCase(role))
{
sep = rtImport.isEmpty() ? "" : ",";
@@ -1547,7 +1550,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
-
+
if (!rtImport.isEmpty())
{
stackParams.put ("route_targets_import", rtImport);
@@ -1619,7 +1622,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
catch (Exception e)
{
String error = "Error creating JsonNode for policyRefs Data";
- logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(),
error, e);
throw new MsoAdapterException (error);
}
@@ -1742,7 +1745,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
catch (Exception e)
{
String error = "Error creating JsonNode from input subnets";
- logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, MsoLogger.ErrorCode.DataError.getValue(), error, e);
+ logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e);
throw new MsoAdapterException (error);
}
//update parameters
@@ -1795,7 +1798,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curR = curR.replace ("%subnetId%", subnet.getSubnetId ());
} else {
String error = "Missing Required AAI SubnetId for subnet in HEAT Template";
- logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException (error);
}
@@ -1809,7 +1812,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curR = curR.replace ("%cidr%", subnet.getCidr ());
} else {
String error = "Missing Required cidr for subnet in HEAT Template";
- logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
+ logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException (error);
}
@@ -1892,7 +1895,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
catch (Exception e)
{
logger.error("{} {} Exception getting subnet-uuids ", MessageEnum.RA_MARSHING_ERROR,
- MsoLogger.ErrorCode.DataError.getValue(), e);
+ ErrorCode.DataError.getValue(), e);
}
logger.debug("Return sMap {}", sMap.toString());
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 253f13d57d..4a6d591977 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
@@ -66,8 +66,8 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.adapters.vnf.BpelRestClient;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.NetworkStatus;
import org.onap.so.openstack.beans.RouteTarget;
@@ -126,7 +126,7 @@ public class NetworkAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception while create network ", MessageEnum.RA_CREATE_NETWORK_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -324,7 +324,7 @@ public class NetworkAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception while delete network ", MessageEnum.RA_DELETE_NETWORK_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -450,7 +450,7 @@ public class NetworkAdapterRest {
.build();
} catch (NetworkException e) {
logger.error("{} {} Exception when query VNF ", MessageEnum.RA_QUERY_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
QueryNetworkError err = new QueryNetworkError();
err.setMessage(e.getMessage());
err.setCategory(MsoExceptionCategory.INTERNAL);
@@ -493,7 +493,7 @@ public class NetworkAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception in rollbackNetwork ", MessageEnum.RA_ROLLBACK_NULL,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -588,7 +588,7 @@ public class NetworkAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception in updateNetwork ", MessageEnum.RA_UPDATE_NETWORK_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
index f46a95df91..ceae1caca6 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
@@ -33,8 +33,8 @@ import org.onap.so.adapters.tenant.exceptions.TenantAlreadyExists;
import org.onap.so.adapters.tenant.exceptions.TenantException;
import org.onap.so.adapters.tenantrest.TenantRollback;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.MsoTenant;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
@@ -101,7 +101,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
tUtils = tFactory.getTenantUtils (cloudSiteId);
} catch (MsoCloudSiteNotFound me) {
logger.error("{} {} no implementation found for {}: ", MessageEnum.RA_CREATE_TENANT_ERR,
- MsoLogger.ErrorCode.DataError.getValue(), cloudSiteId, me);
+ ErrorCode.DataError.getValue(), cloudSiteId, me);
throw new TenantException (me);
}
@@ -111,7 +111,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
newTenant = tUtils.queryTenantByName (tenantName, cloudSiteId);
} catch (MsoException me) {
logger.error(OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR,
- MsoLogger.ErrorCode.DataError.getValue(), me);
+ ErrorCode.DataError.getValue(), me);
throw new TenantException (me);
}
if (newTenant == null) {
@@ -120,7 +120,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
try {
newTenantId = tUtils.createTenant (tenantName, cloudSiteId, metadata, backout.booleanValue ());
} catch (MsoException me) {
- logger.error (OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR, MsoLogger.ErrorCode.DataError.getValue(), me);
+ logger.error (OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR, ErrorCode.DataError.getValue(), me);
throw new TenantException (me);
}
tenantRollback.setTenantId (newTenantId);
@@ -129,7 +129,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
} else {
if (failIfExists != null && failIfExists) {
logger.error("{} {} CreateTenant: Tenant {} already exists in {} ", MessageEnum.RA_TENANT_ALREADY_EXIST,
- MsoLogger.ErrorCode.DataError.getValue(), tenantName, cloudSiteId);
+ ErrorCode.DataError.getValue(), tenantName, cloudSiteId);
throw new TenantAlreadyExists (tenantName, cloudSiteId, newTenant.getTenantId ());
}
@@ -159,7 +159,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
tUtils = tFactory.getTenantUtils (cloudSiteId);
} catch (MsoCloudSiteNotFound me) {
logger.error("{} {} no implementation found for {}: ", MessageEnum.RA_CREATE_TENANT_ERR,
- MsoLogger.ErrorCode.DataError.getValue(), cloudSiteId, me);
+ ErrorCode.DataError.getValue(), cloudSiteId, me);
throw new TenantException (me);
}
@@ -184,7 +184,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
}
} catch (MsoException me) {
logger.error("Exception in queryTenant for {}: ", MessageEnum.RA_GENERAL_EXCEPTION,
- MsoLogger.ErrorCode.DataError.getValue(), tenantNameOrId, me);
+ ErrorCode.DataError.getValue(), tenantNameOrId, me);
throw new TenantException (me);
}
return;
@@ -206,7 +206,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
tenantDeleted.value = deleted;
} catch (MsoException me) {
logger.error("{} {} Exception - DeleteTenant {}: ", MessageEnum.RA_DELETE_TEMAMT_ERR,
- MsoLogger.ErrorCode.DataError.getValue(), tenantId, me);
+ ErrorCode.DataError.getValue(), tenantId, me);
throw new TenantException (me);
}
@@ -228,7 +228,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
logger.warn("{} {} rollbackTenant, rollback is null", MessageEnum.RA_ROLLBACK_NULL,
- MsoLogger.ErrorCode.DataError.getValue());
+ ErrorCode.DataError.getValue());
return;
}
@@ -247,7 +247,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
me.addContext (ROLLBACK_TENANT);
// Failed to delete the tenant.
logger.error("{} {} Exception - rollbackTenant {}: ", MessageEnum.RA_ROLLBACK_TENANT_ERR,
- MsoLogger.ErrorCode.DataError.getValue(), tenantId, me);
+ ErrorCode.DataError.getValue(), tenantId, me);
throw new TenantException (me);
}
}
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 5645759b02..b8e504084b 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
@@ -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.
@@ -60,13 +60,13 @@ public class ValetClient {
@Autowired
private Environment environment;
-
+
private static final String VALET_BASE_URL = "org.onap.so.adapters.valet.base_url";
private static final String VALET_BASE_PATH = "org.onap.so.adapters.valet.base_path";
private static final String VALET_AUTH = "org.onap.so.adapters.valet.basic_auth";
private static final String REQ_ID_HEADER_NAME = "X-RequestID";
protected static final String NO_STATUS_RETURNED = "no status returned from Valet";
-
+
private static final String DEFAULT_BASE_URL = "http://localhost:8080/";
private static final String DEFAULT_BASE_PATH = "api/valet/placement/v1";
private static final String DEFAULT_AUTH_STRING = "";
@@ -75,13 +75,13 @@ public class ValetClient {
private static final String BODY=", body=";
@Autowired
private ObjectMapper mapper;
-
+
protected String baseUrl;
protected String basePath;
protected String authString;
-
- /*
- * Setup the properties needed from properties file. Each will fall to a default
+
+ /*
+ * Setup the properties needed from properties file. Each will fall to a default
*/
@PostConstruct
private void setupParams() {
@@ -93,11 +93,11 @@ public class ValetClient {
logger.debug("Error retrieving valet properties. {}", e.getMessage());
}
}
-
+
/*
- * This method will be invoked to send a Create request to Valet.
+ * This method will be invoked to send a Create request to Valet.
*/
- public GenericValetResponse<ValetCreateResponse> callValetCreateRequest(String requestId, String regionId, String tenantId, String serviceInstanceId,
+ public GenericValetResponse<ValetCreateResponse> callValetCreateRequest(String requestId, String regionId, String ownerId, String tenantId, String serviceInstanceId,
String vnfId, String vnfName, String vfModuleId, String vfModuleName, String keystoneUrl, HeatRequest heatRequest) throws Exception {
ResponseEntity<ValetCreateResponse> response = null;
GenericValetResponse<ValetCreateResponse> gvr = null;
@@ -105,12 +105,12 @@ public class ValetClient {
try {
UriBuilder builder = UriBuilder.fromPath(baseUrl).path(basePath).queryParam(REQUEST_ID, requestId);
URI uri = builder.build();
-
- ValetCreateRequest vcr = this.createValetCreateRequest(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
+
+ ValetCreateRequest vcr = this.createValetCreateRequest(regionId, ownerId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
String body = mapper.writeValueAsString(vcr);
HttpHeaders headers = generateHeaders(requestId);
- HttpEntity<String> entity = new HttpEntity<>(body, headers);
-
+ HttpEntity<String> entity = new HttpEntity<>(body, headers);
+
response = getRestTemplate().exchange(uri, HttpMethod.POST, entity, ValetCreateResponse.class);
gvr = this.getGVRFromResponse(response);
} catch (Exception e) {
@@ -119,17 +119,17 @@ public class ValetClient {
}
return gvr;
}
-
+
private RestTemplate getRestTemplate(){
RestTemplate restTemplate = new RestTemplate();
restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
return restTemplate;
}
-
+
/*
- * This method will be invoked to send an Update request to Valet.
+ * This method will be invoked to send an Update request to Valet.
*/
- public GenericValetResponse<ValetUpdateResponse> callValetUpdateRequest(String requestId, String regionId, String tenantId, String serviceInstanceId,
+ public GenericValetResponse<ValetUpdateResponse> callValetUpdateRequest(String requestId, String regionId, String ownerId, String tenantId, String serviceInstanceId,
String vnfId, String vnfName, String vfModuleId, String vfModuleName, String keystoneUrl, HeatRequest heatRequest) throws Exception {
ResponseEntity<ValetUpdateResponse> response = null;
GenericValetResponse<ValetUpdateResponse> gvr = null;
@@ -137,13 +137,13 @@ public class ValetClient {
try {
UriBuilder builder = UriBuilder.fromPath(baseUrl).path(basePath).queryParam(REQUEST_ID, requestId);
URI uri = builder.build();
-
- ValetUpdateRequest vur = this.createValetUpdateRequest(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
+
+ ValetUpdateRequest vur = this.createValetUpdateRequest(regionId, ownerId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
String body = mapper.writeValueAsString(vur);
- HttpHeaders headers = generateHeaders(requestId);
+ HttpHeaders headers = generateHeaders(requestId);
HttpEntity<String> entity = new HttpEntity<>(body, headers);
-
-
+
+
response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetUpdateResponse.class);
gvr = this.getGVRFromResponse(response);
} catch (Exception e) {
@@ -152,25 +152,25 @@ public class ValetClient {
}
return gvr;
}
-
+
/*
* This method will be invoked to send a Delete request to Valet.
*/
- public GenericValetResponse<ValetDeleteResponse> callValetDeleteRequest(String requestId, String regionId, String tenantId, String vfModuleId, String vfModuleName) throws Exception {
+ public GenericValetResponse<ValetDeleteResponse> callValetDeleteRequest(String requestId, String regionId, String ownerId, String tenantId, String vfModuleId, String vfModuleName) throws Exception {
ResponseEntity<ValetDeleteResponse> response = null;
GenericValetResponse<ValetDeleteResponse> gvr = null;
try {
UriBuilder builder = UriBuilder.fromPath(baseUrl).path(basePath).queryParam(REQUEST_ID, requestId);
URI uri = builder.build();
-
- ValetDeleteRequest vdr = this.createValetDeleteRequest(regionId, tenantId, vfModuleId, vfModuleName);
-
+
+ ValetDeleteRequest vdr = this.createValetDeleteRequest(regionId, ownerId, tenantId, vfModuleId, vfModuleName);
+
String body = mapper.writeValueAsString(vdr);
HttpHeaders headers = generateHeaders(requestId);
HttpEntity<String> entity = new HttpEntity<>(body, headers);
-
-
+
+
response = getRestTemplate().exchange(uri, HttpMethod.DELETE, entity, ValetDeleteResponse.class);
gvr = this.getGVRFromResponse(response);
} catch (Exception e) {
@@ -179,9 +179,9 @@ public class ValetClient {
}
return gvr;
}
-
+
/*
- * This method is called to invoke a Confirm request to Valet.
+ * This method is called to invoke a Confirm request to Valet.
*/
public GenericValetResponse<ValetConfirmResponse> callValetConfirmRequest(String requestId, String stackId) throws Exception {
ResponseEntity<ValetConfirmResponse> response = null;
@@ -190,9 +190,9 @@ public class ValetClient {
try {
UriBuilder builder = UriBuilder.fromPath(this.baseUrl).path(this.basePath).path("{requestId}/confirm/");
URI uri = builder.build(requestId);
-
+
ValetConfirmRequest vcr = this.createValetConfirmRequest(stackId);
-
+
String body = mapper.writeValueAsString(vcr);
HttpHeaders headers = generateHeaders(requestId);
HttpEntity<String> entity = new HttpEntity<>(body, headers);
@@ -206,8 +206,8 @@ public class ValetClient {
}
return gvr;
}
-
- /*
+
+ /*
* This method is called to invoke a Rollback request to Valet.
*/
public GenericValetResponse<ValetRollbackResponse> callValetRollbackRequest(String requestId, String stackId, Boolean suppressRollback, String errorMessage) throws Exception {
@@ -217,14 +217,14 @@ public class ValetClient {
try {
UriBuilder builder = UriBuilder.fromPath(this.baseUrl).path(this.basePath).path("{requestId}/rollback/");
URI uri = builder.build(requestId);
-
+
ValetRollbackRequest vrr = this.createValetRollbackRequest(stackId, suppressRollback, errorMessage);
-
+
String body = mapper.writeValueAsString(vrr);
HttpHeaders headers = generateHeaders(requestId);
HttpEntity<String> entity = new HttpEntity<>(body, headers);
-
-
+
+
response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetRollbackResponse.class);
gvr = this.getGVRFromResponse(response);
} catch (Exception e) {
@@ -233,68 +233,71 @@ public class ValetClient {
}
return gvr;
}
-
+
/*
* This method is to construct the ValetCreateRequest pojo
*/
- private ValetCreateRequest createValetCreateRequest(String regionId, String tenantId, String serviceInstanceId,
+ private ValetCreateRequest createValetCreateRequest(String regionId, String ownerId, String tenantId, String serviceInstanceId,
String vnfId, String vnfName, String vfModuleId, String vfModuleName, String keystoneUrl, HeatRequest heatRequest) {
ValetCreateRequest vcr = new ValetCreateRequest();
vcr.setHeatRequest(heatRequest);
vcr.setKeystoneUrl(keystoneUrl);
vcr.setRegionId(regionId);
+ vcr.setOwnerId(ownerId);
vcr.setServiceInstanceId(serviceInstanceId);
vcr.setTenantId(tenantId);
vcr.setVfModuleId(vfModuleId);
vcr.setVfModuleName(vfModuleName);
vcr.setVnfId(vnfId);
vcr.setVnfName(vnfName);
-
+
return vcr;
}
-
+
/*
* This method is to construct the ValetUpdateRequest pojo
*/
- private ValetUpdateRequest createValetUpdateRequest(String regionId, String tenantId, String serviceInstanceId,
+ private ValetUpdateRequest createValetUpdateRequest(String regionId, String ownerId, String tenantId, String serviceInstanceId,
String vnfId, String vnfName, String vfModuleId, String vfModuleName, String keystoneUrl, HeatRequest heatRequest) {
ValetUpdateRequest vur = new ValetUpdateRequest();
vur.setHeatRequest(heatRequest);
vur.setKeystoneUrl(keystoneUrl);
vur.setRegionId(regionId == null ? "" : regionId);
+ vur.setOwnerId(ownerId == null ? "" : ownerId);
vur.setServiceInstanceId(serviceInstanceId == null ? "" : serviceInstanceId);
vur.setTenantId(tenantId == null ? "" : tenantId);
vur.setVfModuleId(vfModuleId == null ? "" : vfModuleId);
vur.setVfModuleName(vfModuleName == null ? "" : vfModuleName);
vur.setVnfId(vnfId == null ? "" : vnfId);
vur.setVnfName(vnfName == null ? "" : vnfName);
-
+
return vur;
}
-
+
/*
* This method is to construct the ValetDeleteRequest pojo
*/
- private ValetDeleteRequest createValetDeleteRequest(String regionId, String tenantId, String vfModuleId, String vfModuleName) {
+ private ValetDeleteRequest createValetDeleteRequest(String regionId, String ownerId, String tenantId, String vfModuleId, String vfModuleName) {
ValetDeleteRequest vdr = new ValetDeleteRequest();
vdr.setRegionId(regionId == null ? "" : regionId);
+ vdr.setOwnerId(ownerId == null ? "" : ownerId);
vdr.setTenantId(tenantId == null ? "" : tenantId);
vdr.setVfModuleId(vfModuleId == null ? "" : vfModuleId);
vdr.setVfModuleName(vfModuleName == null ? "" : vfModuleName);
-
+
return vdr;
}
-
+
/*
* This method is to construct the ValetDeleteRequest pojo
*/
private ValetConfirmRequest createValetConfirmRequest(String stackId) {
ValetConfirmRequest vcr = new ValetConfirmRequest();
vcr.setStackId(stackId);
-
+
return vcr;
}
-
+
/*
* This method is to construct the ValetRollbackRequest pojo
*/
@@ -303,10 +306,10 @@ public class ValetClient {
vrr.setStackId(stackId);
vrr.setSuppressRollback(suppressRollback);
vrr.setErrorMessage(errorMessage);
-
+
return vrr;
}
-
+
private HttpHeaders generateHeaders(String requestId) {
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
@@ -314,16 +317,16 @@ public class ValetClient {
headers.add("Authorization", "Basic " + this.authString);
}
headers.add(ValetClient.REQ_ID_HEADER_NAME, requestId);
-
+
return headers;
}
-
+
private <T> GenericValetResponse<T> getGVRFromResponse(ResponseEntity<T> response) {
GenericValetResponse<T> gvr = null;
if (response != null) {
T responseObj = response.getBody();
gvr = new GenericValetResponse<>(response.getStatusCodeValue(), ValetClient.NO_STATUS_RETURNED, responseObj);
-
+
} else {
gvr = new GenericValetResponse<>(-1, ValetClient.NO_STATUS_RETURNED, null);
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java
index d692416ea1..cb92ecddad 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,9 +30,11 @@ import com.fasterxml.jackson.annotation.JsonProperty;
*/
public class ValetCreateRequest implements Serializable {
private static final long serialVersionUID = 768026109321305392L;
-
+
@JsonProperty("region_id")
private String regionId;
+ @JsonProperty("owner_id")
+ private String ownerId;
@JsonProperty("tenant_id")
private String tenantId;
@JsonProperty("service_instance_id")
@@ -49,17 +51,23 @@ public class ValetCreateRequest implements Serializable {
private String keystoneUrl;
@JsonProperty("heat_request")
private HeatRequest heatRequest;
-
+
public ValetCreateRequest() {
super();
}
-
+
public String getRegionId() {
return this.regionId;
}
public void setRegionId(String regionId) {
this.regionId = regionId;
}
+ public String getOwnerId() {
+ return this.ownerId;
+ }
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
public String getTenantId() {
return this.tenantId;
}
@@ -108,10 +116,10 @@ public class ValetCreateRequest implements Serializable {
public void setHeatRequest(HeatRequest heatRequest) {
this.heatRequest = heatRequest;
}
-
+
@Override
public int hashCode() {
- return Objects.hash(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
+ return Objects.hash(regionId, ownerId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
}
@Override
public boolean equals(Object o) {
@@ -121,7 +129,8 @@ public class ValetCreateRequest implements Serializable {
return false;
}
ValetCreateRequest vcr = (ValetCreateRequest) o;
- return Objects.equals(regionId, vcr.regionId)
+ return Objects.equals(regionId, vcr.regionId)
+ && Objects.equals(ownerId, vcr.ownerId)
&& Objects.equals(tenantId, vcr.tenantId)
&& Objects.equals(serviceInstanceId, vcr.serviceInstanceId)
&& Objects.equals(vnfId, vcr.vnfId)
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java
index 7bd5855d0e..75d7df1a83 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,22 +30,30 @@ import com.fasterxml.jackson.annotation.JsonProperty;
*/
public class ValetDeleteRequest implements Serializable {
private static final long serialVersionUID = 768026109321305392L;
-
+
@JsonProperty("region_id")
private String regionId;
+ @JsonProperty("owner_id")
+ private String ownerId;
@JsonProperty("tenant_id")
private String tenantId;
@JsonProperty("vf_module_id")
private String vfModuleId;
@JsonProperty("vf_module_name")
private String vfModuleName;
-
+
public String getRegionId() {
return this.regionId;
}
public void setRegionId(String regionId) {
this.regionId = regionId;
}
+ public String getOwnerId() {
+ return this.ownerId;
+ }
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
public String getTenantId() {
return this.tenantId;
}
@@ -66,7 +74,7 @@ public class ValetDeleteRequest implements Serializable {
}
@Override
public int hashCode() {
- return Objects.hash(regionId, tenantId, vfModuleId, vfModuleName);
+ return Objects.hash(regionId, ownerId, tenantId, vfModuleId, vfModuleName);
}
@Override
public boolean equals(Object o) {
@@ -76,7 +84,8 @@ public class ValetDeleteRequest implements Serializable {
return false;
}
ValetDeleteRequest vdr = (ValetDeleteRequest) o;
- return Objects.equals(regionId, vdr.regionId)
+ return Objects.equals(regionId, vdr.regionId)
+ && Objects.equals(ownerId, vdr.ownerId)
&& Objects.equals(tenantId, vdr.tenantId)
&& Objects.equals(vfModuleId, vdr.vfModuleId)
&& Objects.equals(vfModuleName, vdr.vfModuleName);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java
index 360c07b225..2d39dd1a71 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,6 +33,8 @@ public class ValetUpdateRequest implements Serializable {
@JsonProperty("region_id")
private String regionId;
+ @JsonProperty("owner)_id")
+ private String ownerId;
@JsonProperty("tenant_id")
private String tenantId;
@JsonProperty("service_instance_id")
@@ -49,17 +51,23 @@ public class ValetUpdateRequest implements Serializable {
private String keystoneUrl;
@JsonProperty("heat_request")
private HeatRequest heatRequest;
-
+
public ValetUpdateRequest() {
super();
}
-
+
public String getRegionId() {
return this.regionId;
}
public void setRegionId(String regionId) {
this.regionId = regionId;
}
+ public String getOwnerId() {
+ return this.ownerId;
+ }
+ public void setOwnerId(String ownerId) {
+ this.ownerId = ownerId;
+ }
public String getTenantId() {
return this.tenantId;
}
@@ -110,7 +118,7 @@ public class ValetUpdateRequest implements Serializable {
}
@Override
public int hashCode() {
- return Objects.hash(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
+ return Objects.hash(regionId, ownerId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
}
@Override
@@ -121,9 +129,10 @@ public class ValetUpdateRequest implements Serializable {
return false;
}
ValetUpdateRequest vur = (ValetUpdateRequest) o;
- return Objects.equals(regionId, vur.regionId)
+ return Objects.equals(regionId, vur.regionId)
+ && Objects.equals(ownerId, vur.ownerId)
&& Objects.equals(tenantId, vur.tenantId)
- && Objects.equals(serviceInstanceId, vur.serviceInstanceId)
+ && Objects.equals(serviceInstanceId, vur.serviceInstanceId)
&& Objects.equals(vnfId, vur.vnfId)
&& Objects.equals(vnfName, vur.vnfName)
&& Objects.equals(vfModuleId, vur.vfModuleId)
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java
index f6442b6252..b418368170 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java
@@ -33,25 +33,29 @@ import org.springframework.stereotype.Component;
@Component
public class VfModuleCustomizationToVduMapper {
-
+
public VduModelInfo mapVfModuleCustomizationToVdu(VfModuleCustomization vfModuleCustom)
- {
+ {
VduModelInfo vduModel = new VduModelInfo();
vduModel.setModelCustomizationUUID(vfModuleCustom.getModelCustomizationUUID());
-
+ vduModel.setModelUUID(vfModuleCustom.getVfModule().getModelUUID());
+ vduModel.setModelInvariantUUID(vfModuleCustom.getVfModule().getModelInvariantUUID());
+
// Map the cloud templates, attached files, and environment file
mapCloudTemplates(vfModuleCustom.getVfModule().getModuleHeatTemplate(), vduModel);
mapCloudFiles(vfModuleCustom,vduModel);
mapEnvironment(vfModuleCustom.getHeatEnvironment(), vduModel);
-
+
return vduModel;
}
-
+
public VduModelInfo mapVfModuleCustVolumeToVdu(VfModuleCustomization vfModuleCustom)
- {
+ {
VduModelInfo vduModel = new VduModelInfo();
vduModel.setModelCustomizationUUID(vfModuleCustom.getModelCustomizationUUID());
-
+ vduModel.setModelUUID(vfModuleCustom.getVfModule().getModelUUID());
+ vduModel.setModelInvariantUUID(vfModuleCustom.getVfModule().getModelInvariantUUID());
+
// Map the cloud templates, attached files, and environment file
mapCloudTemplates(vfModuleCustom.getVfModule().getVolumeHeatTemplate(), vduModel);
mapCloudFiles(vfModuleCustom,vduModel);
@@ -62,20 +66,20 @@ public class VfModuleCustomizationToVduMapper {
private void mapCloudTemplates(HeatTemplate heatTemplate, VduModelInfo vduModel) {
// TODO: These catalog objects will be refactored to be non-Heat-specific
-
+
List<VduArtifact> vduArtifacts = vduModel.getArtifacts();
-
+
// Main template. Also set the VDU timeout based on the main template.
vduArtifacts.add(mapHeatTemplateToVduArtifact(heatTemplate, ArtifactType.MAIN_TEMPLATE));
vduModel.setTimeoutMinutes(heatTemplate.getTimeoutMinutes());
-
+
// Nested templates
List<HeatTemplate> childTemplates = heatTemplate.getChildTemplates();
if (childTemplates != null) {
for(HeatTemplate childTemplate : childTemplates){
vduArtifacts.add(mapHeatTemplateToVduArtifact(childTemplate, ArtifactType.NESTED_TEMPLATE));
}
- }
+ }
}
private VduArtifact mapHeatTemplateToVduArtifact(HeatTemplate heatTemplate, ArtifactType artifactType) {
@@ -85,12 +89,12 @@ public class VfModuleCustomizationToVduMapper {
vduArtifact.setType(artifactType);
return vduArtifact;
}
-
+
private void mapCloudFiles(VfModuleCustomization vfModuleCustom, VduModelInfo vduModel) {
// TODO: These catalog objects will be refactored to be non-Heat-specific
-
+
List<VduArtifact> vduArtifacts = vduModel.getArtifacts();
-
+
// Attached Files
List<HeatFiles> heatFiles = vfModuleCustom.getVfModule().getHeatFiles();
if (heatFiles != null) {
@@ -115,7 +119,7 @@ public class VfModuleCustomizationToVduMapper {
vduArtifacts.add(mapEnvironmentFileToVduArtifact(heatEnvironment));
}
}
-
+
private VduArtifact mapEnvironmentFileToVduArtifact(HeatEnvironment heatEnv) {
VduArtifact vduArtifact = new VduArtifact();
vduArtifact.setName(heatEnv.getName());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
index 8a5a083c63..1601de064d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
@@ -37,8 +37,8 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -221,7 +221,7 @@ public class BpelRestClient {
if (totalretries >= retryCount) {
debug("Retried " + totalretries + " times, giving up.");
logger.error("{} {} Could not deliver response to BPEL after {} tries: {}", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), totalretries, toBpelStr);
+ ErrorCode.BusinessProcesssError.getValue(), totalretries, toBpelStr);
return false;
}
totalretries++;
@@ -278,7 +278,7 @@ public class BpelRestClient {
}
} catch (Exception e) {
logger.error("{} {} Exception - Error sending Bpel notification: {} ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), toBpelStr, e);
+ ErrorCode.BusinessProcesssError.getValue(), toBpelStr, e);
lastResponseCode = 900;
lastResponse = "";
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java
index c54b067a78..aafcb1c600 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java
@@ -44,6 +44,7 @@ public interface MsoVnfAdapter
*/
@WebMethod
public void createVnf (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfType") @XmlElement(required=true) String vnfType,
@WebParam(name="vnfVersion") @XmlElement(required=false) String vnfVersion,
@@ -62,6 +63,7 @@ public interface MsoVnfAdapter
@WebMethod
public void updateVnf (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfType") @XmlElement(required=true) String vnfType,
@WebParam(name="vnfVersion") @XmlElement(required=false) String vnfVersion,
@@ -76,6 +78,7 @@ public interface MsoVnfAdapter
@WebMethod
public void queryVnf (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfName") @XmlElement(required=true) String vnfName,
@WebParam(name="request") MsoRequest msoRequest,
@@ -87,6 +90,7 @@ public interface MsoVnfAdapter
@WebMethod
public void deleteVnf (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfName") @XmlElement(required=true) String vnfName,
@WebParam(name="request") MsoRequest msoRequest)
@@ -99,6 +103,7 @@ public interface MsoVnfAdapter
@WebMethod
public void createVfModule (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfType") @XmlElement(required=true) String vnfType,
@WebParam(name="vnfVersion") @XmlElement(required=false) String vnfVersion,
@@ -121,6 +126,7 @@ public interface MsoVnfAdapter
@WebMethod
public void deleteVfModule (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vfName") @XmlElement(required=true) String vfName,
@WebParam(name="request") MsoRequest msoRequest,
@@ -129,6 +135,7 @@ public interface MsoVnfAdapter
@WebMethod
public void updateVfModule (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfType") @XmlElement(required=true) String vnfType,
@WebParam(name="vnfVersion") @XmlElement(required=false) String vnfVersion,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java
index 6f61f0292c..70afb1c69c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,7 +47,8 @@ public interface MsoVnfAdapterAsync
@WebMethod
@Oneway
public void createVnfA (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
- @WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
+ @WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfType") @XmlElement(required=true) String vnfType,
@WebParam(name="vnfVersion") @XmlElement(required=false) String vnfVersion,
@WebParam(name="vnfName") @XmlElement(required=true) String vnfName,
@@ -60,10 +61,11 @@ public interface MsoVnfAdapterAsync
@WebParam(name="messageId") @XmlElement(required=true) String messageId,
@WebParam(name="request") MsoRequest msoRequest,
@WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl );
-
+
@WebMethod
@Oneway
public void updateVnfA (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfType") @XmlElement(required=true) String vnfType,
@WebParam(name="vnfVersion") @XmlElement(required=false) String vnfVersion,
@@ -74,10 +76,11 @@ public interface MsoVnfAdapterAsync
@WebParam(name="messageId") @XmlElement(required=true) String messageId,
@WebParam(name="request") MsoRequest msoRequest,
@WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl );
-
+
@WebMethod
@Oneway
public void queryVnfA (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfName") @XmlElement(required=true) String vnfName,
@WebParam(name="messageId") @XmlElement(required=true) String messageId,
@@ -87,6 +90,7 @@ public interface MsoVnfAdapterAsync
@WebMethod
@Oneway
public void deleteVnfA (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId,
+ @WebParam(name="cloudOwner") @XmlElement(required=false) String cloudOwner,
@WebParam(name="tenantId") @XmlElement(required=true) String tenantId,
@WebParam(name="vnfName") @XmlElement(required=true) String vnfName,
@WebParam(name="messageId") @XmlElement(required=true) String messageId,
@@ -99,7 +103,7 @@ public interface MsoVnfAdapterAsync
@WebParam(name="messageId") @XmlElement(required=true) String messageId,
@WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl );
-
+
@WebMethod
public void healthCheckA ();
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
index cf52280b3f..5e42fa5603 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
@@ -10,9 +10,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,8 +44,8 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify;
import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.utils.CryptoUtils;
@@ -63,10 +63,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth";
private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
-
+
@Autowired
private Environment environment;
-
+
@Autowired
private MsoVnfAdapterImpl vnfImpl;
@@ -108,6 +108,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
* and translating the response to an asynchronous notification.
*
* @param cloudSiteId CLLI code of the cloud site in which to create the VNF
+ * @param cloudOwner cloud owner of the cloud site in which to create the VNF
* @param tenantId Openstack tenant identifier
* @param vnfType VNF type key, should match a VNF definition in catalog DB
* @param vnfName Name to be assigned to the new VNF
@@ -119,6 +120,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
*/
@Override
public void createVnfA (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -143,6 +145,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
try {
vnfAdapter.createVnf (cloudSiteId,
+ cloudOwner,
tenantId,
vnfType,
vnfVersion,
@@ -159,7 +162,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
vnfRollback);
} catch (VnfException e) {
logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -169,7 +172,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.name ());
} catch (Exception e1) {
logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -177,7 +180,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
notifyPort.createVnfNotification (messageId, false, exCat, eMsg, null, null, null);
} catch (Exception e1) {
logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
return;
@@ -195,7 +198,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
copyVrb (vnfRollback));
} catch (Exception e) {
logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
}
logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
return;
@@ -203,6 +206,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
@Override
public void updateVnfA (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -225,10 +229,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
Holder <VnfRollback> vnfRollback = new Holder <> ();
try {
- vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
+ vnfAdapter.updateVnf (cloudSiteId, cloudOwner, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
} catch (VnfException e) {
logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -238,7 +242,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.name ());
} catch (Exception e1) {
logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -246,7 +250,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
notifyPort.updateVnfNotification (messageId, false, exCat, eMsg, null, null);
} catch (Exception e1) {
logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
return;
@@ -263,7 +267,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
copyVrb (vnfRollback));
} catch (Exception e) {
logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
}
logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
return;
@@ -277,6 +281,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
* ID, its status, and the set of outputs (from when the stack was created).
*
* @param cloudSiteId CLLI code of the cloud site in which to query
+ * @param cloudOwner cloud owner of cloud site in which to query
* @param tenantId Openstack tenant identifier
* @param vnfName VNF Name or Openstack ID
* @param msoRequest Request tracking information for logs
@@ -284,6 +289,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
*/
@Override
public void queryVnfA (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfName,
String messageId,
@@ -303,10 +309,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
Holder <Map <String, String>> outputs = new Holder <> ();
try {
- vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs);
+ vnfAdapter.queryVnf (cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs);
} catch (VnfException e) {
logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -316,7 +322,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.name ());
} catch (Exception e1) {
logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -324,7 +330,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
notifyPort.queryVnfNotification (messageId, false, exCat, eMsg, null, null, null, null);
} catch (Exception e1) {
logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
return;
@@ -349,7 +355,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
copyQueryOutputs (outputs));
} catch (Exception e) {
logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
}
logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
@@ -363,6 +369,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
* The method has no outputs.
*
* @param cloudSiteId CLLI code of the cloud site in which to delete
+ * @param cloudOwner cloud owner of cloud site in which to delete
* @param tenantId Openstack tenant identifier
* @param vnfName VNF Name or Openstack ID
* @param msoRequest Request tracking information for logs
@@ -370,6 +377,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
*/
@Override
public void deleteVnfA (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfName,
String messageId,
@@ -383,10 +391,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
MsoVnfAdapter vnfAdapter = vnfImpl;
try {
- vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest);
+ vnfAdapter.deleteVnf (cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest);
} catch (VnfException e) {
logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -396,7 +404,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.name ());
} catch (Exception e1) {
logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -404,7 +412,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
notifyPort.deleteVnfNotification (messageId, false, exCat, eMsg);
} catch (Exception e1) {
logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
return;
@@ -418,7 +426,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
} catch (Exception e) {
logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
}
logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
@@ -448,7 +456,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
vnfAdapter.rollbackVnf (rollback);
} catch (VnfException e) {
logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -458,7 +466,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.name ());
} catch (Exception e1) {
logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
@@ -466,7 +474,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
notifyPort.rollbackVnfNotification (messageId, false, exCat, eMsg);
} catch (Exception e1) {
logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
return;
@@ -479,7 +487,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
notifyPort.rollbackVnfNotification (messageId, true, null, null);
} catch (Exception e) {
logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
}
logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
@@ -575,17 +583,17 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("VnfAdapterNotify.wsdl");
} catch (Exception e) {
logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
}
if (warWsdlLoc == null) {
logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue());
+ ErrorCode.BusinessProcesssError.getValue());
} else {
try {
logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString());
} catch (Exception e) {
logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
}
}
@@ -602,7 +610,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
epUrl = new URL (notificationUrl);
} catch (MalformedURLException e1) {
logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
+ ErrorCode.BusinessProcesssError.getValue(), e1);
}
if(null != epUrl) {
@@ -625,12 +633,12 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
headers.put ("Authorization", Collections.singletonList (basicAuth));
} catch (Exception e) {
logger.error("{} {} Exception - Unable to set authorization in callback request ",
- MessageEnum.RA_SET_CALLBACK_AUTH_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.BusinessProcesssError.getValue(), e);
}
return notifyPort;
}
-
+
public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
try {
return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey));
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 4d915f9e84..b99e34eb9d 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
@@ -37,10 +37,22 @@ import java.util.concurrent.TimeUnit;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.apache.commons.collections.CollectionUtils;
+import org.onap.so.adapters.valet.GenericValetResponse;
+import org.onap.so.adapters.valet.ValetClient;
+import org.onap.so.adapters.valet.beans.HeatRequest;
+import org.onap.so.adapters.valet.beans.ValetConfirmResponse;
+import org.onap.so.adapters.valet.beans.ValetCreateResponse;
+import org.onap.so.adapters.valet.beans.ValetDeleteResponse;
+import org.onap.so.adapters.valet.beans.ValetRollbackResponse;
+import org.onap.so.adapters.valet.beans.ValetStatus;
+import org.onap.so.adapters.valet.beans.ValetUpdateResponse;
import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
+import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.cloud.CloudConfig;
+import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.HeatFiles;
@@ -53,28 +65,27 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
+import org.onap.so.heatbridge.HeatBridgeApi;
+import org.onap.so.heatbridge.HeatBridgeImpl;
+import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.onap.so.openstack.exceptions.MsoHeatNotFoundException;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoHeatUtilsWithUpdate;
-import org.onap.so.adapters.valet.ValetClient;
-import org.onap.so.adapters.valet.beans.HeatRequest;
-import org.onap.so.adapters.valet.beans.ValetConfirmResponse;
-import org.onap.so.adapters.valet.beans.ValetCreateResponse;
-import org.onap.so.adapters.valet.beans.ValetDeleteResponse;
-import org.onap.so.adapters.valet.beans.ValetRollbackResponse;
-import org.onap.so.adapters.valet.beans.ValetStatus;
-import org.onap.so.adapters.valet.beans.ValetUpdateResponse;
-import org.onap.so.adapters.valet.GenericValetResponse;
+import org.openstack4j.model.compute.Flavor;
+import org.openstack4j.model.compute.Image;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -164,6 +175,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
* orchestrator fails on a subsequent operation.
*
* @param cloudSiteId CLLI code of the cloud site in which to create the VNF
+ * @param cloudOwner cloud owner of the cloud region in which to create the VNF
* @param tenantId Openstack tenant identifier
* @param vnfType VNF type key, should match a VNF definition in catalog DB
* @param vnfVersion VNF version key, should match a VNF definition in catalog DB
@@ -178,6 +190,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void createVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -208,9 +221,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
} catch (Exception e) {
// might be ok - both are just blank
- logger.debug("ERROR trying to parse the volumeGroupHeatStackId " + volumeGroupHeatStackId,e);
+ logger.debug("ERROR trying to parse the volumeGroupHeatStackId {}", volumeGroupHeatStackId,e);
}
this.createVfModule(cloudSiteId,
+ cloudOwner,
tenantId,
vnfType,
vnfVersion,
@@ -239,11 +253,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
newRequestTypeSb.append(requestType);
}
this.createVfModule(cloudSiteId,
- tenantId,
+ cloudOwner,
+ tenantId,
vnfType,
vnfVersion,
genericVnfId,
- vnfName,
+ vnfName,
vfModuleId,
newRequestTypeSb.toString(),
vfVolGroupHeatStackId,
@@ -263,6 +278,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
@Override
public void updateVnf(String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -274,7 +290,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Holder <Map <String, String>> outputs,
Holder <VnfRollback> rollback) throws VnfException {
// As of 1707 - this method should no longer be called
- MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ());
logger.debug("UpdateVnf called?? This should not be called any longer - update vfModule");
}
@@ -295,6 +310,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void queryVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfName,
MsoRequest msoRequest,
@@ -311,14 +327,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
StackInfo heatStack = null;
long subStartTime = System.currentTimeMillis ();
try {
- heatStack = heat.queryStack (cloudSiteId, tenantId, vnfName);
+ heatStack = heat.queryStack (cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
me.addContext ("QueryVNF");
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- String error = "Query VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ String error = "Query VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, "OpenStack", "QueryVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryStack",
+ tenantId, "OpenStack", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack",
me);
logger.debug(error);
throw new VnfException (me);
@@ -352,12 +368,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
* The method has no outputs.
*
* @param cloudSiteId CLLI code of the cloud site in which to delete
+ * @param cloudOwner cloud owner of the cloud region in which to delete
* @param tenantId Openstack tenant identifier
* @param vnfName VNF Name or Openstack ID
* @param msoRequest Request tracking information for logs
*/
@Override
public void deleteVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfName,
MsoRequest msoRequest) throws VnfException {
@@ -372,14 +390,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// could be thrown.
long subStartTime = System.currentTimeMillis ();
try {
- heat.deleteStack (tenantId, cloudSiteId, vnfName, true);
+ heat.deleteStack (tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
me.addContext ("DeleteVNF");
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- String error = "Delete VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, "OpenStack", "DeleteVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - DeleteVNF",
+ String error = "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "DeleteVNF", ErrorCode.DataError.getValue(), "Exception - DeleteVNF",
me);
logger.debug(error);
throw new VnfException (me);
@@ -406,24 +424,25 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Get the elements of the VnfRollback object for easier access
String cloudSiteId = rollback.getCloudSiteId ();
+ String cloudOwner = rollback.getCloudOwner ();
String tenantId = rollback.getTenantId ();
String vnfId = rollback.getVnfId ();
- logger.debug("Rolling Back VNF {} in {}", vnfId, cloudSiteId + "/" + tenantId);
+ logger.debug("Rolling Back VNF {} in {}", vnfId, cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
try {
- heat.deleteStack (tenantId, cloudSiteId, vnfId, true);
+ heat.deleteStack (tenantId, cloudOwner, cloudSiteId, vnfId, true);
} catch (MsoException me) {
// Failed to rollback the Stack due to an openstack exception.
// Convert to a generic VnfException
me.addContext ("RollbackVNF");
- String error = "Rollback VNF: " + vnfId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudSiteId,
- tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Rollback VNF: " + vnfId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(),
"Exception - DeleteStack", me);
logger.debug(error);
throw new VnfException (me);
@@ -501,14 +520,74 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
}
+ private void heatbridge(StackInfo heatStack, String cloudOwner, String cloudSiteId, String tenantId, String genericVnfName,
+ String vfModuleId) {
+ try {
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ () -> new MsoCloudSiteNotFound(cloudSiteId));
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
+ String heatStackId = heatStack.getCanonicalName().split("/")[1];
+
+ List<String> oobMgtNetNames = new ArrayList<>();
+
+ HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity,
+ cloudOwner, cloudSiteId, tenantId);
+
+ OpenstackClient openstackClient = heatBridgeClient.authenticate();
+ List<Resource> stackResources = heatBridgeClient.queryNestedHeatStackResources(heatStackId);
+
+ List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources);
+
+ List<Image> osImages = heatBridgeClient.extractOpenstackImagesFromServers(osServers);
+
+ List<Flavor> osFlavors = heatBridgeClient.extractOpenstackFlavorsFromServers(osServers);
+
+ logger.debug("Successfully queried heat stack{} for resources.", heatStackId);
+ //os images
+ if (osImages != null && !osImages.isEmpty()) {
+ heatBridgeClient.buildAddImagesToAaiAction(osImages);
+ logger.debug("Successfully built AAI actions to add images.");
+ } else {
+ logger.debug("No images to update to AAI.");
+ }
+ //flavors
+ if (osFlavors != null && !osFlavors.isEmpty()) {
+ heatBridgeClient.buildAddFlavorsToAaiAction(osFlavors);
+ logger.debug("Successfully built AAI actions to add flavors.");
+ } else {
+ logger.debug("No flavors to update to AAI.");
+ }
+
+ //compute resources
+ heatBridgeClient.buildAddVserversToAaiAction(genericVnfName, vfModuleId, osServers);
+ logger.debug("Successfully queried compute resources and built AAI vserver actions.");
+
+ //neutron resources
+ List<String> oobMgtNetIds = new ArrayList<>();
+
+ //if no network-id list is provided, however network-name list is
+ if (!CollectionUtils.isEmpty(oobMgtNetNames)) {
+ oobMgtNetIds = heatBridgeClient.extractNetworkIds(oobMgtNetNames);
+ }
+ heatBridgeClient.buildAddVserverLInterfacesToAaiAction(stackResources, oobMgtNetIds);
+ logger.debug(
+ "Successfully queried neutron resources and built AAI actions to add l-interfaces to vservers.");
+
+ //Update AAI
+ heatBridgeClient.submitToAai();
+ } catch (Exception ex) {
+ logger.debug("Heatbrige failed for stackId: " + heatStack.getCanonicalName(), ex);
+ }
+ }
+
private String convertNode(final JsonNode node) {
try {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
return JSON_MAPPER.writeValueAsString(obj);
} catch (JsonParseException jpe) {
- logger.debug("Error converting json to string " + jpe.getMessage(),jpe);
+ logger.debug("Error converting json to string: {}", jpe.getMessage(),jpe);
} catch (Exception e) {
- logger.debug("Error converting json to string " + e.getMessage(),e);
+ logger.debug("Error converting json to string: {}", e.getMessage(),e);
}
return "[Error converting json to string]";
}
@@ -564,6 +643,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
@Override
public void createVfModule(String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -633,6 +713,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
vfRollback.setCloudSiteId(cloudSiteId);
+ vfRollback.setCloudOwner(cloudOwner);
vfRollback.setTenantId(tenantId);
vfRollback.setMsoRequest(msoRequest);
vfRollback.setRequestType(requestTypeString);
@@ -649,11 +730,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
StackInfo heatStack = null;
long subStartTime1 = System.currentTimeMillis ();
try {
- heatStack = heat.queryStack (cloudSiteId, tenantId, vfModuleName);
+ heatStack = heat.queryStack (cloudSiteId, cloudOwner, tenantId, vfModuleName);
} catch (MsoException me) {
- String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
- tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryStack",
+ String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Exception - queryStack",
me);
logger.debug(error);
// Failed to query the Stack due to an openstack exception.
@@ -667,43 +748,43 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
HeatStatus status = heatStack.getStatus();
if (status == HeatStatus.INIT || status == HeatStatus.BUILDING || status == HeatStatus.DELETING || status == HeatStatus.UPDATING) {
// fail - it's in progress - return meaningful error
- String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
"Stack " + vfModuleName + " already exists");
logger.debug(error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
+ throw new VnfAlreadyExists (vfModuleName, cloudOwner, cloudSiteId, tenantId, heatStack.getCanonicalName ());
}
if (status == HeatStatus.FAILED) {
// fail - it exists and is in a FAILED state
- String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
"Stack " + vfModuleName + " already exists and is " + "in FAILED state");
logger.debug(error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
+ throw new VnfAlreadyExists (vfModuleName, cloudOwner, cloudSiteId, tenantId, heatStack.getCanonicalName ());
}
if (status == HeatStatus.UNKNOWN || status == HeatStatus.UPDATED) {
// fail - it exists and is in a FAILED state
String error =
"Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in "
- + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(),
+ + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
"Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName());
+ throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, heatStack.getCanonicalName());
}
if (status == HeatStatus.CREATED) {
// fail - it exists
if (failIfExists != null && failIfExists) {
String error =
- "Create VF: Stack " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(),
+ "Create VF: Stack " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
"Stack " + vfModuleName + " already exists");
logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName());
+ throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, heatStack.getCanonicalName());
} else {
logger.debug ("Found Existing stack, status={}", heatStack.getStatus ());
// Populate the outputs from the existing stack.
@@ -723,23 +804,23 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (nestedStackId != null) {
try {
logger.debug("Querying for nestedStackId = {}", nestedStackId);
- nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId);
+ nestedHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedStackId);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
me.addContext ("CreateVFModule");
- String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
- tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "queryStack", ErrorCode.BusinessProcesssError.getValue(),
"MsoException trying to query nested stack", me);
logger.debug("ERROR trying to query nested stack= {}", error);
throw new VnfException (me);
}
if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudSiteId, tenantId, error, "OpenStack", "queryStack",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ;
+ logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "queryStack",
+ ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached heatStack ID " + "DOES NOT EXIST");
logger.debug(error);
throw new VnfException (error, MsoExceptionCategory.USERDATA);
@@ -756,24 +837,24 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (nestedBaseStackId != null) {
try {
logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
- nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId);
+ nestedBaseHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
me.addContext ("CreateVFModule");
- String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
+ String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
logger
- .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
- tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ .error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "QueryStack", ErrorCode.BusinessProcesssError.getValue(),
"MsoException trying to query nested base stack", me);
logger.debug("ERROR trying to query nested base stack= {}", error);
throw new VnfException (me);
}
if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudSiteId, tenantId, error, "OpenStack", "QueryStack",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ;
+ logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack",
+ ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached base heatStack ID DOES NOT EXIST");
logger.debug("Exception occurred", error);
throw new VnfException (error, MsoExceptionCategory.USERDATA);
@@ -807,7 +888,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu;
logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", modelCustomizationUuid, "OpenStack",
- MsoLogger.ErrorCode.DataError.getValue(),
+ ErrorCode.DataError.getValue(),
"Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -834,7 +915,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (vnfResource == null) {
String error = "Create VNF: Unknown VNF Type: " + vnfType;
logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType,
- "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type");
+ "OpenStack", ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
@@ -904,7 +985,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// ERROR
String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion();
logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
@@ -947,7 +1028,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString;
logger
.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType,
- "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ "OpenStack", ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -961,7 +1042,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatEnvironment == null) {
String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ "OpenStack", ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException (error, MsoExceptionCategory.INTERNAL);
} else {
@@ -1140,7 +1221,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack",
- MsoLogger.ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+ ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException (error, MsoExceptionCategory.USERDATA);
} else {
@@ -1171,7 +1252,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
boolean sendResponseToValet = false;
if (isValetEnabled) {
Holder<Map<String, Object>> valetModifiedParamsHolder = new Holder<>();
- sendResponseToValet = this.valetCreateRequest(cloudSiteId, tenantId, heatFilesObjects,
+ sendResponseToValet = this.valetCreateRequest(cloudSiteId, cloudOwner, tenantId, heatFilesObjects,
nestedTemplatesChecked, vfModuleName, backout, heatTemplate, newEnvironmentString, goldenInputs,
msoRequest, inputs, failRequestOnValetFailure, valetModifiedParamsHolder);
if (sendResponseToValet) {
@@ -1193,8 +1274,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("heat is not null!!");
heatStack = heat.createStack (cloudSiteId,
+ cloudOwner,
tenantId,
vfModuleName,
+ null,
template,
goldenInputs,
true,
@@ -1210,10 +1293,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
} catch (MsoException me) {
me.addContext ("CreateVFModule");
- String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
logger
- .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
- tenantId, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "MsoException - createStack",
+ .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", ErrorCode.DataError.getValue(), "MsoException - createStack",
me);
logger.debug(error);
if (isValetEnabled && sendResponseToValet) {
@@ -1228,10 +1311,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
throw new VnfException (me);
} catch (NullPointerException npe) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe;
+ String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe;
logger
- .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
- tenantId, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(),
+ .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", ErrorCode.DataError.getValue(),
"NullPointerException - createStack", npe);
logger.debug(error);
logger.debug("NULL POINTER EXCEPTION at heat.createStack");
@@ -1259,7 +1342,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.error("Exception encountered while sending Confirm to Valet ", e);
}
}
- logger.debug("VF Module {} successfully created", vfModuleName);
+ logger.debug ("VF Module {} successfully created", vfModuleName);
+ //call heatbridge
+ heatbridge(heatStack, cloudOwner, cloudSiteId, tenantId, genericVnfName, vfModuleId);
return;
} catch (Exception e) {
logger.debug("unhandled exception in create VF",e);
@@ -1269,12 +1354,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
@Override
public void deleteVfModule (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfName,
MsoRequest msoRequest,
Holder <Map <String, String>> outputs) throws VnfException {
- logger.debug("Deleting VF {} in ", vnfName, cloudSiteId + "/" + tenantId);
+ logger.debug("Deleting VF {} in ", vnfName, cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -1282,14 +1368,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// so we'll need to query first
Map<String, Object> stackOutputs = null;
try {
- stackOutputs = heat.queryStackForOutputs(cloudSiteId, tenantId, vnfName);
+ stackOutputs = heat.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
me.addContext ("DeleteVFModule");
- String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - QueryStack",
+ String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack",
me);
logger.debug(error);
throw new VnfException (me);
@@ -1302,7 +1388,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("isValetEnabled={}, failRequestsOnValetFailure={}", isValetEnabled, failRequestOnValetFailure);
boolean valetDeleteRequestSucceeded = false;
if (isValetEnabled) {
- valetDeleteRequestSucceeded = this.valetDeleteRequest(cloudSiteId, tenantId, vnfName, msoRequest, failRequestOnValetFailure);
+ valetDeleteRequestSucceeded = this.valetDeleteRequest(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest, failRequestOnValetFailure);
}
// Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
@@ -1311,14 +1397,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// could be thrown.
long subStartTime = System.currentTimeMillis ();
try {
- heat.deleteStack (tenantId, cloudSiteId, vnfName, true);
+ heat.deleteStack (tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
me.addContext ("DeleteVNF");
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- String error = "Delete VF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(),
"Exception - deleteStack", me);
logger.debug(error);
if (isValetEnabled && valetDeleteRequestSucceeded) {
@@ -1351,6 +1437,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
@Override
public void updateVfModule (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -1367,12 +1454,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String vfModuleName = vnfName;
String vfModuleType = vnfType;
String methodName = "updateVfModule";
- MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ());
String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName;
StringBuilder sbInit = new StringBuilder();
sbInit.append("updateVfModule: \n");
- sbInit.append("cloudSiteId=" + cloudSiteId + "\n");
+ sbInit.append("cloudOwner=" + cloudOwner + "\n");
+ sbInit.append("cloudSiteId=" + cloudSiteId + "\n");
sbInit.append("tenantId=" + tenantId + "\n");
sbInit.append("vnfType=" + vnfType + "\n");
sbInit.append("vnfVersion=" + vnfVersion + "\n");
@@ -1427,7 +1514,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
vfModuleName = this.getVfModuleNameFromModuleStackId(vfModuleStackId);
}
- logger.debug ("Updating VFModule: " + vfModuleName + " of type " + vfModuleType + "in " + cloudSiteId + "/" + tenantId);
+ logger.debug ("Updating VFModule: " + vfModuleName + " of type " + vfModuleType + "in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
logger.debug("requestTypeString = " + requestTypeString + ", nestedVolumeStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId);
// Will capture execution time for metrics
@@ -1436,6 +1523,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback ();
vfRollback.setCloudSiteId (cloudSiteId);
+ vfRollback.setCloudOwner (cloudOwner);
vfRollback.setTenantId (tenantId);
vfRollback.setMsoRequest (msoRequest);
vfRollback.setRequestType(requestTypeString);
@@ -1449,14 +1537,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
long queryStackStarttime = System.currentTimeMillis ();
logger.debug("UpdateVfModule - querying for {}", vfModuleName);
try {
- heatStack = heat.queryStack (cloudSiteId, tenantId, vfModuleName);
+ heatStack = heat.queryStack (cloudSiteId, cloudOwner, tenantId, vfModuleName);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
me.addContext ("UpdateVFModule");
- String error = "Update VFModule: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
- tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - QueryStack",
+ String error = "Update VFModule: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack",
me);
logger.debug(error);
throw new VnfException (me);
@@ -1465,10 +1553,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
//TODO - do we need to check for the other status possibilities?
if (heatStack == null || heatStack.getStatus () == HeatStatus.NOTFOUND) {
// Not Found
- String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudSiteId + "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudSiteId,
- tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error);
- throw new VnfNotFound (cloudSiteId, tenantId, vfModuleName);
+ String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), error);
+ throw new VnfNotFound (cloudSiteId, cloudOwner, tenantId, vfModuleName);
} else {
logger.debug("Found Existing stack, status={}", heatStack.getStatus());
// Populate the outputs from the existing stack.
@@ -1483,22 +1571,22 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (nestedStackId != null) {
try {
logger.debug("Querying for nestedStackId = {}", nestedStackId);
- nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId);
+ nestedHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedStackId);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
me.addContext ("UpdateVFModule");
- String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - " + error,
+ String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error,
me);
logger.debug("ERROR trying to query nested stack= {}", error);
throw new VnfException (me);
}
if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ;
+ logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, error, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException (error, MsoExceptionCategory.USERDATA);
} else {
@@ -1514,24 +1602,24 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
long queryStackStarttime3 = System.currentTimeMillis ();
try {
logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
- nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId);
+ nestedBaseHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
me.addContext ("UpdateVfModule");
- String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
+ String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
logger
- .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
- tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(),
+ .error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(),
"Exception - " + error, me);
logger.debug("ERROR trying to query nested base stack= {}", error);
throw new VnfException (me);
}
if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
- logger.error ("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudSiteId, tenantId, error, "OpenStack",
- "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ;
+ logger.error ("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, error, "OpenStack",
+ "QueryStack", ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException (error, MsoExceptionCategory.USERDATA);
} else {
@@ -1561,7 +1649,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (vf == null) {
String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu;
logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type",
- vfModuleType, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
logger.debug("Got VF module definition from Catalog: {}", vf.toString());
@@ -1640,7 +1728,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
+ minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: "
+ cloudSiteId + " with AIC_Version:" + aicV;
logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
@@ -1671,7 +1759,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString;
logger
.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType,
- "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ "OpenStack", ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
@@ -1680,7 +1768,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatEnvironment == null) {
String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ "OpenStack", ErrorCode.DataError.getValue(), error);
throw new VnfException (error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug ("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment());
@@ -1815,14 +1903,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
jsonNode = JSON_MAPPER.readTree(jsonString);
} catch (JsonParseException jpe) {
//TODO - what to do here?
- //for now - send the error to debug, but just leave it as a String
- String errorMessage = jpe.getMessage();
- logger.debug("Json Error Converting " + parm.getParamName() + " - " + errorMessage,jpe);
+ //for now - send the error to debug
+ logger.debug("Json Error Converting {} - {}", parm.getParamName(), jpe.getMessage(), jpe);
hasJson = false;
jsonNode = null;
} catch (Exception e) {
// or here?
- logger.debug("Json Error Converting " + parm.getParamName() + " " + e.getMessage(), e);
+ logger.debug("Json Error Converting {} {}", parm.getParamName(), e.getMessage(), e);
hasJson = false;
jsonNode = null;
}
@@ -1898,7 +1985,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
String error = "Update VNF: Missing Required inputs: " + missingParams;
logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack",
- MsoLogger.ErrorCode.DataError.getValue(), error);
+ ErrorCode.DataError.getValue(), error);
throw new VnfException (error, MsoExceptionCategory.USERDATA);
} else {
logger.debug("found missing parameters - but checkRequiredParameters is false - will not block");
@@ -1920,7 +2007,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
extraParams.removeAll (paramList);
if (!extraParams.isEmpty ()) {
logger.warn("{} {} {} {} {} {}", MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType,
- extraParams.toString(), "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "Extra params");
+ extraParams.toString(), "OpenStack", ErrorCode.DataError.getValue(), "Extra params");
inputs.keySet ().removeAll (extraParams);
}
}
@@ -1960,7 +2047,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (parsedVfModuleName == null || parsedVfModuleName.isEmpty()) {
parsedVfModuleName = "unknown";
}
- sendResponseToValet = this.valetUpdateRequest(cloudSiteId, tenantId, heatFilesObjects,
+ sendResponseToValet = this.valetUpdateRequest(cloudSiteId, cloudOwner, tenantId, heatFilesObjects,
nestedTemplatesChecked, parsedVfModuleName, false, heatTemplate, newEnvironmentString, (HashMap<String, Object>) goldenInputs,
msoRequest, inputs, failRequestOnValetFailure, valetModifiedParamsHolder);
if (sendResponseToValet) {
@@ -1975,6 +2062,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
try {
heatStack = heatU.updateStack(
cloudSiteId,
+ cloudOwner,
tenantId,
vfModuleName,
template,
@@ -1988,10 +2076,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
);
} catch (MsoException me) {
me.addContext ("UpdateVFModule");
- String error = "Update VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ String error = "Update VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
logger
- .error("{} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
- tenantId, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - " + error, me);
+ .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId,
+ tenantId, "OpenStack", ErrorCode.DataError.getValue(), "Exception - " + error, me);
if (isValetEnabled && sendResponseToValet) {
logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
try {
@@ -2099,7 +2187,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
/*
* Valet Create request
*/
- private boolean valetCreateRequest(String cloudSiteId, String tenantId, Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked,
+ private boolean valetCreateRequest(String cloudSiteId, String cloudOwner, String tenantId, Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked,
String vfModuleName, boolean backout, HeatTemplate heatTemplate, String newEnvironmentString, Map<String, Object> goldenInputs,
MsoRequest msoRequest, Map<String, Object> inputs, boolean failRequestOnValetFailure, Holder<Map<String, Object>> valetModifiedParamsHolder) throws VnfException {
boolean valetSucceeded = false;
@@ -2111,7 +2199,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
HeatRequest heatRequest = new HeatRequest(vfModuleName, backout, heatTemplate.getTimeoutMinutes(),
heatTemplate.getTemplateBody(), newEnvironmentString, files, goldenInputs);
GenericValetResponse<ValetCreateResponse> createReq = this.vci.callValetCreateRequest(msoRequest.getRequestId(),
- cloudSiteId, tenantId, msoRequest.getServiceInstanceId(), (String)inputs.get("vnf_id"),
+ cloudSiteId, cloudOwner, tenantId, msoRequest.getServiceInstanceId(), (String)inputs.get("vnf_id"),
(String)inputs.get("vnf_name"), (String)inputs.get("vf_module_id"), (String)inputs.get("vf_module_name"), keystoneUrl,
heatRequest);
ValetCreateResponse vcr = createReq.getReturnObject();
@@ -2158,7 +2246,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
* Valet update request
*/
- private boolean valetUpdateRequest(String cloudSiteId, String tenantId,
+ private boolean valetUpdateRequest(String cloudSiteId, String cloudOwnerId, String tenantId,
Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked, String vfModuleName,
boolean backout, HeatTemplate heatTemplate, String newEnvironmentString,
Map<String, Object> goldenInputs, MsoRequest msoRequest, Map<String, Object> inputs,
@@ -2174,7 +2262,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
heatTemplate.getTemplateBody(), newEnvironmentString, files, goldenInputs);
// vnf name is not sent to MSO on update requests - so we will set it to the vf module name for now
GenericValetResponse<ValetUpdateResponse> updateReq = this.vci.callValetUpdateRequest(msoRequest.getRequestId(),
- cloudSiteId, tenantId, msoRequest.getServiceInstanceId(), (String)inputs.get("vnf_id"),
+ cloudSiteId, cloudOwnerId, tenantId, msoRequest.getServiceInstanceId(), (String)inputs.get("vnf_id"),
vfModuleName, (String)inputs.get("vf_module_id"), vfModuleName, keystoneUrl,
heatRequest);
ValetUpdateResponse vur = updateReq.getReturnObject();
@@ -2220,7 +2308,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
/*
* Valet delete request
*/
- private boolean valetDeleteRequest(String cloudSiteId, String tenantId, String vnfName,
+ private boolean valetDeleteRequest(String cloudSiteId, String cloudOwnerId, String tenantId, String vnfName,
MsoRequest msoRequest, boolean failRequestOnValetFailure) {
boolean valetDeleteRequestSucceeded = false;
String valetErrorMessage = "more detail not available";
@@ -2235,7 +2323,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.error("An exception occurred trying to call MsoVnfAdapterImpl.valetDeleteRequest() method", e);
}
GenericValetResponse<ValetDeleteResponse> deleteReq = this.vci.callValetDeleteRequest(msoRequest.getRequestId(),
- cloudSiteId, tenantId, vfModuleId, vfModuleName);
+ cloudSiteId, cloudOwnerId, tenantId, vfModuleId, vfModuleName);
ValetDeleteResponse vdr = deleteReq.getReturnObject();
if (vdr != null && deleteReq.getStatusCode() == 200) {
ValetStatus status = vdr.getStatus();
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 833e200ce9..a07fff024b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -52,9 +52,9 @@ import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.MsoTenant;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
@@ -129,6 +129,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void createVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -157,6 +158,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void updateVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -188,6 +190,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
* The input "vnfName" will also be reflected back as its ID.
*
* @param cloudSiteId CLLI code of the cloud site in which to query
+ * @param cloudOwner cloud owner of the cloud site in which to query
* @param tenantId Openstack tenant identifier - ignored for Cloudify
* @param vnfName VNF Name (should match a deployment ID)
* @param msoRequest Request tracking information for logs
@@ -197,6 +200,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void queryVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfName,
MsoRequest msoRequest,
@@ -226,10 +230,10 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Failed to query the Deployment due to a cloudify exception.
// Convert to a generic VnfException
me.addContext("QueryVNF");
- String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
logger
- .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId,
- CLOUDIFY, "QueryVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryDeployment", me);
+ .error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
+ CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -260,6 +264,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void deleteVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfName,
MsoRequest msoRequest) throws VnfException {
@@ -294,10 +299,11 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Get the elements of the VnfRollback object for easier access
String cloudSiteId = rollback.getCloudSiteId ();
+ String cloudOwner = rollback.getCloudOwner();
String tenantId = rollback.getTenantId ();
String vfModuleId = rollback.getVfModuleStackId ();
- logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudSiteId + "/" + tenantId);
+ logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudOwner + "/" + cloudSiteId + "/" + tenantId);
DeploymentInfo deployment = null;
@@ -319,9 +325,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Failed to rollback the VNF due to a cloudify exception.
// Convert to a generic VnfException
me.addContext ("RollbackVNF");
- String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId,
- tenantId, CLOUDIFY, "DeleteDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId,
+ tenantId, CLOUDIFY, "DeleteDeployment", ErrorCode.DataError.getValue(),
"Exception - DeleteDeployment", me);
logger.debug(error);
throw new VnfException (me);
@@ -523,6 +529,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
* is successfully created but the orchestration fails on a subsequent step.
*
* @param cloudSiteId CLLI code of the cloud site in which to create the VNF
+ * @param cloudOwner cloud owner of the cloud site in which to create the VNF
* @param tenantId Openstack tenant identifier
* @param vfModuleType VF Module type key, should match a VNF definition in catalog DB.
* Deprecated - should use modelCustomizationUuid
@@ -548,6 +555,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void createVfModule(String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vfModuleType,
String vnfVersion,
@@ -576,7 +584,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
logger.debug("Missing required input: modelCustomizationUuid");
String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
- "VF Module ModelCustomizationUuid", CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(),
+ "VF Module ModelCustomizationUuid", CLOUDIFY, ErrorCode.DataError.getValue(),
"Create VF Module: Missing required input: modelCustomizationUuid");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -612,6 +620,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
vfRollback.setCloudSiteId(cloudSiteId);
+ vfRollback.setCloudOwner(cloudOwner);
vfRollback.setTenantId(tenantId);
vfRollback.setMsoRequest(msoRequest);
vfRollback.setRequestType(requestType);
@@ -639,7 +648,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
logger.debug(error);
logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module "
+ "ModelCustomizationUuid",
- modelCustomizationUuid, "CatalogDb", MsoLogger.ErrorCode.DataError.getValue(), error);
+ modelCustomizationUuid, "CatalogDb", ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
logger.debug("Found vfModuleCust entry " + vfmc.toString());
@@ -676,7 +685,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
+ " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId
+ " with AIC_Version:" + cloudSite.getCloudVersion();
logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
@@ -693,9 +702,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
catch (MsoException me) {
// Failed to query the Deployment due to a cloudify exception.
- String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
+ String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
- tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+ tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Exception - queryDeployment", me);
logger.debug(error);
@@ -713,12 +722,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (status == DeploymentStatus.INSTALLED) {
// fail - it exists
if (failIfExists != null && failIfExists) {
- String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already exists");
logger.debug(error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
+ throw new VnfAlreadyExists (vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
} else {
// Found existing deployment and client has not requested "failIfExists".
// Populate the outputs from the existing deployment.
@@ -731,41 +740,41 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Check through various detailed error cases
if (status == DeploymentStatus.INSTALLING || status == DeploymentStatus.UNINSTALLING) {
// fail - it's in progress - return meaningful error
- String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already exists");
logger.debug(error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
+ throw new VnfAlreadyExists (vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
}
else if (status == DeploymentStatus.FAILED) {
// fail - it exists and is in a FAILED state
- String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already " + "exists and is in FAILED state");
logger.debug(error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
+ throw new VnfAlreadyExists (vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
}
else if (status == DeploymentStatus.UNKNOWN || status == DeploymentStatus.CREATED) {
// fail - it exists and is in a UNKNOWN state
- String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already " + "exists and is in " + status.toString() + " state");
logger.debug(error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
+ throw new VnfAlreadyExists (vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
}
else {
// Unexpected, since all known status values have been tested for
String error =
"Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status
- .toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+ .toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already " + "exists and is in an unknown state");
logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
}
}
@@ -783,10 +792,10 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
catch (MsoException me) {
// Failed to query the Volume GroupDeployment due to a cloudify exception.
- String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)",
- MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryDeployment(volume)", me);
+ String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
+ cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)",
+ ErrorCode.DataError.getValue(), "Exception - queryDeployment(volume)", me);
logger.debug(error);
// Convert to a generic VnfException
me.addContext ("CreateVFModule(QueryVolume)");
@@ -799,7 +808,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
+ tenantId + " USER ERROR";
logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(volume)",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached Volume Group DOES NOT EXIST");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -835,11 +844,11 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
catch (MsoException me) {
// Failed to query the Volume GroupDeployment due to a cloudify exception.
String error =
- "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": "
+ "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": "
+ me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)",
- MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryDeployment(Base)", me);
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+ cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)",
+ ErrorCode.DataError.getValue(), "Exception - queryDeployment(Base)", me);
logger.debug(error);
// Convert to a generic VnfException
me.addContext("CreateVFModule(QueryBase)");
@@ -852,7 +861,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
+ tenantId + " USER ERROR";
logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Base " + "Module DOES NOT EXIST");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -887,7 +896,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType="
+ requestType;
logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType,
- "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ "OpenStack", ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
@@ -896,7 +905,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (heatEnvironment == null) {
String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ "OpenStack", ErrorCode.DataError.getValue(), error);
// Alarm on this error, configuration must be fixed
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -1035,7 +1044,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, CLOUDIFY,
- MsoLogger.ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+ ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1098,7 +1107,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
me.addContext("CreateVFModule");
String error = "Create VF Module: Upload blueprint failed. Blueprint=" + blueprintName + ": " + me;
logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
- tenantId, CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me);
+ tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1127,18 +1136,18 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
me.addContext ("CreateVFModule");
- String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
logger
- .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
- tenantId, CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), "MsoException - createDeployment",
+ .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId,
+ tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - createDeployment",
me);
logger.debug(error);
throw new VnfException (me);
} catch (NullPointerException npe) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe;
+ String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe;
logger
- .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
- tenantId, CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(),
+ .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId,
+ tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
"NullPointerException - createDeployment", npe);
logger.debug(error);
logger.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment");
@@ -1168,12 +1177,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
public void deleteVfModule (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfName,
MsoRequest msoRequest,
Holder <Map <String, String>> outputs) throws VnfException {
-
- logger.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
+ logger.debug ("Deleting VF " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -1185,9 +1194,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
// Failed to query the deployment. Convert to a generic VnfException
me.addContext ("DeleteVFModule");
- String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, CLOUDIFY, "QueryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, CLOUDIFY, "QueryDeployment", ErrorCode.DataError.getValue(),
"Exception - QueryDeployment", me);
logger.debug(error);
throw new VnfException (me);
@@ -1205,9 +1214,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
me.addContext("DeleteVfModule");
// Convert to a generic VnfException
- String error = "Delete VF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, "DeleteDeployment", "DeleteDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, "DeleteDeployment", "DeleteDeployment", ErrorCode.DataError.getValue(),
"Exception - DeleteDeployment: " + me.getMessage());
logger.debug(error);
throw new VnfException(me);
@@ -1220,6 +1229,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// TODO: Should Update be supported for Cloudify? What would this look like?
@Override
public void updateVfModule (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
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 b1b97b695e..62c373bea8 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
@@ -72,9 +72,9 @@ import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
@@ -153,6 +153,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void createVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -181,6 +182,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void updateVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -216,6 +218,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void queryVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfNameOrId,
MsoRequest msoRequest,
@@ -225,16 +228,16 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
Holder <Map <String, String>> outputs)
throws VnfException
{
- logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId);
+ logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
long subStartTime = System.currentTimeMillis ();
VduInstance vduInstance = null;
- CloudInfo cloudInfo = new CloudInfo(cloudSiteId, tenantId, null);
+ CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
- VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
try {
vduInstance = vduPlugin.queryVdu (cloudInfo, vnfNameOrId);
@@ -243,9 +246,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Failed to query the VDU due to a plugin exception.
// Convert to a generic VnfException
e.addContext("QueryVNF");
- String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId + ": " + e;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudSiteId,
- tenantId, "VDU", "QueryVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryVDU", e);
+ String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner, cloudSiteId,
+ tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU", e);
logger.debug(error);
throw new VnfException(e);
}
@@ -277,6 +280,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void deleteVnf (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfName,
MsoRequest msoRequest) throws VnfException {
@@ -311,17 +315,18 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Get the elements of the VnfRollback object for easier access
String cloudSiteId = rollback.getCloudSiteId ();
+ String cloudOwner = rollback.getCloudOwner();
String tenantId = rollback.getTenantId ();
- CloudInfo cloudInfo = new CloudInfo (cloudSiteId, tenantId, null);
+ CloudInfo cloudInfo = new CloudInfo (cloudSiteId, cloudOwner, tenantId, null);
String vfModuleId = rollback.getVfModuleStackId ();
- logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
+ logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
VduInstance vduInstance = null;
// Use the VduPlugin to delete the VF Module.
- VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
long subStartTime = System.currentTimeMillis ();
try {
@@ -334,9 +339,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Failed to rollback the VF Module due to a plugin exception.
// Convert to a generic VnfException
ve.addContext ("RollbackVFModule");
- String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + ve;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId,
- tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError.getValue(), "Exception - DeleteVdu", ve);
+ String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + ve;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId,
+ tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu", ve);
logger.debug(error);
throw new VnfException (ve);
}
@@ -410,21 +415,21 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String str = "" + stackOutputs.get(key);
stringOutputs.put(key, str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs", e);
+ logger.debug("Unable to add {} to outputs", key, e);
}
} else if (stackOutputs.get(key) instanceof JsonNode) {
try {
String str = this.convertNode((JsonNode) stackOutputs.get(key));
stringOutputs.put(key, str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting JsonNode", e);
+ logger.debug("Unable to add {} to outputs - exception converting JsonNode", key, e);
}
} else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
try {
String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
stringOutputs.put(key, str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap", e);
+ logger.debug("Unable to add {} to outputs - exception converting LinkedHashMap", key, e);
}
} else {
try {
@@ -565,6 +570,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
* is successfully created but the orchestration fails on a subsequent step.
*
* @param cloudSiteId CLLI code of the cloud site in which to create the VNF
+ * @param cloudOwner cloud owner of the cloud site in which to create the VNF
* @param tenantId Openstack tenant identifier
* @param vfModuleType VF Module type key, should match a VNF definition in catalog DB.
* Deprecated - should use modelCustomizationUuid
@@ -590,6 +596,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void createVfModule(String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vfModuleType,
String vnfVersion,
@@ -618,7 +625,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
logger.debug("Missing required input: modelCustomizationUuid");
String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
- "VF Module ModelCustomizationUuid", "VDU", MsoLogger.ErrorCode.DataError,
+ "VF Module ModelCustomizationUuid", "VDU", ErrorCode.DataError,
"Create VF Module: " + "Missing required input: modelCustomizationUuid");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -654,6 +661,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
vfRollback.setCloudSiteId(cloudSiteId);
+ vfRollback.setCloudOwner(cloudOwner);
vfRollback.setTenantId(tenantId);
vfRollback.setMsoRequest(msoRequest);
vfRollback.setRequestType(requestType);
@@ -681,7 +689,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
logger.debug(error);
logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb",
- MsoLogger.ErrorCode.DataError, error);
+ ErrorCode.DataError, error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
logger.debug("Found vfModuleCust entry {}", vfModuleCust.toString());
@@ -719,7 +727,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
+ " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId
+ " with AIC_Version:" + cloudSite.getCloudVersion();
logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
@@ -727,10 +735,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
VduInstance vduInstance = null;
- CloudInfo cloudInfo = new CloudInfo (cloudSiteId, tenantId, null);
+ CloudInfo cloudInfo = new CloudInfo (cloudSiteId, cloudOwner, tenantId, null);
// Use the VduPlugin.
- VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
// First, look up to see if the VF already exists, unless using multicloud adapter
@@ -741,9 +749,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
catch (VduException me) {
// Failed to query the VDU due to a plugin exception.
- String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"Exception - queryVdu", me);
logger.debug(error);
// Convert to a generic VnfException
@@ -761,12 +769,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (failIfExists != null && failIfExists) {
// fail - it exists
String error =
- "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+ "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists");
logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId());
} else {
// Found existing deployment and client has not requested "failIfExists".
// Populate the outputs from the existing deployment.
@@ -782,42 +790,42 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// fail - it's in progress - return meaningful error
String error =
"Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString()
- + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+ + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists");
logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId());
} else if (status == VduStateType.FAILED) {
// fail - it exists and is in a FAILED state
String error =
- "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId
+ "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId
+ "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in FAILED state");
logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId());
} else if (status == VduStateType.UNKNOWN) {
// fail - it exists and is in a UNKNOWN state
String error =
"Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString()
- + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+ + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state");
logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId());
} else {
// Unexpected, since all known status values have been tested for
String error =
"Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status
- .toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+ .toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in an unknown state");
logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId());
}
}
@@ -835,9 +843,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
catch (VduException me) {
// Failed to query the Volume Group VDU due to a plugin exception.
- String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudSiteId, tenantId, "VDU", "queryVdu(volume)", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(),
"Exception - queryVdu(volume)", me);
logger.debug(error);
// Convert to a generic VnfException
@@ -846,10 +854,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) {
- String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ;
+ logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
+ cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
+ ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached Volume Group " + "DOES NOT EXIST");
logger.debug(error);
throw new VnfException (error, MsoExceptionCategory.USERDATA);
@@ -885,9 +893,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
catch (MsoException me) {
// Failed to query the Base VF Module due to a Vdu Plugin exception.
- String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
- cloudSiteId, tenantId, "VDU", "queryVdu(Base)", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(),
"Exception - queryVdu(Base)", me);
logger.debug(error);
// Convert to a generic VnfException
@@ -897,11 +905,11 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) {
String error =
- "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/"
+ "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
- cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+ cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
+ ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Base Module DOES NOT EXIST");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -934,7 +942,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType="
+ requestType;
logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType,
- "VNF", MsoLogger.ErrorCode.DataError.getValue(), error);
+ "VNF", ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -944,7 +952,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (heatEnvironment == null) {
String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+ "OpenStack", ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
@@ -1082,7 +1090,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
- MsoLogger.ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+ ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1116,22 +1124,22 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
} catch (VduException me) {
// Failed to instantiate the VDU.
me.addContext("CreateVFModule");
- String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
- tenantId, "VDU", MsoLogger.ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me);
+ String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId,
+ tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me);
logger.debug(error);
// Convert to a generic VnfException
throw new VnfException(me);
} catch (NullPointerException npe) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe;
- logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
- tenantId, "VDU", MsoLogger.ErrorCode.DataError.getValue(), "NullPointerException - instantiateVdu",
+ String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe;
+ logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId,
+ tenantId, "VDU", ErrorCode.DataError.getValue(), "NullPointerException - instantiateVdu",
npe);
logger.debug(error);
logger.debug("NULL POINTER EXCEPTION at vduPlugin.instantiateVdu", npe);
throw new VnfException("NullPointerException during instantiateVdu");
} catch (Exception e) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + e;
+ String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e;
logger.debug("Unhandled exception at vduPlugin.instantiateVdu", e);
logger.debug(error);
throw new VnfException("Exception during instantiateVdu: " + e.getMessage());
@@ -1153,22 +1161,23 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
public void deleteVfModule (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vfModuleId,
MsoRequest msoRequest,
Holder <Map <String, String>> outputs) throws VnfException
{
- logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
+ logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
// Capture the output parameters on a delete, so need to query first
VduInstance vduInstance = null;
- CloudInfo cloudInfo = new CloudInfo(cloudSiteId, tenantId, null);
+ CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
// Use the VduPlugin.
- VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
try {
vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleId);
@@ -1177,9 +1186,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Failed to query the VDU due to a plugin exception.
// Convert to a generic VnfException
e.addContext("QueryVFModule");
- String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + e;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudSiteId,
- tenantId, "VDU", "QueryVFModule", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryVDU", e);
+ String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId,
+ tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(), "Exception - queryVDU", e);
logger.debug(error);
throw new VnfException(e);
}
@@ -1200,9 +1209,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
} catch (VduException me) {
me.addContext ("DeleteVfModule");
// Convert to a generic VnfException
- String error = "Delete VF: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId,
- tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError.getValue(),
+ String error = "Delete VF: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId,
+ tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(),
"Exception - DeleteVdu: " + me.getMessage());
logger.debug(error);
throw new VnfException (me);
@@ -1215,6 +1224,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Update VF Module not yet implemented for generic VDU plug-in model.
@Override
public void updateVfModule (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String vnfType,
String vnfVersion,
@@ -1239,7 +1249,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
* defined for the target cloud. Should really be looking at the VNF Model (ochestration_mode)
* but we don't currently have access to that in Query and Delete cases.
*/
- private VduPlugin getVduPlugin (String cloudSiteId) {
+ private VduPlugin getVduPlugin (String cloudSiteId, String cloudOwner) {
Optional<CloudSite> cloudSiteOp = cloudConfig.getCloudSite(cloudSiteId);
if (cloudSiteOp.isPresent()) {
CloudSite cloudSite = cloudSiteOp.get();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
index 1a114067c3..d1a48a7c9b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
@@ -56,8 +56,8 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
@@ -166,7 +166,7 @@ public class VnfAdapterRest {
} catch (Exception e) {
// problem handling delete, send generic failure as sync resp to caller
logger.error("", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -208,12 +208,12 @@ public class VnfAdapterRest {
Holder<Map<String, String>> outputs = new Holder <> ();
if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
//vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest());
- vnfAdapter.deleteVfModule (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs);
+ vnfAdapter.deleteVfModule (req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs);
}
response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value);
} catch (VnfException e) {
logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e);
+ ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -254,7 +254,9 @@ public class VnfAdapterRest {
@PathParam("aaiVfModuleId") String aaiVfModuleId,
@ApiParam(value = "cloudSiteId", required = true)
@QueryParam("cloudSiteId") String cloudSiteId,
- @ApiParam(value = "tenantId", required = true)
+ @ApiParam(value = "cloudOwner", required = true)
+ @QueryParam("cloudOwner") String cloudOwner,
+ @ApiParam(value = "tenantId", required = true)
@QueryParam("tenantId") String tenantId,
@ApiParam(value = "vfModuleName", required = true)
@QueryParam("vfModuleName") String vfModuleName, //RAA? Id in doc
@@ -276,7 +278,7 @@ public class VnfAdapterRest {
Holder<String> vfModuleId = new Holder<>();
Holder<VnfStatus> status = new Holder<>();
Holder<Map<String, String>> outputs = new Holder <> ();
- vnfAdapter.queryVnf (cloudSiteId, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs);
+ vnfAdapter.queryVnf (cloudSiteId, cloudOwner, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs);
if (!vnfExists.value) {
logger.debug("vfModule not found");
respStatus = HttpStatus.SC_NOT_FOUND;
@@ -293,7 +295,7 @@ public class VnfAdapterRest {
.build();
} catch (VnfException e) {
logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
return Response
.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
@@ -371,7 +373,7 @@ public class VnfAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR, "createVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError, "Exception - createVfModule", e);
+ ErrorCode.BusinessProcesssError, "Exception - createVfModule", e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -417,12 +419,13 @@ public class VnfAdapterRest {
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
String cloudsite = req.getCloudSiteId();
+ String cloudOwner = req.getCloudOwner();
if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) {
String tenant = req.getTenantId();
if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
throw new VnfException("testing.");
}
- vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudsite,
+ vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudOwner, cloudsite,
true, false, new MsoRequest("reqid", "svcid"),
req.getVolumeGroupId(), req.getVolumeGroupId(), req.getRequestType(), req.getModelCustomizationUuid());
vfModuleStackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
@@ -443,6 +446,7 @@ public class VnfAdapterRest {
// outputs,
// vnfRollback);
vnfAdapter.createVfModule(req.getCloudSiteId(),
+ req.getCloudOwner(),
req.getTenantId(),
//req.getVnfType(),
completeVnfVfModuleType,
@@ -514,7 +518,7 @@ public class VnfAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -561,6 +565,7 @@ public class VnfAdapterRest {
logger.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
vnfAdapter.updateVfModule (req.getCloudSiteId(),
+ req.getCloudOwner(),
req.getTenantId(),
//req.getVnfType(),
completeVnfVfModuleType,
@@ -645,7 +650,7 @@ public class VnfAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -684,12 +689,12 @@ public class VnfAdapterRest {
try {
VfModuleRollback vmr = req.getVfModuleRollback();
VnfRollback vrb = new VnfRollback(
- vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudSiteId(), true, true,
+ vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(), vmr.getCloudSiteId(), true, true,
vmr.getMsoRequest(), null, null, null, null);
vnfAdapter.rollbackVnf (vrb);
response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError,
+ logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError,
"Exception" + " - " + "rollbackVfModule", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId());
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
index 81989a6fcd..41d350d765 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
@@ -55,8 +55,8 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
@@ -167,7 +167,7 @@ public class VnfAdapterRestV2 {
} catch (Exception e) {
// problem handling delete, send generic failure as sync resp to caller
logger.error("{} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -213,12 +213,12 @@ public class VnfAdapterRestV2 {
//vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest());
// Support different Adapter Implementations
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsite);
- adapter.deleteVfModule (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs);
+ adapter.deleteVfModule (req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs);
}
response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value);
} catch (VnfException e) {
logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e);
+ ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -259,6 +259,8 @@ public class VnfAdapterRestV2 {
@PathParam("aaiVfModuleId") String aaiVfModuleId,
@ApiParam(value = "cloudSiteId", required = true)
@QueryParam("cloudSiteId") String cloudSiteId,
+ @ApiParam(value = "cloudOwner", required = true)
+ @QueryParam("cloudOwner") String cloudOwner,
@ApiParam(value = "tenantId", required = true)
@QueryParam("tenantId") String tenantId,
@ApiParam(value = "vfModuleName", required = true)
@@ -286,7 +288,7 @@ public class VnfAdapterRestV2 {
// Support different Adapter Implementations
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId);
- adapter.queryVnf (cloudSiteId, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs);
+ adapter.queryVnf (cloudSiteId, cloudOwner, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs);
if (!vnfExists.value) {
logger.debug("vfModule not found");
@@ -304,7 +306,7 @@ public class VnfAdapterRestV2 {
.build();
} catch (VnfException e) {
logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
return Response
.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
@@ -385,7 +387,7 @@ public class VnfAdapterRestV2 {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - createVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - createVfModule", e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -434,12 +436,13 @@ public class VnfAdapterRestV2 {
logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
String cloudsiteId = req.getCloudSiteId();
+ String cloudOwner = req.getCloudOwner();
if (cloudsiteId != null && cloudsiteId.equals(TESTING_KEYWORD)) {
String tenant = req.getTenantId();
if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
throw new VnfException("testing.");
}
- vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudsiteId,
+ vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudOwner, cloudsiteId,
true, false, new MsoRequest("reqid", "svcid"),
req.getVolumeGroupId(), req.getVolumeGroupId(), req.getRequestType(), req.getModelCustomizationUuid());
vfModuleStackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
@@ -448,6 +451,7 @@ public class VnfAdapterRestV2 {
// Support different Adapter Implementations
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
adapter.createVfModule(req.getCloudSiteId(),
+ req.getCloudOwner(),
req.getTenantId(),
completeVnfVfModuleType,
req.getVnfVersion(),
@@ -519,7 +523,7 @@ public class VnfAdapterRestV2 {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -572,6 +576,7 @@ public class VnfAdapterRestV2 {
// Support different Adapter Implementations
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
adapter.updateVfModule (req.getCloudSiteId(),
+ req.getCloudOwner(),
req.getTenantId(),
completeVnfVfModuleType,
req.getVnfVersion(),
@@ -654,7 +659,7 @@ public class VnfAdapterRestV2 {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -693,7 +698,7 @@ public class VnfAdapterRestV2 {
try {
VfModuleRollback vmr = req.getVfModuleRollback();
VnfRollback vrb = new VnfRollback(
- vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudSiteId(), true, vmr.isVfModuleCreated(),
+ vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(), vmr.getCloudSiteId(), true, vmr.isVfModuleCreated(),
vmr.getMsoRequest(), null, null, null, null);
// Support multiple adapter implementations
@@ -703,7 +708,7 @@ public class VnfAdapterRestV2 {
response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
} catch (VnfException e) {
logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId());
}
if (!req.isSynchronous()) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
index dc1ff12570..e7d7b56624 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
@@ -60,8 +60,8 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse;
import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
@@ -124,7 +124,7 @@ public class VolumeAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -195,6 +195,7 @@ public class VolumeAdapterRest {
// vnfRollback);
vnfAdapter.createVfModule(
req.getCloudSiteId(), //cloudSiteId,
+ req.getCloudOwner(), //cloudOwner,
req.getTenantId(), //tenantId,
//req.getVnfType(), //vnfType,
completeVnfVfModuleType,
@@ -220,6 +221,7 @@ public class VolumeAdapterRest {
stackId.value,
true, // TODO boolean volumeGroupCreated, when would it be false?
req.getTenantId(),
+ req.getCloudOwner(),
req.getCloudSiteId(),
req.getMsoRequest(),
req.getMessageId());
@@ -286,7 +288,7 @@ public class VolumeAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -325,7 +327,7 @@ public class VolumeAdapterRest {
logger.debug("DeleteVNFVolumesTask start");
try {
if (!req.getCloudSiteId().equals(TESTING_KEYWORD)) {
- vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getTenantId(), req.getVolumeGroupStackId(), req.getMsoRequest());
+ vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), req.getVolumeGroupStackId(), req.getMsoRequest());
}
response = new DeleteVolumeGroupResponse(true, req.getMessageId());
} catch (VnfException e) {
@@ -383,7 +385,7 @@ public class VolumeAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -423,7 +425,7 @@ public class VolumeAdapterRest {
try {
VolumeGroupRollback vgr = req.getVolumeGroupRollback();
VnfRollback vrb = new VnfRollback(
- vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudSiteId(), true, true,
+ vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudOwnerId(), vgr.getCloudSiteId(), true, true,
vgr.getMsoRequest(), null, null, null, null);
vnfAdapter.rollbackVnf(vrb);
response = new RollbackVolumeGroupResponse(true, req.getMessageId());
@@ -483,7 +485,7 @@ public class VolumeAdapterRest {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -542,6 +544,7 @@ public class VolumeAdapterRest {
// outputs,
// vnfRollback);
vnfAdapter.updateVfModule (req.getCloudSiteId(),
+ req.getCloudOwner(),
req.getTenantId(),
//req.getVnfType(),
completeVnfVfModuleType,
@@ -587,6 +590,8 @@ public class VolumeAdapterRest {
@PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
@ApiParam(value = "cloudSiteId", required = true)
@QueryParam("cloudSiteId") String cloudSiteId,
+ @ApiParam(value = "cloudOwner", required = true)
+ @QueryParam("cloudOwner") String cloudOwner,
@ApiParam(value = "tenantId", required = true)
@QueryParam("tenantId") String tenantId,
@ApiParam(value = "volumeGroupStackId", required = true)
@@ -619,7 +624,7 @@ public class VolumeAdapterRest {
status.value = VnfStatus.ACTIVE;
outputs.value = testMap();
} else {
- vnfAdapter.queryVnf(cloudSiteId, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs);
+ vnfAdapter.queryVnf(cloudSiteId, cloudOwner, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs);
}
if (!vnfExists.value) {
logger.debug("VNFVolumes not found");
@@ -637,7 +642,7 @@ public class VolumeAdapterRest {
.build();
} catch (VnfException e) {
logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes", MessageEnum.RA_QUERY_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e);
+ ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e);
VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
logger.debug("Query queryVNFVolumes exit");
return Response
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
index 1dcf586346..cbbfdf359a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
@@ -59,8 +59,8 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse;
import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
@@ -129,7 +129,7 @@ public class VolumeAdapterRestV2 {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -189,6 +189,7 @@ public class VolumeAdapterRestV2 {
MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
vnfAdapter.createVfModule(
req.getCloudSiteId(), //cloudSiteId,
+ req.getCloudOwner(), //cloudOwner,
req.getTenantId(), //tenantId,
completeVnfVfModuleType, //vnfType,
req.getVnfVersion(), //vnfVersion,
@@ -214,6 +215,7 @@ public class VolumeAdapterRestV2 {
stackId.value,
vnfRollback.value.getVnfCreated(),
req.getTenantId(),
+ req.getCloudOwner(),
req.getCloudSiteId(),
req.getMsoRequest(),
req.getMessageId());
@@ -283,7 +285,7 @@ public class VolumeAdapterRestV2 {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -327,7 +329,7 @@ public class VolumeAdapterRestV2 {
if (! cloudSiteId.equals(TESTING_KEYWORD)) {
// Support different Adapter Implementations
MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId);
- vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getTenantId(), req.getVolumeGroupStackId(), req.getMsoRequest());
+ vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), req.getVolumeGroupStackId(), req.getMsoRequest());
}
response = new DeleteVolumeGroupResponse(true, req.getMessageId());
} catch (VnfException e) {
@@ -385,7 +387,7 @@ public class VolumeAdapterRestV2 {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -425,7 +427,7 @@ public class VolumeAdapterRestV2 {
try {
VolumeGroupRollback vgr = req.getVolumeGroupRollback();
VnfRollback vrb = new VnfRollback(
- vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudSiteId(), true, true,
+ vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudOwnerId(), vgr.getCloudSiteId(), true, true,
vgr.getMsoRequest(), null, null, null, null);
// Support different Adapter Implementations
@@ -490,7 +492,7 @@ public class VolumeAdapterRestV2 {
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
@@ -541,6 +543,7 @@ public class VolumeAdapterRestV2 {
// Support different Adapter Implementations
MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, req.getCloudSiteId());
vnfAdapter.updateVfModule (req.getCloudSiteId(),
+ req.getCloudOwner(),
req.getTenantId(),
//req.getVnfType(),
completeVnfVfModuleType,
@@ -586,6 +589,8 @@ public class VolumeAdapterRestV2 {
@PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
@ApiParam(value = "cloudSiteId", required = true)
@QueryParam("cloudSiteId") String cloudSiteId,
+ @ApiParam(value = "cloudOwner", required = true)
+ @QueryParam("cloudOwner") String cloudOwner,
@ApiParam(value = "tenantId", required = true)
@QueryParam("tenantId") String tenantId,
@ApiParam(value = "volumeGroupStackId", required = true)
@@ -622,7 +627,7 @@ public class VolumeAdapterRestV2 {
} else {
// Support different Adapter Implementations
MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId);
- vnfAdapter.queryVnf(cloudSiteId, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs);
+ vnfAdapter.queryVnf(cloudSiteId, cloudOwner, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs);
}
if (!vnfExists.value) {
logger.debug("VNFVolumes not found");
@@ -640,7 +645,7 @@ public class VolumeAdapterRestV2 {
.build();
} catch (VnfException e) {
logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes: ", MessageEnum.RA_QUERY_VNF_ERR,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e);
+ ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e);
VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
logger.debug("Query queryVNFVolumes exit");
return Response
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java
index 2a7f33a682..38283aa17b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java
@@ -36,7 +36,7 @@ public class VnfAlreadyExists extends VnfException {
private static final long serialVersionUID = 1L;
- public VnfAlreadyExists (String name, String cloudId, String tenantId, String vnfId) {
- super("Resource " + name + " already exists in cloud/tenant " + cloudId + "/" + tenantId + " with ID " + vnfId);
+ public VnfAlreadyExists (String name, String cloudId, String cloudOwner, String tenantId, String vnfId) {
+ super("Resource " + name + " already exists in owner/cloud/tenant " + cloudOwner + "/" + cloudId + "/" + tenantId + " with ID " + vnfId);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java
index f3fa39cc2d..18d622453b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java
@@ -35,7 +35,7 @@ public class VnfNotFound extends VnfException {
private static final long serialVersionUID = 1L;
- public VnfNotFound (String cloudId, String tenantId, String vnfName) {
- super("Resource " + vnfName + " not found in cloud/tenant " + cloudId + "/" + tenantId);
+ public VnfNotFound (String cloudId, String cloudOwner, String tenantId, String vnfName) {
+ super("Resource " + vnfName + " not found in owner/cloud/tenant " + cloudOwner + "/" + cloudId + "/" + tenantId);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
new file mode 100644
index 0000000000..6b06761474
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge;
+
+import java.util.List;
+import org.onap.so.heatbridge.openstack.api.OpenstackClient;
+import org.openstack4j.model.compute.Flavor;
+import org.openstack4j.model.compute.Image;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
+
+/**
+ * Defines the contract to extract Heat Stack Resources from Openstack and inventory it to AAI.
+ * This API is used only to "create" objects in AAI.
+ */
+public interface HeatBridgeApi {
+
+ /**
+ * Authenticate with Openstack Keystone. The auth information is read from SO cloud configuration file.
+ *
+ * @return Openstack client object with keystone token
+ * @throws HeatBridgeException upon failure to authenticate with keystone
+ */
+ OpenstackClient authenticate() throws HeatBridgeException;
+
+ /**
+ * Query all the stack based resources from Openstack Heat service
+ *
+ * @param heatStackId Heat stack UUID
+ * @return A list of stack based resources
+ */
+ List<Resource> queryNestedHeatStackResources(String heatStackId);
+
+ /**
+ * Get a filtered list of resource IDs by resource type
+ *
+ * @param stackResources A list of stack based resources
+ * @param resourceType Resource type to filter by
+ * @return A list of stack resources matching the specified resource-type
+ */
+ List<String> extractStackResourceIdsByResourceType(List<Resource> stackResources, String resourceType);
+
+ /**
+ * Get network IDs for a given list of network names.
+ * It is assumed that there is a one to one mapping between the name and ID.
+ * @param networkNameList List of network names
+ * @return List of matching network IDs
+ */
+ List<String> extractNetworkIds(List<String> networkNameList);
+
+ /**
+ * Query the Openstack server objects from the list of stack resources
+ *
+ * @param stackResources A list of stack based resources
+ * @return A list of Openstack Server objects
+ */
+ List<Server> getAllOpenstackServers(List<Resource> stackResources);
+
+ /**
+ * Extract Openstack Image objects from a a list of Server objects
+ *
+ * @param servers A list of Openstack Server objects
+ * @return A list of Openstack Image objects
+ */
+ List<Image> extractOpenstackImagesFromServers(List<Server> servers);
+
+ /**
+ * Extract Openstack Flavor objects from a a list of Server objects
+ *
+ * @param servers A list of Openstack Server objects
+ * @return A list of Openstack Flavor objects
+ */
+ List<Flavor> extractOpenstackFlavorsFromServers(List<Server> servers);
+
+ /**
+ * Query and build AAI actions for Openstack Image resources to AAI's image objects
+ *
+ * @param images List of Openstack Image objects
+ * @throws HeatBridgeException when failing to add images to AAI
+ */
+ void buildAddImagesToAaiAction(List<Image> images) throws HeatBridgeException;
+
+ /**
+ * Query and build AAI actions for Openstack Flavor resources to AAI's flavor objects
+ *
+ * @param flavors List of Openstack Flavor objects
+ * @throws HeatBridgeException when failing to add flavors to AAI
+ */
+ void buildAddFlavorsToAaiAction(List<Flavor> flavors) throws HeatBridgeException;
+
+ /**
+ * Query and build AAI actions for Openstack Compute resources to AAI's vserver objects
+ *
+ * @param genericVnfId AAI generic-vnf-id
+ * @param vfModuleId AAI vf-module-id
+ * @param servers Openstack Server list
+ */
+ void buildAddVserversToAaiAction(String genericVnfId, String vfModuleId, List<Server> servers);
+
+ /**
+ * Query and build AAI actions for Openstack Neutron resources associated with a Compute resource to AAI's
+ * l-interface objects
+ *
+ * @param stackResources Openstack Heat stack resource list
+ * @param oobMgtNetIds List of OOB network IDs list
+ */
+ void buildAddVserverLInterfacesToAaiAction(List<Resource> stackResources, List<String> oobMgtNetIds);
+
+ /**
+ * Execute AAI restful API to update the Openstack resources
+ *
+ * @throws HeatBridgeException when failing to add openstack resource PoJos to AAI
+ */
+ void submitToAai() throws HeatBridgeException;
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java
new file mode 100644
index 0000000000..f993d71e4c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge;
+
+public class HeatBridgeException extends Exception {
+
+ private static final long serialVersionUID = -1472047930391718894L;
+
+ public HeatBridgeException(final String message) {
+ super(message);
+ }
+
+ public HeatBridgeException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
new file mode 100644
index 0000000000..90ceeb7d1c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -0,0 +1,365 @@
+/*
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+import javax.annotation.Nonnull;
+import javax.ws.rs.WebApplicationException;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.validator.routines.InetAddressValidator;
+import org.onap.aai.domain.yang.Flavor;
+import org.onap.aai.domain.yang.Image;
+import org.onap.aai.domain.yang.L3InterfaceIpv4AddressList;
+import org.onap.aai.domain.yang.LInterface;
+import org.onap.aai.domain.yang.PInterface;
+import org.onap.aai.domain.yang.SriovPf;
+import org.onap.aai.domain.yang.SriovPfs;
+import org.onap.aai.domain.yang.SriovVf;
+import org.onap.aai.domain.yang.SriovVfs;
+import org.onap.aai.domain.yang.Vlan;
+import org.onap.aai.domain.yang.Vlans;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.AAISingleTransactionClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.heatbridge.constants.HeatBridgeConstants;
+import org.onap.so.heatbridge.factory.MsoCloudClientFactoryImpl;
+import org.onap.so.heatbridge.helpers.AaiHelper;
+import org.onap.so.heatbridge.openstack.api.OpenstackClient;
+import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactoryImpl;
+import org.onap.so.heatbridge.utils.HeatBridgeUtils;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.ErrorCode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
+import org.openstack4j.model.network.IP;
+import org.openstack4j.model.network.Network;
+import org.openstack4j.model.network.NetworkType;
+import org.openstack4j.model.network.Port;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * This class provides an implementation of {@link HeatBridgeApi}
+ */
+public class HeatBridgeImpl implements HeatBridgeApi {
+
+ private static final Logger logger = LoggerFactory.getLogger(HeatBridgeImpl.class);
+ private static final String ERR_MSG_NULL_OS_CLIENT = "Initialization error: Null openstack client. Authenticate with Keystone first.";
+ private static final String OOB_MGT_NETWORK_IDENTIFIER = "Management";
+ private OpenstackClient osClient;
+ private AAIResourcesClient resourcesClient;
+ private AAISingleTransactionClient transaction;
+ private String cloudOwner;
+ private String cloudRegionId;
+ private String tenantId;
+ private AaiHelper aaiHelper = new AaiHelper();
+ private CloudIdentity cloudIdentity;
+
+
+ public HeatBridgeImpl(AAIResourcesClient resourcesClient, final CloudIdentity cloudIdentity,
+ @Nonnull final String cloudOwner, @Nonnull final String cloudRegionId, @Nonnull final String tenantId) {
+ Objects.requireNonNull(cloudOwner, "Null cloud-owner value!");
+ Objects.requireNonNull(cloudRegionId, "Null cloud-region identifier!");
+ Objects.requireNonNull(tenantId, "Null tenant identifier!");
+ Objects.requireNonNull(tenantId, "Null AAI actions list!");
+
+ this.cloudIdentity = cloudIdentity;
+ this.cloudOwner = cloudOwner;
+ this.cloudRegionId = cloudRegionId;
+ this.tenantId = tenantId;
+ this.resourcesClient = resourcesClient;
+ this.transaction = resourcesClient.beginSingleTransaction();
+ }
+
+ @Override
+ public OpenstackClient authenticate() throws HeatBridgeException {
+ this.osClient = new MsoCloudClientFactoryImpl(new OpenstackClientFactoryImpl())
+ .getOpenstackClient(cloudIdentity.getIdentityUrl(), cloudIdentity.getMsoId(), cloudIdentity.getMsoPass(), cloudRegionId, tenantId);
+ logger.debug("Successfully authenticated with keystone for tenant: " + tenantId + " and cloud "
+ + "region: " + cloudRegionId);
+ return osClient;
+ }
+
+ @Override
+ public List<Resource> queryNestedHeatStackResources(final String heatStackId) {
+ Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
+ Preconditions.checkState(!Strings.isNullOrEmpty(heatStackId), "Invalid heatStackId!");
+ List<Resource> stackBasedResources = osClient
+ .getStackBasedResources(heatStackId, HeatBridgeConstants.OS_DEFAULT_HEAT_NESTING);
+ logger.debug(stackBasedResources.size() + " heat stack resources are extracted for stack: " + heatStackId);
+ return stackBasedResources;
+ }
+
+ @Override
+ public List<String> extractStackResourceIdsByResourceType(final List<Resource> stackResources,
+ final String resourceType) {
+ return stackResources.stream()
+ .filter(stackResource -> stackResource.getType().equals(resourceType))
+ .map(Resource::getPhysicalResourceId)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public List<String> extractNetworkIds(final List<String> networkNameList) {
+ Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
+ return networkNameList.stream()
+ .map(netName -> osClient.listNetworksByFilter(ImmutableMap.of(HeatBridgeConstants.OS_NAME_KEY, netName)))
+ .filter(nets -> nets != null && nets.size() == 1) //extract network-id only if network-name is unique
+ .map(nets -> nets.get(0).getId())
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public List<Server> getAllOpenstackServers(final List<Resource> stackResources) {
+ Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
+
+ // Filter Openstack Compute resources
+ List<String> serverIds = extractStackResourceIdsByResourceType(stackResources,
+ HeatBridgeConstants.OS_SERVER_RESOURCE_TYPE);
+ return serverIds.stream().map(serverId -> osClient.getServerById(serverId)).collect(Collectors.toList());
+ }
+
+ @Override
+ public List<org.openstack4j.model.compute.Image> extractOpenstackImagesFromServers(final List<Server> servers) {
+ Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
+ return servers.stream().map(Server::getImage)
+ .filter(distinctByProperty(org.openstack4j.model.compute.Image::getId)).collect(Collectors.toList());
+ }
+
+ @Override
+ public List<org.openstack4j.model.compute.Flavor> extractOpenstackFlavorsFromServers(final List<Server> servers) {
+ Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
+ return servers.stream().map(Server::getFlavor)
+ .filter(distinctByProperty(org.openstack4j.model.compute.Flavor::getId)).collect(Collectors.toList());
+ }
+
+ @Override
+ public void buildAddImagesToAaiAction(final List<org.openstack4j.model.compute.Image> images)
+ throws HeatBridgeException {
+ for (org.openstack4j.model.compute.Image image : images) {
+ Image aaiImage = aaiHelper.buildImage(image);
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.IMAGE, cloudOwner, cloudRegionId, aaiImage.getImageId());
+ if (!resourcesClient.exists(uri)) {
+ transaction.create(uri, aaiImage);
+ logger.debug("Queuing AAI command to add image: " + aaiImage.getImageId());
+ } else {
+ logger.debug("Nothing to add since image: " + aaiImage.getImageId() + "already exists in AAI.");
+ }
+ } catch (WebApplicationException e) {
+ throw new HeatBridgeException("Failed to update image to AAI: " + aaiImage.getImageId() + ". Error"
+ + " cause: " + e, e);
+ }
+ }
+ }
+
+ @Override
+ public void buildAddFlavorsToAaiAction(final List<org.openstack4j.model.compute.Flavor> flavors)
+ throws HeatBridgeException {
+ for (org.openstack4j.model.compute.Flavor flavor : flavors) {
+ Flavor aaiFlavor = aaiHelper.buildFlavor(flavor);
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.FLAVOR, cloudOwner, cloudRegionId, aaiFlavor.getFlavorId());
+ if (!resourcesClient.exists(uri)) {
+ transaction.create(uri, aaiFlavor);
+ logger.debug("Queuing AAI command to add flavor: " + aaiFlavor.getFlavorId());
+ } else {
+ logger.debug("Nothing to add since flavor: " + aaiFlavor.getFlavorId() + "already exists in AAI.");
+ }
+ } catch (WebApplicationException e) {
+ throw new HeatBridgeException("Failed to update flavor to AAI: " + aaiFlavor.getFlavorId() + ". Error"
+ + " cause: " + e, e);
+ }
+ }
+ }
+
+ @Override
+ public void buildAddVserversToAaiAction(final String genericVnfId, final String vfModuleId,
+ final List<Server> servers) {
+ servers.forEach(server -> {
+ Vserver vserver = aaiHelper.buildVserver(server.getId(), server);
+
+ // Build vserver relationships to: image, flavor, pserver, vf-module
+ vserver.setRelationshipList(aaiHelper.getVserverRelationshipList(cloudOwner, cloudRegionId, genericVnfId,
+ vfModuleId, server));
+ transaction.create(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegionId, tenantId, vserver.getVserverId()), vserver);
+ });
+ }
+
+ @Override
+ public void buildAddVserverLInterfacesToAaiAction(final List<Resource> stackResources,
+ final List<String> oobMgtNetIds) {
+ Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
+ List<String> portIds = extractStackResourceIdsByResourceType(stackResources,
+ HeatBridgeConstants.OS_PORT_RESOURCE_TYPE);
+ for (String portId : portIds) {
+ Port port = osClient.getPortById(portId);
+ LInterface lIf = new LInterface();
+ lIf.setInterfaceId(port.getId());
+ lIf.setInterfaceName(port.getName());
+ lIf.setMacaddr(port.getMacAddress());
+ if (oobMgtNetIds != null && oobMgtNetIds.contains(port.getNetworkId())) {
+ lIf.setInterfaceRole(OOB_MGT_NETWORK_IDENTIFIER);
+ } else {
+ lIf.setInterfaceRole(port.getvNicType());
+ }
+
+ updateLInterfaceIps(port, lIf);
+ updateLInterfaceVlan(port, lIf);
+
+ // Update l-interface to the vserver
+ transaction.create(AAIUriFactory.createResourceUri(
+ AAIObjectType.L_INTERFACE, cloudOwner, cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName()), lIf);
+ }
+ }
+
+ private void updateLInterfaceVlan(final Port port, final LInterface lIf) {
+ Vlan vlan = new Vlan();
+ Network network = osClient.getNetworkById(port.getNetworkId());
+ lIf.setNetworkName(network.getName());
+ if (network.getNetworkType().equals(NetworkType.VLAN)) {
+ vlan.setVlanInterface(network.getProviderSegID());
+ Vlans vlans = new Vlans();
+ List<Vlan> vlanList = vlans.getVlan();
+ vlanList.add(vlan);
+ lIf.setVlans(vlans);
+ }
+ // Build sriov-vf to the l-interface
+ if (port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
+ SriovVfs sriovVfs = new SriovVfs();
+ // JAXB does not generate setters for list, however getter ensures its creation.
+ // Thus, all list manipulations must be made on live list.
+ List<SriovVf> sriovVfList = sriovVfs.getSriovVf();
+ SriovVf sriovVf = new SriovVf();
+ sriovVf.setPciId(port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
+ sriovVf.setNeutronNetworkId(port.getNetworkId());
+ if (port.getVifDetails() != null) {
+ sriovVf.setVfVlanFilter((String) port.getVifDetails().get(HeatBridgeConstants.OS_VLAN_NETWORK_KEY));
+ }
+ sriovVfList.add(sriovVf);
+
+ lIf.setSriovVfs(sriovVfs);
+
+ // For the given port create sriov-pf for host pserver/p-interface if absent
+ updateSriovPfToPserver(port, lIf);
+ }
+ }
+
+ /**
+ * Needs to be corrected according to the specification that is in draft
+ * If pserver/p-interface does not have a SRIOV-PF object matching the PCI-ID of the Openstack port object, then
+ * create it in AAI.
+ * Openstack SRIOV Port object has pci-id (to match sriov-pf on pserver/p-interface), physical-network ID (that
+ * matches the p-interface name).
+ *
+ * @param port Openstack port object
+ * @param lIf AAI l-interface object
+ */
+ private void updateSriovPfToPserver(final Port port, final LInterface lIf) {
+ if (port.getProfile() == null || Strings
+ .isNullOrEmpty(port.getProfile().get(HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY).toString())) {
+ logger.debug("The SRIOV port:" + port.getName() + " is missing physical-network-id, cannot update "
+ + "sriov-pf object for host pserver: " + port.getHostId());
+ return;
+ }
+ Optional<String> matchingPifName = HeatBridgeUtils
+ .getMatchingPserverPifName(port.getProfile().get(HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY).toString());
+ if (matchingPifName.isPresent()) {
+ // Update l-interface description
+ String pserverHostName = port.getHostId();
+ lIf.setInterfaceDescription(
+ "Attached to SR-IOV port: " + pserverHostName + "::" + matchingPifName.get());
+ try {
+ Optional<PInterface> matchingPIf = resourcesClient.get(PInterface.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.P_INTERFACE, pserverHostName, matchingPifName.get()).depth(Depth.ONE));
+ if (matchingPIf.isPresent()) {
+ SriovPfs pIfSriovPfs = matchingPIf.get().getSriovPfs();
+ if (pIfSriovPfs == null) {
+ pIfSriovPfs = new SriovPfs();
+ }
+ // Extract PCI-ID from OS port object
+ String pfPciId = port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString();
+
+ List<SriovPf> existingSriovPfs = pIfSriovPfs.getSriovPf();
+ if (CollectionUtils.isEmpty(existingSriovPfs) || existingSriovPfs.stream()
+ .noneMatch(existingSriovPf -> existingSriovPf.getPfPciId().equals(pfPciId))) {
+ // Add sriov-pf object with PCI-ID to AAI
+ SriovPf sriovPf = new SriovPf();
+ sriovPf.setPfPciId(pfPciId);
+ logger.debug("Queuing AAI command to update sriov-pf object to pserver: " + pserverHostName + "/" +
+ matchingPifName.get());
+ transaction.create(AAIUriFactory.createResourceUri(
+ AAIObjectType.SRIOV_PF, pserverHostName, matchingPifName.get(), sriovPf.getPfPciId()), sriovPf);
+ }
+ }
+ } catch (WebApplicationException e) {
+ // Silently log that we failed to update the Pserver p-interface with PCI-ID
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION, pserverHostName, matchingPifName.get(), cloudOwner,
+ tenantId, "OpenStack", "Heatbridge", ErrorCode.DataError.getValue(), "Exception - Failed to add sriov-pf object to pserver", e);
+ }
+ }
+ }
+
+ private void updateLInterfaceIps(final Port port, final LInterface lIf) {
+ List<L3InterfaceIpv4AddressList> lInterfaceIps = lIf.getL3InterfaceIpv4AddressList();
+ for (IP ip : port.getFixedIps()) {
+ String ipAddress = ip.getIpAddress();
+ if (InetAddressValidator.getInstance().isValidInet4Address(ipAddress)) {
+ L3InterfaceIpv4AddressList lInterfaceIp = new L3InterfaceIpv4AddressList();
+ lInterfaceIp.setL3InterfaceIpv4Address(ipAddress);
+ lInterfaceIp.setNeutronNetworkId(port.getNetworkId());
+ lInterfaceIp.setNeutronSubnetId(ip.getSubnetId());
+ lInterfaceIp.setL3InterfaceIpv4PrefixLength(32L);
+ lInterfaceIps.add(lInterfaceIp);
+ }
+ }
+ }
+
+ @Override
+ public void submitToAai() throws HeatBridgeException {
+ try {
+ transaction.execute();
+ } catch (BulkProcessFailed e) {
+ String msg = "Failed to commit transaction";
+ logger.debug(msg + " with error: " + e);
+ throw new HeatBridgeException(msg, e);
+ }
+ }
+
+ private <T> Predicate<T> distinctByProperty(Function<? super T, Object> keyExtractor) {
+ Map<Object, Boolean> map = new ConcurrentHashMap<>();
+ return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
new file mode 100644
index 0000000000..1f302341ad
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge.constants;
+
+public class HeatBridgeConstants {
+
+ private HeatBridgeConstants() {
+ throw new IllegalStateException("Trying to instantiate a constants class.");
+ }
+
+ /**
+ * Openstack related constants
+ */
+ public static final Integer OS_DEFAULT_HEAT_NESTING = 5;
+ public static final String OS_SERVER_RESOURCE_TYPE = "OS::Nova::Server";
+ public static final String OS_PORT_RESOURCE_TYPE = "OS::Neutron::Port";
+ public static final String OS_SRIOV_PORT_TYPE = "direct";
+ public static final String OS_PCI_SLOT_KEY = "pci_slot";
+ public static final String OS_PHYSICAL_NETWORK_KEY = "physical_network";
+ public static final String OS_VLAN_NETWORK_KEY = "vlan";
+ public static final String OS_UNKNOWN_KEY = "unknown";
+ public static final String OS_RESOURCES_SELF_LINK_KEY = "self";
+ public static final String OS_DEFAULT_DOMAIN_NAME = "default";
+ public static final String OS_KEYSTONE_V2_KEY = "v2.0";
+ public static final String OS_KEYSTONE_V3_KEY = "v3";
+ public static final String OS_NAME_KEY = "name";
+
+ /**
+ * AAI related constants
+ */
+ public static final String AAI_GENERIC_VNF = "generic-vnf";
+ public static final String AAI_GENERIC_VNF_ID = "generic-vnf.vnf-id";
+ public static final String AAI_PSERVER = "pserver";
+ public static final String AAI_VSERVER = "vserver";
+ public static final String AAI_PSERVER_HOSTNAME = "pserver.hostname";
+ public static final String AAI_VF_MODULE = "vf-module";
+ public static final String AAI_VF_MODULE_ID = "vf-module.vf-module-id";
+ public static final String AAI_IMAGE = "image";
+ public static final String AAI_IMAGE_ID = "image.image-id";
+ public static final String AAI_CLOUD_OWNER = "cloud-region.cloud-owner";
+ public static final String AAI_CLOUD_REGION_ID = "cloud-region.cloud-region-id";
+ public static final String AAI_FLAVOR = "flavor";
+ public static final String AAI_FLAVOR_ID = "flavor.flavor-id";
+ public static final String AAI_RESOURCE_DEPTH_ALL = "all";
+ public static final String AAI_SRIOV_PF = "sriov-pf";
+ public static final String AAI_P_INTERFACE_NAME = "p-interface.interface-name";
+ public static final String AAI_SRIOV_PF_PCI_ID = "sriov-pf.pf-pci-id";
+
+ /**
+ * Keys for internal usage
+ */
+ public static final String KEY_FLAVORS = "flavors";
+ public static final String KEY_IMAGES = "images";
+ public static final String KEY_VSERVERS = "vservers";
+ public static final String KEY_SRIOV_PFS = "pserverSriovPfs";
+ public static final String KEY_GLOBAL_SUBSCRIBER_ID = "globalSubscriberId";
+ public static final String KEY_SERVICE_TYPE = "subscriptionServiceType";
+ public static final String KEY_SERVICE_INSTANCE_ID = "serviceInstanceId";
+ public static final String KEY_VNF_INSTANCE_ID = "genericVnfId";
+ public static final String KEY_MSO_REQUEST_ID = "msoRequestId";
+ public static final String KEY_SO_WORKFLOW_EXCEPTION = "WorkflowException";
+ public static final String KEY_PROCESS_STATUS_MSG = "processStatusMsg";
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
new file mode 100644
index 0000000000..100b50e502
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge.factory;
+
+import org.onap.so.heatbridge.HeatBridgeException;
+import org.onap.so.heatbridge.openstack.api.OpenstackClient;
+
+/**
+ * Defines contract to load the cloud configuration from SO, authenticate with keystone for a given cloud-region and
+ * tenant.
+ */
+public interface MsoCloudClientFactory {
+
+ /**
+ * Get the Openstack Client for keystone version specified in cloud configuration.
+ *
+ * @param url openstack url
+ * @param msoId openstack user for mso
+ * @param msoPass openstack password for mso user
+ * @param cloudRegionId cloud-region identifier
+ * @param tenantId tenant identifier
+ * @return Openstack Client for the keystone version requested
+ * @throws HeatBridgeException if any errors when reading cloud configuration or getting openstack client
+ */
+
+
+ OpenstackClient getOpenstackClient(String url, String msoId, String msoPass, String cloudRegionId, String tenantId) throws HeatBridgeException;
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
new file mode 100644
index 0000000000..b70b32a4d6
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge.factory;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Objects;
+import javax.annotation.Nonnull;
+import org.onap.so.heatbridge.HeatBridgeException;
+import org.onap.so.heatbridge.constants.HeatBridgeConstants;
+import org.onap.so.heatbridge.openstack.api.OpenstackAccess;
+import org.onap.so.heatbridge.openstack.api.OpenstackAccess.OpenstackAccessBuilder;
+import org.onap.so.heatbridge.openstack.api.OpenstackClient;
+import org.onap.so.heatbridge.openstack.api.OpenstackClientException;
+import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactory;
+import org.onap.so.utils.CryptoUtils;
+
+/**
+ * This class implements {@link MsoCloudClientFactory}
+ * It loads the cloud configuration from SO and uses it to authenticate with keystone.
+ * As a result of authentication with keystone, it returns the Openstack client with the auth token so that
+ * subsequent API calls to Openstack can be made.
+ */
+public class MsoCloudClientFactoryImpl implements MsoCloudClientFactory {
+
+ private OpenstackClientFactory openstackClientFactory;
+
+ public MsoCloudClientFactoryImpl(@Nonnull OpenstackClientFactory openstackClientFactory) {
+ Objects.requireNonNull(openstackClientFactory, "Null OpenstackClientFactory object");
+ this.openstackClientFactory = openstackClientFactory;
+ }
+ @Override
+ public OpenstackClient getOpenstackClient(@Nonnull String url, @Nonnull String msoId, @Nonnull String msoPass, @Nonnull String cloudRegionId, @Nonnull String tenantId) throws
+ HeatBridgeException {
+ Objects.requireNonNull(url, "Null openstack url!");
+ Objects.requireNonNull(msoId, "Null openstack user id!");
+ Objects.requireNonNull(msoPass, "Null openstack password!");
+ Objects.requireNonNull(cloudRegionId, "Null cloud-region ID!");
+ Objects.requireNonNull(tenantId, "Null tenant ID!");
+ try {
+ final OpenstackAccess osAccess = new OpenstackAccessBuilder()
+ .setBaseUrl(url) // keystone URL
+ .setUser(msoId) // keystone username
+ .setPassword(CryptoUtils.decryptCloudConfigPassword(msoPass)) // keystone decrypted password
+ .setRegion(cloudRegionId) // openstack region
+ .setDomainName(HeatBridgeConstants.OS_DEFAULT_DOMAIN_NAME) // hardcode to "default"
+ .setTenantId(tenantId) // tenantId
+ .build();
+
+ // Identify the Keystone version
+ String version = new URL(url).getPath().replace("/", "");
+ if (version.equals(HeatBridgeConstants.OS_KEYSTONE_V2_KEY)) {
+ return openstackClientFactory.createOpenstackV2Client(osAccess);
+ } else if (version.equals(HeatBridgeConstants.OS_KEYSTONE_V3_KEY)) {
+ return openstackClientFactory.createOpenstackV3Client(osAccess);
+ }
+ throw new OpenstackClientException("Unsupported keystone version!");
+ } catch (MalformedURLException e) {
+ throw new HeatBridgeException("Malformed Keystone Endpoint in SO configuration.", e);
+ } catch (OpenstackClientException osClientEx) {
+ throw new HeatBridgeException("Client error when authenticating with the Openstack V3.", osClientEx);
+ }
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
new file mode 100644
index 0000000000..a0f1f0798f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2018 Bell Canada.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge.helpers;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.apache.commons.collections.CollectionUtils;
+import org.onap.aai.domain.yang.Flavor;
+import org.onap.aai.domain.yang.Image;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipData;
+import org.onap.aai.domain.yang.RelationshipList;
+import org.onap.aai.domain.yang.SriovVf;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.heatbridge.constants.HeatBridgeConstants;
+import org.openstack4j.model.compute.Server;
+
+/**
+ * This class provides wrapper methods to manage creation of AAI objects and extracting objects from AAI and
+ * transforming into required objects.
+ */
+public class AaiHelper {
+
+ /**
+ * Build vserver relationship object to entities: pserver, vf-module, image, flavor
+ *
+ * @param cloudOwner AAI cloudOwner value
+ * @param cloudRegionId AAI cloud-region identifier
+ * @param genericVnfId AAI generic-vnf identifier
+ * @param vfModuleId AAI vf-module identifier
+ * @param server Openstack Server object
+ */
+ public RelationshipList getVserverRelationshipList(final String cloudOwner, final String cloudRegionId, final String
+ genericVnfId, final String vfModuleId, final Server server) {
+ RelationshipList relationshipList = new RelationshipList();
+ List<Relationship> relationships = relationshipList.getRelationship();
+
+ // vserver to pserver relationship
+ Relationship pserverRelationship = buildRelationship(HeatBridgeConstants.AAI_PSERVER,
+ ImmutableMap.<String, String>builder()
+ .put(HeatBridgeConstants.AAI_PSERVER_HOSTNAME, server.getHypervisorHostname())
+ .build());
+ relationships.add(pserverRelationship);
+
+ // vserver to vf-module relationship
+ Relationship vfModuleRelationship = buildRelationship(HeatBridgeConstants.AAI_VF_MODULE,
+ ImmutableMap.<String, String>builder()
+ .put(HeatBridgeConstants.AAI_GENERIC_VNF_ID, genericVnfId)
+ .put(HeatBridgeConstants.AAI_VF_MODULE_ID, vfModuleId)
+ .build());
+ relationships.add(vfModuleRelationship);
+
+ // vserver to image relationship
+ Relationship imageRel = buildRelationship(HeatBridgeConstants.AAI_IMAGE,
+ ImmutableMap.<String, String>builder()
+ .put(HeatBridgeConstants.AAI_CLOUD_OWNER, cloudOwner)
+ .put(HeatBridgeConstants.AAI_CLOUD_REGION_ID, cloudRegionId)
+ .put(HeatBridgeConstants.AAI_IMAGE_ID, server.getImage().getId())
+ .build());
+ relationships.add(imageRel);
+
+ // vserver to flavor relationship
+ Relationship flavorRel = buildRelationship(HeatBridgeConstants.AAI_FLAVOR,
+ ImmutableMap.<String, String>builder()
+ .put(HeatBridgeConstants.AAI_CLOUD_OWNER, cloudOwner)
+ .put(HeatBridgeConstants.AAI_CLOUD_REGION_ID, cloudRegionId)
+ .put(HeatBridgeConstants.AAI_FLAVOR_ID, server.getFlavor().getId())
+ .build());
+ relationships.add(flavorRel);
+ return relationshipList;
+ }
+
+ public RelationshipList getLInterfaceRelationshipList(final String pserverName, final String pIfName,
+ final String pfPciId) {
+ RelationshipList relationshipList = new RelationshipList();
+ List<Relationship> relationships = relationshipList.getRelationship();
+
+ // sriov-vf to sriov-pf relationship
+ Relationship sriovPfRelationship = buildRelationship(HeatBridgeConstants.AAI_SRIOV_PF,
+ ImmutableMap.<String, String>builder()
+ .put(HeatBridgeConstants.AAI_PSERVER_HOSTNAME, pserverName)
+ .put(HeatBridgeConstants.AAI_P_INTERFACE_NAME, pIfName)
+ .put(HeatBridgeConstants.AAI_SRIOV_PF_PCI_ID, pfPciId)
+ .build());
+ relationships.add(sriovPfRelationship);
+
+ return relationshipList;
+ }
+
+ /**
+ * Transform Openstack Server object to AAI Vserver object
+ *
+ * @param serverId Openstack server identifier
+ * @param server Openstack server object
+ * @return AAI Vserver object
+ */
+ public Vserver buildVserver(final String serverId, final Server server) {
+ Vserver vserver = new Vserver();
+ vserver.setInMaint(false);
+ vserver.setIsClosedLoopDisabled(false);
+ vserver.setVserverId(serverId);
+ vserver.setVserverName(server.getName());
+ vserver.setVserverName2(server.getName());
+ vserver.setProvStatus(server.getStatus().value());
+ server.getLinks().stream().filter(link -> link.getRel().equals(HeatBridgeConstants.OS_RESOURCES_SELF_LINK_KEY))
+ .findFirst().ifPresent(link -> vserver.setVserverSelflink(link.getHref()));
+ return vserver;
+ }
+
+ /**
+ * Transform Openstack Image object to AAI Image object
+ *
+ * @param image Openstack Image object
+ * @return AAI Image object
+ */
+ public Image buildImage(final org.openstack4j.model.compute.Image image) {
+ Image aaiImage = new Image();
+ aaiImage.setImageId(image.getId());
+ aaiImage.setImageName(image.getName());
+ aaiImage.setImageOsDistro(HeatBridgeConstants.OS_UNKNOWN_KEY);
+ aaiImage.setImageOsVersion(HeatBridgeConstants.OS_UNKNOWN_KEY);
+ image.getLinks().stream().filter(link -> link.getRel().equals(HeatBridgeConstants.OS_RESOURCES_SELF_LINK_KEY))
+ .findFirst().ifPresent(link -> aaiImage.setImageSelflink(link.getHref()));
+ return aaiImage;
+ }
+
+ /**
+ * Transform Openstack Flavor object to AAI Flavor object
+ *
+ * @param flavor Openstack Flavor object
+ * @return AAI Flavor object
+ */
+ public Flavor buildFlavor(final org.openstack4j.model.compute.Flavor flavor) {
+ Flavor aaiFlavor = new Flavor();
+ aaiFlavor.setFlavorId(flavor.getId());
+ aaiFlavor.setFlavorName(flavor.getName());
+ flavor.getLinks().stream().filter(link -> link.getRel().equals(HeatBridgeConstants.OS_RESOURCES_SELF_LINK_KEY))
+ .findFirst().ifPresent(link -> aaiFlavor.setFlavorSelflink(link.getHref()));
+ return aaiFlavor;
+ }
+
+ /**
+ * Extract a list of flavors URI associated with the list of vservers
+ *
+ * @param vservers List of vserver AAI objects
+ * @return a list of related flavor related-links
+ */
+ public List<String> getFlavorsUriFromVserver(final List<Vserver> vservers) {
+ List<String> flavorUris = new ArrayList<>();
+ vservers.forEach(vserver -> flavorUris.addAll(
+ filterRelatedLinksByRelatedToProperty(vserver.getRelationshipList(), HeatBridgeConstants.AAI_FLAVOR)));
+ return flavorUris;
+ }
+
+ /**
+ * Extract a list of images URI associated with the list of vservers
+ *
+ * @param vservers List of vserver AAI objects
+ * @return a list of related image related-links
+ */
+ public List<String> getImagesUriFromVserver(final List<Vserver> vservers) {
+ List<String> imageUris = new ArrayList<>();
+ vservers.forEach(vserver -> imageUris.addAll(
+ filterRelatedLinksByRelatedToProperty(vserver.getRelationshipList(), HeatBridgeConstants.AAI_IMAGE)));
+ return imageUris;
+ }
+
+ /**
+ * From the list vserver objects build a map of compute hosts's name and the PCI IDs linked to it.
+ *
+ * @param vservers List of vserver AAI objects
+ * @return a map of compute names to the PCI ids associated with the compute
+ */
+ public Map<String, List<String>> getPserverToPciIdMap(final List<Vserver> vservers) {
+ Map<String, List<String>> pserverToPciIdMap = new HashMap<>();
+ for(Vserver vserver : vservers) {
+ if(vserver.getLInterfaces() != null) {
+ List<String> pciIds = vserver.getLInterfaces().getLInterface()
+ .stream()
+ .filter(lInterface -> lInterface.getSriovVfs() != null
+ && CollectionUtils.isNotEmpty(lInterface.getSriovVfs().getSriovVf()))
+ .flatMap(lInterface -> lInterface.getSriovVfs().getSriovVf().stream())
+ .map(SriovVf::getPciId)
+ .collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(pciIds)) {
+ List<String> matchingPservers = extractRelationshipDataValue(vserver.getRelationshipList(),
+ HeatBridgeConstants.AAI_PSERVER, HeatBridgeConstants.AAI_PSERVER_HOSTNAME);
+ Preconditions.checkState(matchingPservers != null && matchingPservers.size() == 1,
+ "Invalid pserver relationships for vserver: " + vserver.getVserverName());
+ pserverToPciIdMap.put(matchingPservers.get(0), pciIds);
+ }
+ }
+ }
+ return pserverToPciIdMap;
+ }
+
+ /**
+ * Extract from relationship-list object all the relationship-value that match the related-to and
+ * relationship-key fields.
+ *
+ * @param relationshipListObj AAI relationship-list object
+ * @param relatedToProperty related-to value
+ * @param relationshipKey relationship-key value
+ * @return relationship-value matching the key requested for the relationship object of type related-to property
+ */
+ private List<String> extractRelationshipDataValue(final RelationshipList relationshipListObj,
+ final String relatedToProperty, final String relationshipKey) {
+ if (relationshipListObj != null && relationshipListObj.getRelationship() != null) {
+ return relationshipListObj.getRelationship().stream()
+ .filter(relationship -> relationship.getRelatedTo().equals(relatedToProperty))
+ .map(Relationship::getRelationshipData)
+ .flatMap(Collection::stream)
+ .filter(data -> data.getRelationshipKey() != null && relationshipKey.equals(data.getRelationshipKey()))
+ .map(RelationshipData::getRelationshipValue)
+ .collect(Collectors.toList());
+ }
+ return new ArrayList<>();
+ }
+
+ /**
+ * Extract and filter the related-links to all objects that match the type specified by the filter property
+ *
+ * @param relationshipListObj AAI object representing relationship object
+ * @param relatedToProperty Value identifying the type of AAI object for related-to field
+ * @return a list of related-links filtered by the specified related-to property
+ */
+ private List<String> filterRelatedLinksByRelatedToProperty(final RelationshipList relationshipListObj,
+ final String relatedToProperty) {
+ if (relationshipListObj != null && relationshipListObj.getRelationship() != null) {
+ return relationshipListObj.getRelationship().stream()
+ .filter(relationship -> relationship.getRelatedTo().equals(relatedToProperty))
+ .map(Relationship::getRelatedLink)
+ .collect(Collectors.toList());
+ }
+ return new ArrayList<>();
+ }
+
+ /**
+ * Build the relationship object
+ *
+ * @param relatedTo Related to entity value
+ * @param relationshipKeyValues Key value pairs of relationship data
+ * @return AAI Relationship object
+ */
+ private Relationship buildRelationship(final String relatedTo, final Map<String, String> relationshipKeyValues) {
+ Relationship relationship = new Relationship();
+ relationship.setRelatedTo(relatedTo);
+ relationshipKeyValues.keySet().forEach(k -> {
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipKey(k);
+ relationshipData.setRelationshipValue(relationshipKeyValues.get(k));
+ relationship.getRelationshipData().add(relationshipData);
+ });
+ return relationship;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
new file mode 100644
index 0000000000..fd5dabc784
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java
@@ -0,0 +1,120 @@
+/*-
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.heatbridge.openstack.api;
+
+import org.openstack4j.model.common.Identifier;
+
+/**
+ * Object handling OpenStack API access information.
+ */
+public class OpenstackAccess {
+ private final String baseUrl;
+ private final String tenantId;
+ private final String user;
+ private final String password;
+ private final String region;
+ private String domainName;
+ private String projectName;
+
+ public OpenstackAccess(OpenstackAccessBuilder builder) {
+ this.baseUrl = builder.baseUrl;
+ this.tenantId = builder.tenantId;
+ this.user = builder.user;
+ this.password = builder.password;
+ this.region = builder.region;
+ this.domainName = builder.domainName;
+ this.projectName = builder.projectName;
+ }
+
+ public String getUrl() {
+ return baseUrl;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getRegion() {
+ return region;
+ }
+
+ public Identifier getDomainNameIdentifier() {
+ return Identifier.byName(domainName);
+ }
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public static class OpenstackAccessBuilder {
+
+ private String baseUrl;
+ private String tenantId;
+ private String user;
+ private String password;
+ private String region;
+ private String domainName;
+ private String projectName;
+
+ public OpenstackAccessBuilder setBaseUrl(final String baseUrl) {
+ this.baseUrl = baseUrl;
+ return this;
+ }
+
+ public OpenstackAccessBuilder setTenantId(final String tenantId) {
+ this.tenantId = tenantId;
+ return this;
+ }
+
+ public OpenstackAccessBuilder setUser(final String user) {
+ this.user = user;
+ return this;
+ }
+
+ public OpenstackAccessBuilder setPassword(final String password) {
+ this.password = password;
+ return this;
+ }
+
+ public OpenstackAccessBuilder setRegion(final String region) {
+ this.region = region;
+ return this;
+ }
+
+ public OpenstackAccessBuilder setDomainName(final String domainName) {
+ this.domainName = domainName;
+ return this;
+ }
+
+ public OpenstackAccessBuilder setProjectName(final String projectName) {
+ this.projectName = projectName;
+ return this;
+ }
+
+ public OpenstackAccess build() {
+ return new OpenstackAccess(this);
+ }
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
new file mode 100644
index 0000000000..143e33581d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.heatbridge.openstack.api;
+
+import java.util.List;
+import java.util.Map;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
+import org.openstack4j.model.network.Network;
+import org.openstack4j.model.network.Port;
+
+public interface OpenstackClient {
+
+ /**
+ * Get a server object by server ID
+ * @param serverId Unique server-name (simple name) or server-id (UUID)
+ * @return Server object
+ */
+ Server getServerById(String serverId);
+
+ /**
+ * Get a port object by port ID
+ * @param portId Unique UUID of the port.
+ * @return Port object.
+ */
+ Port getPortById(String portId);
+
+ /**
+ * Returns a list of all ports we have the right to see
+ * @return List of all Openstack ports
+ */
+ List<Port> getAllPorts();
+
+ /**
+ * Returns a list of all the resources for the stack
+ * @param stackId Stack name or unique UUID
+ * @param nestingDepth The recursion level for which resources will be listed.
+ * @return List of Openstack Stack resources
+ */
+ List<Resource> getStackBasedResources(String stackId, int nestingDepth);
+
+ /**
+ * Get a network instance by network ID
+ * @param networkId Unique UUID of the network.
+ * @return Network object.
+ */
+ Network getNetworkById(String networkId);
+
+ /**
+ * List networks by filtering parameters
+ * @param filterParams key-value pairs for filtering params
+ * @return List of filtered Network objects
+ */
+ List<Network> listNetworksByFilter(Map<String, String> filterParams);
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java
new file mode 100644
index 0000000000..a062ca826d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java
@@ -0,0 +1,29 @@
+/*-
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.heatbridge.openstack.api;
+
+public class OpenstackClientException extends Exception {
+ private static final long serialVersionUID = -5514207977226960180L;
+
+ public OpenstackClientException(final String message) {
+ super(message);
+ }
+
+ public OpenstackClientException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
new file mode 100644
index 0000000000..ebd4753323
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.heatbridge.openstack.api;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import org.openstack4j.api.OSClient;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
+import org.openstack4j.model.network.Network;
+import org.openstack4j.model.network.Port;
+
+abstract class OpenstackClientImpl implements OpenstackClient {
+ @Override
+ public Server getServerById(String serverId) {
+ return getClient().compute().servers().get(serverId);
+ }
+
+ @Override
+ public Port getPortById(String portId) {
+ return getClient().networking().port().get(portId);
+ }
+
+ @Override
+ public List<Port> getAllPorts() { return (List<Port>)getClient().networking().port().list(); }
+
+ @Override
+ public List<Resource> getStackBasedResources(String stackId, int nestingDepth) {
+ return getClient().heat()
+ .resources()
+ .list(stackId, nestingDepth)
+ .stream()
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public Network getNetworkById(String networkId) {
+ return getClient().networking().network().get(networkId);
+ }
+
+ @Override
+ public List<Network> listNetworksByFilter(Map<String, String> filterParams) {
+ return (List<Network>) getClient().networking().network().list(filterParams);
+ }
+
+ /**
+ * Retrieves the specific client to utilize.
+ * @return The specific client to utilize
+ */
+ protected abstract OSClient getClient();
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java
new file mode 100644
index 0000000000..760be72b3f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.heatbridge.openstack.api;
+
+import org.openstack4j.api.OSClient;
+import org.openstack4j.api.OSClient.OSClientV2;
+
+public class OpenstackV2ClientImpl extends OpenstackClientImpl {
+
+ private OSClientV2 client;
+
+ public OpenstackV2ClientImpl(OSClientV2 client) {
+ this.client = client;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected OSClient getClient() {
+ return client;
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java
new file mode 100644
index 0000000000..dddd82ce6a
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.heatbridge.openstack.api;
+
+import org.openstack4j.api.OSClient;
+import org.openstack4j.api.OSClient.OSClientV3;
+
+public class OpenstackV3ClientImpl extends OpenstackClientImpl {
+
+ private OSClientV3 client;
+
+ public OpenstackV3ClientImpl(OSClientV3 client) {
+ this.client = client;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected OSClient getClient() {
+ return client;
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java
new file mode 100644
index 0000000000..5019eec09b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java
@@ -0,0 +1,27 @@
+/*-
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge.openstack.factory;
+
+import org.onap.so.heatbridge.openstack.api.OpenstackAccess;
+import org.onap.so.heatbridge.openstack.api.OpenstackClient;
+import org.onap.so.heatbridge.openstack.api.OpenstackClientException;
+
+public interface OpenstackClientFactory {
+
+ OpenstackClient createOpenstackV3Client(OpenstackAccess osAccess) throws OpenstackClientException;
+
+ OpenstackClient createOpenstackV2Client(OpenstackAccess osAccess) throws OpenstackClientException;
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
new file mode 100644
index 0000000000..72b3795053
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
@@ -0,0 +1,74 @@
+/*-
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge.openstack.factory;
+
+import com.google.common.base.Preconditions;
+import org.onap.so.heatbridge.openstack.api.OpenstackAccess;
+import org.onap.so.heatbridge.openstack.api.OpenstackClient;
+import org.onap.so.heatbridge.openstack.api.OpenstackClientException;
+import org.onap.so.heatbridge.openstack.api.OpenstackV2ClientImpl;
+import org.onap.so.heatbridge.openstack.api.OpenstackV3ClientImpl;
+import org.openstack4j.api.OSClient.OSClientV2;
+import org.openstack4j.api.OSClient.OSClientV3;
+import org.openstack4j.api.exceptions.AuthenticationException;
+import org.openstack4j.openstack.OSFactory;
+
+public class OpenstackClientFactoryImpl implements OpenstackClientFactory {
+
+ @Override
+ public OpenstackClient createOpenstackV3Client(OpenstackAccess osAccess) throws OpenstackClientException {
+ Preconditions.checkNotNull(osAccess.getUrl(), "Keystone-v3 Auth: endpoint not set.");
+ Preconditions.checkNotNull(osAccess.getUser(), "Keystone-v3 Auth: username not set.");
+ Preconditions.checkNotNull(osAccess.getPassword(), "Keystone-v3 Auth: password not set.");
+ Preconditions.checkNotNull(osAccess.getDomainNameIdentifier(), "Keystone-v3 Auth: domain not set.");
+ Preconditions.checkNotNull(osAccess.getRegion(), "Keystone-v3 Auth: region not set.");
+
+ OSClientV3 client;
+ try {
+ client = OSFactory.builderV3()
+ .endpoint(osAccess.getUrl())
+ .credentials(osAccess.getUser(), osAccess.getPassword(), osAccess.getDomainNameIdentifier())
+ .authenticate()
+ .useRegion(osAccess.getRegion());
+ return new OpenstackV3ClientImpl(client);
+ } catch (AuthenticationException exception) {
+ throw new OpenstackClientException("Failed to authenticate with Keystone-v3: " + osAccess.getUrl(), exception);
+ }
+ }
+
+ @Override
+ public OpenstackClient createOpenstackV2Client(OpenstackAccess osAccess) throws OpenstackClientException {
+ Preconditions.checkNotNull(osAccess.getUrl(), "Keystone-v2 Auth: endpoint not set.");
+ Preconditions.checkNotNull(osAccess.getUser(), "Keystone-v2 Auth: username not set.");
+ Preconditions.checkNotNull(osAccess.getPassword(), "Keystone-v2 Auth: password not set.");
+ Preconditions.checkNotNull(osAccess.getTenantId(), "Keystone-v2 Auth: domain not set.");
+ Preconditions.checkNotNull(osAccess.getRegion(), "Keystone-v2 Auth: region not set.");
+
+ OSClientV2 client;
+ try {
+ client = OSFactory.builderV2()
+ .endpoint(osAccess.getUrl())
+ .credentials(osAccess.getUser(), osAccess.getPassword())
+ .tenantId(osAccess.getTenantId())
+ .authenticate()
+ .useRegion(osAccess.getRegion());
+ return new OpenstackV2ClientImpl(client);
+ } catch (AuthenticationException exception) {
+ throw new OpenstackClientException("Failed to authenticate with Keystone-v2.0: " + osAccess.getUrl(),
+ exception);
+ }
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
new file mode 100644
index 0000000000..7daa8c2c71
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.heatbridge.utils;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import java.util.Optional;
+import javax.annotation.Nonnull;
+
+public class HeatBridgeUtils {
+
+ private HeatBridgeUtils() {
+ throw new IllegalStateException("Trying to instantiate a utility class.");
+ }
+
+ /**
+ * IaaS naming convention for compute/p-interface to openstack/physical-network name mapping
+ */
+ private static final String OS_SIDE_SHARED_SRIOV_PREFIX = "shared-";
+ private static final String OS_SIDE_DEDICATED_SRIOV_PREFIX = "dedicated-";
+ private static final String COMPUTE_SIDE_SHARED_SRIOV_PREFIX = "sriov-s-";
+ private static final String COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX = "sriov-d-";
+
+ public static Optional<String> getMatchingPserverPifName(@Nonnull final String physicalNetworkName) {
+ Preconditions.checkState(!Strings.isNullOrEmpty(physicalNetworkName), "Physical network name is null or "
+ + "empty!");
+ if (physicalNetworkName.contains(OS_SIDE_DEDICATED_SRIOV_PREFIX)) {
+ return Optional
+ .of(physicalNetworkName.replace(OS_SIDE_DEDICATED_SRIOV_PREFIX, COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX));
+ } else if (physicalNetworkName.contains(OS_SIDE_SHARED_SRIOV_PREFIX)) {
+ return Optional
+ .of(physicalNetworkName.replace(OS_SIDE_SHARED_SRIOV_PREFIX, COMPUTE_SIDE_SHARED_SRIOV_PREFIX));
+ }
+ return Optional.empty();
+ }
+
+ public static Optional<String> getMatchingPhysicalNetworkName(final String pserverPinterfaceName) {
+ if (pserverPinterfaceName.contains(COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX)) {
+ return Optional
+ .of(pserverPinterfaceName.replace(COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX, OS_SIDE_DEDICATED_SRIOV_PREFIX));
+ } else if (pserverPinterfaceName.contains(COMPUTE_SIDE_SHARED_SRIOV_PREFIX)) {
+ return Optional
+ .of(pserverPinterfaceName.replace(COMPUTE_SIDE_SHARED_SRIOV_PREFIX, OS_SIDE_SHARED_SRIOV_PREFIX));
+ }
+ return Optional.empty();
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
index 5eea46d09f..987e4cf76d 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
import java.io.File;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -42,6 +43,7 @@ import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -49,6 +51,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.heat.model.Resource;
import com.woorea.openstack.heat.model.Resources;
import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.quantum.model.Port;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -61,6 +64,9 @@ public class HeatStackAuditTest extends HeatStackAudit {
private MsoHeatUtils msoHeatUtilsMock;
@Mock
+ private MsoNeutronUtils neutronUtilsMock;
+
+ @Mock
private AuditVServer auditVserver;
private static final String cloudRegion = "cloudRegion";
@@ -72,10 +78,32 @@ public class HeatStackAuditTest extends HeatStackAudit {
private ObjectMapper stackObjectMapper = new ObjectMapper().configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ private List<Optional<Port>> portList = new ArrayList<>();
+
@Before
public void setup() throws Exception{
resources= objectMapper.readValue(new File("src/test/resources/GetResources.json"), Resources.class);
+ Port neutronPort1 =stackObjectMapper.readValue(new File("src/test/resources/NeutronPort1.json"), Port.class);
+ doReturn(Optional.of(neutronPort1)).when(neutronUtilsMock).getNeutronPort("7ee06d9d-3d18-411c-9d3e-aec930f70413", cloudRegion,tenantId);
+ Port neutronPort2 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort2.json"), Port.class);
+ doReturn(Optional.of(neutronPort2)).when(neutronUtilsMock).getNeutronPort("27391d94-33af-474a-927d-d409249e8fd3", cloudRegion,tenantId);
+ Port neutronPort3 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort3.json"), Port.class);
+ doReturn(Optional.of(neutronPort3)).when(neutronUtilsMock).getNeutronPort("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", cloudRegion,tenantId);
+ Port neutronPort4 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort4.json"), Port.class);
+ doReturn(Optional.of(neutronPort4)).when(neutronUtilsMock).getNeutronPort("8d93f63e-e972-48c7-ad98-b2122da47315", cloudRegion,tenantId);
+ Port neutronPort5 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort5.json"), Port.class);
+ doReturn(Optional.of(neutronPort5)).when(neutronUtilsMock).getNeutronPort("0594a2f2-7ea4-42eb-abc2-48ea49677fca", cloudRegion,tenantId);
+ Port neutronPort6 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort6.json"), Port.class);
+ doReturn(Optional.of(neutronPort6)).when(neutronUtilsMock).getNeutronPort("00bb8407-650e-48b5-b919-33b88d6f8fe3", cloudRegion,tenantId);
+
+ portList.add(Optional.empty());
+ portList.add(Optional.of(neutronPort1));
+ portList.add(Optional.of(neutronPort2));
+ portList.add(Optional.of(neutronPort3));
+ portList.add(Optional.of(neutronPort4));
+ portList.add(Optional.of(neutronPort5));
+ portList.add(Optional.of(neutronPort6));
}
@Test
@@ -111,13 +139,13 @@ public class HeatStackAuditTest extends HeatStackAudit {
vServer1.setLInterfaces(vServer1Linterfaces);
LInterface ssc_1_trusted_port_0 = new LInterface();
- ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b");
+ ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413");
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
LInterface ssc_1_mgmt_port_1 = new LInterface();
- ssc_1_mgmt_port_1.setInterfaceId("07f5b14c-147a-4d14-8c94-a9e94dbc097b");
+ ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
LInterface ssc_1_mgmt_port_0 = new LInterface();
@@ -187,7 +215,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
Resources service1ResourceQuerySubInt3 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface2Resources.json"), Resources.class);
doReturn(service1ResourceQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources", cloudRegion,tenantId, Resources.class);
- Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources);
+ Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources,portList);
Set<Vserver> vserversWithSubInterfaces = heatStackAudit.processSubInterfaces(cloudRegion,tenantId,resourceGroups, vServersToAudit);
String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces);
@@ -219,7 +247,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
vServer1.setLInterfaces(vServer1Linterfaces);
LInterface ssc_1_trusted_port_0 = new LInterface();
- ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b");
+ ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413");
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
LInterface ssc_1_service1_port_0 = new LInterface();
@@ -227,7 +255,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
LInterface ssc_1_mgmt_port_1 = new LInterface();
- ssc_1_mgmt_port_1.setInterfaceId("07f5b14c-147a-4d14-8c94-a9e94dbc097b");
+ ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
LInterface ssc_1_mgmt_port_0 = new LInterface();
@@ -244,7 +272,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
expectedVservers.add(vServer1);
- Set<Vserver> actualVservers = heatStackAudit.createVserverSet(resources, novaResources);
+ Set<Vserver> actualVservers = heatStackAudit.createVserverSet(resources, novaResources,portList);
assertThat(actualVservers, sameBeanAs(expectedVservers));
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
index 141be6bd7c..8f6a18225d 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
@@ -61,7 +61,7 @@ public class ValetClientTest extends BaseRestTestUtils {
mockValetCreatePostResponse_200("requestId", mapper.writeValueAsString(vcr));
- GenericValetResponse<ValetCreateResponse> actual = client.callValetCreateRequest("requestId", "regionId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
+ GenericValetResponse<ValetCreateResponse> actual = client.callValetCreateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
assertThat(actual, sameBeanAs(expected));
}
@@ -73,7 +73,7 @@ public class ValetClientTest extends BaseRestTestUtils {
mockValetCreatePutResponse_200("requestId", mapper.writeValueAsString(vur));
- GenericValetResponse<ValetUpdateResponse> actual = client.callValetUpdateRequest("requestId", "regionId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
+ GenericValetResponse<ValetUpdateResponse> actual = client.callValetUpdateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
assertThat(actual, sameBeanAs(expected));
}
@@ -85,7 +85,7 @@ public class ValetClientTest extends BaseRestTestUtils {
mockValetDeleteDeleteResponse_200("requestId", mapper.writeValueAsString(vdr));
- GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId", "tenantId", "vfModuleId", "vfModuleName");
+ GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId", "ownerId", "tenantId", "vfModuleId", "vfModuleName");
assertThat(actual, sameBeanAs(expected));
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
index 3ebaea9c2c..cbf252ec3a 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
@@ -75,7 +75,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId";
String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
- instance.createVnfA("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.createVnfA("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId",
msoRequest, notificationUrl);
@@ -85,7 +85,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
@Test
public void createVNFTest_Exception() throws Exception {
String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
- instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ instance.createVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId",
null, notificationUrl);
@@ -105,7 +105,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
(containing("messageId"))
.willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
- instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", map, "messageId", msoRequest,
notificationUrl);
}
@@ -122,7 +122,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
(containing("messageId"))
.willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest";
- instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", map, "messageId", msoRequest,
notificationUrl);
verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
@@ -133,7 +133,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.queryVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
+ instance.queryVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
"http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
}
@@ -142,7 +142,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.deleteVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
+ instance.deleteVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
"http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
}
@@ -150,6 +150,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
public void rollbackVnfTest() {
VnfRollback vnfRollBack = new VnfRollback();
vnfRollBack.setCloudSiteId("mdt1");
+ vnfRollBack.setCloudOwner("CloudOwner");
vnfRollBack.setTenantId("88a6ca3ee0394ade9403f075db23167e");
vnfRollBack.setVnfId("ff5256d1-5a33-55df-13ab-12abad84e7ff");
instance.rollbackVnfA(vnfRollBack, "messageId",
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
index be3b54e23f..0816bc55a6 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
@@ -106,7 +106,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -126,7 +126,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -146,7 +146,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -166,7 +166,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -183,7 +183,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.TRUE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -197,7 +197,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -213,7 +213,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -232,7 +232,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -252,7 +252,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -270,7 +270,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -302,7 +302,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -339,7 +339,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", null, map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -357,7 +357,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -377,7 +377,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ instance.updateVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
"88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -390,7 +390,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
mockOpenStackResponseAccess(wireMockPort);
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -407,7 +407,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
.withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -424,7 +424,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
.withStatus(HttpStatus.SC_NOT_FOUND)));
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -440,7 +440,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_INTERNAL_SERVER_ERROR,"OpenstackResponse_Stack_Created_VfModule.json");
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -456,7 +456,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_NOT_FOUND,"OpenstackResponse_Stack_Created_VfModule.json");
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -472,7 +472,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json");
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -491,7 +491,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>());
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -511,7 +511,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>());
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.updateVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ instance.updateVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -523,12 +523,12 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> outputs = new HashMap<>();
outputs.put("Key1", "value1");
- when(heatUtils.queryStackForOutputs("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12")).thenReturn(outputs);
+ when(heatUtils.queryStackForOutputs("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12")).thenReturn(outputs);
MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
MsoRequest msoRequest = getMsoRequest();
try {
- instance.deleteVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
+ instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
new Holder<Map<String, String>>());
} catch (Exception e) {
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
index 44843900fc..fbb9a224b3 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
@@ -68,7 +68,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.queryVnf("siteid", "1234", "vfname",
+ instance.queryVnf("siteid", "CloudOwner", "1234", "vfname",
msoRequest, new Holder<>(), new Holder<>(), new Holder<>(),
new Holder<>());
}
@@ -94,7 +94,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
.withBodyFile("OpenstackResponse_Access.json")
.withStatus(HttpStatus.SC_OK)));
- instance.queryVnf("mtn13", "1234", "vfname",
+ instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname",
msoRequest, new Holder<>(), new Holder<>(), new Holder<>(),
new Holder<>());
}
@@ -106,7 +106,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.deleteVfModule("mtn13", "1234", "vfname", msoRequest, new Holder<>());
+ instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>());
}
@Test
@@ -131,7 +131,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
.withBodyFile("OpenstackResponse_Access.json")
.withStatus(HttpStatus.SC_OK)));
- instance.deleteVfModule("mtn13", "1234", "vfname", msoRequest, new Holder<>());
+ instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>());
}
@Test
@@ -141,7 +141,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.deleteVnf("12344", "234", "vnfname", msoRequest);
+ instance.deleteVnf("12344", "CloudOwner", "234", "vnfname", msoRequest);
}
@@ -184,7 +184,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
}
@Test
@@ -194,7 +194,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", null, new
+ instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", null, new
HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
}
@@ -205,7 +205,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
}
@Test
@@ -215,7 +215,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.createVfModule("mtn13", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ instance.createVfModule("mtn13", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
}
@Test
@@ -241,7 +241,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
.withBodyFile("OpenstackResponse_Access.json")
.withStatus(HttpStatus.SC_OK)));
- instance.createVfModule("mtn13", "123", "vf", "v1", "", "vfname", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ instance.createVfModule("mtn13", "CloudOwner", "123", "vf", "v1", "", "vfname", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
}
@Test
@@ -251,7 +251,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
- instance.updateVfModule("123", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>());
+ instance.updateVfModule("123", "CloudOwner", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>());
}
@Test
@@ -268,7 +268,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
try {
- instance.createVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ instance.createVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", map,
Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(),
new Holder<>());
@@ -286,7 +286,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
map.put("key1", "value1");
try {
- instance.updateVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ instance.updateVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
"volumeGroupHeatStackId|1", map, msoRequest, new Holder<>(),
new Holder<>());
} catch (Exception e) {
@@ -300,7 +300,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
msoRequest.setRequestId("12345");
msoRequest.setServiceInstanceId("12345");
try {
- instance.deleteVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest);
+ instance.deleteVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest);
} catch (Exception e) {
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
index 376076a0a0..342a21a49c 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
@@ -92,7 +92,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{
.withBodyFile("MulticloudResponse_Stack_Create.json")
.withStatus(HttpStatus.SC_CREATED)));
- instance.createVfModule("MTN13", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId", "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId", "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
}
@Test
@@ -108,7 +108,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{
stubFor(delete(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse()
.withStatus(HttpStatus.SC_NO_CONTENT)));
- instance.deleteVfModule("MTN13", "123", "workload-id", msoRequest, new Holder<>());
+ instance.deleteVfModule("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>());
}
@Test
@@ -121,7 +121,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{
.withBodyFile("MulticloudResponse_Stack.json")
.withStatus(HttpStatus.SC_OK)));
- instance.queryVnf("MTN13", "123", "workload-id", msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), new Holder<>());
+ instance.queryVnf("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), new Holder<>());
}
// TODO Error Tests
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
index 0cd3d1a61d..3dcb52b8b7 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
@@ -58,7 +58,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", null, map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -70,7 +70,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -82,7 +82,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -96,7 +96,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ msoVnfPluginAdapter.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -109,7 +109,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -127,7 +127,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
+ msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD",
"volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
@@ -137,7 +137,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
public void deleteVfModule_QueryVduException() throws Exception {
expectedException.expect(VnfException.class);
MsoRequest msoRequest = getMsoRequest();
- msoVnfPluginAdapter.deleteVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
+ msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
new Holder<Map<String, String>>());
}
@@ -154,7 +154,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
MsoRequest msoRequest = getMsoRequest();
- msoVnfPluginAdapter.deleteVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
+ msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
new Holder<Map<String, String>>());
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java
index 2740e254e1..232f5b3afe 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java
@@ -59,8 +59,9 @@ public class QueryTest {
@Test
public void testQueryCreatedVnf() throws VnfException, MsoException {
StackInfo info = new StackInfo("stackName", HeatStatus.CREATED);
- when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info);
+ when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info);
String cloudId = "MT";
+ String cloudOwner = "CloudOwner";
String tenantId = "MSO_Test";
String vnfName = "VNF_TEST1";
Holder<Boolean> vnfExists = new Holder<>();
@@ -68,7 +69,7 @@ public class QueryTest {
Holder<VnfStatus> status = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
- vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
+ vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
assertTrue(vnfExists.value);
}
@@ -76,8 +77,9 @@ public class QueryTest {
@Test
public void testQueryNotFoundVnf() throws VnfException, MsoException {
StackInfo info = new StackInfo("stackName", HeatStatus.NOTFOUND);
- when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info);
+ when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info);
String cloudId = "MT";
+ String cloudOwner = "CloudOwner";
String tenantId = "MSO_Test";
String vnfName = "VNF_TEST1";
Holder<Boolean> vnfExists = new Holder<>();
@@ -85,7 +87,7 @@ public class QueryTest {
Holder<VnfStatus> status = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
- vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
+ vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
assertFalse(vnfExists.value);
}
@@ -94,6 +96,7 @@ public class QueryTest {
// @Ignore // 1802 merge
public void testQueryVnfWithException() throws VnfException, MsoException {
String cloudId = "MT";
+ String cloudOwner = "CloudOwner";
String tenantId = "MSO_Test";
String vnfName = "VNF_TEST1";
Holder<Boolean> vnfExists = new Holder<>();
@@ -102,7 +105,7 @@ public class QueryTest {
Holder<Map<String, String>> outputs = new Holder<>();
thrown.expect(VnfException.class);
thrown.expectCause(hasProperty("context", is("QueryVNF")));
- when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenThrow(new MsoOpenstackException(1, "test messsage", "test detail"));
- vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
+ when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenThrow(new MsoOpenstackException(1, "test messsage", "test detail"));
+ vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
index 343b6245e6..50bae8a074 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
@@ -82,6 +82,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
private static final String MSO_REQUEST_ID = "62265093-277d-4388-9ba6-449838ade586";
private static final String MSO_SERVICE_INSTANCE_ID = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
private static final String CLOUDSITE_ID = "mtn13";
+ private static final String CLOUD_OWNER = "CloudOwner";
private static final String TENANT_ID = "0422ffb57ba042c0800a29dc85ca70f8";
private static final String VNF_TYPE = "MSOTADevInfra_vSAMP10a_Service/vSAMP10a 1";
private static final String VNF_NAME = "MSO-DEV-VNF-1802-it3-pwt3-vSAMP10a-1XXX-Replace";
@@ -449,7 +450,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
VfModuleRollback vfModuleRollback = new VfModuleRollback(AAI_VNF_ID, VF_MODULE_ID,
- "StackId", false, TENANT_ID, CLOUDSITE_ID, msoRequest, "messageId");
+ "StackId", false, TENANT_ID, CLOUD_OWNER, CLOUDSITE_ID, msoRequest, "messageId");
RollbackVfModuleRequest request = new RollbackVfModuleRequest();
request.setVfModuleRollback(vfModuleRollback);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
new file mode 100644
index 0000000000..3c777e17cb
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -0,0 +1,375 @@
+/*
+ * Copyright (C) 2018 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.so.heatbridge;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+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.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.LInterface;
+import org.onap.aai.domain.yang.PInterface;
+import org.onap.aai.domain.yang.SriovPf;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.AAISingleTransactionClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.heatbridge.constants.HeatBridgeConstants;
+import org.onap.so.heatbridge.openstack.api.OpenstackClient;
+import org.onap.so.heatbridge.openstack.api.OpenstackClientException;
+import org.openstack4j.model.compute.Flavor;
+import org.openstack4j.model.compute.Image;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.compute.Server.Status;
+import org.openstack4j.model.heat.Resource;
+import org.openstack4j.model.network.Network;
+import org.openstack4j.model.network.NetworkType;
+import org.openstack4j.model.network.Port;
+import org.openstack4j.openstack.heat.domain.HeatResource;
+import org.openstack4j.openstack.heat.domain.HeatResource.Resources;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableMap;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class HeatBridgeImplTest {
+
+ private static final String CLOUD_OWNER = "CloudOwner";
+ private static final String REGION_ID = "RegionOne";
+ private static final String TENANT_ID = "7320ec4a5b9d4589ba7c4412ccfd290f";
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ @Mock
+ private OpenstackClient osClient;
+
+ private CloudIdentity cloudIdentity = new CloudIdentity();
+
+ @Mock
+ private AAIResourcesClient resourcesClient;
+ @Mock
+ private AAISingleTransactionClient transaction;
+
+ private HeatBridgeImpl heatbridge;
+
+ @Before
+ public void setUp() throws HeatBridgeException, OpenstackClientException, BulkProcessFailed {
+
+ when(resourcesClient.beginSingleTransaction()).thenReturn(transaction);
+ heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, TENANT_ID);
+ }
+
+ @Ignore
+ @Test
+ public void testQueryNestedHeatStackResources() throws HeatBridgeException {
+ // Arrange
+ String heatStackId = "1234567";
+ List<Resource> expectedResourceList = (List<Resource>) extractTestStackResources();
+ when(osClient.getStackBasedResources(heatStackId, HeatBridgeConstants.OS_DEFAULT_HEAT_NESTING))
+ .thenReturn(expectedResourceList);
+
+ // Act
+ List<Resource> resourceList = heatbridge.queryNestedHeatStackResources(heatStackId);
+
+ // Assert
+ verify(osClient).getStackBasedResources(heatStackId, HeatBridgeConstants.OS_DEFAULT_HEAT_NESTING);
+ assertEquals(resourceList, expectedResourceList);
+ }
+
+ @Test
+ public void testExtractStackResourceIdsByResourceType() throws HeatBridgeException {
+ // Arrange
+ List<Resource> expectedResourceList = (List<Resource>) extractTestStackResources();
+ List<String> expectedServerIds = Arrays.asList("43c2159b-2c04-46ac-bda5-594110cae2d3",
+ "7cff109a-b2b7-4933-97b4-ec44a8365568");
+
+ // Act
+ List<String> serverIds = heatbridge
+ .extractStackResourceIdsByResourceType(expectedResourceList, HeatBridgeConstants.OS_SERVER_RESOURCE_TYPE);
+
+ // Assert
+ assertEquals(expectedServerIds, serverIds);
+ }
+
+ @Ignore
+ @Test
+ public void testGetAllOpenstackServers() {
+ // Arrange
+ List<Resource> stackResources = (List<Resource>) extractTestStackResources();
+
+ Server server1 = mock(Server.class);
+ Server server2 = mock(Server.class);
+ List<Server> expectedServers = Arrays.asList(server1, server2);
+
+ when(osClient.getServerById("43c2159b-2c04-46ac-bda5-594110cae2d3")).thenReturn(server1);
+ when(osClient.getServerById("7cff109a-b2b7-4933-97b4-ec44a8365568")).thenReturn(server2);
+
+ // Act
+ List<Server> servers = heatbridge.getAllOpenstackServers(stackResources);
+
+ // Assert
+ assertEquals(expectedServers, servers);
+ }
+
+ @Ignore
+ @Test
+ public void testExtractOpenstackImagesFromServers() {
+ // Arrange
+ Server server1 = mock(Server.class);
+ Server server2 = mock(Server.class);
+ List<Server> servers = Arrays.asList(server1, server2);
+
+ Image image1 = mock(Image.class);
+ Image image2 = mock(Image.class);
+ when(image1.getId()).thenReturn("1");
+ when(image2.getId()).thenReturn("1");
+ List<Image> expectedDistinctImages = Collections.singletonList(image1);
+
+ when(server1.getImage()).thenReturn(image1);
+ when(server2.getImage()).thenReturn(image2);
+
+ // Act
+ List<Image> images = heatbridge.extractOpenstackImagesFromServers(servers);
+
+ // Assert
+ assertEquals(expectedDistinctImages, images);
+ }
+
+ @Ignore
+ @Test
+ public void testExtractOpenstackFlavorsFromServers() {
+ // Arrange
+ Server server1 = mock(Server.class);
+ Server server2 = mock(Server.class);
+ List<Server> servers = Arrays.asList(server1, server2);
+
+ Flavor flavor1 = mock(Flavor.class);
+ Flavor flavor2 = mock(Flavor.class);
+ when(flavor1.getId()).thenReturn("1");
+ when(flavor2.getId()).thenReturn("2");
+ List<Flavor> expectedFlavors = Arrays.asList(flavor1, flavor2);
+
+ when(server1.getFlavor()).thenReturn(flavor1);
+ when(server2.getFlavor()).thenReturn(flavor2);
+
+ // Act
+ List<Flavor> flavors = heatbridge.extractOpenstackFlavorsFromServers(servers);
+
+ // Assert
+ assertEquals(expectedFlavors, flavors);
+ }
+
+ @Test
+ public void testUpdateVserversToAai() throws HeatBridgeException {
+ // Arrange
+ Server server1 = mock(Server.class);
+
+ when(server1.getId()).thenReturn("test-server1-id");
+ when(server1.getHypervisorHostname()).thenReturn("test-hypervisor");
+ when(server1.getName()).thenReturn("test-server1-name");
+ when(server1.getStatus()).thenReturn(Status.ACTIVE);
+ when(server1.getLinks()).thenReturn(new ArrayList<>());
+
+ Server server2 = mock(Server.class);
+ when(server2.getId()).thenReturn("test-server2-id");
+ when(server2.getHypervisorHostname()).thenReturn("test-hypervisor");
+ when(server2.getName()).thenReturn("test-server2-name");
+ when(server2.getStatus()).thenReturn(Status.ACTIVE);
+ when(server2.getLinks()).thenReturn(new ArrayList<>());
+
+ List<Server> servers = Arrays.asList(server1, server2);
+
+ Image image = mock(Image.class);
+ when(server1.getImage()).thenReturn(image);
+ when(server2.getImage()).thenReturn(image);
+ when(image.getId()).thenReturn("test-image-id");
+
+ Flavor flavor = mock(Flavor.class);
+ when(server1.getFlavor()).thenReturn(flavor);
+ when(server2.getFlavor()).thenReturn(flavor);
+ when(flavor.getId()).thenReturn("test-flavor-id");
+
+
+ // Act
+ heatbridge.buildAddVserversToAaiAction("test-genericVnf-id", "test-vfModule-id", servers);
+
+ // Assert
+ ArgumentCaptor<AAIResourceUri> captor = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(transaction, times(2)).create(captor.capture(), any(Vserver.class));
+
+ List<AAIResourceUri> uris = captor.getAllValues();
+ assertEquals(AAIUriFactory.createResourceUri(
+ AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID, server1.getId()), uris.get(0));
+ assertEquals(AAIUriFactory.createResourceUri(
+ AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID, server2.getId()), uris.get(1));
+
+ }
+
+ @Test
+ public void testUpdateImagesToAai() throws HeatBridgeException {
+ // Arrange
+ Image image1 = mock(Image.class);
+ when(image1.getId()).thenReturn("test-image1-id");
+ when(image1.getName()).thenReturn("test-image1-name");
+ when(image1.getLinks()).thenReturn(new ArrayList<>());
+
+ Image image2 = mock(Image.class);
+ when(image2.getId()).thenReturn("test-image2-id");
+ when(image2.getName()).thenReturn("test-image2-name");
+ when(image2.getLinks()).thenReturn(new ArrayList<>());
+
+ List<Image> images = Arrays.asList(image1, image2);
+
+ // Act #1
+ heatbridge.buildAddImagesToAaiAction(images);
+
+ // Assert #1
+ verify(transaction, times(2)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Image.class));
+
+ // Act #2
+ heatbridge.buildAddImagesToAaiAction(images);
+
+ // Assert #2
+ verify(transaction, times(4)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Image.class));
+ }
+
+ @Test
+ public void testUpdateFlavorsToAai() throws HeatBridgeException {
+ // Arrange
+ Flavor flavor1 = mock(Flavor.class);
+ when(flavor1.getId()).thenReturn("test-flavor1-id");
+ when(flavor1.getName()).thenReturn("test-flavor1-name");
+ when(flavor1.getLinks()).thenReturn(new ArrayList<>());
+
+ Flavor flavor2 = mock(Flavor.class);
+ when(flavor2.getId()).thenReturn("test-flavor2-id");
+ when(flavor2.getName()).thenReturn("test-flavor2-name");
+ when(flavor2.getLinks()).thenReturn(new ArrayList<>());
+
+ List<Flavor> flavors = Arrays.asList(flavor1, flavor2);
+
+ // Act #1
+ heatbridge.buildAddFlavorsToAaiAction(flavors);
+
+ // Assert #1
+ verify(transaction, times(2)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Flavor.class));
+
+ // Act #2
+ heatbridge.buildAddFlavorsToAaiAction(flavors);
+
+ // Assert #2
+ verify(transaction, times(4)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Flavor.class));
+ }
+
+ @Ignore
+ @Test
+ public void testUpdateVserverLInterfacesToAai() throws HeatBridgeException {
+ // Arrange
+ List<Resource> stackResources = (List<Resource>) extractTestStackResources();
+ Port port = mock(Port.class);
+ when(port.getId()).thenReturn("test-port-id");
+ when(port.getName()).thenReturn("test-port-name");
+ when(port.getvNicType()).thenReturn(HeatBridgeConstants.OS_SRIOV_PORT_TYPE);
+ when(port.getMacAddress()).thenReturn("78:4f:43:68:e2:78");
+ when(port.getNetworkId()).thenReturn("890a203a-23gg-56jh-df67-731656a8f13a");
+ when(port.getDeviceId()).thenReturn("test-device-id");
+ when(port.getVifDetails())
+ .thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_VLAN_NETWORK_KEY, "2345"));
+ String pfPciId = "0000:08:00.0";
+ when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId,
+ HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id"));
+
+ Network network = mock(Network.class);
+ when(network.getId()).thenReturn("test-network-id");
+ when(network.getNetworkType()).thenReturn(NetworkType.VLAN);
+ when(network.getProviderSegID()).thenReturn("2345");
+
+ when(osClient.getPortById("212a203a-9764-4f42-84ea-731536a8f13a")).thenReturn(port);
+ when(osClient.getPortById("387e3904-8948-43d1-8635-b6c2042b54da")).thenReturn(port);
+ when(osClient.getPortById("70a09dfd-f1c5-4bc8-bd8f-dc539b8d662a")).thenReturn(port);
+ when(osClient.getPortById("12f88b4d-c8a4-4fbd-bcb4-7e36af02430b")).thenReturn(port);
+ when(osClient.getPortById("c54b9f45-b413-4937-bbe4-3c8a5689cfc9")).thenReturn(port);
+ when(osClient.getNetworkById(anyString())).thenReturn(network);
+
+ SriovPf sriovPf = new SriovPf();
+ sriovPf.setPfPciId(pfPciId);
+ PInterface pIf = mock(PInterface.class);
+ when(pIf.getInterfaceName()).thenReturn("test-port-id");
+ when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf));
+
+ // Act
+ heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"));
+
+ // Assert
+ verify(transaction, times(5)).create(any(AAIResourceUri.class), any(LInterface.class));
+ verify(osClient, times(5)).getPortById(anyString());
+ verify(osClient, times(5)).getNetworkById(anyString());
+ }
+
+ private List<? extends Resource> extractTestStackResources() {
+ List<HeatResource> stackResources = null;
+ try {
+ stackResources = MAPPER.readValue(readTestResourceFile("stack-resources.json"), Resources.class)
+ .getList();
+ assertNotNull(stackResources);
+ assertFalse(stackResources.isEmpty());
+ } catch (IOException e) {
+ Assert.fail("Failed to extract test stack resources.");
+ }
+ return stackResources;
+ }
+
+ private String readTestResourceFile(String filePath) {
+ String content = null;
+ String pathname = Objects.requireNonNull(getClass().getClassLoader().getResource(filePath)).getFile();
+ File file = new File(pathname);
+ try {
+ content = Objects.requireNonNull(FileUtils.readFileToString(file, Charset.defaultCharset()));
+ } catch (IOException e) {
+ Assert.fail(String.format("Failed to read test resource file (%s)", filePath));
+ }
+ return content;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
index 22e66d41bb..3366ce4a05 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
@@ -1,6 +1,6 @@
{
- "resources": [
- {
+ "resources": [
+ {
"links": [
{
"href": "https://orchestration.com:8004/v1/99cecb7b19dc4690960761abd0fe2413/stacks/zdyh3brlba05_addon/03840be2-7ce6-4e38-a748-dbd59a798732/resources/vlbagent_eph_aff_id",
@@ -22,207 +22,208 @@
"resource_type": "OS::Heat::RandomString",
"updated_time": "2019-02-07T22:56:12Z"
},
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_trusted_port_0",
+ "physical_resource_id": "7ee06d9d-3d18-411c-9d3e-aec930f70413",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_trusted_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_service1_port_0",
+ "physical_resource_id": "36551a08-592c-4329-ab75-6c594420754c",
+ "required_by": [
+ "ssc_1_subint_service1_port_0_subinterfaces",
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_service1_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces",
+ "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
+ "required_by": [],
+ "resource_name": "ssc_1_subint_service2_port_0_subinterfaces",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Heat::ResourceGroup",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_mgmt_port_1",
+ "physical_resource_id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_mgmt_port_1",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0",
+ "rel": "self"
+ },
{
- "resource_name": "ssc_1_trusted_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_trusted_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "d2f51f82-0ec2-4581-bd1a-d2a82073e52b",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_service1_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_service1_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_1_subint_service1_port_0_subinterfaces",
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "27391d94-33af-474a-927d-d409249e8fd3",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_subint_service2_port_0_subinterfaces",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
- "resource_type": "OS::Heat::ResourceGroup"
- },
- {
- "resource_name": "ssc_1_mgmt_port_1",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_mgmt_port_1",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "07f5b14c-147a-4d14-8c94-a9e94dbc097b",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_mgmt_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_mgmt_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_service2_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_service2_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_1_subint_service2_port_0_subinterfaces",
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_int_ha_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_int_ha_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_server_1",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_server_1",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
- "resource_type": "OS::Nova::Server"
- },
- {
- "resource_name": "ssc_1_subint_service1_port_0_subinterfaces",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672",
- "resource_type": "OS::Heat::ResourceGroup"
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_mgmt_port_0",
+ "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_mgmt_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
}
- ]
+ ],
+ "logical_resource_id": "ssc_1_service2_port_0",
+ "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "required_by": [
+ "ssc_1_subint_service2_port_0_subinterfaces",
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_service2_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_int_ha_port_0",
+ "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_int_ha_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_server_1",
+ "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "required_by": [],
+ "resource_name": "ssc_server_1",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Nova::Server",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces",
+ "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672",
+ "required_by": [],
+ "resource_name": "ssc_1_subint_service1_port_0_subinterfaces",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Heat::ResourceGroup",
+ "updated_time": "2019-01-23T19:34:15Z"
+ }
+ ]
}
+
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json
new file mode 100644
index 0000000000..e4bd83c21d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "7ee06d9d-3d18-411c-9d3e-aec930f70413",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json
new file mode 100644
index 0000000000..376a526133
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "27391d94-33af-474a-927d-d409249e8fd3",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json
new file mode 100644
index 0000000000..f0549216be
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json
new file mode 100644
index 0000000000..fa10b0c864
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "8d93f63e-e972-48c7-ad98-b2122da47315",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json
new file mode 100644
index 0000000000..54a9ee8404
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json
new file mode 100644
index 0000000000..c47dfd755b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json b/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json
new file mode 100644
index 0000000000..6b63895a33
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json
@@ -0,0 +1,441 @@
+{
+ "resources": [
+ {
+ "resource_name": "ge_000",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule/d1431cdc-9b29-44fc-98d0-9b3dc1ac246d/resources/ge_000",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule/d1431cdc-9b29-44fc-98d0-9b3dc1ac246d",
+ "rel": "stack"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-ge_000-t66dxpwq6nb5/deee54a3-08ac-477b-9c09-c798edb40be1",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "ge_000",
+ "resource_status_reason": "state changed",
+ "updated_time": "2018-04-09T21:09:52Z",
+ "required_by": [
+ "vfw_instance"
+ ],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "deee54a3-08ac-477b-9c09-c798edb40be1",
+ "resource_type": "port.yaml"
+ },
+ {
+ "resource_name": "vfw_instance",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule/d1431cdc-9b29-44fc-98d0-9b3dc1ac246d/resources/vfw_instance",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule/d1431cdc-9b29-44fc-98d0-9b3dc1ac246d",
+ "rel": "stack"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "vfw_instance",
+ "resource_status_reason": "state changed",
+ "updated_time": "2018-04-09T21:09:52Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "resource_type": "vfw.yaml"
+ },
+ {
+ "resource_name": "port",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-ge_000-t66dxpwq6nb5/deee54a3-08ac-477b-9c09-c798edb40be1/resources/port",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-ge_000-t66dxpwq6nb5/deee54a3-08ac-477b-9c09-c798edb40be1",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "port",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:09:52Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "212a203a-9764-4f42-84ea-731536a8f13a",
+ "resource_type": "OS::Neutron::Port"
+ },
+ {
+ "resource_name": "pfe0",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/pfe0",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "rel": "stack"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-pfe0-kvqmgn7jmiti/1325e04b-e836-4a13-bb2e-f34923d97ad7",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "pfe0",
+ "resource_status_reason": "state changed",
+ "updated_time": "2018-04-09T21:09:54Z",
+ "required_by": [
+ "re0"
+ ],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "1325e04b-e836-4a13-bb2e-f34923d97ad7",
+ "resource_type": "fpc.yaml"
+ },
+ {
+ "resource_name": "fpc_internal_port",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/fpc_internal_port",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "rel": "stack"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_internal_port-gbnyc4w7mb5b/4e920f39-9784-417e-9331-d75e2e37cc51",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "fpc_internal_port",
+ "resource_status_reason": "state changed",
+ "updated_time": "2018-04-09T21:09:54Z",
+ "required_by": [
+ "pfe0"
+ ],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "4e920f39-9784-417e-9331-d75e2e37cc51",
+ "resource_type": "re_pfe_port.yaml"
+ },
+ {
+ "resource_name": "re-fpc-affinity-grp",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re-fpc-affinity-grp",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "re-fpc-affinity-grp",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:09:54Z",
+ "required_by": [
+ "pfe0",
+ "re0"
+ ],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "3aa37238-f8ff-4c96-b56a-8903bae28a60",
+ "resource_type": "OS::Nova::ServerGroup"
+ },
+ {
+ "resource_name": "re0",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re0",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "rel": "stack"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re0-73oifso3xntc/0915e27e-428d-4d2c-a67b-abbce18081b2",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "re0",
+ "resource_status_reason": "state changed",
+ "updated_time": "2018-04-09T21:09:54Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "0915e27e-428d-4d2c-a67b-abbce18081b2",
+ "resource_type": "re.yaml"
+ },
+ {
+ "resource_name": "re_external_port",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re_external_port",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "rel": "stack"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_external_port-3okiee3zocr7/f58c65e3-a72e-4b2d-a295-cb40324d6b4c",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "re_external_port",
+ "resource_status_reason": "state changed",
+ "updated_time": "2018-04-09T21:09:54Z",
+ "required_by": [
+ "re0"
+ ],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "f58c65e3-a72e-4b2d-a295-cb40324d6b4c",
+ "resource_type": "port.yaml"
+ },
+ {
+ "resource_name": "fpc_external_port",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/fpc_external_port",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "rel": "stack"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_external_port-5vumcqp7hkbn/979e47c9-c15a-428e-ad73-af922029ee37",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "fpc_external_port",
+ "resource_status_reason": "state changed",
+ "updated_time": "2018-04-09T21:09:54Z",
+ "required_by": [
+ "pfe0",
+ "re0"
+ ],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "979e47c9-c15a-428e-ad73-af922029ee37",
+ "resource_type": "port.yaml"
+ },
+ {
+ "resource_name": "re_internal_port",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re_internal_port",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "rel": "stack"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_internal_port-u4txbvemndci/0aebfd9d-ad97-43b1-a67b-b2b5340738d2",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "re_internal_port",
+ "resource_status_reason": "state changed",
+ "updated_time": "2018-04-09T21:09:54Z",
+ "required_by": [
+ "re0"
+ ],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "0aebfd9d-ad97-43b1-a67b-b2b5340738d2",
+ "resource_type": "re_pfe_port.yaml"
+ },
+ {
+ "resource_name": "re_pfe_network",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re_pfe_network",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b",
+ "rel": "stack"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "re_pfe_network",
+ "resource_status_reason": "state changed",
+ "updated_time": "2018-04-09T21:09:54Z",
+ "required_by": [
+ "fpc_internal_port",
+ "re_internal_port"
+ ],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "290fc2fd-cd1d-47d0-90eb-2ece7c009b29",
+ "resource_type": "bridge_int.yaml"
+ },
+ {
+ "resource_name": "fpc",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-pfe0-kvqmgn7jmiti/1325e04b-e836-4a13-bb2e-f34923d97ad7/resources/fpc",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-pfe0-kvqmgn7jmiti/1325e04b-e836-4a13-bb2e-f34923d97ad7",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "fpc",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:09:58Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "43c2159b-2c04-46ac-bda5-594110cae2d3",
+ "resource_type": "OS::Nova::Server"
+ },
+ {
+ "resource_name": "port",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_internal_port-gbnyc4w7mb5b/4e920f39-9784-417e-9331-d75e2e37cc51/resources/port",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_internal_port-gbnyc4w7mb5b/4e920f39-9784-417e-9331-d75e2e37cc51",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "port",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:09:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "387e3904-8948-43d1-8635-b6c2042b54da",
+ "resource_type": "OS::Neutron::Port"
+ },
+ {
+ "resource_name": "re",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re0-73oifso3xntc/0915e27e-428d-4d2c-a67b-abbce18081b2/resources/re",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re0-73oifso3xntc/0915e27e-428d-4d2c-a67b-abbce18081b2",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "re",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:10:36Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "7cff109a-b2b7-4933-97b4-ec44a8365568",
+ "resource_type": "OS::Nova::Server"
+ },
+ {
+ "resource_name": "port",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_external_port-3okiee3zocr7/f58c65e3-a72e-4b2d-a295-cb40324d6b4c/resources/port",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_external_port-3okiee3zocr7/f58c65e3-a72e-4b2d-a295-cb40324d6b4c",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "port",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:09:55Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "70a09dfd-f1c5-4bc8-bd8f-dc539b8d662a",
+ "resource_type": "OS::Neutron::Port"
+ },
+ {
+ "resource_name": "port",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_external_port-5vumcqp7hkbn/979e47c9-c15a-428e-ad73-af922029ee37/resources/port",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_external_port-5vumcqp7hkbn/979e47c9-c15a-428e-ad73-af922029ee37",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "port",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:09:55Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "12f88b4d-c8a4-4fbd-bcb4-7e36af02430b",
+ "resource_type": "OS::Neutron::Port"
+ },
+ {
+ "resource_name": "port",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_internal_port-u4txbvemndci/0aebfd9d-ad97-43b1-a67b-b2b5340738d2/resources/port",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_internal_port-u4txbvemndci/0aebfd9d-ad97-43b1-a67b-b2b5340738d2",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "port",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:09:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "c54b9f45-b413-4937-bbe4-3c8a5689cfc9",
+ "resource_type": "OS::Neutron::Port"
+ },
+ {
+ "resource_name": "bridge_network_subnet",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29/resources/bridge_network_subnet",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "bridge_network_subnet",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:09:55Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "5ffd8c02-6913-4b67-adba-74e78c2bbe40",
+ "resource_type": "OS::Neutron::Subnet"
+ },
+ {
+ "resource_name": "bridge_network",
+ "links": [
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29/resources/bridge_network",
+ "rel": "self"
+ },
+ {
+ "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "bridge_network",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2018-04-09T21:09:55Z",
+ "required_by": [
+ "bridge_network_subnet"
+ ],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "5ad95036-8daf-4379-a59c-865f35976cd4",
+ "resource_type": "OS::Neutron::Net"
+ }
+ ]
+}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
index f7d718ccdc..09e8cf1d32 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
@@ -32,8 +32,8 @@ import org.onap.so.db.request.beans.ArchivedInfraRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.data.repository.ArchivedInfraRequestsRepository;
import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -148,7 +148,7 @@ public class ArchiveInfraRequestsScheduler {
newArchivedReqs.add(archivedInfra);
oldInfraReqs.add(iar);
} catch(Exception e) {
- logger.error("{} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), MsoLogger.ErrorCode
+ logger.error("{} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode
.UnknownError.getValue(), e);
}
}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index 1027c8a18b..e3867d1b93 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -38,7 +38,7 @@ import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.db.request.data.repository.OperationStatusRepository;
import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
import org.onap.so.db.request.data.repository.SiteStatusRepository;
-import org.onap.so.logger.MsoLogger;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.requestsdb.RequestsDbConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -128,7 +128,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
} catch (Exception e) {
String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId;
logger.error(error, e);
- throw new MsoRequestsDbException(error, MsoLogger.ErrorCode.BusinessProcesssError, e);
+ throw new MsoRequestsDbException(error, ErrorCode.BusinessProcesssError, e);
}
}
@@ -154,7 +154,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
} catch (Exception e) {
String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId;
logger.error(error,e);
- throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError , e);
+ throw new MsoRequestsDbException(error, ErrorCode.BusinessProcesssError , e);
}
return request;
}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java
index e6d736d2ad..16a3a7d427 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java
@@ -24,7 +24,7 @@ package org.onap.so.adapters.requestsdb.exceptions;
import javax.xml.ws.WebFault;
import org.onap.so.exceptions.MSOException;
-import org.onap.so.logger.MsoLogger.ErrorCode;
+import org.onap.so.logger.ErrorCode;
/**
* This class simply extends Exception (without addition additional functionality)
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.4__Add_Vnf_Operational_Env_Id_column.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.4__Add_Vnf_Operational_Env_Id_column.sql
new file mode 100644
index 0000000000..11be8ec8ab
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.4__Add_Vnf_Operational_Env_Id_column.sql
@@ -0,0 +1,3 @@
+use requestdb;
+
+ALTER TABLE activate_operational_env_service_model_distribution_status ADD VNF_OPERATIONAL_ENV_ID varchar(45) NOT NULL;
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
index 32eb40aed8..75c8f1af52 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
@@ -30,7 +30,6 @@ import org.junit.runner.RunWith;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
import org.onap.so.adapters.requestsdb.application.TestAppender;
-import org.onap.so.logger.MsoLogger;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
index 103e216229..963ef7c832 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
@@ -46,7 +46,6 @@ import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import org.onap.so.db.request.data.repository.OperationStatusRepository;
import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDbConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
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 48d589592f..9c2ea6d3bf 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
@@ -37,15 +37,15 @@ VALUES
(2, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca715', 'configurationId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfigRequest'),
(3, '5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'configId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfig');
-INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
-INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
+INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
-INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
+INSERT INTO activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502018', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
+('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502018', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
INSERT INTO `activate_operational_env_per_distributionid_status` (`DISTRIBUTION_ID`, `DISTRIBUTION_ID_STATUS`, `DISTRIBUTION_ID_ERROR_REASON`, `CREATE_TIME`, `MODIFY_TIME`, `OPERATIONAL_ENV_ID`, `SERVICE_MODEL_VERSION_ID`, `REQUEST_ID`)
VALUES
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
index 543c8e4b00..2c84ed4fd0 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
@@ -32,7 +32,6 @@ import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
index 5deec41d94..26e67c8507 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
@@ -32,8 +32,8 @@ import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,17 +62,17 @@ public class SDNCAdapterService extends Service {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl");
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
- MsoLogger.ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
+ ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if(wsdlUrl == null) {
logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
- MsoLogger.ErrorCode.DataError.getValue(), "WSDL not found");
+ ErrorCode.DataError.getValue(), "WSDL not found");
} else {
try {
logger.info("{} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL, wsdlUrl.toURI().toString());
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL,
- MsoLogger.ErrorCode.DataError.getValue(), "Exception - print URL", e);
+ ErrorCode.DataError.getValue(), "Exception - print URL", e);
}
}
WSDL_LOCATION = wsdlUrl;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
index 3dcd008ba5..2703060761 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
@@ -33,8 +33,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -135,7 +135,7 @@ public class SDNCAdapterCallbackRequest {
}
catch (Exception e)
{
- logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), ErrorCode.DataError.getValue(),
"Exception - MARSHING_ERROR", e);
}
return "";
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
index fd288c6a04..ee7a467357 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
@@ -31,8 +31,8 @@ import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,18 +59,18 @@ public class SDNCCallbackAdapterService extends Service {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl");
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
+ ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if(wsdlUrl == null) {
logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), "WSDL not found");
+ ErrorCode.DataError.getValue(), "WSDL not found");
} else {
try {
logger.info("{} {} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
wsdlUrl.toURI().toString(), "SDNC");
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
- "SDNC", MsoLogger.ErrorCode.DataError.getValue(), "Exception - URL convention problem", e);
+ "SDNC", ErrorCode.DataError.getValue(), "Exception - URL convention problem", e);
}
}
WSDL_LOCATION = wsdlUrl;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
index 6262f2d86f..401f5c5b2b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
@@ -23,8 +23,8 @@
package org.onap.so.adapters.sdnc.impl;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -65,7 +65,7 @@ public class MapRequestTunables {
String[] parts = value.split("\\|"); //escape pipe
if (parts.length < 3) {
logger.warn("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), "Invalid config");
+ ErrorCode.DataError.getValue(), "Invalid config");
}
for (int i = 0; i < parts.length; i++) {
@@ -101,7 +101,7 @@ public class MapRequestTunables {
}
if (error != null) {
logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), "Missing config param");
+ ErrorCode.DataError.getValue(), "Missing config param");
}
logger.debug("RequestTunables Key:{} Value:{} Tunables:{}", key, value, this.toString());
return reqTunable;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
index cf81ae4be0..104b4ebcc7 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
@@ -29,9 +29,9 @@ import javax.servlet.http.HttpServletResponse;
import org.onap.so.adapters.sdnc.SDNCAdapterPortType;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -75,7 +75,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
catch (Exception e){
String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage();
logger.error("{} {} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), respMsg, e);
+ ErrorCode.DataError.getValue(), respMsg, e);
SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index d7f2c11d0b..80f111b570 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -46,6 +46,8 @@ import javax.xml.ws.handler.MessageContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
+
+import org.onap.so.logger.ErrorCode;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
import org.onap.so.adapters.sdnc.client.CallbackHeader;
@@ -54,7 +56,6 @@ import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterPortType;
import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterService;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -84,7 +85,7 @@ public class SDNCRestClient{
@Async
public void executeRequest(SDNCAdapterRequest bpelRequest)
{
-
+
logger.debug("BPEL Request:" + bpelRequest.toString());
// Added delay to allow completion of create request to SDNC
@@ -92,7 +93,9 @@ public class SDNCRestClient{
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- e.printStackTrace();
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC",
+ ErrorCode.UnknownError.getValue(), "Exception processing request to SDNC", e);
+
Thread.currentThread().interrupt();
}
@@ -103,12 +106,10 @@ public class SDNCRestClient{
String sdncReqBody = null;
-
-
RequestTunables rt = new RequestTunables(bpelReqId,
bpelRequest.getRequestHeader().getMsoAction(),
bpelRequest.getRequestHeader().getSvcOperation(),
- bpelRequest.getRequestHeader().getSvcAction());
+ bpelRequest.getRequestHeader().getSvcAction());
rt = tunablesMapper.setTunables(rt);
rt.setSdncaNotificationUrl(env.getProperty(Constants.MY_URL_PROP));
@@ -175,8 +176,8 @@ public class SDNCRestClient{
sdncResp.setRespCode(con.getResponseCode());
sdncResp.setRespMsg(con.getResponseMessage());
- if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) {
- in = new BufferedReader(new InputStreamReader(con.getInputStream()));
+ if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) {
+ in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
//Not parsing the response -it contains a responseHdr section and data section
while ((inputLine = in.readLine()) != null) {
@@ -184,7 +185,7 @@ public class SDNCRestClient{
}
in.close();
}
-
+
sdncResp.setSdncRespXml(response.toString());
logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC");
return(sdncResp);
@@ -192,7 +193,7 @@ public class SDNCRestClient{
catch (Exception e)
{
logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e);
//default
sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
String respMsg = "Error processing request to SDNC. ";
@@ -233,7 +234,7 @@ public class SDNCRestClient{
sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType);
} catch (Exception e3) {
logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
- error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
+ error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
}
String eTag = null;
@@ -242,7 +243,7 @@ public class SDNCRestClient{
sdncErrMsg.append(", error-tag:").append(eTag);
} catch (Exception e3) {
logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
- error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
+ error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
}
String eMsg = null;
@@ -251,17 +252,17 @@ public class SDNCRestClient{
sdncErrMsg.append(", error-message:").append(eMsg).append("]");
} catch (Exception e3) {
logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message", error.toString(),
- "SDNC", MsoLogger.ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
+ "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG, e3);
}
}
} catch (Exception e2) {
logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), "Exception while analyse error", e2);
+ ErrorCode.DataError.getValue(), "Exception while analyse error", e2);
}
} //is != null
} catch (Exception e1) {
logger.error("{} {} {} {}", MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1);
}
} //con != null
@@ -273,7 +274,7 @@ public class SDNCRestClient{
sdncResp.setRespMsg(respMsg);
logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e);
return sdncResp;
}
@@ -304,7 +305,7 @@ public class SDNCRestClient{
} catch (MalformedURLException e1) {
error = "Caught exception initializing Callback wsdl " + e1.getMessage();
logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
- MsoLogger.ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
+ ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
}
@@ -313,7 +314,7 @@ public class SDNCRestClient{
SDNCCallbackAdapterPortType cbPort = cbSvc.getSDNCCallbackAdapterSoapHttpPort();
BindingProvider bp = (BindingProvider)cbPort;
-
+
if(null != wsdlUrl) {
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl.toExternalForm());
}
@@ -335,7 +336,7 @@ public class SDNCRestClient{
catch (Exception e2) {
error = "Unable to set authorization in callback request " + e2.getMessage();
logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Exception - Unable to set authorization in callback request", e2);
}
@@ -347,7 +348,7 @@ public class SDNCRestClient{
catch (Exception e)
{
error = "Error sending BpelCallback request" + e.getMessage();
- logger.error("Error {} - {} - {}", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ logger.error("Error {} - {} - {}", ErrorCode.BusinessProcesssError.getValue(),
MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), error, e);
}
logger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
index 96e7dcf51a..daa83d27f8 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
@@ -33,8 +33,8 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -103,7 +103,7 @@ public class Utils {
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
}
return null;
}
@@ -137,7 +137,7 @@ public class Utils {
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e);
+ ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e);
}
return null;
}
@@ -172,7 +172,7 @@ public class Utils {
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e);
+ ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e);
}
return null;
}
@@ -198,7 +198,7 @@ public class Utils {
s = s.replaceAll("xmlns=\"\"", "");
return s;
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), MsoLogger.ErrorCode.DataError
+ logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError
.getValue(), "Exception - domToStr", e);
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
index 6a66770d29..cf52972d8f 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -36,9 +36,9 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.sdnc.impl.Constants;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -134,7 +134,7 @@ public class BPRestCallback {
method.setHeader(ONAPLogConstants.Headers.PARTNER_NAME,"SO-SDNCAdapter");
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request", e);
error = true;
}
@@ -150,7 +150,7 @@ public class BPRestCallback {
if (httpResponse.getStatusLine().getStatusCode() >= 300) {
String msg = "Received error response to callback request: " + httpResponse.getStatusLine();
- logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, MsoLogger.ErrorCode
+ logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA, ErrorCode
.BusinessProcesssError.getValue(), msg);
}
@@ -158,7 +158,7 @@ public class BPRestCallback {
return true;
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e);
return false;
} finally {
if (httpResponse != null) {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
index fd9ce4c719..d4c2c57510 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
@@ -25,9 +25,9 @@ package org.onap.so.adapters.sdnc.sdncrest;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdnc.impl.Constants;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,7 +56,7 @@ public class MapTypedRequestTunablesData {
if ("".equals(value)) {
error= MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey();
logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(), "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
+ ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
@@ -66,7 +66,7 @@ public class MapTypedRequestTunablesData {
if (parts.length != 5) {
error="Invalid configuration for: " + reqTunable.getKey();
logger.error("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value, "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), "Invalid config");
+ ErrorCode.DataError.getValue(), "Invalid config");
throw new SDNCAdapterException(error);
}
@@ -82,7 +82,7 @@ public class MapTypedRequestTunablesData {
if ("".equals(reqTunable.getSdncUrl())) {
error=MISSING_CONFIGURATION_ERROR_MSG + urlPropKey;
logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
+ ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
@@ -100,7 +100,7 @@ public class MapTypedRequestTunablesData {
if ("".equals(reqTunable.getMyUrl())) {
error=MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP;
logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP, "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
+ ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index 06e7ab23a6..7cc5b8e14e 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -52,9 +52,9 @@ import org.apache.http.util.EntityUtils;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -201,12 +201,12 @@ public abstract class SDNCConnector {
protected void logError(String errMsg) {
logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
- MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg);
+ ErrorCode.AvailabilityError.getValue(), errMsg);
}
protected void logError(String errMsg, Throwable t) {
logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
- MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg, t);
+ ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
/**
@@ -290,7 +290,7 @@ public abstract class SDNCConnector {
info += "error-type:" + errorType;
} catch (XPathExpressionException e) {
logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type", error.toString(),
- "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
+ "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
try {
@@ -301,7 +301,7 @@ public abstract class SDNCConnector {
info += "error-tag:" + errorTag;
} catch (XPathExpressionException e) {
logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag", error.toString(),
- "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
+ "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
try {
@@ -312,7 +312,7 @@ public abstract class SDNCConnector {
info += "error-message:" + errorMessage;
} catch (Exception e) {
logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
- error.toString(), "SDNC", MsoLogger.ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
+ error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
if (!info.isEmpty()) {
@@ -325,7 +325,7 @@ public abstract class SDNCConnector {
}
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
- MsoLogger.ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
+ ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
}
return output.toString();
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
index d0973d3c44..a42e92db4b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
@@ -39,8 +39,8 @@ import org.onap.so.adapters.sdncrest.RequestInformation;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.onap.so.adapters.sdncrest.SDNCServiceError;
import org.onap.so.adapters.sdncrest.SDNCServiceRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -65,7 +65,6 @@ public class SDNCServiceRequestTask {
@Async
public void runRequest(SDNCServiceRequest request,String msoRequestId,String msoServiceInstanceId,String myUrlSuffix)
{
- MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId);
String sdncRequestId = request.getSdncRequestId();
String sdncService = request.getSdncService();
@@ -193,7 +192,7 @@ public class SDNCServiceRequestTask {
addTextChild(agnosticServiceInformation, "anydata", anydata);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
return null;
}
@@ -211,7 +210,7 @@ public class SDNCServiceRequestTask {
transformer.transform(new DOMSource(doc), new StreamResult(writer));
xml = writer.toString();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError.getValue(),
"Exception - domToStr", e);
return null;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
index 75a0b07643..96153a18fa 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
@@ -33,9 +33,9 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.onap.so.adapters.sdnc.impl.Constants;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -72,7 +72,7 @@ public class SNIROResponse {
if (bpUrl == null || ("").equals(bpUrl)) {
String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.BPEL_REST_URL_PROP,
- "SDNC", MsoLogger.ErrorCode.DataError.getValue(), "Missing config param");
+ "SDNC", ErrorCode.DataError.getValue(), "Missing config param");
return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
index 66ed6953a2..2c1155ca6f 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
@@ -27,8 +27,8 @@ import java.io.IOException;
import org.onap.so.adapters.vfc.constant.HttpCode;
import org.onap.so.adapters.vfc.exceptions.ApplicationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -86,7 +86,7 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
@@ -104,7 +104,7 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
@@ -121,7 +121,7 @@ public class JsonUtil {
try {
return MAPPER.writeValueAsString(srcObj);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
"fail to marshal json", e);
throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!");
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
index 9a23861bf6..a51564eef8 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
@@ -43,8 +43,8 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.onap.so.adapters.vfc.model.RestfulResponse;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -196,12 +196,12 @@ public class RestfulUtil {
private static void logError(String errMsg, Throwable t) {
logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), errMsg, t);
+ ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
private static void logError(String errMsg) {
logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
- MsoLogger.ErrorCode.AvailabilityError.toString(), errMsg);
+ ErrorCode.AvailabilityError.toString(), errMsg);
}
private static RestfulResponse createResponse(int statusCode, String content) {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
index 56d425745f..7e866f9008 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
@@ -44,6 +44,7 @@
<sourceFolder>src/gen/java/main</sourceFolder>
<withXml>true</withXml>
<useRxJava2>true</useRxJava2>
+ <serializableModel>true</serializableModel>
</configOptions>
</configuration>
</execution>
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 4554835b33..2e1fc97336 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -76,5 +76,10 @@
<artifactId>mso-adapters-rest-interface</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
index 4dabec3e9b..b14ead0c4f 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
@@ -21,14 +21,101 @@
package org.onap.so.adapters.vnfmadapter.rest;
import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import java.util.UUID;
+import javax.validation.Valid;
+import javax.ws.rs.core.MediaType;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
+import io.swagger.annotations.ApiParam;
/**
* Controller for handling requests to the VNFM (Virtual Network Function Manager) adapter REST API.
*/
@Controller
-@RequestMapping(value = BASE_URL)
+@RequestMapping(value = BASE_URL, produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
+ consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class VnfmAdapterController {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterController.class);
+
+ @PostMapping(value = "/vnfs/{vnfId}")
+ public ResponseEntity<CreateVnfResponse> vnfCreate(
+ @ApiParam(value = "The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in AAI.",
+ required = true) @PathVariable("vnfId") final String vnfId,
+ @ApiParam(value = "VNF creation parameters",
+ required = true) @Valid @RequestBody final CreateVnfRequest createVnfRequest,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies a single top level invocation of ONAP",
+ required = false) @RequestHeader(value = ONAPLogConstants.Headers.REQUEST_ID,
+ required = false) final String requestId,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies the client application user agent or user invoking the API",
+ required = false) @RequestHeader(value = ONAPLogConstants.Headers.PARTNER_NAME,
+ required = false) final String partnerName,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies a single invocation of a single component",
+ required = false) @RequestHeader(value = ONAPLogConstants.Headers.INVOCATION_ID,
+ required = false) final String invocationId) {
+
+ setLoggingMDCs(requestId, partnerName, invocationId);
+
+ logger.info("REST request vnfCreate with body: {}", createVnfRequest);
+
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(UUID.randomUUID().toString());
+ clearLoggingMDCs();
+ return new ResponseEntity<>(response, HttpStatus.ACCEPTED);
+ }
+
+ @DeleteMapping(value = "/vnfs/{vnfId}")
+ public ResponseEntity<DeleteVnfResponse> vnfDelete(
+ @ApiParam(value = "The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in AAI.",
+ required = true) @PathVariable("vnfId") final String vnfId,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies a single top level invocation of ONAP",
+ required = false) @RequestHeader(value = ONAPLogConstants.Headers.REQUEST_ID,
+ required = false) final String requestId,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies the client application user agent or user invoking the API",
+ required = false) @RequestHeader(value = ONAPLogConstants.Headers.PARTNER_NAME,
+ required = false) final String partnerName,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies a single invocation of a single component",
+ required = false) @RequestHeader(value = ONAPLogConstants.Headers.INVOCATION_ID,
+ required = false) final String invocationId) {
+
+ setLoggingMDCs(requestId, partnerName, invocationId);
+
+ logger.info("REST request vnfDelete for VNF: {}", vnfId);
+
+ final DeleteVnfResponse response = new DeleteVnfResponse();
+ response.setJobId(UUID.randomUUID().toString());
+ clearLoggingMDCs();
+ return new ResponseEntity<>(response, HttpStatus.ACCEPTED);
+ }
+
+ private void setLoggingMDCs(final String requestId, final String partnerName, final String invocationId) {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
+ MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
+ }
+
+ private void clearLoggingMDCs() {
+ MDC.clear();
+ }
+
}
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
new file mode 100644
index 0000000000..071a330e8b
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -0,0 +1,90 @@
+/*-
+ * ============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.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.net.URI;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.http.MediaType;
+import org.springframework.http.RequestEntity;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class VnfmAdapterControllerTest {
+
+ @LocalServerPort
+ private int port;
+
+ private final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+
+ @Test
+ public void createVnf_ValidRequest_Returns202AndJobId() throws Exception {
+ final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+ final RequestEntity<CreateVnfRequest> request =
+ RequestEntity.post(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myVnfId"))
+ .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
+ .header("X-ONAP-RequestId", "myRequestId").header("X-ONAP-InvocationID", "myInvocationId")
+ .body(createVnfRequest);
+ final ResponseEntity<CreateVnfResponse> response = restTemplate.exchange(request, CreateVnfResponse.class);
+ assertEquals(202, response.getStatusCode().value());
+ assertNotNull(response.getBody().getJobId());
+ }
+
+ @Test
+ public void createVnf_UnauthorizedUser_Returns401() throws Exception {
+ final TestRestTemplate restTemplateWrongPassword = new TestRestTemplate("test", "wrongPassword");
+ final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+ final RequestEntity<CreateVnfRequest> request =
+ RequestEntity.post(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myVnfId"))
+ .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
+ .header("X-ONAP-RequestId", "myRequestId").header("X-ONAP-InvocationID", "myInvocationId")
+ .body(createVnfRequest);
+ final ResponseEntity<CreateVnfResponse> response =
+ restTemplateWrongPassword.exchange(request, CreateVnfResponse.class);
+ assertEquals(401, response.getStatusCode().value());
+ }
+
+ @Test
+ public void deleteVnf_ValidRequest_Returns202AndJobId() throws Exception {
+ final RequestEntity<Void> request = RequestEntity
+ .delete(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myVnfId"))
+ .accept(MediaType.APPLICATION_JSON).header("X-ONAP-RequestId", "myRequestId")
+ .header("X-ONAP-InvocationID", "myInvocationId").header("Content-Type", "application/json").build();
+ final ResponseEntity<DeleteVnfResponse> response = restTemplate.exchange(request, DeleteVnfResponse.class);
+ assertEquals(202, response.getStatusCode().value());
+ assertNotNull(response.getBody().getJobId());
+ }
+
+}
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index 50fbdd447b..7b774a2cce 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -1,265 +1,270 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so</groupId>
- <artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
- <groupId>org.onap.so</groupId>
- <artifactId>asdc-controller</artifactId>
- <name>asdc-controller</name>
- <description>ASDC CLient and Controller</description>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <antlr.version>4.7.1</antlr.version>
- <java.version>1.8</java.version>
- </properties>
+ <groupId>org.onap.so</groupId>
+ <artifactId>asdc-controller</artifactId>
+ <name>asdc-controller</name>
+ <description>ASDC CLient and Controller</description>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <antlr.version>4.7.1</antlr.version>
+ <java.version>1.8</java.version>
+ <sdc.tosca.version>1.5.0</sdc.tosca.version>
+ <jtosca.version>1.5.0</jtosca.version>
+ </properties>
- <build>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <plugins>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>0.7.7.201606060606</version>
- <configuration>
- <excludes>
-+ <exclude>**/resource-examples/**</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <id>default-prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>default-report</id>
- <goals>
- <goal>report</goal>
- </goals>
- </execution>
- <execution>
- <id>default-check</id>
- <goals>
- <goal>check</goal>
- </goals>
- <configuration>
- <rules>
- <rule implementation="org.jacoco.maven.RuleConfiguration">
- <element>BUNDLE</element>
- <limits>
- <limit implementation="org.jacoco.report.check.Limit">
- <counter>INSTRUCTION</counter>
- <value>COVEREDRATIO</value>
- </limit>
- </limits>
- </rule>
- </rules>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.antlr</groupId>
- <artifactId>antlr4-maven-plugin</artifactId>
- <version>${antlr.version}</version>
- <executions>
- <execution>
- <id>antlr</id>
- <phase>generate-test-resources</phase>
- <goals>
- <goal>antlr4</goal>
- </goals>
- <configuration>
- <visitor>true</visitor>
- <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <executions>
- <execution>
- <id>default-testCompile</id>
- <phase>test-compile</phase>
- <goals>
- <goal>testCompile</goal>
- </goals>
- <configuration>
- <generatedTestSourcesDirectory>${project.build.directory}/generated-sources</generatedTestSourcesDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <configuration>
- <mainClass>org.onap.so.asdc.Application</mainClass>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>extract-docker-file</id>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>start</id>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>original</id>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <version>1.5.16</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jersey</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jdbc</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-catalog-db</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.sdc.sdc-distribution-client</groupId>
- <artifactId>sdc-distribution-client</artifactId>
- <version>1.3.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.onap.sdc.sdc-tosca</groupId>
- <artifactId>sdc-tosca</artifactId>
- <version>1.4.8</version>
- </dependency>
- <dependency>
- <groupId>org.onap.sdc.jtosca</groupId>
- <artifactId>jtosca</artifactId>
- <version>1.4.8</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-api-handler-common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-requests-db</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-requests-db-repositories</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr4</artifactId>
- <version>${antlr.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-configuration-processor</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.vorburger.mariaDB4j</groupId>
- <artifactId>mariaDB4j</artifactId>
- <version>2.2.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-contract-wiremock</artifactId>
- <version>1.2.4.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>io.micrometer</groupId>
- <artifactId>micrometer-core</artifactId>
- </dependency>
- <dependency>
- <groupId>io.micrometer</groupId>
- <artifactId>micrometer-registry-prometheus</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.interceptor</groupId>
- <artifactId>javax.interceptor-api</artifactId>
- </dependency>
- </dependencies>
+ <build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.7.7.201606060606</version>
+ <configuration>
+ <excludes>
+ +
+ <exclude>**/resource-examples/**</exclude>
+ </excludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>default-prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-report</id>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-check</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <rule implementation="org.jacoco.maven.RuleConfiguration">
+ <element>BUNDLE</element>
+ <limits>
+ <limit implementation="org.jacoco.report.check.Limit">
+ <counter>INSTRUCTION</counter>
+ <value>COVEREDRATIO</value>
+ </limit>
+ </limits>
+ </rule>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr4-maven-plugin</artifactId>
+ <version>${antlr.version}</version>
+ <executions>
+ <execution>
+ <id>antlr</id>
+ <phase>generate-test-resources</phase>
+ <goals>
+ <goal>antlr4</goal>
+ </goals>
+ <configuration>
+ <visitor>true</visitor>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ <configuration>
+ <generatedTestSourcesDirectory>${project.build.directory}/generated-sources
+ </generatedTestSourcesDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>org.onap.so.asdc.Application</mainClass>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>extract-docker-file</id>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>fabric8-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start</id>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>original</id>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey2-jaxrs</artifactId>
+ <version>1.5.16</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jersey</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jdbc</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-catalog-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.sdc.sdc-distribution-client</groupId>
+ <artifactId>sdc-distribution-client</artifactId>
+ <version>1.3.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.sdc.sdc-tosca</groupId>
+ <artifactId>sdc-tosca</artifactId>
+ <version>${sdc.tosca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.sdc.jtosca</groupId>
+ <artifactId>jtosca</artifactId>
+ <version>${jtosca.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-api-handler-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db-repositories</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr4</artifactId>
+ <version>${antlr.version}</version>
+
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.vorburger.mariaDB4j</groupId>
+ <artifactId>mariaDB4j</artifactId>
+ <version>2.2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-contract-wiremock</artifactId>
+ <version>1.2.4.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-registry-prometheus</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.interceptor</groupId>
+ <artifactId>javax.interceptor-api</artifactId>
+ </dependency>
+ </dependencies>
</project>
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 dc30b0e7de..c9332e8f84 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
@@ -24,6 +24,11 @@ d * ============LICENSE_START===================================================
package org.onap.so.asdc.client;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -31,7 +36,6 @@ import java.io.UnsupportedEncodingException;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
-
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
@@ -48,6 +52,9 @@ import org.onap.so.asdc.client.exceptions.ASDCDownloadException;
import org.onap.so.asdc.client.exceptions.ASDCParametersException;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.installer.IVfResourceInstaller;
+import org.onap.so.asdc.installer.PnfResourceStructure;
+import org.onap.so.asdc.installer.ResourceStructure;
+import org.onap.so.asdc.installer.ResourceType;
import org.onap.so.asdc.installer.ToscaResourceStructure;
import org.onap.so.asdc.installer.VfResourceStructure;
import org.onap.so.asdc.installer.bpmn.BpmnInstaller;
@@ -57,20 +64,14 @@ import org.onap.so.asdc.tenantIsolation.WatchdogDistribution;
import org.onap.so.asdc.util.ASDCNotificationLogging;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
@Component
public class ASDCController {
@@ -79,54 +80,49 @@ public class ASDCController {
protected boolean isAsdcClientAutoManaged = false;
protected String controllerName;
-
+
private ASDCControllerStatus controllerStatus = ASDCControllerStatus.STOPPED;
-
+
protected int nbOfNotificationsOngoing = 0;
@Autowired
private ToscaResourceInstaller toscaInstaller;
-
+
@Autowired
private BpmnInstaller bpmnInstaller;
-
+
@Autowired
private WatchdogDistributionStatusRepository wdsRepo;
-
+
@Autowired
private ASDCConfiguration asdcConfig;
-
+
@Autowired
private ASDCStatusCallBack asdcStatusCallBack;
-
+
@Autowired
private ASDCNotificationCallBack asdcNotificationCallBack;
-
+
private IDistributionClient distributionClient;
-
+
private static final String UUID_PARAM = "(UUID:";
-
+
@Autowired
private WatchdogDistribution wd;
-
- public int getNbOfNotificationsOngoing () {
+ public int getNbOfNotificationsOngoing() {
return nbOfNotificationsOngoing;
- }
+ }
public IDistributionClient getDistributionClient() {
- return distributionClient;
- }
-
-
-
- public void setDistributionClient(IDistributionClient distributionClient) {
- this.distributionClient = distributionClient;
- }
-
+ return distributionClient;
+ }
+ public void setDistributionClient(IDistributionClient distributionClient) {
+ this.distributionClient = distributionClient;
+ }
- protected void changeControllerStatus (ASDCControllerStatus newControllerStatus) {
+ protected void changeControllerStatus(ASDCControllerStatus newControllerStatus) {
switch (newControllerStatus) {
case BUSY:
@@ -150,97 +146,99 @@ public class ASDCController {
}
}
- public ASDCControllerStatus getControllerStatus () {
+ public ASDCControllerStatus getControllerStatus() {
return this.controllerStatus;
}
-
- public ASDCController () {
- isAsdcClientAutoManaged = true;
+
+ public ASDCController() {
+ this("");
}
- public ASDCController (String controllerConfigName) {
+ public ASDCController(String controllerConfigName) {
isAsdcClientAutoManaged = true;
this.controllerName = controllerConfigName;
}
- public ASDCController (String controllerConfigName, IDistributionClient asdcClient, IVfResourceInstaller resourceinstaller) {
- distributionClient = asdcClient;
+ public ASDCController(String controllerConfigName, IDistributionClient asdcClient,
+ IVfResourceInstaller resourceinstaller) {
+ distributionClient = asdcClient;
}
- public ASDCController (String controllerConfigName,IDistributionClient asdcClient) {
+ public ASDCController(String controllerConfigName, IDistributionClient asdcClient) {
distributionClient = asdcClient;
- this.controllerName = controllerConfigName;
+ this.controllerName = controllerConfigName;
}
+
public String getControllerName() {
- return controllerName;
- }
+ return controllerName;
+ }
- public void setControllerName(String controllerName) {
- this.controllerName = controllerName;
- }
+ public void setControllerName(String controllerName) {
+ this.controllerName = controllerName;
+ }
- /**
+ /**
* This method initializes the ASDC Controller and the ASDC Client.
*
* @throws ASDCControllerException It throws an exception if the ASDC Client cannot be instantiated or if an init
- * attempt is done when already initialized
+ * attempt is done when already initialized
* @throws ASDCParametersException If there is an issue with the parameters provided
* @throws IOException In case of issues when trying to load the key file
*/
- public void initASDC () throws ASDCControllerException {
+ public void initASDC() throws ASDCControllerException {
String event = "Initialize the ASDC Controller";
logger.debug(event);
- if (this.getControllerStatus () != ASDCControllerStatus.STOPPED) {
+ if (this.getControllerStatus() != ASDCControllerStatus.STOPPED) {
String endEvent = "The controller is already initialized, call the closeASDC method first";
- throw new ASDCControllerException (endEvent);
+ throw new ASDCControllerException(endEvent);
}
- if (asdcConfig != null) {
+ if (asdcConfig != null) {
asdcConfig.setAsdcControllerName(controllerName);
- }
+ }
if (this.distributionClient == null) {
- distributionClient = DistributionClientFactory.createDistributionClient ();
+ distributionClient = DistributionClientFactory.createDistributionClient();
}
-
- IDistributionClientResult result = this.distributionClient.init (asdcConfig,
- asdcNotificationCallBack, asdcStatusCallBack);
- if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
+
+ IDistributionClientResult result = this.distributionClient.init(asdcConfig,
+ asdcNotificationCallBack, asdcStatusCallBack);
+ if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
String endEvent = "ASDC distribution client init failed with reason:"
- + result.getDistributionMessageResult ();
- logger.debug (endEvent);
- this.changeControllerStatus (ASDCControllerStatus.STOPPED);
- throw new ASDCControllerException ("Initialization of the ASDC Controller failed with reason: "
- + result.getDistributionMessageResult ());
+ + result.getDistributionMessageResult();
+ logger.debug(endEvent);
+ this.changeControllerStatus(ASDCControllerStatus.STOPPED);
+ throw new ASDCControllerException("Initialization of the ASDC Controller failed with reason: "
+ + result.getDistributionMessageResult());
}
- result = this.distributionClient.start ();
- if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
+ result = this.distributionClient.start();
+ if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
String endEvent = "ASDC distribution client start failed with reason:"
- + result.getDistributionMessageResult ();
- logger.debug (endEvent);
- this.changeControllerStatus (ASDCControllerStatus.STOPPED);
- throw new ASDCControllerException ("Startup of the ASDC Controller failed with reason: "
- + result.getDistributionMessageResult ());
+ + result.getDistributionMessageResult();
+ logger.debug(endEvent);
+ this.changeControllerStatus(ASDCControllerStatus.STOPPED);
+ throw new ASDCControllerException("Startup of the ASDC Controller failed with reason: "
+ + result.getDistributionMessageResult());
}
- this.changeControllerStatus (ASDCControllerStatus.IDLE);
+ this.changeControllerStatus(ASDCControllerStatus.IDLE);
logger.info("{} {} {}", MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC.toString(), "ASDC", "changeControllerStatus");
}
/**
* This method closes the ASDC Controller and the ASDC Client.
*
- * @throws ASDCControllerException It throws an exception if the ASDC Client cannot be closed because
- * it's currently BUSY in processing notifications.
+ * @throws ASDCControllerException It throws an exception if the ASDC Client cannot be closed because it's currently
+ * BUSY in processing notifications.
*/
- public void closeASDC () throws ASDCControllerException {
+ public void closeASDC() throws ASDCControllerException {
- if (this.getControllerStatus () == ASDCControllerStatus.BUSY) {
- throw new ASDCControllerException ("Cannot close the ASDC controller as it's currently in BUSY state");
+ if (this.getControllerStatus() == ASDCControllerStatus.BUSY) {
+ throw new ASDCControllerException("Cannot close the ASDC controller as it's currently in BUSY state");
}
if (this.distributionClient != null) {
- this.distributionClient.stop ();
+ this.distributionClient.stop();
// If auto managed we can set it to Null, ASDCController controls it.
// In the other case the client of this class has specified it, so we can't reset it
if (isAsdcClientAutoManaged) {
@@ -249,205 +247,201 @@ public class ASDCController {
}
}
- this.changeControllerStatus (ASDCControllerStatus.STOPPED);
+ this.changeControllerStatus(ASDCControllerStatus.STOPPED);
}
- private boolean checkResourceAlreadyDeployed (VfResourceStructure resource) throws ArtifactInstallerException {
+ private boolean checkResourceAlreadyDeployed(VfResourceStructure resource) throws ArtifactInstallerException {
-
- if (toscaInstaller.isResourceAlreadyDeployed (resource)) {
- logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST.toString(),
- resource.getResourceInstance().getResourceInstanceName(),
- resource.getResourceInstance().getResourceUUID(),
- resource.getResourceInstance().getResourceName());
+ if (toscaInstaller.isResourceAlreadyDeployed(resource)) {
+ logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST.toString(),
+ resource.getResourceInstance().getResourceInstanceName(),
+ resource.getResourceInstance().getResourceUUID(),
+ resource.getResourceInstance().getResourceName());
- this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DOWNLOADED,null);
- this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DEPLOYED,null);
+ this.sendDeployNotificationsForResource(resource, DistributionStatusEnum.ALREADY_DOWNLOADED, null);
+ this.sendDeployNotificationsForResource(resource, DistributionStatusEnum.ALREADY_DEPLOYED, null);
- return true;
- } else {
- return false;
- }
+ return true;
+ } else {
+ return false;
+ }
}
-
- protected IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact,
- String distributionId) throws ASDCDownloadException {
+ protected IDistributionClientDownloadResult downloadTheArtifact(IArtifactInfo artifact,
+ String distributionId) throws ASDCDownloadException {
- logger.debug("Trying to download the artifact : " + artifact.getArtifactURL ()
- + UUID_PARAM
- + artifact.getArtifactUUID ()
- + ")");
+ logger.info("Trying to download the artifact UUID: {} from URL: {}", artifact.getArtifactUUID(),
+ artifact.getArtifactURL());
IDistributionClientDownloadResult downloadResult;
-
try {
- downloadResult = distributionClient.download (artifact);
+ downloadResult = distributionClient.download(artifact);
if (null == downloadResult) {
- logger.info ("{} {}", MessageEnum.ASDC_ARTIFACT_NULL.toString(), artifact.getArtifactUUID());
- return downloadResult;
+ logger.info("{} {}", MessageEnum.ASDC_ARTIFACT_NULL.toString(), artifact.getArtifactUUID());
+ return downloadResult;
}
} catch (RuntimeException e) {
- logger.debug ("Not able to download the artifact due to an exception: " + artifact.getArtifactURL ());
- this.sendASDCNotification (NotificationType.DOWNLOAD,
- artifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- distributionId,
- DistributionStatusEnum.DOWNLOAD_ERROR,
- e.getMessage (),
- System.currentTimeMillis ());
-
- throw new ASDCDownloadException ("Exception caught when downloading the artifact", e);
+ logger.debug("Not able to download the artifact due to an exception: " + artifact.getArtifactURL());
+ this.sendASDCNotification(NotificationType.DOWNLOAD,
+ artifact.getArtifactURL(),
+ asdcConfig.getConsumerID(),
+ distributionId,
+ DistributionStatusEnum.DOWNLOAD_ERROR,
+ e.getMessage(),
+ System.currentTimeMillis());
+
+ throw new ASDCDownloadException("Exception caught when downloading the artifact", e);
}
- if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult ())) {
+ if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult())) {
logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC.toString(), artifact.getArtifactURL(),
artifact.getArtifactUUID(), String.valueOf(downloadResult.getArtifactPayload().length));
} else {
logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
- downloadResult.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(),
+ downloadResult.getDistributionMessageResult(), ErrorCode.DataError.getValue(),
"ASDC artifact download fail");
- this.sendASDCNotification (NotificationType.DOWNLOAD,
- artifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- distributionId,
- DistributionStatusEnum.DOWNLOAD_ERROR,
- downloadResult.getDistributionMessageResult (),
- System.currentTimeMillis ());
-
- throw new ASDCDownloadException ("Artifact " + artifact.getArtifactName ()
- + " could not be downloaded from ASDC URL "
- + artifact.getArtifactURL ()
- + UUID_PARAM
- + artifact.getArtifactUUID ()
- + ")"
- + System.lineSeparator ()
- + "Error message is "
- + downloadResult.getDistributionMessageResult ()
- + System.lineSeparator ());
+ this.sendASDCNotification(NotificationType.DOWNLOAD,
+ artifact.getArtifactURL(),
+ asdcConfig.getConsumerID(),
+ distributionId,
+ DistributionStatusEnum.DOWNLOAD_ERROR,
+ downloadResult.getDistributionMessageResult(),
+ System.currentTimeMillis());
+
+ throw new ASDCDownloadException("Artifact " + artifact.getArtifactName()
+ + " could not be downloaded from ASDC URL "
+ + artifact.getArtifactURL()
+ + UUID_PARAM
+ + artifact.getArtifactUUID()
+ + ")"
+ + System.lineSeparator()
+ + "Error message is "
+ + downloadResult.getDistributionMessageResult()
+ + System.lineSeparator());
}
- this.sendASDCNotification (NotificationType.DOWNLOAD,
- artifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- distributionId,
- DistributionStatusEnum.DOWNLOAD_OK,
- null,
- System.currentTimeMillis ());
+ this.sendASDCNotification(NotificationType.DOWNLOAD,
+ artifact.getArtifactURL(),
+ asdcConfig.getConsumerID(),
+ distributionId,
+ DistributionStatusEnum.DOWNLOAD_OK,
+ null,
+ System.currentTimeMillis());
return downloadResult;
}
- private void writeArtifactToFile (IArtifactInfo artifact,
- IDistributionClientDownloadResult resultArtifact) {
+ private void writeArtifactToFile(IArtifactInfo artifact, IDistributionClientDownloadResult resultArtifact) {
- logger.debug(
- "Trying to write artifact to file : " + artifact.getArtifactURL() + UUID_PARAM + artifact.getArtifactUUID()
- + ")");
-
- String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString();
- // make parent directory
- File file = new File(filePath);
- File fileParent = file.getParentFile();
- if (!fileParent.exists()) {
- fileParent.mkdirs();
- }
-
- byte[] payloadBytes = resultArtifact.getArtifactPayload();
-
- try (FileOutputStream outFile = new FileOutputStream(filePath)) {
- logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***WRITE FILE ARTIFACT NAME",
- "ASDC", artifact.getArtifactName());
- outFile.write(payloadBytes, 0, payloadBytes.length);
- outFile.close();
- } catch (Exception e) {
- logger.debug("Exception :", e);
- logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
- artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
- resultArtifact.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(),
- "ASDC write to file failed");
+ String filePath = Paths
+ .get(getMsoConfigPath(), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize()
+ .toString();
+
+ logger.info("Trying to write artifact UUID: {}, URL: {} to file: {}", artifact.getArtifactUUID(),
+ artifact.getArtifactURL(), filePath);
+
+ // make parent directory
+ File file = new File(filePath);
+ File fileParent = file.getParentFile();
+ if (!fileParent.exists()) {
+ fileParent.mkdirs();
+ }
+
+ byte[] payloadBytes = resultArtifact.getArtifactPayload();
+
+ try (FileOutputStream outFile = new FileOutputStream(filePath)) {
+ logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***WRITE FILE ARTIFACT NAME",
+ "ASDC", artifact.getArtifactName());
+ outFile.write(payloadBytes, 0, payloadBytes.length);
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
+ resultArtifact.getDistributionMessageResult(), ErrorCode.DataError.getValue(),
+ "ASDC write to file failed");
}
}
- protected void sendDeployNotificationsForResource(VfResourceStructure vfResourceStructure,DistributionStatusEnum distribStatus, String errorReason) {
-
- for (IArtifactInfo artifactInfo : vfResourceStructure.getResourceInstance().getArtifacts()) {
-
- if ((DistributionStatusEnum.DEPLOY_OK.equals(distribStatus) && !artifactInfo.getArtifactType().equalsIgnoreCase("OTHER") && !vfResourceStructure.isAlreadyDeployed())
- // This could be NULL if the artifact is a VF module artifact, this won't be present in the MAP
- && vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()) != null
- && vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()).getDeployedInDb() == 0) {
- this.sendASDCNotification (NotificationType.DEPLOY,
- artifactInfo.getArtifactURL (),
- asdcConfig.getConsumerID (),
- vfResourceStructure.getNotification().getDistributionID(),
- DistributionStatusEnum.DEPLOY_ERROR,
- "The artifact has not been used by the modules defined in the resource",
- System.currentTimeMillis ());
- } else {
- this.sendASDCNotification (NotificationType.DEPLOY,
- artifactInfo.getArtifactURL (),
- asdcConfig.getConsumerID (),
- vfResourceStructure.getNotification().getDistributionID(),
- distribStatus,
- errorReason,
- System.currentTimeMillis ());
- }
- }
+ protected void sendDeployNotificationsForResource(ResourceStructure resourceStructure,
+ DistributionStatusEnum distribStatus, String errorReason) {
+
+ for (IArtifactInfo artifactInfo : resourceStructure.getResourceInstance().getArtifacts()) {
+
+ if ((DistributionStatusEnum.DEPLOY_OK.equals(distribStatus) && !artifactInfo.getArtifactType()
+ .equalsIgnoreCase("OTHER") && !resourceStructure.isAlreadyDeployed())
+ // This could be NULL if the artifact is a VF module artifact, this won't be present in the MAP
+ && resourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()) != null
+ && resourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()).getDeployedInDb()
+ == 0) {
+ this.sendASDCNotification(NotificationType.DEPLOY,
+ artifactInfo.getArtifactURL(),
+ asdcConfig.getConsumerID(),
+ resourceStructure.getNotification().getDistributionID(),
+ DistributionStatusEnum.DEPLOY_ERROR,
+ "The artifact has not been used by the modules defined in the resource",
+ System.currentTimeMillis());
+ } else {
+ this.sendASDCNotification(NotificationType.DEPLOY,
+ artifactInfo.getArtifactURL(),
+ asdcConfig.getConsumerID(),
+ resourceStructure.getNotification().getDistributionID(),
+ distribStatus,
+ errorReason,
+ System.currentTimeMillis());
+ }
+ }
}
-
- protected void sendCsarDeployNotification(INotificationData iNotif, VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure, boolean deploySuccessful, String errorReason) {
-
- IArtifactInfo csarArtifact = toscaResourceStructure.getToscaArtifact();
-
- if(deploySuccessful){
-
- this.sendASDCNotification (NotificationType.DEPLOY,
- csarArtifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- resourceStructure.getNotification().getDistributionID(),
- DistributionStatusEnum.DEPLOY_OK,
- errorReason,
- System.currentTimeMillis ());
-
- } else {
-
- this.sendASDCNotification (NotificationType.DEPLOY,
- csarArtifact.getArtifactURL (),
- asdcConfig.getConsumerID (),
- resourceStructure.getNotification().getDistributionID(),
- DistributionStatusEnum.DEPLOY_ERROR,
- errorReason,
- System.currentTimeMillis ());
-
- }
+
+ protected void sendCsarDeployNotification(INotificationData iNotif, ResourceStructure resourceStructure,
+ ToscaResourceStructure toscaResourceStructure, boolean deploySuccessful, String errorReason) {
+
+ IArtifactInfo csarArtifact = toscaResourceStructure.getToscaArtifact();
+
+ if (deploySuccessful) {
+
+ this.sendASDCNotification(NotificationType.DEPLOY,
+ csarArtifact.getArtifactURL(),
+ asdcConfig.getConsumerID(),
+ resourceStructure.getNotification().getDistributionID(),
+ DistributionStatusEnum.DEPLOY_OK,
+ errorReason,
+ System.currentTimeMillis());
+
+ } else {
+
+ this.sendASDCNotification(NotificationType.DEPLOY,
+ csarArtifact.getArtifactURL(),
+ asdcConfig.getConsumerID(),
+ resourceStructure.getNotification().getDistributionID(),
+ DistributionStatusEnum.DEPLOY_ERROR,
+ errorReason,
+ System.currentTimeMillis());
+
+ }
}
-
- protected void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
+
+ protected void deployResourceStructure(ResourceStructure resourceStructure,
+ ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
logger.info("{} {} {} {}", MessageEnum.ASDC_START_DEPLOY_ARTIFACT.toString(),
resourceStructure.getResourceInstance().getResourceInstanceName(),
resourceStructure.getResourceInstance().getResourceUUID(), "ASDC");
try {
- String resourceType = resourceStructure.getResourceInstance().getResourceType();
- String category = resourceStructure.getResourceInstance().getCategory();
- if("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)){
- resourceStructure.createVfModuleStructures();
- }
- toscaInstaller.installTheResource(toscaResourceStructure, resourceStructure);
+ resourceStructure.prepareInstall();
+ toscaInstaller.installTheResource(toscaResourceStructure, resourceStructure);
} catch (ArtifactInstallerException e) {
logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
resourceStructure.getResourceInstance().getResourceName(),
resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf(resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
+ String.valueOf(resourceStructure.getNumberOfResources()), "ASDC", "deployResourceStructure");
sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
throw e;
}
@@ -456,228 +450,231 @@ public class ASDCController {
logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
resourceStructure.getResourceInstance().getResourceName(),
resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf(resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
+ String.valueOf(resourceStructure.getNumberOfResources()), "ASDC", "deployResourceStructure");
sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_OK, null);
}
}
-
+
private enum NotificationType {
- DOWNLOAD, DEPLOY
+ DOWNLOAD, DEPLOY
}
- protected void sendASDCNotification (NotificationType notificationType,
- String artifactURL,
- String consumerID,
- String distributionID,
- DistributionStatusEnum status,
- String errorReason,
- long timestamp) {
-
- String event = "Sending " + notificationType.name ()
- + "("
- + status.name ()
- + ")"
- + " notification to ASDC for artifact:"
- + artifactURL;
+ protected void sendASDCNotification(NotificationType notificationType,
+ String artifactURL,
+ String consumerID,
+ String distributionID,
+ DistributionStatusEnum status,
+ String errorReason,
+ long timestamp) {
+
+ String event = "Sending " + notificationType.name()
+ + "("
+ + status.name()
+ + ")"
+ + " notification to ASDC for artifact:"
+ + artifactURL;
if (errorReason != null) {
- event=event+"("+errorReason+")";
+ event = event + "(" + errorReason + ")";
}
logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC.toString(), notificationType.name(),
status.name(), artifactURL, "ASDC", "sendASDCNotification");
- logger.debug (event);
+ logger.debug(event);
String action = "";
try {
- IDistributionStatusMessage message = new DistributionStatusMessage (artifactURL,
- consumerID,
- distributionID,
- status,
- timestamp);
+ IDistributionStatusMessage message = new DistributionStatusMessage(artifactURL,
+ consumerID,
+ distributionID,
+ status,
+ timestamp);
switch (notificationType) {
case DOWNLOAD:
if (errorReason != null) {
- this.distributionClient.sendDownloadStatus (message, errorReason);
+ this.distributionClient.sendDownloadStatus(message, errorReason);
} else {
- this.distributionClient.sendDownloadStatus (message);
+ this.distributionClient.sendDownloadStatus(message);
}
action = "sendDownloadStatus";
break;
case DEPLOY:
if (errorReason != null) {
- this.distributionClient.sendDeploymentStatus (message, errorReason);
+ this.distributionClient.sendDeploymentStatus(message, errorReason);
} else {
- this.distributionClient.sendDeploymentStatus (message);
+ this.distributionClient.sendDeploymentStatus(message);
}
action = "sendDeploymentdStatus";
break;
default:
- break;
+ break;
}
} catch (RuntimeException e) {
logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
- "sendASDCNotification", MsoLogger.ErrorCode.SchemaError.getValue(),
+ "sendASDCNotification", ErrorCode.SchemaError.getValue(),
"RuntimeException - sendASDCNotification", e);
}
}
-
- protected void sendFinalDistributionStatus (
- String distributionID,
- DistributionStatusEnum status,
- String errorReason) {
+ protected void sendFinalDistributionStatus(
+ String distributionID,
+ DistributionStatusEnum status,
+ String errorReason) {
- logger.debug("Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status
+ logger.debug(
+ "Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status
.name() + " and ErrorReason " + errorReason);
- long subStarttime = System.currentTimeMillis ();
- try {
-
-
- IFinalDistrStatusMessage finalDistribution = new FinalDistributionStatusMessage(distributionID,status,subStarttime, asdcConfig.getConsumerID());
-
- if(errorReason == null){
- this.distributionClient.sendFinalDistrStatus(finalDistribution);
- }else{
- this.distributionClient.sendFinalDistrStatus(finalDistribution, errorReason);
- }
-
-
- } catch (RuntimeException e) {
- logger.debug("Exception caught in sendFinalDistributionStatus {}", e.getMessage());
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC", "sendASDCNotification",
- MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification", e);
- }
+ long subStarttime = System.currentTimeMillis();
+ try {
+
+ IFinalDistrStatusMessage finalDistribution = new FinalDistributionStatusMessage(distributionID, status,
+ subStarttime, asdcConfig.getConsumerID());
+
+ if (errorReason == null) {
+ this.distributionClient.sendFinalDistrStatus(finalDistribution);
+ } else {
+ this.distributionClient.sendFinalDistrStatus(finalDistribution, errorReason);
+ }
+
+
+ } catch (RuntimeException e) {
+ logger.debug("Exception caught in sendFinalDistributionStatus {}", e.getMessage());
+ logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
+ "sendASDCNotification",
+ ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification", e);
+ }
}
- private Optional<String> getNotificationJson(INotificationData iNotif) {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- mapper.setSerializationInclusion(Include.NON_EMPTY);
- mapper.setSerializationInclusion(Include.NON_ABSENT);
+ private Optional<String> getNotificationJson(INotificationData iNotif) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ mapper.setSerializationInclusion(Include.NON_EMPTY);
+ mapper.setSerializationInclusion(Include.NON_ABSENT);
mapper.enable(MapperFeature.USE_ANNOTATIONS);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- Optional<String> returnValue = Optional.empty();
- try {
- returnValue = Optional.of(mapper.writeValueAsString(iNotif));
- } catch (JsonProcessingException e) {
- logger.error("Error converting incoming ASDC notification to JSON" , e);
- }
- return returnValue;
- }
-
- public void treatNotification (INotificationData iNotif) {
-
- int noOfArtifacts = 0;
-
-
- for (IResourceInstance resource : iNotif.getResources ()) {
- noOfArtifacts += resource.getArtifacts ().size ();
- }
+ Optional<String> returnValue = Optional.empty();
+ try {
+ returnValue = Optional.of(mapper.writeValueAsString(iNotif));
+ } catch (JsonProcessingException e) {
+ logger.error("Error converting incoming ASDC notification to JSON", e);
+ }
+ return returnValue;
+ }
+
+ public void treatNotification(INotificationData iNotif) {
+
+ int noOfArtifacts = 0;
+
+ for (IResourceInstance resource : iNotif.getResources()) {
+ noOfArtifacts += resource.getArtifacts().size();
+ }
logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(), String.valueOf(noOfArtifacts),
iNotif.getServiceUUID(), "ASDC");
try {
- logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
- logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(), "ASDC",
+ logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
+ logger
+ .info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(), "ASDC",
"treatNotification");
this.changeControllerStatus(ASDCControllerStatus.BUSY);
- Optional<String> notificationMessage = getNotificationJson(iNotif);
- toscaInstaller.processWatchdog(iNotif.getDistributionID(), iNotif.getServiceUUID(), notificationMessage,
- asdcConfig.getConsumerID());
-
- // Process only the Resource artifacts in MSO
- this.processResourceNotification(iNotif);
-
- //********************************************************************************************************
- //Start Watchdog loop and wait for all components to complete before reporting final status back.
- // **If timer expires first then we will report a Distribution Error back to ASDC
- //********************************************************************************************************
- long initialStartTime = System.currentTimeMillis();
- boolean componentsComplete = false;
- String distributionStatus = null;
- String watchdogError = null;
- String overallStatus = null;
- int watchDogTimeout = asdcConfig.getWatchDogTimeout() * 1000;
- boolean isDeploySuccess = false;
-
- while(!componentsComplete && (System.currentTimeMillis() - initialStartTime) < watchDogTimeout)
- {
-
- try{
- distributionStatus = wd.getOverallDistributionStatus(iNotif.getDistributionID());
- Thread.sleep(watchDogTimeout / 10);
- }catch(Exception e){
- logger.debug ("Exception in Watchdog Loop {}", e.getMessage());
- Thread.sleep(watchDogTimeout / 10);
- }
-
- if(distributionStatus != null && !distributionStatus.equalsIgnoreCase(DistributionStatus.INCOMPLETE.name())){
-
- if(distributionStatus.equalsIgnoreCase(DistributionStatus.SUCCESS.name())){
- isDeploySuccess = true;
- overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK.name();
- }else{
- overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
- }
- componentsComplete = true;
- }
- }
-
- if(!componentsComplete){
- logger.debug("Timeout of {} seconds was reached before all components reported status", watchDogTimeout);
- watchdogError = "Timeout occurred while waiting for all components to report status";
- overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
- }
-
- if(distributionStatus == null){
- overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
- logger.debug("DistributionStatus is null for DistributionId: {}", iNotif.getDistributionID());
- }
-
- try {
- wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), overallStatus);
- logger.debug("A&AI Updated succefully with Distribution Status!");
- }
- catch(Exception e) {
- logger.debug("Exception in Watchdog executePatchAAI(): {}", e.getMessage());
- watchdogError = "Error calling A&AI " + e.getMessage();
- if(e.getCause() != null) {
- logger.debug("Exception caused by: {}", e.getCause().getMessage());
- }
- }
-
-
- if(isDeploySuccess && watchdogError == null){
- sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK, null);
- WatchdogDistributionStatus wds = new WatchdogDistributionStatus(iNotif.getDistributionID());
- wds.setDistributionIdStatus(DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK.toString());
- wdsRepo.save(wds);
- } else {
- sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, watchdogError);
- WatchdogDistributionStatus wds = new WatchdogDistributionStatus(iNotif.getDistributionID());
- wds.setDistributionIdStatus(DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.toString());
- wdsRepo.save(wds);
- }
-
-
- } catch(ObjectOptimisticLockingFailureException e) {
+ Optional<String> notificationMessage = getNotificationJson(iNotif);
+ toscaInstaller.processWatchdog(iNotif.getDistributionID(), iNotif.getServiceUUID(), notificationMessage,
+ asdcConfig.getConsumerID());
+
+ // Process only the Resource artifacts in MSO
+ this.processResourceNotification(iNotif);
+
+ //********************************************************************************************************
+ //Start Watchdog loop and wait for all components to complete before reporting final status back.
+ // **If timer expires first then we will report a Distribution Error back to ASDC
+ //********************************************************************************************************
+ long initialStartTime = System.currentTimeMillis();
+ boolean componentsComplete = false;
+ String distributionStatus = null;
+ String watchdogError = null;
+ String overallStatus = null;
+ int watchDogTimeout = asdcConfig.getWatchDogTimeout() * 1000;
+ boolean isDeploySuccess = false;
+
+ while (!componentsComplete && (System.currentTimeMillis() - initialStartTime) < watchDogTimeout) {
+
+ try {
+ distributionStatus = wd.getOverallDistributionStatus(iNotif.getDistributionID());
+ Thread.sleep(watchDogTimeout / 10);
+ } catch (Exception e) {
+ logger.debug("Exception in Watchdog Loop {}", e.getMessage());
+ Thread.sleep(watchDogTimeout / 10);
+ }
+
+ if (distributionStatus != null && !distributionStatus
+ .equalsIgnoreCase(DistributionStatus.INCOMPLETE.name())) {
+
+ if (distributionStatus.equalsIgnoreCase(DistributionStatus.SUCCESS.name())) {
+ isDeploySuccess = true;
+ overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK.name();
+ } else {
+ overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
+ }
+ componentsComplete = true;
+ }
+ }
+
+ if (!componentsComplete) {
+ logger
+ .debug("Timeout of {} seconds was reached before all components reported status", watchDogTimeout);
+ watchdogError = "Timeout occurred while waiting for all components to report status";
+ overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
+ }
+
+ if (distributionStatus == null) {
+ overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
+ logger.debug("DistributionStatus is null for DistributionId: {}", iNotif.getDistributionID());
+ }
+
+ try {
+ wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), overallStatus);
+ logger.debug("A&AI Updated succefully with Distribution Status!");
+ } catch (Exception e) {
+ logger.debug("Exception in Watchdog executePatchAAI(): {}", e.getMessage());
+ watchdogError = "Error calling A&AI " + e.getMessage();
+ if (e.getCause() != null) {
+ logger.debug("Exception caused by: {}", e.getCause().getMessage());
+ }
+ }
+
+ if (isDeploySuccess && watchdogError == null) {
+ sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK,
+ null);
+ WatchdogDistributionStatus wds = new WatchdogDistributionStatus(iNotif.getDistributionID());
+ wds.setDistributionIdStatus(DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK.toString());
+ wdsRepo.save(wds);
+ } else {
+ sendFinalDistributionStatus(iNotif.getDistributionID(),
+ DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, watchdogError);
+ WatchdogDistributionStatus wds = new WatchdogDistributionStatus(iNotif.getDistributionID());
+ wds.setDistributionIdStatus(DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.toString());
+ wdsRepo.save(wds);
+ }
+
+
+ } catch (ObjectOptimisticLockingFailureException e) {
logger.debug("OptimisticLockingFailure for DistributionId: {} Another process "
+ "has already altered this distribution, so not going to process it on this site.",
iNotif.getDistributionID());
logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Database concurrency exception: ", "ASDC", "treatNotification",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e);
+ ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e);
} catch (Exception e) {
logger.error("", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
- "Unexpected exception caught during the notification processing", "ASDC",
- "treatNotification", MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException in treatNotification",
- e);
+ "Unexpected exception caught during the notification processing", "ASDC",
+ "treatNotification", ErrorCode.SchemaError.getValue(),
+ "RuntimeException in treatNotification",
+ e);
try {
wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(),
@@ -690,167 +687,168 @@ public class ASDCController {
logger.debug("Exception caused by: {}", aaiException.getCause().getMessage());
}
}
-
- sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, e.getMessage());
-
- WatchdogDistributionStatus wds = new WatchdogDistributionStatus(iNotif.getDistributionID());
- wds.setDistributionIdStatus(DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.toString());
- wdsRepo.save(wds);
-
+
+ sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR,
+ e.getMessage());
+
+ WatchdogDistributionStatus wds = new WatchdogDistributionStatus(iNotif.getDistributionID());
+ wds.setDistributionIdStatus(DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.toString());
+ wdsRepo.save(wds);
+
} finally {
- this.changeControllerStatus (ASDCControllerStatus.IDLE);
+ this.changeControllerStatus(ASDCControllerStatus.IDLE);
}
}
- protected void processResourceNotification (INotificationData iNotif) {
- // For each artifact, create a structure describing the VFModule in a ordered flat level
- VfResourceStructure resourceStructure = null;
- ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure();
- boolean deploySuccessful = true;
- boolean hasVFResource = false;
- String errorMessage = null;
-
- try {
-
- this.processCsarServiceArtifacts(iNotif, toscaResourceStructure);
- IArtifactInfo iArtifact = toscaResourceStructure.getToscaArtifact();
- String filePath = System.getProperty("mso.config.path") + "/ASDC/" + iArtifact.getArtifactVersion() + "/" + iArtifact.getArtifactName();
- File csarFile = new File(filePath);
- String csarFilePath = csarFile.getAbsolutePath();
- if (bpmnInstaller.containsWorkflows(csarFilePath)) {
- bpmnInstaller.installBpmn(csarFilePath);
- }
-
- for (IResourceInstance resource : iNotif.getResources()){
-
- resourceStructure = new VfResourceStructure(iNotif,resource);
-
- String resourceType = resourceStructure.getResourceInstance().getResourceType();
- String category = resourceStructure.getResourceInstance().getCategory();
-
- logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure
- .getResourceInstance().getResourceUUID());
-
- if("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)){
-
- hasVFResource = true;
-
- for (IArtifactInfo artifact : resource.getArtifacts()) {
- IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,
- iNotif.getDistributionID());
- if (resultArtifact != null) {
-
- if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifact.getArtifactType())) {
- logger.debug("VF_MODULE_ARTIFACT: "+ new String(resultArtifact.getArtifactPayload(),"UTF-8"));
- logger.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact
- (resultArtifact.getArtifactPayload())));
- }
- resourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact);
- }
- }
-
- //Deploy VF resource and artifacts
- logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
- try{
-
- this.deployResourceStructure(resourceStructure, toscaResourceStructure);
-
- } catch(ArtifactInstallerException e){
- deploySuccessful = false;
- errorMessage = e.getMessage();
- logger.error("Exception occurred", e);
- }
- }
-
- }
-
- // There are cases where the Service has no VF resources, those are handled here
- if (!hasVFResource) {
-
- logger.debug("No resources found for Service: {}", iNotif.getServiceUUID());
-
- try{
- resourceStructure = new VfResourceStructure(iNotif,new ResourceInstance());
-
- this.deployResourceStructure(resourceStructure, toscaResourceStructure);
-
- } catch(ArtifactInstallerException e){
- deploySuccessful = false;
- errorMessage = e.getMessage();
- logger.error("Exception occurred", e);
- }
- }
- this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deploySuccessful, errorMessage);
-
- } catch (ASDCDownloadException | UnsupportedEncodingException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
- "Exception caught during Installation of artifact", "ASDC", "processResourceNotification",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e);
- }
+ protected void processResourceNotification(INotificationData iNotif) {
+ // For each artifact, create a structure describing the VFModule in a ordered flat level
+ ResourceStructure resourceStructure = null;
+ String msoConfigPath = getMsoConfigPath();
+ ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure(msoConfigPath);
+ boolean deploySuccessful = true;
+ String errorMessage = null;
+
+ try {
+ this.processCsarServiceArtifacts(iNotif, toscaResourceStructure);
+ IArtifactInfo iArtifact = toscaResourceStructure.getToscaArtifact();
+ String filePath =
+ msoConfigPath + "/ASDC/" + iArtifact.getArtifactVersion() + "/" + iArtifact
+ .getArtifactName();
+ File csarFile = new File(filePath);
+ String csarFilePath = csarFile.getAbsolutePath();
+ if (bpmnInstaller.containsWorkflows(csarFilePath)) {
+ bpmnInstaller.installBpmn(csarFilePath);
+ }
+
+ for (IResourceInstance resource : iNotif.getResources()) {
+
+ String resourceType = resource.getResourceType();
+ String category = resource.getCategory();
+
+ logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID());
+
+ if ("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)) {
+ resourceStructure = new VfResourceStructure(iNotif, resource);
+ } else if ("PNF".equals(resourceType)) {
+ resourceStructure = new PnfResourceStructure(iNotif, resource);
+ } else {
+ // There are cases where the Service has no VF resources, those are handled here
+ logger.info("No resources found for Service: {}", iNotif.getServiceUUID());
+ resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
+ resourceStructure.setResourceType(ResourceType.OTHER);
+ }
+
+ for (IArtifactInfo artifact : resource.getArtifacts()) {
+ IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,
+ iNotif.getDistributionID());
+ if (resultArtifact != null) {
+ resourceStructure.addArtifactToStructure(distributionClient, artifact, resultArtifact);
+ }
+ }
+
+ //Deploy VF resource and artifacts
+ logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
+ try {
+ this.deployResourceStructure(resourceStructure, toscaResourceStructure);
+ } catch (ArtifactInstallerException e) {
+ deploySuccessful = false;
+ errorMessage = e.getMessage();
+ logger.error("Exception occurred", e);
+ }
+
+ this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deploySuccessful,
+ errorMessage);
+ }
+
+
+ } catch (ASDCDownloadException | UnsupportedEncodingException e) {
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during Installation of artifact", "ASDC", "processResourceNotification",
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e);
+ }
}
- protected void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
-
- List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts();
-
- for(IArtifactInfo artifact : serviceArtifacts){
-
- if(artifact.getArtifactType().equals(ASDCConfiguration.TOSCA_CSAR)){
-
- try{
-
- toscaResourceStructure.setToscaArtifact(artifact);
-
- IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,iNotif.getDistributionID());
-
- writeArtifactToFile(artifact, resultArtifact);
-
- toscaResourceStructure.updateResourceStructure(artifact);
-
- toscaResourceStructure.setServiceVersion(iNotif.getServiceVersion());
-
- logger.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure));
-
-
- } catch(Exception e){
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
- "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", e);
- }
- }
- else if(artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOWS)){
-
- try{
-
- IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact,iNotif.getDistributionID());
-
- writeArtifactToFile(artifact, resultArtifact);
-
- toscaResourceStructure.setToscaArtifact(artifact);
-
- logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
-
-
- } catch(Exception e){
- logger.info("Whats the error {}", e.getMessage());
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
- "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts",
- e);
+
+ private String getMsoConfigPath() {
+ String msoConfigPath = System.getProperty("mso.config.path");
+ if (msoConfigPath == null) {
+ logger.info("Unable to find the system property mso.config.path, use the default configuration");
+ msoConfigPath = asdcConfig.getPropertyOrNull("mso.config.defaultpath");
+ }
+ if (msoConfigPath == null) {
+ logger.info("Unable to find the property: {} from configuration.", "mso.config.defaultpath");
+ msoConfigPath = "";
+ }
+ logger.info("MSO config path is: {}", msoConfigPath);
+ return msoConfigPath;
+ }
+
+ protected void processCsarServiceArtifacts(INotificationData iNotif,
+ ToscaResourceStructure toscaResourceStructure) {
+
+ List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts();
+
+ for (IArtifactInfo artifact : serviceArtifacts) {
+
+ if (artifact.getArtifactType().equals(ASDCConfiguration.TOSCA_CSAR)) {
+
+ try {
+
+ toscaResourceStructure.setToscaArtifact(artifact);
+
+ IDistributionClientDownloadResult resultArtifact = this
+ .downloadTheArtifact(artifact, iNotif.getDistributionID());
+
+ writeArtifactToFile(artifact, resultArtifact);
+
+ toscaResourceStructure.updateResourceStructure(artifact);
+
+ toscaResourceStructure.setServiceVersion(iNotif.getServiceVersion());
+
+ logger.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure));
+
+
+ } catch (Exception e) {
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts",
+ ErrorCode.BusinessProcesssError.getValue(),
+ "Exception in processCsarServiceArtifacts", e);
+ }
+ } else if (artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOWS)) {
+
+ try {
+
+ IDistributionClientDownloadResult resultArtifact = this
+ .downloadTheArtifact(artifact, iNotif.getDistributionID());
+
+ writeArtifactToFile(artifact, resultArtifact);
+
+ toscaResourceStructure.setToscaArtifact(artifact);
+
+ logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
+
+
+ } catch (Exception e) {
+ logger.info("Whats the error {}", e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts",
+ ErrorCode.BusinessProcesssError.getValue(),
+ "Exception in processCsarServiceArtifacts",
+ e);
+ }
}
- }
-
- }
+
+ }
}
-
- private static final String UNKNOWN="Unknown";
-
+
+ private static final String UNKNOWN = "Unknown";
+
/**
* @return the address of the ASDC we are connected to.
*/
- public String getAddress () {
+ public String getAddress() {
if (asdcConfig != null) {
- return asdcConfig.getAsdcAddress ();
+ return asdcConfig.getAsdcAddress();
}
return UNKNOWN;
}
@@ -858,9 +856,9 @@ public class ASDCController {
/**
* @return the environment name of the ASDC we are connected to.
*/
- public String getEnvironment () {
+ public String getEnvironment() {
if (asdcConfig != null) {
- return asdcConfig.getEnvironmentName ();
+ return asdcConfig.getEnvironmentName();
}
return UNKNOWN;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
index ed97f5bdea..759d88f196 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java
@@ -41,7 +41,7 @@ public class ArtifactInfoImpl implements IArtifactInfo {
private ArtifactInfoImpl generatedArtifact;
private List<IArtifactInfo> relatedArtifactsInfo;
private List<ArtifactInfoImpl> relatedArtifactsImpl;
- ArtifactInfoImpl(){}
+ public ArtifactInfoImpl(){}
private ArtifactInfoImpl(IArtifactInfo iArtifactInfo){
artifactName = iArtifactInfo.getArtifactName();
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
index cbe16d864a..9462cc85d8 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/NotificationDataImpl.java
@@ -129,6 +129,10 @@ public class NotificationDataImpl implements INotificationData {
}
return ret;
}
+
+ public void setResources(List<ResourceInfoImpl> resources){
+ this.resources = resources;
+ }
public List<ResourceInfoImpl> getResourcesImpl(){
return resources;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
index dad7e64931..9103ae132e 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ResourceInfoImpl.java
@@ -31,7 +31,7 @@ import org.onap.sdc.api.notification.IResourceInstance;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class ResourceInfoImpl implements IResourceInstance{
- ResourceInfoImpl (){}
+ public ResourceInfoImpl (){}
private String resourceInstanceName;
private String resourceCustomizationUUID;
private String resourceName;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
index 329c139ec3..e9e5372d98 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
@@ -40,8 +40,8 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
import org.onap.so.asdc.client.test.emulators.JsonStatusData;
import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -111,7 +111,7 @@ public class ASDCRestInterface {
logger.info("Error caught " + e.getMessage());
logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
"Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e);
}
logger.info("ASDC Updates are complete");
logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(), "ASDC",
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/PnfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/PnfResourceStructure.java
new file mode 100644
index 0000000000..1c1351b272
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/PnfResourceStructure.java
@@ -0,0 +1,50 @@
+/*
+ * ============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.asdc.installer;
+
+import java.io.UnsupportedEncodingException;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+
+/**
+ * This class represents the PNF resource structure.
+ */
+public class PnfResourceStructure extends ResourceStructure {
+
+ public PnfResourceStructure(INotificationData notificationData, IResourceInstance resourceInstance) {
+ super(notificationData, resourceInstance);
+ this.resourceType = ResourceType.PNF_RESOURCE;
+ }
+
+ @Override
+ public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
+ IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
+
+ }
+
+ @Override
+ public void prepareInstall() throws ArtifactInstallerException {
+
+ }
+}
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
new file mode 100644
index 0000000000..53cc74f7e4
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java
@@ -0,0 +1,152 @@
+/*
+ * ============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.asdc.installer;
+
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract class to represent the resource structure.
+ *
+ * This structure exists to avoid having issues if the order of the resource artifact of tree structure is not good.
+ */
+public abstract class ResourceStructure {
+
+ /**
+ * Flag to indicate whether the resource is deployed successfully.
+ */
+ protected boolean isDeployedSuccessfully = false;
+
+ /**
+ * Flag to indicate whether the resource is already deployed.
+ */
+ protected boolean isAlreadyDeployed = false;
+
+ /**
+ * The resource type.
+ */
+ protected ResourceType resourceType;
+
+ /**
+ * The Raw notification data.
+ */
+ protected INotificationData notificationData;
+
+ /**
+ * The resource we will try to deploy.
+ */
+ protected IResourceInstance resourceInstance;
+
+ /**
+ * Number of resources provided by the resource structure.
+ */
+ protected int NumberOfResources;
+
+ /**
+ * The list of artifacts existing in this resource hashed by UUID.
+ */
+ protected final Map<String, VfModuleArtifact> artifactsMapByUUID;
+
+ public ResourceStructure(INotificationData notificationData, IResourceInstance resourceInstance) {
+ this.notificationData = notificationData;
+ this.resourceInstance = resourceInstance;
+ artifactsMapByUUID = new HashMap<>();
+ }
+
+ /**
+ * Add artifact to the resource structure.
+ *
+ * @param distributionClient
+ * @param artifactinfo
+ * @param clientResult
+ * @throws UnsupportedEncodingException
+ */
+ public abstract void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
+ IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException;
+
+ /**
+ * Prepare the resource for installation.
+ *
+ * @throws ArtifactInstallerException
+ */
+ public abstract void prepareInstall() throws ArtifactInstallerException;
+
+ public boolean isDeployedSuccessfully() {
+ return isDeployedSuccessfully;
+ }
+
+ public void setDeployedSuccessfully(boolean deployedSuccessfully) {
+ isDeployedSuccessfully = deployedSuccessfully;
+ }
+
+ public boolean isAlreadyDeployed() {
+ return isAlreadyDeployed;
+ }
+
+ public void setAlreadyDeployed(boolean alreadyDeployed) {
+ isAlreadyDeployed = alreadyDeployed;
+ }
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(ResourceType resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public INotificationData getNotification() {
+ return notificationData;
+ }
+
+ public void setNotification(INotificationData notificationData) {
+ this.notificationData = notificationData;
+ }
+
+ public IResourceInstance getResourceInstance() {
+ return resourceInstance;
+ }
+
+ public void setResourceInstance(IResourceInstance resourceInstance) {
+ this.resourceInstance = resourceInstance;
+ }
+
+ public int getNumberOfResources() {
+ return NumberOfResources;
+ }
+
+ public void setNumberOfResources(int numberOfResources) {
+ NumberOfResources = numberOfResources;
+ }
+
+ public Map<String, VfModuleArtifact> getArtifactsMapByUUID() {
+ return artifactsMapByUUID;
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceType.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceType.java
new file mode 100644
index 0000000000..8d55f57dfa
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceType.java
@@ -0,0 +1,41 @@
+/*
+ * ============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.asdc.installer;
+
+/**
+ * This enum defines the resource type, it's used for tosca parsing, extraction and ingestion in SO.
+ */
+public enum ResourceType {
+
+ /**
+ * VF resource and the category is not allotted_resource.
+ */
+ VF_RESOURCE,
+
+ /**
+ * PNF resource.
+ */
+ PNF_RESOURCE,
+
+ /**
+ * Other resource type, including VF resource of allotted_resource category.
+ */
+ OTHER
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index 700a5b16bb..3efc503fcb 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
@@ -43,6 +43,7 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkInstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup;
@@ -50,12 +51,20 @@ import org.onap.so.db.catalog.beans.ToscaCsar;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
public class ToscaResourceStructure {
+
+ protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceStructure.class);
+
+ /**
+ * mso config path, used for the config files, like download csar files.
+ */
+ private String msoConfigPath;
Metadata serviceMetadata;
private Service catalogService;
@@ -100,6 +109,8 @@ public class ToscaResourceStructure {
private VfModuleCustomization vfModuleCustomization;
private VnfResourceCustomization vnfResourceCustomization;
+
+ private PnfResourceCustomization pnfResourceCustomization;
private AllottedResource allottedResource;
@@ -111,22 +122,21 @@ public class ToscaResourceStructure {
private ToscaCsar toscaCsar;
- protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceStructure.class);
-
-
public ToscaResourceStructure(){
+ this(System.getProperty("mso.config.path"));
}
-
+
+ public ToscaResourceStructure(final String msoConfigPath){
+ this.msoConfigPath = msoConfigPath;
+ logger.info("MSO config path is: {}", msoConfigPath);
+ }
+
public void updateResourceStructure(IArtifactInfo artifact) throws ASDCDownloadException {
-
-
+
try {
-
SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();//Autoclosable
-
- logger.debug("MSO config path is: " + System.getProperty("mso.config.path"));
-
- String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString();
+
+ String filePath = Paths.get(msoConfigPath, "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString();
File spoolFile = new File(filePath);
@@ -137,10 +147,10 @@ public class ToscaResourceStructure {
sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath(),false);
}catch(Exception e){
- logger.info("System out {}", e.getMessage());
+ logger.debug(e.getMessage(), e);
logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC",
- "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ "processResourceNotification", ErrorCode.BusinessProcesssError.getValue(),
"Exception in " + "processResourceNotification", e);
throw new ASDCDownloadException ("Exception caught when passing the csar file to the parser ", e);
@@ -259,6 +269,15 @@ public class ToscaResourceStructure {
this.vnfResourceCustomization = vnfResourceCustomization;
}
+ public PnfResourceCustomization getPnfResourceCustomization() {
+ return pnfResourceCustomization;
+ }
+
+ public void setPnfResourceCustomization(PnfResourceCustomization pnfResourceCustomization) {
+ this.pnfResourceCustomization = pnfResourceCustomization;
+ }
+
+
public VfModuleCustomization getCatalogVfModuleCustomization() {
return vfModuleCustomization;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
index 92fc598e7d..cb4761c557 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
@@ -42,8 +42,7 @@ public final class VfModuleArtifact {
private HeatEnvironment heatEnvironment;
public VfModuleArtifact(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
- artifactInfo=artifactinfo;
- result = new String(clientResult.getArtifactPayload(), "UTF-8");
+ this(artifactinfo, clientResult, null);
}
public VfModuleArtifact(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate) throws UnsupportedEncodingException {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
index 5b24dc56a1..402af160c1 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
@@ -10,9 +10,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,6 +31,7 @@ import java.util.List;
import java.util.Map;
import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.util.ASDCNotificationLogging;
import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
@@ -49,186 +50,156 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * This structure exists to avoid having issues if the order of the vfResource/vfmodule artifact is not good (tree structure).
- *
+ * This structure exists to avoid having issues if the order of the vfResource/vfmodule artifact is not good (tree
+ * structure).
*/
-
-
-public class VfResourceStructure {
-
- protected static final Logger logger = LoggerFactory.getLogger(VfResourceStructure.class);
-
- private boolean isDeployedSuccessfully=false;
- /**
- * The Raw notification data.
- */
- private final INotificationData notification;
- /**
- * The Raw notification data.
- */
- private boolean isAlreadyDeployed=false;
-
- /**
- * The resource we will try to deploy.
- */
- private final IResourceInstance resourceInstance;
-
- /**
- * The list of VfModules defined for this resource.
- */
- private final List<VfModuleStructure> vfModulesStructureList;
-
- /**
- * The list of VfModulesMetadata defined for this resource.
- */
- private List<IVfModuleData> vfModulesMetadataList;
-
- private VnfResource catalogVnfResource;
-
- private NetworkResourceCustomization catalogNetworkResourceCustomization;
-
- private AllottedResourceCustomization catalogResourceCustomization;
-
- private Service catalogService;
-
- /**
- * The list of artifacts existing in this resource hashed by UUID.
- */
- private final Map<String, VfModuleArtifact> artifactsMapByUUID;
-
-
- public VfResourceStructure(INotificationData notificationdata, IResourceInstance resourceinstance) {
- notification=notificationdata;
- resourceInstance=resourceinstance;
- vfModulesStructureList = new LinkedList<>();
- artifactsMapByUUID = new HashMap<>();
- }
-
- public void addArtifactToStructure(IDistributionClient distributionClient,IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
- VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo,clientResult);
- addArtifactByType(artifactinfo,clientResult,vfModuleArtifact);
- }
-
- public void addArtifactToStructure(IDistributionClient distributionClient,IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate) throws UnsupportedEncodingException {
- VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo,clientResult,modifiedHeatTemplate);
- addArtifactByType(artifactinfo,clientResult,vfModuleArtifact);
- }
-
- protected void addArtifactByType(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult, VfModuleArtifact vfModuleArtifact) throws UnsupportedEncodingException {
-
- switch(artifactinfo.getArtifactType()) {
- case ASDCConfiguration.HEAT:
- case ASDCConfiguration.HEAT_ENV:
- case ASDCConfiguration.HEAT_VOL:
- case ASDCConfiguration.HEAT_NESTED: // For 1607 only 1 level tree is supported
- case ASDCConfiguration.HEAT_ARTIFACT:
- case ASDCConfiguration.HEAT_NET:
- case ASDCConfiguration.OTHER:
- artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact);
- break;
- case ASDCConfiguration.VF_MODULES_METADATA:
- vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload());
- break;
- default:
- break;
- }
- }
-
- public void createVfModuleStructures() throws ArtifactInstallerException {
-
- //for vender tosca VNF there is no VFModule in VF
- if (vfModulesMetadataList == null) {
- logger.info("{} {} {} {}", MessageEnum.ASDC_GENERAL_INFO.toString(), "There is no VF mudules in the VF.", "ASDC",
- "createVfModuleStructures");
- return;
- }
- for (IVfModuleData vfModuleMeta:vfModulesMetadataList) {
- vfModulesStructureList.add(new VfModuleStructure(this,vfModuleMeta));
- }
- }
-
- public INotificationData getNotification() {
- return notification;
- }
-
- public IResourceInstance getResourceInstance() {
- return resourceInstance;
- }
-
- public List<VfModuleStructure> getVfModuleStructure() {
- return vfModulesStructureList;
- }
-
- public boolean isDeployedSuccessfully() {
- return isDeployedSuccessfully;
- }
-
- public void setSuccessfulDeployment() {
- isDeployedSuccessfully = true;
- }
-
- public boolean isAlreadyDeployed() {
- return isAlreadyDeployed;
- }
-
- public void setAlreadyDeployed(boolean isAlreadyDeployed) {
- this.isAlreadyDeployed = isAlreadyDeployed;
- }
-
- public Map<String, VfModuleArtifact> getArtifactsMapByUUID() {
- return artifactsMapByUUID;
- }
-
- public List<VfModuleStructure> getVfModulesStructureList() {
- return vfModulesStructureList;
- }
-
- public VnfResource getCatalogVnfResource() {
- return catalogVnfResource;
- }
-
- public void setCatalogVnfResource(VnfResource catalogVnfResource) {
- this.catalogVnfResource = catalogVnfResource;
- }
-
- // Network Only
- public NetworkResourceCustomization getCatalogNetworkResourceCustomization() {
- return catalogNetworkResourceCustomization;
- }
- // Network Only
- public void setCatalogNetworkResourceCustomization(NetworkResourceCustomization catalogNetworkResourceCustomization) {
- this.catalogNetworkResourceCustomization = catalogNetworkResourceCustomization;
- }
-
- public AllottedResourceCustomization getCatalogResourceCustomization() {
- return catalogResourceCustomization;
- }
-
- public void setCatalogResourceCustomization(
- AllottedResourceCustomization catalogResourceCustomization) {
- this.catalogResourceCustomization = catalogResourceCustomization;
- }
-
- public Service getCatalogService() {
- return catalogService;
- }
-
- public void setCatalogService(Service catalogService) {
- this.catalogService = catalogService;
- }
-
- public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) {
- try {
- List<IVfModuleData> listVFModuleMetaData = new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>(){});
- return listVFModuleMetaData;
-
- } catch (JsonParseException e) {
- logger.debug("JsonParseException : ",e);
- } catch (JsonMappingException e) {
- logger.debug("JsonMappingException : ",e);
- } catch (IOException e) {
- logger.debug("IOException : ",e);
- }
- return null;
- }
+public class VfResourceStructure extends ResourceStructure {
+
+ protected static final Logger logger = LoggerFactory.getLogger(VfResourceStructure.class);
+
+ /**
+ * The list of VfModules defined for this resource.
+ */
+ private final List<VfModuleStructure> vfModulesStructureList;
+
+ /**
+ * The list of VfModulesMetadata defined for this resource.
+ */
+ private List<IVfModuleData> vfModulesMetadataList;
+
+ private VnfResource catalogVnfResource;
+
+ private NetworkResourceCustomization catalogNetworkResourceCustomization;
+
+ private AllottedResourceCustomization catalogResourceCustomization;
+
+ private Service catalogService;
+
+
+ public VfResourceStructure(INotificationData notificationdata, IResourceInstance resourceinstance) {
+ super(notificationdata, resourceinstance);
+ this.resourceType = ResourceType.VF_RESOURCE;
+ vfModulesStructureList = new LinkedList<>();
+ }
+
+ public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
+ IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
+ this.addArtifactToStructure(distributionClient, artifactinfo, clientResult, null);
+ }
+
+ public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
+ IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate)
+ throws UnsupportedEncodingException {
+ VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo, clientResult, modifiedHeatTemplate);
+ addArtifactByType(artifactinfo, clientResult, vfModuleArtifact);
+ if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifactinfo.getArtifactType())) {
+ logger.debug("VF_MODULE_ARTIFACT: " + new String(clientResult.getArtifactPayload(), "UTF-8"));
+ logger.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(vfModulesMetadataList));
+ }
+ }
+
+ protected void addArtifactByType(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult,
+ VfModuleArtifact vfModuleArtifact) throws UnsupportedEncodingException {
+
+ switch (artifactinfo.getArtifactType()) {
+ case ASDCConfiguration.HEAT:
+ case ASDCConfiguration.HEAT_ENV:
+ case ASDCConfiguration.HEAT_VOL:
+ case ASDCConfiguration.HEAT_NESTED: // For 1607 only 1 level tree is supported
+ case ASDCConfiguration.HEAT_ARTIFACT:
+ case ASDCConfiguration.HEAT_NET:
+ case ASDCConfiguration.OTHER:
+ artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact);
+ break;
+ case ASDCConfiguration.VF_MODULES_METADATA:
+ vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload());
+ break;
+ default:
+ break;
+ }
+ }
+
+ public void prepareInstall() throws ArtifactInstallerException{
+ createVfModuleStructures();
+ }
+
+ public void createVfModuleStructures() throws ArtifactInstallerException {
+
+ //for vender tosca VNF there is no VFModule in VF
+ if (vfModulesMetadataList == null) {
+ logger.info("{} {} {} {}", MessageEnum.ASDC_GENERAL_INFO.toString(), "There is no VF mudules in the VF.",
+ "ASDC",
+ "createVfModuleStructures");
+ return;
+ }
+ for (IVfModuleData vfModuleMeta : vfModulesMetadataList) {
+ vfModulesStructureList.add(new VfModuleStructure(this, vfModuleMeta));
+ }
+ setNumberOfResources(vfModulesMetadataList.size());
+ }
+
+ public List<VfModuleStructure> getVfModuleStructure() {
+ return vfModulesStructureList;
+ }
+
+ public Map<String, VfModuleArtifact> getArtifactsMapByUUID() {
+ return artifactsMapByUUID;
+ }
+
+ public List<VfModuleStructure> getVfModulesStructureList() {
+ return vfModulesStructureList;
+ }
+
+ public VnfResource getCatalogVnfResource() {
+ return catalogVnfResource;
+ }
+
+ public void setCatalogVnfResource(VnfResource catalogVnfResource) {
+ this.catalogVnfResource = catalogVnfResource;
+ }
+
+ // Network Only
+ public NetworkResourceCustomization getCatalogNetworkResourceCustomization() {
+ return catalogNetworkResourceCustomization;
+ }
+
+ // Network Only
+ public void setCatalogNetworkResourceCustomization(
+ NetworkResourceCustomization catalogNetworkResourceCustomization) {
+ this.catalogNetworkResourceCustomization = catalogNetworkResourceCustomization;
+ }
+
+ public AllottedResourceCustomization getCatalogResourceCustomization() {
+ return catalogResourceCustomization;
+ }
+
+ public void setCatalogResourceCustomization(
+ AllottedResourceCustomization catalogResourceCustomization) {
+ this.catalogResourceCustomization = catalogResourceCustomization;
+ }
+
+ public Service getCatalogService() {
+ return catalogService;
+ }
+
+ public void setCatalogService(Service catalogService) {
+ this.catalogService = catalogService;
+ }
+
+ public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) {
+ try {
+ List<IVfModuleData> listVFModuleMetaData = new ObjectMapper()
+ .readValue(arg0, new TypeReference<List<VfModuleMetaData>>() {
+ });
+ return listVFModuleMetaData;
+
+ } catch (JsonParseException e) {
+ logger.debug("JsonParseException : ", e);
+ } catch (JsonMappingException e) {
+ logger.debug("JsonMappingException : ", e);
+ } catch (IOException e) {
+ logger.debug("IOException : ", e);
+ }
+ return null;
+ }
}
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 7e3f5dfef6..8daa708ee7 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
@@ -45,8 +45,8 @@ import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.HttpClientBuilder;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -84,7 +84,7 @@ public class BpmnInstaller {
logger.debug("Failed deploying BPMN {}", name);
logger
.error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, fileName,
- Integer.toString(response.getStatusLine().getStatusCode()), MsoLogger.ErrorCode.DataError.getValue(),
+ Integer.toString(response.getStatusLine().getStatusCode()), ErrorCode.DataError.getValue(),
"ASDC BPMN deploy failed");
}
else {
@@ -95,7 +95,7 @@ public class BpmnInstaller {
logger.debug("Exception :", e);
logger
.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, e.getMessage(),
- MsoLogger.ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
+ ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
}
}
entry = csarFile.getNextEntry();
@@ -104,7 +104,7 @@ public class BpmnInstaller {
} catch (IOException ex) {
logger.debug("Exception :", ex);
logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,
- ex.getMessage(), MsoLogger.ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed");
+ ex.getMessage(), ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed");
}
return;
}
@@ -123,7 +123,7 @@ public class BpmnInstaller {
} catch (Exception e) {
logger.debug("Exception :", e);
logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath, e.getMessage(),
- MsoLogger.ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
+ ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
}
return workflowsInCsar;
}
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 6d9e2fbb0c..db639dad0a 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
@@ -10,9 +10,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,6 +24,8 @@
package org.onap.so.asdc.installer.heat;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
@@ -35,13 +37,15 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.LockAcquisitionException;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.IResourceInstance;
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.TopologyTemplateQuery;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
import org.onap.sdc.toscaparser.api.CapabilityAssignment;
@@ -62,6 +66,8 @@ import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.installer.ASDCElementInfo;
import org.onap.so.asdc.installer.BigDecimalVersion;
import org.onap.so.asdc.installer.IVfModuleData;
+import org.onap.so.asdc.installer.PnfResourceStructure;
+import org.onap.so.asdc.installer.ResourceStructure;
import org.onap.so.asdc.installer.ToscaResourceStructure;
import org.onap.so.asdc.installer.VfModuleArtifact;
import org.onap.so.asdc.installer.VfModuleStructure;
@@ -84,6 +90,8 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkInstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.SubType;
@@ -109,6 +117,8 @@ import org.onap.so.db.catalog.data.repository.HeatTemplateRepository;
import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
+import org.onap.so.db.catalog.data.repository.PnfCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.PnfResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository;
@@ -124,8 +134,8 @@ import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -133,2018 +143,2323 @@ import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
@Component
public class ToscaResourceInstaller {
- protected static final String NODES_VRF_ENTRY = "org.openecomp.nodes.VRFEntry";
-
- protected static final String VLAN_NETWORK_RECEPTOR = "org.openecomp.nodes.VLANNetworkReceptor";
-
- protected static final String ALLOTTED_RESOURCE = "Allotted Resource";
-
- protected static final String MULTI_STAGE_DESIGN = "multi_stage_design";
-
- protected static final String SCALABLE = "scalable";
-
- protected static final String BASIC = "BASIC";
-
- protected static final String PROVIDER = "PROVIDER";
-
- protected static final String HEAT = "HEAT";
-
- protected static final String MANUAL_RECORD = "MANUAL_RECORD";
-
- protected static final String MSO = "SO";
-
-
- @Autowired
- protected ServiceRepository serviceRepo;
-
- @Autowired
- protected InstanceGroupRepository instanceGroupRepo;
-
- @Autowired
- protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo;
-
- @Autowired
- protected CollectionResourceRepository collectionRepo;
-
- @Autowired
- protected CollectionResourceCustomizationRepository collectionCustomizationRepo;
-
- @Autowired
- protected ConfigurationResourceCustomizationRepository configCustomizationRepo;
-
- @Autowired
- protected ConfigurationResourceRepository configRepo;
-
- @Autowired
- protected VnfResourceRepository vnfRepo;
-
- @Autowired
- protected VnfCustomizationRepository vnfCustomizationRepo;
-
- @Autowired
- protected VFModuleRepository vfModuleRepo;
-
- @Autowired
- protected VFModuleCustomizationRepository vfModuleCustomizationRepo;
-
- @Autowired
- protected VnfcInstanceGroupCustomizationRepository vnfcInstanceGroupCustomizationRepo;
-
- @Autowired
- protected VnfcCustomizationRepository vnfcCustomizationRepo;
-
- @Autowired
- protected CvnfcCustomizationRepository cvnfcCustomizationRepo;
-
- @Autowired
- protected AllottedResourceRepository allottedRepo;
-
- @Autowired
- protected AllottedResourceCustomizationRepository allottedCustomizationRepo;
-
- @Autowired
- protected NetworkResourceRepository networkRepo;
-
- @Autowired
- protected HeatTemplateRepository heatRepo;
-
- @Autowired
- protected NetworkResourceCustomizationRepository networkCustomizationRepo;
-
- @Autowired
- protected WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository;
- @Autowired
- protected WatchdogDistributionStatusRepository watchdogDistributionStatusRepository;
- @Autowired
- protected WatchdogServiceModVerIdLookupRepository watchdogModVerIdLookupRepository;
-
- @Autowired
- protected TempNetworkHeatTemplateRepository tempNetworkLookupRepo;
-
- @Autowired
- protected ExternalServiceToInternalServiceRepository externalServiceToInternalServiceRepository;
-
- protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceInstaller.class);
-
- public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException {
- boolean status = false;
- VfResourceStructure vfResourceStructure = vfResourceStruct;
- try {
- status = vfResourceStructure.isDeployedSuccessfully();
- } catch (RuntimeException e) {
- status = false;
- }
- try {
- Service existingService = serviceRepo.findOneByModelUUID(vfResourceStructure.getNotification().getServiceUUID());
- if(existingService != null)
- status = true;
- if (status) {
- logger.info(vfResourceStructure.getResourceInstance().getResourceInstanceName(),
- vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
- vfResourceStructure.getNotification().getServiceName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()),
- vfResourceStructure.getNotification().getServiceUUID(),
- vfResourceStructure.getResourceInstance().getResourceName(), "", "");
- WatchdogComponentDistributionStatus wdStatus = new WatchdogComponentDistributionStatus(vfResourceStruct.getNotification().getDistributionID(), MSO);
- wdStatus.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
- watchdogCDStatusRepository.saveAndFlush(wdStatus);
- } else {
- logger.info(vfResourceStructure.getResourceInstance().getResourceInstanceName(),
- vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
- vfResourceStructure.getNotification().getServiceName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- vfResourceStructure.getNotification().getServiceVersion()),
- vfResourceStructure.getNotification().getServiceUUID(),
- vfResourceStructure.getResourceInstance().getResourceName(), "", "");
- }
- return status;
- } catch (Exception e) {
- logger
- .error("{} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), MsoLogger.ErrorCode.SchemaError.getValue(),
- "Exception - isResourceAlreadyDeployed");
- throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e);
- }
- }
-
- public void installTheComponentStatus(IStatusData iStatus) throws ArtifactInstallerException {
- logger.debug("Entering installTheComponentStatus for distributionId {} and ComponentName {}",
- iStatus.getDistributionID(), iStatus.getComponentName());
-
- try {
- WatchdogComponentDistributionStatus cdStatus = new WatchdogComponentDistributionStatus(iStatus.getDistributionID(),
- iStatus.getComponentName());
- cdStatus.setComponentDistributionStatus(iStatus.getStatus().toString());
- watchdogCDStatusRepository.save(cdStatus);
-
- } catch (Exception e) {
- logger.debug("Exception caught in installTheComponentStatus {}", e.getMessage());
- throw new ArtifactInstallerException("Exception caught in installTheComponentStatus " + e.getMessage());
- }
- }
-
- @Transactional(rollbackFor = { ArtifactInstallerException.class })
- public void installTheResource(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct)
- throws ArtifactInstallerException {
- VfResourceStructure vfResourceStructure = vfResourceStruct;
- extractHeatInformation(toscaResourceStruct, vfResourceStructure);
-
- // PCLO: in case of deployment failure, use a string that will represent
- // the type of artifact that failed...
- List<ASDCElementInfo> artifactListForLogging = new ArrayList<>();
- try {
- createToscaCsar(toscaResourceStruct);
- Service service = createService(toscaResourceStruct, vfResourceStruct);
-
- processResourceSequence(toscaResourceStruct, service);
- processVFResources(toscaResourceStruct, service, vfResourceStructure);
- List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
- processAllottedResources(toscaResourceStruct, service, allottedResourceList);
- processNetworks(toscaResourceStruct, service);
- // process Network Collections
- processNetworkCollections(toscaResourceStruct, service);
- // Process Service Proxy & Configuration
- processServiceProxyAndConfiguration(toscaResourceStruct, service);
-
- serviceRepo.save(service);
-
- WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(vfResourceStruct.getNotification().getDistributionID(), MSO);
- status.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
- watchdogCDStatusRepository.save(status);
-
- toscaResourceStruct.setSuccessfulDeployment();
-
- } catch (Exception e) {
- logger.debug("Exception :", e);
- WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(vfResourceStruct.getNotification().getDistributionID(), MSO);
- status.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_ERROR.name());
- watchdogCDStatusRepository.save(status);
- Throwable dbExceptionToCapture = e;
- while (!(dbExceptionToCapture instanceof ConstraintViolationException
- || dbExceptionToCapture instanceof LockAcquisitionException)
- && (dbExceptionToCapture.getCause() != null)) {
- dbExceptionToCapture = dbExceptionToCapture.getCause();
- }
-
- if (dbExceptionToCapture instanceof ConstraintViolationException
- || dbExceptionToCapture instanceof LockAcquisitionException) {
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
- vfResourceStructure.getResourceInstance().getResourceName(),
- vfResourceStructure.getNotification().getServiceVersion(), MsoLogger.ErrorCode.DataError.getValue(),
- "Exception - ASCDC Artifact already deployed", e);
- } else {
- String elementToLog = (!artifactListForLogging.isEmpty()
- ? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
- : "No element listed");
- logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
- MsoLogger.ErrorCode.DataError.getValue(),
- "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName()
- + ". Transaction rollback", e);
- throw new ArtifactInstallerException("Exception caught during installation of "
- + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
- }
- }
- }
-
-
- List<NodeTemplate> getRequirementList(List<NodeTemplate> resultList, List<NodeTemplate> nodeTemplates,
- ISdcCsarHelper iSdcCsarHelper) {
-
- List<NodeTemplate> nodes = new ArrayList<NodeTemplate>();
- nodes.addAll(nodeTemplates);
-
- for (NodeTemplate nodeTemplate : nodeTemplates) {
- RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate);
- List<RequirementAssignment> reqAs = requirement.getAll();
- for (RequirementAssignment ra : reqAs) {
- String reqNode = ra.getNodeTemplateName();
- for (NodeTemplate rNode : resultList) {
- if (rNode.getName().equals(reqNode)) {
- if(!resultList.contains(nodeTemplate)) {
- resultList.add(nodeTemplate);
- }
- if(nodes.contains(nodeTemplate)) {
- nodes.remove(nodeTemplate);
- }
- break;
- }
- }
- }
- }
-
- if (!nodes.isEmpty()) {
- getRequirementList(resultList, nodes, iSdcCsarHelper);
- }
-
- return resultList;
- }
-
- // This method retrieve resource sequence from csar file
- void processResourceSequence(ToscaResourceStructure toscaResourceStructure, Service service) {
- List<String> resouceSequence = new ArrayList<String>();
- List<NodeTemplate> resultList = new ArrayList<NodeTemplate>();
-
- ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper();
- List<NodeTemplate> nodeTemplates = iSdcCsarHelper.getServiceNodeTemplates();
- List<NodeTemplate> nodes = new ArrayList<NodeTemplate>();
- nodes.addAll(nodeTemplates);
-
- for (NodeTemplate nodeTemplate : nodeTemplates) {
- RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate);
-
- if (requirement == null || requirement.getAll() == null || requirement.getAll().isEmpty()) {
- resultList.add(nodeTemplate);
- nodes.remove(nodeTemplate);
- }
- }
-
- resultList = getRequirementList(resultList, nodes, iSdcCsarHelper);
-
- for (NodeTemplate node : resultList) {
- String templateName = node.getMetaData().getValue("name");
- if (!resouceSequence.contains(templateName)) {
- resouceSequence.add(templateName);
- }
- }
-
- String resourceSeqStr = resouceSequence.stream().collect(Collectors.joining(","));
- service.setResourceOrder(resourceSeqStr);
- logger.debug(" resourceSeq for service uuid(" + service.getModelUUID() + ") : " + resourceSeqStr);
- }
-
- private static String CUSTOMIZATION_UUID = "customizationUUID";
-
- private static String getValue(Object value, List<Input> servInputs) {
- String output = null;
- if(value instanceof Map) {
- // currently this logic handles only one level of nesting.
- return ((LinkedHashMap) value).values().toArray()[0].toString();
- } else if(value instanceof GetInput) {
- String inputName = ((GetInput)value).getInputName();
-
- for(Input input : servInputs) {
- if(input.getName().equals(inputName)) {
- // keep both input name and default value
- // if service input does not supplies value the use default value
- String defaultValue = input.getDefault() != null ? (String) input.getDefault().toString() : "";
- output = inputName + "|" + defaultValue;// return default value
- }
- }
-
- } else {
- output = value != null ? value.toString() : "";
- }
- return output; // return property value
- }
-
- String getResourceInput(ToscaResourceStructure toscaResourceStructure, String resourceCustomizationUuid) throws ArtifactInstallerException {
- Map<String, String> resouceRequest = new HashMap<>();
- ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper();
-
- List<Input> serInput = iSdcCsarHelper.getServiceInputs();
- Optional<NodeTemplate> nodeTemplateOpt = iSdcCsarHelper.getServiceNodeTemplates().stream()
- .filter(e -> e.getMetaData().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)).findFirst();
- if(nodeTemplateOpt.isPresent()) {
- NodeTemplate nodeTemplate = nodeTemplateOpt.get();
- LinkedHashMap<String, Property> resourceProperties = nodeTemplate.getProperties();
-
- for(String key : resourceProperties.keySet()) {
- Property property = resourceProperties.get(key);
-
- String value = getValue(property.getValue(), serInput);
- resouceRequest.put(key, value);
- }
- }
-
- try {
- ObjectMapper objectMapper = new ObjectMapper();
- String jsonStr = objectMapper.writeValueAsString(resouceRequest);
-
- jsonStr = jsonStr.replace("\"", "\\\"");
- logger.debug("resource request for resource customization id (" + resourceCustomizationUuid + ") : " + jsonStr);
- return jsonStr;
- } catch (JsonProcessingException e) {
- logger.error("resource input could not be deserialized for resource customization id ("
- + resourceCustomizationUuid + ")");
- throw new ArtifactInstallerException("resource input could not be parsed", e);
- }
- }
-
- protected void processNetworks (ToscaResourceStructure toscaResourceStruct,
- Service service) throws ArtifactInstallerException {
- List <NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper ().getServiceVlList ();
-
- if (nodeTemplatesVLList != null) {
- for (NodeTemplate vlNode : nodeTemplatesVLList) {
- String networkResourceModelName = vlNode.getMetaData ().getValue (SdcPropertyNames.PROPERTY_NAME_NAME);
+ protected static final String NODES_VRF_ENTRY = "org.openecomp.nodes.VRFEntry";
+
+ protected static final String VLAN_NETWORK_RECEPTOR = "org.openecomp.nodes.VLANNetworkReceptor";
+
+ protected static final String ALLOTTED_RESOURCE = "Allotted Resource";
+
+ protected static final String MULTI_STAGE_DESIGN = "multi_stage_design";
+
+ protected static final String SCALABLE = "scalable";
+
+ protected static final String BASIC = "BASIC";
+
+ protected static final String PROVIDER = "PROVIDER";
+
+ protected static final String HEAT = "HEAT";
+
+ protected static final String MANUAL_RECORD = "MANUAL_RECORD";
+
+ protected static final String MSO = "SO";
+
+ protected static final String SDNC_MODEL_NAME = "sdnc_model_name";
+
+ protected static final String SDNC_MODEL_VERSION = "sdnc_model_version";
+
+ private static String CUSTOMIZATION_UUID = "customizationUUID";
+
+
+ @Autowired
+ protected ServiceRepository serviceRepo;
+
+ @Autowired
+ protected InstanceGroupRepository instanceGroupRepo;
+
+ @Autowired
+ protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo;
+
+ @Autowired
+ protected CollectionResourceRepository collectionRepo;
+
+ @Autowired
+ protected CollectionResourceCustomizationRepository collectionCustomizationRepo;
+
+ @Autowired
+ protected ConfigurationResourceCustomizationRepository configCustomizationRepo;
+
+ @Autowired
+ protected ConfigurationResourceRepository configRepo;
+
+ @Autowired
+ protected VnfResourceRepository vnfRepo;
+
+ @Autowired
+ protected VnfCustomizationRepository vnfCustomizationRepo;
+
+ @Autowired
+ protected VFModuleRepository vfModuleRepo;
+
+ @Autowired
+ protected VFModuleCustomizationRepository vfModuleCustomizationRepo;
+
+ @Autowired
+ protected VnfcInstanceGroupCustomizationRepository vnfcInstanceGroupCustomizationRepo;
+
+ @Autowired
+ protected VnfcCustomizationRepository vnfcCustomizationRepo;
+
+ @Autowired
+ protected CvnfcCustomizationRepository cvnfcCustomizationRepo;
+
+ @Autowired
+ protected AllottedResourceRepository allottedRepo;
+
+ @Autowired
+ protected AllottedResourceCustomizationRepository allottedCustomizationRepo;
+
+ @Autowired
+ protected NetworkResourceRepository networkRepo;
+
+ @Autowired
+ protected HeatTemplateRepository heatRepo;
+
+ @Autowired
+ protected NetworkResourceCustomizationRepository networkCustomizationRepo;
+
+ @Autowired
+ protected WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository;
+ @Autowired
+ protected WatchdogDistributionStatusRepository watchdogDistributionStatusRepository;
+ @Autowired
+ protected WatchdogServiceModVerIdLookupRepository watchdogModVerIdLookupRepository;
+
+ @Autowired
+ protected TempNetworkHeatTemplateRepository tempNetworkLookupRepo;
+
+ @Autowired
+ protected ExternalServiceToInternalServiceRepository externalServiceToInternalServiceRepository;
+
+ @Autowired
+ protected PnfResourceRepository pnfResourceRepository;
+
+ @Autowired
+ protected PnfCustomizationRepository pnfCustomizationRepository;
+
+ protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceInstaller.class);
+
+ public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException {
+ boolean status = false;
+ VfResourceStructure vfResourceStructure = vfResourceStruct;
+ try {
+ status = vfResourceStructure.isDeployedSuccessfully();
+ } catch (RuntimeException e) {
+ status = false;
+ }
+ try {
+ Service existingService = serviceRepo
+ .findOneByModelUUID(vfResourceStructure.getNotification().getServiceUUID());
+ if (existingService != null) {
+ status = true;
+ }
+ if (status) {
+ logger.info(vfResourceStructure.getResourceInstance().getResourceInstanceName(),
+ vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
+ vfResourceStructure.getNotification().getServiceName(),
+ BigDecimalVersion.castAndCheckNotificationVersionToString(
+ vfResourceStructure.getNotification().getServiceVersion()),
+ vfResourceStructure.getNotification().getServiceUUID(),
+ vfResourceStructure.getResourceInstance().getResourceName(), "", "");
+ WatchdogComponentDistributionStatus wdStatus = new WatchdogComponentDistributionStatus(
+ vfResourceStruct.getNotification().getDistributionID(), MSO);
+ wdStatus.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
+ watchdogCDStatusRepository.saveAndFlush(wdStatus);
+ } else {
+ logger.info(vfResourceStructure.getResourceInstance().getResourceInstanceName(),
+ vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(),
+ vfResourceStructure.getNotification().getServiceName(),
+ BigDecimalVersion.castAndCheckNotificationVersionToString(
+ vfResourceStructure.getNotification().getServiceVersion()),
+ vfResourceStructure.getNotification().getServiceUUID(),
+ vfResourceStructure.getResourceInstance().getResourceName(), "", "");
+ }
+ return status;
+ } catch (Exception e) {
+ logger
+ .error("{} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(),
+ ErrorCode.SchemaError.getValue(),
+ "Exception - isResourceAlreadyDeployed");
+ throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e);
+ }
+ }
+
+ public void installTheComponentStatus(IStatusData iStatus) throws ArtifactInstallerException {
+ logger.debug("Entering installTheComponentStatus for distributionId {} and ComponentName {}",
+ iStatus.getDistributionID(), iStatus.getComponentName());
+
+ try {
+ WatchdogComponentDistributionStatus cdStatus = new WatchdogComponentDistributionStatus(
+ iStatus.getDistributionID(),
+ iStatus.getComponentName());
+ cdStatus.setComponentDistributionStatus(iStatus.getStatus().toString());
+ watchdogCDStatusRepository.save(cdStatus);
+
+ } catch (Exception e) {
+ logger.debug("Exception caught in installTheComponentStatus {}", e.getMessage());
+ throw new ArtifactInstallerException("Exception caught in installTheComponentStatus " + e.getMessage());
+ }
+ }
+
+ @Transactional(rollbackFor = {ArtifactInstallerException.class})
+ public void installTheResource(ToscaResourceStructure toscaResourceStruct, ResourceStructure resourceStruct)
+ throws ArtifactInstallerException {
+ if (resourceStruct instanceof VfResourceStructure) {
+ installTheVfResouce(toscaResourceStruct, (VfResourceStructure) resourceStruct);
+ } else if (resourceStruct instanceof PnfResourceStructure) {
+ installPnfResource(toscaResourceStruct, (PnfResourceStructure) resourceStruct);
+ } else {
+ logger.warn("Unrecognized resource type");
+ }
+ }
+
+ private void installPnfResource(ToscaResourceStructure toscaResourceStruct, PnfResourceStructure resourceStruct)
+ throws ArtifactInstallerException {
+
+ // PCLO: in case of deployment failure, use a string that will represent
+ // the type of artifact that failed...
+ List<ASDCElementInfo> artifactListForLogging = new ArrayList<>();
+ try {
+ createToscaCsar(toscaResourceStruct);
+ Service service = createService(toscaResourceStruct, resourceStruct);
+
+ processResourceSequence(toscaResourceStruct, service);
+ processPnfResources(toscaResourceStruct, service, resourceStruct);
+ serviceRepo.save(service);
+
+ WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(
+ resourceStruct.getNotification().getDistributionID(), MSO);
+ status.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
+ watchdogCDStatusRepository.save(status);
+
+ toscaResourceStruct.setSuccessfulDeployment();
+
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(
+ resourceStruct.getNotification().getDistributionID(), MSO);
+ status.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_ERROR.name());
+ watchdogCDStatusRepository.save(status);
+ Throwable dbExceptionToCapture = e;
+ while (!(dbExceptionToCapture instanceof ConstraintViolationException
+ || dbExceptionToCapture instanceof LockAcquisitionException)
+ && (dbExceptionToCapture.getCause() != null)) {
+ dbExceptionToCapture = dbExceptionToCapture.getCause();
+ }
+
+ if (dbExceptionToCapture instanceof ConstraintViolationException
+ || dbExceptionToCapture instanceof LockAcquisitionException) {
+ logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
+ resourceStruct.getResourceInstance().getResourceName(),
+ resourceStruct.getNotification().getServiceVersion(), ErrorCode.DataError.getValue(),
+ "Exception - ASCDC Artifact already deployed", e);
+ } else {
+ String elementToLog = (!artifactListForLogging.isEmpty()
+ ? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
+ : "No element listed");
+ logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
+ ErrorCode.DataError.getValue(),
+ "Exception caught during installation of " + resourceStruct.getResourceInstance()
+ .getResourceName()
+ + ". Transaction rollback", e);
+ throw new ArtifactInstallerException("Exception caught during installation of "
+ + resourceStruct.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
+ }
+ }
+ }
+
+ private void installTheVfResouce(ToscaResourceStructure toscaResourceStruct, VfResourceStructure resourceStruct)
+ throws ArtifactInstallerException {
+ VfResourceStructure vfResourceStructure = resourceStruct;
+ extractHeatInformation(toscaResourceStruct, vfResourceStructure);
+
+ // PCLO: in case of deployment failure, use a string that will represent
+ // the type of artifact that failed...
+ List<ASDCElementInfo> artifactListForLogging = new ArrayList<>();
+ try {
+ createToscaCsar(toscaResourceStruct);
+ Service service = createService(toscaResourceStruct, resourceStruct);
+
+ processResourceSequence(toscaResourceStruct, service);
+ processVFResources(toscaResourceStruct, service, vfResourceStructure);
+ List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources();
+ processAllottedResources(toscaResourceStruct, service, allottedResourceList);
+ processNetworks(toscaResourceStruct, service);
+ // process Network Collections
+ processNetworkCollections(toscaResourceStruct, service);
+ // Process Service Proxy & Configuration
+ processServiceProxyAndConfiguration(toscaResourceStruct, service);
+
+ serviceRepo.save(service);
+
+ WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(
+ resourceStruct.getNotification().getDistributionID(), MSO);
+ status.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
+ watchdogCDStatusRepository.save(status);
+
+ toscaResourceStruct.setSuccessfulDeployment();
+
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ WatchdogComponentDistributionStatus status = new WatchdogComponentDistributionStatus(
+ resourceStruct.getNotification().getDistributionID(), MSO);
+ status.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_ERROR.name());
+ watchdogCDStatusRepository.save(status);
+ Throwable dbExceptionToCapture = e;
+ while (!(dbExceptionToCapture instanceof ConstraintViolationException
+ || dbExceptionToCapture instanceof LockAcquisitionException)
+ && (dbExceptionToCapture.getCause() != null)) {
+ dbExceptionToCapture = dbExceptionToCapture.getCause();
+ }
+
+ if (dbExceptionToCapture instanceof ConstraintViolationException
+ || dbExceptionToCapture instanceof LockAcquisitionException) {
+ logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
+ vfResourceStructure.getResourceInstance().getResourceName(),
+ vfResourceStructure.getNotification().getServiceVersion(), ErrorCode.DataError.getValue(),
+ "Exception - ASCDC Artifact already deployed", e);
+ } else {
+ String elementToLog = (!artifactListForLogging.isEmpty()
+ ? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
+ : "No element listed");
+ logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
+ ErrorCode.DataError.getValue(),
+ "Exception caught during installation of " + vfResourceStructure.getResourceInstance()
+ .getResourceName()
+ + ". Transaction rollback", e);
+ throw new ArtifactInstallerException("Exception caught during installation of "
+ + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
+ }
+ }
+ }
+
+
+ List<NodeTemplate> getRequirementList(List<NodeTemplate> resultList, List<NodeTemplate> nodeTemplates,
+ ISdcCsarHelper iSdcCsarHelper) {
+
+ List<NodeTemplate> nodes = new ArrayList<NodeTemplate>();
+ nodes.addAll(nodeTemplates);
+
+ for (NodeTemplate nodeTemplate : nodeTemplates) {
+ RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate);
+ List<RequirementAssignment> reqAs = requirement.getAll();
+ for (RequirementAssignment ra : reqAs) {
+ String reqNode = ra.getNodeTemplateName();
+ for (NodeTemplate rNode : resultList) {
+ if (rNode.getName().equals(reqNode)) {
+ if (!resultList.contains(nodeTemplate)) {
+ resultList.add(nodeTemplate);
+ }
+ if (nodes.contains(nodeTemplate)) {
+ nodes.remove(nodeTemplate);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ if (!nodes.isEmpty()) {
+ getRequirementList(resultList, nodes, iSdcCsarHelper);
+ }
+
+ return resultList;
+ }
+
+ // This method retrieve resource sequence from csar file
+ void processResourceSequence(ToscaResourceStructure toscaResourceStructure, Service service) {
+ List<String> resouceSequence = new ArrayList<String>();
+ List<NodeTemplate> resultList = new ArrayList<NodeTemplate>();
+
+ ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper();
+ List<NodeTemplate> nodeTemplates = iSdcCsarHelper.getServiceNodeTemplates();
+ List<NodeTemplate> nodes = new ArrayList<NodeTemplate>();
+ nodes.addAll(nodeTemplates);
+
+ for (NodeTemplate nodeTemplate : nodeTemplates) {
+ RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate);
+
+ if (requirement == null || requirement.getAll() == null || requirement.getAll().isEmpty()) {
+ resultList.add(nodeTemplate);
+ nodes.remove(nodeTemplate);
+ }
+ }
+
+ resultList = getRequirementList(resultList, nodes, iSdcCsarHelper);
+
+ for (NodeTemplate node : resultList) {
+ String templateName = node.getMetaData().getValue("name");
+ if (!resouceSequence.contains(templateName)) {
+ resouceSequence.add(templateName);
+ }
+ }
+
+ String resourceSeqStr = resouceSequence.stream().collect(Collectors.joining(","));
+ service.setResourceOrder(resourceSeqStr);
+ logger.debug(" resourceSeq for service uuid(" + service.getModelUUID() + ") : " + resourceSeqStr);
+ }
+
+ private static String getValue(Object value, List<Input> servInputs) {
+ String output = null;
+ if (value instanceof Map) {
+ // currently this logic handles only one level of nesting.
+ return ((LinkedHashMap) value).values().toArray()[0].toString();
+ } else if (value instanceof GetInput) {
+ String inputName = ((GetInput) value).getInputName();
+
+ for (Input input : servInputs) {
+ if (input.getName().equals(inputName)) {
+ // keep both input name and default value
+ // if service input does not supplies value the use default value
+ String defaultValue = input.getDefault() != null ? (String) input.getDefault().toString() : "";
+ output = inputName + "|" + defaultValue;// return default value
+ }
+ }
+
+ } else {
+ output = value != null ? value.toString() : "";
+ }
+ return output; // return property value
+ }
+
+ String getResourceInput(ToscaResourceStructure toscaResourceStructure, String resourceCustomizationUuid)
+ throws ArtifactInstallerException {
+ Map<String, String> resouceRequest = new HashMap<>();
+ ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper();
+
+ List<Input> serInput = iSdcCsarHelper.getServiceInputs();
+ Optional<NodeTemplate> nodeTemplateOpt = iSdcCsarHelper.getServiceNodeTemplates().stream()
+ .filter(e -> e.getMetaData().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)).findFirst();
+ if (nodeTemplateOpt.isPresent()) {
+ NodeTemplate nodeTemplate = nodeTemplateOpt.get();
+ LinkedHashMap<String, Property> resourceProperties = nodeTemplate.getProperties();
+
+ for (String key : resourceProperties.keySet()) {
+ Property property = resourceProperties.get(key);
+
+ String value = getValue(property.getValue(), serInput);
+ resouceRequest.put(key, value);
+ }
+ }
+
+ try {
+ ObjectMapper objectMapper = new ObjectMapper();
+ String jsonStr = objectMapper.writeValueAsString(resouceRequest);
+
+ jsonStr = jsonStr.replace("\"", "\\\"");
+ logger.debug(
+ "resource request for resource customization id (" + resourceCustomizationUuid + ") : " + jsonStr);
+ return jsonStr;
+ } catch (JsonProcessingException e) {
+ logger.error("resource input could not be deserialized for resource customization id ("
+ + resourceCustomizationUuid + ")");
+ throw new ArtifactInstallerException("resource input could not be parsed", e);
+ }
+ }
+
+ protected void processNetworks(ToscaResourceStructure toscaResourceStruct,
+ Service service) throws ArtifactInstallerException {
+ List<NodeTemplate> nodeTemplatesVLList = toscaResourceStruct.getSdcCsarHelper().getServiceVlList();
+
+ if (nodeTemplatesVLList != null) {
+ for (NodeTemplate vlNode : nodeTemplatesVLList) {
+ String networkResourceModelName = vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
TempNetworkHeatTemplateLookup tempNetworkLookUp =
- tempNetworkLookupRepo.findFirstBynetworkResourceModelName (networkResourceModelName);
+ tempNetworkLookupRepo.findFirstBynetworkResourceModelName(networkResourceModelName);
if (tempNetworkLookUp != null) {
HeatTemplate heatTemplate =
- heatRepo.findByArtifactUuid (tempNetworkLookUp.getHeatTemplateArtifactUuid ());
+ heatRepo.findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid());
if (heatTemplate != null) {
NetworkResourceCustomization networkCustomization =
- createNetwork (vlNode,
- toscaResourceStruct,
- heatTemplate,
- tempNetworkLookUp.getAicVersionMax (),
- tempNetworkLookUp.getAicVersionMin (),
- service);
- service.getNetworkCustomizations ().add (networkCustomization);
+ createNetwork(vlNode,
+ toscaResourceStruct,
+ heatTemplate,
+ tempNetworkLookUp.getAicVersionMax(),
+ tempNetworkLookUp.getAicVersionMin(),
+ service);
+ service.getNetworkCustomizations().add(networkCustomization);
+ } else {
+ throw new ArtifactInstallerException("No HeatTemplate found for artifactUUID: "
+ + tempNetworkLookUp.getHeatTemplateArtifactUuid());
+ }
+ } else {
+ NetworkResourceCustomization networkCustomization = createNetwork(vlNode,
+ toscaResourceStruct,
+ null,
+ null,
+ null,
+ service);
+ service.getNetworkCustomizations().add(networkCustomization);
+ logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for "
+ + networkResourceModelName);
+ }
+
+ }
+ }
+ }
+
+ 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 ConfigurationResource getConfigurationResource(NodeTemplate nodeTemplate) {
+ Metadata metadata = nodeTemplate.getMetaData();
+ ConfigurationResource configResource = new ConfigurationResource();
+ configResource.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ configResource.setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ configResource.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ configResource.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ configResource.setDescription(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ configResource.setToscaNodeType(nodeTemplate.getType());
+ return configResource;
+ }
+
+ protected ConfigurationResourceCustomization getConfigurationResourceCustomization(NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStructure,
+ ServiceProxyResourceCustomization spResourceCustomization) {
+ Metadata metadata = nodeTemplate.getMetaData();
+
+ ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
+
+ ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization();
+
+ Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
+
+ configCustomizationResource
+ .setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ configCustomizationResource.setModelInstanceName(nodeTemplate.getName());
+
+ configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ configCustomizationResource
+ .setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID());
+
+ configCustomizationResource.setConfigurationResource(configResource);
+ configResourceCustomizationSet.add(configCustomizationResource);
+
+ configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
+ return configCustomizationResource;
+ }
+
+
+ protected Optional<ConfigurationResourceCustomization> getVnrNodeTemplate(
+ List<NodeTemplate> configurationNodeTemplatesList,
+ ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization) {
+ Optional<ConfigurationResourceCustomization> configurationResourceCust = Optional.empty();
+ for (NodeTemplate nodeTemplate : configurationNodeTemplatesList) {
+ StatefulEntityType entityType = nodeTemplate.getTypeDefinition();
+ String type = entityType.getType();
+
+ if (VLAN_NETWORK_RECEPTOR.equals(type)) {
+ configurationResourceCust = Optional.of(getConfigurationResourceCustomization(nodeTemplate,
+ toscaResourceStructure, spResourceCustomization));
+ break;
+ }
+ }
+
+ return configurationResourceCust;
+ }
+
+ protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) {
+
+ List<NodeTemplate> serviceProxyResourceList = toscaResourceStruct.getSdcCsarHelper()
+ .getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY);
+
+ List<NodeTemplate> configurationNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper()
+ .getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION);
+
+ List<ServiceProxyResourceCustomization> serviceProxyList = new ArrayList<ServiceProxyResourceCustomization>();
+ List<ConfigurationResourceCustomization> configurationResourceList = new ArrayList<ConfigurationResourceCustomization>();
+
+ ServiceProxyResourceCustomization serviceProxy = null;
+
+ if (serviceProxyResourceList != null) {
+ for (NodeTemplate spNode : serviceProxyResourceList) {
+ serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct);
+ serviceProxyList.add(serviceProxy);
+ Optional<ConfigurationResourceCustomization> vnrResourceCustomization = getVnrNodeTemplate(
+ configurationNodeTemplatesList, toscaResourceStruct, serviceProxy);
+
+ for (NodeTemplate configNode : configurationNodeTemplatesList) {
+
+ List<RequirementAssignment> requirementsList = toscaResourceStruct.getSdcCsarHelper()
+ .getRequirementsOf(configNode).getAll();
+ for (RequirementAssignment requirement : requirementsList) {
+ if (requirement.getNodeTemplateName().equals(spNode.getName())) {
+ ConfigurationResourceCustomization configurationResource = createConfiguration(configNode,
+ toscaResourceStruct, serviceProxy, vnrResourceCustomization);
+
+ Optional<ConfigurationResourceCustomization> matchingObject = configurationResourceList
+ .stream()
+ .filter(configurationResourceCustomization -> configNode.getMetaData()
+ .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)
+ .equals(configurationResource.getModelCustomizationUUID()))
+ .findFirst();
+ if (!matchingObject.isPresent()) {
+ configurationResourceList.add(configurationResource);
+ }
+
+ break;
+ }
+ }
+ }
+
+ }
+ }
+
+ service.setConfigurationCustomizations(configurationResourceList);
+ service.setServiceProxyCustomizations(serviceProxyList);
+ }
+
+ protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) {
+
+ List<NodeTemplate> networkCollectionList = toscaResourceStruct.getSdcCsarHelper()
+ .getServiceNodeTemplateBySdcType(SdcTypes.CR);
+
+ if (networkCollectionList != null) {
+ for (NodeTemplate crNode : networkCollectionList) {
+
+ createNetworkCollection(crNode, toscaResourceStruct, service);
+ collectionRepo.saveAndFlush(toscaResourceStruct.getCatalogCollectionResource());
+
+ List<NetworkInstanceGroup> networkInstanceGroupList = toscaResourceStruct
+ .getCatalogNetworkInstanceGroup();
+ for (NetworkInstanceGroup networkInstanceGroup : networkInstanceGroupList) {
+ instanceGroupRepo.saveAndFlush(networkInstanceGroup);
+ }
+
+ }
+ }
+ service.getCollectionResourceCustomizations()
+ .add(toscaResourceStruct.getCatalogCollectionResourceCustomization());
+ }
+
+
+ protected void processVFResources(ToscaResourceStructure toscaResourceStruct, Service service,
+ VfResourceStructure vfResourceStructure)
+ throws Exception {
+ logger.debug("processVFResources");
+
+ List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
+
+ for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
+ Metadata metadata = nodeTemplate.getMetaData();
+ String vfCustomizationCategory = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ logger.debug("VF Category is : " + vfCustomizationCategory);
+
+ // Do not treat Allotted Resources as VNF resources
+ if (ALLOTTED_RESOURCE.equalsIgnoreCase(vfCustomizationCategory)) {
+ continue;
+ }
+
+ String vfCustomizationUUID = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
+
+ 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);
+
+ if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
+ logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
+ + " matches vfNotificationResource CustomizationUUID");
+
+ processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata,
+ vfCustomizationCategory);
+ } else {
+ logger.debug("Notification VF ResourceCustomizationUUID: "
+ + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match "
+ + "Tosca VF Customization UUID: " + vfCustomizationUUID);
+ }
+ }
+ }
+
+ /**
+ * This is used to process the PNF specific resource, including resource and resource_customization. {@link
+ * IEntityDetails} based API is used to retrieve information. Please check {@link ISdcCsarHelper} for details.
+ */
+ protected void processPnfResources(ToscaResourceStructure toscaResourceStruct, Service service,
+ PnfResourceStructure resourceStructure) throws Exception {
+ logger.info("Processing PNF resource: {}", resourceStructure.getResourceInstance().getResourceUUID());
+
+ ISdcCsarHelper sdcCsarHelper = toscaResourceStruct.getSdcCsarHelper();
+ EntityQuery entityQuery = EntityQuery.newBuilder(SdcTypes.PNF).build();
+ TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build();
+
+ List<IEntityDetails> entityDetailsList = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, false);
+ for (IEntityDetails entityDetails : entityDetailsList) {
+ Metadata metadata = entityDetails.getMetadata();
+ String customizationUUID = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ String modelUuid = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
+ String notifCustomizationUUID = resourceStructure.getResourceInstance().getResourceCustomizationUUID();
+ if (customizationUUID != null && customizationUUID.equals(notifCustomizationUUID)) {
+ logger.info("Resource customization UUID: {} is the same as notified resource customizationUUID: {}",
+ customizationUUID, notifCustomizationUUID);
+
+ if (checkExistingPnfResourceCutomization(customizationUUID)) {
+ logger.info("Resource customization UUID: {} already deployed", customizationUUID);
+ } else {
+ PnfResource pnfResource = findExistingPnfResource(service, modelUuid);
+ if (pnfResource == null) {
+ pnfResource = createPnfResource(entityDetails);
+ }
+ PnfResourceCustomization pnfResourceCustomization = createPnfResourceCustomization(entityDetails,
+ pnfResource);
+ pnfResource.getPnfResourceCustomizations().add(pnfResourceCustomization);
+ toscaResourceStruct.setPnfResourceCustomization(pnfResourceCustomization);
+ service.getPnfCustomizations().add(pnfResourceCustomization);
+ }
+ } else {
+ logger
+ .warn("Resource customization UUID: {} is NOT the same as notified resource customizationUUID: {}",
+ customizationUUID, notifCustomizationUUID);
+ }
+ }
+ }
+
+ private PnfResource findExistingPnfResource(Service service, String modelUuid) {
+ PnfResource pnfResource = null;
+ for (PnfResourceCustomization pnfResourceCustomization : service.getPnfCustomizations()) {
+ if (pnfResourceCustomization.getPnfResources() != null && pnfResourceCustomization.getPnfResources()
+ .getModelUUID().equals(modelUuid)) {
+ pnfResource = pnfResourceCustomization.getPnfResources();
+ }
+ }
+ if (pnfResource == null) {
+ pnfResource = pnfResourceRepository.findById(modelUuid).orElse(pnfResource);
+ }
+ return pnfResource;
+ }
+
+ private boolean checkExistingPnfResourceCutomization(String customizationUUID) {
+ return pnfCustomizationRepository.findById(customizationUUID).isPresent();
+ }
+
+ /**
+ * Construct the {@link PnfResource} from {@link IEntityDetails} object.
+ */
+ private PnfResource createPnfResource(IEntityDetails entity) {
+ PnfResource pnfResource = new PnfResource();
+ Metadata metadata = entity.getMetadata();
+ pnfResource.setModelInvariantUUID(
+ testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ pnfResource.setModelName(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ pnfResource.setModelUUID(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ pnfResource.setModelVersion(
+ testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ pnfResource.setDescription(
+ testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ pnfResource.setCategory(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)));
+ pnfResource.setSubCategory(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
+ pnfResource.setToscaNodeType(entity.getToscaType());
+ return pnfResource;
+ }
+
+ /**
+ * Construct the {@link PnfResourceCustomization} from {@link IEntityDetails} object.
+ */
+ private PnfResourceCustomization createPnfResourceCustomization(IEntityDetails entityDetails,
+ PnfResource pnfResource) {
+
+ PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
+ Metadata metadata = entityDetails.getMetadata();
+ Map<String, Property> properties = entityDetails.getProperties();
+ pnfResourceCustomization
+ .setModelCustomizationUUID(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ pnfResourceCustomization.setModelInstanceName(entityDetails.getName());
+ pnfResourceCustomization
+ .setNfFunction(getStringValue(properties.get(SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)));
+ pnfResourceCustomization.setNfNamingCode(getStringValue(properties.get(SdcPropertyNames.PROPERTY_NAME_NFCODE)));
+ pnfResourceCustomization.setNfRole(getStringValue(properties.get(SdcPropertyNames.PROPERTY_NAME_NFROLE)));
+ pnfResourceCustomization.setNfType(getStringValue(properties.get(SdcPropertyNames.PROPERTY_NAME_NFTYPE)));
+ pnfResourceCustomization.setMultiStageDesign(getStringValue(properties.get(MULTI_STAGE_DESIGN)));
+ pnfResourceCustomization.setBlueprintName(getStringValue(properties.get(SDNC_MODEL_NAME)));
+ pnfResourceCustomization.setBlueprintVersion(getStringValue(properties.get(SDNC_MODEL_VERSION)));
+
+ pnfResourceCustomization.setPnfResources(pnfResource);
+
+ return pnfResourceCustomization;
+ }
+
+ /**
+ * Get value from {@link Property} and cast to String value. Return empty String if property is null value.
+ */
+ private String getStringValue(Property property) {
+ if (null == property) {
+ return "";
+ }
+ Object value = property.getValue();
+ return String.valueOf(value);
+ }
+
+ protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure,
+ Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory)
+ throws Exception {
+
+ logger.debug("VF Category is : " + vfCustomizationCategory);
+
+ VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
+
+ if (vfResourceStructure.getVfModuleStructure() != null && !vfResourceStructure.getVfModuleStructure()
+ .isEmpty()) {
+
+ String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper()
+ .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
+
+ 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);
+
+ if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
+
+ logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
+ + " matches vfNotificationResource CustomizationUUID");
+
+ Set<CvnfcCustomization> existingCvnfcSet = new HashSet<CvnfcCustomization>();
+ Set<VnfcCustomization> existingVnfcSet = new HashSet<VnfcCustomization>();
+
+ for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
+
+ logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
+ List<org.onap.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct
+ .getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
+ IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
+
+ logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : " + vfMetadata
+ .getVfModuleModelCustomizationUUID());
+
+ Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream()
+ .peek(group -> logger.debug(
+ "To Csar Group VFModuleModelCustomizationUUID " + group.getMetadata()
+ .getValue("vfModuleModelCustomizationUUID")))
+ .filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID")
+ .equals(vfMetadata.getVfModuleModelCustomizationUUID()))
+ .findFirst();
+ if (matchingObject.isPresent()) {
+ VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(),
+ nodeTemplate, toscaResourceStruct,
+ vfResourceStructure, vfMetadata, vnfResource, service, existingCvnfcSet, existingVnfcSet);
+ vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources());
+ } else {
+ throw new Exception(
+ "Cannot find matching VFModule Customization in Csar for Vf_Modules_Metadata: " + vfMetadata
+ .getVfModuleModelCustomizationUUID());
+ }
+
+ }
+
+ } else {
+ logger.debug("Notification VF ResourceCustomizationUUID: " + vfNotificationResource
+ .getResourceCustomizationUUID() + " doesn't match " +
+ "Tosca VF Customization UUID: " + vfCustomizationUUID);
+ }
+ }
+
+ service.getVnfCustomizations().add(vnfResource);
+ }
+
+ public void processWatchdog(String distributionId, String servideUUID, Optional<String> distributionNotification,
+ String consumerId) {
+ WatchdogServiceModVerIdLookup modVerIdLookup = new WatchdogServiceModVerIdLookup(distributionId, servideUUID,
+ distributionNotification, consumerId);
+ watchdogModVerIdLookupRepository.saveAndFlush(modVerIdLookup);
+
+ try {
+
+ WatchdogDistributionStatus distributionStatus = new WatchdogDistributionStatus(distributionId);
+ watchdogDistributionStatusRepository.saveAndFlush(distributionStatus);
+
+ } catch (ObjectOptimisticLockingFailureException e) {
+ logger.debug("ObjectOptimisticLockingFailureException in processWatchdog : " + e.toString());
+ throw e;
+ }
+ }
+
+ protected void extractHeatInformation(ToscaResourceStructure toscaResourceStruct,
+ VfResourceStructure vfResourceStructure) {
+ for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
+
+ switch (vfModuleArtifact.getArtifactInfo().getArtifactType()) {
+ case ASDCConfiguration.HEAT:
+ case ASDCConfiguration.HEAT_NESTED:
+ createHeatTemplateFromArtifact(vfResourceStructure, toscaResourceStruct,
+ vfModuleArtifact);
+ break;
+ case ASDCConfiguration.HEAT_VOL:
+ createHeatTemplateFromArtifact(vfResourceStructure, toscaResourceStruct,
+ vfModuleArtifact);
+ VfModuleArtifact envModuleArtifact = getHeatEnvArtifactFromGeneratedArtifact(vfResourceStructure,
+ vfModuleArtifact);
+ createHeatEnvFromArtifact(vfResourceStructure, envModuleArtifact);
+ break;
+ case ASDCConfiguration.HEAT_ENV:
+ createHeatEnvFromArtifact(vfResourceStructure, vfModuleArtifact);
+ break;
+ case ASDCConfiguration.HEAT_ARTIFACT:
+ createHeatFileFromArtifact(vfResourceStructure, vfModuleArtifact,
+ toscaResourceStruct);
+ break;
+ case ASDCConfiguration.HEAT_NET:
+ case ASDCConfiguration.OTHER:
+ logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
+ vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" + vfModuleArtifact
+ .getArtifactInfo()
+ .getArtifactName() + ")", ErrorCode.DataError.getValue(),
+ "Artifact type not supported");
+ break;
+ default:
+ break;
+
+ }
+ }
+ }
+
+ protected VfModuleArtifact getHeatEnvArtifactFromGeneratedArtifact(VfResourceStructure vfResourceStructure,
+ VfModuleArtifact vfModuleArtifact) {
+ String artifactName = vfModuleArtifact.getArtifactInfo().getArtifactName();
+ artifactName = artifactName.substring(0, artifactName.indexOf('.'));
+ for (VfModuleArtifact moduleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
+ if (moduleArtifact.getArtifactInfo().getArtifactName().contains(artifactName)
+ && moduleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ENV)) {
+ return moduleArtifact;
+ }
+ }
+ return null;
+ }
+
+ public String verifyTheFilePrefixInArtifacts(String filebody, VfResourceStructure vfResourceStructure,
+ List<String> listTypes) {
+ String newFileBody = filebody;
+ for (VfModuleArtifact moduleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
+
+ if (listTypes.contains(moduleArtifact.getArtifactInfo().getArtifactType())) {
+
+ newFileBody = verifyTheFilePrefixInString(newFileBody,
+ moduleArtifact.getArtifactInfo().getArtifactName());
+ }
+ }
+ return newFileBody;
+ }
+
+ public String verifyTheFilePrefixInString(final String body, final String filenameToVerify) {
+
+ String needlePrefix = "file:///";
+ String prefixedFilenameToVerify = needlePrefix + filenameToVerify;
+
+ if ((body == null) || (body.length() == 0) || (filenameToVerify == null) || (filenameToVerify.length() == 0)) {
+ return body;
+ }
+
+ StringBuilder sb = new StringBuilder(body.length());
+
+ int currentIndex = 0;
+ int startIndex = 0;
+
+ while (currentIndex != -1) {
+ startIndex = currentIndex;
+ currentIndex = body.indexOf(prefixedFilenameToVerify, startIndex);
+
+ if (currentIndex == -1) {
+ break;
+ }
+ // We append from the startIndex up to currentIndex (start of File
+ // Name)
+ sb.append(body.substring(startIndex, currentIndex));
+ sb.append(filenameToVerify);
+
+ currentIndex += prefixedFilenameToVerify.length();
+ }
+
+ sb.append(body.substring(startIndex));
+
+ return sb.toString();
+ }
+
+ protected void createHeatTemplateFromArtifact(VfResourceStructure vfResourceStructure,
+ ToscaResourceStructure toscaResourceStruct, VfModuleArtifact vfModuleArtifact) {
+ HeatTemplate heatTemplate = new HeatTemplate();
+ List<String> typeList = new ArrayList<>();
+ typeList.add(ASDCConfiguration.HEAT_NESTED);
+ typeList.add(ASDCConfiguration.HEAT_ARTIFACT);
+
+ heatTemplate.setTemplateBody(
+ verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(), vfResourceStructure, typeList));
+ heatTemplate.setTemplateName(vfModuleArtifact.getArtifactInfo().getArtifactName());
+
+ if (vfModuleArtifact.getArtifactInfo().getArtifactTimeout() != null) {
+ heatTemplate.setTimeoutMinutes(vfModuleArtifact.getArtifactInfo().getArtifactTimeout());
+ } else {
+ heatTemplate.setTimeoutMinutes(240);
+ }
+
+ heatTemplate.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
+ heatTemplate.setVersion(BigDecimalVersion
+ .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
+ heatTemplate.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+
+ if (vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null) {
+ heatTemplate.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
+ } else {
+ heatTemplate.setArtifactChecksum(MANUAL_RECORD);
+ }
+
+ Set<HeatTemplateParam> heatParam = extractHeatTemplateParameters(
+ vfModuleArtifact.getResult(), vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+ heatTemplate.setParameters(heatParam);
+ vfModuleArtifact.setHeatTemplate(heatTemplate);
+ }
+
+ protected void createHeatEnvFromArtifact(VfResourceStructure vfResourceStructure,
+ VfModuleArtifact vfModuleArtifact) {
+ HeatEnvironment heatEnvironment = new HeatEnvironment();
+ heatEnvironment.setName(vfModuleArtifact.getArtifactInfo().getArtifactName());
+ List<String> typeList = new ArrayList<>();
+ typeList.add(ASDCConfiguration.HEAT);
+ typeList.add(ASDCConfiguration.HEAT_VOL);
+ heatEnvironment.setEnvironment(
+ verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(), vfResourceStructure, typeList));
+ heatEnvironment.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
+ heatEnvironment.setVersion(BigDecimalVersion
+ .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
+ heatEnvironment.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+
+ if (vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null) {
+ heatEnvironment.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
+ } else {
+ heatEnvironment.setArtifactChecksum(MANUAL_RECORD);
+ }
+ vfModuleArtifact.setHeatEnvironment(heatEnvironment);
+ }
+
+ protected void createHeatFileFromArtifact(VfResourceStructure vfResourceStructure,
+ VfModuleArtifact vfModuleArtifact, ToscaResourceStructure toscaResourceStruct) {
+
+ HeatFiles heatFile = new HeatFiles();
+ heatFile.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+ heatFile.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
+ heatFile.setFileBody(vfModuleArtifact.getResult());
+ heatFile.setFileName(vfModuleArtifact.getArtifactInfo().getArtifactName());
+ heatFile.setVersion(BigDecimalVersion
+ .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
+ toscaResourceStruct.setHeatFilesUUID(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
+ if (vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null) {
+ heatFile.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
+ } else {
+ heatFile.setArtifactChecksum(MANUAL_RECORD);
+ }
+ vfModuleArtifact.setHeatFiles(heatFile);
+ }
+
+ protected Service createService(ToscaResourceStructure toscaResourceStructure,
+ ResourceStructure resourceStructure) {
+
+ Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
+
+ Service service = new Service();
+
+ if (serviceMetadata != null) {
+
+ if (toscaResourceStructure.getServiceVersion() != null) {
+ service.setModelVersion(toscaResourceStructure.getServiceVersion());
+ }
+
+ service.setServiceType(serviceMetadata.getValue("serviceType"));
+ service.setServiceRole(serviceMetadata.getValue("serviceRole"));
+ service.setCategory(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ service.setDescription(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ service.setModelName(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ service.setModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ service.setEnvironmentContext(serviceMetadata.getValue("environmentContext"));
+
+ if (resourceStructure != null) {
+ service.setWorkloadContext(resourceStructure.getNotification().getWorkloadContext());
+ }
+
+ service.setModelInvariantUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ service.setCsar(toscaResourceStructure.getCatalogToscaCsar());
+ }
+
+ toscaResourceStructure.setCatalogService(service);
+ return service;
+ }
+
+ protected ServiceProxyResourceCustomization createServiceProxy(NodeTemplate nodeTemplate, Service service,
+ ToscaResourceStructure toscaResourceStructure) {
+
+ Metadata spMetadata = nodeTemplate.getMetaData();
+
+ ServiceProxyResourceCustomization spCustomizationResource = new ServiceProxyResourceCustomization();
+
+ Set<ServiceProxyResourceCustomization> serviceProxyCustomizationSet = new HashSet<>();
+
+ spCustomizationResource.setModelName(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ spCustomizationResource
+ .setModelInvariantUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ spCustomizationResource.setModelUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ spCustomizationResource.setModelVersion(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ spCustomizationResource.setDescription(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+
+ spCustomizationResource
+ .setModelCustomizationUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ spCustomizationResource.setModelInstanceName(nodeTemplate.getName());
+ spCustomizationResource.setToscaNodeType(nodeTemplate.getType());
+
+ String sourceServiceUUID = spMetadata.getValue("sourceModelUuid");
+
+ Service sourceService = serviceRepo.findOneByModelUUID(sourceServiceUUID);
+
+ spCustomizationResource.setSourceService(sourceService);
+ spCustomizationResource.setToscaNodeType(nodeTemplate.getType());
+ serviceProxyCustomizationSet.add(spCustomizationResource);
+
+ toscaResourceStructure.setCatalogServiceProxyResourceCustomization(spCustomizationResource);
+
+ return spCustomizationResource;
+ }
+
+ protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization,
+ Optional<ConfigurationResourceCustomization> vnrResourceCustomization) {
+
+ ConfigurationResourceCustomization configCustomizationResource = getConfigurationResourceCustomization(
+ nodeTemplate,
+ toscaResourceStructure, spResourceCustomization);
+
+ ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
+
+ Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
+
+ StatefulEntityType entityType = nodeTemplate.getTypeDefinition();
+ String type = entityType.getType();
+
+ if (NODES_VRF_ENTRY.equals(type)) {
+ configCustomizationResource.setConfigResourceCustomization(vnrResourceCustomization.orElse(null));
+ }
+
+ configCustomizationResource.setConfigurationResource(configResource);
+
+ configResourceCustomizationSet.add(configCustomizationResource);
+
+ configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
+
+ toscaResourceStructure.setCatalogConfigurationResource(configResource);
+
+ toscaResourceStructure.setCatalogConfigurationResourceCustomization(configCustomizationResource);
+
+ return configCustomizationResource;
+ }
+
+ protected ConfigurationResource createFabricConfiguration(NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStructure) {
+
+ Metadata fabricMetadata = nodeTemplate.getMetaData();
+
+ ConfigurationResource configResource = new ConfigurationResource();
+
+ configResource.setModelName(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ configResource.setModelInvariantUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ 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());
+
+ return configResource;
+ }
+
+ protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) {
+ ToscaCsar toscaCsar = new ToscaCsar();
+ 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());
+ toscaCsar.setUrl(toscaResourceStructure.getToscaArtifact().getArtifactURL());
+
+ toscaResourceStructure.setCatalogToscaCsar(toscaCsar);
+ }
+
+ protected VnfcCustomization findExistingVfc(Set<VnfcCustomization> vnfcCustomizations, String customizationUUID) {
+ VnfcCustomization vnfcCustomization = null;
+ for (VnfcCustomization vnfcCustom : vnfcCustomizations) {
+ if (vnfcCustom != null && vnfcCustom.getModelCustomizationUUID().equals(customizationUUID)) {
+ vnfcCustomization = vnfcCustom;
+ }
+ }
+
+ if (vnfcCustomization == null) {
+ vnfcCustomization = vnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID);
+ }
+
+ return vnfcCustomization;
+ }
+
+ protected CvnfcCustomization findExistingCvfc(Set<CvnfcCustomization> cvnfcCustomizations,
+ String customizationUUID) {
+ CvnfcCustomization cvnfcCustomization = null;
+ for (CvnfcCustomization cvnfcCustom : cvnfcCustomizations) {
+ if (cvnfcCustom != null && cvnfcCustom.getModelCustomizationUUID().equals(customizationUUID)) {
+ cvnfcCustomization = cvnfcCustom;
+ }
+ }
+
+ if (cvnfcCustomization == null) {
+ cvnfcCustomization = cvnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID);
+ }
+
+ return cvnfcCustomization;
+ }
+
+ protected NetworkResourceCustomization createNetwork(NodeTemplate networkNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin,
+ Service service) {
+
+ NetworkResourceCustomization networkResourceCustomization = networkCustomizationRepo
+ .findOneByModelCustomizationUUID(
+ networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ boolean networkUUIDsMatch = true;
+ // Check to make sure the NetworkResourceUUID on the Customization record matches the NetworkResourceUUID from the distribution.
+ // If not we'll update the Customization record with latest from the distribution
+ if (networkResourceCustomization != null) {
+ String existingNetworkModelUUID = networkResourceCustomization.getNetworkResource().getModelUUID();
+ String latestNetworkModelUUID = networkNodeTemplate.getMetaData()
+ .getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
+
+ if (!existingNetworkModelUUID.equals(latestNetworkModelUUID)) {
+ networkUUIDsMatch = false;
+ }
+
+ }
+
+ if (networkResourceCustomization != null && !networkUUIDsMatch) {
+
+ NetworkResource networkResource = createNetworkResource(networkNodeTemplate, toscaResourceStructure,
+ heatTemplate,
+ aicMax, aicMin);
+
+ networkResourceCustomization.setNetworkResource(networkResource);
+
+ networkCustomizationRepo.saveAndFlush(networkResourceCustomization);
+
+ } else if (networkResourceCustomization == null) {
+ networkResourceCustomization = createNetworkResourceCustomization(networkNodeTemplate,
+ toscaResourceStructure);
+
+ NetworkResource networkResource = findExistingNetworkResource(service,
+ networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ if (networkResource == null) {
+ networkResource = createNetworkResource(networkNodeTemplate, toscaResourceStructure, heatTemplate,
+ aicMax, aicMin);
+ }
+
+ networkResource.addNetworkResourceCustomization(networkResourceCustomization);
+ networkResourceCustomization.setNetworkResource(networkResource);
+ }
+
+ return networkResourceCustomization;
+ }
+
+ protected NetworkResource findExistingNetworkResource(Service service, String modelUUID) {
+ NetworkResource networkResource = null;
+ for (NetworkResourceCustomization networkCustom : service.getNetworkCustomizations()) {
+ if (networkCustom.getNetworkResource() != null
+ && networkCustom.getNetworkResource().getModelUUID().equals(modelUUID)) {
+ networkResource = networkCustom.getNetworkResource();
+ }
+ }
+ if (networkResource == null) {
+ networkResource = networkRepo.findResourceByModelUUID(modelUUID);
+ }
+
+ return networkResource;
+ }
+
+ protected NetworkResourceCustomization createNetworkResourceCustomization(NodeTemplate networkNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure) {
+ NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
+ networkResourceCustomization.setModelInstanceName(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ networkResourceCustomization.setModelCustomizationUUID(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+
+ networkResourceCustomization.setNetworkTechnology(
+ testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)));
+ networkResourceCustomization.setNetworkType(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)));
+ networkResourceCustomization.setNetworkRole(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)));
+ networkResourceCustomization.setNetworkScope(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)));
+ return networkResourceCustomization;
+ }
+
+ protected NetworkResource createNetworkResource(NodeTemplate networkNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin) {
+ NetworkResource networkResource = new NetworkResource();
+ String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
+ networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
+
+ if ("true".equalsIgnoreCase(providerNetwork)) {
+ networkResource.setNeutronNetworkType(PROVIDER);
+ } else {
+ networkResource.setNeutronNetworkType(BASIC);
+ }
+
+ networkResource.setModelName(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+
+ networkResource.setModelInvariantUUID(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ networkResource.setModelUUID(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ networkResource.setModelVersion(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+
+ networkResource.setAicVersionMax(aicMax);
+ networkResource.setAicVersionMin(aicMin);
+ networkResource.setToscaNodeType(networkNodeTemplate.getType());
+ networkResource.setDescription(
+ testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ networkResource.setOrchestrationMode(HEAT);
+ networkResource.setHeatTemplate(heatTemplate);
+ return networkResource;
+ }
+
+ protected CollectionNetworkResourceCustomization createNetworkCollection(NodeTemplate networkNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, Service service) {
+
+ CollectionNetworkResourceCustomization collectionNetworkResourceCustomization = new CollectionNetworkResourceCustomization();
+
+ // **** Build Object to populate Collection_Resource table
+ CollectionResource collectionResource = new CollectionResource();
+
+ 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());
+
+ 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.setModelInstanceName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ ncfc.setModelCustomizationUUID(
+ networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ Set<CollectionNetworkResourceCustomization> networkResourceCustomizationSet = new HashSet<>();
+ networkResourceCustomizationSet.add(collectionNetworkResourceCustomization);
+
+ ncfc.setNetworkResourceCustomization(networkResourceCustomizationSet);
+
+ ncfc.setCollectionResource(collectionResource);
+ toscaResourceStructure.setCatalogCollectionResourceCustomization(ncfc);
+
+ //*** Build object to populate the Instance_Group table
+ List<Group> groupList = toscaResourceStructure.getSdcCsarHelper()
+ .getGroupsOfOriginOfNodeTemplateByToscaGroupType(networkNodeTemplate,
+ "org.openecomp.groups.NetworkCollection");
+
+ List<NetworkInstanceGroup> networkInstanceGroupList = new ArrayList<>();
+
+ List<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationList = new ArrayList<CollectionResourceInstanceGroupCustomization>();
+
+ for (Group group : groupList) {
+
+ NetworkInstanceGroup networkInstanceGroup = new NetworkInstanceGroup();
+ Metadata instanceMetadata = group.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.setRole(SubType.SUB_INTERFACE.toString()); // Set
+ // Role
+ networkInstanceGroup.setType(InstanceGroupType.L3_NETWORK); // Set
+ // type
+ networkInstanceGroup.setCollectionResource(collectionResource);
+
+ // ****Build object to populate
+ // Collection_Resource_Instance_Group_Customization table
+ CollectionResourceInstanceGroupCustomization crInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization();
+ crInstanceGroupCustomization.setInstanceGroup(networkInstanceGroup);
+ crInstanceGroupCustomization.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ crInstanceGroupCustomization.setModelCustomizationUUID(
+ networkNodeTemplate.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");
+
+ if (policyList != null) {
+ for (Policy policy : policyList) {
+ for (String policyNetworkCollection : policy.getTargets()) {
+
+ if (policyNetworkCollection.equalsIgnoreCase(group.getName())) {
+
+ Map<String, Object> propMap = policy.getPolicyProperties();
+
+ if (propMap.get("quantity") != null) {
+
+ String quantity = toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(networkNodeTemplate,
+ getPropertyInput(propMap.get("quantity").toString()));
+
+ if (quantity != null) {
+ crInstanceGroupCustomization
+ .setSubInterfaceNetworkQuantity(Integer.parseInt(quantity));
+ }
+
+ }
+
+ }
+ }
+ }
+ }
+
+ 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"));
+ crInstanceGroupCustomization.setCollectionResourceCust(ncfc);
+ collectionResourceInstanceGroupCustomizationList.add(crInstanceGroupCustomization);
+
+ networkInstanceGroup
+ .setCollectionInstanceGroupCustomizations(collectionResourceInstanceGroupCustomizationList);
+
+ networkInstanceGroupList.add(networkInstanceGroup);
+
+ toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList);
+
+ List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplateBySdcType(networkNodeTemplate, SdcTypes.VL);
+
+ List<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationList = new ArrayList<>();
+
+ //*****Build object to populate the NetworkResource table
+ NetworkResource networkResource = new NetworkResource();
+
+ for (NodeTemplate vlNodeTemplate : vlNodeList) {
+
+ String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
+ vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
+
+ if ("true".equalsIgnoreCase(providerNetwork)) {
+ networkResource.setNeutronNetworkType(PROVIDER);
+ } else {
+ networkResource.setNeutronNetworkType(BASIC);
+ }
+
+ networkResource
+ .setModelName(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+
+ networkResource.setModelInvariantUUID(
+ vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ networkResource
+ .setModelUUID(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ networkResource
+ .setModelVersion(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+
+ networkResource.setAicVersionMax(
+ vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
+
+ TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo
+ .findFirstBynetworkResourceModelName(
+ vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+
+ if (tempNetworkLookUp != null) {
+
+ HeatTemplate heatTemplate = heatRepo
+ .findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid());
+ networkResource.setHeatTemplate(heatTemplate);
+
+ networkResource.setAicVersionMin(tempNetworkLookUp.getAicVersionMin());
+
+ }
+
+ networkResource.setToscaNodeType(vlNodeTemplate.getType());
+ networkResource
+ .setDescription(vlNodeTemplate.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());
+ }
+
+ collectionNetworkResourceCustomization.setModelCustomizationUUID(
+ vlNodeTemplate.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));
+ collectionNetworkResourceCustomization.setInstanceGroup(networkInstanceGroup);
+ collectionNetworkResourceCustomization.setNetworkResource(networkResource);
+ collectionNetworkResourceCustomization.setNetworkResourceCustomization(ncfc);
+
+ collectionNetworkResourceCustomizationList.add(collectionNetworkResourceCustomization);
+ }
+
+ }
+
+ return collectionNetworkResourceCustomization;
+ }
+
+ protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(NodeTemplate vnfcNodeTemplate, Group group,
+ VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure) {
+
+ Metadata instanceMetadata = group.getMetadata();
+ // Populate InstanceGroup
+ VFCInstanceGroup 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.setRole("SUB-INTERFACE"); // Set Role
+ vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type
+
+ //Populate VNFCInstanceGroupCustomization
+ VnfcInstanceGroupCustomization vfcInstanceGroupCustom = new VnfcInstanceGroupCustomization();
+
+ vfcInstanceGroupCustom.setModelCustomizationUUID(vnfResourceCustomization.getModelCustomizationUUID());
+ vfcInstanceGroupCustom.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ 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);
+ }
+ }
+ vfcInstanceGroupCustom.setFunction(
+ toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vnfcNodeTemplate, getInputName));
+
+ vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
+ vfcInstanceGroupCustom.setVnfResourceCust(vnfResourceCustomization);
+
+ return vfcInstanceGroupCustom;
+
+ }
+
+ protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate,
+ ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure,
+ IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service,
+ Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet) {
+
+ VfModuleCustomization vfModuleCustomization = findExistingVfModuleCustomization(vnfResource,
+ vfModuleData.getVfModuleModelCustomizationUUID());
+ if (vfModuleCustomization == null) {
+ VfModule vfModule = findExistingVfModule(vnfResource,
+ vfTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+ Metadata vfMetadata = group.getMetadata();
+ if (vfModule == null) {
+ vfModule = createVfModule(group, toscaResourceStructure, vfModuleData, vfMetadata);
+ }
+
+ vfModuleCustomization = createVfModuleCustomization(group, toscaResourceStructure, vfModule, vfModuleData);
+ setHeatInformationForVfModule(toscaResourceStructure, vfResourceStructure, vfModule, vfModuleCustomization,
+ vfMetadata);
+ vfModuleCustomization.setVfModule(vfModule);
+ vfModule.getVfModuleCustomization().add(vfModuleCustomization);
+ vnfResource.getVfModuleCustomizations().add(vfModuleCustomization);
+ } else {
+ vfResourceStructure.setAlreadyDeployed(true);
+ }
+
+ //******************************************************************************************************************
+ //* Extract VFC's and CVFC's then add them to VFModule
+ //******************************************************************************************************************
+
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
+ Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<CvnfcCustomization>();
+ Set<VnfcCustomization> vnfcCustomizations = new HashSet<VnfcCustomization>();
+
+ // 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();
+ }
+
+ // Extract CVFC lists
+ List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC);
+
+ for (NodeTemplate cvfcTemplate : cvfcList) {
+
+ CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(existingCvnfcSet,
+ cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ if (vfModuleMemberName != null && vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName())) {
+
+ //Extract associated VFC - Should always be just one
+ List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
+
+ for (NodeTemplate vfcTemplate : vfcList) {
+
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ VnfcCustomization existingVnfcCustomization = null;
+
+ existingVnfcCustomization = findExistingVfc(existingVnfcSet,
+ vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ if (existingVnfcCustomization == null) {
+ vnfcCustomization = new VnfcCustomization();
} else {
- throw new ArtifactInstallerException ("No HeatTemplate found for artifactUUID: "
- + tempNetworkLookUp.getHeatTemplateArtifactUuid ());
- }
- } else {
- NetworkResourceCustomization networkCustomization = createNetwork (vlNode,
- toscaResourceStruct,
- null,
- null,
- null,
- service);
- service.getNetworkCustomizations().add (networkCustomization);
- logger.debug ("No NetworkResourceName found in TempNetworkHeatTemplateLookup for "
- + networkResourceModelName);
- }
-
- }
- }
- }
-
- 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 ConfigurationResource getConfigurationResource(NodeTemplate nodeTemplate) {
- Metadata metadata = nodeTemplate.getMetaData();
- ConfigurationResource configResource = new ConfigurationResource();
- configResource.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- configResource.setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- configResource.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- configResource.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- configResource.setDescription(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- configResource.setToscaNodeType(nodeTemplate.getType());
- return configResource;
- }
-
- protected ConfigurationResourceCustomization getConfigurationResourceCustomization(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure,
- ServiceProxyResourceCustomization spResourceCustomization ) {
- Metadata metadata = nodeTemplate.getMetaData();
-
- ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
-
- ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization();
-
- Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
-
- configCustomizationResource.setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- configCustomizationResource.setModelInstanceName(nodeTemplate.getName());
-
- configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
- configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
- configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
- configCustomizationResource.setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID());
-
- configCustomizationResource.setConfigurationResource(configResource);
- configResourceCustomizationSet.add(configCustomizationResource);
-
- configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
- return configCustomizationResource;
- }
-
-
- protected Optional<ConfigurationResourceCustomization> getVnrNodeTemplate(List<NodeTemplate> configurationNodeTemplatesList,
- ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization) {
- Optional<ConfigurationResourceCustomization> configurationResourceCust = Optional.empty();
- for (NodeTemplate nodeTemplate : configurationNodeTemplatesList) {
- StatefulEntityType entityType = nodeTemplate.getTypeDefinition();
- String type = entityType.getType();
-
- if(VLAN_NETWORK_RECEPTOR.equals(type)) {
- configurationResourceCust= Optional.of(getConfigurationResourceCustomization(nodeTemplate,
- toscaResourceStructure,spResourceCustomization));
- break;
- }
- }
-
- return configurationResourceCust;
- }
-
- protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) {
-
- List<NodeTemplate> serviceProxyResourceList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY);
-
- List<NodeTemplate> configurationNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION);
-
- List<ServiceProxyResourceCustomization> serviceProxyList = new ArrayList<ServiceProxyResourceCustomization>();
- List<ConfigurationResourceCustomization> configurationResourceList = new ArrayList<ConfigurationResourceCustomization>();
-
- ServiceProxyResourceCustomization serviceProxy = null;
-
- if (serviceProxyResourceList != null) {
- for (NodeTemplate spNode : serviceProxyResourceList) {
- serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct);
- serviceProxyList.add(serviceProxy);
- Optional<ConfigurationResourceCustomization> vnrResourceCustomization = getVnrNodeTemplate(configurationNodeTemplatesList,toscaResourceStruct,serviceProxy);
-
- for (NodeTemplate configNode : configurationNodeTemplatesList) {
-
- List<RequirementAssignment> requirementsList = toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll();
- for (RequirementAssignment requirement : requirementsList) {
- if (requirement.getNodeTemplateName().equals(spNode.getName())) {
- ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy, vnrResourceCustomization);
-
- Optional<ConfigurationResourceCustomization> matchingObject = configurationResourceList.stream()
- .filter(configurationResourceCustomization -> configNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID).equals(configurationResource.getModelCustomizationUUID()))
- .findFirst();
- if(!matchingObject.isPresent()){
- configurationResourceList.add(configurationResource);
- }
-
- break;
- }
- }
- }
-
- }
- }
-
- service.setConfigurationCustomizations(configurationResourceList);
- service.setServiceProxyCustomizations(serviceProxyList);
- }
-
- protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) {
-
- List<NodeTemplate> networkCollectionList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
-
- if (networkCollectionList != null) {
- for (NodeTemplate crNode : networkCollectionList) {
-
- createNetworkCollection(crNode, toscaResourceStruct, service);
- collectionRepo.saveAndFlush(toscaResourceStruct.getCatalogCollectionResource());
-
- List<NetworkInstanceGroup> networkInstanceGroupList = toscaResourceStruct.getCatalogNetworkInstanceGroup();
- for(NetworkInstanceGroup networkInstanceGroup : networkInstanceGroupList){
- instanceGroupRepo.saveAndFlush(networkInstanceGroup);
- }
-
- }
- }
- service.getCollectionResourceCustomizations().add(toscaResourceStruct.getCatalogCollectionResourceCustomization());
- }
-
-
- protected void processVFResources (ToscaResourceStructure toscaResourceStruct, Service service, VfResourceStructure vfResourceStructure)
- throws Exception{
- logger.debug("processVFResources");
-
- List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
-// String servicecategory = toscaResourceStruct.getCatalogService().getCategory();
-// String serviceType = toscaResourceStruct.getCatalogService().getServiceType();
-
- for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
- Metadata metadata = nodeTemplate.getMetaData();
- String vfCustomizationCategory = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
- logger.debug("VF Category is : " + vfCustomizationCategory);
-
- // Do not treat Allotted Resources as VNF resources
- if(ALLOTTED_RESOURCE.equalsIgnoreCase(vfCustomizationCategory)){
- continue;
- }
-
- String vfCustomizationUUID = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
-
- 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);
-
- if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
- logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
- + " matches vfNotificationResource CustomizationUUID");
-
- processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata,
- vfCustomizationCategory);
- } else {
- logger.debug("Notification VF ResourceCustomizationUUID: "
- + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match "
- + "Tosca VF Customization UUID: " + vfCustomizationUUID);
- }
- }
- }
-
-
- protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure,
- Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory) throws Exception {
-
- logger.debug("VF Category is : " + vfCustomizationCategory);
-
- if(vfResourceStructure.getVfModuleStructure() != null && !vfResourceStructure.getVfModuleStructure().isEmpty())
- {
-
- String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper()
- .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
-
- 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);
-
- if(vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())){
-
- logger.debug("vfCustomizationUUID: " + vfCustomizationUUID + " matches vfNotificationResource CustomizationUUID");
-
- VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
-
- Set<CvnfcCustomization> existingCvnfcSet = new HashSet<CvnfcCustomization>();
- Set<VnfcCustomization> existingVnfcSet = new HashSet<VnfcCustomization>();
-
- for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
-
- logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
- List<org.onap.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct
- .getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
- IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
-
- logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID());
-
- Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream()
- .peek(group -> logger.debug("To Csar Group VFModuleModelCustomizationUUID " + group.getMetadata().getValue("vfModuleModelCustomizationUUID")))
- .filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID()))
- .findFirst();
- if(matchingObject.isPresent()){
- VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct,
- vfResourceStructure,vfMetadata, vnfResource, service, existingCvnfcSet, existingVnfcSet);
- vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources());
- }else
- throw new Exception("Cannot find matching VFModule Customization in Csar for Vf_Modules_Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID());
-
- }
- service.getVnfCustomizations().add(vnfResource);
- } else{
- logger.debug("Notification VF ResourceCustomizationUUID: " + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match " +
- "Tosca VF Customization UUID: " + vfCustomizationUUID);
- }
- }
- }
-
- public void processWatchdog(String distributionId, String servideUUID, Optional<String> distributionNotification,
- String consumerId) {
- WatchdogServiceModVerIdLookup modVerIdLookup = new WatchdogServiceModVerIdLookup(distributionId, servideUUID,
- distributionNotification, consumerId);
- watchdogModVerIdLookupRepository.saveAndFlush(modVerIdLookup);
-
- try{
-
- WatchdogDistributionStatus distributionStatus = new WatchdogDistributionStatus(distributionId);
- watchdogDistributionStatusRepository.saveAndFlush(distributionStatus);
-
- } catch(ObjectOptimisticLockingFailureException e){
- logger.debug("ObjectOptimisticLockingFailureException in processWatchdog : " + e.toString());
- throw e;
- }
- }
-
- protected void extractHeatInformation(ToscaResourceStructure toscaResourceStruct,
- VfResourceStructure vfResourceStructure) {
- for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
-
- switch (vfModuleArtifact.getArtifactInfo().getArtifactType()) {
- case ASDCConfiguration.HEAT:
- case ASDCConfiguration.HEAT_NESTED:
- createHeatTemplateFromArtifact(vfResourceStructure, toscaResourceStruct,
- vfModuleArtifact);
- break;
- case ASDCConfiguration.HEAT_VOL:
- createHeatTemplateFromArtifact(vfResourceStructure, toscaResourceStruct,
- vfModuleArtifact);
- VfModuleArtifact envModuleArtifact = getHeatEnvArtifactFromGeneratedArtifact(vfResourceStructure, vfModuleArtifact);
- createHeatEnvFromArtifact(vfResourceStructure, envModuleArtifact);
- break;
- case ASDCConfiguration.HEAT_ENV:
- createHeatEnvFromArtifact(vfResourceStructure, vfModuleArtifact);
- break;
- case ASDCConfiguration.HEAT_ARTIFACT:
- createHeatFileFromArtifact(vfResourceStructure, vfModuleArtifact,
- toscaResourceStruct);
- break;
- case ASDCConfiguration.HEAT_NET:
- case ASDCConfiguration.OTHER:
- logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
- vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" + vfModuleArtifact.getArtifactInfo()
- .getArtifactName() + ")", MsoLogger.ErrorCode.DataError.getValue(), "Artifact type not supported");
- break;
- default:
- break;
-
- }
- }
- }
-
- protected VfModuleArtifact getHeatEnvArtifactFromGeneratedArtifact(VfResourceStructure vfResourceStructure,
- VfModuleArtifact vfModuleArtifact) {
- String artifactName = vfModuleArtifact.getArtifactInfo().getArtifactName();
- artifactName = artifactName.substring(0, artifactName.indexOf('.'));
- for (VfModuleArtifact moduleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
- if (moduleArtifact.getArtifactInfo().getArtifactName().contains(artifactName)
- && moduleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ENV)) {
- return moduleArtifact;
- }
- }
- return null;
- }
-
- public String verifyTheFilePrefixInArtifacts(String filebody, VfResourceStructure vfResourceStructure,
- List<String> listTypes) {
- String newFileBody = filebody;
- for (VfModuleArtifact moduleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
-
- if (listTypes.contains(moduleArtifact.getArtifactInfo().getArtifactType())) {
-
- newFileBody = verifyTheFilePrefixInString(newFileBody,
- moduleArtifact.getArtifactInfo().getArtifactName());
- }
- }
- return newFileBody;
- }
-
- public String verifyTheFilePrefixInString(final String body, final String filenameToVerify) {
-
- String needlePrefix = "file:///";
- String prefixedFilenameToVerify = needlePrefix + filenameToVerify;
-
- if ((body == null) || (body.length() == 0) || (filenameToVerify == null) || (filenameToVerify.length() == 0)) {
- return body;
- }
-
- StringBuilder sb = new StringBuilder(body.length());
-
- int currentIndex = 0;
- int startIndex = 0;
-
- while (currentIndex != -1) {
- startIndex = currentIndex;
- currentIndex = body.indexOf(prefixedFilenameToVerify, startIndex);
-
- if (currentIndex == -1) {
- break;
- }
- // We append from the startIndex up to currentIndex (start of File
- // Name)
- sb.append(body.substring(startIndex, currentIndex));
- sb.append(filenameToVerify);
-
- currentIndex += prefixedFilenameToVerify.length();
- }
-
- sb.append(body.substring(startIndex));
-
- return sb.toString();
- }
-
- protected void createHeatTemplateFromArtifact(VfResourceStructure vfResourceStructure,
- ToscaResourceStructure toscaResourceStruct, VfModuleArtifact vfModuleArtifact) {
- HeatTemplate heatTemplate = new HeatTemplate();
- List<String> typeList = new ArrayList<>();
- typeList.add(ASDCConfiguration.HEAT_NESTED);
- typeList.add(ASDCConfiguration.HEAT_ARTIFACT);
-
- heatTemplate.setTemplateBody(
- verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(), vfResourceStructure, typeList));
- heatTemplate.setTemplateName(vfModuleArtifact.getArtifactInfo().getArtifactName());
-
- if (vfModuleArtifact.getArtifactInfo().getArtifactTimeout() != null) {
- heatTemplate.setTimeoutMinutes(vfModuleArtifact.getArtifactInfo().getArtifactTimeout());
- } else {
- heatTemplate.setTimeoutMinutes(240);
- }
-
- heatTemplate.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
- heatTemplate.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
- heatTemplate.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- if (vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null) {
- heatTemplate.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
- } else {
- heatTemplate.setArtifactChecksum(MANUAL_RECORD);
- }
-
- Set<HeatTemplateParam> heatParam = extractHeatTemplateParameters(
- vfModuleArtifact.getResult(), vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- heatTemplate.setParameters(heatParam);
- vfModuleArtifact.setHeatTemplate(heatTemplate);
- }
-
- protected void createHeatEnvFromArtifact(VfResourceStructure vfResourceStructure,
- VfModuleArtifact vfModuleArtifact) {
- HeatEnvironment heatEnvironment = new HeatEnvironment();
- heatEnvironment.setName(vfModuleArtifact.getArtifactInfo().getArtifactName());
- List<String> typeList = new ArrayList<>();
- typeList.add(ASDCConfiguration.HEAT);
- typeList.add(ASDCConfiguration.HEAT_VOL);
- heatEnvironment.setEnvironment(
- verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(), vfResourceStructure, typeList));
- heatEnvironment.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
- heatEnvironment.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
- heatEnvironment.setArtifactUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
-
- if (vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null) {
- heatEnvironment.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
- } else {
- heatEnvironment.setArtifactChecksum(MANUAL_RECORD);
- }
- vfModuleArtifact.setHeatEnvironment(heatEnvironment);
- }
-
- protected void createHeatFileFromArtifact(VfResourceStructure vfResourceStructure,
- VfModuleArtifact vfModuleArtifact, ToscaResourceStructure toscaResourceStruct) {
-
- HeatFiles heatFile = new HeatFiles();
- heatFile.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- heatFile.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription());
- heatFile.setFileBody(vfModuleArtifact.getResult());
- heatFile.setFileName(vfModuleArtifact.getArtifactInfo().getArtifactName());
- heatFile.setVersion(BigDecimalVersion
- .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion()));
- toscaResourceStruct.setHeatFilesUUID(vfModuleArtifact.getArtifactInfo().getArtifactUUID());
- if (vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null) {
- heatFile.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum());
- } else {
- heatFile.setArtifactChecksum(MANUAL_RECORD);
- }
- vfModuleArtifact.setHeatFiles(heatFile);
- }
-
- protected Service createService(ToscaResourceStructure toscaResourceStructure,
- VfResourceStructure vfResourceStructure) {
-
- Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
-
- Service service = new Service();
-
- if (serviceMetadata != null) {
-
- if (toscaResourceStructure.getServiceVersion() != null) {
- service.setModelVersion(toscaResourceStructure.getServiceVersion());
- }
-
- service.setServiceType(serviceMetadata.getValue("serviceType"));
- service.setServiceRole(serviceMetadata.getValue("serviceRole"));
-
- service.setDescription(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- service.setModelName(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- service.setModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- service.setEnvironmentContext(serviceMetadata.getValue("environmentContext"));
-
- if (vfResourceStructure != null)
- service.setWorkloadContext(vfResourceStructure.getNotification().getWorkloadContext());
-
- service.setModelInvariantUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- service.setCsar(toscaResourceStructure.getCatalogToscaCsar());
- }
-
-
- toscaResourceStructure.setCatalogService(service);
- return service;
- }
-
- protected ServiceProxyResourceCustomization createServiceProxy(NodeTemplate nodeTemplate, Service service, ToscaResourceStructure toscaResourceStructure) {
-
- Metadata spMetadata = nodeTemplate.getMetaData();
-
- ServiceProxyResourceCustomization spCustomizationResource = new ServiceProxyResourceCustomization();
-
- Set<ServiceProxyResourceCustomization> serviceProxyCustomizationSet = new HashSet<>();
-
- spCustomizationResource.setModelName(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- spCustomizationResource.setModelInvariantUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- spCustomizationResource.setModelUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- spCustomizationResource.setModelVersion(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- spCustomizationResource.setDescription(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
-
- spCustomizationResource.setModelCustomizationUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- spCustomizationResource.setModelInstanceName(nodeTemplate.getName());
- spCustomizationResource.setToscaNodeType(nodeTemplate.getType());
-
- String sourceServiceUUID = spMetadata.getValue("sourceModelUuid");
-
- Service sourceService = serviceRepo.findOneByModelUUID(sourceServiceUUID);
-
- spCustomizationResource.setSourceService(sourceService);
- spCustomizationResource.setToscaNodeType(nodeTemplate.getType());
- serviceProxyCustomizationSet.add(spCustomizationResource);
-
-
- toscaResourceStructure.setCatalogServiceProxyResourceCustomization(spCustomizationResource);
-
- return spCustomizationResource;
- }
-
- protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate,
- ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization,
- Optional<ConfigurationResourceCustomization> vnrResourceCustomization) {
-
- ConfigurationResourceCustomization configCustomizationResource = getConfigurationResourceCustomization(nodeTemplate,
- toscaResourceStructure,spResourceCustomization);
-
- ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
-
- Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
-
- StatefulEntityType entityType = nodeTemplate.getTypeDefinition();
- String type = entityType.getType();
-
- if(NODES_VRF_ENTRY.equals(type)) {
- configCustomizationResource.setConfigResourceCustomization(vnrResourceCustomization.orElse(null));
- }
-
- configCustomizationResource.setConfigurationResource(configResource);
-
- configResourceCustomizationSet.add(configCustomizationResource);
-
- configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
-
- toscaResourceStructure.setCatalogConfigurationResource(configResource);
-
- toscaResourceStructure.setCatalogConfigurationResourceCustomization(configCustomizationResource);
-
- return configCustomizationResource;
- }
-
- protected ConfigurationResource createFabricConfiguration(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure) {
-
- Metadata fabricMetadata = nodeTemplate.getMetaData();
-
- ConfigurationResource configResource = new ConfigurationResource();
-
- configResource.setModelName(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- configResource.setModelInvariantUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- 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());
-
- return configResource;
- }
-
- protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) {
- ToscaCsar toscaCsar = new ToscaCsar();
- 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());
- toscaCsar.setUrl(toscaResourceStructure.getToscaArtifact().getArtifactURL());
-
- toscaResourceStructure.setCatalogToscaCsar(toscaCsar);
- }
-
- protected VnfcCustomization findExistingVfc(Set<VnfcCustomization> vnfcCustomizations, String customizationUUID) {
- VnfcCustomization vnfcCustomization = null;
- for(VnfcCustomization vnfcCustom : vnfcCustomizations){
- if (vnfcCustom != null && vnfcCustom.getModelCustomizationUUID().equals(customizationUUID)) {
- vnfcCustomization = vnfcCustom;
- }
- }
-
- if(vnfcCustomization==null)
- vnfcCustomization = vnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID);
-
- return vnfcCustomization;
- }
-
- protected CvnfcCustomization findExistingCvfc(Set<CvnfcCustomization> cvnfcCustomizations, String customizationUUID) {
- CvnfcCustomization cvnfcCustomization = null;
- for(CvnfcCustomization cvnfcCustom : cvnfcCustomizations){
- if (cvnfcCustom != null && cvnfcCustom.getModelCustomizationUUID().equals(customizationUUID)) {
- cvnfcCustomization = cvnfcCustom;
- }
- }
-
- if(cvnfcCustomization==null)
- cvnfcCustomization = cvnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID);
-
- return cvnfcCustomization;
- }
-
- protected NetworkResourceCustomization createNetwork(NodeTemplate networkNodeTemplate,
- ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin,Service service) {
-
- NetworkResourceCustomization networkResourceCustomization=networkCustomizationRepo.findOneByModelCustomizationUUID(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
-
- boolean networkUUIDsMatch = true;
- // Check to make sure the NetworkResourceUUID on the Customization record matches the NetworkResourceUUID from the distribution.
- // If not we'll update the Customization record with latest from the distribution
- if(networkResourceCustomization != null){
- String existingNetworkModelUUID = networkResourceCustomization.getNetworkResource().getModelUUID();
- String latestNetworkModelUUID = networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
-
- if(!existingNetworkModelUUID.equals(latestNetworkModelUUID)){
- networkUUIDsMatch = false;
- }
-
- }
-
- if (networkResourceCustomization!=null && !networkUUIDsMatch){
-
- NetworkResource networkResource = createNetworkResource(networkNodeTemplate, toscaResourceStructure, heatTemplate,
- aicMax, aicMin);
-
- networkResourceCustomization.setNetworkResource(networkResource);
-
- networkCustomizationRepo.saveAndFlush(networkResourceCustomization);
-
- }
- else if(networkResourceCustomization==null){
- networkResourceCustomization = createNetworkResourceCustomization(networkNodeTemplate,
- toscaResourceStructure);
-
- NetworkResource networkResource = findExistingNetworkResource(service,
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- if(networkResource == null)
- networkResource = createNetworkResource(networkNodeTemplate, toscaResourceStructure, heatTemplate,
- aicMax, aicMin);
-
- networkResource.addNetworkResourceCustomization(networkResourceCustomization);
- networkResourceCustomization.setNetworkResource(networkResource);
- }
-
- return networkResourceCustomization;
- }
-
- protected NetworkResource findExistingNetworkResource(Service service, String modelUUID) {
- NetworkResource networkResource = null;
- for(NetworkResourceCustomization networkCustom : service.getNetworkCustomizations()){
- if (networkCustom.getNetworkResource() != null
- && networkCustom.getNetworkResource().getModelUUID().equals(modelUUID)) {
- networkResource = networkCustom.getNetworkResource();
- }
- }
- if(networkResource==null)
- networkResource = networkRepo.findResourceByModelUUID(modelUUID);
-
- return networkResource;
- }
-
- protected NetworkResourceCustomization createNetworkResourceCustomization(NodeTemplate networkNodeTemplate,
- ToscaResourceStructure toscaResourceStructure) {
- NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
- networkResourceCustomization.setModelInstanceName(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- networkResourceCustomization.setModelCustomizationUUID(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
-
- networkResourceCustomization.setNetworkTechnology(
- testNull(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
- SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)));
- networkResourceCustomization.setNetworkType(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)));
- networkResourceCustomization.setNetworkRole(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)));
- networkResourceCustomization.setNetworkScope(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)));
- return networkResourceCustomization;
- }
-
- protected NetworkResource createNetworkResource(NodeTemplate networkNodeTemplate,
- ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin) {
- NetworkResource networkResource = new NetworkResource();
- String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
-
- if ("true".equalsIgnoreCase(providerNetwork)) {
- networkResource.setNeutronNetworkType(PROVIDER);
- } else {
- networkResource.setNeutronNetworkType(BASIC);
- }
-
- networkResource.setModelName(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
-
- networkResource.setModelInvariantUUID(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
- networkResource.setModelUUID(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
- networkResource.setModelVersion(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
-
- networkResource.setAicVersionMax(aicMax);
- networkResource.setAicVersionMin(aicMin);
- networkResource.setToscaNodeType(networkNodeTemplate.getType());
- networkResource.setDescription(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- networkResource.setOrchestrationMode(HEAT);
- networkResource.setHeatTemplate(heatTemplate);
- return networkResource;
- }
-
- protected CollectionNetworkResourceCustomization createNetworkCollection(NodeTemplate networkNodeTemplate,
- ToscaResourceStructure toscaResourceStructure, Service service) {
-
- CollectionNetworkResourceCustomization collectionNetworkResourceCustomization = new CollectionNetworkResourceCustomization();
-
- // **** Build Object to populate Collection_Resource table
- CollectionResource collectionResource = new CollectionResource();
-
- 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());
-
- 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.setModelInstanceName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- ncfc.setModelCustomizationUUID(
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
-
- Set<CollectionNetworkResourceCustomization> networkResourceCustomizationSet = new HashSet<>();
- networkResourceCustomizationSet.add(collectionNetworkResourceCustomization);
-
- ncfc.setNetworkResourceCustomization(networkResourceCustomizationSet);
-
- ncfc.setCollectionResource(collectionResource);
- toscaResourceStructure.setCatalogCollectionResourceCustomization(ncfc);
-
- //*** Build object to populate the Instance_Group table
- List<Group> groupList = toscaResourceStructure.getSdcCsarHelper()
- .getGroupsOfOriginOfNodeTemplateByToscaGroupType(networkNodeTemplate,
- "org.openecomp.groups.NetworkCollection");
-
- List<NetworkInstanceGroup> networkInstanceGroupList = new ArrayList<>();
-
- List<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationList = new ArrayList<CollectionResourceInstanceGroupCustomization>();
-
- for (Group group : groupList) {
-
- NetworkInstanceGroup networkInstanceGroup = new NetworkInstanceGroup();
- Metadata instanceMetadata = group.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.setRole(SubType.SUB_INTERFACE.toString()); // Set
- // Role
- networkInstanceGroup.setType(InstanceGroupType.L3_NETWORK); // Set
- // type
- networkInstanceGroup.setCollectionResource(collectionResource);
-
- // ****Build object to populate
- // Collection_Resource_Instance_Group_Customization table
- CollectionResourceInstanceGroupCustomization crInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization();
- crInstanceGroupCustomization.setInstanceGroup(networkInstanceGroup);
- crInstanceGroupCustomization.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- crInstanceGroupCustomization.setModelCustomizationUUID(
- networkNodeTemplate.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");
-
- if(policyList != null){
- for(Policy policy : policyList){
- for(String policyNetworkCollection : policy.getTargets()){
-
- if(policyNetworkCollection.equalsIgnoreCase(group.getName())){
-
- Map<String, Object> propMap = policy.getPolicyProperties();
-
- if(propMap.get("quantity") != null){
-
- String quantity = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, getPropertyInput(propMap.get("quantity").toString()));
-
- if(quantity != null){
- crInstanceGroupCustomization.setSubInterfaceNetworkQuantity(Integer.parseInt(quantity));
- }
-
- }
-
- }
- }
- }
- }
-
- 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"));
- crInstanceGroupCustomization.setCollectionResourceCust(ncfc);
- collectionResourceInstanceGroupCustomizationList.add(crInstanceGroupCustomization);
-
- networkInstanceGroup
- .setCollectionInstanceGroupCustomizations(collectionResourceInstanceGroupCustomizationList);
-
- networkInstanceGroupList.add(networkInstanceGroup);
-
-
- toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList);
-
- List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplateBySdcType(networkNodeTemplate, SdcTypes.VL);
-
- List<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationList = new ArrayList<>();
-
- //*****Build object to populate the NetworkResource table
- NetworkResource networkResource = new NetworkResource();
-
- for(NodeTemplate vlNodeTemplate : vlNodeList){
-
- String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
-
- if ("true".equalsIgnoreCase(providerNetwork)) {
- networkResource.setNeutronNetworkType(PROVIDER);
- } else {
- networkResource.setNeutronNetworkType(BASIC);
- }
-
- networkResource.setModelName(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
-
- networkResource.setModelInvariantUUID(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- networkResource.setModelUUID(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- networkResource
- .setModelVersion(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
-
- networkResource.setAicVersionMax(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
-
- TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo.findFirstBynetworkResourceModelName(
- vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
-
- if (tempNetworkLookUp != null ) {
-
- HeatTemplate heatTemplate = heatRepo
- .findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid());
- networkResource.setHeatTemplate(heatTemplate);
-
- networkResource.setAicVersionMin(tempNetworkLookUp.getAicVersionMin());
-
- }
-
- networkResource.setToscaNodeType(vlNodeTemplate.getType());
- networkResource
- .setDescription(vlNodeTemplate.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());
- }
-
- collectionNetworkResourceCustomization.setModelCustomizationUUID(
- vlNodeTemplate.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));
- collectionNetworkResourceCustomization.setInstanceGroup(networkInstanceGroup);
- collectionNetworkResourceCustomization.setNetworkResource(networkResource);
- collectionNetworkResourceCustomization.setNetworkResourceCustomization(ncfc);
-
- collectionNetworkResourceCustomizationList.add(collectionNetworkResourceCustomization);
- }
-
- }
-
- return collectionNetworkResourceCustomization;
- }
-
- protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(NodeTemplate vnfcNodeTemplate, Group group,
- VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure) {
-
- Metadata instanceMetadata = group.getMetadata();
- // Populate InstanceGroup
- VFCInstanceGroup 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.setRole("SUB-INTERFACE"); // Set Role
- vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type
-
- //Populate VNFCInstanceGroupCustomization
- VnfcInstanceGroupCustomization vfcInstanceGroupCustom = new VnfcInstanceGroupCustomization();
-
- vfcInstanceGroupCustom.setModelCustomizationUUID(vnfResourceCustomization.getModelCustomizationUUID());
- vfcInstanceGroupCustom.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- 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);
- }
- }
- vfcInstanceGroupCustom.setFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vnfcNodeTemplate, getInputName));
-
- vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
- vfcInstanceGroupCustom.setVnfResourceCust(vnfResourceCustomization);
-
- return vfcInstanceGroupCustom;
-
- }
-
- protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate,
- ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure,
- IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet) {
-
- VfModuleCustomization vfModuleCustomization = findExistingVfModuleCustomization(vnfResource,
- vfModuleData.getVfModuleModelCustomizationUUID());
- if(vfModuleCustomization == null){
- VfModule vfModule = findExistingVfModule(vnfResource,
- vfTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
- Metadata vfMetadata = group.getMetadata();
- if(vfModule==null)
- vfModule=createVfModule(group, toscaResourceStructure, vfModuleData, vfMetadata);
-
- vfModuleCustomization = createVfModuleCustomization(group, toscaResourceStructure, vfModule, vfModuleData);
- setHeatInformationForVfModule(toscaResourceStructure, vfResourceStructure, vfModule, vfModuleCustomization,
- vfMetadata);
- vfModuleCustomization.setVfModule(vfModule);
- vfModule.getVfModuleCustomization().add(vfModuleCustomization);
- vnfResource.getVfModuleCustomizations().add(vfModuleCustomization);
- } else {
- vfResourceStructure.setAlreadyDeployed(true);
- }
-
- //******************************************************************************************************************
- //* Extract VFC's and CVFC's then add them to VFModule
- //******************************************************************************************************************
-
- Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
- Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<CvnfcCustomization>();
- Set<VnfcCustomization> vnfcCustomizations = new HashSet<VnfcCustomization>();
-
- // 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();
- }
-
- // Extract CVFC lists
- List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC);
-
- for(NodeTemplate cvfcTemplate : cvfcList) {
-
- CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(existingCvnfcSet, cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
-
- if(vfModuleMemberName != null && vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName())){
-
- //Extract associated VFC - Should always be just one
- List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
-
- for(NodeTemplate vfcTemplate : vfcList) {
-
- VnfcCustomization vnfcCustomization = new VnfcCustomization();
- VnfcCustomization existingVnfcCustomization = null;
-
- existingVnfcCustomization = findExistingVfc(existingVnfcSet, vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
-
- if(existingVnfcCustomization == null){
- vnfcCustomization = new VnfcCustomization();
- } else {
- vnfcCustomization = existingVnfcCustomization;
- }
-
- // Only Add Abstract VNFC's to our DB, ignore all others
- if(existingVnfcCustomization == null && vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY).equalsIgnoreCase("Abstract")){
- vnfcCustomization.setModelCustomizationUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- vnfcCustomization.setModelInstanceName(vfcTemplate.getName());
- vnfcCustomization.setModelInvariantUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- vnfcCustomization.setModelName(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- vnfcCustomization.setModelUUID(vfcTemplate.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()));
-
- vnfcCustomizations.add(vnfcCustomization);
- existingVnfcSet.add(vnfcCustomization);
- }
-
- // This check is needed incase the VFC subcategory is something other than Abstract. In that case we want to skip adding that record to our DB.
- if(vnfcCustomization.getModelCustomizationUUID() != null){
-
- CvnfcCustomization cvnfcCustomization = null;
-
- if(existingCvnfcCustomization != null){
- cvnfcCustomization = existingCvnfcCustomization;
- }
- else{
-
- cvnfcCustomization = new CvnfcCustomization();
- cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName());
- cvnfcCustomization.setModelInvariantUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- cvnfcCustomization.setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- cvnfcCustomization.setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
-
- cvnfcCustomization.setModelVersion(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- cvnfcCustomization.setDescription(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType()));
-
- if(existingVnfcCustomization != null){
- cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization);
- }else{
- cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
- }
-
- cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_function"));
- cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code"));
- cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
- cvnfcCustomization.setVnfResourceCustomization(vnfResource);
-
- cvnfcCustomizations.add(cvnfcCustomization);
- existingCvnfcSet.add(cvnfcCustomization);
- }
-
- //*****************************************************************************************************************************************
- //* Extract Fabric Configuration
- //*****************************************************************************************************************************************
-
- List<NodeTemplate> fabricConfigList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CONFIGURATION);
-
- for(NodeTemplate fabricTemplate : fabricConfigList) {
-
- ConfigurationResource fabricConfig = null;
-
- ConfigurationResource existingConfig = findExistingConfiguration(service, fabricTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
-
- if(existingConfig == null){
-
- fabricConfig = createFabricConfiguration(fabricTemplate, toscaResourceStructure);
-
- }else {
- fabricConfig = existingConfig;
- }
-
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = createVfCnvfConfigCustomization(fabricTemplate, toscaResourceStructure,
- vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig, vfTemplate, vfModuleMemberName);
-
- vnfVfmoduleCvnfcConfigurationCustomizations.add(vnfVfmoduleCvnfcConfigurationCustomization);
- }
-
- }
-
- }
-
- }
-
- }
-
- vfModuleCustomization.setCvnfcCustomization(cvnfcCustomizations);
- vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizations);
-
- return vfModuleCustomization;
- }
-
- protected VnfVfmoduleCvnfcConfigurationCustomization createVfCnvfConfigCustomization(NodeTemplate fabricTemplate, ToscaResourceStructure toscaResourceStruct,
- VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization,
- ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) {
-
- Metadata fabricMetadata = fabricTemplate.getMetaData();
-
- VnfVfmoduleCvnfcConfigurationCustomization vfModuleToCvnfc = new VnfVfmoduleCvnfcConfigurationCustomization();
-
- vfModuleToCvnfc.setConfigurationResource(configResource);
- vfModuleToCvnfc.setCvnfcCustomization(cvnfcCustomization);
- vfModuleToCvnfc.setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- vfModuleToCvnfc.setModelInstanceName(fabricTemplate.getName());
- vfModuleToCvnfc.setVfModuleCustomization(vfModuleCustomization);
- vfModuleToCvnfc.setVnfResourceCustomization(vnfResource);
-
- List<Policy> policyList = toscaResourceStruct.getSdcCsarHelper().getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(vfTemplate, "org.openecomp.policies.External");
-
- if(policyList != null){
- for(Policy policy : policyList){
-
- for(String policyCvfcTarget : policy.getTargets()){
-
- if(policyCvfcTarget.equalsIgnoreCase(vfModuleMemberName)){
-
- Map<String, Object> propMap = policy.getPolicyProperties();
-
- if(propMap.get("type").toString().equalsIgnoreCase("Fabric Policy")){
- vfModuleToCvnfc.setPolicyName(propMap.get("name").toString());
- }
- }
- }
- }
- }
-
- vfModuleToCvnfc.setConfigurationFunction(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "function"));
- vfModuleToCvnfc.setConfigurationRole(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "role"));
- vfModuleToCvnfc.setConfigurationType(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "type"));
-
- return vfModuleToCvnfc;
- }
-
- protected ConfigurationResource findExistingConfiguration(Service service, String modelUUID) {
- ConfigurationResource configResource = null;
- for(ConfigurationResourceCustomization configurationResourceCustom : service.getConfigurationCustomizations()){
- if (configurationResourceCustom.getConfigurationResource() != null
- && configurationResourceCustom.getConfigurationResource().getModelUUID().equals(modelUUID)) {
- configResource = configurationResourceCustom.getConfigurationResource();
- }
- }
- if(configResource==null)
- configResource = configRepo.findResourceByModelUUID(modelUUID);
-
- return configResource;
- }
-
- protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource,
- String vfModuleModelCustomizationUUID) {
- VfModuleCustomization vfModuleCustomization = null;
- for(VfModuleCustomization vfModuleCustom : vnfResource.getVfModuleCustomizations()){
- if(vfModuleCustom.getModelCustomizationUUID().equalsIgnoreCase(vfModuleModelCustomizationUUID)){
- vfModuleCustomization = vfModuleCustom;
- }
- }
- if(vfModuleCustomization==null)
- vfModuleCustomization = vfModuleCustomizationRepo
- .findByModelCustomizationUUID(vfModuleModelCustomizationUUID);
-
- return vfModuleCustomization;
- }
-
- protected VfModule findExistingVfModule(VnfResourceCustomization vnfResource, String modelUUID) {
- VfModule vfModule = null;
- for(VfModuleCustomization vfModuleCustom : vnfResource.getVfModuleCustomizations()){
- if(vfModuleCustom.getVfModule() != null && vfModuleCustom.getVfModule().getModelUUID().equals(modelUUID)){
- vfModule = vfModuleCustom.getVfModule();
- }
- }
- if(vfModule==null)
- vfModule = vfModuleRepo.findByModelUUID(modelUUID);
-
- return vfModule;
- }
-
- protected VfModuleCustomization createVfModuleCustomization(Group group,
- ToscaResourceStructure toscaResourceStructure, VfModule vfModule, IVfModuleData vfModuleData) {
- VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
-
- vfModuleCustomization.setModelCustomizationUUID(vfModuleData.getVfModuleModelCustomizationUUID());
-
- vfModuleCustomization.setVfModule(vfModule);
-
- String initialCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- 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 = 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));
-
- 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);
- if (minInstances != null && minInstances.length() > 0) {
- vfModuleCustomization.setMinInstances(Integer.valueOf(minInstances));
- }
- return vfModuleCustomization;
- }
-
- protected VfModule createVfModule(Group group, 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));
- } 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.setModelUUID(vfModuleModelUUID);
- vfModule.setModelVersion(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
- vfModule.setDescription(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
-
- String vfModuleType = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE);
- if (vfModuleType != null && "Base".equalsIgnoreCase(vfModuleType)) {
- vfModule.setIsBase(true);
- } else {
- vfModule.setIsBase(false);
- }
- return vfModule;
- }
-
- protected void setHeatInformationForVfModule(ToscaResourceStructure toscaResourceStructure,
- VfResourceStructure vfResourceStructure, VfModule vfModule, VfModuleCustomization vfModuleCustomization,
- Metadata vfMetadata) {
-
- Optional<VfModuleStructure> matchingObject = vfResourceStructure.getVfModuleStructure().stream()
- .filter(vfModuleStruct -> vfModuleStruct.getVfModuleMetadata().getVfModuleModelUUID()
- .equalsIgnoreCase(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)))
- .findFirst();
-
- if (matchingObject.isPresent()) {
- List<HeatFiles> heatFilesList = new ArrayList<>();
- List<HeatTemplate> volumeHeatChildTemplates = new ArrayList<HeatTemplate>();
- List<HeatTemplate> heatChildTemplates = new ArrayList<HeatTemplate>();
- HeatTemplate parentHeatTemplate = new HeatTemplate();
- String parentArtifactType = null;
- Set<String> artifacts = new HashSet<>(matchingObject.get().getVfModuleMetadata().getArtifacts());
- for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
-
- List<HeatTemplate> childNestedHeatTemplates = new ArrayList<HeatTemplate>();
-
- if (artifacts.contains(vfModuleArtifact.getArtifactInfo().getArtifactUUID())) {
- checkVfModuleArtifactType(vfModule, vfModuleCustomization, heatFilesList, vfModuleArtifact,
- childNestedHeatTemplates, parentHeatTemplate, vfResourceStructure);
- }
-
- if(vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_NESTED)){
- parentArtifactType = identifyParentOfNestedTemplate(matchingObject.get(), vfModuleArtifact);
-
- if(!childNestedHeatTemplates.isEmpty()){
-
- if (parentArtifactType != null && parentArtifactType.equalsIgnoreCase(ASDCConfiguration.HEAT_VOL)) {
- volumeHeatChildTemplates.add(childNestedHeatTemplates.get(0));
- } else {
- heatChildTemplates.add(childNestedHeatTemplates.get(0));
- }
- }
- }
-
- }
- if(!heatFilesList.isEmpty()){
- vfModule.setHeatFiles(heatFilesList);
- }
-
-
- // Set all Child Templates related to HEAT_VOLUME
- if(!volumeHeatChildTemplates.isEmpty()){
- if(vfModule.getVolumeHeatTemplate() != null){
- vfModule.getVolumeHeatTemplate().setChildTemplates(volumeHeatChildTemplates);
- }else{
- logger.debug("VolumeHeatTemplate not set in setHeatInformationForVfModule()");
- }
- }
-
- // Set all Child Templates related to HEAT
- if(!heatChildTemplates.isEmpty()){
- if(vfModule.getModuleHeatTemplate() != null){
- vfModule.getModuleHeatTemplate().setChildTemplates(heatChildTemplates);
- }else{
- logger.debug("ModuleHeatTemplate not set in setHeatInformationForVfModule()");
- }
- }
- }
- }
-
- protected void checkVfModuleArtifactType(VfModule vfModule, VfModuleCustomization vfModuleCustomization,
- List<HeatFiles> heatFilesList, VfModuleArtifact vfModuleArtifact, List<HeatTemplate> nestedHeatTemplates,
- HeatTemplate parentHeatTemplate, VfResourceStructure vfResourceStructure) {
- if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT)) {
- vfModuleArtifact.incrementDeployedInDB();
- vfModule.setModuleHeatTemplate(vfModuleArtifact.getHeatTemplate());
- } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_VOL)) {
- vfModule.setVolumeHeatTemplate(vfModuleArtifact.getHeatTemplate());
- VfModuleArtifact volVfModuleArtifact = this.getHeatEnvArtifactFromGeneratedArtifact(vfResourceStructure, vfModuleArtifact);
- vfModuleCustomization.setVolumeHeatEnv(volVfModuleArtifact.getHeatEnvironment());
- vfModuleArtifact.incrementDeployedInDB();
- } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ENV)) {
- if(vfModuleArtifact.getHeatEnvironment().getName().contains("volume")) {
- vfModuleCustomization.setVolumeHeatEnv(vfModuleArtifact.getHeatEnvironment());
- } else {
- vfModuleCustomization.setHeatEnvironment(vfModuleArtifact.getHeatEnvironment());
- }
- vfModuleArtifact.incrementDeployedInDB();
- } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ARTIFACT)) {
- heatFilesList.add(vfModuleArtifact.getHeatFiles());
- vfModuleArtifact.incrementDeployedInDB();
- } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_NESTED)) {
- nestedHeatTemplates.add(vfModuleArtifact.getHeatTemplate());
- vfModuleArtifact.incrementDeployedInDB();
- }
- }
-
- protected VnfResourceCustomization createVnfResource(NodeTemplate vfNodeTemplate,
- ToscaResourceStructure toscaResourceStructure, Service service) {
- VnfResourceCustomization vnfResourceCustomization = vnfCustomizationRepo.findOneByModelCustomizationUUID(
- vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- if(vnfResourceCustomization == null){
- VnfResource vnfResource = findExistingVnfResource(service,
- vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
-
- if(vnfResource==null)
- vnfResource=createVnfResource(vfNodeTemplate);
-
- vnfResourceCustomization = createVnfResourceCustomization(vfNodeTemplate, toscaResourceStructure,
- vnfResource);
- vnfResourceCustomization.setVnfResources(vnfResource);
- vnfResource.getVnfResourceCustomizations().add(vnfResourceCustomization);
-
- // Fetch VNFC Instance Group Info
- List<Group> groupList = toscaResourceStructure.getSdcCsarHelper()
- .getGroupsOfOriginOfNodeTemplateByToscaGroupType(vfNodeTemplate,
- "org.openecomp.groups.VfcInstanceGroup");
-
- for (Group group : groupList) {
-
- VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup(vfNodeTemplate, group, vnfResourceCustomization, toscaResourceStructure);
-
- vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization);
- }
- }
- return vnfResourceCustomization;
- }
-
- protected VnfResource findExistingVnfResource(Service service, String modelUUID) {
- VnfResource vnfResource = null;
- for(VnfResourceCustomization vnfResourceCustom : service.getVnfCustomizations()){
- if (vnfResourceCustom.getVnfResources() != null
- && vnfResourceCustom.getVnfResources().getModelUUID().equals(modelUUID)) {
- vnfResource = vnfResourceCustom.getVnfResources();
- }
- }
- if(vnfResource==null)
- vnfResource = vnfRepo.findResourceByModelUUID(modelUUID);
-
- return vnfResource;
- }
-
- protected VnfResourceCustomization createVnfResourceCustomization(NodeTemplate vfNodeTemplate,
- ToscaResourceStructure toscaResourceStructure, VnfResource vnfResource) {
- VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
- vnfResourceCustomization.setModelCustomizationUUID(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- vnfResourceCustomization.setModelInstanceName(vfNodeTemplate.getName());
-
- 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.setMultiStageDesign(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, MULTI_STAGE_DESIGN));
-
- vnfResourceCustomization.setVnfResources(vnfResource);
- vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger(
- vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
-
- CapabilityAssignments vnfCustomizationCapability = toscaResourceStructure.getSdcCsarHelper()
- .getCapabilitiesOf(vfNodeTemplate);
-
- if (vnfCustomizationCapability != null) {
- CapabilityAssignment capAssign = vnfCustomizationCapability.getCapabilityByName(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)));
- }
-
- }
-
- toscaResourceStructure.setCatalogVnfResourceCustomization(vnfResourceCustomization);
-
- return vnfResourceCustomization;
- }
-
- protected VnfResource createVnfResource(NodeTemplate vfNodeTemplate) {
- 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)));
-
- vnfResource.setModelVersion(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- vnfResource.setDescription(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- vnfResource.setOrchestrationMode(HEAT);
- vnfResource.setToscaNodeType(testNull(vfNodeTemplate.getType()));
- vnfResource.setAicVersionMax(
- testNull(vfNodeTemplate.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));
-
- return vnfResource;
- }
-
- protected AllottedResourceCustomization createAllottedResource(NodeTemplate nodeTemplate,
- ToscaResourceStructure toscaResourceStructure, Service service) {
- AllottedResourceCustomization allottedResourceCustomization = allottedCustomizationRepo
- .findOneByModelCustomizationUUID(
- nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
-
- if(allottedResourceCustomization == null){
- AllottedResource allottedResource = findExistingAllottedResource(service,
- nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
-
- if(allottedResource==null)
- allottedResource=createAR(nodeTemplate);
-
- toscaResourceStructure.setAllottedResource(allottedResource);
- allottedResourceCustomization = createAllottedResourceCustomization(nodeTemplate, toscaResourceStructure);
- allottedResourceCustomization.setAllottedResource(allottedResource);
- allottedResource.getAllotedResourceCustomization().add(allottedResourceCustomization);
- }
- return allottedResourceCustomization;
- }
-
- protected AllottedResource findExistingAllottedResource(Service service, String modelUUID) {
- AllottedResource allottedResource = null;
- for(AllottedResourceCustomization allottedResourceCustom : service.getAllottedCustomizations()){
- if (allottedResourceCustom.getAllottedResource() != null
- && allottedResourceCustom.getAllottedResource().getModelUUID().equals(modelUUID)) {
- allottedResource = allottedResourceCustom.getAllottedResource();
- }
- }
- if(allottedResource==null)
- allottedResource = allottedRepo.findResourceByModelUUID(modelUUID);
-
- return allottedResource;
- }
-
- protected AllottedResourceCustomization createAllottedResourceCustomization(NodeTemplate nodeTemplate,
- ToscaResourceStructure toscaResourceStructure) {
- AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
- allottedResourceCustomization.setModelCustomizationUUID(
- testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- allottedResourceCustomization.setModelInstanceName(nodeTemplate.getName());
-
-
- 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<NodeTemplate> vfcNodes = toscaResourceStructure.getSdcCsarHelper().getVfcListByVf(allottedResourceCustomization.getModelCustomizationUUID());
-
- if(vfcNodes != null){
- for(NodeTemplate vfcNode : vfcNodes){
-
- 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"));
- }
- }
-
-
- CapabilityAssignments arCustomizationCapability = toscaResourceStructure.getSdcCsarHelper()
- .getCapabilitiesOf(nodeTemplate);
-
- if (arCustomizationCapability != null) {
- CapabilityAssignment capAssign = arCustomizationCapability.getCapabilityByName(SCALABLE);
-
- 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) {
- AllottedResource allottedResource = new AllottedResource();
- allottedResource
- .setModelUUID(testNull(nodeTemplate.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)));
- 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)));
- allottedResource
- .setDescription(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- return allottedResource;
- }
-
- protected Set<HeatTemplateParam> extractHeatTemplateParameters(String yamlFile, String artifactUUID) {
- // Scan the payload downloadResult and extract the HeatTemplate
- // parameters
- YamlEditor yamlEditor = new YamlEditor(yamlFile.getBytes());
- return yamlEditor.getParameterList(artifactUUID);
- }
-
- protected String testNull(Object object) {
-
- if (object == null) {
- return null;
- } else if (object.equals("NULL")) {
- return null;
- } else if (object instanceof Integer) {
- return object.toString();
- } else if (object instanceof String) {
- return (String) object;
- } else {
- return "Type not recognized";
- }
- }
-
- protected static String identifyParentOfNestedTemplate(VfModuleStructure vfModuleStructure,
- VfModuleArtifact heatNestedArtifact) {
-
- if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) != null && vfModuleStructure
- .getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo().getRelatedArtifacts() != null) {
- for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0)
- .getArtifactInfo().getRelatedArtifacts()) {
- if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
- return ASDCConfiguration.HEAT;
- }
-
- }
- }
-
- if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL) != null
- && vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo()
- .getRelatedArtifacts() != null) {
- for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL)
- .get(0).getArtifactInfo().getRelatedArtifacts()) {
- if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
- return ASDCConfiguration.HEAT_VOL;
- }
-
- }
- }
-
- // Does not belong to anything
- return null;
-
- }
-
- protected static String createVNFName(VfResourceStructure vfResourceStructure) {
-
- return vfResourceStructure.getNotification().getServiceName() + "/"
- + vfResourceStructure.getResourceInstance().getResourceInstanceName();
- }
-
- protected static String createVfModuleName(VfModuleStructure vfModuleStructure) {
-
- return createVNFName(vfModuleStructure.getParentVfResource()) + "::"
- + vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
- }
-
- protected String getPropertyInput(String propertyName){
-
- String inputName = new String();
-
- if (propertyName != null) {
- int getInputIndex = propertyName.indexOf("{get_input=");
- if (getInputIndex > -1) {
- inputName = propertyName.substring(getInputIndex+11, propertyName.length()-1);
- }
- }
-
- return inputName;
- }
-
-
- protected static Timestamp getCurrentTimeStamp() {
-
- return new Timestamp(new Date().getTime());
- }
+ vnfcCustomization = existingVnfcCustomization;
+ }
+
+ // Only Add Abstract VNFC's to our DB, ignore all others
+ if (existingVnfcCustomization == null && vfcTemplate.getMetaData()
+ .getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY).equalsIgnoreCase("Abstract")) {
+ vnfcCustomization.setModelCustomizationUUID(
+ vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vnfcCustomization.setModelInstanceName(vfcTemplate.getName());
+ vnfcCustomization.setModelInvariantUUID(
+ vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ vnfcCustomization
+ .setModelName(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ vnfcCustomization
+ .setModelUUID(vfcTemplate.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()));
+
+ vnfcCustomizations.add(vnfcCustomization);
+ existingVnfcSet.add(vnfcCustomization);
+ }
+
+ // This check is needed incase the VFC subcategory is something other than Abstract. In that case we want to skip adding that record to our DB.
+ if (vnfcCustomization.getModelCustomizationUUID() != null) {
+
+ CvnfcCustomization cvnfcCustomization = null;
+
+ if (existingCvnfcCustomization != null) {
+ cvnfcCustomization = existingCvnfcCustomization;
+ } else {
+
+ cvnfcCustomization = new CvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID(
+ cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName());
+ cvnfcCustomization.setModelInvariantUUID(
+ cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ cvnfcCustomization
+ .setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ cvnfcCustomization
+ .setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ cvnfcCustomization.setModelVersion(
+ testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ cvnfcCustomization.setDescription(
+ testNull(
+ cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType()));
+
+ if (existingVnfcCustomization != null) {
+ cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization);
+ } else {
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+ }
+
+ cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_function"));
+ cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code"));
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+ cvnfcCustomization.setVnfResourceCustomization(vnfResource);
+
+ cvnfcCustomizations.add(cvnfcCustomization);
+ existingCvnfcSet.add(cvnfcCustomization);
+ }
+
+ //*****************************************************************************************************************************************
+ //* Extract Fabric Configuration
+ //*****************************************************************************************************************************************
+
+ List<NodeTemplate> fabricConfigList = toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplateBySdcType(vfTemplate, SdcTypes.CONFIGURATION);
+
+ for (NodeTemplate fabricTemplate : fabricConfigList) {
+
+ ConfigurationResource fabricConfig = null;
+
+ ConfigurationResource existingConfig = findExistingConfiguration(service,
+ fabricTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ if (existingConfig == null) {
+
+ fabricConfig = createFabricConfiguration(fabricTemplate, toscaResourceStructure);
+
+ } else {
+ fabricConfig = existingConfig;
+ }
+
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = createVfCnvfConfigCustomization(
+ fabricTemplate, toscaResourceStructure,
+ vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig, vfTemplate,
+ vfModuleMemberName);
+
+ vnfVfmoduleCvnfcConfigurationCustomizations.add(vnfVfmoduleCvnfcConfigurationCustomization);
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ vfModuleCustomization.setCvnfcCustomization(cvnfcCustomizations);
+ vfModuleCustomization
+ .setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizations);
+
+ return vfModuleCustomization;
+ }
+
+ protected VnfVfmoduleCvnfcConfigurationCustomization createVfCnvfConfigCustomization(NodeTemplate fabricTemplate,
+ ToscaResourceStructure toscaResourceStruct,
+ VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization,
+ CvnfcCustomization cvnfcCustomization,
+ ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) {
+
+ Metadata fabricMetadata = fabricTemplate.getMetaData();
+
+ VnfVfmoduleCvnfcConfigurationCustomization vfModuleToCvnfc = new VnfVfmoduleCvnfcConfigurationCustomization();
+
+ vfModuleToCvnfc.setConfigurationResource(configResource);
+ vfModuleToCvnfc.setCvnfcCustomization(cvnfcCustomization);
+ vfModuleToCvnfc
+ .setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vfModuleToCvnfc.setModelInstanceName(fabricTemplate.getName());
+ vfModuleToCvnfc.setVfModuleCustomization(vfModuleCustomization);
+ vfModuleToCvnfc.setVnfResourceCustomization(vnfResource);
+
+ List<Policy> policyList = toscaResourceStruct.getSdcCsarHelper()
+ .getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(vfTemplate, "org.openecomp.policies.External");
+
+ if (policyList != null) {
+ for (Policy policy : policyList) {
+
+ for (String policyCvfcTarget : policy.getTargets()) {
+
+ if (policyCvfcTarget.equalsIgnoreCase(vfModuleMemberName)) {
+
+ Map<String, Object> propMap = policy.getPolicyProperties();
+
+ if (propMap.get("type").toString().equalsIgnoreCase("Fabric Policy")) {
+ vfModuleToCvnfc.setPolicyName(propMap.get("name").toString());
+ }
+ }
+ }
+ }
+ }
+
+ vfModuleToCvnfc.setConfigurationFunction(
+ toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "function"));
+ vfModuleToCvnfc.setConfigurationRole(
+ toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "role"));
+ vfModuleToCvnfc.setConfigurationType(
+ toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "type"));
+
+ return vfModuleToCvnfc;
+ }
+
+ protected ConfigurationResource findExistingConfiguration(Service service, String modelUUID) {
+ ConfigurationResource configResource = null;
+ for (ConfigurationResourceCustomization configurationResourceCustom : service
+ .getConfigurationCustomizations()) {
+ if (configurationResourceCustom.getConfigurationResource() != null
+ && configurationResourceCustom.getConfigurationResource().getModelUUID().equals(modelUUID)) {
+ configResource = configurationResourceCustom.getConfigurationResource();
+ }
+ }
+ if (configResource == null) {
+ configResource = configRepo.findResourceByModelUUID(modelUUID);
+ }
+
+ return configResource;
+ }
+
+ protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource,
+ String vfModuleModelCustomizationUUID) {
+ VfModuleCustomization vfModuleCustomization = null;
+ for (VfModuleCustomization vfModuleCustom : vnfResource.getVfModuleCustomizations()) {
+ if (vfModuleCustom.getModelCustomizationUUID().equalsIgnoreCase(vfModuleModelCustomizationUUID)) {
+ vfModuleCustomization = vfModuleCustom;
+ }
+ }
+ if (vfModuleCustomization == null) {
+ vfModuleCustomization = vfModuleCustomizationRepo
+ .findByModelCustomizationUUID(vfModuleModelCustomizationUUID);
+ }
+
+ return vfModuleCustomization;
+ }
+
+ protected VfModule findExistingVfModule(VnfResourceCustomization vnfResource, String modelUUID) {
+ VfModule vfModule = null;
+ for (VfModuleCustomization vfModuleCustom : vnfResource.getVfModuleCustomizations()) {
+ if (vfModuleCustom.getVfModule() != null && vfModuleCustom.getVfModule().getModelUUID().equals(modelUUID)) {
+ vfModule = vfModuleCustom.getVfModule();
+ }
+ }
+ if (vfModule == null) {
+ vfModule = vfModuleRepo.findByModelUUID(modelUUID);
+ }
+
+ return vfModule;
+ }
+
+ protected VfModuleCustomization createVfModuleCustomization(Group group,
+ ToscaResourceStructure toscaResourceStructure, VfModule vfModule, IVfModuleData vfModuleData) {
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+
+ vfModuleCustomization.setModelCustomizationUUID(vfModuleData.getVfModuleModelCustomizationUUID());
+
+ vfModuleCustomization.setVfModule(vfModule);
+
+ String initialCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
+ 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 = 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));
+
+ 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);
+ if (minInstances != null && minInstances.length() > 0) {
+ vfModuleCustomization.setMinInstances(Integer.valueOf(minInstances));
+ }
+ return vfModuleCustomization;
+ }
+
+ protected VfModule createVfModule(Group group, 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));
+ } 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.setModelUUID(vfModuleModelUUID);
+ vfModule.setModelVersion(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
+ vfModule.setDescription(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+
+ String vfModuleType = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE);
+ if (vfModuleType != null && "Base".equalsIgnoreCase(vfModuleType)) {
+ vfModule.setIsBase(true);
+ } else {
+ vfModule.setIsBase(false);
+ }
+ return vfModule;
+ }
+
+ protected void setHeatInformationForVfModule(ToscaResourceStructure toscaResourceStructure,
+ VfResourceStructure vfResourceStructure, VfModule vfModule, VfModuleCustomization vfModuleCustomization,
+ Metadata vfMetadata) {
+
+ Optional<VfModuleStructure> matchingObject = vfResourceStructure.getVfModuleStructure().stream()
+ .filter(vfModuleStruct -> vfModuleStruct.getVfModuleMetadata().getVfModuleModelUUID()
+ .equalsIgnoreCase(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)))
+ .findFirst();
+
+ if (matchingObject.isPresent()) {
+ List<HeatFiles> heatFilesList = new ArrayList<>();
+ List<HeatTemplate> volumeHeatChildTemplates = new ArrayList<HeatTemplate>();
+ List<HeatTemplate> heatChildTemplates = new ArrayList<HeatTemplate>();
+ HeatTemplate parentHeatTemplate = new HeatTemplate();
+ String parentArtifactType = null;
+ Set<String> artifacts = new HashSet<>(matchingObject.get().getVfModuleMetadata().getArtifacts());
+ for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
+
+ List<HeatTemplate> childNestedHeatTemplates = new ArrayList<HeatTemplate>();
+
+ if (artifacts.contains(vfModuleArtifact.getArtifactInfo().getArtifactUUID())) {
+ checkVfModuleArtifactType(vfModule, vfModuleCustomization, heatFilesList, vfModuleArtifact,
+ childNestedHeatTemplates, parentHeatTemplate, vfResourceStructure);
+ }
+
+ if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_NESTED)) {
+ parentArtifactType = identifyParentOfNestedTemplate(matchingObject.get(), vfModuleArtifact);
+
+ if (!childNestedHeatTemplates.isEmpty()) {
+
+ if (parentArtifactType != null && parentArtifactType
+ .equalsIgnoreCase(ASDCConfiguration.HEAT_VOL)) {
+ volumeHeatChildTemplates.add(childNestedHeatTemplates.get(0));
+ } else {
+ heatChildTemplates.add(childNestedHeatTemplates.get(0));
+ }
+ }
+ }
+
+ }
+ if (!heatFilesList.isEmpty()) {
+ vfModule.setHeatFiles(heatFilesList);
+ }
+
+ // Set all Child Templates related to HEAT_VOLUME
+ if (!volumeHeatChildTemplates.isEmpty()) {
+ if (vfModule.getVolumeHeatTemplate() != null) {
+ vfModule.getVolumeHeatTemplate().setChildTemplates(volumeHeatChildTemplates);
+ } else {
+ logger.debug("VolumeHeatTemplate not set in setHeatInformationForVfModule()");
+ }
+ }
+
+ // Set all Child Templates related to HEAT
+ if (!heatChildTemplates.isEmpty()) {
+ if (vfModule.getModuleHeatTemplate() != null) {
+ vfModule.getModuleHeatTemplate().setChildTemplates(heatChildTemplates);
+ } else {
+ logger.debug("ModuleHeatTemplate not set in setHeatInformationForVfModule()");
+ }
+ }
+ }
+ }
+
+ protected void checkVfModuleArtifactType(VfModule vfModule, VfModuleCustomization vfModuleCustomization,
+ List<HeatFiles> heatFilesList, VfModuleArtifact vfModuleArtifact, List<HeatTemplate> nestedHeatTemplates,
+ HeatTemplate parentHeatTemplate, VfResourceStructure vfResourceStructure) {
+ if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT)) {
+ vfModuleArtifact.incrementDeployedInDB();
+ vfModule.setModuleHeatTemplate(vfModuleArtifact.getHeatTemplate());
+ } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_VOL)) {
+ vfModule.setVolumeHeatTemplate(vfModuleArtifact.getHeatTemplate());
+ VfModuleArtifact volVfModuleArtifact = this
+ .getHeatEnvArtifactFromGeneratedArtifact(vfResourceStructure, vfModuleArtifact);
+ vfModuleCustomization.setVolumeHeatEnv(volVfModuleArtifact.getHeatEnvironment());
+ vfModuleArtifact.incrementDeployedInDB();
+ } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ENV)) {
+ if (vfModuleArtifact.getHeatEnvironment().getName().contains("volume")) {
+ vfModuleCustomization.setVolumeHeatEnv(vfModuleArtifact.getHeatEnvironment());
+ } else {
+ vfModuleCustomization.setHeatEnvironment(vfModuleArtifact.getHeatEnvironment());
+ }
+ vfModuleArtifact.incrementDeployedInDB();
+ } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ARTIFACT)) {
+ heatFilesList.add(vfModuleArtifact.getHeatFiles());
+ vfModuleArtifact.incrementDeployedInDB();
+ } else if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_NESTED)) {
+ nestedHeatTemplates.add(vfModuleArtifact.getHeatTemplate());
+ vfModuleArtifact.incrementDeployedInDB();
+ }
+ }
+
+ protected VnfResourceCustomization createVnfResource(NodeTemplate vfNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, Service service) {
+ VnfResourceCustomization vnfResourceCustomization = vnfCustomizationRepo.findOneByModelCustomizationUUID(
+ vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ if (vnfResourceCustomization == null) {
+ VnfResource vnfResource = findExistingVnfResource(service,
+ vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ if (vnfResource == null) {
+ vnfResource = createVnfResource(vfNodeTemplate);
+ }
+
+ vnfResourceCustomization = createVnfResourceCustomization(vfNodeTemplate, toscaResourceStructure,
+ vnfResource);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+ vnfResource.getVnfResourceCustomizations().add(vnfResourceCustomization);
+
+ // Fetch VNFC Instance Group Info
+ List<Group> groupList = toscaResourceStructure.getSdcCsarHelper()
+ .getGroupsOfOriginOfNodeTemplateByToscaGroupType(vfNodeTemplate,
+ "org.openecomp.groups.VfcInstanceGroup");
+
+ for (Group group : groupList) {
+
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup(vfNodeTemplate,
+ group, vnfResourceCustomization, toscaResourceStructure);
+
+ vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization);
+ }
+ }
+ return vnfResourceCustomization;
+ }
+
+ protected VnfResource findExistingVnfResource(Service service, String modelUUID) {
+ VnfResource vnfResource = null;
+ for (VnfResourceCustomization vnfResourceCustom : service.getVnfCustomizations()) {
+ if (vnfResourceCustom.getVnfResources() != null
+ && vnfResourceCustom.getVnfResources().getModelUUID().equals(modelUUID)) {
+ vnfResource = vnfResourceCustom.getVnfResources();
+ }
+ }
+ if (vnfResource == null) {
+ vnfResource = vnfRepo.findResourceByModelUUID(modelUUID);
+ }
+
+ return vnfResource;
+ }
+
+ protected VnfResourceCustomization createVnfResourceCustomization(NodeTemplate vfNodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, VnfResource vnfResource) {
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID(
+ testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ vnfResourceCustomization.setModelInstanceName(vfNodeTemplate.getName());
+
+ 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.setMultiStageDesign(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vfNodeTemplate, MULTI_STAGE_DESIGN));
+
+ vnfResourceCustomization.setBlueprintName(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_NAME)));
+
+ vnfResourceCustomization.setBlueprintVersion(testNull(toscaResourceStructure.getSdcCsarHelper()
+ .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_VERSION)));
+
+ vnfResourceCustomization.setVnfResources(vnfResource);
+ vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger(
+ vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
+
+ CapabilityAssignments vnfCustomizationCapability = toscaResourceStructure.getSdcCsarHelper()
+ .getCapabilitiesOf(vfNodeTemplate);
+
+ if (vnfCustomizationCapability != null) {
+ CapabilityAssignment capAssign = vnfCustomizationCapability.getCapabilityByName(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)));
+ }
+
+ }
+
+ toscaResourceStructure.setCatalogVnfResourceCustomization(vnfResourceCustomization);
+
+ return vnfResourceCustomization;
+ }
+
+ protected VnfResource createVnfResource(NodeTemplate vfNodeTemplate) {
+ 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)));
+
+ vnfResource.setModelVersion(
+ testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ vnfResource.setDescription(
+ testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ vnfResource.setOrchestrationMode(HEAT);
+ vnfResource.setToscaNodeType(testNull(vfNodeTemplate.getType()));
+ vnfResource.setAicVersionMax(
+ testNull(vfNodeTemplate.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));
+
+ return vnfResource;
+ }
+
+ protected AllottedResourceCustomization createAllottedResource(NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStructure, Service service) {
+ AllottedResourceCustomization allottedResourceCustomization = allottedCustomizationRepo
+ .findOneByModelCustomizationUUID(
+ nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ if (allottedResourceCustomization == null) {
+ AllottedResource allottedResource = findExistingAllottedResource(service,
+ nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ if (allottedResource == null) {
+ allottedResource = createAR(nodeTemplate);
+ }
+
+ toscaResourceStructure.setAllottedResource(allottedResource);
+ allottedResourceCustomization = createAllottedResourceCustomization(nodeTemplate, toscaResourceStructure);
+ allottedResourceCustomization.setAllottedResource(allottedResource);
+ allottedResource.getAllotedResourceCustomization().add(allottedResourceCustomization);
+ }
+ return allottedResourceCustomization;
+ }
+
+ protected AllottedResource findExistingAllottedResource(Service service, String modelUUID) {
+ AllottedResource allottedResource = null;
+ for (AllottedResourceCustomization allottedResourceCustom : service.getAllottedCustomizations()) {
+ if (allottedResourceCustom.getAllottedResource() != null
+ && allottedResourceCustom.getAllottedResource().getModelUUID().equals(modelUUID)) {
+ allottedResource = allottedResourceCustom.getAllottedResource();
+ }
+ }
+ if (allottedResource == null) {
+ allottedResource = allottedRepo.findResourceByModelUUID(modelUUID);
+ }
+
+ return allottedResource;
+ }
+
+ protected AllottedResourceCustomization createAllottedResourceCustomization(NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStructure) {
+ AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
+ allottedResourceCustomization.setModelCustomizationUUID(
+ testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ allottedResourceCustomization.setModelInstanceName(nodeTemplate.getName());
+
+ 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<NodeTemplate> vfcNodes = toscaResourceStructure.getSdcCsarHelper()
+ .getVfcListByVf(allottedResourceCustomization.getModelCustomizationUUID());
+
+ if (vfcNodes != null) {
+ for (NodeTemplate vfcNode : vfcNodes) {
+
+ 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"));
+ }
+ }
+
+ CapabilityAssignments arCustomizationCapability = toscaResourceStructure.getSdcCsarHelper()
+ .getCapabilitiesOf(nodeTemplate);
+
+ if (arCustomizationCapability != null) {
+ CapabilityAssignment capAssign = arCustomizationCapability.getCapabilityByName(SCALABLE);
+
+ 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) {
+ AllottedResource allottedResource = new AllottedResource();
+ allottedResource
+ .setModelUUID(testNull(nodeTemplate.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)));
+ 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)));
+ allottedResource
+ .setDescription(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ return allottedResource;
+ }
+
+ protected Set<HeatTemplateParam> extractHeatTemplateParameters(String yamlFile, String artifactUUID) {
+ // Scan the payload downloadResult and extract the HeatTemplate
+ // parameters
+ YamlEditor yamlEditor = new YamlEditor(yamlFile.getBytes());
+ return yamlEditor.getParameterList(artifactUUID);
+ }
+
+ protected String testNull(Object object) {
+
+ if (object == null) {
+ return null;
+ } else if (object.equals("NULL")) {
+ return null;
+ } else if (object instanceof Integer) {
+ return object.toString();
+ } else if (object instanceof String) {
+ return (String) object;
+ } else {
+ return "Type not recognized";
+ }
+ }
+
+ protected static String identifyParentOfNestedTemplate(VfModuleStructure vfModuleStructure,
+ VfModuleArtifact heatNestedArtifact) {
+
+ if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) != null && vfModuleStructure
+ .getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo().getRelatedArtifacts() != null) {
+ for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0)
+ .getArtifactInfo().getRelatedArtifacts()) {
+ if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
+ return ASDCConfiguration.HEAT;
+ }
+
+ }
+ }
+
+ if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL) != null
+ && vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo()
+ .getRelatedArtifacts() != null) {
+ for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL)
+ .get(0).getArtifactInfo().getRelatedArtifacts()) {
+ if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) {
+ return ASDCConfiguration.HEAT_VOL;
+ }
+
+ }
+ }
+
+ // Does not belong to anything
+ return null;
+
+ }
+
+ protected static String createVNFName(VfResourceStructure vfResourceStructure) {
+
+ return vfResourceStructure.getNotification().getServiceName() + "/"
+ + vfResourceStructure.getResourceInstance().getResourceInstanceName();
+ }
+
+ protected static String createVfModuleName(VfModuleStructure vfModuleStructure) {
+
+ return createVNFName(vfModuleStructure.getParentVfResource()) + "::"
+ + vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
+ }
+
+ protected String getPropertyInput(String propertyName) {
+
+ String inputName = new String();
+
+ if (propertyName != null) {
+ int getInputIndex = propertyName.indexOf("{get_input=");
+ if (getInputIndex > -1) {
+ inputName = propertyName.substring(getInputIndex + 11, propertyName.length() - 1);
+ }
+ }
+
+ return inputName;
+ }
+
+
+ protected static Timestamp getCurrentTimeStamp() {
+
+ return new Timestamp(new Date().getTime());
+ }
}
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 de28ca2446..0d75c56c58 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
@@ -323,9 +323,67 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
}
+ buffer.append(System.lineSeparator());
+ buffer.append("VF Module Customization Properties:");
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Customization UUID:");
+ buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID)));
+ buffer.append(System.lineSeparator());
}
+ List<NodeTemplate> vfConfigList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CONFIGURATION);
+
+ if(vfConfigList != null){
+ for (NodeTemplate configNodeTemplate : vfConfigList) {
+
+ buffer.append(System.lineSeparator());
+ buffer.append(System.lineSeparator());
+ buffer.append("Fabric Configuration Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Name:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Description:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("Version:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(System.lineSeparator());
+ buffer.append("InvariantUuid:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Tosca Node Type:");
+ buffer.append(configNodeTemplate.getType());
+
+ buffer.append(System.lineSeparator());
+ buffer.append(System.lineSeparator());
+ buffer.append("Fabric Configuration Customization Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Customization UUID:");
+ buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Instance Name:");
+ buffer.append(configNodeTemplate.getName());
+ buffer.append(System.lineSeparator());
+ buffer.append("NFFunction:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFRole:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFType:");
+ buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(System.lineSeparator());
+
+ }
+ }
+
List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CVFC);
for(NodeTemplate cvfcTemplate : cvfcList) {
@@ -523,6 +581,7 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
}
+
List<Group> groupList = toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(crNode, "org.openecomp.groups.NetworkCollection");
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
new file mode 100644
index 0000000000..c0c66123eb
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
@@ -0,0 +1,442 @@
+/*
+ * ============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.asdc.client;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.ok;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import javax.persistence.EntityNotFoundException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
+import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
+import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
+import org.onap.so.asdc.client.test.emulators.ResourceInfoImpl;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ToscaCsar;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.data.repository.PnfCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.PnfResourceRepository;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
+import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * This is used to run some basic integration test(BIT) for ASDC controller. It will test the csar install and all the
+ * testing csar files are located underneath src/main/resources/download folder,
+ *
+ * PNF csar: service-Testservice140-csar.csar VNF csar: service-Svc140-VF-csar.csar
+ */
+@Transactional
+public class ASDCControllerITTest extends BaseTest {
+
+ private Logger logger = LoggerFactory.getLogger(ASDCControllerITTest.class);
+
+ @Rule
+ public TestName testName = new TestName();
+
+ private String serviceUuid;
+ private String serviceInvariantUuid;
+
+ /**
+ * Random UUID served as distribution UUID.
+ */
+ private String distributionId;
+ private String artifactUuid;
+
+ @Autowired
+ private ASDCController asdcController;
+
+ @Autowired
+ private PnfResourceRepository pnfResourceRepository;
+
+ @Autowired
+ private PnfCustomizationRepository pnfCustomizationRepository;
+
+ @Autowired
+ private VnfResourceRepository vnfResourceRepository;
+
+ @Autowired
+ private VnfCustomizationRepository vnfCustomizationRepository;
+
+ @Autowired
+ private ToscaCsarRepository toscaCsarRepository;
+
+ @Autowired
+ private ServiceRepository serviceRepository;
+
+ private DistributionClientEmulator distributionClient;
+
+ @Before
+ public void setUp() {
+ distributionId = UUID.randomUUID().toString();
+ artifactUuid = UUID.randomUUID().toString();
+ logger.info("Using distributionId: {}, artifactUUID: {} for testcase: {}", distributionId, artifactUuid,
+ testName.getMethodName());
+
+ distributionClient = new DistributionClientEmulator();
+ distributionClient.setResourcePath("src/test/resources");
+ asdcController.setDistributionClient(distributionClient);
+ try {
+ asdcController.initASDC();
+ } catch (ASDCControllerException e) {
+ logger.error(e.getMessage(), e);
+ fail(e.getMessage());
+ }
+ }
+
+ @After
+ public void shutDown() {
+ try {
+ asdcController.closeASDC();
+ } catch (ASDCControllerException e) {
+ logger.error(e.getMessage(), e);
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * Mock the AAI using wireshark.
+ */
+ private void initMockAaiServer(final String serviceUuid, final String serviceInvariantUuid) {
+ String modelEndpoint = "/aai/v15/service-design-and-creation/models/model/" + serviceInvariantUuid
+ + "/model-vers/model-ver/" + serviceUuid + "?depth=0";
+
+ stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok()));
+ }
+
+ /**
+ * Test with service-Testservice140-csar.csar.
+ */
+ @Test
+ public void treatNotification_ValidPnfResource_ExpectedOutput() {
+
+ /**
+ * service UUID/invariantUUID from global metadata in service-Testservice140-template.yml.
+ */
+ String serviceUuid = "efaea486-561f-4159-9191-a8d3cb346728";
+ String serviceInvariantUuid = "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23";
+
+ initMockAaiServer(serviceUuid, serviceInvariantUuid);
+
+ NotificationDataImpl notificationData = new NotificationDataImpl();
+ notificationData.setServiceUUID(serviceUuid);
+ notificationData.setDistributionID(distributionId);
+ notificationData.setServiceInvariantUUID(serviceInvariantUuid);
+ notificationData.setServiceVersion("1.0");
+
+ ResourceInfoImpl resourceInfo = constructPnfResourceInfo();
+ List<ResourceInfoImpl> resourceInfoList = new ArrayList<>();
+ resourceInfoList.add(resourceInfo);
+ notificationData.setResources(resourceInfoList);
+
+ ArtifactInfoImpl artifactInfo = constructPnfServiceArtifact();
+ List<ArtifactInfoImpl> artifactInfoList = new ArrayList<>();
+ artifactInfoList.add(artifactInfo);
+ notificationData.setServiceArtifacts(artifactInfoList);
+
+ try {
+ asdcController.treatNotification(notificationData);
+ logger.info("Checking the database for PNF ingestion");
+
+ /**
+ * Check the tosca csar entity, it should be the same as provided from NotficationData.
+ */
+ ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid)
+ .orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found"));
+ assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID());
+ assertEquals("tosca csar name", "service-Testservice140-csar.csar", toscaCsar.getName());
+ assertEquals("tosca csar version", "1.0", toscaCsar.getVersion());
+ assertNull("tosca csar descrption", toscaCsar.getDescription());
+ assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum());
+ assertEquals("toscar csar URL", "/download/service-Testservice140-csar.csar", toscaCsar.getUrl());
+
+ /**
+ * Check the service entity, it should be the same as global metadata information in service-Testservice140-template.yml inside csar.
+ */
+ Service service = serviceRepository.findById(serviceUuid)
+ .orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found"));
+ assertEquals("model UUID", "efaea486-561f-4159-9191-a8d3cb346728", service.getModelUUID());
+ assertEquals("model name", "TestService140", service.getModelName());
+ assertEquals("model invariantUUID", "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23",
+ service.getModelInvariantUUID());
+ assertEquals("model version", "1.0", service.getModelVersion());
+ assertEquals("description", "Test Service for extended attributes of PNF resource",
+ service.getDescription().trim());
+ assertEquals("tosca csar artifact UUID", artifactUuid, service.getCsar().getArtifactUUID());
+ assertEquals("service type", "Network", service.getServiceType());
+ assertEquals("service role", "nfv", service.getServiceRole());
+ assertEquals("environment context", "General_Revenue-Bearing", service.getEnvironmentContext());
+ assertEquals("service category", "Network Service", service.getCategory());
+ assertNull("workload context", service.getWorkloadContext());
+ assertEquals("resource order", "Test140PNF", service.getResourceOrder());
+
+ /**
+ * Check PNF resource, it should be the same as metadata in the topology template in service-Testservice140-template.yml
+ * OR
+ * global metadata in the resource-Test140pnf-template.yml
+ */
+ String pnfResourceKey = "9c54e269-122b-4e8a-8b2a-6eac849b441a";
+ PnfResource pnfResource = pnfResourceRepository.findById(pnfResourceKey)
+ .orElseThrow(() -> new EntityNotFoundException("PNF resource:" + pnfResourceKey + " not found"));
+ assertNull("orchestration mode", pnfResource.getOrchestrationMode());
+ assertEquals("Description", "Oracle", pnfResource.getDescription().trim());
+ assertEquals("model UUID", pnfResourceKey, pnfResource.getModelUUID());
+ assertEquals("model invariant UUID", "d832a027-75f3-455d-9de4-f02fcdee7e7e",
+ pnfResource.getModelInvariantUUID());
+ assertEquals("model version", "1.0", pnfResource.getModelVersion());
+ assertEquals("model name", "Test140PNF", pnfResource.getModelName());
+ assertEquals("tosca node type", "org.openecomp.resource.pnf.Test140pnf", pnfResource.getToscaNodeType());
+ assertEquals("resource category", "Application L4+", pnfResource.getCategory());
+ assertEquals("resource sub category", "Call Control", pnfResource.getSubCategory());
+
+ /**
+ * Check PNF resource customization, it should be the same as metadata in the topology template in service-Testservice140-template.yml
+ * OR
+ * global metadata in the resource-Test140pnf-template.yml
+ */
+ String pnfCustomizationKey = "428a3d73-f962-4cc2-ba62-2483c45d6b12";
+ PnfResourceCustomization pnfCustomization = pnfCustomizationRepository
+ .findById(pnfCustomizationKey).orElseThrow(
+ () -> new EntityNotFoundException(
+ "PNF resource customization: " + pnfCustomizationKey + " not found"));
+ assertEquals("model customizationUUID", pnfCustomizationKey, pnfCustomization.getModelCustomizationUUID());
+ assertEquals("model instance name", "Test140PNF 0", pnfCustomization.getModelInstanceName());
+ assertEquals("NF type", "", pnfCustomization.getNfType());
+ assertEquals("NF Role", "nf", pnfCustomization.getNfRole());
+ assertEquals("NF function", "nf", pnfCustomization.getNfFunction());
+ assertEquals("NF naming code", "", pnfCustomization.getNfNamingCode());
+ assertEquals("PNF resource model UUID", pnfResourceKey, pnfCustomization.getPnfResources().getModelUUID());
+ assertEquals("Multi stage design", "", pnfCustomization.getMultiStageDesign());
+ assertNull("resource input", pnfCustomization.getResourceInput());
+ assertEquals("cds blueprint name(sdnc_model_name property)", pnfCustomization.getBlueprintName(),
+ pnfCustomization.getBlueprintName());
+ assertEquals("cds blueprint version(sdnc_model_version property)", pnfCustomization.getBlueprintVersion(),
+ pnfCustomization.getBlueprintVersion());
+
+ /**
+ * Check the pnf resource customization with service mapping
+ */
+ List<PnfResourceCustomization> pnfCustList = service.getPnfCustomizations();
+ assertEquals("PNF resource customization entity", 1, pnfCustList.size());
+ assertEquals(pnfCustomizationKey, pnfCustList.get(0).getModelCustomizationUUID());
+
+ } catch (Exception e) {
+ logger.info(e.getMessage(), e);
+ fail(e.getMessage());
+ }
+ }
+
+ private ArtifactInfoImpl constructPnfServiceArtifact() {
+ ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl();
+ artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);
+ artifactInfo.setArtifactURL("/download/service-Testservice140-csar.csar");
+ artifactInfo.setArtifactName("service-Testservice140-csar.csar");
+ artifactInfo.setArtifactVersion("1.0");
+ artifactInfo.setArtifactUUID(artifactUuid);
+ return artifactInfo;
+ }
+
+ /**
+ * Construct the PnfResourceInfo based on the resource-Test140Pnf-template.yml from
+ * service-Testservice140-csar.csar.
+ */
+ private ResourceInfoImpl constructPnfResourceInfo() {
+ ResourceInfoImpl resourceInfo = new ResourceInfoImpl();
+ resourceInfo.setResourceInstanceName("Test140PNF");
+ resourceInfo.setResourceInvariantUUID("d832a027-75f3-455d-9de4-f02fcdee7e7e");
+ resourceInfo.setResoucreType("PNF");
+ resourceInfo.setCategory("Application L4+");
+ resourceInfo.setSubcategory("Call Control");
+ resourceInfo.setResourceUUID("9c54e269-122b-4e8a-8b2a-6eac849b441a");
+ resourceInfo.setResourceCustomizationUUID("428a3d73-f962-4cc2-ba62-2483c45d6b12");
+ resourceInfo.setResourceVersion("1.0");
+ return resourceInfo;
+ }
+
+ /**
+ * Testing with the service-Svc140-VF-csar.csar.
+ */
+ @Test
+ public void treatNotification_ValidVnfResource_ExpectedOutput() {
+
+ /**
+ * service UUID/invariantUUID from global metadata in resource-Testvf140-template.yml.
+ */
+ String serviceUuid = "28944a37-de3f-46ec-9c60-b57036fbd26d";
+ String serviceInvariantUuid = "9e900d3e-1e2e-4124-a5c2-4345734dc9de";
+
+ initMockAaiServer(serviceUuid, serviceInvariantUuid);
+
+ NotificationDataImpl notificationData = new NotificationDataImpl();
+ notificationData.setServiceUUID(serviceUuid);
+ notificationData.setDistributionID(distributionId);
+ notificationData.setServiceInvariantUUID(serviceInvariantUuid);
+ notificationData.setServiceVersion("1.0");
+
+ ResourceInfoImpl resourceInfo = constructVnfResourceInfo();
+ List<ResourceInfoImpl> resourceInfoList = new ArrayList<>();
+ resourceInfoList.add(resourceInfo);
+ notificationData.setResources(resourceInfoList);
+
+ ArtifactInfoImpl artifactInfo = constructVnfServiceArtifact();
+ List<ArtifactInfoImpl> artifactInfoList = new ArrayList<>();
+ artifactInfoList.add(artifactInfo);
+ notificationData.setServiceArtifacts(artifactInfoList);
+
+ try {
+ asdcController.treatNotification(notificationData);
+ logger.info("Checking the database for VNF ingestion");
+
+ /**
+ * Check the tosca csar entity, it should be the same as provided from NotficationData.
+ */
+ ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid)
+ .orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found"));
+ assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID());
+ assertEquals("tosca csar name", "service-Svc140-VF-csar.csar", toscaCsar.getName());
+ assertEquals("tosca csar version", "1.0", toscaCsar.getVersion());
+ assertNull("tosca csar descrption", toscaCsar.getDescription());
+ assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum());
+ assertEquals("toscar csar URL", "/download/service-Svc140-VF-csar.csar", toscaCsar.getUrl());
+
+ /**
+ * Check the service entity, it should be the same as global metadata information in service-Testservice140-template.yml inside csar.
+ */
+ Service service = serviceRepository.findById(serviceUuid)
+ .orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found"));
+ assertEquals("model UUID", serviceUuid, service.getModelUUID());
+ assertEquals("model name", "SVC140", service.getModelName());
+ assertEquals("model invariantUUID", serviceInvariantUuid,
+ service.getModelInvariantUUID());
+ assertEquals("model version", "1.0", service.getModelVersion());
+ assertEquals("description", "SVC140",
+ service.getDescription().trim());
+ assertEquals("tosca csar artifact UUID", artifactUuid, service.getCsar().getArtifactUUID());
+ assertEquals("service type", "ST", service.getServiceType());
+ assertEquals("service role", "Sr", service.getServiceRole());
+ assertEquals("environment context", "General_Revenue-Bearing", service.getEnvironmentContext());
+ assertEquals("service category", "Network Service", service.getCategory());
+ assertNull("workload context", service.getWorkloadContext());
+ assertEquals("resource order", "TestVF140", service.getResourceOrder());
+
+ /**
+ * Check VNF resource, it should be the same as metadata in the topology template in service-Testservice140-template.yml
+ * OR
+ * global metadata in the resource-Testservice140-template.yml
+ */
+ String vnfResourceKey = "d20d3ea9-2f54-4071-8b5c-fd746dde245e";
+ VnfResource vnfResource = vnfResourceRepository.findById(vnfResourceKey)
+ .orElseThrow(() -> new EntityNotFoundException("VNF resource:" + vnfResourceKey + " not found"));
+ assertEquals("orchestration mode", "HEAT", vnfResource.getOrchestrationMode());
+ assertEquals("Description", "TestPNF140", vnfResource.getDescription().trim());
+ assertEquals("model UUID", vnfResourceKey, vnfResource.getModelUUID());
+ assertEquals("model invariant UUID", "7a4bffa2-fac5-4b8b-b348-0bdf313a1aeb",
+ vnfResource.getModelInvariantUUID());
+ assertEquals("model version", "1.0", vnfResource.getModelVersion());
+ assertEquals("model name", "TestVF140", vnfResource.getModelName());
+ assertEquals("tosca node type", "org.openecomp.resource.vf.Testvf140", vnfResource.getToscaNodeType());
+ assertEquals("resource category", "Application L4+", vnfResource.getCategory());
+ assertEquals("resource sub category", "Database", vnfResource.getSubCategory());
+
+ /**
+ * Check VNF resource customization, it should be the same as metadata in the topology template in service-Testservice140-template.yml
+ * OR
+ * global metadata in the resource-Testservice140-template.yml
+ */
+ String vnfCustomizationKey = "ca1c8455-8ce2-4a76-a037-3f4cf01cffa0";
+ VnfResourceCustomization vnfCustomization = vnfCustomizationRepository
+ .findById(vnfCustomizationKey).orElseThrow(
+ () -> new EntityNotFoundException(
+ "VNF resource customization: " + vnfCustomizationKey + " not found"));
+ assertEquals("model customizationUUID", vnfCustomizationKey, vnfCustomization.getModelCustomizationUUID());
+ assertEquals("model instance name", "TestVF140 0", vnfCustomization.getModelInstanceName());
+ assertNull("NF type", vnfCustomization.getNfType());
+ assertNull("NF Role", vnfCustomization.getNfRole());
+ assertNull("NF function", vnfCustomization.getNfFunction());
+ assertNull("NF naming code", vnfCustomization.getNfNamingCode());
+ assertEquals("VNF resource model UUID", vnfResourceKey, vnfCustomization.getVnfResources().getModelUUID());
+ assertEquals("Multi stage design", "false", vnfCustomization.getMultiStageDesign());
+ assertNull("resource input", vnfCustomization.getResourceInput());
+ assertEquals("cds blueprint name(sdnc_model_name property)", vnfCustomization.getBlueprintName(),
+ vnfCustomization.getBlueprintName());
+ assertEquals("cds blueprint version(sdnc_model_version property)", vnfCustomization.getBlueprintVersion(),
+ vnfCustomization.getBlueprintVersion());
+ /**
+ * Check the vnf resource customization with service mapping
+ */
+ List<VnfResourceCustomization> vnfCustList = service.getVnfCustomizations();
+ assertEquals("VNF resource customization entity", 1, vnfCustList.size());
+ assertEquals(vnfCustomizationKey, vnfCustList.get(0).getModelCustomizationUUID());
+ } catch (Exception e) {
+ logger.info(e.getMessage(), e);
+ fail(e.getMessage());
+ }
+ }
+
+ private ArtifactInfoImpl constructVnfServiceArtifact() {
+ ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl();
+ artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);
+ artifactInfo.setArtifactURL("/download/service-Svc140-VF-csar.csar");
+ artifactInfo.setArtifactName("service-Svc140-VF-csar.csar");
+ artifactInfo.setArtifactVersion("1.0");
+ artifactInfo.setArtifactUUID(artifactUuid);
+ return artifactInfo;
+ }
+
+ /**
+ * Construct the PnfResourceInfo based on the resource-Testvf140-template.yml from service-Svc140-VF-csar.csar.
+ */
+ private ResourceInfoImpl constructVnfResourceInfo() {
+ ResourceInfoImpl resourceInfo = new ResourceInfoImpl();
+ resourceInfo.setResourceInstanceName("TestVF140");
+ resourceInfo.setResourceInvariantUUID("7a4bffa2-fac5-4b8b-b348-0bdf313a1aeb");
+ resourceInfo.setResoucreType("VF");
+ resourceInfo.setCategory("Application L4+");
+ resourceInfo.setSubcategory("Database");
+ resourceInfo.setResourceUUID("d20d3ea9-2f54-4071-8b5c-fd746dde245e");
+ resourceInfo.setResourceCustomizationUUID("ca1c8455-8ce2-4a76-a037-3f4cf01cffa0");
+ resourceInfo.setResourceVersion("1.0");
+ resourceInfo.setArtifacts(Collections.EMPTY_LIST);
+ return resourceInfo;
+ }
+}
diff --git a/asdc-controller/src/test/resources/ASDC/.gitignore b/asdc-controller/src/test/resources/ASDC/.gitignore
index e54786bc77..836e68d117 100644
--- a/asdc-controller/src/test/resources/ASDC/.gitignore
+++ b/asdc-controller/src/test/resources/ASDC/.gitignore
@@ -1 +1 @@
-/*.csar
+*.*/*.csar
diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
index caaa5dd3b4..5ba8521b3c 100644
--- a/asdc-controller/src/test/resources/application-test.yaml
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -14,7 +14,7 @@ spring:
initialization-mode: always
jpa:
generate-ddl: false
- show-sql: false
+ show-sql: true
hibernate:
ddl-auto: none
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
@@ -97,3 +97,5 @@ mso:
enabled: false
aai:
endpoint: http://localhost:${wiremock.server.port}
+ config:
+ defaultpath: src/test/resources
diff --git a/asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csar b/asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csar
new file mode 100644
index 0000000000..0de1b0b0a0
--- /dev/null
+++ b/asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/download/service-Testservice140-csar.csar b/asdc-controller/src/test/resources/download/service-Testservice140-csar.csar
new file mode 100644
index 0000000000..bd9a1dc775
--- /dev/null
+++ b/asdc-controller/src/test/resources/download/service-Testservice140-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 43572c476d..1035817c3c 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -399,6 +399,8 @@ create table `vnf_resource_customization` (
`vnf_resource_model_uuid` varchar(200) not null,
`multi_stage_design` varchar(20) default null,
`resource_input` varchar(20000) default null,
+ `cds_blueprint_name` varchar(200) default null,
+ `cds_blueprint_version` varchar(20) default null,
primary key (`model_customization_uuid`),
key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`),
constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade
@@ -833,6 +835,45 @@ CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource` (
+ `ORCHESTRATION_MODE` varchar(20) DEFAULT NULL,
+ `DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODEL_UUID` varchar(200) NOT NULL,
+ `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL,
+ `MODEL_VERSION` varchar(20) NOT NULL,
+ `MODEL_NAME` varchar(200) DEFAULT NULL,
+ `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
+ `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL,
+ `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_UUID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
+ `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` varchar(200) NOT NULL,
+ `NF_TYPE` varchar(200) DEFAULT NULL,
+ `NF_ROLE` varchar(200) DEFAULT NULL,
+ `NF_FUNCTION` varchar(200) DEFAULT NULL,
+ `NF_NAMING_CODE` varchar(200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
+ `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
+ `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
+ KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
+ CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` (
+ `SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`)
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
--------START Request DB SCHEMA --------
CREATE DATABASE requestdb;
USE requestdb;
@@ -1026,6 +1067,7 @@ CREATE TABLE `activate_operational_env_service_model_distribution_status` (
`WORKLOAD_CONTEXT` varchar(80) NOT NULL,
`CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `VNF_OPERATIONAL_ENV_ID` varchar(45) NOT NULL,
PRIMARY KEY (`OPERATIONAL_ENV_ID`,`SERVICE_MODEL_VERSION_ID`,`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
index 4e7c549323..b98e395228 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.ErrorCode
import java.util.regex.Matcher
import java.util.regex.Pattern
@@ -39,7 +40,6 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.aai.AAIVersion
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.openpojo.rules.HasToStringRule
@@ -136,13 +136,13 @@ class AaiUtil {
}else{
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Call AAI Cloud Region is NOT Successful.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
throw new BpmnError("MSOWorkflowException")
}
}catch(Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception occured while getting the Cloud Reqion.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
+ ErrorCode.UnknownError.getValue(), e.getMessage());
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return regionId
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index c700fa70e1..1ceafb6684 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -32,111 +34,15 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIResourcesClient
import org.springframework.web.util.UriUtils
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import groovy.json.JsonSlurper
public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor {
- public MsoUtils utils = new MsoUtils()
-
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- */
- public void logError(String message) {
- log('ERROR', message, null, "true")
- }
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logError(String message, Throwable cause) {
- log('ERROR', message, cause, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- */
- public void logWarn(String message) {
- log('WARN', message, null, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logWarn(String message, Throwable cause) {
- log('WARN', message, cause, "true")
- }
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, String isDebugLogEnabled) {
- log('DEBUG', message, null, isDebugLogEnabled)
- }
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, Throwable cause, String isDebugLogEnabled) {
- log('DEBUG', message, cause, isDebugLogEnabled)
- }
+ private static final Logger logger = LoggerFactory.getLogger( MsoUtils.class);
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, String isLevelEnabled) {
- log(level, message, null, isLevelEnabled)
- }
-
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, Throwable cause, String isLevelEnabled) {
- if (cause == null) {
- utils.log(level, message, isLevelEnabled);
- } else {
- StringWriter stringWriter = new StringWriter();
- PrintWriter printWriter = new PrintWriter(stringWriter);
- printWriter.println(message);
- cause.printStackTrace(printWriter);
- utils.log(level, stringWriter.toString(), isLevelEnabled);
- printWriter.close();
- }
- }
-
- /**
- * Logs a WorkflowException at the ERROR level with the specified message.
- * @param execution the execution
- */
- public void logWorkflowException(DelegateExecution execution, String message) {
- def workflowException = execution.getVariable("WorkflowException")
-
- if (workflowException == null) {
- logError(message);
- } else {
- logError(message + ": " + workflowException)
- }
- }
+ public MsoUtils utils = new MsoUtils()
/**
* Saves the WorkflowException in the execution to the specified variable,
@@ -173,7 +79,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
', requredVariables=' + requiredVariables +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
+ logger.debug('Entered ' + method)
String processKey = getProcessKey(execution)
def prefix = execution.getVariable("prefix")
@@ -236,14 +142,13 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
serviceInstanceId = (String) execution.getVariable("mso-service-instance-id")
}
- utils.logContext(requestId, serviceInstanceId)
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
+ logger.debug('Incoming message: ' + System.lineSeparator() + request)
+ logger.debug('Exited ' + method)
return request
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- logError('Caught exception in ' + method, e)
+ logger.error('Caught exception in {}: {}', method, e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
@@ -259,18 +164,11 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
'execution=' + execution.getId() +
')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
+ logger.debug('Entered ' + method)
String processKey = getProcessKey(execution);
def prefix = execution.getVariable("prefix")
- def requestId =getVariable(execution, "mso-request-id")
- def serviceInstanceId = getVariable(execution, "mso-service-instance-id")
- if(requestId!=null && serviceInstanceId!=null){
- utils.logContext(requestId, serviceInstanceId)
- }
-
-
def request = getVariable(execution, prefix + 'Request')
if (request == null) {
@@ -286,8 +184,8 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def parsed = jsonSlurper.parseText(request)
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
+ logger.debug('Incoming message: ' + System.lineSeparator() + request)
+ logger.debug('Exited ' + method)
return parsed
}
@@ -317,10 +215,10 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
}
if (String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true")) {
- logDebug("Sync response has already been sent for " + processKey, isDebugLogEnabled)
+ logger.debug("Sync response has already been sent for " + processKey)
}else{
- logDebug("Building " + processKey + " response ", isDebugLogEnabled)
+ logger.debug("Building " + processKey + " response ")
int intResponseCode;
@@ -345,11 +243,10 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
execution.setVariable(processKey + "Status", status);
execution.setVariable("WorkflowResponse", response)
- logDebug("Sending response for " + processKey
+ logger.debug("Sending response for " + processKey
+ " ResponseCode=" + intResponseCode
+ " Status=" + status
- + " Response=\n" + response,
- isDebugLogEnabled)
+ + " Response=\n" + response)
// TODO: ensure that this flow was invoked asynchronously?
@@ -370,7 +267,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
}
} catch (Exception ex) {
- logError("Unable to send workflow response to client ....", ex)
+ logger.error("Unable to send workflow response to client ....", ex)
}
}
@@ -440,7 +337,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def element = utils.getNodeXml(xml, elementName, false)
if (element.trim().isEmpty()) {
def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
} else {
return element
@@ -462,7 +359,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def elementText = utils.getNodeText(xml, elementName)
if ((elementText == null) || (elementText.isEmpty())) {
def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
+ logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
} else {
return elementText
@@ -577,9 +474,9 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
String prefix = execution.getVariable('prefix')
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered SetSuccessIndicator Method', isDebugLogEnabled)
+ logger.debug('Entered SetSuccessIndicator Method')
execution.setVariable(prefix+'SuccessIndicator', isSuccess)
- logDebug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '', isDebugLogEnabled)
+ logger.debug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '')
}
/**
@@ -587,14 +484,14 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
*
*/
public void sendSyncError(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String requestId = execution.getVariable("mso-request-id")
- logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled)
+ logger.debug('sendSyncError, requestId: ' + requestId)
WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException")
if (workflowExceptionObj != null) {
String errorMessage = workflowExceptionObj.getErrorMessage()
def errorCode = workflowExceptionObj.getErrorCode()
- logDebug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode, isDebugEnabled)
+ logger.debug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode)
sendWorkflowResponse(execution, errorCode, errorMessage)
}
}
@@ -610,27 +507,26 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
DelegateExecution execution = (DelegateExecution) args[0]
def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')'
- def isDebugEnabled = execution.getVariable('isDebugLogEnabled')
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + classAndMethod, isDebugEnabled)
- logDebug('Received parameters: ' + args, isDebugEnabled)
+ logger.debug('Entered ' + classAndMethod)
+ logger.debug('Received parameters: ' + args)
try{
def methodToCall = this.metaClass.getMetaMethod(methodName, args)
- logDebug('Method to call: ' + methodToCall, isDebugEnabled)
+ logger.debug('Method to call: ' + methodToCall)
methodToCall?.invoke(this, args)
}
catch(BpmnError bpmnError) {
- logDebug('Rethrowing BpmnError ' + bpmnError.getMessage(), isDebugEnabled)
+ logger.debug('Rethrowing BpmnError ' + bpmnError.getMessage())
throw bpmnError
}
catch(Exception e) {
- e.printStackTrace()
- logDebug('Unexpected error encountered - ' + e.getMessage(), isDebugEnabled)
+ logger.debug('Unexpected error encountered - {}', e.getMessage(), e)
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
finally {
- logDebug('Exited ' + classAndMethod, isDebugEnabled)
+ logger.debug('Exited ' + classAndMethod)
}
}
}
@@ -726,8 +622,8 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
def disableRollback = execution.getVariable("disableRollback")
def defaultRollback = UrnPropertiesReader.getVariable("mso.rollback", execution).toBoolean()
- logDebug('disableRollback: ' + disableRollback, isDebugLogEnabled)
- logDebug('defaultRollback: ' + defaultRollback, isDebugLogEnabled)
+ logger.debug('disableRollback: ' + disableRollback)
+ logger.debug('defaultRollback: ' + defaultRollback)
def rollbackEnabled
@@ -735,7 +631,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
// get from default urn settings for mso_rollback
disableRollback = !defaultRollback
rollbackEnabled = defaultRollback
- logDebug('disableRollback is null or empty!', isDebugLogEnabled)
+ logger.debug('disableRollback is null or empty!')
}
else {
if(disableRollback == true) {
@@ -748,9 +644,9 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
rollbackEnabled = defaultRollback
}
}
-
+
execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled)
- logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled)
+ logger.debug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled)
}
public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) {
@@ -760,7 +656,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
execution.setVariable("BasicAuthHeaderValueDB",encodedString)
} catch (IOException ex) {
String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
+ logger.debug(dataErrorMessage)
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
index dec69dfb71..e0e85e9629 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.logger.ErrorCode
import static org.apache.commons.lang3.StringUtils.isBlank;
@@ -40,7 +41,6 @@ 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.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -196,7 +196,7 @@ class AllottedResourceUtils {
getAAIClient().update(uri,allottedResource)
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Exception in updateAR.", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
+ "Exception in updateAR.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage());
exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage())
}
logger.trace("Exit updateAROrchStatus ")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
index 3545361811..4a59b9789a 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
@@ -26,9 +26,9 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.appc.client.lcm.model.Action
-import org.onap.so.client.appc.ApplicationControllerAction;
+import org.onap.so.client.appc.ApplicationControllerAction
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -122,7 +122,7 @@ public class AppCClient extends AbstractServiceTaskProcessor{
catch (BpmnError e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
appcMessage = e.getMessage()
}
execution.setVariable("errorCode", appcCode)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
index 11c2bb265d..d5b0b31a39 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -31,8 +31,9 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
+
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
@@ -50,13 +51,13 @@ class CatalogDbUtils {
private static final Logger logger = LoggerFactory.getLogger( CatalogDbUtils.class);
private HttpClientFactory httpClientFactory
- private MsoUtils msoUtils
- private JsonUtils jsonUtils
+ private MsoUtils utils
+ private JsonUtils jsonUtils
static private String defaultDbAdapterVersion = "v2"
- CatalogDbUtils(HttpClientFactory httpClientFactory, MsoUtils msoUtils, JsonUtils jsonUtils) {
+ CatalogDbUtils(HttpClientFactory httpClientFactory, JsonUtils jsonUtils) {
this.httpClientFactory = httpClientFactory
- this.msoUtils = msoUtils
+ this.utils = new MsoUtils()
this.jsonUtils = jsonUtils
}
@@ -81,7 +82,7 @@ class CatalogDbUtils {
catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in Querying Catalog DB", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
+ ErrorCode.UnknownError.getValue(), e.message);
throw e
}
@@ -104,7 +105,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ logger.error("Exception in Querying Catalog DB: " + e.message)
throw e
}
@@ -119,7 +120,7 @@ class CatalogDbUtils {
catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in Querying Catalog DB", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
+ ErrorCode.UnknownError.getValue(), e.message);
throw e
}
}
@@ -143,7 +144,7 @@ class CatalogDbUtils {
catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in Querying Catalog DB", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
+ ErrorCode.UnknownError.getValue(), e.message);
throw e
}
@@ -169,7 +170,7 @@ class CatalogDbUtils {
catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in Querying Catalog DB", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
+ ErrorCode.UnknownError.getValue(), e.message);
throw e
}
@@ -219,7 +220,7 @@ class CatalogDbUtils {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in parsing Catalog DB Response", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
+ ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfos
@@ -298,7 +299,7 @@ class CatalogDbUtils {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in parsing Catalog DB Response", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
+ ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfos
@@ -352,7 +353,7 @@ class CatalogDbUtils {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in parsing Catalog DB Response", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
+ ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfos
@@ -381,7 +382,7 @@ class CatalogDbUtils {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in parsing Catalog DB Response", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
+ ErrorCode.UnknownError.getValue(), e.message);
}
return serviceResourcesObject
@@ -429,7 +430,7 @@ class CatalogDbUtils {
catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception while parsing model information", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
+ ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfo
}
@@ -487,7 +488,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ logger.error("Exception in Querying Catalog DB: " + e.message)
throw e
}
@@ -499,13 +500,13 @@ class CatalogDbUtils {
String encodedString = null
try {
String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
- msoUtils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
+ logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
- encodedString = msoUtils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable("BasicAuthHeaderValueDB",encodedString)
} catch (IOException ex) {
String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- msoUtils.log("ERROR", dataErrorMessage)
+ logger.error(dataErrorMessage)
}
return encodedString
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
index faa0037169..bf7d07cbb3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 NOKIA.
* ================================================================================
+ * 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
@@ -26,6 +28,6 @@ import org.onap.so.client.HttpClientFactory
public class CatalogDbUtilsFactory {
CatalogDbUtils create() {
- return new CatalogDbUtils(new HttpClientFactory(), new MsoUtils(), new JsonUtils())
+ return new CatalogDbUtils(new HttpClientFactory(), new JsonUtils())
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
index 1c2862e00d..a9e01c7191 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
@@ -24,8 +24,8 @@ package org.onap.so.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -75,7 +75,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
- ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -238,7 +238,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
logger.trace('Exited ' + method)
@@ -271,7 +271,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -309,7 +309,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
index dfe0772cab..6a82512d88 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
@@ -26,6 +26,7 @@ package org.onap.so.bpmn.common.scripts
import joptsimple.internal.Strings
import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.logger.ErrorCode
import org.springframework.http.HttpStatus
import javax.ws.rs.core.UriBuilder
@@ -37,7 +38,6 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -132,7 +132,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
public void handleAAIQueryFailure(DelegateExecution execution) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"),
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
"ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse"));
}
@@ -141,7 +141,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
def errorNotAssociated = "Error occurred - volume group id ${execution.getVariable('CVGN_volumeGroupId')} " +
"is not associated with ${execution.getVariable('CVGN_volumeGroupName')}"
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated)
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
index f2d5a61542..7c1c0a0490 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
@@ -31,8 +31,8 @@ import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -107,7 +107,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing queryAAIForVolumeGroup.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
+ ErrorCode.UnknownError.getValue(), e.getMessage());
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.")
}
logger.trace("COMPLETED queryAAIForVolumeGroup Process ")
@@ -129,7 +129,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing assignVolumeHeatId.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e);
+ ErrorCode.UnknownError.getValue(), e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.")
}
logger.trace("COMPLETED assignVolumeHeatId Process ")
@@ -149,7 +149,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing assignWorkflowException.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e);
+ ErrorCode.UnknownError.getValue(), e);
}
logger.trace("COMPLETED Assign Workflow Exception =")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
index 8bc97f7f40..e9e7d1ed7c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
@@ -32,8 +32,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.db.catalog.beans.OrchestrationStatus
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -63,8 +63,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_moduleExists",false)
execution.setVariable("CAAIVfMod_baseModuleConflict", false)
execution.setVariable("CAAIVfMod_vnfNameFromAAI", null)
-
-
+
+
// CreateAAIVfModule workflow response variable placeholders
execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null)
execution.setVariable("CAAIVfMod_queryGenericVnfResponse","")
@@ -80,14 +80,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CreateAAIVfModuleResponse","")
execution.setVariable("RollbackData", null)
- }
-
+ }
+
// parse the incoming CREATE_VF_MODULE request and store the Generic VNF
// and VF Module data in the flow DelegateExecution
public void preProcessRequest(DelegateExecution execution) {
initProcessVariables(execution)
- def vnfId = execution.getVariable("vnfId")
+ def vnfId = execution.getVariable("vnfId")
if (vnfId == null || vnfId.isEmpty()) {
execution.setVariable("CAAIVfMod_newGenericVnf", true)
execution.setVariable("CAAIVfMod_vnfId","")
@@ -96,14 +96,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_vnfId",vnfId)
}
- def vnfName = execution.getVariable("vnfName")
+ def vnfName = execution.getVariable("vnfName")
execution.setVariable("CAAIVfMod_vnfName", vnfName)
String vnfType = execution.getVariable("vnfType")
execution.setVariable("CAAIVfMod_vnfType", StringUtils.defaultString(vnfType))
execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId"))
-
+
String personaModelId = execution.getVariable("personaModelId")
execution.setVariable("CAAIVfMod_personaId",StringUtils.defaultString(personaModelId))
@@ -219,8 +219,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", 201)
execution.setVariable("CAAIVfMod_createGenericVnfResponse", "Vnf Created")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.")
}
}
@@ -426,7 +425,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
public void handleAAIQueryFailure(DelegateExecution execution) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"),
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue());
int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode")
exceptionUtil.buildAndThrowWorkflowException(execution, code, "Error occurred attempting to query AAI")
@@ -478,7 +477,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error occurred during CreateAAIVfModule flow", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), errorResponse);
+ ErrorCode.UnknownError.getValue(), errorResponse);
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
logger.debug("Workflow exception occurred in CreateAAIVfModule: " + errorResponse)
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
index dc4871119e..7e46784af2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
@@ -121,8 +121,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
execution.setVariable('CAAIVfModVG_getVfModuleResponse', "VF-Module Not found!!")
}
}catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
}
@@ -174,8 +173,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
logger.debug("CreateAAIVfModule Response code: " + 200)
logger.debug("CreateAAIVfModule Response: " + "Success")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PUT: {}', ex.getMessage(), ex)
execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
index e6beac6742..4bce23eff7 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
@@ -27,8 +27,8 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -76,7 +76,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id
// expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist
public void queryAAIForGenericVnf(DelegateExecution execution) {
-
+
def vnfId = execution.getVariable("DAAIVfMod_vnfId")
try {
@@ -112,8 +112,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", 200)
execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "Vnf Deleted")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI DELETE: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf")
}
}
@@ -131,8 +130,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", 200)
execution.setVariable("DAAIVfMod_deleteVfModuleResponse", "Vf Module Deleted")
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule")
}
}
@@ -208,7 +206,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
public void handleAAIQueryFailure(DelegateExecution execution) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"),
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue());
def errorCode = 5000
// set the errorCode to distinguish between a A&AI failure
// and the Generic Vnf Id not found
@@ -255,7 +253,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error occurred during DeleteAAIVfModule flow", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), errorResponse);
+ ErrorCode.UnknownError.getValue(), errorResponse);
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
}
@@ -265,7 +263,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
public void handleDeleteGenericVnfFailure(DelegateExecution execution) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI error occurred deleting the Generic Vnf", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(),
+ ErrorCode.UnknownError.getValue(),
execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"));
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"))
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
index b062974c98..30dbeb09d5 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
@@ -22,6 +22,8 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.ErrorCode
+
import static org.apache.commons.lang3.StringUtils.*
import com.google.common.xml.XmlEscapers
@@ -31,7 +33,6 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -91,7 +92,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
wfex = execution.getVariable("WorkflowException")
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage);
+ ErrorCode.UnknownError.getValue(), wfex.errorMessage);
return wfex
} else {
try {
@@ -104,7 +105,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
logger.debug("mappedErrorMessage " + mappedErrorMessage)
wfex = execution.getVariable("WorkflowException")
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage);
+ ErrorCode.UnknownError.getValue(), wfex.errorMessage);
return wfex
} catch(Exception ex) {
logger.debug("error mapping error, return null: " + ex)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
index d4c5d2f7bb..2ceec3cb44 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
@@ -23,13 +23,13 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.logger.ErrorCode
import java.text.SimpleDateFormat
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -99,7 +99,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
@@ -212,7 +212,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -246,7 +246,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
@@ -277,7 +277,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
@@ -308,7 +308,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
@@ -337,7 +337,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
@@ -357,7 +357,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
@@ -392,7 +392,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
// Do NOT throw WorkflowException!
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
}
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
index 0d39ea15f8..f008130c32 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.common.scripts
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.ErrorCode
import java.io.Serializable;
@@ -42,7 +43,6 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.utils.TargetEntity
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -151,8 +151,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
}
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -161,7 +160,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage())
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
index cf7290a654..27fe33f5ea 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
@@ -20,7 +20,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.scripts;
+package org.onap.so.bpmn.common.scripts
+
+import org.onap.so.logger.ErrorCode;
import static org.apache.commons.lang3.StringUtils.*;
@@ -44,7 +46,6 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.ruby.*
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -290,7 +291,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -341,11 +342,11 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
msg = "BPMN error in createAOTSTicket " + ex.getMessage()
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
} catch (Exception ex){
msg = "Exception in createAOTSTicket " + ex.getMessage()
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
}
logger.trace("Exit createAOTSTicket of ManualHandling ")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
index 10d02686cc..f371ccef4d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
@@ -22,14 +22,14 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.ErrorCode
+
import java.text.SimpleDateFormat
import org.apache.commons.codec.binary.Base64
import org.apache.commons.lang3.StringEscapeUtils
-import org.onap.so.bpmn.core.BPMNLogger
import org.onap.so.bpmn.core.xml.XmlTool
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.utils.CryptoUtils
@@ -88,7 +88,7 @@ class MsoUtils {
}
return nodes
}
-
+
def getNodeXml(xmlInput,element){
return getNodeXml(xmlInput, element, true)
}
@@ -105,7 +105,7 @@ class MsoUtils {
return unescapeNodeContents(nodeToSerialize, nodeAsText)
}
-
+
def unescapeNodeContents(NodeChild node, String text) {
if (!node.childNodes().hasNext()) {
return StringEscapeUtils.unescapeXml(text)
@@ -124,9 +124,9 @@ class MsoUtils {
}
}
-
+
/***** Utilities when using XmlParser *****/
-
+
/**
* Convert a Node into a String by deserializing it and formatting it.
*
@@ -138,12 +138,12 @@ class MsoUtils {
nodeAsString = removeXmlPreamble(nodeAsString)
return formatXml(nodeAsString)
}
-
+
/**
* Get the specified child Node of the specified parent. If there are
* multiple children of the same name, only the first one is returned.
* If there are no children with the specified name, 'null' is returned.
- *
+ *
* @param parent Parent Node in which to find a child.
* @param childNodeName Name of the child Node to get.
* @return the (first) child Node with the specified name or 'null'
@@ -157,11 +157,11 @@ class MsoUtils {
return nodeList.get(0)
}
}
-
+
/**
* Get the textual value of the specified child Node of the specified parent.
* If there are no children with the specified name, 'null' is returned.
- *
+ *
* @param parent Parent Node in which to find a child.
* @param childNodeName Name of the child Node whose value to get.
* @return the textual value of child Node with the specified name or 'null'
@@ -175,11 +175,11 @@ class MsoUtils {
return childNode.text()
}
}
-
+
/**
* Get all of the child nodes from the specified parent that have the
* specified name. The returned NodeList could be empty.
- *
+ *
* @param parent Parent Node in which to find children.
* @param childNodeName Name of the children to get.
* @return a NodeList of all the children from the parent with the specified
@@ -191,14 +191,14 @@ class MsoUtils {
/***** End of Utilities when using XmlParser *****/
-
+
/** these are covered under the common function above**/
def getSubscriberName(xmlInput,element){
def rtn=null
if(xmlInput!=null){
def xml= new XmlSlurper().parseText(xmlInput)
rtn= xml.'**'.find{node->node.name()==element}.text()
- }
+ }
return rtn
}
def getTenantInformation(xmlInput,element){
@@ -226,7 +226,7 @@ class MsoUtils {
}
return ret
}
-
+
def searchMetaDataNode(fxml, searchName, searchValue){
def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue}
if(ret != null){
@@ -234,7 +234,7 @@ class MsoUtils {
}
return ret
}
-
+
// for Trinity L3 add/delete bonding
def getPBGFList(isDebugLogEnabled, xmlInput){
log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled)
@@ -270,20 +270,18 @@ class MsoUtils {
}
myNodes.add(XmlUtil.serialize(nodeToAdd))
}
-
}
}
-
return myNodes
}else{
return null
}
}
-
+
def getPBGFList(xmlInput){
getPBGFList("false", xmlInput)
}
-
+
def getMetaVal(node, name){
try{
return node.'**'.find {it.metaname.text() == name}.metaval.text()
@@ -292,39 +290,20 @@ class MsoUtils {
}
}
- def log(logmode,logtxt,isDebugLogEnabled="false"){
+ def private log(logmode,logtxt,isDebugLogEnabled="false"){
if ("INFO"==logmode) {
- logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN");
+ logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN");
} else if ("WARN"==logmode) {
- // to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method
logger.warn ("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), logtxt);
+ ErrorCode.UnknownError.getValue(), logtxt);
} else if ("ERROR"==logmode) {
- // to see the error text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger error() method
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), logtxt);
-
+ ErrorCode.UnknownError.getValue(), logtxt);
} else {
- BPMNLogger.debug(isDebugLogEnabled, logtxt);
+ logger.debug(logtxt);
}
}
- def logContext(requestId, serviceInstanceId){
-// msoLogger.setLogContext(requestId, serviceInstanceId);
- }
-
- def logMetrics(elapsedTime, logtxt){
-
-// msoLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
-// logtxt, "BPMN", MsoLogger.getServiceName(), null);
- }
-
- def logAudit(logtxt){
- long startTime = System.currentTimeMillis();
-
-// msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt);
- }
-
// headers: header - name-value
def getHeaderNameValue(xmlInput, nameAttribute){
def rtn=null
@@ -334,7 +313,7 @@ class MsoUtils {
}
return rtn
}
-
+
/**
* Gets the children of the specified element.
*/
@@ -353,10 +332,10 @@ class MsoUtils {
}
return out.toString();
}
-
+
/**
* Encodes a value so it can be used inside an XML text element.
- *
+ *
* <b>Will double encode</b>
* @param s the string to encode
* @return the encoded string
@@ -364,7 +343,7 @@ class MsoUtils {
public static String xmlEscape(Object value) {
return XmlTool.encode(value)
}
-
+
/**
* Removes the preamble, if present, from an XML document.
* Also, for historical reasons, this also trims leading and trailing
@@ -412,29 +391,29 @@ class MsoUtils {
public String formatXml(def xml) {
return XmlTool.normalize(xml);
}
-
+
// build single elements
def buildElements(xmlInput, elementList, parentName) {
String var = ""
def xmlBuild = ""
if (parentName != "") {
xmlBuild += "<tns2:"+parentName+">"
- }
+ }
if (xmlInput != null) {
for (element in elementList) {
def xml= new XmlSlurper().parseText(xmlInput)
var = xml.'**'.find {it.name() == element}
if (var != null) {
xmlBuild += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">"
- }
+ }
}
}
if (parentName != "") {
xmlBuild += "</tns2:"+parentName+">"
- }
+ }
return xmlBuild
}
-
+
// build the Unbounded elements
def buildElementsUnbounded(xmlInput, elementList, parentName) {
def varParents = ""
@@ -462,7 +441,7 @@ class MsoUtils {
}
return xmlBuildUnbounded
}
-
+
// Build l2-homing-information
def buildL2HomingInformation(xmlInput) {
def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli","aic-version"]
@@ -472,7 +451,7 @@ class MsoUtils {
}
return rebuildL2Home
}
-
+
// Build internet-evc-access-information
def buildInternetEvcAccessInformation(xmlInput) {
def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"]
@@ -482,7 +461,7 @@ class MsoUtils {
}
return rebuildInternetEvcAccess
}
-
+
// Build ucpe-vms-service-information
def buildUcpeVmsServiceInformation(xmlInput) {
def rebuildUcpeVmsServiceInformation = ''
@@ -514,7 +493,7 @@ class MsoUtils {
log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation)
return rebuildUcpeVmsServiceInformation
}
-
+
// Build internet-service-change-details
def buildInternetServiceChangeDetails(xmlInput) {
def rebuildInternetServiceChangeDetails = ""
@@ -544,33 +523,33 @@ class MsoUtils {
}
}
return rebuildInternetServiceChangeDetails
- }
-
- // Build vr-lan
+ }
+
+ // Build vr-lan
def buildVrLan(xmlInput) {
-
+
def rebuildVrLan = ''
if (xmlInput != null) {
-
+
rebuildVrLan = "<tns2:vr-lan>"
def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim()
rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "")
-
+
// vr-lan-interface
def rebuildVrLanInterface = "<tns2:vr-lan-interface>"
def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim()
rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface)
-
+
// dhcp
def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim()
def rebuildDhcp = buildDhcp(dhcp)
rebuildVrLanInterface += rebuildDhcp
-
+
// pat
def pat = getNodeXml(vrLan, "pat").drop(38).trim()
def rebuildPat = buildPat(pat)
rebuildVrLanInterface += rebuildPat
-
+
// nat
def rebuildNat = ""
try { // optional
@@ -580,31 +559,31 @@ class MsoUtils {
log("ERROR", " Optional - Exception 'nat' ")
}
rebuildVrLanInterface += rebuildNat
-
+
// firewall-lite
def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim()
def rebuildFirewallLite = buildFirewallLite(firewallLite)
rebuildVrLanInterface += rebuildFirewallLite
-
+
// static-routes
def rebuildStaticRoutes = ""
- try { // optional
+ try { // optional
def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim()
rebuildStaticRoutes = buildStaticRoutes(staticRoutes)
} catch (Exception e) {
log("ERROR", " Optional - Exception 'static-routes' ")
}
rebuildVrLanInterface += rebuildStaticRoutes
-
+
rebuildVrLan += rebuildVrLanInterface
rebuildVrLan += "</tns2:vr-lan-interface>"
rebuildVrLan += "</tns2:vr-lan>"
-
+
}
log("DEBUG", " rebuildVrLan - " + rebuildVrLan)
- return rebuildVrLan
+ return rebuildVrLan
}
-
+
// Build vr-lan-interface
def buildVrLanInterfacePartial(xmlInput) {
def rebuildingVrLanInterface = ''
@@ -633,7 +612,7 @@ class MsoUtils {
log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface)
return rebuildingVrLanInterface
}
-
+
// Build dhcp
def buildDhcp(xmlInput) {
def rebuildingDhcp = ''
@@ -703,10 +682,10 @@ class MsoUtils {
log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ")
}
rebuildingDhcp += "</tns2:dhcp>"
- }
+ }
log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp)
return rebuildingDhcp
- }
+ }
// Build pat
def buildPat(xmlInput) {
@@ -727,7 +706,7 @@ class MsoUtils {
log("DEBUG", " rebuildingPat - " + rebuildingPat)
return rebuildingPat
}
-
+
// Build nat
def buildNat(xmlInput) {
def rebuildingNat = ''
@@ -745,19 +724,19 @@ class MsoUtils {
}
log("DEBUG", " rebuildingNat - " + rebuildingNat)
return rebuildingNat
- }
-
+ }
+
// Build firewall-lite
def buildFirewallLite(xmlInput) {
def rebuildingFirewallLite = ''
-
+
if (xmlInput != null) {
-
+
def firewallLiteData = new XmlSlurper().parseText(xmlInput)
rebuildingFirewallLite = "<tns2:firewall-lite>"
def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"]
rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "")
-
+
try { // optional
def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"}
def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size()
@@ -785,7 +764,7 @@ class MsoUtils {
} catch (Exception e) {
log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ")
}
-
+
try { // optional
def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"}
def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size()
@@ -818,7 +797,7 @@ class MsoUtils {
log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite)
return rebuildingFirewallLite
}
-
+
def buildStaticRoutes(xmlInput) {
def rebuildingStaticRoutes = ''
if (xmlInput != null) {
@@ -832,21 +811,21 @@ class MsoUtils {
log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes)
return rebuildingStaticRoutes
}
-
+
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;
}
-
+
public String generateCurrentTimeInGMT(){
final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
final String utcTime = sdf.format(new Date());
return utcTime;
}
-
+
/**
* @param encryptedAuth: encrypted credentials from urn properties
@@ -867,7 +846,7 @@ class MsoUtils {
throw ex
}
}
-
+
def encrypt(toEncrypt, msokey){
try {
String result = CryptoUtils.encrypt(toEncrypt, msokey);
@@ -877,7 +856,7 @@ class MsoUtils {
log("ERROR", "Failed to encrypt credentials")
}
}
-
+
def decrypt(toDecrypt, msokey){
try {
String result = CryptoUtils.decrypt(toDecrypt, msokey);
@@ -888,7 +867,7 @@ class MsoUtils {
throw e
}
}
-
+
/**
* Return URL with qualified host name (if any) or urn mapping
* @param String url from urn mapping
@@ -904,12 +883,12 @@ class MsoUtils {
callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"})
}
}catch(Exception e){
- log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace())
+ logger.debug("Unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: {}", e.getMessage(), e)
}
return callbackUrlToUse
-
+
}
-
+
/**
* Retrieves text context of the element if the element exists, returns empty string otherwise
* @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse
@@ -924,7 +903,7 @@ class MsoUtils {
}
return text
}
-
+
/**
*
* Find the lowest unused module-index value in a given xml
@@ -932,14 +911,14 @@ class MsoUtils {
public String getLowestUnusedIndex(String xml) {
if (xml == null || xml.isEmpty()) {
return "0"
- }
- def moduleIndexList = getMultNodes(xml, "module-index")
- if (moduleIndexList == null || moduleIndexList.size() == 0) {
+ }
+ def moduleIndexList = getMultNodes(xml, "module-index")
+ if (moduleIndexList == null || moduleIndexList.size() == 0) {
return "0"
}
-
+
def sortedModuleIndexList = moduleIndexList.sort{ a, b -> a as Integer <=> b as Integer}
-
+
for (i in 0..sortedModuleIndexList.size()-1) {
if (Integer.parseInt(sortedModuleIndexList[i]) != i) {
return i.toString()
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index cac7a35282..49acf37078 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -195,7 +195,6 @@ class OofHoming extends AbstractServiceTaskProcessor {
try {
String response = execution.getVariable("asyncCallbackResponse")
logger.debug( "OOF Async Callback Response is: " + response)
- utils.logAudit("OOF Async Callback Response is: " + response)
oofUtils.validateCallbackResponse(execution, response)
String placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions")
@@ -378,7 +377,6 @@ class OofHoming extends AbstractServiceTaskProcessor {
}
execution.setVariable("DHVCS_requestId", requestId)
logger.debug( "***** STARTED Homing Subflow for request: " + requestId + " *****")
- utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****")
}
/**
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
index 259808feb6..50c4e56547 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
@@ -38,7 +38,6 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.springframework.web.util.UriUtils
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
index 3a93d48da3..a0da6870ae 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
@@ -29,8 +29,8 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -67,7 +67,7 @@ public void preProcessRequest (DelegateExecution execution) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\''
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -78,7 +78,7 @@ public void preProcessRequest (DelegateExecution execution) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\''
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -89,7 +89,7 @@ public void preProcessRequest (DelegateExecution execution) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\''
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(messageType + '_CORRELATOR', correlator)
@@ -101,7 +101,7 @@ public void preProcessRequest (DelegateExecution execution) {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
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 cf0e35a59f..a7bb707dff 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
@@ -21,14 +21,14 @@
*/
package org.onap.so.bpmn.common.scripts;
-import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.logger.ErrorCode;
import java.text.SimpleDateFormat
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -75,7 +75,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
} catch (IOException ex) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Unable to encode username password string", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
}
// TODO Use variables instead of passing xml request - Huh?
@@ -166,7 +166,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
logger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution))
}catch(Exception e){
- logger.debug('Internal Error occured during PreProcess Method: ', e)
+ logger.debug('Internal Error occured during PreProcess Method: {}', e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code?
}
logger.trace("End pre Process SDNCRequestScript ")
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 fd5dbaea90..69d5f02df5 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
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.ErrorCode
import java.text.SimpleDateFormat
import javax.ws.rs.core.Response
@@ -43,7 +44,6 @@ import org.onap.so.bpmn.core.domain.RollbackData
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
@@ -87,7 +87,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -108,7 +108,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -123,7 +123,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -140,7 +140,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -156,7 +156,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
@@ -165,7 +165,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
}
}
@@ -196,7 +196,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -244,7 +244,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -258,7 +258,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg, e)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -274,9 +274,6 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String prefix = execution.getVariable('prefix')
String callback = execution.getVariable('SDNCAResponse_MESSAGE')
- String requestId = execution.getVariable("mso-request-id");
- String serviceInstanceId = execution.getVariable("mso-service-instance-id")
- utils.logContext(requestId, serviceInstanceId)
logger.debug("Incoming SDNC Rest Callback is: " + callback)
try {
@@ -372,7 +369,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -398,7 +395,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
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 cd86120860..f91bf54edc 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
@@ -22,6 +22,8 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.ErrorCode
+
import java.text.SimpleDateFormat
import java.net.URLEncoder
@@ -38,7 +40,6 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -85,7 +86,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -106,7 +107,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -121,7 +122,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -132,7 +133,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -151,7 +152,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
@@ -160,7 +161,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
}
}
@@ -191,7 +192,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
index 085e82ca24..e6d54b8681 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
@@ -26,11 +26,11 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.L3Network
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.logger.ErrorCode;
import org.springframework.web.util.UriUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -265,7 +265,7 @@ class SDNCAdapterUtils {
if (callbackUrl == null || callbackUrl.trim() == "") {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'mso:workflow:sdncadapter:callback URN is not set', "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
}
@@ -403,7 +403,7 @@ class SDNCAdapterUtils {
if (callbackUrl == null || callbackUrl.trim() == "") {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'mso:workflow:sdncadapter:callback URN is not set', "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
}
@@ -476,7 +476,7 @@ class SDNCAdapterUtils {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error")
}
}
@@ -983,7 +983,7 @@ class SDNCAdapterUtils {
}else {
logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING,
'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ',
- "BPMN", MsoLogger.ErrorCode.UnknownError,
+ "BPMN", ErrorCode.UnknownError,
'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ')
execution.setVariable("L3HLAB_rollback", true)
def msg = trinityExceptionUtil.intDataResponseCode(response, execution)
@@ -993,7 +993,7 @@ class SDNCAdapterUtils {
if (response == null || response.trim().equals("")) {
logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING,
'sdncAdapter workflow response is empty', "BPMN",
- MsoLogger.ErrorCode.UnknownError, 'sdncAdapter workflow response is empty')
+ ErrorCode.UnknownError, 'sdncAdapter workflow response is empty')
execution.setVariable("L3HLAB_rollback", true)
def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution)
exceptionUtil.buildAndThrowWorkflowException(execution, intResponseCode, msg)
@@ -1005,7 +1005,7 @@ class SDNCAdapterUtils {
throw e;
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' +
- 'exception in ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ 'exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable(prefix+"ResponseCode",400)
execution.setVariable("L3HLAB_rollback", true)
def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
index c489778d36..615c977a1e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
@@ -24,8 +24,8 @@ package org.onap.so.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -216,7 +216,7 @@ class TrinityExceptionUtil {
if(message != null) {
execution.setVariable(prefix+"ErrorResponse",message)
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(),
+ ErrorCode.UnknownError.getValue(),
execution.getVariable(prefix+"ErrorResponse"));
return message
} else {
@@ -312,7 +312,7 @@ class TrinityExceptionUtil {
execution.setVariable(prefix+"errTxt", messageTxt)
execution.setVariable(prefix+"errVariables", msgVars)
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(),
+ ErrorCode.UnknownError.getValue(),
execution.getVariable(prefix+"ErrorResponse"));
return message
}catch(Exception ex) {
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index fd45cb5a03..a40bf59097 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -30,8 +30,8 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -183,7 +183,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
if (newPersonaModelId != genericVnf.getModelInvariantId()) {
def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values'
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue())
+ ErrorCode.UnknownError.getValue())
throw new Exception(msg)
}
@@ -206,7 +206,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Construct payload
managementV6AddressEntry = updateGenericVnfNode(origRequest, 'management-v6-address')
}
-
+
// Handle orchestration-status
String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus')
String orchestrationStatusEntry = null
@@ -214,7 +214,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Construct payload
orchestrationStatusEntry = updateGenericVnfNode(origRequest, 'orchestration-status')
}
-
+
org.onap.aai.domain.yang.GenericVnf payload = new org.onap.aai.domain.yang.GenericVnf();
payload.setVnfId(vnfId)
payload.setPersonaModelVersion(personaModelVersionEntry)
@@ -227,8 +227,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
try {
getAAIClient().update(uri,payload)
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PATCH: {}', ex.getMessage(), ex)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PATCH Failed:' + ex.getMessage())
}
@@ -258,9 +257,9 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
return ""
}
else {
- return elementValue
+ return elementValue
}
-
+
}
/**
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
index 92a043e65a..9b12413177 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
@@ -30,7 +30,6 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
index 536d9062c0..c4ef165f63 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
@@ -20,7 +20,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.scripts;
+package org.onap.so.bpmn.common.scripts
+
+import org.onap.so.logger.ErrorCode;
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
@@ -31,7 +33,6 @@ import org.w3c.dom.Node
import org.w3c.dom.NodeList
import org.xml.sax.InputSource
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -111,7 +112,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
'Exception transforming network params to vnfNetworks', "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e);
+ ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e);
}
return vnfNetworks
}
@@ -150,7 +151,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
'Exception transforming params to entries', "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
+ ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
}
return entries
}
@@ -191,7 +192,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
'Exception transforming params to entries', "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
+ ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
}
return entries
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
index 259a7872a3..1960cafb0f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
@@ -69,7 +69,7 @@ class VidUtils {
public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) {
createXmlVolumeRequest(requestMap, action, serviceInstanceId, '')
}
-
+
/**
* Create a volume-request XML using a map
@@ -84,9 +84,9 @@ class VidUtils {
def serviceName = ''
def modelCustomizationName = ''
def asdcServiceModelVersion = ''
-
+
def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback
-
+
def backoutOnFailure = ""
if(suppressRollback != null){
if ( suppressRollback == true) {
@@ -95,7 +95,7 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: ''
def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: ''
def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
@@ -108,16 +108,16 @@ class VidUtils {
modelCustomizationName = it.relatedInstance.modelInfo?.modelInstanceName
}
}
-
+
vnfType = serviceName + '/' + modelCustomizationName
-
+
def userParams = requestMap.requestDetails?.requestParameters?.userParams
def userParamsNode = ''
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: ''
-
+
String xmlReq = """
<volume-request xmlns="http://www.w3.org/2001/XMLSchema">
<request-info>
@@ -145,9 +145,9 @@ class VidUtils {
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
}
-
+
/**
- * A common method that can be used to build volume-params node from a map.
+ * A common method that can be used to build volume-params node from a map.
* @param Map userParams
* @return
*/
@@ -166,9 +166,9 @@ class VidUtils {
}
/**
- * A common method that can be used to extract 'requestDetails'
+ * A common method that can be used to extract 'requestDetails'
* @param String json
- * @return String json requestDetails
+ * @return String json requestDetails
*/
@Deprecated
public getJsonRequestDetails(String jsonInput) {
@@ -183,10 +183,10 @@ class VidUtils {
return rtn
} else {
return rtn
- }
+ }
}
}
-
+
/**
* A common method that can be used to extract 'requestDetails' in Xml
* @param String json
@@ -203,17 +203,17 @@ class VidUtils {
return XmlTool.normalize(XML.toString(jsonObj))
}
}
-
+
/**
* Create a network-request XML using a map
- * @param execution
- * @param xmlRequestDetails - requestDetails in xml
+ * @param execution
+ * @param xmlRequestDetails - requestDetails in xml
* @return
* Note: See latest version: createXmlNetworkRequestInstance()
*/
public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) {
-
+
def requestId = execution.getVariable("requestId")
def serviceInstanceId = execution.getVariable("serviceInstanceId")
def requestAction = execution.getVariable("requestAction")
@@ -225,13 +225,13 @@ class VidUtils {
def instanceName = reqMap.requestDetails.requestInfo.instanceName
def modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationId
if (modelCustomizationId == null) {
- modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ?
+ modelCustomizationId = reqMap.requestDetails.modelInfo.modelCustomizationUuid !=null ?
reqMap.requestDetails.modelInfo.modelCustomizationUuid : ""
}
def modelName = reqMap.requestDetails.modelInfo.modelName
def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId
def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId
- def serviceId = reqMap.requestDetails.requestInfo.productFamilyId
+ def serviceId = reqMap.requestDetails.requestInfo.productFamilyId
def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString()
def backoutOnFailure = "true"
if(suppressRollback != null){
@@ -241,7 +241,7 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
//def userParams = reqMap.requestDetails.requestParameters.userParams
//def userParamsNode = buildUserParams(userParams)
def userParams = reqMap.requestDetails?.requestParameters?.userParams
@@ -249,26 +249,26 @@ class VidUtils {
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
-
+
//'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
def sdncVersion = execution.getVariable("sdncVersion")
-
+
String xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
+ <network-request xmlns="http://www.w3.org/2001/XMLSchema">
+ <request-info>
<request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
- <action>${MsoUtils.xmlEscape(requestAction)}</action>
- <source>VID</source>
+ <action>${MsoUtils.xmlEscape(requestAction)}</action>
+ <source>VID</source>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- </request-info>
+ </request-info>
<network-inputs>
- <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
- <network-name>${MsoUtils.xmlEscape(instanceName)}</network-name>
+ <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
+ <network-name>${MsoUtils.xmlEscape(instanceName)}</network-name>
<network-type>${MsoUtils.xmlEscape(modelName)}</network-type>
- <modelCustomizationId>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationId>
- <aic-cloud-region>${MsoUtils.xmlEscape(lcpCloudRegionId)}</aic-cloud-region>
+ <modelCustomizationId>${MsoUtils.xmlEscape(modelCustomizationId)}</modelCustomizationId>
+ <aic-cloud-region>${MsoUtils.xmlEscape(lcpCloudRegionId)}</aic-cloud-region>
<tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id>
- <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+ <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
<sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
</network-inputs>
@@ -281,8 +281,7 @@ class VidUtils {
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
} catch(Exception e) {
- logger.debug("{} {}", "Error in Vid Utils", e.getCause())
- e.printStackTrace();
+ logger.debug("Error in Vid Utils: {}", e.getCause(), e)
throw e
}
}
@@ -299,7 +298,7 @@ class VidUtils {
def networkModelVersion = ""
def networkModelCustomizationUuid = ""
def networkModelInvariantUuid = ""
-
+
// verify the DB Catalog response JSON structure
def networkModelInfo = execution.getVariable("networkModelInfo")
def jsonSlurper = new JsonSlurper()
@@ -326,14 +325,14 @@ class VidUtils {
} catch (Exception ex) {
throw ex
}
- }
-
+ }
+
def serviceModelUuid = ""
def serviceModelName = ""
def serviceModelVersion = ""
def serviceModelCustomizationUuid = ""
def serviceModelInvariantUuid = ""
-
+
// verify the DB Catalog response JSON structure
def serviceModelInfo = execution.getVariable("serviceModelInfo")
def jsonServiceSlurper = new JsonSlurper()
@@ -361,8 +360,8 @@ class VidUtils {
throw ex
}
}
-
-
+
+
def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : ""
def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : ""
def requestId = execution.getVariable("msoRequestId")
@@ -382,88 +381,88 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
//'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
def sdncVersion = execution.getVariable("sdncVersion")
-
+
def source = "VID"
def action = execution.getVariable("action")
-
+
def userParamsNode = ""
def userParams = execution.getVariable("networkInputParams")
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
-
+
String xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
+ <network-request xmlns="http://www.w3.org/2001/XMLSchema">
+ <request-info>
<request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
- <action>${MsoUtils.xmlEscape(action)}</action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <action>${MsoUtils.xmlEscape(action)}</action>
+ <source>${MsoUtils.xmlEscape(source)}</source>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- </request-info>
- <network-inputs>
- <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
- <network-name>${MsoUtils.xmlEscape(networkName)}</network-name>
+ </request-info>
+ <network-inputs>
+ <network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
+ <network-name>${MsoUtils.xmlEscape(networkName)}</network-name>
<network-type>${MsoUtils.xmlEscape(networkModelName)}</network-type>
<subscription-service-type>${MsoUtils.xmlEscape(subscriptionServiceType)}</subscription-service-type>
<global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
- <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudReqion)}</aic-cloud-region>
+ <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudReqion)}</aic-cloud-region>
<tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id>
- <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+ <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
<failIfExist>${MsoUtils.xmlEscape(failIfExist)}</failIfExist>
<networkModelInfo>
<modelName>${MsoUtils.xmlEscape(networkModelName)}</modelName>
<modelUuid>${MsoUtils.xmlEscape(networkModelUuid)}</modelUuid>
- <modelInvariantUuid>${MsoUtils.xmlEscape(networkModelInvariantUuid)}</modelInvariantUuid>
+ <modelInvariantUuid>${MsoUtils.xmlEscape(networkModelInvariantUuid)}</modelInvariantUuid>
<modelVersion>${MsoUtils.xmlEscape(networkModelVersion)}</modelVersion>
<modelCustomizationUuid>${MsoUtils.xmlEscape(networkModelCustomizationUuid)}</modelCustomizationUuid>
</networkModelInfo>
<serviceModelInfo>
<modelName>${MsoUtils.xmlEscape(serviceModelName)}</modelName>
<modelUuid>${MsoUtils.xmlEscape(serviceModelUuid)}</modelUuid>
- <modelInvariantUuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</modelInvariantUuid>
+ <modelInvariantUuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</modelInvariantUuid>
<modelVersion>${MsoUtils.xmlEscape(serviceModelVersion)}</modelVersion>
<modelCustomizationUuid>${MsoUtils.xmlEscape(serviceModelCustomizationUuid)}</modelCustomizationUuid>
-
- </serviceModelInfo>
- <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
+
+ </serviceModelInfo>
+ <sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
</network-inputs>
<network-params>
${userParamsNode}
- </network-params>
+ </network-params>
</network-request>
"""
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
-
+
}
-
+
/**
* Create a vnf-request XML using a map
- * @param requestMap - map created from VID JSON
+ * @param requestMap - map created from VID JSON
* @param action
* @return
*/
public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) {
-
+
//def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
-
+
//relatedInstanceList.each {
// if (it.relatedInstance.modelInfo.modelType == 'vnf') {
// vnfType = it.relatedInstance.modelInfo.modelName
// vnfId = it.relatedInstance.modelInfo.modelInvariantId
// }
//}
-
+
def vnfName = ''
def asdcServiceModelInfo = ''
-
+
def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList
-
-
+
+
if (relatedInstanceList != null) {
relatedInstanceList.each {
if (it.relatedInstance.modelInfo?.modelType == 'service') {
@@ -474,30 +473,30 @@ class VidUtils {
}
}
}
-
+
def vnfType = execution.getVariable('vnfType')
def vnfId = execution.getVariable('vnfId')
def vfModuleId = execution.getVariable('vfModuleId')
def volumeGroupId = execution.getVariable('volumeGroupId')
def userParams = requestMap.requestDetails?.requestParameters?.userParams
-
-
+
+
def userParamsNode = ''
if(userParams != null) {
userParamsNode = buildUserParams(userParams)
}
-
+
def isBaseVfModule = "false"
if (execution.getVariable('isBaseVfModule') == true) {
isBaseVfModule = "true"
}
-
+
def requestId = execution.getVariable("mso-request-id")
def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: ''
def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: ''
def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback
-
+
def backoutOnFailure = ""
if(suppressRollback != null){
if ( suppressRollback == true) {
@@ -506,14 +505,14 @@ class VidUtils {
backoutOnFailure = "true"
}
}
-
+
def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: ''
def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: ''
def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: ''
def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantUuid ?: ''
def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelUuid ?: ''
def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationUuid ?: ''
-
+
String xmlReq = """
<vnf-request>
<request-info>
@@ -524,17 +523,17 @@ class VidUtils {
</request-info>
<vnf-inputs>
<!-- not in use in 1610 -->
- <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>
+ <vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>
<vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
<vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
<volume-group-id>${MsoUtils.xmlEscape(volumeGroupId)}</volume-group-id>
<vf-module-id>${MsoUtils.xmlEscape(vfModuleId)}</vf-module-id>
- <vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name>
+ <vf-module-name>${MsoUtils.xmlEscape(vfModuleName)}</vf-module-name>
<vf-module-model-name>${MsoUtils.xmlEscape(vfModuleModelName)}</vf-module-model-name>
<model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</model-customization-id>
<is-base-vf-module>${MsoUtils.xmlEscape(isBaseVfModule)}</is-base-vf-module>
<asdc-service-model-version>${MsoUtils.xmlEscape(asdcServiceModelInfo)}</asdc-service-model-version>
- <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region>
+ <aic-cloud-region>${MsoUtils.xmlEscape(aicCloudRegion)}</aic-cloud-region>
<tenant-id>${MsoUtils.xmlEscape(tenantId)}</tenant-id>
<service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
@@ -546,10 +545,10 @@ class VidUtils {
</vnf-params>
</vnf-request>
"""
-
+
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
}
-
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
index d8b2c4f5c0..aacd385a3b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.ErrorCode
import javax.ws.rs.core.Response
import org.apache.commons.lang3.*
@@ -31,7 +32,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
@@ -79,7 +79,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (messageId == null || messageId.isEmpty()) {
String msg = getProcessKey(execution) + ': no messageId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -93,7 +93,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (notificationUrl == null || notificationUrl.isEmpty()) {
String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -107,7 +107,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -125,7 +125,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -138,7 +138,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -147,7 +147,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -161,7 +161,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -170,7 +170,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -184,7 +184,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleRollbackNode == null) {
String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -193,7 +193,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -202,7 +202,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -223,7 +223,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -239,7 +239,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -255,7 +255,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -268,7 +268,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -286,7 +286,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
@@ -294,7 +294,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (IOException ex) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue(), ex);
}
}
@@ -304,7 +304,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -356,7 +356,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} else {
String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -369,7 +369,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -398,7 +398,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
vnfAdapterWorkflowException(execution, callback)
}
} catch (Exception e) {
- logger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e)
+ logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
index 4d74ac374e..c947bf2e65 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
@@ -25,8 +25,8 @@ package org.onap.so.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -88,7 +88,7 @@ class VnfAdapterUtils {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage())
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java
index 2dbf2feaf7..526f5d5288 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java
@@ -35,13 +35,12 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
@@ -185,7 +184,7 @@ public class BpmnRestClient {
logger.trace("request body is {}", jsonReq);
} catch(Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java
index 5352fc2fe0..2cc6415a50 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java
@@ -146,7 +146,7 @@ public abstract class FlowValidatorRunner<S extends FlowValidator, E extends Flo
result.add(klass.newInstance());
}
} catch (InstantiationException | IllegalAccessException e) {
- logger.error("failed to build validator list for " + clazz.getName(), e);
+ logger.error("failed to build validator list for {}", clazz.getName(), e);
throw new RuntimeException(e);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
index 61f92313f7..0de3414381 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
@@ -26,8 +26,8 @@ package org.onap.so.bpmn.common.workflow.context;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.TimeUnit;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -121,7 +121,6 @@ public class WorkflowContextHolder {
while (!isInterrupted()) {
try {
WorkflowContext requestObject = responseQueue.take();
- MsoLogger.setLogContext(requestObject.getRequestId(), null);
logger.debug("Time remaining for request id: {}:{}", requestObject.getRequestId(), requestObject
.getDelay
(TimeUnit.MILLISECONDS));
@@ -132,7 +131,7 @@ public class WorkflowContextHolder {
} catch (Exception e) {
logger.debug("WorkflowContextHolder timeout thread caught exception: ", e);
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread");
+ ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread");
}
}
logger.debug("WorkflowContextHolder timeout thread interrupted, quitting");
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 ba3ab7f315..c6e7668f22 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
@@ -143,8 +143,28 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
private String nfFunction;
@JsonProperty("nf-role")
private String nfRole;
+ @JsonProperty("CDS_BLUEPRINT_NAME")
+ private String blueprintName;
+ @JsonProperty("CDS_BLUEPRINT_VERSION")
+ private String blueprintVersion;
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
public String getNfFunction() {
return nfFunction;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
index 68caeb244f..b432fe10b7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
@@ -13,11 +13,11 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("vnfc")
public class Vnfc implements Serializable {
-
+
/**
*
*/
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -9170269565756850796L;
@Id
@JsonProperty("vnfc-name")
private String vnfcName;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
index 87168107e1..462664c612 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
@@ -34,9 +34,25 @@ public class ModelInfoConfiguration implements Serializable{
private String modelVersionId;
@JsonProperty("model-customization-id")
private String modelCustomizationId;
+ @JsonProperty("configuration-type")
+ private String configurationType;
+ @JsonProperty("configuration-role")
+ private String configurationRole;
@JsonProperty("policy-name")
private String policyName;
+ public String getConfigurationRole() {
+ return configurationRole;
+ }
+ public void setConfigurationRole(String configurationRole) {
+ this.configurationRole = configurationRole;
+ }
+ public String getConfigurationType() {
+ return configurationType;
+ }
+ public void setConfigurationType(String configurationType) {
+ this.configurationType = configurationType;
+ }
public String getModelInvariantId() {
return modelInvariantId;
}
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 0a334cde6f..50a9c4e8b1 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
@@ -505,6 +505,8 @@ public class BBInputSetupMapperLayer {
modelInfoConfiguration.setModelCustomizationId(vnfVfmoduleCvnfcConfigurationCustomization.getModelCustomizationUUID());
modelInfoConfiguration.setModelInvariantId(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID());
modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName());
+ modelInfoConfiguration.setConfigurationType(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationType());
+ modelInfoConfiguration.setConfigurationRole(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationRole());
return modelInfoConfiguration;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index 36a6bf37d9..88ed5d37d9 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -146,7 +146,7 @@ public class BBInputSetupUtils {
}
public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String vnfCustomizationUuid,
- String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) {
+ String vfModuleCustomizationUuid, String cvnfcCustomizationUuid){
return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfCustomizationUuid,
vfModuleCustomizationUuid, cvnfcCustomizationUuid);
}
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 d2d321f8f4..8af6e809f4 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
@@ -46,6 +46,9 @@ 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));
+ }
public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value)
throws BBObjectNotFoundException {
@@ -59,39 +62,39 @@ public class ExtractPojosForBB {
result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value);
break;
case GENERIC_VNF_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getVnfs(), value);
break;
case NETWORK_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getNetworks(), value);
break;
case VOLUME_GROUP_ID:
- vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
result = lookupObjectInList(vnf.getVolumeGroups(), value);
break;
case VF_MODULE_ID:
- vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
result = lookupObjectInList(vnf.getVfModules(), value);
break;
case ALLOTTED_RESOURCE_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getAllottedResources(), value);
break;
case CONFIGURATION_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getConfigurations(), value);
break;
case VPN_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value);
break;
case VPN_BONDING_LINK_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),value);
break;
case INSTANCE_GROUP_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getInstanceGroups(), value);
break;
default:
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
new file mode 100644
index 0000000000..0b2ef928ad
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
@@ -0,0 +1,192 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
+import org.onap.so.client.PreconditionFailedException;
+import org.onap.so.client.RestPropertiesLoader;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.google.protobuf.Struct;
+import com.google.protobuf.Struct.Builder;
+import com.google.protobuf.util.JsonFormat;
+
+import io.grpc.Status;
+
+/**
+ * Util class to support Call to CDS client
+ *
+ */
+@Component
+public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
+
+ private static final Logger logger = LoggerFactory.getLogger(AbstractCDSProcessingBBUtils.class);
+
+ private static final String SUCCESS = "Success";
+ private static final String FAILED = "Failed";
+ private static final String PROCESSING = "Processing";
+
+ private final AtomicReference<String> cdsResponse = new AtomicReference<>();
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ /**
+ * Extracting data from execution object and building the ExecutionServiceInput
+ * Object
+ *
+ * @param execution
+ * DelegateExecution object
+ */
+ public void constructExecutionServiceInputObject(DelegateExecution execution) {
+ logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest ");
+
+ try {
+ AbstractCDSPropertiesBean executionObject = (AbstractCDSPropertiesBean) execution
+ .getVariable("executionObject");
+
+ String payload = executionObject.getRequestObject();
+
+ CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(executionObject.getOriginatorId())
+ .setRequestId(executionObject.getRequestId()).setSubRequestId(executionObject.getSubRequestId())
+ .build();
+ ActionIdentifiers actionIdentifiers = ActionIdentifiers.newBuilder()
+ .setBlueprintName(executionObject.getBlueprintName())
+ .setBlueprintVersion(executionObject.getBlueprintVersion())
+ .setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build();
+
+ Builder struct = Struct.newBuilder();
+ try {
+ JsonFormat.parser().merge(payload, struct);
+ } catch (InvalidProtocolBufferException e) {
+ logger.error("Failed to parse received message. blueprint({}:{}) for action({}). {}",
+ executionObject.getBlueprintVersion(), executionObject.getBlueprintName(),
+ executionObject.getActionName(), e);
+ }
+
+ ExecutionServiceInput executionServiceInput = ExecutionServiceInput.newBuilder()
+ .setCommonHeader(commonHeader).setActionIdentifiers(actionIdentifiers).setPayload(struct.build())
+ .build();
+
+ execution.setVariable("executionServiceInput", executionServiceInput);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * get the executionServiceInput object from execution and send a request to CDS
+ * Client and wait for TIMEOUT period
+ *
+ * @param execution
+ * DelegateExecution object
+ */
+ public void sendRequestToCDSClient(DelegateExecution execution) {
+
+ logger.trace("Start AbstractCDSProcessingBBUtils.sendRequestToCDSClient ");
+ try {
+ CDSProperties props = RestPropertiesLoader.getInstance().getNewImpl(CDSProperties.class);
+ if (props == null) {
+ throw new PreconditionFailedException(
+ "No RestProperty.CDSProperties implementation found on classpath, can't create client.");
+ }
+
+ ExecutionServiceInput executionServiceInput = (ExecutionServiceInput) execution
+ .getVariable("executionServiceInput");
+
+ CDSProcessingListener cdsProcessingListener = new AbstractCDSProcessingBBUtils();
+
+ CDSProcessingClient cdsClient = new CDSProcessingClient(cdsProcessingListener);
+ CountDownLatch countDownLatch = cdsClient.sendRequest(executionServiceInput);
+
+ try {
+ countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ logger.error("Caught exception in sendRequestToCDSClient in AbstractCDSProcessingBBUtils : ", ex);
+ } finally {
+ cdsClient.close();
+ }
+
+ if (cdsResponse != null) {
+ execution.setVariable("CDSStatus", cdsResponse.get());
+ }
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Get Response from CDS Client
+ *
+ */
+ @Override
+ public void onMessage(ExecutionServiceOutput message) {
+ logger.info("Received notification from CDS: {}", message);
+ EventType eventType = message.getStatus().getEventType();
+
+ switch (eventType) {
+
+ case EVENT_COMPONENT_FAILURE:
+ // failed processing with failure
+ cdsResponse.set(FAILED);
+ break;
+ case EVENT_COMPONENT_PROCESSING:
+ // still processing
+ cdsResponse.set(PROCESSING);
+ break;
+ case EVENT_COMPONENT_EXECUTED:
+ // done with async processing
+ cdsResponse.set(SUCCESS);
+ break;
+ default:
+ cdsResponse.set(FAILED);
+ break;
+ }
+
+ }
+
+ /**
+ * On error at CDS, log the error
+ */
+ @Override
+ public void onError(Throwable t) {
+ Status status = Status.fromThrowable(t);
+ logger.error("Failed processing blueprint {}", status, t);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java
new file mode 100644
index 0000000000..4b645984cf
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/AbstractCDSPropertiesBean.java
@@ -0,0 +1,89 @@
+package org.onap.so.client.cds.beans;
+
+import java.io.Serializable;
+
+public class AbstractCDSPropertiesBean implements Serializable {
+
+ private static final long serialVersionUID = -4800522372460352963L;
+
+ private String blueprintName;
+
+ private String blueprintVersion;
+
+ private String requestObject;
+
+ private String originatorId;
+
+ private String requestId;
+
+ private String subRequestId;
+
+ private String actionName;
+
+ private String mode;
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
+ public String getRequestObject() {
+ return requestObject;
+ }
+
+ public void setRequestObject(String requestObject) {
+ this.requestObject = requestObject;
+ }
+
+ public String getOriginatorId() {
+ return originatorId;
+ }
+
+ public void setOriginatorId(String originatorId) {
+ this.originatorId = originatorId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getSubRequestId() {
+ return subRequestId;
+ }
+
+ public void setSubRequestId(String subRequestId) {
+ this.subRequestId = subRequestId;
+ }
+
+ public String getActionName() {
+ return actionName;
+ }
+
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+ }
+
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
+}
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
new file mode 100644
index 0000000000..bdb9161735
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
@@ -0,0 +1,112 @@
+package org.onap.so.client.cds.beans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"service-instance-id",
+"pnf-id",
+"pnf-name",
+"service-model-uuid",
+"pnf-customization-uuid"
+})
+
+public class ConfigAssignPropertiesForPnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("pnf-id")
+ private String pnfId;
+
+ @JsonProperty("pnf-name")
+ private String pnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("pnf-customization-uuid")
+ private String pnfCustomizationUuid;
+
+ @JsonIgnore
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getPnfId() {
+ return pnfId;
+ }
+
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getPnfCustomizationUuid() {
+ return pnfCustomizationUuid;
+ }
+
+ public void setPnfCustomizationUuid(String pnfCustomizationUuid) {
+ this.pnfCustomizationUuid = pnfCustomizationUuid;
+ }
+
+ public Map<String, Object> getUserParam() {
+ return this.userParam;
+ }
+
+ public void setUserParam(String name, Object value) {
+ this.userParam.put(name, value);
+ }
+
+ @Override
+ public String toString() {
+
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+ for (Map.Entry<String, Object> entry : userParam.entrySet()) {
+ sb.append(",");
+ sb.append("\"");
+ sb.append(entry.getKey());
+ sb.append("\"");
+ sb.append(":");
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
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
new file mode 100644
index 0000000000..1ce26d8585
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
@@ -0,0 +1,112 @@
+package org.onap.so.client.cds.beans;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"service-instance-id",
+"vnf-id",
+"vnf-name",
+"service-model-uuid",
+"vnf-customization-uuid"
+})
+
+public class ConfigAssignPropertiesForVnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("vnf-id")
+ private String vnfId;
+
+ @JsonProperty("vnf-name")
+ private String vnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("vnf-customization-uuid")
+ private String vnfCustomizationUuid;
+
+ @JsonIgnore
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getVnfCustomizationUuid() {
+ return vnfCustomizationUuid;
+ }
+
+ public void setVnfCustomizationUuid(String vnfCustomizationUuid) {
+ this.vnfCustomizationUuid = vnfCustomizationUuid;
+ }
+
+ public Map<String, Object> getUserParam() {
+ return this.userParam;
+ }
+
+ public void setUserParam(String name, Object value) {
+ this.userParam.put(name, value);
+ }
+
+ @Override
+ public String toString() {
+
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
+ sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
+ for (Map.Entry<String, Object> entry : userParam.entrySet()) {
+ sb.append(",");
+ sb.append("\"");
+ sb.append(entry.getKey());
+ sb.append("\"");
+ sb.append(":");
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java
new file mode 100644
index 0000000000..b96847f422
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnf.java
@@ -0,0 +1,46 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"config-assign-properties",
+"resolution-key"
+})
+
+public class ConfigAssignRequestPnf {
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+ @JsonProperty("config-assign-properties")
+ private ConfigAssignPropertiesForPnf configAssignPropertiesForPnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigAssignPropertiesForPnf getConfigAssignPropertiesForPnf() {
+ return configAssignPropertiesForPnf;
+ }
+
+ public void setConfigAssignPropertiesForPnf(ConfigAssignPropertiesForPnf configAssignPropertiesForPnf) {
+ this.configAssignPropertiesForPnf = configAssignPropertiesForPnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java
new file mode 100644
index 0000000000..b3a9601e2e
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnf.java
@@ -0,0 +1,45 @@
+
+package org.onap.so.client.cds.beans;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"config-assign-properties",
+"resolution-key"
+})
+public class ConfigAssignRequestVnf {
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+ @JsonProperty("config-assign-properties")
+ private ConfigAssignPropertiesForVnf configAssignPropertiesForVnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigAssignPropertiesForVnf getConfigAssignPropertiesForVnf() {
+ return configAssignPropertiesForVnf;
+ }
+
+ public void setConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignPropertiesForVnf) {
+ this.configAssignPropertiesForVnf = configAssignPropertiesForVnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java
new file mode 100644
index 0000000000..b8fb5b96bd
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnf.java
@@ -0,0 +1,88 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"service-instance-id",
+"pnf-id",
+"pnf-name",
+"service-model-uuid",
+"pnf-customization-uuid"
+})
+
+public class ConfigDeployPropertiesForPnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("pnf-id")
+ private String pnfId;
+
+ @JsonProperty("pnf-name")
+ private String pnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("pnf-customization-uuid")
+ private String pnfCustomizationUuid;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getPnfId() {
+ return pnfId;
+ }
+
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getPnfCustomizationUuid() {
+ return pnfCustomizationUuid;
+ }
+
+ public void setPnfCustomizationUuid(String pnfCustomizationUuid) {
+ this.pnfCustomizationUuid = pnfCustomizationUuid;
+ }
+
+ @Override
+ public String toString() {
+
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java
new file mode 100644
index 0000000000..ca2530b541
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnf.java
@@ -0,0 +1,87 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"service-instance-id",
+"vnf-id",
+"vnf-name",
+"service-model-uuid",
+"vnf-customization-uuid"
+})
+public class ConfigDeployPropertiesForVnf {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("vnf-id")
+ private String vnfId;
+
+ @JsonProperty("vnf-name")
+ private String vnfName;
+
+ @JsonProperty("service-model-uuid")
+ private String serviceModelUuid;
+
+ @JsonProperty("vnf-customization-uuid")
+ private String vnfCustomizationUuid;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public String getServiceModelUuid() {
+ return serviceModelUuid;
+ }
+
+ public void setServiceModelUuid(String serviceModelUuid) {
+ this.serviceModelUuid = serviceModelUuid;
+ }
+
+ public String getVnfCustomizationUuid() {
+ return vnfCustomizationUuid;
+ }
+
+ public void setVnfCustomizationUuid(String vnfCustomizationUuid) {
+ this.vnfCustomizationUuid = vnfCustomizationUuid;
+ }
+
+ @Override
+ public String toString() {
+
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
+ sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
+
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java
new file mode 100644
index 0000000000..4635008d3f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnf.java
@@ -0,0 +1,46 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"config-deploy-properties",
+"resolution-key"
+})
+public class ConfigDeployRequestPnf {
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+
+ @JsonProperty("config-deploy-properties")
+ private ConfigDeployPropertiesForPnf configDeployPropertiesForPnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigDeployPropertiesForPnf getConfigDeployPropertiesForPnf() {
+ return configDeployPropertiesForPnf;
+ }
+
+ public void setConfigDeployPropertiesForPnf(ConfigDeployPropertiesForPnf configDeployPropertiesForPnf) {
+ this.configDeployPropertiesForPnf = configDeployPropertiesForPnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java
new file mode 100644
index 0000000000..53b956d3c4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnf.java
@@ -0,0 +1,46 @@
+package org.onap.so.client.cds.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"config-deploy-properties",
+"resolution-key"
+})
+public class ConfigDeployRequestVnf {
+ @JsonProperty("resolution-key")
+ private String resolutionKey;
+
+ @JsonProperty("config-deploy-properties")
+ private ConfigDeployPropertiesForVnf configDeployPropertiesForVnf;
+
+ public String getResolutionKey() {
+ return resolutionKey;
+ }
+
+ public void setResolutionKey(String resolutionKey) {
+ this.resolutionKey = resolutionKey;
+ }
+
+ public ConfigDeployPropertiesForVnf getConfigDeployPropertiesForVnf() {
+ return configDeployPropertiesForVnf;
+ }
+
+ public void setConfigDeployPropertiesForVnf(ConfigDeployPropertiesForVnf configDeployPropertiesForVnf) {
+ this.configDeployPropertiesForVnf = configDeployPropertiesForVnf;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ return sb.toString();
+ }
+
+}
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 916d24e8dc..cb65f4d420 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
@@ -27,8 +27,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -55,7 +55,7 @@ public class ExceptionBuilder {
}
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString());
+ ErrorCode.UnknownError.getValue(), msg.toString());
execution.setVariable(errorVariable, exception.getMessage());
} catch (Exception ex){
//log trace, allow process to complete gracefully
@@ -84,7 +84,7 @@ public class ExceptionBuilder {
}
}
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg.toString());
+ ErrorCode.UnknownError.getValue(), msg.toString());
execution.setVariable(errorVariable, exception.getMessage());
} catch (Exception ex){
//log trace, allow process to complete gracefully
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
index 1967e5a1ce..d1888b17df 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
@@ -30,6 +30,7 @@ public class CDSPropertiesImpl implements CDSProperties {
private static final String ENDPOINT = "cds.endpoint";
private static final String PORT = "cds.port";
private static final String AUTH = "cds.auth";
+ private static final String TIMEOUT = "cds.timeout";
public CDSPropertiesImpl() {
// Needed for service loader
@@ -74,4 +75,9 @@ public class CDSPropertiesImpl implements CDSProperties {
public boolean mapNotFoundToEmpty() {
return false;
}
+
+ @Override
+ public int getTimeout() {
+ return Integer.parseInt(Objects.requireNonNull(UrnPropertiesReader.getVariable(TIMEOUT)));
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
index d6a7cf0634..d7438f80f9 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Nokia.
* ================================================================================
+ * 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
@@ -51,7 +53,6 @@ class CatalogDbUtilsTest {
private static final String RESPONSE_FROM_CATALOG_DB = "{\"serviceVnfs\": [{\"name\": \"service1\"," +
"\"vfModules\": [{\"name\": \"module1\", \"isBase\":true, \"initialCount\":1}]}]}"
private HttpClientFactory httpClientFactoryMock
- private MsoUtils msoUtilsMock
private JsonUtils jsonUtilsMock
private HttpClient httpClientMock
private DelegateExecutionFake executionFake
@@ -61,11 +62,10 @@ class CatalogDbUtilsTest {
@Before
void setUp() {
httpClientFactoryMock = mock(HttpClientFactory.class)
- msoUtilsMock = mock(MsoUtils.class)
jsonUtilsMock = mock(JsonUtils.class)
httpClientMock = mock(HttpClient.class)
executionFake = new DelegateExecutionFake()
- testedObject = new CatalogDbUtils(httpClientFactoryMock, msoUtilsMock, jsonUtilsMock)
+ testedObject = new CatalogDbUtils(httpClientFactoryMock, jsonUtilsMock)
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
index 21441b9b73..60385a7990 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
@@ -34,7 +34,6 @@ import org.mockito.ArgumentCaptor
import org.mockito.Captor
import org.mockito.MockitoAnnotations
import org.mockito.runners.MockitoJUnitRunner
-import org.onap.so.bpmn.mock.StubResponseAAI
import static org.mockito.Mockito.*
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
index 2bd5181c31..6a4d53654b 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
@@ -37,7 +37,6 @@ import org.mockito.MockitoAnnotations
import org.mockito.runners.MockitoJUnitRunner
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
-import org.onap.so.bpmn.mock.StubResponseAAI
import static com.github.tomakehurst.wiremock.client.WireMock.*
import static org.mockito.ArgumentMatchers.any
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy
index afc180e8a4..75ddca5e98 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy
@@ -85,6 +85,7 @@ public class VnfAdapterRestV1Test {
<volumeGroupId>8a07b246-155e-4b08-b56e-76e98a3c2d66</volumeGroupId>
<volumeGroupStackId>phmaz401me6-vpevre-VOLUMEGROUP/dbd560b6-b03f-4a17-92e7-8942459a60c1</volumeGroupStackId>
<cloudSiteId>mtrnj1b</cloudSiteId>
+ <cloudOwnerId>CloudOwner</cloudOwnerId>
<tenantId>cfb5e0a790374c9a98a1c0d2044206a7</tenantId>
<volumeGroupCreated>true</volumeGroupCreated>
<msoRequest>
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index d5b5cde99b..bf98648dbc 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -352,7 +352,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -370,7 +370,7 @@ public class BuildingBlockTestDataSetup{
Collection collection = null;
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
collection = serviceInstance.getCollection();
if (collection == null) {
@@ -445,7 +445,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -490,7 +490,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -525,7 +525,7 @@ public class BuildingBlockTestDataSetup{
GenericVnf genericVnf = null;
try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
} catch(BBObjectNotFoundException e) {
genericVnf = setGenericVnf();
}
@@ -553,7 +553,7 @@ public class BuildingBlockTestDataSetup{
GenericVnf genericVnf = null;
try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
} catch(BBObjectNotFoundException e) {
genericVnf = setGenericVnf();
}
@@ -617,7 +617,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -684,7 +684,7 @@ public class BuildingBlockTestDataSetup{
configurations.add(config);
ServiceInstance serviceInstance = new ServiceInstance();
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java
deleted file mode 100644
index b9a413fc96..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java
+++ /dev/null
@@ -1,207 +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.mock;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-
-/**
- *
- * Mock Resource which is used to start, stop the WireMock Server
- * Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer
- * You can also selectively setup a stub (use reset before setting up), reset all stubs
- */
-@Path("/server")
-public class MockResource {
-
- private boolean started = false;
- private final Integer defaultPort = 28090;
- private WireMockServer wireMockServer = null;
- private static Map<String,String> mockProperties = new HashMap<>();
-
- public static String getMockProperties(String key) {
- return mockProperties.get(key);
- }
-
- private synchronized void initMockServer(int portNumber) {
- String path = "src/test/resources/" + "__files/sdncSimResponse.xml";
- path = path.substring(0,path.indexOf("__files/"));
-
- wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.onap.so.bpmn.mock.SDNCAdapterMockTransformer")
- .extensions("org.onap.so.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterCreateMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterDeleteMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterUpdateMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterRollbackMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterQueryMockTransformer"));
- //.withRootDirectory(path));
- //Mocks were failing - commenting out for now, both mock and transformers seem to work fine
- WireMock.configureFor("localhost", portNumber);
- wireMockServer.start();
-// StubResponse.setupAllMocks();
- started= true;
- }
-
- public static void main(String [] args) {
- MockResource mockresource = new MockResource();
- mockresource.start(28090);
- mockresource.reset();
-// mockresource.setupStub("MockCreateTenant");
- }
-
- /**
- * Starts the wiremock server in default port
- * @return
- */
- @GET
- @Path("/start")
- @Produces("application/json")
- public Response start() {
- return startMockServer(defaultPort);
- }
-
- private Response startMockServer(int port) {
- if (!started) {
- initMockServer(defaultPort);
- System.out.println("Started Mock Server in port " + port);
- return Response.status(200).entity("Started Mock Server in port " + port).build();
- } else {
- return Response.status(200).entity("Mock Server is already running").build();
- }
- }
-
- /**
- * Starts the wiremock server in a different port
- * @param portNumber
- * @return
- */
- @GET
- @Path("/start/{portNumber}")
- @Produces("application/json")
- public Response start(@PathParam("portNumber") Integer portNumber) {
- if (portNumber == null) portNumber = defaultPort;
- return startMockServer(portNumber);
- }
-
-
- /**
- * Stop the wiremock server
- * @return
- */
- @GET
- @Path("/stop")
- @Produces("application/json")
- public synchronized Response stop() {
- if (wireMockServer.isRunning()) {
- wireMockServer.stop();
- started = false;
- return Response.status(200).entity("Stopped Mock Server in port ").build();
- }
- return Response.status(200).entity("Mock Server is not running").build();
- }
-
-
- /**
- * Return list of mock properties
- * @return
- */
- @GET
- @Path("/properties")
- @Produces("application/json")
- public Response getProperties() {
- return Response.status(200).entity(mockProperties).build();
- }
-
- /**
- * Update a particular mock property at run-time
- * @param name
- * @param value
- * @return
- */
- @POST
- @Path("/properties/{name}/{value}")
- public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) {
- if (mockProperties.size() > 50) return Response.serverError().build();
- mockProperties.put(name, value);
- return Response.status(200).build();
- }
-
- /**
- * Reset all stubs
- * @return
- */
- @GET
- @Path("/reset")
- @Produces("application/json")
- public Response reset() {
- WireMock.reset();
- return Response.status(200).entity("Wiremock stubs are reset").build();
- }
-
-
- /**
- * Setup a stub selectively
- * Prior to use, make sure that stub method is available in StubResponse class
- * @param methodName
- * @return
- */
-
- // commenting for now until we figure out a way to use new StubResponse classes to setupStubs
-// @GET
-// @Path("/stub/{methodName}")
-// @Produces("application/json")
-// public Response setupStub(@PathParam("methodName") String methodName) {
-//
-// @SuppressWarnings("rawtypes")
-// Class params[] = {};
-// Object paramsObj[] = {};
-//
-// try {
-// Method thisMethod = StubResponse.class.getDeclaredMethod(methodName, params);
-// try {
-// thisMethod.invoke(StubResponse.class, paramsObj);
-// } catch (IllegalAccessException | IllegalArgumentException
-// | InvocationTargetException e) {
-// return Response.status(200).entity("Error invoking " + methodName ).build();
-// }
-// } catch (NoSuchMethodException | SecurityException e) {
-// return Response.status(200).entity("Stub " + methodName + " not found...").build();
-// }
-// return Response.status(200).entity("Successfully invoked " + methodName).build();
-// }
-
-
- public static Map<String,String> getMockProperties(){
- return mockProperties;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java
deleted file mode 100644
index 8515307394..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java
+++ /dev/null
@@ -1,156 +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.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.BinaryFile;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-
-/**
- *
- * Simulates SDNC Adapter Callback response
- *
- */
-public class SDNCAdapterAsyncTransformer extends ResponseDefinitionTransformer {
-
- private String syncResponse;
- private String callbackResponseWrapper;
-
- public SDNCAdapterAsyncTransformer() {
- syncResponse = FileUtil.readResourceFile("__files/StandardSDNCSynchResponse.xml");
- callbackResponseWrapper = FileUtil.readResourceFile("__files/sdncCallbackSoapWrapper.xml");
- }
-
- @Override
- public String getName() {
- return "sdnc-adapter-vf-module-assign";
- }
-
- /**
- * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
- * so that callback response can be correlated
- *
- * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
- * the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
-
- System.out.println("responseDefinition: " + responseDefinition);
-
- // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests)
- String sdncResponse = responseDefinition.getBody();
- System.out.println("sdncResponse:" + sdncResponse);
-
- if (sdncResponse == null) {
- // Body wasn't specified. Check for a body file
- String bodyFileName = responseDefinition.getBodyFileName();
- System.out.println("bodyFileName" + bodyFileName);
- if (bodyFileName != null) {
- System.out.println("fileSource Class: " + fileSource.getClass().getName());
- BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName);
- byte[] responseFile = bodyFile.readContents();
- sdncResponse = new String(responseFile);
- System.out.println("sdncResponse(2):" + sdncResponse);
- }
- }
-
- // Next substitute the SDNC response into the callbackResponse (SOAP wrapper).
- // Also, replace the request ID wherever it appears
- String callbackResponse = callbackResponseWrapper.replace("SDNC_RESPONSE_DATA", sdncResponse).replaceAll("SDNC_REQUEST_ID", requestId);
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 2000;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(syncResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.SDNC_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java
deleted file mode 100644
index 11788be76e..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Simulates SDNC Adapter Callback response
- *
- */
-public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterMockTransformer.class);
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterMockTransformer() {
- callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml");
- }
-
- public SDNCAdapterMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "sdnc-adapter-transformer";
- }
-
- /**
- * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
- * so that callback response can be correlated
- *
- * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
- * the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
-
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- logger.info("callbackResponse:" + callbackResponse);
-
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace("testRequestId", requestId);
- }
-
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody("").withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :", e1);
- }
- logger.debug("Sending callback response:" + callbackUrl);
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.SDNC_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
deleted file mode 100644
index 344c3b521d..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterNetworkTopologyMockTransformer.class);
-
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterNetworkTopologyMockTransformer() {
- callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml");
- }
-
- public SDNCAdapterNetworkTopologyMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "network-topology-operation-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource, Parameters parameters) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
- logger.info("request callbackUrl : " + callbackUrl);
- logger.info("request requestId : " + requestId);
-
- logger.info("file path/name : " + responseDefinition.getBodyFileName());
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- // extract Response responseRequestId
- String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>"));
- logger.info("response requestId: " + responseRequestId);
- logger.info("callbackResponse (before): " + callbackResponse);
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- }
- logger.info("callbackResponse (after):" + callbackResponse);
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :", e1);
- }
- logger.debug("Sending callback response to url: {}", callbackUrl);
- try {
- HttpClient client = new HttpClientFactory()
- .newTextXmlClient(UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER);
- Response response = client.post(payLoad);
- logger.debug("Successfully posted callback? Status: {}", response.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.debug("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java
index e0c51b794c..66dc1f9910 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java
@@ -80,29 +80,6 @@ public class StubResponseSDNCAdapter {
.withBodyFile(responseFile)));
}
- public static void mockSDNCAdapterSimulator(String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
public static void mockSDNCAdapterRest() {
stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
.willReturn(aResponse()
@@ -133,17 +110,4 @@ public class StubResponseSDNCAdapter {
.withHeader("Content-Type", "application/json")));
}
- public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withTransformers("network-topology-operation-transformer")
- .withBodyFile(responseFile)));
- }
-
-
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java
index 91ecbd23b4..75283515af 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java
@@ -53,29 +53,6 @@ public class StubResponseVNFAdapter {
.willReturn(aResponse()
.withStatus(500)));
}
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) {
stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java
deleted file mode 100644
index e190535e7e..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java
+++ /dev/null
@@ -1,167 +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.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.BinaryFile;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-
-/**
- *
- * Simulates VNF Adapter Asynch Callback response.
- * This should work for any of the operations.
- *
- * This transformer uses the mapped message as the asynchronous response.
- * By definition, the async API sends a 202 (with no body) in the sync response.
- *
- */
-public class VnfAdapterAsyncTransformer extends ResponseDefinitionTransformer {
-
- public VnfAdapterAsyncTransformer() {
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-async";
- }
-
- /**
- * Grab the incoming request, extract properties to be copied to the response
- * (request id, vnf id, vf module ID, message ID). Then fetch the actual response
- * body from its FileSource, make the replacements.
- *
- * The sync response is an empty 202 response.
- * The transformed mapped response file is sent asynchronously after a delay.
- *
- * Mock Resource can be used to add dynamic properties. If vnf_delay is not in the list by
- * default waits for 5s before the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- // Note: Should recognize both XML and JSON. But current BPMN uses XML.
- String notificationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
-
- String vnfId = requestBody.substring(requestBody.indexOf("<vnfId>")+7, requestBody.indexOf("</vnfId>"));
- String vfModuleId = requestBody.substring(requestBody.indexOf("<vfModuleId>")+12, requestBody.indexOf("</vfModuleId>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String requestId = requestBody.substring(requestBody.indexOf("<requestId>")+11, requestBody.indexOf("</requestId>"));
-
- System.out.println("responseDefinition: " + responseDefinition);
-
- // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests)
- String vnfResponse = responseDefinition.getBody();
- System.out.println("VNF Response:" + vnfResponse);
-
- if (vnfResponse == null) {
- // Body wasn't specified. Check for a body file
- String bodyFileName = responseDefinition.getBodyFileName();
- System.out.println("bodyFileName" + bodyFileName);
- if (bodyFileName != null) {
- System.out.println("fileSource Class: " + fileSource.getClass().getName());
- BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName);
- byte[] responseFile = bodyFile.readContents();
- vnfResponse = new String(responseFile);
- System.out.println("vnfResponse(2):" + vnfResponse);
- }
- }
-
- // Transform the SDNC response to escape < and >
- vnfResponse = vnfResponse.replaceAll ("VNF_ID", vnfId);
- vnfResponse = vnfResponse.replaceAll ("VF_MODULE_ID", vfModuleId);
- vnfResponse = vnfResponse.replaceAll ("REQUEST_ID", requestId);
- vnfResponse = vnfResponse.replaceAll ("MESSAGE_ID", messageId);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 5000;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("notification Url:" + notificationUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(notificationUrl,vnfResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(202).withBody("").withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java
deleted file mode 100644
index 362d9508d3..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterCreateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-create-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before): {}", notifyCallbackResponse);
- logger.info("vnf Response (after): {}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterCreateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :",e1);
- }
- logger.debug("Sending callback response to url: {}", callbackUrl);
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- Response response = client.post(payLoad);
- logger.debug("Successfully posted callback? Status: {}", response.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.debug("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java
deleted file mode 100644
index b67f3dcedd..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterDeleteMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml");
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-delete-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterDeleteMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :",e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java
deleted file mode 100644
index 48ced35810..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterQueryMockTransformer.java class
- *
- */
-
-
-public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterQueryMockTransformer
- .class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterQueryMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml");
- }
-
- public VnfAdapterQueryMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-query-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
-
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterQueryMockTransformer notficationUrl: {}:delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- logger.info("Inside Callback" );
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.debug("Exception :",e);
- }
- }
-
- }
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java
deleted file mode 100644
index edf05422d1..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterRollbackMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterRollbackMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml");
- }
-
- public VnfAdapterRollbackMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-rollback-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterRollbackMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java
deleted file mode 100644
index 5693877574..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterUpdateMockTransformer.java class
- *
- */
-public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterUpdateMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String requestId;
- private String ackResponse;
-
- public VnfAdapterUpdateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml");
- }
-
- public VnfAdapterUpdateMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-update-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterUpdateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :", e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
-
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
index bc41b168ef..5de0903d65 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
@@ -120,30 +120,29 @@ public class ExtractPojosForBBTest extends BaseTest{
customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend);
gBBInput.setCustomer(customer);
- ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc");
+ ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId());
- GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "abc");
+ GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
assertEquals(extractVnfPend.getVnfId(), vnfPend.getVnfId());
- L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID, "abc");
+ L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID);
assertEquals(extractNetworkPend.getNetworkId(), networkPend.getNetworkId());
- VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, "abc");
+ VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
assertEquals(extractVolumeGroupPend.getVolumeGroupId(), volumeGroupPend.getVolumeGroupId());
AllottedResource extractallotedResourcePend = extractPojos.extractByKey(execution,
- ResourceKey.ALLOTTED_RESOURCE_ID, "abc");
+ ResourceKey.ALLOTTED_RESOURCE_ID);
assertEquals(extractallotedResourcePend.getId(), allotedResourcePend.getId());
- Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID,
- "abc");
+ Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
assertEquals(extractConfigurationPend.getConfigurationId(), configurationPend.getConfigurationId());
- VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "abc");
+ VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID);
assertEquals(extractVpnBinding.getVpnId(), vpnBinding.getVpnId());
- VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "abc");
+ VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID);
assertEquals(extractVfModulePend.getVfModuleId(), vfModulePend.getVfModuleId());
- VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "testVpnBondingLink");
+ VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
assertEquals(extractVpnBondingLinkPend.getVpnBondingLinkId(), vpnBondingLinkPend.getVpnBondingLinkId());
- InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, "test-instance-group-1");
+ InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
assertEquals(instanceGroupPend.getId(), extractInstanceGroupPend.getId());
}
@@ -157,7 +156,7 @@ public class ExtractPojosForBBTest extends BaseTest{
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc");
+ extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
}
@Test
@@ -169,7 +168,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
}
@Test
@@ -181,7 +180,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID);
}
@Test
@@ -193,7 +192,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
}
@Test
public void allotedError() throws BBObjectNotFoundException {
@@ -204,7 +203,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID);
}
@Test
public void vpnBindingError() throws BBObjectNotFoundException {
@@ -214,7 +213,7 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.VPN_ID);
}
@Test
@@ -225,6 +224,6 @@ public class ExtractPojosForBBTest extends BaseTest{
ServiceInstance serviceInstance = new ServiceInstance();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "bbb");
+ extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
}
}
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 df9f2259a1..eb26bf34ee 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -43,6 +45,7 @@ import java.util.Map;
import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -2712,5 +2715,24 @@ public class BBInputSetupTest {
assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
}
+
+ @Test
+ public void testGettingVnfcToConfiguration() throws Exception {
+
+ String vnfcName = "vnfcName";
+ org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration();
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ AAIResultWrapper configurationWrapper =
+ new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
+
+ doReturn(new AAIResultWrapper(null)).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri);
+ Vnfc vnfc = SPY_bbInputSetup.getVnfcToConfiguration(vnfcName);
+ Assert.assertNull(vnfc);
+
+ doReturn(configurationWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri);
+ vnfc = SPY_bbInputSetup.getVnfcToConfiguration(vnfcName);
+ Assert.assertNotNull(vnfc);
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
new file mode 100644
index 0000000000..b2812d9bfb
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.UUID;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.mockito.InjectMocks;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+
+@RunWith(JUnit4.class)
+public class AbstractCDSProcessingBBUtilsTest {
+ @InjectMocks
+ private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils = new AbstractCDSProcessingBBUtils();
+ @InjectMocks
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+
+ @Test
+ public void preProcessRequestTest() throws Exception {
+ String requestObject = "{\"config-assign-request\":{\"resolution-key\":\"resolutionKey\", \"config-assign-properties\":{\"service-instance-id\":\"serviceInstanceId\", \"vnf-id\":\"vnfId\", \"vnf-name\":\"vnfName\", \"service-model-uuid\":\"serviceModelUuid\", \"vnf-customization-uuid\":\"vnfCustomizationUuid\",\"Instance1\":\"Instance1Value\",\"Instance2\":\"Instance2Value\",\"Param3\":\"Param3Value\"}}}";
+ String blueprintName = "blueprintName";
+ String blueprintVersion = "blueprintVersion";
+ String actionName = "actionName";
+ String mode = "mode";
+ String requestId = "123456";
+ String originatorId = "originatorId";
+ String subRequestId = UUID.randomUUID().toString();
+
+ abstractCDSPropertiesBean.setActionName(actionName);
+ abstractCDSPropertiesBean.setBlueprintName(blueprintName);
+ abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
+ abstractCDSPropertiesBean.setMode(mode);
+ abstractCDSPropertiesBean.setOriginatorId(originatorId);
+ abstractCDSPropertiesBean.setRequestId(requestId);
+ abstractCDSPropertiesBean.setRequestObject(requestObject);
+ abstractCDSPropertiesBean.setSubRequestId(subRequestId);
+
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable("executionObject")).thenReturn(abstractCDSPropertiesBean);
+
+ abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution);
+ assertTrue(true);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java
new file mode 100644
index 0000000000..c294124e69
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnfTest.java
@@ -0,0 +1,70 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConfigAssignPropertiesForPnfTest {
+ ConfigAssignPropertiesForPnf configAssignPropertiesForPnf = new ConfigAssignPropertiesForPnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+ private String serviceInstanceId;
+ private String pnfId;
+ private String pnfName;
+ private String serviceModelUuid;
+ private String pnfCustomizationUuid;
+
+ @Test
+ public final void testConfigDeployPropertiesForPnfTest() {
+ userParam.put("Instance1", "instance1value");
+ userParam.put("Instance2", "instance2value");
+ configAssignPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configAssignPropertiesForPnf.setPnfId("pnf-id");
+ configAssignPropertiesForPnf.setPnfName("pnf-name");
+ configAssignPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForPnf.setUserParam("Instance1", "instance1value");
+ configAssignPropertiesForPnf.setUserParam("Instance2", "instance2value");
+
+ assertNotNull(configAssignPropertiesForPnf.getPnfCustomizationUuid());
+ assertNotNull(configAssignPropertiesForPnf.getPnfId());
+ assertNotNull(configAssignPropertiesForPnf.getPnfName());
+ assertNotNull(configAssignPropertiesForPnf.getServiceInstanceId());
+ assertNotNull(configAssignPropertiesForPnf.getServiceModelUuid());
+ assertNotNull(configAssignPropertiesForPnf.getUserParam());
+
+ assertEquals("service-instance-id", configAssignPropertiesForPnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configAssignPropertiesForPnf.getServiceModelUuid());
+ assertEquals("pnf-customization-uuid", configAssignPropertiesForPnf.getPnfCustomizationUuid());
+ assertEquals("pnf-id", configAssignPropertiesForPnf.getPnfId());
+ assertEquals("pnf-name", configAssignPropertiesForPnf.getPnfName());
+ assertEquals(userParam, configAssignPropertiesForPnf.getUserParam());
+ }
+
+ @Test
+ public void testtoString() {
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+ for (Map.Entry<String, Object> entry : userParam.entrySet()) {
+ sb.append(",");
+ sb.append("\"");
+ sb.append(entry.getKey());
+ sb.append("\"");
+ sb.append(":");
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ sb.append('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configAssignPropertiesForPnf.toString());
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java
new file mode 100644
index 0000000000..8b732af6d0
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnfTest.java
@@ -0,0 +1,68 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConfigAssignPropertiesForVnfTest {
+ ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+ private String serviceInstanceId;
+ private String vnfId;
+ private String vnfName;
+ private String serviceModelUuid;
+ private String vnfCustomizationUuid;
+
+ @Test
+ public final void testConfigAssignPropertiesForVnfTest() {
+ userParam.put("Instance1", "instance1value");
+ configAssignPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configAssignPropertiesForVnf.setVnfId("vnf-id");
+ configAssignPropertiesForVnf.setVnfName("vnf-name");
+ configAssignPropertiesForVnf.setUserParam("Instance1", "instance1value");
+
+ assertNotNull(configAssignPropertiesForVnf.getServiceInstanceId());
+ assertNotNull(configAssignPropertiesForVnf.getServiceModelUuid());
+ assertNotNull(configAssignPropertiesForVnf.getVnfCustomizationUuid());
+ assertNotNull(configAssignPropertiesForVnf.getVnfId());
+ assertNotNull(configAssignPropertiesForVnf.getVnfName());
+ assertNotNull(configAssignPropertiesForVnf.getUserParam());
+
+ assertEquals("service-instance-id", configAssignPropertiesForVnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configAssignPropertiesForVnf.getServiceModelUuid());
+ assertEquals("vnf-customization-uuid", configAssignPropertiesForVnf.getVnfCustomizationUuid());
+ assertEquals("vnf-id", configAssignPropertiesForVnf.getVnfId());
+ assertEquals("vnf-name", configAssignPropertiesForVnf.getVnfName());
+ assertEquals(userParam, configAssignPropertiesForVnf.getUserParam());
+
+ }
+
+ @Test
+ public void testtoString() {
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
+ sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
+ for (Map.Entry<String, Object> entry : userParam.entrySet()) {
+ sb.append(",");
+ sb.append("\"");
+ sb.append(entry.getKey());
+ sb.append("\"");
+ sb.append(":");
+ sb.append("\"");
+ sb.append(entry.getValue());
+ sb.append("\"");
+ }
+ sb.append('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configAssignPropertiesForVnf.toString());
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java
new file mode 100644
index 0000000000..e4f062ad05
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestPnfTest.java
@@ -0,0 +1,48 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConfigAssignRequestPnfTest {
+ ConfigAssignRequestPnf configAssignRequestPnf = new ConfigAssignRequestPnf();
+ ConfigAssignPropertiesForPnf configAssignPropertiesForPnf = new ConfigAssignPropertiesForPnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+ private String resolutionKey;
+
+ @Test
+ public final void testConfigAssignRequestPnfTest() {
+ configAssignRequestPnf.setResolutionKey("resolution-key");
+ configAssignRequestPnf.setConfigAssignPropertiesForPnf(configAssignPropertiesForPnf);
+ assertNotNull(configAssignRequestPnf.getResolutionKey());
+ assertNotNull(configAssignRequestPnf.getConfigAssignPropertiesForPnf());
+
+ assertEquals("resolution-key", configAssignRequestPnf.getResolutionKey());
+ assertEquals(configAssignPropertiesForPnf, configAssignRequestPnf.getConfigAssignPropertiesForPnf());
+ }
+
+ @Test
+ public void testtoString() {
+ userParam.put("Instance1", "instance1value");
+ configAssignPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configAssignPropertiesForPnf.setPnfId("pnf-id");
+ configAssignPropertiesForPnf.setPnfName("pnf-name");
+ configAssignPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForPnf.setUserParam("user_params", userParam);
+ configAssignRequestPnf.setConfigAssignPropertiesForPnf(configAssignPropertiesForPnf);
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configAssignRequestPnf.toString());
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java
new file mode 100644
index 0000000000..ad3af47453
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigAssignRequestVnfTest.java
@@ -0,0 +1,51 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ConfigAssignRequestVnfTest {
+ ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf();
+ ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
+ private Map<String, Object> userParam = new HashMap<String, Object>();
+
+ private String resolutionKey;
+
+ @Test
+ public final void testConfigAssignRequestVnf() {
+ configAssignRequestVnf.setResolutionKey("resolution-key");
+ configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
+ assertNotNull(configAssignRequestVnf.getResolutionKey());
+ assertNotNull(configAssignRequestVnf.getConfigAssignPropertiesForVnf());
+
+ assertEquals("resolution-key", configAssignRequestVnf.getResolutionKey());
+ assertEquals(configAssignPropertiesForVnf, configAssignRequestVnf.getConfigAssignPropertiesForVnf());
+
+ }
+
+ @Test
+ public void testtoString() {
+ userParam.put("Instance1", "instance1value");
+ configAssignPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configAssignPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configAssignPropertiesForVnf.setUserParam("user_params", userParam);
+ configAssignPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configAssignPropertiesForVnf.setVnfId("vnf-id");
+ configAssignPropertiesForVnf.setVnfName("vnf-name");
+ configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
+
+ final StringBuilder sb = new StringBuilder("{\"config-assign-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-assign-properties\":").append(configAssignPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configAssignRequestVnf.toString());
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java
new file mode 100644
index 0000000000..1d771c86d5
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForPnfTest.java
@@ -0,0 +1,50 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class ConfigDeployPropertiesForPnfTest {
+ ConfigDeployPropertiesForPnf configDeployPropertiesForPnf = new ConfigDeployPropertiesForPnf();
+ private String serviceInstanceId;
+ private String pnfId;
+ private String pnfName;
+ private String serviceModelUuid;
+ private String pnfCustomizationUuid;
+
+ @Test
+ public final void testConfigDeployPropertiesForPnfTest() {
+ configDeployPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configDeployPropertiesForPnf.setPnfId("pnf-id");
+ configDeployPropertiesForPnf.setPnfName("pnf-name");
+ assertNotNull(configDeployPropertiesForPnf.getServiceInstanceId());
+ assertNotNull(configDeployPropertiesForPnf.getServiceModelUuid());
+ assertNotNull(configDeployPropertiesForPnf.getPnfCustomizationUuid());
+ assertNotNull(configDeployPropertiesForPnf.getPnfId());
+ assertNotNull(configDeployPropertiesForPnf.getPnfName());
+
+ assertEquals("service-instance-id", configDeployPropertiesForPnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configDeployPropertiesForPnf.getServiceModelUuid());
+ assertEquals("pnf-customization-uuid", configDeployPropertiesForPnf.getPnfCustomizationUuid());
+ assertEquals("pnf-id", configDeployPropertiesForPnf.getPnfId());
+ assertEquals("pnf-name", configDeployPropertiesForPnf.getPnfName());
+
+ }
+
+ @Test
+ public void testtoString() {
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"pnf-id\":").append("\"").append(pnfId).append("\"");
+ sb.append(", \"pnf-name\":").append("\"").append(pnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"pnf-customization-uuid\":").append("\"").append(pnfCustomizationUuid).append("\"");
+ sb.append('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configDeployPropertiesForPnf.toString());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java
new file mode 100644
index 0000000000..47c59b93e9
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployPropertiesForVnfTest.java
@@ -0,0 +1,49 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class ConfigDeployPropertiesForVnfTest {
+ ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
+ private String serviceInstanceId;
+ private String vnfId;
+ private String vnfName;
+ private String serviceModelUuid;
+ private String vnfCustomizationUuid;
+
+ @Test
+ public final void testConfigDeployPropertiesForVnf() {
+ configDeployPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configDeployPropertiesForVnf.setVnfId("vnf-id");
+ configDeployPropertiesForVnf.setVnfName("vnf-name");
+ assertNotNull(configDeployPropertiesForVnf.getServiceInstanceId());
+ assertNotNull(configDeployPropertiesForVnf.getServiceModelUuid());
+ assertNotNull(configDeployPropertiesForVnf.getVnfCustomizationUuid());
+ assertNotNull(configDeployPropertiesForVnf.getVnfId());
+ assertNotNull(configDeployPropertiesForVnf.getVnfName());
+
+ assertEquals("service-instance-id", configDeployPropertiesForVnf.getServiceInstanceId());
+ assertEquals("service-model-uuid", configDeployPropertiesForVnf.getServiceModelUuid());
+ assertEquals("vnf-customization-uuid", configDeployPropertiesForVnf.getVnfCustomizationUuid());
+ assertEquals("vnf-id", configDeployPropertiesForVnf.getVnfId());
+ assertEquals("vnf-name", configDeployPropertiesForVnf.getVnfName());
+ }
+
+ @Test
+ public void testtoString() {
+ final StringBuilder sb = new StringBuilder("{");
+ sb.append("\"service-instance-id\":").append("\"").append(serviceInstanceId).append("\"");
+ sb.append(", \"vnf-id\":").append("\"").append(vnfId).append("\"");
+ sb.append(", \"vnf-name\":").append("\"").append(vnfName).append("\"");
+ sb.append(", \"service-model-uuid\":").append("\"").append(serviceModelUuid).append("\"");
+ sb.append(", \"vnf-customization-uuid\":").append("\"").append(vnfCustomizationUuid).append("\"");
+ sb.append('}');
+ String Expexted = sb.toString();
+ assertEquals(Expexted, configDeployPropertiesForVnf.toString());
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java
new file mode 100644
index 0000000000..df41bf23b8
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestPnfTest.java
@@ -0,0 +1,41 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class ConfigDeployRequestPnfTest {
+ ConfigDeployRequestPnf configDeployRequestPnf = new ConfigDeployRequestPnf();
+ private String resolutionKey;
+ ConfigDeployPropertiesForPnf configDeployPropertiesForPnf = new ConfigDeployPropertiesForPnf();
+
+ @Test
+ public final void testConfigDeployRequestVnf() {
+ configDeployRequestPnf.setResolutionKey("resolution-key");
+ configDeployRequestPnf.setConfigDeployPropertiesForPnf(configDeployPropertiesForPnf);
+ assertNotNull(configDeployRequestPnf.getResolutionKey());
+ assertNotNull(configDeployRequestPnf.getConfigDeployPropertiesForPnf());
+ assertEquals("resolution-key", configDeployRequestPnf.getResolutionKey());
+ assertEquals(configDeployPropertiesForPnf, configDeployRequestPnf.getConfigDeployPropertiesForPnf());
+ }
+
+ @Test
+ public void testtoString() {
+ configDeployPropertiesForPnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForPnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForPnf.setPnfCustomizationUuid("pnf-customization-uuid");
+ configDeployPropertiesForPnf.setPnfId("pnf-id");
+ configDeployPropertiesForPnf.setPnfName("pnf-name");
+ configDeployRequestPnf.setConfigDeployPropertiesForPnf(configDeployPropertiesForPnf);
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForPnf.toString());
+ sb.append('}');
+ sb.append('}');
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configDeployRequestPnf.toString());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java
new file mode 100644
index 0000000000..f771710f8b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/beans/ConfigDeployRequestVnfTest.java
@@ -0,0 +1,42 @@
+package org.onap.so.client.cds.beans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class ConfigDeployRequestVnfTest {
+
+ ConfigDeployRequestVnf configDeployRequestVnf = new ConfigDeployRequestVnf();
+ private String resolutionKey;
+ ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
+
+ @Test
+ public final void testConfigDeployRequestVnf() {
+ configDeployRequestVnf.setResolutionKey("resolution-key");
+ configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
+ assertNotNull(configDeployRequestVnf.getResolutionKey());
+ assertNotNull(configDeployRequestVnf.getConfigDeployPropertiesForVnf());
+ assertEquals("resolution-key", configDeployRequestVnf.getResolutionKey());
+ assertEquals(configDeployPropertiesForVnf, configDeployRequestVnf.getConfigDeployPropertiesForVnf());
+ }
+
+ @Test
+ public void testtoString() {
+ configDeployPropertiesForVnf.setServiceInstanceId("service-instance-id");
+ configDeployPropertiesForVnf.setServiceModelUuid("service-model-uuid");
+ configDeployPropertiesForVnf.setVnfCustomizationUuid("vnf-customization-uuid");
+ configDeployPropertiesForVnf.setVnfId("vnf-id");
+ configDeployPropertiesForVnf.setVnfName("vnf-name");
+ configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
+ final StringBuilder sb = new StringBuilder("{\"config-deploy-request\":{");
+ sb.append("\"resolution-key\":").append("\"").append(resolutionKey).append("\"");
+ sb.append(", \"config-deploy-properties\":").append(configDeployPropertiesForVnf.toString());
+ sb.append('}');
+ sb.append('}');
+ String Expexted = sb.toString();
+
+ assertEquals(Expexted, configDeployRequestVnf.toString());
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java
index 6166071437..fb794e251d 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,6 +23,8 @@
package org.onap.so.bpmn.core;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Used in the output variable mapping configuration of subflow call activity
@@ -36,6 +40,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
*/
public class ResponseBuilder implements java.io.Serializable {
private static final long serialVersionUID = 1L;
+ private static final Logger logger = LoggerFactory.getLogger(ResponseBuilder.class);
/**
* Creates a WorkflowException using data from the execution variables.
@@ -48,28 +53,28 @@ public class ResponseBuilder implements java.io.Serializable {
String method = getClass().getSimpleName() + ".buildWorkflowException(" +
"execution=" + execution.getId() +
")";
- String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled");
- logDebug("Entered " + method, isDebugLogEnabled);
-
+
+ logger.debug("Entered " + method);
+
String prefix = (String) execution.getVariable("prefix");
String processKey = getProcessKey(execution);
- logDebug("processKey=" + processKey, isDebugLogEnabled);
+ logger.debug("processKey=" + processKey);
// See if there"s already a WorkflowException object in the execution.
WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException");
if (theException != null) {
- logDebug("Exited " + method + " - propagated " + theException, isDebugLogEnabled);
+ logger.debug("Exited " + method + " - propagated " + theException);
return theException;
}
-
+
// Look in the legacy variables: ErrorResponse and ResponseCode
String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null);
String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null);
- logDebug("errorResponse=" + errorResponse, isDebugLogEnabled);
- logDebug("responseCode=" + responseCode, isDebugLogEnabled);
+ logger.debug("errorResponse=" + errorResponse);
+ logger.debug("responseCode=" + responseCode);
if (errorResponse != null || !isOneOf(responseCode, null, "0", "200", "201", "202", "204")) {
// This is an error condition. We need to return a WorkflowExcpetion
@@ -93,8 +98,8 @@ public class ResponseBuilder implements java.io.Serializable {
String xmlErrorCode = trimString(getXMLTextElement(maybeXML, "ErrorCode"), null);
if (xmlErrorMessage != null || xmlErrorCode != null) {
- logDebug("xmlErrorMessage=" + xmlErrorMessage, isDebugLogEnabled);
- logDebug("xmlErrorCode=" + xmlErrorCode, isDebugLogEnabled);
+ logger.debug("xmlErrorMessage=" + xmlErrorMessage);
+ logger.debug("xmlErrorCode=" + xmlErrorCode);
if (xmlErrorMessage == null) {
errorResponse = "Received error code " + xmlErrorCode + " from " + processKey;
@@ -135,27 +140,26 @@ public class ResponseBuilder implements java.io.Serializable {
theException = new WorkflowException(processKey, intResponseCode, errorResponse);
execution.setVariable("WorkflowException", theException);
- logDebug("Exited " + method + " - created " + theException, isDebugLogEnabled);
+ logger.debug("Exited " + method + " - created " + theException);
return theException;
}
- logDebug("Exited " + method + " - no WorkflowException", isDebugLogEnabled);
+ logger.debug("Exited " + method + " - no WorkflowException");
return null;
}
-
+
/**
* Returns the "Response" variable, unless the execution variables
* indicate there was an error. In that case, null is returned.
* @param execution the execution
*/
public Object buildWorkflowResponse(DelegateExecution execution) {
-
+
String method = getClass().getSimpleName() + ".buildWorkflowResponse(" +
"execution=" + execution.getId() +
")";
- String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled");
- logDebug("Entered " + method, isDebugLogEnabled);
-
+ logger.debug("Entered " + method);
+
String prefix = (String) execution.getVariable("prefix");
String processKey = getProcessKey(execution);
@@ -169,16 +173,16 @@ public class ResponseBuilder implements java.io.Serializable {
isOneOf(responseCode, null, "0", "200", "201", "202", "204")) {
theResponse = execution.getVariable("WorkflowResponse");
-
+
if (theResponse == null) {
theResponse = execution.getVariable(processKey + "Response");
}
}
- logDebug("Exited " + method, isDebugLogEnabled);
+ logger.debug("Exited " + method);
return theResponse;
}
-
+
/**
* Checks if the specified item is one of the specified values.
* @param item the item
@@ -201,10 +205,10 @@ public class ResponseBuilder implements java.io.Serializable {
}
}
}
-
+
return false;
}
-
+
/**
* Creates a string value of the specified object, trimming whitespace in
* the process. If the result is null or empty, the specified empty string
@@ -221,7 +225,7 @@ public class ResponseBuilder implements java.io.Serializable {
String s = String.valueOf(object).trim();
return s.equals("") ? emptyStringValue : s;
}
-
+
/**
* Returns the process definition key (i.e. the process name) from the
* execution.
@@ -237,16 +241,7 @@ public class ResponseBuilder implements java.io.Serializable {
return execution.getProcessEngineServices().getRepositoryService()
.getProcessDefinition(execution.getProcessDefinitionId()).getKey();
}
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- private void logDebug(String message, String isDebugLogEnabled) {
- BPMNLogger.debug(isDebugLogEnabled, message);
- }
-
+
/**
* Removes namespace definitions and prefixes from XML, if any.
*/
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
index a83337fc5b..5271bb3c53 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
@@ -22,13 +22,17 @@ package org.onap.so.bpmn.core.domain;
import static org.junit.Assert.*;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
public class VnfResourceTest {
-
+
+ private final static String ALL_VF_MODULES_JSON =
+ "{\"ArrayList\":[{\"resourceType\":\"MODULE\",\"resourceInstance\":{},\"homingSolution\":{\"license\":{},\"rehome\":false},\"vfModuleName\":\"vfModuleName\",\"vfModuleType\":\"vfModuleType\",\"heatStackId\":\"heatStackId\",\"hasVolumeGroup\":true,\"isBase\":true,\"vfModuleLabel\":\"vfModuleLabel\",\"initialCount\":0},{\"resourceType\":\"MODULE\",\"resourceInstance\":{},\"homingSolution\":{\"license\":{},\"rehome\":false},\"vfModuleName\":\"vfModuleName\",\"vfModuleType\":\"vfModuleType\",\"heatStackId\":\"heatStackId\",\"hasVolumeGroup\":true,\"isBase\":true,\"vfModuleLabel\":\"vfModuleLabel\",\"initialCount\":0}]}";
+
private VnfResource vnf= new VnfResource();
List<ModuleResource> moduleResources;
@@ -63,4 +67,34 @@ public class VnfResourceTest {
assertTrue(vnfResource != null);
}
+ @Test
+ public void testVfModules() {
+
+ moduleResources = new ArrayList<>();
+
+ ModuleResource moduleresource = new ModuleResource();
+ moduleresource.setVfModuleName("vfModuleName");
+ moduleresource.setHeatStackId("heatStackId");
+ moduleresource.setIsBase(true);
+ moduleresource.setVfModuleLabel("vfModuleLabel");
+ moduleresource.setInitialCount(0);
+ moduleresource.setVfModuleType("vfModuleType");
+ moduleresource.setHasVolumeGroup(true);
+
+ moduleResources.add(moduleresource);
+
+ vnf.setModules(moduleResources);
+ assertEquals(vnf.getVfModules(), moduleResources);
+
+ List<ModuleResource> moduleResources = vnf.getAllVfModuleObjects();
+ assertEquals(1, moduleResources.size());
+
+ vnf.addVfModule(moduleresource);
+ moduleResources = vnf.getAllVfModuleObjects();
+ assertEquals(2, moduleResources.size());
+
+ assertEquals(ALL_VF_MODULES_JSON, vnf.getAllVfModulesJson());
+
+ }
+
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
index 194ce58fe9..9fd3bc596f 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
@@ -36,6 +36,7 @@ import javax.xml.bind.annotation.XmlType;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="cloudOwner" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="msoRequest" type="{http://org.onap.so/vnfNotify}msoRequest" minOccurs="0"/>
* &lt;element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* &lt;element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
@@ -52,6 +53,7 @@ import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "vnfRollback", propOrder = {
"cloudSiteId",
+ "cloudOwner",
"msoRequest",
"tenantCreated",
"tenantId",
@@ -61,6 +63,7 @@ import javax.xml.bind.annotation.XmlType;
public class VnfRollback {
protected String cloudSiteId;
+ protected String cloudOwner;
protected MsoRequest msoRequest;
protected boolean tenantCreated;
protected String tenantId;
@@ -92,6 +95,30 @@ public class VnfRollback {
}
/**
+ * Gets the value of the cloudOwner property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ /**
+ * Sets the value of the cloudOwner property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCloudOwner(String value) {
+ this.cloudOwner = value;
+ }
+
+ /**
* Gets the value of the msoRequest property.
*
* @return
@@ -201,6 +228,7 @@ public class VnfRollback {
return
"<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' +
+ "<cloudOwner>"+cloudOwner+"</cloudOwner>" + '\n' +
msoRequestElement +
"<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' +
"<tenantId>"+tenantId+"</tenantId>" + '\n' +
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
index 4ab22f4616..46a6fa3ef3 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
@@ -33,8 +33,8 @@ import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.Execution;
import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -221,7 +221,7 @@ public class CallbackHandlerService {
+ queryException;
logger.debug(msg);
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg, queryException);
+ ErrorCode.UnknownError.getValue(), msg, queryException);
}
return false;
@@ -264,7 +264,7 @@ public class CallbackHandlerService {
+ "': " + ole;
logger.debug(msg);
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole);
+ ErrorCode.UnknownError.getValue(), msg, ole);
//Retry for OptimisticLocking Exceptions
int retryCount = 0;
@@ -297,14 +297,14 @@ public class CallbackHandlerService {
String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex;
logger.debug(strMsg);
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, olex);
+ ErrorCode.UnknownError.getValue(), strMsg, olex);
} catch (Exception excep) {
retryCount = 0;
//oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep;
logger.debug(strMsg);
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, excep);
+ ErrorCode.UnknownError.getValue(), strMsg, excep);
}
}
@@ -318,7 +318,7 @@ public class CallbackHandlerService {
+ "': " + e;
logger.debug(msg);
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
+ ErrorCode.UnknownError.getValue(), msg, e);
}
} catch (Exception e) {
// This must be an exception from the flow itself. Log it, but don't
@@ -328,7 +328,7 @@ public class CallbackHandlerService {
+ "': " + e;
logger.debug(msg);
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
+ ErrorCode.UnknownError.getValue(), msg, e);
}
return true;
@@ -364,10 +364,10 @@ public class CallbackHandlerService {
protected void logCallbackError(String method, long startTime, String msg, Exception e) {
if (e == null) {
logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg);
+ ErrorCode.UnknownError.getValue(), msg);
} else {
logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
+ ErrorCode.UnknownError.getValue(), msg, e);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
index 267e24fec4..a74bdfc649 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
@@ -34,7 +34,6 @@ import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -65,8 +64,6 @@ public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService im
String correlationVariable = "SDNCA_requestId";
String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
- MsoLogger.setLogContext(correlationValue, "N/A");
-
CallbackResult result = callback.handleCallback(method, message, messageEventName,
messageVariable, correlationVariable, correlationValue, logMarker);
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
index 65cc70d5f4..ed524c115e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
@@ -40,7 +40,6 @@ import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify;
import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
import org.onap.so.bpmn.common.adapter.vnf.VnfStatus;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -118,8 +117,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFQ_messageId";
String correlationValue = messageId;
- MsoLogger.setLogContext(correlationValue, "N/A");
-
QueryVnfNotification message = new QueryVnfNotification();
message.setMessageId(messageId);
@@ -161,8 +158,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFC_messageId";
String correlationValue = messageId;
- MsoLogger.setLogContext(correlationValue, "N/A");
-
CreateVnfNotification message = new CreateVnfNotification();
message.setMessageId(messageId);
@@ -201,8 +196,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFU_messageId";
String correlationValue = messageId;
- MsoLogger.setLogContext(correlationValue, "N/A");
-
UpdateVnfNotification message = new UpdateVnfNotification();
message.setMessageId(messageId);
@@ -236,8 +229,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFDEL_uuid";
String correlationValue = messageId;
- MsoLogger.setLogContext(correlationValue, "N/A");
-
DeleteVnfNotification message = new DeleteVnfNotification();
message.setMessageId(messageId);
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
index a5af553e1c..075102331c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
@@ -36,8 +36,8 @@ import javax.ws.rs.core.Response;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -79,7 +79,6 @@ public class WorkflowMessageResource{
String message) {
String method = "receiveWorkflowMessage";
- MsoLogger.setLogContext(correlator, "N/A");
logger.debug(LOGMARKER + " Received workflow message"
+ " type='" + messageType + "'"
@@ -91,7 +90,7 @@ public class WorkflowMessageResource{
String msg = "Missing message type";
logger.debug(LOGMARKER + " " + msg);
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
+ ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
@@ -99,7 +98,7 @@ public class WorkflowMessageResource{
String msg = "Missing correlator";
logger.debug(LOGMARKER + " " + msg);
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
- MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
+ ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
index d10ecd1ce2..a5d479ae41 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
@@ -50,8 +50,8 @@ import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -202,7 +202,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId());
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey),
- MsoLogger.ErrorCode.UnknownError.getValue(),
+ ErrorCode.UnknownError.getValue(),
LOGMARKER + workflowResponse.getMessage() + " for processKey: " + processKey + " with response: "
+ workflowResponse.getResponse());
@@ -237,10 +237,6 @@ public class WorkflowResource extends ProcessEngineAwareService {
}
private void setLogContext(String processKey, Map<String, Object> inputVariables) {
- if (inputVariables != null) {
- MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"),
- getValueFromInputVariables(inputVariables, "mso-service-instance-id"));
- }
}
private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) {
@@ -591,7 +587,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
response.setProcessInstanceID(processInstanceId);
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey),
- MsoLogger.ErrorCode.UnknownError.getValue(),
+ ErrorCode.UnknownError.getValue(),
LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response
.getResponse());
logger.debug("Exception :",ex);
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 04059557ae..3eed14bc30 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
@@ -53,11 +53,8 @@ import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl;
import org.camunda.bpm.model.bpmn.instance.EndEvent;
import org.camunda.bpm.model.bpmn.instance.FlowNode;
import org.camunda.bpm.model.bpmn.instance.StartEvent;
-import org.onap.so.bpmn.core.BPMNLogger;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -73,11 +70,11 @@ import org.springframework.stereotype.Component;
* Plugin for MSO logging and URN mapping.
*/
@Component
-public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
-
+public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
+
@Autowired
private LoggingParseListener loggingParseListener;
-
+
@Override
public void preInit(
ProcessEngineConfigurationImpl processEngineConfiguration) {
@@ -89,14 +86,14 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
}
preParseListeners.add(loggingParseListener);
}
-
+
/**
* Called when a process flow is parsed so we can inject listeners.
*/
@Component
- public class LoggingParseListener extends AbstractBpmnParseListener {
-
-
+ public class LoggingParseListener extends AbstractBpmnParseListener {
+
+
private void injectLogExecutionListener(ActivityImpl activity) {
activity.addListener(
ExecutionListener.EVENTNAME_END,
@@ -117,7 +114,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
@Override
public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) {
- // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events
+ // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events
injectLogExecutionListener(startEventActivity);
}
@@ -277,15 +274,15 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
injectLogExecutionListener(messageActivity);
}
}
-
+
/**
* Logs details about the current activity.
- */
+ */
public class LoggingExecutionListener implements ExecutionListener {
private final Logger logger = LoggerFactory.getLogger(LoggingExecutionListener.class);
private String event;
-
+
public LoggingExecutionListener() {
this.event = "";
}
@@ -293,32 +290,31 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
public LoggingExecutionListener(String event) {
this.event = event;
}
-
+
public String getEvent() {
return event;
}
@Override
- public void notify(DelegateExecution execution) throws Exception {
+ public void notify(DelegateExecution execution) throws Exception {
//required for legacy groovy processing in camunda
execution.setVariable("isDebugLogEnabled", "true");
if (!isBlank(execution.getCurrentActivityName())) {
try {
-
+
String id = execution.getId();
- if (id != null ) {
+ if (id != null ) {
RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
String processName = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(execution.getProcessDefinitionId())
.singleResult()
- .getName();
+ .getName();
+
-
String requestId = (String) execution.getVariable("mso-request-id");
String svcid = (String) execution.getVariable("mso-service-instance-id");
- MsoLogger.setLogContext(requestId, svcid);
}
- } catch(Exception e) {
+ } catch(Exception e) {
logger.error("Exception occurred", e);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
index 9b8f6cd5cc..8bc0055343 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -40,9 +42,10 @@ import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
import org.camunda.bpm.engine.impl.util.xml.Element;
-import org.onap.so.bpmn.core.BPMNLogger;
import org.onap.so.bpmn.core.WorkflowException;
import org.springframework.stereotype.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This plugin does the following:
@@ -60,7 +63,8 @@ import org.springframework.stereotype.Component;
*/
@Component
public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
-
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class);
+
@Override
public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
List<BpmnParseListener> preParseListeners =
@@ -73,7 +77,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
preParseListeners.add(new WorkflowExceptionParseListener());
}
-
+
public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener {
@Override
public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
@@ -131,7 +135,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
}
}
}
-
+
/**
* If there is a WorkflowException object in the execution, this method
* removes it (saving a copy of it in a different variable).
@@ -147,8 +151,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
saveName = "SavedWorkflowException" + (++index);
}
- BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"),
- "WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
+ logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
execution.setVariable(saveName, workflowException);
execution.setVariable("WorkflowException", null);
@@ -163,8 +166,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
public static class WorkflowExceptionTriggerTask implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
- BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"),
- "WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
+ logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
throw new BpmnError("MSOWorkflowException");
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
index 3dd2ac957c..2ba5c7286e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
@@ -40,7 +40,6 @@ import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.bpmn.mock.FileUtil;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
index ad08f8b2bb..1ef864b543 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
@@ -59,6 +59,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
private final String CREATE_VF_MODULE_REQUEST =
"<createVfModuleRequest>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
" <vnfId>vnfId</vnfId>" + EOL +
" <vfModuleName>vfModuleName</vfModuleName>" + EOL +
@@ -94,6 +95,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
private final String UPDATE_VF_MODULE_REQUEST =
"<updateVfModuleRequest>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
" <vnfId>vnfId</vnfId>" + EOL +
" <vfModuleName>vfModuleName</vfModuleName>" + EOL +
@@ -130,6 +132,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
private final String DELETE_VF_MODULE_REQUEST =
"<deleteVfModuleRequest>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
" <vnfId>vnfId</vnfId>" + EOL +
" <vfModuleId>vfModuleId</vfModuleId>" + EOL +
@@ -150,6 +153,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
" <skipAAI>true</skipAAI>" + EOL +
" <vfModuleRollback>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
" <vnfId>vnfId</vnfId>" + EOL +
" <vfModuleId>vfModuleId</vfModuleId>" + EOL +
@@ -186,6 +190,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
" <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
" <vfModuleCreated>true</vfModuleCreated>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
" <msoRequest>" + EOL +
" <requestId>requestId</requestId>" + EOL +
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 117d3b213a..eed2978bc7 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
@@ -1100,6 +1100,10 @@ public abstract class WorkflowTest {
"/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()");
rollback.setCloudSiteId(cloudSiteId);
+ String cloudOwner = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()");
+ rollback.setCloudOwner(cloudOwner);
+
String requestId = xpathTool.evaluate(
"/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
String serviceInstanceId = xpathTool.evaluate(
@@ -1276,6 +1280,10 @@ public abstract class WorkflowTest {
"/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()");
rollback.setCloudSiteId(cloudSiteId);
+ String cloudOwner = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()");
+ rollback.setCloudOwner(cloudOwner);
+
String requestId = xpathTool.evaluate(
"/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
String serviceInstanceId = xpathTool.evaluate(
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckClosedLoopDisabledFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckClosedLoopDisabledFlagActivity.bpmn
new file mode 100644
index 0000000000..9ac0f38835
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckClosedLoopDisabledFlagActivity.bpmn
@@ -0,0 +1,50 @@
+<?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="VNFCheckClosedLoopDisabledFlagActivity" name="VNFCheckClosedLoopDisabledFlagActivity&#10;" isExecutable="true">
+ <bpmn:startEvent id="VNFCheckClosedLoopDisabledFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_01c8z5u</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFCheckClosedLoopDisabledFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_12mzh2v</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskCheckClosedLoopDisabledFlagActivity" name="VNF Check Closed Loop Disabled Flag (AAI)" camunda:expression="${AAIFlagTasks.checkVnfClosedLoopDisabledFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_01c8z5u</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12mzh2v</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_01c8z5u" sourceRef="VNFCheckClosedLoopDisabledFlagActivity_Start" targetRef="TaskCheckClosedLoopDisabledFlagActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_12mzh2v" sourceRef="TaskCheckClosedLoopDisabledFlagActivity" targetRef="VNFCheckClosedLoopDisabledFlagActivity_End" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFCheckClosedLoopDisabledFlagActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFCheckClosedLoopDisabledFlagActivity_Start">
+ <dc:Bounds x="104" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="122" y="112" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFCheckClosedLoopDisabledFlagActivity_End">
+ <dc:Bounds x="320" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="338" y="116" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskCheckClosedLoopDisabledFlagActivity">
+ <dc:Bounds x="192" y="54" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_01c8z5u_di" bpmnElement="SequenceFlow_01c8z5u">
+ <di:waypoint xsi:type="dc:Point" x="140" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="192" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="166" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12mzh2v_di" bpmnElement="SequenceFlow_12mzh2v">
+ <di:waypoint xsi:type="dc:Point" x="292" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="320" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="306" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckInMaintFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckInMaintFlagActivity.bpmn
new file mode 100644
index 0000000000..8709f399a5
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckInMaintFlagActivity.bpmn
@@ -0,0 +1,50 @@
+<?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="VNFCheckInMaintFlagActivity" name="VNFCheckInMaintFlagActivity&#10;" isExecutable="true">
+ <bpmn:startEvent id="VNFCheckInMaintFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_0h1gkvd</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFCheckInMaintFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_0xu6esl</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskCheckInMaintFlag" name="VNF Check InMaint Flag (AAI)" camunda:expression="${AAIFlagTasks.checkVnfInMaintFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0h1gkvd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xu6esl</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0h1gkvd" sourceRef="VNFCheckInMaintFlagActivity_Start" targetRef="TaskCheckInMaintFlag" />
+ <bpmn:sequenceFlow id="SequenceFlow_0xu6esl" sourceRef="TaskCheckInMaintFlag" targetRef="VNFCheckInMaintFlagActivity_End" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFCheckInMaintFlagActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFCheckInMaintFlagActivity_Start">
+ <dc:Bounds x="104" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="122" y="112" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFCheckInMaintFlagActivity_End">
+ <dc:Bounds x="384" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="357" y="116" width="90" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskCheckInMaintFlag">
+ <dc:Bounds x="194" y="54" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0h1gkvd_di" bpmnElement="SequenceFlow_0h1gkvd">
+ <di:waypoint xsi:type="dc:Point" x="140" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="194" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="167" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xu6esl_di" bpmnElement="SequenceFlow_0xu6esl">
+ <di:waypoint xsi:type="dc:Point" x="294" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="384" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="339" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckPserversLockedFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckPserversLockedFlagActivity.bpmn
new file mode 100644
index 0000000000..9c327a4da9
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckPserversLockedFlagActivity.bpmn
@@ -0,0 +1,50 @@
+<?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="VNFCheckPserversLockedFlagActivity" name="VNFCheckInMaintFlagActivity&#10;" isExecutable="true">
+ <bpmn:startEvent id="VNFCheckPserversLockedFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_0a56huh</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFCheckPserversLockedFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_1f2j7tx</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskCheckPserversLockedFlagActivity" name="VNF Check Pservers Locked Flag (AAI)" camunda:expression="${AAIFlagTasks.checkVnfPserversLockedFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0a56huh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1f2j7tx</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0a56huh" sourceRef="VNFCheckPserversLockedFlagActivity_Start" targetRef="TaskCheckPserversLockedFlagActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_1f2j7tx" sourceRef="TaskCheckPserversLockedFlagActivity" targetRef="VNFCheckPserversLockedFlagActivity_End" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFCheckPserversLockedFlagActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFCheckPserversLockedFlagActivity_Start">
+ <dc:Bounds x="104" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="122" y="112" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFCheckPserversLockedFlagActivity_End">
+ <dc:Bounds x="320" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="338" y="116" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskCheckPserversLockedFlagActivity">
+ <dc:Bounds x="192" y="54" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0a56huh_di" bpmnElement="SequenceFlow_0a56huh">
+ <di:waypoint xsi:type="dc:Point" x="140" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="192" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="166" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1f2j7tx_di" bpmnElement="SequenceFlow_1f2j7tx">
+ <di:waypoint xsi:type="dc:Point" x="292" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="320" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="306" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetClosedLoopDisabledFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetClosedLoopDisabledFlagActivity.bpmn
new file mode 100644
index 0000000000..f356634106
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetClosedLoopDisabledFlagActivity.bpmn
@@ -0,0 +1,50 @@
+<?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="VNFSetClosedLoopDisabledFlagActivity" name="VNFSetClosedLoopDisabledFlagActivity&#10;" isExecutable="true">
+ <bpmn:startEvent id="VNFSetClosedLoopDisabledFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_0pp6ze7</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFSetClosedLoopDisabledFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_0g0xfi3</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskSetClosedLoopDisabledFlagActivity" name="VNF Set Closed Loop Disabled Flag (AAI)" camunda:expression="${AAIFlagTasks.modifyVnfClosedLoopDisabledFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), true)}">
+ <bpmn:incoming>SequenceFlow_0pp6ze7</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0g0xfi3</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0pp6ze7" sourceRef="VNFSetClosedLoopDisabledFlagActivity_Start" targetRef="TaskSetClosedLoopDisabledFlagActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_0g0xfi3" sourceRef="TaskSetClosedLoopDisabledFlagActivity" targetRef="VNFSetClosedLoopDisabledFlagActivity_End" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFSetClosedLoopDisabledFlagActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFSetClosedLoopDisabledFlagActivity_Start">
+ <dc:Bounds x="104" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="122" y="112" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFSetClosedLoopDisabledFlagActivity_End">
+ <dc:Bounds x="320" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="338" y="116" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskSetClosedLoopDisabledFlagActivity">
+ <dc:Bounds x="192" y="54" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0pp6ze7_di" bpmnElement="SequenceFlow_0pp6ze7">
+ <di:waypoint xsi:type="dc:Point" x="140" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="192" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="166" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0g0xfi3_di" bpmnElement="SequenceFlow_0g0xfi3">
+ <di:waypoint xsi:type="dc:Point" x="292" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="320" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="306" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
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
new file mode 100644
index 0000000000..0dbe989cb2
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn
@@ -0,0 +1,47 @@
+<?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:startEvent id="VNFUnsetClosedLoopDisabledFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_19it9ao</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFUnsetClosedLoopDisabledFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_1en9xbh</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskVNFUnsetClosedLoopDisabledFlagActivity" name="VNF Unset Closed Loop Disabled Flag (AAI)" camunda:expression="${AAIFlagTasks.modifyVnfClosedLoopDisabledFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), false)}">
+ <bpmn:incoming>SequenceFlow_19it9ao</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1en9xbh</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_19it9ao" sourceRef="VNFUnsetClosedLoopDisabledFlagActivity_Start" targetRef="TaskVNFUnsetClosedLoopDisabledFlagActivity" />
+ <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:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUnsetClosedLoopDisabledFlagActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1phehn7_di" bpmnElement="VNFUnsetClosedLoopDisabledFlagActivity_End">
+ <dc:Bounds x="501" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="519" y="142" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_15fwoxi_di" bpmnElement="TaskVNFUnsetClosedLoopDisabledFlagActivity">
+ <dc:Bounds x="296" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_19it9ao_di" bpmnElement="SequenceFlow_19it9ao">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="296" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="252.5" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1en9xbh_di" bpmnElement="SequenceFlow_1en9xbh">
+ <di:waypoint xsi:type="dc:Point" x="396" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="501" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="448.5" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AbstractCDSProcessingBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AbstractCDSProcessingBB.bpmn
new file mode 100644
index 0000000000..4fcf13d98d
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AbstractCDSProcessingBB.bpmn
@@ -0,0 +1,50 @@
+<?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" id="Definitions_1l7m222" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.1">
+ <bpmn:process id="AbstractCDSProcessingBB" name="Abstract CDS Processing BB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_02v5z4h</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_02v5z4h" sourceRef="StartEvent_1" targetRef="Task_06n9c9v" />
+ <bpmn:sequenceFlow id="SequenceFlow_0gksy4i" sourceRef="Task_06n9c9v" targetRef="Task_0kjfr5o" />
+ <bpmn:sequenceFlow id="SequenceFlow_161g9uz" sourceRef="Task_0kjfr5o" targetRef="EndEvent_1h3epjc" />
+ <bpmn:endEvent id="EndEvent_1h3epjc">
+ <bpmn:incoming>SequenceFlow_161g9uz</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="Task_06n9c9v" name="Get Required data to call CDS Client" camunda:expression="${AbstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution)}">
+ <bpmn:incoming>SequenceFlow_02v5z4h</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0gksy4i</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Task_0kjfr5o" name="CDS&#10;(Call SelfServiceAPI)&#10;" camunda:expression="${AbstractCDSProcessingBBUtils.sendRequestToCDSClient(execution)}">
+ <bpmn:incoming>SequenceFlow_0gksy4i</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_161g9uz</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AbstractCDSProcessingBB">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="124" y="264" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_02v5z4h_di" bpmnElement="SequenceFlow_02v5z4h">
+ <di:waypoint x="160" y="282" />
+ <di:waypoint x="223" y="282" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0gksy4i_di" bpmnElement="SequenceFlow_0gksy4i">
+ <di:waypoint x="323" y="282" />
+ <di:waypoint x="385" y="282" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_161g9uz_di" bpmnElement="SequenceFlow_161g9uz">
+ <di:waypoint x="485" y="282" />
+ <di:waypoint x="578" y="282" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1h3epjc_di" bpmnElement="EndEvent_1h3epjc">
+ <dc:Bounds x="578" y="264" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_16es7z5_di" bpmnElement="Task_06n9c9v">
+ <dc:Bounds x="223" y="242" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_18soa9e_di" bpmnElement="Task_0kjfr5o">
+ <dc:Bounds x="385" y="242" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn
new file mode 100644
index 0000000000..9892fbdd91
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn
@@ -0,0 +1,98 @@
+<?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_1ahlzqg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.1">
+ <bpmn:process id="ConfigAssignVnfBB" name="ConfigAssignVnfBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0gmfit3</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0gmfit3" sourceRef="StartEvent_1" targetRef="Task_0bhf6tp" />
+ <bpmn:endEvent id="EndEvent_0lgvk82">
+ <bpmn:incoming>SequenceFlow_1mkhog2</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1mkhog2" sourceRef="Task_1hs1mn0" targetRef="EndEvent_0lgvk82" />
+ <bpmn:callActivity id="CallActivity_1gfzi2g" name="Abstract CDS&#10;(CDS Call)&#10;" calledElement="AbstractCDSProcessingBB">
+ <bpmn:extensionElements>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="CDSStatus" target="CDSStatus" />
+ <camunda:in source="executionObject" target="executionObject" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_05qembo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cvsnuu</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:serviceTask id="Task_1hs1mn0" name="Update AAI&#10;(VNF)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusConfigAssignedVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_07tqu82</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1mkhog2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05qembo" sourceRef="Task_0bhf6tp" targetRef="CallActivity_1gfzi2g" />
+ <bpmn:serviceTask id="Task_0bhf6tp" name="PreProcess Abstract CDS Processing" camunda:expression="${ConfigAssignVnf.PreProcessAbstractCDSProcessing(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0gmfit3</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05qembo</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_13q340y" default="SequenceFlow_15gxql1">
+ <bpmn:incoming>SequenceFlow_0cvsnuu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07tqu82</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_15gxql1</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0cvsnuu" sourceRef="CallActivity_1gfzi2g" targetRef="ExclusiveGateway_13q340y" />
+ <bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="success" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("CDSStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_0mnaj50">
+ <bpmn:incoming>SequenceFlow_15gxql1</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1s1hqgm" errorRef="Error_0aovtfv" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_15gxql1" sourceRef="ExclusiveGateway_13q340y" targetRef="EndEvent_0mnaj50" />
+ </bpmn:process>
+ <bpmn:error id="Error_0aovtfv" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ConfigAssignVnfBB">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="507" y="187" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0gmfit3_di" bpmnElement="SequenceFlow_0gmfit3">
+ <di:waypoint x="543" y="205" />
+ <di:waypoint x="614" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0lgvk82_di" bpmnElement="EndEvent_0lgvk82">
+ <dc:Bounds x="1307" y="187" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1mkhog2_di" bpmnElement="SequenceFlow_1mkhog2">
+ <di:waypoint x="1218" y="205" />
+ <di:waypoint x="1307" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1gfzi2g_di" bpmnElement="CallActivity_1gfzi2g">
+ <dc:Bounds x="788" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0404s6a_di" bpmnElement="Task_1hs1mn0">
+ <dc:Bounds x="1118" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05qembo_di" bpmnElement="SequenceFlow_05qembo">
+ <di:waypoint x="714" y="205" />
+ <di:waypoint x="788" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_01mv1si_di" bpmnElement="Task_0bhf6tp">
+ <dc:Bounds x="614" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_13q340y_di" bpmnElement="ExclusiveGateway_13q340y" isMarkerVisible="true">
+ <dc:Bounds x="978" y="180" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cvsnuu_di" bpmnElement="SequenceFlow_0cvsnuu">
+ <di:waypoint x="888" y="205" />
+ <di:waypoint x="978" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07tqu82_di" bpmnElement="SequenceFlow_07tqu82">
+ <di:waypoint x="1028" y="205" />
+ <di:waypoint x="1118" y="205" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1053" y="187" width="41" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0mnaj50_di" bpmnElement="EndEvent_0mnaj50">
+ <dc:Bounds x="985" y="327" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15gxql1_di" bpmnElement="SequenceFlow_15gxql1">
+ <di:waypoint x="1003" y="230" />
+ <di:waypoint x="1003" y="327" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigDeployVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigDeployVnfBB.bpmn
new file mode 100644
index 0000000000..92ac5f9f5b
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigDeployVnfBB.bpmn
@@ -0,0 +1,116 @@
+<?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_1556kf5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
+ <bpmn:process id="ConfigDeployVnfBB" name="ConfigDeployVnfBB" isExecutable="true">
+ <bpmn:startEvent id="Start" name="Start">
+ <bpmn:outgoing>SequenceFlow_0pd4jka</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="UpdateAAIConfigured" name="Update AAI Configured" camunda:expression="${ConfigDeployVnf.updateAAIConfigured(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1tb7fs1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_00u29dm</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="End" name="End">
+ <bpmn:incoming>SequenceFlow_00u29dm</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0pd4jka" sourceRef="Start" targetRef="UpdateAAIConfigure" />
+ <bpmn:sequenceFlow id="SequenceFlow_03xbj4e" sourceRef="AbstractCDSBB" targetRef="ExclusiveGateway_0duh80v" />
+ <bpmn:sequenceFlow id="SequenceFlow_00u29dm" sourceRef="UpdateAAIConfigured" targetRef="End" />
+ <bpmn:callActivity id="AbstractCDSBB" name="Abstract CDS (CDS Call)" calledElement="AbstractCDSProcessingBB">
+ <bpmn:extensionElements>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="executionObject" target="executionObject" />
+ <camunda:out source="CDSStatus" target="CDSStatus" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0kruy8t</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_03xbj4e</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:serviceTask id="UpdateAAIConfigure" name="Update AAI Configure" camunda:expression="${ConfigDeployVnf.updateAAIConfigure(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0pd4jka</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0moyu92</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0moyu92" sourceRef="UpdateAAIConfigure" targetRef="PreProcessAbstractCDSProcessing" />
+ <bpmn:sequenceFlow id="SequenceFlow_0kruy8t" sourceRef="PreProcessAbstractCDSProcessing" targetRef="AbstractCDSBB" />
+ <bpmn:serviceTask id="PreProcessAbstractCDSProcessing" name="PreProcess Abstract CDS Processing" camunda:expression="${ConfigDeployVnf.preProcessAbstractCDSProcessing(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0moyu92</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0kruy8t</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0duh80v" default="SequenceFlow_0o50k2d">
+ <bpmn:incoming>SequenceFlow_03xbj4e</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1tb7fs1</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0o50k2d</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1tb7fs1" name="success" sourceRef="ExclusiveGateway_0duh80v" targetRef="UpdateAAIConfigured">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("CDSStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0o50k2d" sourceRef="ExclusiveGateway_0duh80v" targetRef="EndEvent_0wwnq4u" />
+ <bpmn:endEvent id="EndEvent_0wwnq4u">
+ <bpmn:incoming>SequenceFlow_0o50k2d</bpmn:incoming>
+ <bpmn:errorEventDefinition errorRef="Error_0zsv500" />
+ </bpmn:endEvent>
+ </bpmn:process>
+ <bpmn:error id="Error_0zsv500" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ConfigDeployVnfBB">
+ <bpmndi:BPMNEdge id="SequenceFlow_0pd4jka_di" bpmnElement="SequenceFlow_0pd4jka">
+ <di:waypoint x="542" y="248" />
+ <di:waypoint x="607" y="248" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_03xbj4e_di" bpmnElement="SequenceFlow_03xbj4e">
+ <di:waypoint x="1039" y="248" />
+ <di:waypoint x="1089" y="248" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_00u29dm_di" bpmnElement="SequenceFlow_00u29dm">
+ <di:waypoint x="1327" y="248" />
+ <di:waypoint x="1399" y="248" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start">
+ <dc:Bounds x="506" y="230" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="512" y="273" width="25" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0c9apxl_di" bpmnElement="UpdateAAIConfigured">
+ <dc:Bounds x="1227" y="208" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0p7ssqo_di" bpmnElement="End">
+ <dc:Bounds x="1399" y="230" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1407" y="273" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0vg7uiv_di" bpmnElement="AbstractCDSBB">
+ <dc:Bounds x="939" y="208" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_05zt0do_di" bpmnElement="UpdateAAIConfigure">
+ <dc:Bounds x="607" y="208" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0moyu92_di" bpmnElement="SequenceFlow_0moyu92">
+ <di:waypoint x="707" y="248" />
+ <di:waypoint x="770" y="248" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kruy8t_di" bpmnElement="SequenceFlow_0kruy8t">
+ <di:waypoint x="870" y="248" />
+ <di:waypoint x="939" y="248" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0m4kmps_di" bpmnElement="PreProcessAbstractCDSProcessing">
+ <dc:Bounds x="770" y="208" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0duh80v_di" bpmnElement="ExclusiveGateway_0duh80v" isMarkerVisible="true">
+ <dc:Bounds x="1089" y="223" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tb7fs1_di" bpmnElement="SequenceFlow_1tb7fs1">
+ <di:waypoint x="1139" y="248" />
+ <di:waypoint x="1227" y="248" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1163" y="230" width="41" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0o50k2d_di" bpmnElement="SequenceFlow_0o50k2d">
+ <di:waypoint x="1114" y="273" />
+ <di:waypoint x="1114" y="348" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1p3d0t4_di" bpmnElement="EndEvent_0wwnq4u">
+ <dc:Bounds x="1096" y="348" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
new file mode 100644
index 0000000000..9437d02b69
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
@@ -0,0 +1,62 @@
+<?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" id="Definitions_0x13ohc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+ <bpmn:process id="EtsiVnfInstantiateBB" name="&#10;EtsiVnfInstantiateBB" isExecutable="true">
+ <bpmn:serviceTask id="ServiceTask_02e82t2" name="Create &#10;CreateVnfRequest&#10;" camunda:expression="${VnfmAdapterCreateVnfTask.buildCreateVnfRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_18fsqzd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0f0vsnv</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:startEvent id="StartEvent_0ru3x55">
+ <bpmn:outgoing>SequenceFlow_016sgof</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_016sgof" sourceRef="StartEvent_0ru3x55" targetRef="ServiceTask_1jf7hlc" />
+ <bpmn:endEvent id="EndEvent_001k15i">
+ <bpmn:incoming>SequenceFlow_0hp0ka1</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0f0vsnv" sourceRef="ServiceTask_02e82t2" targetRef="ServiceTask_06ao4xu" />
+ <bpmn:serviceTask id="ServiceTask_06ao4xu" name="&#10;Invoke VNFM Adaptor&#10;" camunda:asyncAfter="true" camunda:expression="${VnfmAdapterCreateVnfTask.invokeVnfmAdapter(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0f0vsnv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0hp0ka1</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_1jf7hlc" name="&#10;Retrieve Input Parameters&#10;" camunda:asyncAfter="true" camunda:expression="${InputParameterRetrieverTask.getInputParameters(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_016sgof</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18fsqzd</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_18fsqzd" sourceRef="ServiceTask_1jf7hlc" targetRef="ServiceTask_02e82t2" />
+ <bpmn:sequenceFlow id="SequenceFlow_0hp0ka1" sourceRef="ServiceTask_06ao4xu" targetRef="EndEvent_001k15i" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="EtsiVnfInstantiateBB">
+ <bpmndi:BPMNShape id="ServiceTask_02e82t1_di" bpmnElement="ServiceTask_02e82t2">
+ <dc:Bounds x="480" y="227" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0ru3x55_di" bpmnElement="StartEvent_0ru3x55">
+ <dc:Bounds x="232" y="249" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_016sgof_di" bpmnElement="SequenceFlow_016sgof">
+ <di:waypoint x="268" y="267" />
+ <di:waypoint x="332" y="267" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_001k15i_di" bpmnElement="EndEvent_001k15i">
+ <dc:Bounds x="783" y="249" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0f0vsnv_di" bpmnElement="SequenceFlow_0f0vsnv">
+ <di:waypoint x="580" y="267" />
+ <di:waypoint x="629" y="267" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_06ao4xu_di" bpmnElement="ServiceTask_06ao4xu">
+ <dc:Bounds x="629" y="227" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1jf7hlc_di" bpmnElement="ServiceTask_1jf7hlc">
+ <dc:Bounds x="332" y="227" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_18fsqzd_di" bpmnElement="SequenceFlow_18fsqzd">
+ <di:waypoint x="432" y="267" />
+ <di:waypoint x="480" y="267" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hp0ka1_di" bpmnElement="SequenceFlow_0hp0ka1">
+ <di:waypoint x="729" y="267" />
+ <di:waypoint x="783" y="267" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
index 5189f8b48a..83363d48ba 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2">
<bpmn:process id="ExecuteBuildingBlock" name="ExecuteBuildingBlock" isExecutable="true">
<bpmn:startEvent id="Start_ExecuteBuildingBlock" name="start">
<bpmn:outgoing>SequenceFlow_0rq4c5r</bpmn:outgoing>
@@ -9,6 +9,7 @@
<camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_19wuics</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_01h9qmz</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index 2437476b59..76ca2a89cc 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns: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.10.0">
+<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.7.2">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -88,7 +88,7 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index cd2b46bf70..6aa5cf3412 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -349,7 +349,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -367,7 +367,7 @@ public class BuildingBlockTestDataSetup{
Collection collection = null;
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
collection = serviceInstance.getCollection();
if (collection == null) {
@@ -442,7 +442,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -487,7 +487,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -522,7 +522,7 @@ public class BuildingBlockTestDataSetup{
GenericVnf genericVnf = null;
try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
} catch(BBObjectNotFoundException e) {
genericVnf = setGenericVnf();
}
@@ -550,7 +550,7 @@ public class BuildingBlockTestDataSetup{
GenericVnf genericVnf = null;
try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
} catch(BBObjectNotFoundException e) {
genericVnf = setGenericVnf();
}
@@ -614,7 +614,7 @@ public class BuildingBlockTestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java
new file mode 100644
index 0000000000..ac4499bf89
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFCheckClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start",
+ "TaskCheckClosedLoopDisabledFlagActivity",
+ "VNFCheckClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .checkVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start",
+ "TaskCheckClosedLoopDisabledFlagActivity").hasNotPassed(
+ "VNFCheckClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java
new file mode 100644
index 0000000000..050d3124f6
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+
+public class VNFCheckInMaintFlagActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start",
+ "TaskCheckInMaintFlag",
+ "VNFCheckInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFCheckInMaintFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .checkVnfInMaintFlag(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start",
+ "TaskCheckInMaintFlag").hasNotPassed(
+ "VNFCheckInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java
new file mode 100644
index 0000000000..e43f47fa6a
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFCheckPserversLockedFlagActivity extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start",
+ "TaskCheckPserversLockedFlagActivity",
+ "VNFCheckPserversLockedFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFCheckPserversLockedFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .checkVnfPserversLockedFlag(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start",
+ "TaskCheckPserversLockedFlagActivity").hasNotPassed(
+ "VNFCheckPserversLockedFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java
new file mode 100644
index 0000000000..8e56051f47
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFSetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start",
+ "TaskSetClosedLoopDisabledFlagActivity",
+ "VNFSetClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start",
+ "TaskSetClosedLoopDisabledFlagActivity").hasNotPassed(
+ "VNFSetInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+}
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
new file mode 100644
index 0000000000..4c9b33c2c7
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFUnsetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
+ "TaskVNFUnsetClosedLoopDisabledFlagActivity",
+ "VNFUnsetClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUnsetClosedLoopFlag_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
+ "TaskVNFUnsetClosedLoopDisabledFlagActivity").hasNotPassed(
+ "VNFUnsetClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+}
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 21426c1d51..bd465eb9a8 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
@@ -21,11 +21,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.*;
+import org.onap.so.logger.ErrorCode;
+
+import static org.apache.commons.lang3.StringUtils.*
-import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -35,7 +36,6 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
@@ -327,7 +327,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
- MsoLogger.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/CreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
index 16f7d53087..d588da38b0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy
@@ -30,7 +30,6 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -417,7 +416,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
String errorException = " Bpmn error encountered in CreateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse()"
- logger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage())
+ logger.debug("Exception error in CreateNetworkInstance flow, buildErrorResponse(): {}", ex.getMessage(), ex)
falloutHandlerRequest =
"""<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:ns="http://org.onap/so/request/types/v1"
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 bb2116acb9..65fa0511ac 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
@@ -441,7 +441,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest)
- utils.logAudit(sndcTopologyCreateRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString)
logger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
index 116328b05d..712512fdc9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
@@ -20,9 +20,8 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.v12.GenericVnf;
@@ -35,9 +34,9 @@ import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.bpmn.infrastructure.aai.AAICreateResources;
+import org.onap.so.bpmn.infrastructure.aai.AAICreateResources
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.w3c.dom.*
@@ -254,7 +253,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
//execution.setVariable("CVFMODVOL2_isDataOk", false)
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
" Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
}
@@ -304,7 +303,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Encountered ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -405,7 +404,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing PostProcessResponse - " + "\n", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())
}
logger.trace("COMPLETED PostProcessResponse Process")
@@ -482,7 +481,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method , "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
@@ -531,7 +530,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing prepareUpdateInfraRequest.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED prepareUpdateInfraRequest Process")
@@ -587,7 +586,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method , "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
index 26690ece48..5ba90eb989 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
@@ -22,21 +22,17 @@
package org.onap.so.bpmn.infrastructure.scripts
-import org.apache.commons.collections.CollectionUtils
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.SearchResults
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.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.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -311,7 +307,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest)
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response " +
- "going to FalloutHandler", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
+ "going to FalloutHandler", "BPMN", ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
index 1c2975b06c..c0e8d5a6ba 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.logger.ErrorCode
import static org.apache.commons.lang3.StringUtils.*;
@@ -42,7 +43,6 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources;
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -169,7 +169,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -195,7 +195,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
throw b
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in " +
- "CreateVnfInfra PreProcessRequest method", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+ "CreateVnfInfra PreProcessRequest method", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest")
}
@@ -221,7 +221,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process")
}
@@ -247,7 +247,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCAssignRequest")
@@ -271,7 +271,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
- "Processing preProcessSDNCActivateRequest", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+ "Processing preProcessSDNCActivateRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCActivateRequest Process")
@@ -462,7 +462,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
if (vnfs == null) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching " +
- "VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "");
+ "VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), "");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
}
@@ -471,7 +471,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
if (vnf == null) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF" +
- " in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "");
+ " in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), "");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
}
@@ -544,7 +544,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
}catch(Exception ex){
String msg = "Exception in LineOfBusiness. " + ex.getMessage();
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
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 ccdb5d77cd..4233147f83 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
@@ -328,7 +328,6 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
}
String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest)
- utils.logAudit(sdncTopologyDeleteRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString)
logger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
index a19b7b7870..1e2f50148c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
@@ -20,9 +20,8 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -30,14 +29,12 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import groovy.json.*
-
public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
String Prefix="DELNI_"
String groovyClassName = "DeleteNetworkInstance"
@@ -359,7 +356,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue())
+ ErrorCode.UnknownError.getValue())
} catch (Exception ex) {
// caught exception
@@ -382,7 +379,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex)
}
}
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 0dc86632e2..20134a77a9 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
@@ -354,7 +354,6 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest)
- utils.logAudit(sdncTopologyDeleteRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString)
logger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
index 234482f83c..3a1815cfe6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
@@ -29,9 +29,9 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil;
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.VidUtils;
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -127,7 +127,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
catch(Exception e) {
String restFaultMessage = e.getMessage()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception",
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
}
@@ -161,7 +161,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -204,7 +204,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -230,7 +230,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in '
- + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage())
}
}
@@ -279,7 +279,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage())
}
}
@@ -324,7 +324,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -377,7 +377,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
index c48527a64f..cf53aff878 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
@@ -20,9 +20,8 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.VolumeGroup
@@ -35,17 +34,13 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.web.util.UriUtils
-
-
import groovy.json.JsonSlurper
import javax.ws.rs.NotFoundException
@@ -73,6 +68,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable('DELVfModVol_vnfType', null)
execution.setVariable('DELVfModVol_serviceId', null)
execution.setVariable('DELVfModVol_cloudRegion', null)
+ execution.setVariable('DELVfModVol_cloudOwner', null)
execution.setVariable('DELVfModVol_tenantId', null)
execution.setVariable('DELVfModVol_volumeParams', null)
execution.setVariable('DELVfModVol_volumeGroupHeatStackId', null)
@@ -146,6 +142,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable('DELVfModVol_volumeOutputs', utils.getNodeXml(request, 'volume-outputs', false))
execution.setVariable('DELVfModVol_volumeParams', utils.getNodeXml(request, 'volume-params'))
execution.setVariable('DELVfModVol_cloudRegion', utils.getNodeText(request, 'aic-cloud-region'))
+ execution.setVariable('DELVfModVol_cloudOwner', utils.getNodeText(request, 'cloud-owner'))
setBasicDBAuthHeader(execution, isDebugLogEnabled)
@@ -313,6 +310,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) {
def cloudRegion = execution.getVariable('DELVfModVol_cloudRegion')
+ def cloudOwner = execution.getVariable('DELVfModVol_cloudOwner')
def tenantId = execution.getVariable('DELVfModVol_tenantId')
def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId')
def volumeGroupHeatStackId = execution.getVariable('DELVfModVol_volumeGroupHeatStackId')
@@ -329,6 +327,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String vnfAdapterRestRequest = """
<deleteVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
<volumeGroupStackId>${MsoUtils.xmlEscape(volumeGroupHeatStackId)}</volumeGroupStackId>
@@ -466,7 +465,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest)
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Overall Error Response going to FalloutHandler", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
+ ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
}
@@ -487,7 +486,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
' retrieved from AAI for Volume Group Id ' + volumeGroupId
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
ExceptionUtil exceptionUtil = new ExceptionUtil()
exceptionUtil.buildWorkflowException(execution, 5000, errorMessage)
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 e35268c45a..125c3e4504 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
@@ -20,7 +20,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.onap.so.logger.ErrorCode;
import static org.apache.commons.lang3.StringUtils.*;
@@ -44,7 +46,6 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -444,7 +445,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
- MsoLogger.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/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
index 418a1bdd9b..468f603ef6 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
@@ -32,8 +32,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.bpmn.core.UrnPropertiesReader
@@ -236,7 +236,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception occured while executing AAI Put Call", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
throw new BpmnError("MSOWorkflowException")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index 80bc201ecd..eface7b847 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.ErrorCode
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
@@ -62,7 +63,6 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
import org.onap.so.db.catalog.beans.HomingInstance
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -569,7 +569,7 @@ public class DoCreateVfModule extends VfModuleBase {
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg);
+ ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -622,7 +622,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Internal Error')
}
@@ -668,8 +668,7 @@ public class DoCreateVfModule extends VfModuleBase {
rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true")
execution.setVariable("rollbackData", rollbackData)
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while postProcessing CreateAAIVfModule request:' + ex.getMessage())
+ logger.debug('Exception occurred while postProcessing CreateAAIVfModule request: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Bad response from CreateAAIVfModule' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -741,8 +740,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -751,7 +749,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
@@ -822,17 +820,16 @@ public class DoCreateVfModule extends VfModuleBase {
}
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
}
}
@@ -868,7 +865,7 @@ public class DoCreateVfModule extends VfModuleBase {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCAssignRequest")
@@ -962,7 +959,7 @@ public class DoCreateVfModule extends VfModuleBase {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCGetRequest Process")
@@ -982,6 +979,8 @@ public class DoCreateVfModule extends VfModuleBase {
//Get variables
//cloudSiteId
def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId")
+ //cloudOwner
+ def cloudOwner = execution.getVariable("DCVFM_cloudOwner")
//tenantId
def tenantId = execution.getVariable("DCVFM_tenantId")
//vnfType
@@ -1070,6 +1069,7 @@ public class DoCreateVfModule extends VfModuleBase {
String createVnfARequest = """
<createVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vnfName>${MsoUtils.xmlEscape(vnfName)}</vnfName>
@@ -1167,7 +1167,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
@@ -1233,6 +1233,7 @@ public class DoCreateVfModule extends VfModuleBase {
def vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName")
def vnfId = execution.getVariable("DCVFM_vnfId")
def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId")
+ def cloudOwner = execution.getVariable("DCVFM_cloudOwner")
def sdncVersion = execution.getVariable("DCVFM_sdncVersion")
def serviceModelInfo = execution.getVariable("serviceModelInfo")
def vnfModelInfo = execution.getVariable("vnfModelInfo")
@@ -1557,7 +1558,7 @@ public class DoCreateVfModule extends VfModuleBase {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestOrch")
@@ -1587,7 +1588,7 @@ public class DoCreateVfModule extends VfModuleBase {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessUpdateAAIVfModuleStatus")
@@ -1617,7 +1618,7 @@ public class DoCreateVfModule extends VfModuleBase {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessUpdateAAIVfModuleRequestGroup")
@@ -1697,7 +1698,7 @@ public class DoCreateVfModule extends VfModuleBase {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCGetRequest", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCGetRequest Process")
@@ -1819,14 +1820,14 @@ public class DoCreateVfModule extends VfModuleBase {
} catch(BpmnError b){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Rethrowing MSOWorkflowException", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage());
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + b.getMessage());
throw b
}catch (Exception ex) {
// try error
String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + ex.getMessage()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI Query Cloud Region Failed " + errorMessage, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method")
}
}
@@ -1889,7 +1890,7 @@ public class DoCreateVfModule extends VfModuleBase {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest")
@@ -2022,7 +2023,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Encountered in " + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
@@ -2067,7 +2068,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
@@ -2120,7 +2121,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in queryCatalogDB', "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage())
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
index 6f6ed671fe..07ffa38498 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
@@ -36,13 +36,11 @@ import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.web.util.UriUtils
-
import javax.ws.rs.NotFoundException
@@ -94,6 +92,8 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName)
String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion")
execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId)
+ String cloudOwner = rollbackData.get("VFMODULE", "cloudowner")
+ execution.setVariable("DCVFMR_cloudOwner", cloudOwner)
String heatStackId = rollbackData.get("VFMODULE", "heatstackid")
execution.setVariable("DCVFMR_heatStackId", heatStackId)
String requestId = rollbackData.get("VFMODULE", "msorequestid")
@@ -265,7 +265,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
@@ -360,6 +360,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
String origRequestId = execution.getVariable("DCVFMR_requestId")
String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId")
+ String cloudOwner = execution.getVariable("DCVFMR_cloudOwner")
String vnfId = execution.getVariable("DCVFMR_vnfId")
String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId")
@@ -375,6 +376,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
@@ -448,7 +450,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue());
+ "BPMN", ErrorCode.UnknownError.getValue());
String processKey = getProcessKey(execution);
exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule")
@@ -609,7 +611,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage())
}
}
@@ -627,7 +629,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED setSuccessfulRollbackStatus")
@@ -647,7 +649,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing setFailedRollbackStatus.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED setFailedRollbackStatus")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
index 24528db473..e1b0776d3b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
@@ -23,13 +23,12 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.db.catalog.beans.HomingInstance
+import org.onap.so.logger.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.GenericVnf
-import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -42,17 +41,12 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
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.springframework.web.util.UriUtils
-import org.json.JSONObject
-
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
/**
* This class supports the DoCreateVnf building block subflow
@@ -222,7 +216,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("DoCVNF_sdncCallbackUrl", sdncCallbackUrl)
@@ -368,7 +362,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
resourceClient.connect(uri, siUri)
}catch(Exception ex) {
- logger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process ", ex)
+ logger.debug("Error Occured in DoCreateVnf CreateGenericVnf Process: {}", ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf CreateGenericVnf Process")
}
logger.trace("COMPLETED DoCreateVnf CreateGenericVnf Process")
@@ -414,7 +408,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCAssignRequest", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCAssignRequest")
@@ -632,7 +626,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCGetRequest Process")
@@ -671,7 +665,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
index f0680e227c..725a139b59 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
@@ -39,8 +39,8 @@ import org.onap.so.bpmn.core.json.DecomposeJsonUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources;
-import org.onap.so.logger.MsoLogger
+import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
+import org.onap.so.logger.ErrorCode
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.logger.MessageEnum
@@ -310,7 +310,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessAddOnModule")
@@ -328,7 +328,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing postProcessAddOnModule ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage())
}
logger.trace("COMPLETED postProcessAddOnModule")
@@ -358,7 +358,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing validateBaseModule ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage())
}
logger.trace("COMPLETED validateBaseModule")
@@ -389,7 +389,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
}
logger.trace("COMPLETED validateAddOnModule")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy
index 6f4c030683..3209f52fef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy
@@ -22,8 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.*;
-
+import org.onap.so.logger.ErrorCode
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -34,7 +33,6 @@ import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -167,7 +165,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessCreateVfModuleRollback")
@@ -187,14 +185,14 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessCreateVfModuleRollback Method:\n" + e.getMessage())
}
if (rolledBack == false) {
logger.debug("Failure on DoCreateVfModuleRollback")
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Unsuccessful rollback of DoCreateVfModule ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule")
}
logger.trace("COMPLETED postProcessCreateVfModuleRollback")
@@ -220,7 +218,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCDeactivateRequest")
@@ -342,7 +340,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
- "Processing setSuccessfulRollbackStatus ", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ "Processing setSuccessfulRollbackStatus ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED setSuccessfulRollbackStatus")
@@ -364,7 +362,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
- "Processing setFailedRollbackStatus. ", "BPMN",MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ "Processing setFailedRollbackStatus. ", "BPMN",ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED setFailedRollbackStatus")
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 0c14827f22..f1b7328bcc 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
@@ -22,6 +22,8 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.ErrorCode
+
import static org.apache.commons.lang3.StringUtils.*;
import javax.xml.parsers.DocumentBuilder
@@ -39,7 +41,6 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils;
@@ -533,7 +534,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
- MsoLogger.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/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
index f476b080b7..1912d65ce3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.aai.domain.yang.AllottedResource
+import org.onap.so.logger.ErrorCode
import javax.ws.rs.core.UriBuilder
@@ -31,15 +32,13 @@ import static org.apache.commons.lang3.StringUtils.*;
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.onap.so.bpmn.common.scripts.AaiUtil
+import org.json.JSONArray
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -947,7 +946,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e);
+ ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preUpdateServiceOperationStatus Process ")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
index 9c04328d0d..a54d90b2bf 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
@@ -44,8 +44,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -466,7 +466,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
@@ -518,7 +518,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
@@ -559,7 +559,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
@@ -999,7 +999,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
index e3e3990527..26233811ae 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
@@ -24,18 +24,17 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.aai.domain.yang.NetworkPolicies
import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.so.logger.ErrorCode
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
-import org.onap.so.bpmn.common.scripts.VfModule
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
@@ -44,10 +43,8 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.Node
@@ -114,6 +111,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("tenantId", tenantId)
String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
execution.setVariable("cloudSiteId", cloudSiteId)
+ String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
// Source is HARDCODED
String source = "VID"
execution.setVariable("source", source)
@@ -179,6 +178,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("vfModuleModelName", vfModuleModelName)
String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region")
execution.setVariable("cloudSiteId", cloudSiteId)
+ String cloudOwner = utils.getNodeText(xml, "cloud-owner")
+ execution.setVariable("cloudOwner", cloudOwner)
}
// formulate the request for PrepareUpdateAAIVfModule
@@ -284,6 +285,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
def origRequestId = execution.getVariable('requestId')
def srvInstId = execution.getVariable("serviceInstanceId")
def aicCloudRegion = execution.getVariable("cloudSiteId")
+ def cloudOwner = execution.getVariable("cloudOwner")
def vnfId = execution.getVariable("vnfId")
def vfModuleId = execution.getVariable("vfModuleId")
def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId')
@@ -299,6 +301,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
@@ -358,7 +361,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
+ "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable("DoDVfMod_deleteGenericVnfResponse"))
@@ -579,7 +582,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
@@ -618,8 +621,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
logger.debug("Received orchestration status from A&AI: " + orchestrationStatus)
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -628,7 +630,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
index 0c244e8e67..f0182e5614 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
@@ -26,6 +26,7 @@ import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.NetworkPolicies
import org.onap.aai.domain.yang.NetworkPolicy
import org.onap.aai.domain.yang.VfModule
+import org.onap.so.logger.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -44,13 +45,12 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
public class DoDeleteVfModuleFromVnf extends VfModuleBase {
private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleFromVnf.class);
-
+
def Prefix="DDVFMV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -66,7 +66,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
initProcessVariables(execution)
try {
-
+
// Building Block-type request
// Set mso-request-id to request-id for VNF Adapter interface
@@ -75,10 +75,13 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
execution.setVariable("requestId", requestId)
logger.debug("msoRequestId: " + requestId)
String tenantId = execution.getVariable("tenantId")
- logger.debug("tenantId: " + tenantId)
+ logger.debug("tenantId: " + tenantId)
String cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("cloudSiteId", cloudSiteId)
logger.debug("cloudSiteId: " + cloudSiteId)
+ String cloudOwner = execution.getVariable("cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
// Source is HARDCODED
String source = "VID"
execution.setVariable("source", source)
@@ -99,28 +102,26 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
}
else {
execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId)
- }
+ }
String sdncVersion = execution.getVariable("sdncVersion")
if (sdncVersion == null) {
sdncVersion = "1707"
}
execution.setVariable(Prefix + "sdncVersion", sdncVersion)
- logger.debug("Incoming Sdnc Version is: " + sdncVersion)
-
+ logger.debug("Incoming Sdnc Version is: " + sdncVersion)
+
String sdncCallbackUrl = (String) UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
+ ErrorCode.UnknownError.getValue(), "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
logger.debug("SDNC Callback URL is: " + sdncCallbackUrl)
-
-
}catch(BpmnError b){
throw b
}catch(Exception e){
@@ -128,7 +129,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!")
}
}
-
+
public void queryAAIForVfModule(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.queryAAIForVfModule(' +
'execution=' + execution.getId() +
@@ -151,8 +152,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
execution.setVariable('DDVMFV_getVnfResponse', "Generic Vnf not found!")
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
execution.setVariable('DDVMFV_getVnfResponseCode', 500)
execution.setVariable('DDVFMV_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
}
@@ -162,11 +162,11 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage())
}
}
-
+
/**
* Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID
* exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module
@@ -215,7 +215,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
}
}
@@ -241,7 +241,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
@@ -363,6 +363,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
def origRequestId = execution.getVariable('requestId')
def srvInstId = execution.getVariable("serviceInstanceId")
def aicCloudRegion = execution.getVariable("cloudSiteId")
+ def cloudOwner = execution.getVariable("cloudOwner")
def vnfId = execution.getVariable("vnfId")
def vfModuleId = execution.getVariable("vfModuleId")
def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId')
@@ -378,6 +379,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
@@ -403,7 +405,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"),
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
+ "BPMN", ErrorCode.UnknownError.getValue(), "Exception");
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable("DDVFMV_deleteGenericVnfResponse"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
index 787b582808..6acf2223b0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
@@ -217,6 +217,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
*/
public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) {
def cloudRegion = execution.getVariable(prefix+'aicCloudRegion')
+ def cloudOwner = execution.getVariable(prefix+'cloudOwner')
def tenantId = execution.getVariable('tenantId') // input parameter (optional) - see preProcessRequest
def volumeGroupId = execution.getVariable('volumeGroupId') // input parameter (required)
def volumeGroupHeatStackId = execution.getVariable(prefix+'volumeGroupHeatStackId') // from AAI query volume group
@@ -233,6 +234,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
String vnfAdapterRestRequest = """
<deleteVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
<volumeGroupStackId>${MsoUtils.xmlEscape(volumeGroupHeatStackId)}</volumeGroupStackId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
index a2c6a82a93..ca367d0045 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
@@ -44,8 +44,8 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -111,7 +111,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception");
+ ErrorCode.UnknownError.getValue(), "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
@@ -240,7 +240,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule." + e, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCAssignRequest ")
@@ -322,7 +322,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}
if (vfModuleBaseEntry != null) {
vfModulesList.add(vfModuleBaseEntry)
- }
+ }
}
}else{
execution.setVariable('DCVFM_queryAAIVfModuleResponseCode', 404)
@@ -331,8 +331,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}
execution.setVariable("DDVAM_vfModules", vfModulesList)
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -341,7 +340,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
@@ -369,7 +368,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule." + e, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage())
}
logger.trace("COMPLETED prepareNextModuleToDelete ")
@@ -395,7 +394,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preProcessSDNCDeactivateRequest ")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
index 7f168d99ad..ce3b243533 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
@@ -21,6 +21,8 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.ErrorCode
+
import static org.apache.commons.lang3.StringUtils.*;
import org.camunda.bpm.engine.delegate.BpmnError
@@ -32,7 +34,6 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils;
@@ -139,7 +140,7 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
- MsoLogger.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/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
index 905afb53d5..1b089d2a2b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
@@ -33,6 +33,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.camunda.bpm.engine.delegate.BpmnError
import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.ErrorCode
import javax.ws.rs.core.Response
@@ -47,7 +48,6 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.NsScaleParameters
import org.onap.so.bpmn.infrastructure.vfcmodel.NsParameters
import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
@@ -184,7 +184,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
} catch (InterruptedException e) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Time Delay exception" + e, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
}
}
@@ -217,7 +217,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
logger.trace("Completed Execute VF-C adapter Post Process ")
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " +
- "while executing VFC Post Call.", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), e);
+ "while executing VFC Post Call.", "BPMN", ErrorCode.UnknownError.getValue(), e);
throw new BpmnError("MSOWorkflowException")
}
return apiResponse
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
index 4fe30803c4..508131279a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
@@ -195,7 +195,6 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_initResOperStatusRequest", payload)
logger.info( "Outgoing initResourceOperationStatus: \n" + payload)
- utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
logger.info( "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index 47647bd9a6..a05d2527b0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -44,8 +44,8 @@ import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.constants.Defaults
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -143,6 +143,12 @@ public class DoUpdateVfModule extends VfModuleBase {
execution.setVariable("DOUPVfMod_aicCloudRegion", cloudSiteId)
logger.debug("cloudSiteId: " + cloudSiteId)
+
+ //cloudOwner
+ def cloudOwner = execution.getVariable("cloudOwner")
+ execution.setVariable("DOUPVfMod_cloudOwner", cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
+
//vnfType
def vnfType = execution.getVariable("vnfType")
execution.setVariable("DOUPVfMod_vnfType", vnfType)
@@ -304,6 +310,7 @@ public class DoUpdateVfModule extends VfModuleBase {
execution.setVariable('DOUPVfMod_modelCustomizationUuid', getNodeTextForce(vnfInputs, 'model-customization-id'))
execution.setVariable('DOUPVfMod_serviceId', getRequiredNodeText(execution, vnfInputs, 'service-id'))
execution.setVariable('DOUPVfMod_aicCloudRegion', getRequiredNodeText(execution, vnfInputs, 'aic-cloud-region'))
+ execution.setVariable('DOUPVfMod_cloudOwner', getRequiredNodeText(execution, vnfInputs, 'cloud-owner'))
execution.setVariable('DOUPVfMod_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id'))
//isBaseVfModule
def isBaseVfModule = "false"
@@ -327,7 +334,7 @@ public class DoUpdateVfModule extends VfModuleBase {
if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) {
def msg = 'Required variable \'mso.workflow.sdncadapter.callback\' is missing'
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -337,7 +344,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -378,7 +385,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage())
}
}
@@ -429,14 +436,14 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch(BpmnError b){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Rethrowing MSOWorkflowException", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + b);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + b);
throw b
}catch (Exception e) {
// try error
String errorMessage = "Bpmn error encountered in CreateVfModule flow. Unexpected Response from AAI - " + e.getMessage()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage())
}
logger.trace('Exited ' + method)
@@ -543,7 +550,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage())
}
}
@@ -607,7 +614,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage())
}
}
@@ -640,6 +647,7 @@ public class DoUpdateVfModule extends VfModuleBase {
heatStackId = vfModule.getHeatStackId()
}
def cloudId = execution.getVariable('DOUPVfMod_aicCloudRegion')
+ def cloudOwner = execution.getVariable('DOUPVfMod_cloudOwner')
def vnfType = execution.getVariable('DOUPVfMod_vnfType')
def vnfName = execution.getVariable('DOUPVfMod_vnfName')
def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName')
@@ -672,6 +680,7 @@ public class DoUpdateVfModule extends VfModuleBase {
String vnfAdapterRestRequest = """
<updateVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudId)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
@@ -709,7 +718,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage())
}
}
@@ -757,7 +766,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
@@ -831,7 +840,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage())
}
}
@@ -934,7 +943,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage())
}
}
@@ -955,7 +964,7 @@ public class DoUpdateVfModule extends VfModuleBase {
def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException')
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
logger.trace('Exited ' + method)
} catch (BpmnError e) {
@@ -963,7 +972,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage())
}
}
@@ -1032,8 +1041,7 @@ public class DoUpdateVfModule extends VfModuleBase {
}
}
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -1042,7 +1050,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
index 3d8205fd2a..eb788a85b7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.ErrorCode
import javax.ws.rs.core.Response
import org.camunda.bpm.engine.delegate.BpmnError
@@ -41,7 +42,6 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
@@ -265,8 +265,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
}
execution.setVariable("DUVAM_vfModules", vfModulesList)
} catch (Exception ex) {
- ex.printStackTrace()
- logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET: {}', ex.getMessage(), ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
logger.trace('Exited ' + method)
@@ -275,7 +274,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
}
}
@@ -331,7 +330,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage())
}
logger.trace("COMPLETED prepareNextModuleToUpdate ")
@@ -407,7 +406,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
index 534e5b513a..4321dbadd5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
@@ -34,8 +34,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.*
import org.onap.so.client.appc.ApplicationControllerOrchestrator
import org.onap.so.client.appc.ApplicationControllerSupport
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -235,7 +235,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
String restFaultMessage = e.getMessage()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -278,7 +278,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -329,7 +329,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
}
}
@@ -371,7 +371,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -415,7 +415,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -463,7 +463,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -533,19 +533,19 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (java.lang.NoSuchMethodError e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy
index 5f215479e9..ef4a78ffde 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy
@@ -21,41 +21,14 @@
package org.onap.so.bpmn.infrastructure.scripts
-import groovy.json.JsonOutput
-
-import groovy.json.JsonSlurper
-import groovy.util.Node
-import groovy.util.XmlParser;
-import groovy.xml.QName
-
-import java.io.Serializable;
-import java.util.UUID;
+import org.onap.so.logger.ErrorCode
import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd
import org.camunda.bpm.engine.delegate.DelegateExecution
-
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
-import org.onap.so.bpmn.common.scripts.VidUtils;
-import org.onap.so.bpmn.core.RollbackData
-import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.bpmn.core.domain.ModelInfo
-import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.domain.VnfResource
-import org.onap.so.client.aai.*
-
-import org.onap.so.client.appc.ApplicationControllerClient;
-import org.onap.so.client.appc.ApplicationControllerSupport;
-import org.onap.so.client.aai.AAIResourcesClient
-import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIUri
-import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -116,7 +89,7 @@ public class RollbackVnf extends VnfCmBase {
String restFaultMessage = e.getMessage()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("rollbackErrorCode", "1")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
index 010ac7cda8..0afa34bdec 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
@@ -22,6 +22,8 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.ErrorCode
+
import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -33,7 +35,6 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.utils.UUIDChecker
@@ -295,7 +296,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e);
+ ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED prepareInitServiceOperationStatus Process ")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
index 4e3517e5b5..1168b20220 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
@@ -72,7 +72,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
try {
String siRequest = execution.getVariable("bpmnRequest")
- utils.logAudit(siRequest)
String requestId = execution.getVariable("mso-request-id")
execution.setVariable("msoRequestId", requestId)
@@ -277,7 +276,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
logger.error( "Outgoing updateServiceOperStatusRequest: \n" + payload)
- utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload)
}catch(Exception e){
logger.debug( "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e)
@@ -398,7 +396,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
<aetgt:ErrorCode>${MsoUtils.xmlEscape(errorCode)}</aetgt:ErrorCode>
</aetgt:WorkflowException>"""
- utils.logAudit(buildworkflowException)
sendWorkflowResponse(execution, 500, buildworkflowException)
} catch (Exception ex) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy
index 0b46a5a849..b12da9f959 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy
@@ -362,7 +362,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
String errorException = " Bpmn error encountered in UpdateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse() - "
- logger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): " + ex.getMessage())
+ logger.debug("Exception error in UpdateNetworkInstance flow, buildErrorResponse(): {}", ex.getMessage(), ex)
falloutHandlerRequest =
"""<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:ns="http://org.onap/so/request/types/v1"
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy
index 175bbbdbc9..9db5b7366a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy
@@ -28,8 +28,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -98,7 +98,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -153,7 +153,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage())
}
}
@@ -183,7 +183,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
}
}
@@ -239,7 +239,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage())
}
}
@@ -280,7 +280,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -335,7 +335,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
index cad1c6f204..2404169493 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
@@ -30,8 +30,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -223,7 +223,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
catch(Exception e) {
String restFaultMessage = e.getMessage()
logger.error("{} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
+ ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -264,7 +264,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -293,7 +293,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
}
}
@@ -347,7 +347,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage())
}
}
@@ -386,7 +386,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -439,7 +439,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -509,7 +509,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy
index f04fa002fe..575a8f3f1a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy
@@ -235,7 +235,6 @@ public class UpdateVfModuleInfraV2 {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -276,7 +275,6 @@ public class UpdateVfModuleInfraV2 {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -362,7 +360,6 @@ public class UpdateVfModuleInfraV2 {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
}
@@ -398,7 +395,6 @@ public class UpdateVfModuleInfraV2 {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- //logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
index 367a63fede..3e9b934a2e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
@@ -37,8 +37,8 @@ import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -100,6 +100,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
execution.setVariable('UPDVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type'))
execution.setVariable('UPDVfModVol_serviceId', getRequiredNodeText(execution, volumeInputs, 'service-id'))
execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region'))
+ execution.setVariable('UPDVfModVol_cloudOwner', getRequiredNodeText(execution, volumeInputs, 'cloud-owner'))
execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id'))
def volumeParams = utils.getNodeXml(request, 'volume-params')
@@ -111,7 +112,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
throw bpmnError
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -163,7 +164,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
throw e
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage())
}
}
@@ -214,7 +215,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
throw e
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVolumeGroup(): ' + e.getMessage())
}
}
@@ -255,6 +256,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
String vnfAdapterRestRequest = """
<updateVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
<volumeGroupStackId>${MsoUtils.xmlEscape(volumeGroupHeatStackId)}</volumeGroupStackId>
@@ -283,7 +285,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
throw e
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage())
}
}
@@ -328,7 +330,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
throw e
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepDbInfraDbRequest(): ' + e.getMessage())
}
}
@@ -366,7 +368,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
throw e
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepCompletionHandlerRequest(): ' + e.getMessage())
}
}
@@ -416,7 +418,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
throw e
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in prepFalloutHandler(): ' + e.getMessage())
}
}
@@ -444,7 +446,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
'\' retrieved from AAI for Volume Group Id \'' + volumeGroupId + '\', AIC Cloud Region \'' + aicCloudRegion + '\''
logger.error("{} {} Error in UpdateVfModuleVol: {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage)
+ ErrorCode.UnknownError.getValue(), errorMessage)
WorkflowException exception = new WorkflowException(processKey, 5000, errorMessage)
execution.setVariable("WorkflowException", exception)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
index 9e1694089e..ab7b659b51 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
@@ -41,8 +41,8 @@ import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -135,6 +135,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
execution.setVariable('UPDVfModVol_vnfVersion', getRequiredNodeText(execution, volumeInputs, 'asdc-service-model-version'))
execution.setVariable('UPDVfModVol_serviceId', utils.getNodeText(volumeInputs, 'service-id'))
execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region'))
+ execution.setVariable('UPDVfModVol_cloudRegion', getRequiredNodeText(execution, volumeInputs, 'cloud-owner'))
execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id'))
//execution.setVariable('UPDVfModVol_modelCustomizationId', getRequiredNodeText(execution, volumeInputs, 'model-customization-id'))
@@ -328,6 +329,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
String vnfAdapterRestRequest = """
<updateVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vnfName>${MsoUtils.xmlEscape(vnfName)}</vnfName>
@@ -480,7 +482,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
ExceptionUtil exceptionUtil = new ExceptionUtil()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' +
- 'UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception")
+ 'UpdateVfModuleVol: ' + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
@@ -499,7 +501,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
ExceptionUtil exceptionUtil = new ExceptionUtil()
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' +
- 'UpdateVfModuleVol: ' + errorMessage, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception")
+ 'UpdateVfModuleVol: ' + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
index 60af2a0fe2..26a509022c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
@@ -35,8 +35,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIRestClientImpl
import org.onap.so.client.aai.AAIUpdatorImpl
import org.onap.so.client.aai.AAIValidatorImpl
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -214,7 +214,7 @@ public class UpdateVnfInfra extends VnfCmBase {
catch(Exception e) {
String restFaultMessage = e.getMessage()
logger.error("{} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
+ ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -255,7 +255,7 @@ public class UpdateVnfInfra extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -305,7 +305,7 @@ public class UpdateVnfInfra extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
}
}
@@ -346,7 +346,7 @@ public class UpdateVnfInfra extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -389,7 +389,7 @@ public class UpdateVnfInfra extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -436,7 +436,7 @@ public class UpdateVnfInfra extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
index a83b36fd6e..09e7516f85 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
@@ -46,8 +46,8 @@ import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.appc.ApplicationControllerClient
import org.onap.so.client.appc.ApplicationControllerSupport
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -100,7 +100,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -149,7 +149,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
}
}
@@ -190,7 +190,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -320,7 +320,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVnf(): ' + e.getMessage())
}
}
@@ -362,7 +362,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -409,7 +409,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -454,7 +454,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -500,7 +500,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -579,19 +579,19 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
logger.trace('Exited ' + method)
} catch (BpmnError e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (java.lang.NoSuchMethodError e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
@@ -658,7 +658,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
@@ -729,7 +729,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
index 0a748db561..90523a02be 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
@@ -33,8 +33,8 @@ import org.onap.so.client.aai.*
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -159,7 +159,7 @@ public class VnfConfigUpdate extends VnfCmBase {
catch(Exception e) {
String restFaultMessage = e.getMessage()
logger.error("{} {} Exception Encountered - \n {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
+ ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -201,7 +201,7 @@ public class VnfConfigUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -242,7 +242,7 @@ public class VnfConfigUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -285,7 +285,7 @@ public class VnfConfigUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -333,7 +333,7 @@ public class VnfConfigUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -378,7 +378,7 @@ public class VnfConfigUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -424,7 +424,7 @@ public class VnfConfigUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
index fe6045dc3b..05aff713bc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
@@ -38,8 +38,8 @@ import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.appc.ApplicationControllerClient
import org.onap.so.client.appc.ApplicationControllerSupport
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -179,7 +179,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
catch(Exception e) {
String restFaultMessage = e.getMessage()
logger.error("{} {} Exception Encountered - {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
+ ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
@@ -220,7 +220,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
@@ -262,7 +262,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage())
@@ -305,7 +305,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} Caught exception in {} \n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
+ ErrorCode.UnknownError.getValue(), method, e)
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
//exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage())
@@ -352,7 +352,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
- ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -397,7 +397,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
- ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -442,7 +442,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
throw e;
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
- ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
@@ -521,17 +521,17 @@ public class VnfInPlaceUpdate extends VnfCmBase {
logger.trace('Exited ' + method)
} catch (BpmnError e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
- ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (java.lang.NoSuchMethodError e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
- ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
- ' ' + method, "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
index 628088c380..9829419128 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
@@ -19,7 +19,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.vcpe.scripts;
+package org.onap.so.bpmn.vcpe.scripts
+
+import org.onap.so.logger.ErrorCode;
import static org.apache.commons.lang3.StringUtils.*
@@ -34,7 +36,6 @@ import org.onap.so.bpmn.core.domain.*
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.springframework.web.util.UriUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -421,7 +422,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
}
@@ -848,7 +849,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
} catch (BpmnError b) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Rethrowing MSOWorkflowException", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
throw b
} catch (Exception e) {
logger.debug("Caught Exception during processJavaException Method: " + e)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
index 312f3ca102..a1cdacaf08 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
@@ -30,8 +30,8 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -421,7 +421,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
}catch(BpmnError b){
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Rethrowing MSOWorkflowException", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue());
throw b
}catch(Exception e){
logger.debug("Caught Exception during processJavaException Method: " + e)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
index 8bf16a0dc4..24589a0893 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
@@ -34,8 +34,8 @@ 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.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -587,7 +587,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
}
logger.trace("end preProcessSDNCGet")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
index 255b1f32eb..f27b3d94b1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
@@ -30,8 +30,8 @@ import org.onap.so.bpmn.common.scripts.AllottedResourceUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -207,7 +207,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
}catch(Exception ex){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
logger.trace("end deleteAaiAR")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
index d74510a25e..b6e7470834 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
@@ -33,8 +33,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -522,7 +522,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
}
logger.trace("end preProcessSDNCGet")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
index def3cca2f7..ad2c9e155d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
@@ -27,20 +27,14 @@ import org.onap.so.bpmn.common.scripts.*;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.MsoUtils
-import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
-
-
-import java.util.UUID;
+import org.onap.so.logger.ErrorCode
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.apache.commons.lang3.*
-import org.springframework.web.util.UriUtils;
+
import static org.apache.commons.lang3.StringUtils.*
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -214,7 +208,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
}catch(Exception ex){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
logger.trace("end deleteAaiAR")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
index 8929f67cfc..ca1b2ded2a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
@@ -31,8 +31,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -353,7 +353,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
}catch(Exception ex){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:" + ex);
+ ErrorCode.UnknownError.getValue(), "Exception is:" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
logger.trace("end deleteAaiAR")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
index 84e77afda7..0da6fd26f4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
@@ -31,8 +31,8 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -357,7 +357,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
}catch(Exception ex){
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
}
logger.trace("end deleteAaiAR")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
index 53f6b78d69..fb5d04328f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
@@ -33,7 +33,7 @@ import java.util.Spliterator;
public final class JsonUtilForPnfCorrelationId {
- private static final String JSON_PNF_CORRELATION_ID_FIELD_NAME = "pnfCorrelationId";
+ private static final String JSON_PNF_CORRELATION_ID_FIELD_NAME = "correlationId";
static List<String> parseJsonToGelAllPnfCorrelationId(String json) {
JsonElement je = new JsonParser().parse(json);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java
index 0d7c4abeee..ee8743f846 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java
@@ -24,7 +24,6 @@ import java.util.List;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.core.UrnPropertiesReader;
-import org.onap.so.logger.MsoLogger;
public class BPMNProperties {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java
index ae320bdfb0..292f6ef575 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.vfcmodel;
-import org.onap.so.logger.MsoLogger;
/**
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 1f837eb444..113f05d3ca 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
@@ -62,8 +62,8 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.util.UriUtils;
@@ -688,7 +688,7 @@ public class ServicePluginFactory {
return mapper.readValue(jsonstr, type);
} catch (IOException e) {
logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
+ ErrorCode.BusinessProcesssError.getValue(), e);
}
return null;
}
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 4f02fe2ec0..4c9bb4259e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -45,8 +45,8 @@ 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;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDbConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -285,7 +285,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception);
logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(),
" updateProgress catch exception: ", this.getTaskName(),
- MsoLogger.ErrorCode.UnknownError.getValue(), exception.getClass().toString());
+ ErrorCode.UnknownError.getValue(), exception.getClass().toString());
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
index e7ebe23e75..fc5960b92f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
@@ -165,6 +165,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345")
+ when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner")
when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData())
List fqdnList = new ArrayList()
fqdnList.add("test")
@@ -194,6 +195,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345")
+ when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner")
when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData())
List fqdnList = new ArrayList()
fqdnList.add("test")
@@ -223,6 +225,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345")
+ when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner")
when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData())
List fqdnList = new ArrayList()
fqdnList.add("test")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy
index d635b2311a..59a2b0eda3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy
@@ -182,6 +182,7 @@ class DoUpdateVfModuleTest extends MsoGroovyTest{
ExecutionEntity mockExecution = setupMock()
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP")
+ when(mockExecution.getVariable(prefix + "cloudRegion")).thenReturn("CloudOwner")
when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32")
when(mockExecution.getVariable(prefix + "volumeGroupStackId")).thenReturn("12345")
when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("PCRF::module-0-2")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy
index 06ae576307..8af15de75b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy
@@ -143,6 +143,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP")
+ when(mockExecution.getVariable(prefix + "cloudOwner")).thenReturn("CloudOwner")
when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("")
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setHeatStackId("heatStackId")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
index 02a6f20992..17a6ee09d8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
@@ -29,13 +29,13 @@ import org.junit.Test;
public class JsonUtilForPnfCorrelationIdTest {
- private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"corrTest1\","
- + "\"key1\":\"value1\"},{\"pnfCorrelationId\": \"corrTest2\",\"key2\":\"value2\"}]";
+ private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"correlationId\": \"corrTest1\","
+ + "\"key1\":\"value1\"},{\"correlationId\": \"corrTest2\",\"key2\":\"value2\"}]";
- private static final String JSON_WITH_ONE_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\":\"corrTest3\"}]";
+ private static final String JSON_WITH_ONE_PNF_CORRELATION_ID = "[{\"correlationId\":\"corrTest3\"}]";
private static final String JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS =
- "[\"{\\\"pnfCorrelationId\\\":\\\"corrTest4\\\"}\", \"{\\\"pnfCorrelationId\\\":\\\"corrTest5\\\"}\"]";
+ "[\"{\\\"correlationId\\\":\\\"corrTest4\\\"}\", \"{\\\"correlationId\\\":\\\"corrTest5\\\"}\"]";
private static final String JSON_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index 078c2f7784..60f51ff783 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -58,8 +58,8 @@ public class PnfEventReadyDmaapClientTest {
private static final String PNF_CORRELATION_ID = "corrTestId";
private static final String PNF_CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId";
- private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"%s\","
- + "\"value\":\"value1\"},{\"pnfCorrelationId\": \"corr\",\"value\":\"value2\"}]";
+ private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"correlationId\": \"%s\","
+ + "\"value\":\"value1\"},{\"correlationId\": \"corr\",\"value\":\"value2\"}]";
private static final String JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index 0243ce8ae6..8adffb29b5 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -1,150 +1,166 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.onap.so</groupId>
- <artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>so-bpmn-tasks</artifactId>
- <packaging>jar</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>1.8</maven.compiler.source>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>default-test</id>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <includes>
- <include>**/UnitTestSuite.java</include>
- </includes>
- </configuration>
- </execution>
- <execution>
- <id>integration-test</id>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <includes>
- <include>**/IntegrationTestSuite.java</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-codegen-maven-plugin</artifactId>
- <version>2.3.1</version>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <inputSpec>${project.basedir}/src/main/resources/naming-service/swagger.json</inputSpec>
- <apiPackage>org.onap.namingservice.api</apiPackage>
- <modelPackage>org.onap.namingservice.model</modelPackage>
- <invokerPackage>org.onap.namingservice.invoker</invokerPackage>
- </configuration>
- </execution>
- </executions>
- <configuration>
- <inputSpec>${project.basedir}/src/main/resources/swagger.json</inputSpec>
- <language>java</language>
- <configOptions>
- <sourceFolder>src/gen/java/main</sourceFolder>
- <serializableModel>true</serializableModel>
- </configOptions>
- <output>${project.build.directory}/generated-sources</output>
- <generateApis>false</generateApis>
- <library>jersey2</library>
- <generateSupportingFiles>false</generateSupportingFiles>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <!-- Import dependency management from Spring Boot -->
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${springboot.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.camunda.bpm.springboot</groupId>
- <artifactId>camunda-bpm-spring-boot-starter</artifactId>
- <version>${camunda.springboot.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-contract-wiremock</artifactId>
- <version>1.2.4.RELEASE</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.camunda.bpm.extension.mockito</groupId>
- <artifactId>camunda-bpm-mockito</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>MSOCommonBPMN</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>so-bpmn-infrastructure-common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-adapter-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.sdnc.northbound</groupId>
- <artifactId>generic-resource-api-client</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>ch.vorburger.mariaDB4j</groupId>
- <artifactId>mariaDB4j</artifactId>
- <version>2.2.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- </dependencies>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.onap.so</groupId>
+ <artifactId>bpmn</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>so-bpmn-tasks</artifactId>
+ <packaging>jar</packaging>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/UnitTestSuite.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/IntegrationTestSuite.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <version>2.3.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${project.basedir}/src/main/resources/naming-service/swagger.json</inputSpec>
+ <apiPackage>org.onap.namingservice.api</apiPackage>
+ <modelPackage>org.onap.namingservice.model</modelPackage>
+ <invokerPackage>org.onap.namingservice.invoker</invokerPackage>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <inputSpec>${project.basedir}/src/main/resources/swagger.json</inputSpec>
+ <language>java</language>
+ <configOptions>
+ <sourceFolder>src/gen/java/main</sourceFolder>
+ <serializableModel>true</serializableModel>
+ </configOptions>
+ <output>${project.build.directory}/generated-sources</output>
+ <generateApis>false</generateApis>
+ <library>jersey2</library>
+ <generateSupportingFiles>false</generateSupportingFiles>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <!-- Import dependency management from Spring Boot -->
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${springboot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.camunda.bpm.springboot</groupId>
+ <artifactId>camunda-bpm-spring-boot-starter</artifactId>
+ <version>${camunda.springboot.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-contract-wiremock</artifactId>
+ <version>1.2.4.RELEASE</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.camunda.bpm.extension.mockito</groupId>
+ <artifactId>camunda-bpm-mockito</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>MSOCommonBPMN</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-bpmn-infrastructure-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-adapter-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.sdnc.northbound</groupId>
+ <artifactId>generic-resource-api-client</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>ch.vorburger.mariaDB4j</groupId>
+ <artifactId>mariaDB4j</artifactId>
+ <version>2.2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>nl.jqno.equalsverifier</groupId>
+ <artifactId>equalsverifier</artifactId>
+ <version>2.5.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java
index 6571971347..bdb46e8d2b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java
@@ -41,7 +41,7 @@ public class AAICommonTasks {
public Optional<String> getServiceType(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
ModelInfoServiceInstance model = serviceInstance.getModelInfoServiceInstance();
if (model != null) {
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 8dd55d9eac..dad84e53a9 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
@@ -62,8 +62,8 @@ import org.onap.so.client.orchestration.AAIVfModuleResources;
import org.onap.so.client.orchestration.AAIVnfResources;
import org.onap.so.client.orchestration.AAIVolumeGroupResources;
import org.onap.so.client.orchestration.AAIVpnBindingResources;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -104,7 +104,7 @@ public class AAICreateTasks {
public void createServiceInstance(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = execution.getGeneralBuildingBlock().getCustomer();
aaiSIResources.createServiceInstance(serviceInstance, customer);
} catch (Exception ex) {
@@ -115,13 +115,13 @@ public class AAICreateTasks {
public void createServiceSubscription(BuildingBlockExecution execution){
try{
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution,
- ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = execution.getGeneralBuildingBlock().getCustomer();
if (null == customer) {
String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: "
+ serviceInstance.getServiceInstanceId();
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), errorMessage);
+ ErrorCode.UnknownError.getValue(), errorMessage);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
}
aaiSIResources.createServiceSubscription(customer);
@@ -135,7 +135,7 @@ public class AAICreateTasks {
public void createProject(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Project project = serviceInstance.getProject();
if(project != null) {
if (project.getProjectName() == null || "".equals(project.getProjectName())) {
@@ -151,7 +151,7 @@ public class AAICreateTasks {
public void createOwningEntity(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
OwningEntity owningEntity = serviceInstance.getOwningEntity();
String owningEntityId = owningEntity.getOwningEntityId();
String owningEntityName = owningEntity.getOwningEntityName();
@@ -166,13 +166,13 @@ public class AAICreateTasks {
if (owningEntityName == null || "".equals(owningEntityName)) {
String msg = "Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName.";
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg);
+ ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
} else {
if(aaiSIResources.existsOwningEntityName(owningEntityName)){
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("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg);
+ ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}else{
aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
@@ -187,8 +187,8 @@ public class AAICreateTasks {
public void createVnf(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
execution.setVariable("callHoming", Boolean.TRUE.equals(vnf.isCallHoming()));
aaiVnfResources.createVnfandConnectServiceInstance(vnf, serviceInstance);
} catch (Exception ex) {
@@ -198,7 +198,7 @@ public class AAICreateTasks {
public void createPlatform(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
Platform platform = vnf.getPlatform();
if(platform != null) {
if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) {
@@ -215,7 +215,7 @@ public class AAICreateTasks {
public void createLineOfBusiness(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness();
if(lineOfBusiness != null) {
if (lineOfBusiness.getLineOfBusinessName() == null || "".equals(lineOfBusiness.getLineOfBusinessName())) {
@@ -233,8 +233,8 @@ public class AAICreateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion);
aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion);
@@ -246,8 +246,8 @@ public class AAICreateTasks {
public void createVfModule(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
int moduleIndex = 0;
if (vfModule.getModelInfoVfModule() != null && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) {
moduleIndex = this.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, vfModule);
@@ -266,11 +266,11 @@ public class AAICreateTasks {
*/
public void connectVfModuleToVolumeGroup(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
VolumeGroup volumeGroup = null;
try{
- volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch (BBObjectNotFoundException e){
logger.info("VolumeGroup not found. Skipping Connect between VfModule and VolumeGroup");
}
@@ -289,8 +289,8 @@ public class AAICreateTasks {
*/
public void createNetwork(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
//set default to false. ToBe updated by SDNC
l3network.setIsBoundToVpn(false);
//define is bound to vpn flag as true if NEUTRON_NETWORK_TYPE is PROVIDER
@@ -319,7 +319,7 @@ public class AAICreateTasks {
*/
public void createNetworkCollection(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Collection networkCollection = serviceInstance.getCollection();
//pass name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow
//put shell in AAI
@@ -337,7 +337,7 @@ public class AAICreateTasks {
*/
public void createNetworkCollectionInstanceGroup(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup();
//set name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow
instanceGroup.setInstanceGroupName(execution.getVariable(NETWORK_COLLECTION_NAME));
@@ -356,7 +356,7 @@ public class AAICreateTasks {
*/
public void connectNetworkToTenant(BuildingBlockExecution execution) {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.connectNetworkToTenant(l3network, execution.getGeneralBuildingBlock().getCloudRegion());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -370,7 +370,7 @@ public class AAICreateTasks {
*/
public void connectNetworkToCloudRegion(BuildingBlockExecution execution) {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.connectNetworkToCloudRegion(l3network, execution.getGeneralBuildingBlock().getCloudRegion());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -390,7 +390,7 @@ public class AAICreateTasks {
cloudRegionsToSkip = Arrays.stream(cloudRegions).anyMatch(execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId()::equals);
}
if(!cloudRegionsToSkip) {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.connectVnfToCloudRegion(vnf, execution.getGeneralBuildingBlock().getCloudRegion());
}
} catch (Exception ex) {
@@ -405,7 +405,7 @@ public class AAICreateTasks {
*/
public void connectVnfToTenant(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.connectVnfToTenant(vnf, execution.getGeneralBuildingBlock().getCloudRegion());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -419,8 +419,8 @@ public class AAICreateTasks {
*/
public void connectNetworkToNetworkCollectionServiceInstance(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(l3network, serviceInstance);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -434,8 +434,8 @@ public class AAICreateTasks {
*/
public void connectNetworkToNetworkCollectionInstanceGroup(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
//connect network only if Instance Group / Collection objects exist
if (serviceInstance.getCollection() != null && serviceInstance.getCollection().getInstanceGroup() != null)
aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(l3network, serviceInstance.getCollection().getInstanceGroup());
@@ -446,7 +446,7 @@ public class AAICreateTasks {
public void createConfiguration(BuildingBlockExecution execution){
try{
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.createConfiguration(configuration);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -455,8 +455,8 @@ public class AAICreateTasks {
public void createInstanceGroupVnf(BuildingBlockExecution execution){
try{
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
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 6e4a5f3d15..095fd7f86d 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
@@ -82,8 +82,8 @@ public class AAIDeleteTasks {
private AAIInstanceGroupResources aaiInstanceGroupResources;
public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
execution.setVariable("aaiVfModuleRollback", false);
try {
@@ -95,7 +95,7 @@ public class AAIDeleteTasks {
}
public void deleteVnf(BuildingBlockExecution execution) throws Exception {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
execution.setVariable("aaiVnfRollback", false);
try {
@@ -108,7 +108,7 @@ public class AAIDeleteTasks {
public void deleteServiceInstance(BuildingBlockExecution execution) throws Exception {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiSIResources.deleteServiceInstance(serviceInstance);
}
catch(Exception ex) {
@@ -119,7 +119,7 @@ public class AAIDeleteTasks {
public void deleteNetwork(BuildingBlockExecution execution) throws Exception {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.deleteNetwork(l3network);
execution.setVariable("isRollbackNeeded", true);
}
@@ -130,7 +130,7 @@ public class AAIDeleteTasks {
public void deleteCollection(BuildingBlockExecution execution) throws Exception {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiNetworkResources.deleteCollection(serviceInstance.getCollection());
}
catch(Exception ex) {
@@ -140,7 +140,7 @@ public class AAIDeleteTasks {
public void deleteInstanceGroup(BuildingBlockExecution execution) throws Exception {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiNetworkResources.deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
}
catch(Exception ex) {
@@ -150,7 +150,7 @@ public class AAIDeleteTasks {
public void deleteVolumeGroup(BuildingBlockExecution execution) {
try {
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
} catch (Exception ex) {
@@ -159,7 +159,7 @@ public class AAIDeleteTasks {
}
public void deleteConfiguration(BuildingBlockExecution execution) {
try {
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.deleteConfiguration(configuration);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -168,7 +168,7 @@ public class AAIDeleteTasks {
public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
try {
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java
index 94529f915b..177e09d5a1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java
@@ -47,7 +47,7 @@ public class AAIFlagTasks {
public void checkVnfInMaintFlag(BuildingBlockExecution execution) {
boolean inMaint = false;
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
String vnfId = vnf.getVnfId();
inMaint = aaiVnfResources.checkInMaintFlag(vnfId);
} catch (Exception ex) {
@@ -60,7 +60,7 @@ public class AAIFlagTasks {
public void modifyVnfInMaintFlag(BuildingBlockExecution execution, boolean inMaint) {
try {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
@@ -73,4 +73,45 @@ public class AAIFlagTasks {
}
}
+ public void checkVnfClosedLoopDisabledFlag(BuildingBlockExecution execution) {
+ boolean isClosedLoopDisabled = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ isClosedLoopDisabled = aaiVnfResources.checkVnfClosedLoopDisabledFlag(vnfId);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ if (isClosedLoopDisabled) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF Close Loop Disabled in A&AI");
+ }
+ }
+
+ public void modifyVnfClosedLoopDisabledFlag(BuildingBlockExecution execution, boolean closedLoopDisabled) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+ copiedGenericVnf.setClosedLoopDisabled(closedLoopDisabled);
+ genericVnf.setClosedLoopDisabled(closedLoopDisabled);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void checkVnfPserversLockedFlag(BuildingBlockExecution execution) {
+ boolean inPserversLocked = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String vnfId = vnf.getVnfId();
+ inPserversLocked = aaiVnfResources.checkVnfPserversLockedFlag(vnfId);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ if (inPserversLocked) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF PServers in Locked in A&AI");
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
index e89dffc6d9..e0e139e290 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
@@ -71,8 +71,7 @@ public class AAIQueryTasks {
public void queryNetworkVpnBinding(BuildingBlockExecution execution) {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
- execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
if (!networkRelationships.isPresent()) {
@@ -106,8 +105,7 @@ public class AAIQueryTasks {
public void getNetworkVpnBinding(BuildingBlockExecution execution) {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
- execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
CreateNetworkRequest createNetworkRequest = execution.getVariable("createNetworkRequest");
@@ -162,8 +160,7 @@ public class AAIQueryTasks {
*/
public void queryNetworkPolicy(BuildingBlockExecution execution) {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
- execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
if (!networkRelationships.isPresent()) {
@@ -193,8 +190,7 @@ public class AAIQueryTasks {
*/
public void queryNetworkTableRef(BuildingBlockExecution execution) {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
- execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
if (!networkRelationships.isPresent()) {
@@ -229,8 +225,7 @@ public class AAIQueryTasks {
public void querySubnet(BuildingBlockExecution execution) {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
- execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
if (!networkRelationships.isPresent()) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 34598ef00a..82b61c17b5 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
@@ -82,7 +82,7 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiServiceInstanceRollback", true);
} catch (Exception ex) {
@@ -92,7 +92,7 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -101,7 +101,7 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -110,7 +110,7 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -121,7 +121,7 @@ public class AAIUpdateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
volumeGroup.setHeatStackId("");
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
@@ -134,7 +134,7 @@ public class AAIUpdateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
@@ -147,7 +147,7 @@ public class AAIUpdateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
@@ -163,7 +163,7 @@ public class AAIUpdateTasks {
if (heatStackId == null) {
heatStackId = "";
}
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
volumeGroup.setHeatStackId(heatStackId);
@@ -175,9 +175,9 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -186,8 +186,8 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) {
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -196,9 +196,9 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
if (vnf.getModelInfoGenericVnf() != null) {
multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
@@ -217,8 +217,8 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -228,8 +228,8 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeactivateVfModuleRollback", false);
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED);
execution.setVariable("aaiDeactivateVfModuleRollback", true);
} catch (Exception ex) {
@@ -266,7 +266,7 @@ public class AAIUpdateTasks {
protected void updateNetwork(BuildingBlockExecution execution, OrchestrationStatus status) {
try {
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
updateNetworkAAI(l3Network, status);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -298,7 +298,7 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) {
execution.setVariable("aaiNetworkCollectionActivateRollback", false);
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Collection networkCollection = serviceInstance.getCollection();
Collection copiedNetworkCollection = networkCollection.shallowCopyId();
@@ -314,8 +314,8 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiActivateVfModuleRollback", false);
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
execution.setVariable("aaiActivateVfModuleRollback", true);
} catch (Exception ex) {
@@ -329,8 +329,8 @@ public class AAIUpdateTasks {
if (heatStackId == null) {
heatStackId = "";
}
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
vfModule.setHeatStackId(heatStackId);
aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
} catch (Exception ex) {
@@ -345,7 +345,7 @@ public class AAIUpdateTasks {
*/
public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
execution.setVariable("aaiNetworkActivateRollback", false);
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
L3Network copiedl3network = l3network.shallowCopyId();
CreateNetworkResponse response = execution.getVariable("createNetworkResponse");
try {
@@ -386,7 +386,7 @@ public class AAIUpdateTasks {
* @throws Exception
*/
public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
L3Network copiedl3network = l3network.shallowCopyId();
UpdateNetworkResponse response = execution.getVariable("updateNetworkResponse");
try {
@@ -410,7 +410,7 @@ public class AAIUpdateTasks {
public void updateObjectNetwork(BuildingBlockExecution execution) {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.updateNetwork(l3network);
} catch(Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -423,7 +423,7 @@ public class AAIUpdateTasks {
*/
public void updateServiceInstance(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiServiceInstanceResources.updateServiceInstance(serviceInstance);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -432,7 +432,7 @@ public class AAIUpdateTasks {
public void updateObjectVnf(BuildingBlockExecution execution) {
try {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateObjectVnf(genericVnf);
} catch(Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -442,9 +442,9 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeleteVfModuleRollback", false);
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule copiedVfModule = vfModule.shallowCopyId();
copiedVfModule.setHeatStackId("");
@@ -457,8 +457,8 @@ public class AAIUpdateTasks {
public void updateModelVfModule(BuildingBlockExecution execution) {
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -466,7 +466,7 @@ public class AAIUpdateTasks {
}
public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
try {
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -475,7 +475,7 @@ public class AAIUpdateTasks {
public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
try {
- Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -486,7 +486,7 @@ public class AAIUpdateTasks {
try {
String ipv4OamAddress = execution.getVariable("oamManagementV4Address");
if (ipv4OamAddress != null) {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
genericVnf.setIpv4OamAddress(ipv4OamAddress);
@@ -503,7 +503,7 @@ public class AAIUpdateTasks {
try {
String managementV6Address = execution.getVariable("oamManagementV6Address");
if (managementV6Address != null) {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
genericVnf.setManagementV6Address(managementV6Address);
@@ -520,8 +520,8 @@ public class AAIUpdateTasks {
try {
String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn");
if (contrailServiceInstanceFqdn != null) {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn);
aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
}
@@ -530,4 +530,34 @@ public class AAIUpdateTasks {
}
}
+ public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution){
+ try{
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE);
+
+ }catch(Exception ex){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+
+ }
+
+ public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution){
+ try{
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
+
+ }catch(Exception 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 dc8f72c7a5..821dfc18b0 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
@@ -36,8 +36,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.slf4j.Logger;
@@ -136,7 +136,7 @@ public class ExecuteActivity implements JavaDelegate {
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), msg, ex);
+ ErrorCode.UnknownError.getValue(), msg, ex);
execution.setVariable("ExecuteActivityErrorMessage", msg);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java
index 4c531d46f9..67d2864204 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java
@@ -53,8 +53,8 @@ public class NetworkAdapterCreateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
Map<String, String> userInput = gBBInput.getUserInput();
String cloudRegionPo = execution.getVariable("cloudRegionPo");
@@ -69,7 +69,7 @@ public class NetworkAdapterCreateTasks {
public void processResponseFromOpenstack(BuildingBlockExecution execution) {
try {
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
if(createNetworkResponse != null) {
@@ -90,8 +90,8 @@ public class NetworkAdapterCreateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse");
Map<String, String> userInput = gBBInput.getUserInput();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java
index 41dabf9302..7e0c5f6da4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java
@@ -29,7 +29,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
import org.onap.so.client.exception.ExceptionBuilder;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -47,8 +46,8 @@ public class NetworkAdapterDeleteTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java
index 61687081d9..9eeba0445b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java
@@ -52,8 +52,8 @@ public class NetworkAdapterUpdateTasks {
public void updateNetwork(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
UpdateNetworkRequest updateNetworkRequest = networkAdapterObjectMapper.createNetworkUpdateRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, gBBInput.getUserInput(), gBBInput.getCustomer());
execution.setVariable("networkAdapterRequest", updateNetworkRequest);
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 1815fcd827..ae9e6e7488 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
@@ -65,12 +65,12 @@ public class VnfAdapterCreateTasks {
ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
VfModule vfModule;
String sdncVfModuleQueryResponse = null;
try {
- vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
}
@@ -94,11 +94,11 @@ public class VnfAdapterCreateTasks {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VolumeGroup volumeGroup = null;
try {
- volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch(BBObjectNotFoundException bbException) {
}
CloudRegion cloudRegion = gBBInput.getCloudRegion();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
index 759ec61878..a96e2702cd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
@@ -58,8 +58,8 @@ public class VnfAdapterDeleteTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
execution.setVariable(VNFREST_REQUEST, deleteVolumeGroupRequest.toXmlString());
@@ -73,9 +73,9 @@ public class VnfAdapterDeleteTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
DeleteVfModuleRequest deleteVfModuleRequest = vnfAdapterVfModuleResources.deleteVfModuleRequest( gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, genericVnf, vfModule);
execution.setVariable(VNFREST_REQUEST, deleteVfModuleRequest.toXmlString());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index 47357d8ef3..e854efd414 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -37,8 +37,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.exceptions.MarshallerException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -74,7 +74,7 @@ public class VnfAdapterImpl {
public void preProcessVnfAdapter(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
execution.setVariable("heatStackId", null);
@@ -93,7 +93,7 @@ public class VnfAdapterImpl {
if (!StringUtils.isEmpty( vnfAdapterResponse)) {
Object vnfRestResponse = unMarshal(vnfAdapterResponse);
if(vnfRestResponse instanceof CreateVfModuleResponse) {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
if(!StringUtils.isEmpty(heatStackId)) {
vfModule.setHeatStackId(heatStackId);
@@ -104,8 +104,8 @@ public class VnfAdapterImpl {
processVfModuleOutputs(execution, vfModuleOutputs);
}
} else if(vnfRestResponse instanceof DeleteVfModuleResponse) {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
if(null!= vfModuleDelete && vfModuleDelete) {
vfModule.setHeatStackId(null);
@@ -128,7 +128,7 @@ public class VnfAdapterImpl {
}
}
} else if(vnfRestResponse instanceof CreateVolumeGroupResponse) {
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId();
if(!StringUtils.isEmpty(heatStackId)) {
volumeGroup.setHeatStackId(heatStackId);
@@ -137,7 +137,7 @@ public class VnfAdapterImpl {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
}
} else if(vnfRestResponse instanceof DeleteVolumeGroupResponse) {
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted();
if(null!= volumeGroupDelete && volumeGroupDelete) {
volumeGroup.setHeatStackId(null);
@@ -167,9 +167,9 @@ public class VnfAdapterImpl {
SAXSource source = new SAXSource(xmlReader, inputSource);
return jaxbUnmarshaller.unmarshal(source);
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), MsoLogger.ErrorCode.SchemaError.getValue(),
+ logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
e.getMessage(), e);
- throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(), ErrorCode.SchemaError.getValue(), e);
}
}
@@ -178,8 +178,8 @@ public class VnfAdapterImpl {
return;
}
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>();
Iterator<String> keys = vfModuleOutputs.keySet().iterator();
while (keys.hasNext()) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
new file mode 100644
index 0000000000..667ac133af
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.bpmn.infrastructure.adapter.vnfm.tasks;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class Constants {
+
+ public static final String CREATE_VNF_REQUEST_PARAM_NAME = "createVnfRequest";
+ public static final String CREATE_VNF_RESPONSE_PARAM_NAME = "createVnfResponse";
+
+ public static final String INPUT_PARAMETER = "inputParameter";
+
+ public static final String DOT = ".";
+ public static final String UNDERSCORE = "_";
+ public static final String SPACE = "\\s+";
+
+ public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/";
+ public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk";
+
+ public static final String FORWARD_SLASH = "/";
+ public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/";
+
+
+ private Constants() {}
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
new file mode 100644
index 0000000000..ebb9d521c3
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTask.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
+import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * This class retrieve input parameters
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Component
+public class InputParameterRetrieverTask {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(InputParameterRetrieverTask.class);
+
+ private final InputParametersProvider inputParametersProvider;
+
+ private final ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ public InputParameterRetrieverTask(final InputParametersProvider inputParametersProvider,
+ final ExtractPojosForBB extractPojosForBB) {
+ this.inputParametersProvider = inputParametersProvider;
+ this.extractPojosForBB = extractPojosForBB;
+ }
+
+ public void getInputParameters(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing getInputParameters ...");
+
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+ final InputParameter inputParameter = inputParametersProvider.getInputParameter(vnf);
+
+ LOGGER.debug("inputParameter: {}", inputParameter);
+ execution.setVariable(INPUT_PARAMETER, inputParameter);
+
+ LOGGER.debug("Finished executing getInputParameters ...");
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to invoke create and instantiation request", exception);
+ execution.setVariable(INPUT_PARAMETER, NullInputParameter.NULL_INSTANCE);
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
new file mode 100644
index 0000000000..4e15474e46
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTask.java
@@ -0,0 +1,162 @@
+/*-
+ * ============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.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_REQUEST_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_RESPONSE_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DOT;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.SPACE;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.UNDERSCORE;
+import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.onap.vnfmadapter.v1.model.Tenant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.google.common.base.Optional;
+
+/**
+ * This class is executed from EtsiVnfInstantiateBB building block and it sends the create request
+ * to the VNFM adapter
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Component
+public class VnfmAdapterCreateVnfTask {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterCreateVnfTask.class);
+
+ private final ExtractPojosForBB extractPojosForBB;
+ private final ExceptionBuilder exceptionUtil;
+ private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
+
+ @Autowired
+ public VnfmAdapterCreateVnfTask(final ExceptionBuilder exceptionUtil, final ExtractPojosForBB extractPojosForBB,
+ final VnfmAdapterServiceProvider vnfmAdapterServiceProvider) {
+ this.exceptionUtil = exceptionUtil;
+ this.extractPojosForBB = extractPojosForBB;
+ this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
+ }
+
+ /**
+ * Create {@link CreateVnfRequest} object with required fields and store it in
+ * {@link org.camunda.bpm.engine.delegate.DelegateExecution}
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void buildCreateVnfRequest(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing buildCreateVnfRequest ...");
+
+ final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
+ final CloudRegion cloudRegion = buildingBlock.getCloudRegion();
+
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+ final ModelInfoGenericVnf modelInfoGenericVnf = vnf.getModelInfoGenericVnf();
+
+ final InputParameter inputParameter = getInputParameter(execution);
+
+ final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+
+ createVnfRequest.setName(getName(vnf.getVnfName(), modelInfoGenericVnf.getModelInstanceName()));
+ createVnfRequest.setTenant(getTenant(cloudRegion));
+ createVnfRequest.setAdditionalParams(inputParameter.getAdditionalParams());
+ createVnfRequest.setExternalVirtualLinks(inputParameter.getExtVirtualLinks());
+
+ LOGGER.info("CreateVnfRequest : {}", createVnfRequest);
+
+ execution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, createVnfRequest);
+
+ LOGGER.debug("Finished executing buildCreateVnfRequest ...");
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to execute buildCreateVnfRequest", exception);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1200, exception);
+ }
+ }
+
+ private InputParameter getInputParameter(final BuildingBlockExecution execution) {
+ final InputParameter inputParameter = execution.getVariable(INPUT_PARAMETER);
+ return inputParameter != null ? inputParameter : NullInputParameter.NULL_INSTANCE;
+ }
+
+ /**
+ * Invoke VNFM adapter to create and instantiate VNF
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void invokeVnfmAdapter(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing invokeVnfmAdapter ...");
+ final CreateVnfRequest request = execution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
+
+ final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+
+ final Optional<CreateVnfResponse> response =
+ vnfmAdapterServiceProvider.invokeCreateInstantiationRequest(vnf.getVnfId(), request);
+
+ if (!response.isPresent()) {
+ final String errorMessage = "Unexpected error while processing create and instantiation request";
+ LOGGER.error(errorMessage);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1201, errorMessage);
+ }
+
+ final CreateVnfResponse vnfResponse = response.get();
+
+ LOGGER.debug("Vnf instantiation response: {}", vnfResponse);
+ execution.setVariable(CREATE_VNF_RESPONSE_PARAM_NAME, vnfResponse);
+
+ LOGGER.debug("Finished executing invokeVnfmAdapter ...");
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to invoke create and instantiation request", exception);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1202, exception);
+ }
+ }
+
+ private Tenant getTenant(final CloudRegion cloudRegion) {
+ final Tenant tenant = new Tenant();
+ tenant.setCloudOwner(cloudRegion.getCloudOwner());
+ tenant.setRegionName(cloudRegion.getLcpCloudRegionId());
+ tenant.setTenantId(cloudRegion.getTenantId());
+ return tenant;
+ }
+
+ private String getName(final String vnfName, final String modelInstanceName) {
+ if (modelInstanceName != null) {
+ return (vnfName + DOT + modelInstanceName).replaceAll(SPACE, UNDERSCORE);
+ }
+ return vnfName != null ? vnfName.replaceAll(SPACE, UNDERSCORE) : vnfName;
+ }
+
+}
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
new file mode 100644
index 0000000000..1046b6bf26
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * Provides {@link org.onap.so.rest.service.VnfmAdapterServiceProvider} configuration for
+ * {@link VnfmAdapterCreateVnfTask}
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Configuration
+public class VnfmAdapterCreateVnfTaskConfiguration {
+
+ @Bean
+ public HttpRestServiceProvider databaseHttpRestServiceProvider(
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
+ @Autowired final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
+ return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(etsiVnfmAdapter.getAuth()));
+ }
+
+ 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/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
new file mode 100644
index 0000000000..02303ef09d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProvider.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+
+import com.google.common.base.Optional;
+
+
+/**
+ * Provide a service which interacts with VNFM adapter for instantiating, monitoring VNF
+ *
+ * @author waqas.ikram@est.tech
+ */
+public interface VnfmAdapterServiceProvider {
+
+ Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId, final CreateVnfRequest request);
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
new file mode 100644
index 0000000000..afdcccfd36
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
@@ -0,0 +1,89 @@
+/*-
+ * ============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.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import com.google.common.base.Optional;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@Service
+public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class);
+
+ private final VnfmAdapterUrlProvider urlProvider;
+ private final HttpRestServiceProvider httpServiceProvider;
+
+ @Autowired
+ public VnfmAdapterServiceProviderImpl(final VnfmAdapterUrlProvider urlProvider,
+ final HttpRestServiceProvider httpServiceProvider) {
+ this.urlProvider = urlProvider;
+ this.httpServiceProvider = httpServiceProvider;
+ }
+
+ @Override
+ public Optional<CreateVnfResponse> invokeCreateInstantiationRequest(final String vnfId,
+ final CreateVnfRequest request) {
+ try {
+ final String url = urlProvider.getCreateInstantiateUrl(vnfId);
+
+ final ResponseEntity<CreateVnfResponse> response =
+ httpServiceProvider.postHttpRequest(request, url, CreateVnfResponse.class);
+
+ final HttpStatus httpStatus = response.getStatusCode();
+ if (!(httpStatus.equals(HttpStatus.ACCEPTED)) && !(httpStatus.equals(HttpStatus.OK))) {
+ LOGGER.error("Unable to invoke HTTP POST using URL: {}, Response Code: {}", url, httpStatus.value());
+ return Optional.absent();
+ }
+
+ if (!response.hasBody()) {
+ LOGGER.error("Received response without body: {}", response);
+ return Optional.absent();
+ }
+
+ final CreateVnfResponse createVnfResponse = response.getBody();
+
+ if (createVnfResponse.getJobId() == null || createVnfResponse.getJobId().isEmpty()) {
+ LOGGER.error("Received invalid instantiation response: {}", response);
+ return Optional.absent();
+ }
+
+ return Optional.of(createVnfResponse);
+ } catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
+ LOGGER.error("Unexpected error while processing create and instantiation request", httpInvocationException);
+ return Optional.absent();
+ }
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
new file mode 100644
index 0000000000..03ee0712e7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProvider.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import java.net.URI;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.util.UriComponentsBuilder;
+
+/**
+ *
+ * Provides VNFM adapter {@link java.net.URL}
+ *
+ * @author waqas.ikram@est.tech
+ *
+ */
+@Service
+public class VnfmAdapterUrlProvider {
+
+ private final URI baseUri;
+
+ @Autowired
+ public VnfmAdapterUrlProvider(final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
+ this.baseUri = UriComponentsBuilder.fromHttpUrl(etsiVnfmAdapter.getUrl()).build().toUri();
+ }
+
+ /**
+ * Get VNFM create and instantiate URL
+ *
+ * @param vnfId The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in
+ * AAI.
+ * @return VNFM create and instantiate URL
+ */
+ public String getCreateInstantiateUrl(final String vnfId) {
+ return UriComponentsBuilder.fromUri(baseUri).pathSegment("vnfs").pathSegment(vnfId).build().toString();
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
new file mode 100644
index 0000000000..c9b1ad1ce1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmBasicHttpConfigProvider.java
@@ -0,0 +1,75 @@
+/*-
+ * ============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.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNFM_ADAPTER_DEFAULT_AUTH;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNFM_ADAPTER_DEFAULT_URL;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Provides VNFM adapter {@link java.net.URI} and basic authorization values
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Configuration
+@ConfigurationProperties(prefix = "so.vnfm.adapter")
+public class VnfmBasicHttpConfigProvider {
+
+ private String url = VNFM_ADAPTER_DEFAULT_URL;
+
+ private String auth = VNFM_ADAPTER_DEFAULT_AUTH;
+
+ /**
+ * @return the url
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * @param url the url to set
+ */
+ public void setUrl(final String url) {
+ this.url = url;
+ }
+
+ /**
+ * @return the auth
+ */
+ public String getAuth() {
+ return auth;
+ }
+
+ /**
+ * @param auth the auth to set
+ */
+ public void setAuth(final String auth) {
+ this.auth = auth;
+ }
+
+ @Override
+ public String toString() {
+ return "EtsiVnfmAdapter [url=" + url + ", auth=" + auth + "]";
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
new file mode 100644
index 0000000000..5ade3240a0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParameter.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
+
+/**
+ * Wrapper class for instance parameters which are based on SOL003
+ *
+ * @author waqas.ikram@est.tech
+ */
+public class InputParameter implements Serializable {
+
+ private static final long serialVersionUID = 42034634585595304L;
+
+ private Map<String, String> additionalParams = new HashMap<>();
+
+ private List<ExternalVirtualLink> extVirtualLinks = new ArrayList<>();
+
+ public InputParameter(final Map<String, String> additionalParams, final List<ExternalVirtualLink> extVirtualLinks) {
+ this.additionalParams = additionalParams;
+ this.extVirtualLinks = extVirtualLinks;
+ }
+
+ /**
+ * @return the additionalParams
+ */
+ public Map<String, String> getAdditionalParams() {
+ return additionalParams;
+ }
+
+ /**
+ * @return the extVirtualLinks
+ */
+ public List<ExternalVirtualLink> getExtVirtualLinks() {
+ return extVirtualLinks;
+ }
+
+ /**
+ * @param additionalParams the additionalParams to set
+ */
+ public void setAdditionalParams(final Map<String, String> additionalParams) {
+ this.additionalParams = additionalParams;
+ }
+
+ /**
+ * @param extVirtualLinks the extVirtualLinks to set
+ */
+ public void setExtVirtualLinks(final List<ExternalVirtualLink> extVirtualLinks) {
+ this.extVirtualLinks = extVirtualLinks;
+ }
+
+ @Override
+ public String toString() {
+ return "InputParameter [additionalParams=" + additionalParams + ", extVirtualLinks=" + extVirtualLinks + "]";
+ }
+
+}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java
index 4606c04e05..55203fb7cc 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProvider.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * Copyright (C) 2019 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,17 +17,15 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.monitoring.rest.service;
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
-import com.google.common.base.Optional;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
/**
- * @author waqas.ikram@ericsson.com
+ * @author waqas.ikram@est.tech
*/
-public interface HttpRestServiceProvider {
+public interface InputParametersProvider {
- public <T> Optional<T> getHttpResponse(final String url, final Class<T> clazz);
-
- public <T> Optional<T> postHttpRequest(final Object object, final String url, final Class<T> clazz);
+ InputParameter getInputParameter(final GenericVnf genericVnf);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
new file mode 100644
index 0000000000..6027e78d8b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImpl.java
@@ -0,0 +1,161 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jayway.jsonpath.JsonPath;
+
+import net.minidev.json.JSONArray;
+
+/**
+ * This class retrieve pre-load data from SDNC using <br/>
+ * <b>GET</b> /config/VNF-API:preload-vnfs/vnf-preload-list/{vnf-name}/{vnf-type}
+ *
+ * @author waqas.ikram@est.tech
+ */
+@Service
+public class InputParametersProviderImpl implements InputParametersProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(InputParametersProviderImpl.class);
+
+ private static final String EXT_VIRTUAL_LINKS = "extVirtualLinks";
+ private static final String ADDITIONAL_PARAMS = "additionalParams";
+ private static final String VNF_PARAMETERS_PATH = "$..vnf-parameters";
+
+ private final SDNCClient sdncClient;
+
+ @Autowired
+ public InputParametersProviderImpl(final SDNCClient sdncClient) {
+ this.sdncClient = sdncClient;
+ }
+
+ @Override
+ public InputParameter getInputParameter(final GenericVnf genericVnf) {
+ final String vnfName = genericVnf.getVnfName();
+ final String vnfType = getVnfType(genericVnf);
+ final String url = getPreloadVnfsUrl(vnfName, vnfType);
+
+ try {
+ LOGGER.debug("Will query sdnc for input parameters using url: {}", url);
+ final String jsonResponse = sdncClient.get(url);
+
+ final JSONArray vnfParametersArray = JsonPath.read(jsonResponse, VNF_PARAMETERS_PATH);
+ if (vnfParametersArray != null) {
+ for (int index = 0; index < vnfParametersArray.size(); index++) {
+ final Object vnfParametersObject = vnfParametersArray.get(index);
+ if (vnfParametersObject instanceof JSONArray) {
+ final JSONArray vnfParameters = (JSONArray) vnfParametersObject;
+ final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParameters);
+ return new InputParameter(getAdditionalParameters(vnfParametersMap),
+ getExtVirtualLinks(vnfParametersMap));
+ }
+ }
+ }
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to retrieve/parse input parameters using URL: {} ", url, exception);
+ }
+ LOGGER.warn("No input parameters found ...");
+ return NullInputParameter.NULL_INSTANCE;
+
+ }
+
+ private List<ExternalVirtualLink> getExtVirtualLinks(final Map<String, String> vnfParametersMap)
+ throws JsonParseException, IOException {
+ try {
+ final String extVirtualLinksString = vnfParametersMap.get(EXT_VIRTUAL_LINKS);
+
+ if (extVirtualLinksString != null && !extVirtualLinksString.isEmpty()) {
+ final ObjectMapper mapper = new ObjectMapper();
+ final TypeReference<List<ExternalVirtualLink>> extVirtualLinksStringTypeRef =
+ new TypeReference<List<ExternalVirtualLink>>() {};
+
+ return mapper.readValue(extVirtualLinksString, extVirtualLinksStringTypeRef);
+ }
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to parse {} ", EXT_VIRTUAL_LINKS, exception);
+ }
+ return Collections.emptyList();
+ }
+
+ private Map<String, String> getAdditionalParameters(final Map<String, String> vnfParametersMap)
+ throws JsonParseException, IOException {
+ try {
+ final String additionalParamsString = vnfParametersMap.get(ADDITIONAL_PARAMS);
+ if (additionalParamsString != null && !additionalParamsString.isEmpty()) {
+ final ObjectMapper mapper = new ObjectMapper();
+ final TypeReference<Map<String, String>> typeRef = new TypeReference<Map<String, String>>() {};
+ return mapper.readValue(additionalParamsString, typeRef);
+ }
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to parse {} ", ADDITIONAL_PARAMS, exception);
+ }
+ return Collections.emptyMap();
+ }
+
+ private Map<String, String> getVnfParameterMap(final JSONArray array) {
+ try {
+ if (array != null) {
+ final ObjectMapper mapper = new ObjectMapper();
+ final VnfParameter[] readValue = mapper.readValue(array.toJSONString(), VnfParameter[].class);
+ LOGGER.debug("Vnf parameters: {}", Arrays.asList(readValue));
+ return Arrays.asList(readValue).stream()
+ .filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null)
+ .collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue));
+ }
+ } catch (final IOException exception) {
+ LOGGER.error("Unable to parse vnf parameters : {}", array, exception);
+ }
+ return Collections.emptyMap();
+ }
+
+ private String getPreloadVnfsUrl(final String vnfName, final String vnfType) {
+ return PRELOAD_VNFS_URL + vnfName + FORWARD_SLASH + vnfType;
+ }
+
+ private String getVnfType(final GenericVnf genericVnf) {
+ final ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ if (modelInfoGenericVnf != null && modelInfoGenericVnf.getModelName() != null) {
+ return modelInfoGenericVnf.getModelName();
+ }
+ return genericVnf.getVnfType();
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java
index ede515650e..fb877ac55d 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/NullInputParameter.java
@@ -1,10 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
+ * Copyright (C) 2019 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,21 +13,25 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
-package org.onap.so.bpmn.core;
+import java.util.Collections;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class NullInputParameter extends InputParameter {
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+ private static final long serialVersionUID = -7261286746726871696L;
-public class BPMNLogger {
- private static Logger logger = LoggerFactory.getLogger(BPMNLogger.class);
-
- public static void debug (String isDebugLogEnabled, String LogText) {
- logger.debug(LogText);
- }
+ public static final NullInputParameter NULL_INSTANCE = new NullInputParameter();
-
-}
+ private NullInputParameter() {
+ super(Collections.emptyMap(), Collections.emptyList());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
new file mode 100644
index 0000000000..11e93e733d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import java.util.Objects;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * This is used to deserialize vnf-parameters from vnf-preload-list/{vnf-name}/{vnf-type} response
+ *
+ * @author waqas.ikram@est.tech
+ */
+public class VnfParameter {
+
+ @JsonProperty("vnf-parameter-name")
+ private String name;
+
+ @JsonProperty("vnf-parameter-value")
+ private String value;
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(final String value) {
+ this.value = value;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((value == null) ? 0 : value.hashCode());
+ return Objects.hash(name, value);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj instanceof VnfParameter) {
+ VnfParameter other = (VnfParameter) obj;
+ return Objects.equals(name, other.name) && Objects.equals(value, other.value);
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "VnfParameter [name=" + name + ", value=" + value + "]";
+ }
+
+}
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 4b4b3eca23..f9e4177315 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
@@ -37,8 +37,8 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -82,7 +82,7 @@ public class AppcRunTasks {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
GenericVnf vnf = null;
try {
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
} catch (BBObjectNotFoundException e) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists");
}
@@ -110,7 +110,7 @@ public class AppcRunTasks {
String vfModuleId = null;
VfModule vfModule = null;
try {
- vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
} catch (BBObjectNotFoundException e) {
}
if (vfModule != null) {
@@ -137,7 +137,7 @@ public class AppcRunTasks {
catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
index 8cb7cbbe91..f6e07c8303 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
@@ -71,7 +71,7 @@ public class AuditTasks {
AuditInventory auditInventory = new AuditInventory();
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
auditInventory.setCloudOwner(cloudRegion.getCloudOwner());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
index 753a29f208..c3106d6e49 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
@@ -47,8 +47,7 @@ public class AssignNetwork {
public boolean networkFoundByName(BuildingBlockExecution execution) {
boolean networkFound = false;
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
- execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())){
networkFound = true;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java
index ee80ba4c55..0aa3142996 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java
@@ -50,7 +50,7 @@ public class AssignVnf {
public void createInstanceGroups(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
for(InstanceGroup instanceGroup : instanceGroups) {
if(ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
new file mode 100644
index 0000000000..242135adb8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import java.util.Map;
+import java.util.UUID;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.cds.beans.ConfigAssignPropertiesForVnf;
+import org.onap.so.client.cds.beans.ConfigAssignRequestVnf;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * Get vnf related data and config assign
+ *
+ */
+@Component
+public class ConfigAssignVnf {
+
+ private static final Logger logger = LoggerFactory.getLogger(ConfigAssignVnf.class);
+ private static final String ORIGINATOR_ID = "SO";
+ private static final String ACTION_NAME = "config-assign";
+ private static final String MODE = "sync";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ /**
+ * Getting the vnf data, blueprint name, blueprint version etc and setting them
+ * in execution object and calling the subprocess.
+ *
+ * @param execution
+ */
+ public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
+ logger.info("Start preProcessAbstractCDSProcessing ");
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+
+ Map<String, Object> userParams = execution.getGeneralBuildingBlock().getRequestContext().getUserParams();
+
+ ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
+ configAssignPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ configAssignPropertiesForVnf
+ .setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ configAssignPropertiesForVnf
+ .setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ configAssignPropertiesForVnf.setVnfId(vnf.getVnfId());
+ configAssignPropertiesForVnf.setVnfName(vnf.getVnfName());
+
+ for (Map.Entry<String, Object> entry : userParams.entrySet()) {
+ configAssignPropertiesForVnf.setUserParam(entry.getKey(), entry.getValue());
+ }
+
+ ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf();
+ configAssignRequestVnf.setResolutionKey(vnf.getVnfName());
+ configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
+
+ String blueprintName = vnf.getBlueprintName();
+ String blueprintVersion = vnf.getBlueprintVersion();
+
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+
+ abstractCDSPropertiesBean.setBlueprintName(blueprintName);
+ abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
+ abstractCDSPropertiesBean.setRequestObject(configAssignRequestVnf.toString());
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ abstractCDSPropertiesBean.setOriginatorId(ORIGINATOR_ID);
+ abstractCDSPropertiesBean.setRequestId(gBBInput.getRequestContext().getMsoRequestId());
+ abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
+ abstractCDSPropertiesBean.setActionName(ACTION_NAME);
+ abstractCDSPropertiesBean.setMode(MODE);
+ execution.setVariable("executionObject", abstractCDSPropertiesBean);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+}
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
new file mode 100644
index 0000000000..1bc7c0f574
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
@@ -0,0 +1,130 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2019 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import java.util.UUID;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.aai.tasks.AAIUpdateTasks;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.cds.beans.ConfigDeployPropertiesForVnf;
+import org.onap.so.client.cds.beans.ConfigDeployRequestVnf;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * Get vnf related data and config Deploy
+ *
+ */
+@Component
+public class ConfigDeployVnf {
+ private static final Logger logger = LoggerFactory.getLogger(ConfigDeployVnf.class);
+ private final static String ORIGINATOR_ID = "SO";
+ private final static String ACTION_NAME = "config-deploy";
+ private final static String MODE = "async";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private AAIUpdateTasks aaiUpdateTask;
+
+ /**
+ * Update vnf orch status to configure in AAI
+ *
+ * @param execution
+ */
+ public void updateAAIConfigure(BuildingBlockExecution execution) {
+ aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+
+ }
+ /**
+ * Getting the vnf object and set in execution object
+ *
+ * @param execution
+ *
+ *
+ */
+ public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
+
+
+ logger.info("Start preProcessAbstractCDSProcessing");
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+
+ ConfigDeployPropertiesForVnf configDeployPropertiesForVnf = new ConfigDeployPropertiesForVnf();
+ configDeployPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ configDeployPropertiesForVnf.setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ configDeployPropertiesForVnf.setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ configDeployPropertiesForVnf.setVnfId(vnf.getVnfId());
+ configDeployPropertiesForVnf.setVnfName(vnf.getVnfName());
+
+ ConfigDeployRequestVnf configDeployRequestVnf = new ConfigDeployRequestVnf();
+
+ configDeployRequestVnf.setResolutionKey(vnf.getVnfName());
+ configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
+
+ String blueprintName = vnf.getBlueprintName();
+ String blueprintVersion = vnf.getBlueprintVersion();
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+
+ abstractCDSPropertiesBean.setBlueprintName(blueprintName);
+ abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
+ abstractCDSPropertiesBean.setRequestObject(configDeployRequestVnf.toString());
+
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ abstractCDSPropertiesBean.setOriginatorId( ORIGINATOR_ID);
+ abstractCDSPropertiesBean.setRequestId(gBBInput.getRequestContext().getMsoRequestId());
+ abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
+ abstractCDSPropertiesBean.setActionName(ACTION_NAME);
+ abstractCDSPropertiesBean.setMode(MODE);
+
+ execution.setVariable("executionObject", abstractCDSPropertiesBean);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Update vnf orch status to configured in AAI
+ *
+ * @param execution
+ */
+ public void updateAAIConfigured(BuildingBlockExecution execution) {
+ aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
index 6c0cdb39f6..4cd0321578 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
@@ -39,8 +39,8 @@ import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -81,7 +81,7 @@ public class ConfigurationScaleOut {
String configScaleOutPayloadString = null;
ControllerSelectionReference controllerSelectionReference;
ConfigScaleOutPayload configPayload = new ConfigScaleOutPayload();
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
String vnfId = vnf.getVnfId();
String vnfName = vnf.getVnfName();
String vnfType = vnf.getVnfType();
@@ -89,7 +89,7 @@ public class ConfigurationScaleOut {
controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
String controllerName = controllerSelectionReference.getControllerName();
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
Map<String, String> paramsMap = new HashMap<>();
@@ -155,7 +155,7 @@ public class ConfigurationScaleOut {
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
}
logger.error("Error Message: " + appcMessage);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java
index 962d4fa8c4..8cad8f93ec 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java
@@ -55,8 +55,8 @@ public class CreateNetwork {
public void buildCreateNetworkRequest(BuildingBlockExecution execution) throws Exception {
try{
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
Map<String, String> userInput = gBBInput.getUserInput();
String cloudRegionPo = execution.getVariable("cloudRegionPo");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
index 060775e1d7..5665302b2a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
@@ -54,7 +54,7 @@ public class CreateNetworkCollection {
*/
public void buildNetworkCollectionName(BuildingBlockExecution execution) throws Exception {
try{
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup();
if(instanceGroup.getModelInfoInstanceGroup() != null) {
//Build collection name assembling SI name and IG function
@@ -84,7 +84,7 @@ public class CreateNetworkCollection {
public void connectCollectionToInstanceGroup(BuildingBlockExecution execution) throws Exception {
execution.setVariable("connectCollectionToInstanceGroupRollback", false);
try{
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Collection networkCollection = serviceInstance.getCollection();
aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(networkCollection.getInstanceGroup(), networkCollection);
execution.setVariable("connectCollectionToInstanceGroupRollback", true);
@@ -101,7 +101,7 @@ public class CreateNetworkCollection {
public void connectInstanceGroupToCloudRegion(BuildingBlockExecution execution) throws Exception {
execution.setVariable("connectInstanceGroupToCloudRegionRollback", false);
try{
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Collection networkCollection = serviceInstance.getCollection();
aaiNetworkResources.connectInstanceGroupToCloudRegion(networkCollection.getInstanceGroup(), execution.getGeneralBuildingBlock().getCloudRegion());
execution.setVariable("connectInstanceGroupToCloudRegionRollback", true);
@@ -118,7 +118,7 @@ public class CreateNetworkCollection {
public void connectCollectionToServiceInstance(BuildingBlockExecution execution) throws Exception {
execution.setVariable("connectCollectionToServiceInstanceRollback", false);
try{
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Collection networkCollection = serviceInstance.getCollection();
aaiNetworkResources.connectNetworkCollectionToServiceInstance(networkCollection, serviceInstance);
execution.setVariable("connectCollectionToServiceInstanceRollback", true);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
index feb9fb81b4..f0db5eda2e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
@@ -34,8 +34,8 @@ import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -60,7 +60,7 @@ public class GenericVnfHealthCheck {
try {
ControllerSelectionReference controllerSelectionReference;
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
String vnfId = vnf.getVnfId();
String vnfName = vnf.getVnfName();
String vnfType = vnf.getVnfType();
@@ -111,7 +111,7 @@ public class GenericVnfHealthCheck {
appcMessage = appCClient.getErrorMessage();
} catch (BpmnError ex) {
logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
- "Caught exception in GenericVnfHealthCheck", "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(), ex);
+ "Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex);
appcMessage = ex.getMessage();
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
} catch (Exception e) {
@@ -120,13 +120,13 @@ public class GenericVnfHealthCheck {
appcMessage = "Request to APPC timed out. ";
logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
"Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
throw e;
}
else {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java
index 945c693d47..217a60b60a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtils.java
@@ -26,7 +26,6 @@ import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
-import org.onap.so.logger.MsoLogger;
import org.springframework.stereotype.Component;
@Component
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 c7fd41c77a..9a7d695c01 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
@@ -67,8 +67,7 @@ public class UnassignNetworkBB {
public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) throws Exception {
try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
- execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
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 b9360b3d81..afa9b439db 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
@@ -48,7 +48,7 @@ public class UnassignVnf {
public void deleteInstanceGroups(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
for(InstanceGroup instanceGroup : instanceGroups) {
if(ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
index 2fba3b3b25..9214635602 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
@@ -11,14 +11,16 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.ticket.ExternalTicket;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ManualHandlingTasks {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ManualHandlingTasks.class);
+ private static final Logger logger = LoggerFactory.getLogger(ManualHandlingTasks.class);
private static final String TASK_TYPE_PAUSE = "pause";
private static final String TASK_TYPE_FALLOUT = "fallout";
@@ -34,7 +36,7 @@ public class ManualHandlingTasks {
DelegateExecution execution = task.getExecution();
try {
String taskId = task.getId();
- msoLogger.debug("taskId is: " + taskId);
+ logger.debug("taskId is: " + taskId);
String type = TASK_TYPE_FALLOUT;
String nfRole = (String) execution.getVariable("vnfType");
String subscriptionServiceType = (String) execution.getVariable("serviceType");
@@ -66,13 +68,13 @@ public class ManualHandlingTasks {
TaskService taskService = execution.getProcessEngineServices().getTaskService();
taskService.setVariables(taskId, taskVariables);
- msoLogger.debug("successfully created fallout task: "+ taskId);
+ logger.debug("successfully created fallout task: "+ taskId);
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.getMessage());
+ logger.debug("BPMN exception: " + e.getMessage());
throw e;
} catch (Exception ex){
String msg = "Exception in setFalloutTaskVariables " + ex.getMessage();
- msoLogger.debug(msg);
+ logger.debug(msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
}
@@ -83,7 +85,7 @@ public class ManualHandlingTasks {
try {
String taskId = task.getId();
- msoLogger.debug("taskId is: " + taskId);
+ logger.debug("taskId is: " + taskId);
String type = TASK_TYPE_PAUSE;
String nfRole = (String) execution.getVariable("vnfType");
String subscriptionServiceType = (String) execution.getVariable("serviceType");
@@ -115,13 +117,13 @@ public class ManualHandlingTasks {
TaskService taskService = execution.getProcessEngineServices().getTaskService();
taskService.setVariables(taskId, taskVariables);
- msoLogger.debug("successfully created pause task: "+ taskId);
+ logger.debug("successfully created pause task: "+ taskId);
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.getMessage());
+ logger.debug("BPMN exception: " + e.getMessage());
throw e;
} catch (Exception ex){
String msg = "Exception in setPauseTaskVariables " + ex.getMessage();
- msoLogger.debug(msg);
+ logger.debug(msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
@@ -134,24 +136,24 @@ public class ManualHandlingTasks {
try {
String taskId = task.getId();
- msoLogger.debug("taskId is: " + taskId);
+ logger.debug("taskId is: " + taskId);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
Map<String, Object> taskVariables = taskService.getVariables(taskId);
String responseValue = (String) taskVariables.get("responseValue");
- msoLogger.debug("Received responseValue on completion: "+ responseValue);
+ logger.debug("Received responseValue on completion: "+ responseValue);
// Have to set the first letter of the response to upper case
String responseValueUppercaseStart = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1);
- msoLogger.debug("ResponseValue to taskListener: "+ responseValueUppercaseStart);
+ logger.debug("ResponseValue to taskListener: "+ responseValueUppercaseStart);
execution.setVariable("responseValueTask", responseValueUppercaseStart);
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.getMessage());
+ logger.debug("BPMN exception: " + e.getMessage());
throw e;
} catch (Exception ex){
String msg = "Exception in completeManualTask " + ex.getMessage();
- msoLogger.debug(msg);
+ logger.debug(msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
@@ -177,10 +179,10 @@ public class ManualHandlingTasks {
ticket.createTicket();
} catch (BpmnError e) {
String msg = "BPMN error in createAOTSTicket " + e.getMessage();
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue());
} catch (Exception ex){
String msg = "Exception in createExternalTicket " + ex.getMessage();
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", ErrorCode.UnknownError.getValue());
}
}
@@ -195,7 +197,7 @@ public class ManualHandlingTasks {
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception e) {
- msoLogger.error("Unable to save the updated request status to the DB",e);
+ logger.error("Unable to save the updated request status to the DB",e);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
index cb4ac5c9d9..119716a58d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
@@ -42,7 +42,7 @@ public class NamingServiceCreateTasks {
private NamingServiceResources namingServiceResources;
public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
String policyInstanceName = execution.getVariable("policyInstanceName");
String nfNamingCode = execution.getVariable("nfNamingCode");
String generatedInstanceGroupName = "";
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
index ddea2724bc..c998e4aa75 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
@@ -42,7 +42,7 @@ public class NamingServiceDeleteTasks {
private NamingServiceResources namingServiceResources;
public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception {
- InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
try {
namingServiceResources.deleteInstanceGroupName(instanceGroup);
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 3793adc5d0..31f4b33e0c 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
@@ -67,8 +67,8 @@ public class SDNCActivateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
Customer customer = gBBInput.getCustomer();
GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
@@ -89,8 +89,8 @@ public class SDNCActivateTasks {
public void activateNetwork(BuildingBlockExecution execution) throws BBObjectNotFoundException {
try{
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = gBBInput.getCustomer();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
@@ -111,12 +111,9 @@ public class SDNCActivateTasks {
GenericVnf vnf = null;
VfModule vfModule = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
- execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID,
- execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID,
- execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer,
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 715322bef3..cbb1f34ae5 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
@@ -71,7 +71,7 @@ public class SDNCAssignTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = gBBInput.getCustomer();
GenericResourceApiServiceOperationInformation req = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
@@ -87,8 +87,8 @@ public class SDNCAssignTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming()));
@@ -105,12 +105,12 @@ public class SDNCAssignTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
VolumeGroup volumeGroup = null;
try{
- volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch (BBObjectNotFoundException e){
logger.info("No volume group was found.");
}
@@ -134,8 +134,8 @@ public class SDNCAssignTasks {
public void assignNetwork(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = gBBInput.getCustomer();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
index 592b831d62..59e46e1667 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java
@@ -63,7 +63,7 @@ public class SDNCChangeAssignTasks {
public void changeModelServiceInstance(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericResourceApiServiceOperationInformation req = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext());
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
@@ -77,8 +77,8 @@ public class SDNCChangeAssignTasks {
public void changeModelVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext());
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
@@ -92,8 +92,8 @@ public class SDNCChangeAssignTasks {
public void changeAssignNetwork(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
@@ -109,9 +109,9 @@ public class SDNCChangeAssignTasks {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
Customer customer = gBBInput.getCustomer();
GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
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 d7313ad9a4..8202a14fa3 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
@@ -69,9 +69,9 @@ public class SDNCDeactivateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer,
@@ -95,8 +95,8 @@ public class SDNCDeactivateTasks {
RequestContext requestContext = gBBInput.getRequestContext();
ServiceInstance serviceInstance = null;
GenericVnf vnf = null;
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
Customer customer = gBBInput.getCustomer();
GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
@@ -118,8 +118,7 @@ public class SDNCDeactivateTasks {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
- execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = gBBInput.getCustomer();
GenericResourceApiServiceOperationInformation req = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
@@ -139,8 +138,8 @@ public class SDNCDeactivateTasks {
public void deactivateNetwork(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = gBBInput.getCustomer();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
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 b636fe1292..941eb7a004 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
@@ -50,8 +50,8 @@ public class SDNCQueryTasks {
private ExtractPojosForBB extractPojosForBB;
public void queryVnf(BuildingBlockExecution execution) throws Exception {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
+ serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/"
@@ -69,9 +69,9 @@ public class SDNCQueryTasks {
public void queryVfModule(BuildingBlockExecution execution) throws Exception {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
+ serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/"
+ genericVnf.getVnfId() + "/vnf-data/vf-modules/vf-module/"
@@ -94,7 +94,7 @@ public class SDNCQueryTasks {
public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) {
try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
String response = sdncVfModuleResources.queryVfModule(vfModule);
execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response);
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 292f29c349..340872593f 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
@@ -68,7 +68,7 @@ public class SDNCUnassignTasks {
public void unassignServiceInstance(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
RequestContext requestContext = gBBInput.getRequestContext();
Customer customer = gBBInput.getCustomer();
GenericResourceApiServiceOperationInformation req = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext);
@@ -83,9 +83,9 @@ public class SDNCUnassignTasks {
public void unassignVfModule(BuildingBlockExecution execution) {
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
@@ -98,8 +98,8 @@ public class SDNCUnassignTasks {
public void unassignVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
RequestContext requestContext = gBBInput.getRequestContext();
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
@@ -116,8 +116,8 @@ public class SDNCUnassignTasks {
public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
- L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = gBBInput.getCustomer();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
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 a622520a71..bbfc01921c 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
@@ -80,36 +80,36 @@ public class OrchestrationStatusValidator {
switch(buildingBlockDetail.getResourceType()) {
case SERVICE:
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
orchestrationStatus = serviceInstance.getOrchestrationStatus();
break;
case VNF:
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
orchestrationStatus = genericVnf.getOrchestrationStatus();
break;
case VF_MODULE:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
orchestrationStatus = vfModule.getOrchestrationStatus();
break;
case VOLUME_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
orchestrationStatus = volumeGroup.getOrchestrationStatus();
break;
case NETWORK:
- org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
orchestrationStatus = network.getOrchestrationStatus();
break;
case NETWORK_COLLECTION:
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInst = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInst = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
org.onap.so.bpmn.servicedecomposition.bbobjects.Collection networkCollection = serviceInst.getCollection();
orchestrationStatus = networkCollection.getOrchestrationStatus();
break;
case CONFIGURATION:
- org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
orchestrationStatus = configuration.getOrchestrationStatus();
break;
case INSTANCE_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
orchestrationStatus = instanceGroup.getOrchestrationStatus();
break;
case NO_VALIDATE:
@@ -128,7 +128,7 @@ public class OrchestrationStatusValidator {
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, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution, previousOrchestrationStatusValidationResult,
genericVnf, orchestrationStatusStateTransitionDirective);
}
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 877a0dded7..242f125bde 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
@@ -368,44 +368,30 @@ public class WorkflowActionBBTasks {
ExecuteBuildingBlock ebb, List<ExecuteBuildingBlock> flowsToExecute) {
try {
String vnfId = ebb.getWorkflowResourceIds().getVnfId();
- String vfModuleId = ebb.getWorkflowResourceIds().getVfModuleId();
+ String vfModuleId = ebb.getResourceId();
+ ebb.getWorkflowResourceIds().setVfModuleId(vfModuleId);
String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId();
List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC);
for(Vnfc vnfc : vnfcs) {
String modelCustomizationId = vnfc.getModelCustomizationId();
- List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID);
- CvnfcCustomization cvnfcCustomization = null;
- for(CvnfcCustomization cvnfc : cvnfcCustomizations) {
- if(cvnfc.getModelCustomizationUUID().equalsIgnoreCase(modelCustomizationId)) {
- cvnfcCustomization = cvnfc;
- }
- }
- if(cvnfcCustomization != null) {
- VnfVfmoduleCvnfcConfigurationCustomization fabricConfig = null;
- for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfcCustomization.getVnfVfmoduleCvnfcConfigurationCustomization()){
- if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){
- if(fabricConfig == null) {
- fabricConfig = customization;
- } else {
- throw new Exception("Multiple Fabric configs found for this vnfc");
- }
- }
- }
- if(fabricConfig != null) {
- String configurationId = UUID.randomUUID().toString();
- ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
- configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
- configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
- configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID);
- configurationResourceKeys.setVnfcName(vnfc.getVnfcName());
- ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
- ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
- flowsToExecute.add(assignConfigBB);
- flowsToExecute.add(activateConfigBB);
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("completed", false);
- }
+ VnfVfmoduleCvnfcConfigurationCustomization fabricConfig =
+ catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfCustomizationUUID, vfModuleCustomizationUUID, modelCustomizationId);
+ if(fabricConfig != null && fabricConfig.getConfigurationResource() != null
+ && fabricConfig.getConfigurationResource().getToscaNodeType() != null
+ && fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
+ String configurationId = UUID.randomUUID().toString();
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
+ configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
+ configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID);
+ configurationResourceKeys.setVnfcName(vnfc.getVnfcName());
+ ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
+ ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys);
+ flowsToExecute.add(assignConfigBB);
+ flowsToExecute.add(activateConfigBB);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("completed", false);
} else {
logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java
index 36162af740..c0f7b21a9e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java
@@ -57,7 +57,7 @@ public class SDNOHealthCheckTasks {
Map<ResourceKey, String> lookupMap = execution.getLookupMap();
for (Map.Entry<ResourceKey, String> entry : lookupMap.entrySet()) {
if (entry.getKey().equals(ResourceKey.GENERIC_VNF_ID)) {
- vnf = extractPojosForBB.extractByKey(execution, entry.getKey(), entry.getValue());
+ vnf = extractPojosForBB.extractByKey(execution, entry.getKey());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index c8eeaa7a2b..518da1fa5f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -254,6 +254,9 @@ public class AAIObjectMapper {
map().setModelCustomizationId(source.getModelInfoConfiguration().getModelCustomizationId());
map().setModelVersionId(source.getModelInfoConfiguration().getModelVersionId());
map().setModelInvariantId(source.getModelInfoConfiguration().getModelInvariantId());
+ map().setConfigurationType(source.getModelInfoConfiguration().getConfigurationType());
+ map().setConfigurationSubType(source.getModelInfoConfiguration().getConfigurationRole());
+ map().setConfigPolicyName(source.getModelInfoConfiguration().getPolicyName());
}
});
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
index f917aed39e..8c774d8677 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -51,7 +51,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.beans.Subnet;
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 98174d59b6..258bea9a01 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
@@ -121,6 +121,7 @@ public class VnfAdapterVfModuleObjectMapper {
CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ createVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner());
createVfModuleRequest.setTenantId(cloudRegion.getTenantId());
createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName());
@@ -776,6 +777,7 @@ public class VnfAdapterVfModuleObjectMapper {
VfModule vfModule) throws IOException {
DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest();
deleteVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ deleteVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner());
deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
deleteVfModuleRequest.setVnfId(genericVnf.getVnfId());
deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
@@ -823,4 +825,4 @@ public class VnfAdapterVfModuleObjectMapper {
}
return baseVfModule;
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
index 17fa10a186..8456f26239 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
@@ -31,8 +31,8 @@ import org.onap.namingservice.model.NameGenResponse;
import org.onap.namingservice.model.NameGenResponseError;
import org.onap.namingservice.model.Respelement;
import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
@@ -52,7 +52,7 @@ public class NamingClientResponseValidator {
public String validateNameGenResponse(ResponseEntity<NameGenResponse> response) throws BadResponseException {
if (response == null) {
logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
NO_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -62,7 +62,7 @@ public class NamingClientResponseValidator {
NameGenResponse responseBody = response.getBody();
if (responseBody == null) {
logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
NULL_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -92,7 +92,7 @@ public class NamingClientResponseValidator {
}
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
+ ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
}
@@ -100,7 +100,7 @@ public class NamingClientResponseValidator {
public String validateNameGenDeleteResponse(ResponseEntity<NameGenDeleteResponse> response) throws BadResponseException {
if (response == null) {
logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NO_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
NO_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -110,7 +110,7 @@ public class NamingClientResponseValidator {
NameGenDeleteResponse responseBody = response.getBody();
if (responseBody == null) {
logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), NULL_RESPONSE_FROM_NAMING_SERVICE,
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
NULL_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -123,7 +123,7 @@ public class NamingClientResponseValidator {
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
+ ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
}
@@ -143,7 +143,7 @@ public class NamingClientResponseValidator {
}
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
- MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
+ ErrorCode.DataError.getValue(), errorMessage);
return errorMessage;
}
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 3bb1d81e27..f412720af7 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
@@ -50,7 +50,7 @@ public class AAIConfigurationResources {
*/
public void createConfiguration(Configuration configuration) {
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
- configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
}
@@ -165,7 +165,7 @@ public class AAIConfigurationResources {
injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
}
- public void connectConfigurationToVfModule(String configurationId, String vfModuleId, String vnfId){
+ public void connectConfigurationToVfModule(String configurationId, String vnfId, String vfModuleId){
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
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 0c65abfe0c..48a1c1e558 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
@@ -22,6 +22,7 @@
package org.onap.so.client.orchestration;
+import java.io.IOException;
import java.util.Optional;
import org.onap.so.bpmn.common.InjectionHelper;
@@ -31,6 +32,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIValidatorImpl;
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;
@@ -50,6 +52,8 @@ public class AAIVnfResources {
@Autowired
private AAIObjectMapper aaiObjectMapper;
+ private AAIValidatorImpl aaiValidatorImpl= new AAIValidatorImpl();
+
public void createVnfandConnectServiceInstance(GenericVnf vnf, ServiceInstance serviceInstance) {
AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
vnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
@@ -125,4 +129,19 @@ public class AAIVnfResources {
AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
injectionHelper.getAaiClient().connect(tenantURI, vnfURI);
}
+
+ public boolean checkVnfClosedLoopDisabledFlag(String vnfId) {
+ org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
+ .get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ .orElse(new org.onap.aai.domain.yang.GenericVnf());
+ return vnf.isIsClosedLoopDisabled();
+ }
+
+ public boolean checkVnfPserversLockedFlag (String vnfId) throws IOException {
+ org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
+ .get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ .orElse(new org.onap.aai.domain.yang.GenericVnf());
+ return aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
+
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java
index 6867cb8ebb..8f3445529e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java
@@ -43,7 +43,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.adapter.network.NetworkAdapterClientException;
import org.onap.so.client.adapter.network.NetworkAdapterClientImpl;
import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
-import org.onap.so.logger.MsoLogger;
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 99d5fca31f..cae4a19f20 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
@@ -42,7 +42,6 @@ import org.springframework.stereotype.Component;
public class SDNCClient {
private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
- private BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
@Autowired
private SDNCProperties properties;
@@ -61,6 +60,8 @@ public class SDNCClient {
public String post(Object request, SDNCTopology topology) throws MapperException, BadResponseException {
String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/";
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+
STOClient.setTargetUrl(targetUrl);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
@@ -70,7 +71,8 @@ public class SDNCClient {
public String post(Object request, String url) throws MapperException, BadResponseException {
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
STOClient.setTargetUrl(url);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
@@ -91,7 +93,8 @@ public class SDNCClient {
public String get(String queryLink) throws MapperException, BadResponseException {
String request = "";
String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+ String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
STOClient.setTargetUrl(targetUrl);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
index 8513b26a5d..418e70a09e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
@@ -30,8 +30,8 @@ import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
@@ -69,7 +69,7 @@ public class SdnCommonTasks {
} catch (JsonProcessingException e) {
logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(),
COULD_NOT_CONVERT_SDNC_POJO_TO_JSON,
- "BPMN", MsoLogger.ErrorCode.DataError.getValue(), e.getMessage());
+ "BPMN", ErrorCode.DataError.getValue(), e.getMessage());
throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON);
}
jsonRequest = "{\"input\":" + jsonRequest + "}";
@@ -101,7 +101,7 @@ public class SdnCommonTasks {
public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
if (CollectionUtils.isEmpty(output)) {
logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
+ ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
}
LinkedHashMap<String, Object> embeddedResponse =(LinkedHashMap<String, Object>) output.get("output");
@@ -128,7 +128,7 @@ public class SdnCommonTasks {
} else {
String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
- MsoLogger.ErrorCode.DataError.getValue(), errorMessage);
+ ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
}
@@ -142,7 +142,7 @@ public class SdnCommonTasks {
public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
if (CollectionUtils.isEmpty(output)) {
logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
+ ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
}
ObjectMapper objMapper = new ObjectMapper();
@@ -153,7 +153,7 @@ public class SdnCommonTasks {
}
catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC,
- "BPMN", MsoLogger.ErrorCode.UnknownError.getValue(),
+ "BPMN", ErrorCode.UnknownError.getValue(),
BAD_RESPONSE_FROM_SDNC);
throw new BadResponseException(BAD_RESPONSE_FROM_SDNC);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
index e46c456f88..b11e2caafa 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
@@ -85,6 +85,7 @@ public class GCTopologyOperationRequestMapper {
GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation =
new GenericResourceApiConfigurationinformationConfigurationInformation();
configurationInformation.setConfigurationId(vnrConfiguration.getConfigurationId());
+ configurationInformation.setConfigurationType(vnrConfiguration.getConfigurationType());
req.setRequestInformation(requestInformation);
req.setSdncRequestHeader(sdncRequestHeader);
req.setServiceInformation(serviceInformation);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
index 5124435a79..b8c5fad41d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -47,8 +47,8 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -174,7 +174,7 @@ public class VfModuleTopologyOperationRequestMapper {
objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath();
} catch (Exception e) {
logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
- MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
+ ErrorCode.UnknownError.getValue(), e.getMessage());
}
}
return objectPath;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
index cf28c114e8..a91ef66a29 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
@@ -29,6 +29,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.io.IOException;
+
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -63,7 +65,7 @@ public class AAIFlagTasksTest extends BaseTaskTest {
public void before() throws BBObjectNotFoundException {
genericVnf = setGenericVnf();
doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
- when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),any())).thenReturn(genericVnf);
}
@Test
@@ -119,4 +121,89 @@ public class AAIFlagTasksTest extends BaseTaskTest {
verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
}
}
+
+ @Test
+ public void checkVnfClosedLoopDisabledTestTrue() throws Exception {
+ doThrow(new BpmnError("VNF Closed Loop Disabled in A&AI")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), eq("VNF Closed Loop Disabled in A&AI"));
+ }
+ }
+
+ @Test
+ public void checkVnfClosedLoopDisabledTestFalse() throws Exception {
+ doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), any(int.class), any(String.class));
+ }
+
+ @Test
+ public void checkVnfClosedLoopDisabledFlagExceptionTest() {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.class).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+ }
+
+ @Test
+ public void modifyVnfClosedLoopDisabledFlagTest() throws Exception {
+ doNothing().when(aaiVnfResources).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
+ aaiFlagTasks.modifyVnfClosedLoopDisabledFlag(execution, true);
+ verify(aaiVnfResources, times(1)).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
+ }
+
+ @Test
+ public void modifyVnfClosedLoopDisabledFlagExceptionTest() {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.class).when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class));
+ try {
+ aaiFlagTasks.modifyVnfClosedLoopDisabledFlag(execution, true);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+ }
+
+
+ @Test
+ public void checkVnfPserversLockedFlagTestTrue() throws Exception {
+ doThrow(new BpmnError("VNF PServers in Locked in A&AI")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doReturn(true).when(aaiVnfResources).checkVnfPserversLockedFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfPserversLockedFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), eq("VNF PServers in Locked in A&AI"));
+ }
+ }
+
+ @Test
+ public void checkVnfPserversLockedFlagTestFalse() throws Exception {
+ doReturn(false).when(aaiVnfResources).checkVnfPserversLockedFlag(isA(String.class));
+ aaiFlagTasks.checkVnfPserversLockedFlag(execution);
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), any(int.class), any(String.class));
+ }
+
+ @Test
+ public void checkVnfPserversLockedFlagExceptionTest() throws IOException {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.class).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfPserversLockedFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfPserversLockedFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
index 166319d32b..d0901eb689 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
@@ -353,7 +353,7 @@ public class TestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -371,7 +371,7 @@ public class TestDataSetup{
Collection collection = null;
try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
collection = serviceInstance.getCollection();
if (collection == null) {
@@ -393,7 +393,7 @@ public class TestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -464,7 +464,7 @@ public class TestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -517,7 +517,7 @@ public class TestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -556,7 +556,7 @@ public class TestDataSetup{
GenericVnf genericVnf = null;
try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
} catch(BBObjectNotFoundException e) {
genericVnf = setGenericVnf();
}
@@ -586,7 +586,7 @@ public class TestDataSetup{
GenericVnf genericVnf = null;
try {
- genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
} catch(BBObjectNotFoundException e) {
genericVnf = setGenericVnf();
}
@@ -650,7 +650,7 @@ public class TestDataSetup{
ServiceInstance serviceInstance = null;
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
@@ -710,7 +710,7 @@ public class TestDataSetup{
configurations.add(config);
ServiceInstance serviceInstance = new ServiceInstance();
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch(BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
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 4e147a022c..fcb95ca07e 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
@@ -96,13 +96,13 @@ public class AAICreateTasksTest extends BaseTaskTest{
configuration = setConfiguration();
instanceGroup = setInstanceGroupVnf();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID), any())).thenReturn(configuration);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
@@ -277,7 +277,7 @@ public class AAICreateTasksTest extends BaseTaskTest{
public void createVnfExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "notfound");
- doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID),eq("notfound"));
+ doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
aaiCreateTasks.createVnf(execution);
verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
@@ -291,7 +291,7 @@ public class AAICreateTasksTest extends BaseTaskTest{
newVfModule.setModuleIndex(null);
newVfModule.getModelInfoVfModule().setModelInvariantUUID("testModelInvariantUUID1");
doNothing().when(aaiVfModuleResources).createVfModule(newVfModule, genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(newVfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(newVfModule);
assertEquals(null, newVfModule.getModuleIndex());
aaiCreateTasks.createVfModule(execution);
@@ -412,8 +412,8 @@ public class AAICreateTasksTest extends BaseTaskTest{
gBBInput.setServiceInstance(serviceInstance);
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), eq("testServiceInstanceId"))).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID),eq("testNetworkId"))).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(serviceInstance);
//verify connection call was not executednetwork
exception.expect(BpmnError.class);
aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
index 94d886cdb5..826f888818 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -88,13 +88,13 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
configuration = setConfiguration();
instanceGroup = setInstanceGroupVnf();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID), any())).thenReturn(configuration);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.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 a8a249f386..05af58040a 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
@@ -84,12 +84,12 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
configuration = setConfiguration();
subnet = buildSubnet();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID), any())).thenReturn(configuration);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
@@ -655,4 +655,17 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
aaiUpdateTasks.updateManagementV6AddressVnf(execution);
verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf);
}
+
+ @Test
+ public void updateOrchestrationStatusVnfConfigureTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURE);
+
+ aaiUpdateTasks.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+ }
+ @Test
+ public void updateOrchestrationStatusVnfConfiguredTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURED);
+
+ aaiUpdateTasks.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java
index 3034f0bd67..72f6a08ee7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java
@@ -72,8 +72,8 @@ public class NetworkAdapterCreateTasksTest extends BaseTaskTest{
orchestrationContext.setIsRollbackEnabled(true);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(l3Network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(l3Network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java
index 5b534e00e7..ceb4796443 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java
@@ -66,8 +66,8 @@ public class NetworkAdapterDeleteTasksTest extends BaseTaskTest{
requestContext = setRequestContext();
cloudRegion = setCloudRegion();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(l3Network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(l3Network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java
index 478c512b0a..0406ce09a3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java
@@ -79,8 +79,8 @@ public class NetworkAdapterUpdateTasksTest extends BaseTaskTest{
userInput = setUserInput();
userInput.put("userInputKey1", "userInputValue1");
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java
index eaab75d4b9..32b3201d11 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java
@@ -76,9 +76,9 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{
CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
request.setVolumeGroupId("volumeGroupStackId");
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse);
vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
@@ -107,9 +107,9 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{
CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
request.setVolumeGroupId("volumeGroupStackId");
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null);
vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
@@ -122,7 +122,7 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{
@Test
public void test_createVolumeGroupRequest_exception() throws Exception {
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any());
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
expectedException.expect(BpmnError.class);
@@ -156,8 +156,8 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{
String sdncVnfQueryResponse = "{someJson}";
execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
@@ -199,9 +199,9 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{
String sdncVnfQueryResponse = "{someJson}";
execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance,
genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
@@ -216,7 +216,7 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{
@Test
public void createVfModuleExceptionTest() throws Exception {
// run with no data setup, and it will throw a BBObjectNotFoundException
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any());
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
expectedException.expect(BpmnError.class);
vnfAdapterCreateTasks.createVolumeGroupRequest(execution);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
index b8be26b12a..efd2e7d849 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
@@ -76,10 +76,10 @@ public class VnfAdapterDeleteTasksTest extends BaseTaskTest{
orchestrationContext = setOrchestrationContext();
orchestrationContext.setIsRollbackEnabled(true);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
index 33d0dbe130..b515835f19 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
@@ -78,10 +78,10 @@ public class VnfAdapterImplTest extends BaseTaskTest {
volumeGroup.setHeatStackId(null);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
}
@Test
@@ -209,7 +209,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void preProcessVnfAdapterExceptionTest() throws BBObjectNotFoundException {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any());
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID));
vnfAdapterImpl.preProcessVnfAdapter(execution);
}
@@ -263,7 +263,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapterExceptionTest() throws BBObjectNotFoundException {
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any());
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID));
execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
expectedException.expect(BpmnError.class);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java
new file mode 100644
index 0000000000..803b58b4b8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParametersProvider;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.NullInputParameter;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class InputParameterRetrieverTaskTest extends BaseTaskTest {
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Mock
+ private InputParametersProvider inputParametersProvider;
+
+ @Test
+ public void testGGetInputParameters_inputParameterStoredInExecutionContext() throws BBObjectNotFoundException {
+ final InputParameterRetrieverTask objUnderTest =
+ new InputParameterRetrieverTask(inputParametersProvider, extractPojosForBB);
+
+ final InputParameter inputParameter = new InputParameter(Collections.emptyMap(), Collections.emptyList());
+ when(inputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class))).thenReturn(inputParameter);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf());
+ objUnderTest.getInputParameters(stubbedxecution);
+
+ final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER);
+ assertNotNull(actual);
+ assertTrue(actual instanceof InputParameter);
+ }
+
+ @Test
+ public void testGGetInputParameters_ThrowExecption_NullInputParameterStoredInExecutionContext()
+ throws BBObjectNotFoundException {
+ final InputParameterRetrieverTask objUnderTest =
+ new InputParameterRetrieverTask(inputParametersProvider, extractPojosForBB);
+
+ when(inputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class)))
+ .thenThrow(RuntimeException.class);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf());
+ objUnderTest.getInputParameters(stubbedxecution);
+
+ final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER);
+ assertNotNull(actual);
+ assertTrue(actual instanceof NullInputParameter);
+ }
+
+
+ private class StubbedBuildingBlockExecution implements BuildingBlockExecution {
+
+ private final Map<String, Serializable> execution = new HashMap<>();
+
+ @Override
+ public GeneralBuildingBlock getGeneralBuildingBlock() {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getVariable(final String key) {
+ return (T) execution.get(key);
+ }
+
+ @Override
+ public <T> T getRequiredVariable(final String key) throws RequiredExecutionVariableExeception {
+ return null;
+ }
+
+ @Override
+ public void setVariable(final String key, final Serializable value) {
+ execution.put(key, value);
+ }
+
+ @Override
+ public Map<ResourceKey, String> getLookupMap() {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public String getFlowToBeCalled() {
+ return null;
+ }
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.java
new file mode 100644
index 0000000000..5451d4442f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/TestConstants.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.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmBasicHttpConfigProvider;
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+public class TestConstants {
+
+ public static final String DUMMY_GENERIC_VND_ID = "5956a99d-9736-11e8-8caf-022ac9304eeb";
+ public static final String DUMMY_BASIC_AUTH = "Basic 123abc";
+ public static final String DUMMY_URL = "http://localhost:30406/so/vnfm-adapter/v1/";
+ public static final String EXPECTED_URL = DUMMY_URL + "vnfs/" + DUMMY_GENERIC_VND_ID;
+
+ public static VnfmBasicHttpConfigProvider getVnfmBasicHttpConfigProvider() {
+ return getVnfmBasicHttpConfigProvider(DUMMY_URL, DUMMY_BASIC_AUTH);
+ }
+
+ public static VnfmBasicHttpConfigProvider getVnfmBasicHttpConfigProvider(final String url, final String auth) {
+ final VnfmBasicHttpConfigProvider vnfmBasicHttpConfigProvider = new VnfmBasicHttpConfigProvider();
+ vnfmBasicHttpConfigProvider.setUrl(url);
+ vnfmBasicHttpConfigProvider.setAuth(auth);
+ return vnfmBasicHttpConfigProvider;
+ }
+
+ private TestConstants() {}
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java
new file mode 100644
index 0000000000..5aaebea76e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfigurationTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertNotNull;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterCreateVnfTaskConfiguration;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class VnfmAdapterCreateVnfTaskConfigurationTest {
+
+ @Mock
+ private RestTemplate restTemplate;
+
+ @Test
+ public void test_databaseHttpRestServiceProvider_httpRestServiceProviderNotNull() {
+ final VnfmAdapterCreateVnfTaskConfiguration objUnderTest = new VnfmAdapterCreateVnfTaskConfiguration();
+
+ final HttpRestServiceProvider actual =
+ objUnderTest.databaseHttpRestServiceProvider(restTemplate, getVnfmBasicHttpConfigProvider());
+ assertNotNull(actual);
+
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
new file mode 100644
index 0000000000..20abe6ece1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskTest.java
@@ -0,0 +1,250 @@
+/*-
+ * ============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.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_REQUEST_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_RESPONSE_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.INPUT_PARAMETER;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils.InputParameter;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.onap.vnfmadapter.v1.model.Tenant;
+
+import com.google.common.base.Optional;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class VnfmAdapterCreateVnfTaskTest extends BaseTaskTest {
+
+ private static final String MODEL_INSTANCE_NAME = "MODEL_INSTANCE_NAME";
+
+ private static final String CLOUD_OWNER = "CLOUD_OWNER";
+
+ private static final String LCP_CLOUD_REGIONID = "RegionOnce";
+
+ private static final String TENANT_ID = UUID.randomUUID().toString();
+
+ private static final String VNF_ID = UUID.randomUUID().toString();
+
+ private static final String VNF_NAME = "VNF_NAME";
+
+ private static final String JOB_ID = UUID.randomUUID().toString();
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Test
+ public void testBuildCreateVnfRequest_withValidValues_storesRequestInExecution() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+ stubbedxecution.setVariable(INPUT_PARAMETER,
+ new InputParameter(Collections.emptyMap(), Collections.emptyList()));
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ objUnderTest.buildCreateVnfRequest(stubbedxecution);
+
+ final CreateVnfRequest actual = stubbedxecution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
+ assertNotNull(actual);
+ assertEquals(VNF_NAME + "." + MODEL_INSTANCE_NAME, actual.getName());
+
+ final Tenant actualTenant = actual.getTenant();
+ assertEquals(CLOUD_OWNER, actualTenant.getCloudOwner());
+ assertEquals(LCP_CLOUD_REGIONID, actualTenant.getRegionName());
+ assertEquals(TENANT_ID, actualTenant.getTenantId());
+
+ }
+
+ @Test
+ public void testBuildCreateVnfRequest_extractPojosForBBThrowsException_exceptionBuilderCalled() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
+
+ objUnderTest.buildCreateVnfRequest(stubbedxecution);
+
+ final CreateVnfRequest actual = stubbedxecution.getVariable(CREATE_VNF_REQUEST_PARAM_NAME);
+
+ assertNull(actual);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1200),
+ any(Exception.class));
+
+ }
+
+ @Test
+ public void testInvokeVnfmAdapter_validValues_storesResponseInExecution() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+
+ stubbedxecution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, new CreateVnfRequest());
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ when(mockedVnfmAdapterServiceProvider.invokeCreateInstantiationRequest(eq(VNF_ID), any(CreateVnfRequest.class)))
+ .thenReturn(getCreateVnfResponse());
+
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
+
+ assertNotNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
+ }
+
+ @Test
+ public void testInvokeVnfmAdapter_invalidValues_storesResponseInExecution() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+
+ stubbedxecution.setVariable(CREATE_VNF_REQUEST_PARAM_NAME, new CreateVnfRequest());
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf());
+ when(mockedVnfmAdapterServiceProvider.invokeCreateInstantiationRequest(eq(VNF_ID), any(CreateVnfRequest.class)))
+ .thenReturn(Optional.absent());
+
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
+
+ assertNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1202),
+ any(Exception.class));
+ }
+
+
+ @Test
+ public void testInvokeVnfmAdapter_extractPojosForBBThrowsException_exceptionBuilderCalled() throws Exception {
+
+ final VnfmAdapterCreateVnfTask objUnderTest = getEtsiVnfInstantiateTask();
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
+
+ objUnderTest.invokeVnfmAdapter(stubbedxecution);
+
+ assertNull(stubbedxecution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME));
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1202),
+ any(Exception.class));
+
+ }
+
+ private Optional<CreateVnfResponse> getCreateVnfResponse() {
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(JOB_ID);
+ return Optional.of(response);
+ }
+
+ private GenericVnf getGenericVnf() {
+ final GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ genericVnf.setModelInfoGenericVnf(getModelInfoGenericVnf());
+ genericVnf.setVnfName(VNF_NAME);
+ return genericVnf;
+ }
+
+ private ModelInfoGenericVnf getModelInfoGenericVnf() {
+ final ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInstanceName(MODEL_INSTANCE_NAME);
+ return modelInfoGenericVnf;
+ }
+
+ private VnfmAdapterCreateVnfTask getEtsiVnfInstantiateTask() {
+ return new VnfmAdapterCreateVnfTask(exceptionUtil, extractPojosForBB, mockedVnfmAdapterServiceProvider);
+ }
+
+ private class StubbedBuildingBlockExecution implements BuildingBlockExecution {
+
+ private final Map<String, Serializable> execution = new HashMap<>();
+ private final GeneralBuildingBlock generalBuildingBlock;
+
+ StubbedBuildingBlockExecution() {
+ generalBuildingBlock = getGeneralBuildingBlockValue();
+ }
+
+ @Override
+ public GeneralBuildingBlock getGeneralBuildingBlock() {
+ return generalBuildingBlock;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getVariable(final String key) {
+ return (T) execution.get(key);
+ }
+
+ @Override
+ public <T> T getRequiredVariable(final String key) throws RequiredExecutionVariableExeception {
+ return null;
+ }
+
+ @Override
+ public void setVariable(final String key, final Serializable value) {
+ execution.put(key, value);
+ }
+
+ @Override
+ public Map<ResourceKey, String> getLookupMap() {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public String getFlowToBeCalled() {
+ return null;
+ }
+
+ private GeneralBuildingBlock getGeneralBuildingBlockValue() {
+ final GeneralBuildingBlock buildingBlock = new GeneralBuildingBlock();
+ buildingBlock.setCloudRegion(getCloudRegion());
+ return buildingBlock;
+ }
+
+ private CloudRegion getCloudRegion() {
+ final CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setCloudOwner(CLOUD_OWNER);
+ cloudRegion.setLcpCloudRegionId(LCP_CLOUD_REGIONID);
+ cloudRegion.setTenantId(TENANT_ID);
+ return cloudRegion;
+ }
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
new file mode 100644
index 0000000000..0f443916c4
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
@@ -0,0 +1,167 @@
+/*-
+ * ============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.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_GENERIC_VND_ID;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
+
+import java.util.UUID;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterServiceProvider;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterServiceProviderImpl;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterUrlProvider;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import com.google.common.base.Optional;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class VnfmAdapterServiceProviderImplTest {
+
+ private static final String EMPTY_JOB_ID = "";
+
+ private static final CreateVnfRequest CREATE_VNF_REQUEST = new CreateVnfRequest();
+
+ private static final String DUMMY_JOB_ID = UUID.randomUUID().toString();
+
+ @Mock
+ private HttpRestServiceProvider mockedHttpServiceProvider;
+
+ @Mock
+ private ResponseEntity<CreateVnfResponse> mockedResponseEntity;
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBody_validResponse() {
+
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(mockedResponseEntity.hasBody()).thenReturn(true);
+ final CreateVnfResponse response = getCreateVnfResponse(DUMMY_JOB_ID);
+ when(mockedResponseEntity.getBody()).thenReturn(response);
+
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertTrue(actual.isPresent());
+ assertEquals(actual.get(), response);
+
+ }
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithNoBody_noResponse() {
+ assertWithStatuCode(HttpStatus.ACCEPTED);
+ }
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusNotOkWithNoBody_noResponse() {
+ assertWithStatuCode(HttpStatus.UNAUTHORIZED);
+ }
+
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderReturnsStatusAcceptedWithBodyWithInvalidJobId_noResponse() {
+ assertWithJobId(null);
+ assertWithJobId(EMPTY_JOB_ID);
+ }
+
+ @Test
+ public void testInvokeCreateInstantiationRequest_httpServiceProviderThrowException_httpRestServiceProviderNotNull() {
+
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenThrow(RestProcessingException.class);
+
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+
+ }
+
+
+ private void assertWithJobId(final String jobId) {
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ when(mockedResponseEntity.hasBody()).thenReturn(true);
+ final CreateVnfResponse response = getCreateVnfResponse(jobId);
+ when(mockedResponseEntity.getBody()).thenReturn(response);
+
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+ }
+
+ private void assertWithStatuCode(final HttpStatus status) {
+ when(mockedHttpServiceProvider.postHttpRequest(eq(CREATE_VNF_REQUEST), anyString(),
+ eq(CreateVnfResponse.class))).thenReturn(mockedResponseEntity);
+ when(mockedResponseEntity.getStatusCode()).thenReturn(status);
+ when(mockedResponseEntity.hasBody()).thenReturn(false);
+
+ final VnfmAdapterServiceProvider objUnderTest =
+ new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
+
+ final Optional<CreateVnfResponse> actual =
+ objUnderTest.invokeCreateInstantiationRequest(DUMMY_GENERIC_VND_ID, CREATE_VNF_REQUEST);
+ assertFalse(actual.isPresent());
+ }
+
+
+
+ private CreateVnfResponse getCreateVnfResponse(final String jobId) {
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(jobId);
+ return response;
+ }
+
+
+ private VnfmAdapterUrlProvider getVnfmAdapterUrlProvider() {
+ return new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.java
new file mode 100644
index 0000000000..cb93adca69
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterUrlProviderTest.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.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_GENERIC_VND_ID;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXPECTED_URL;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getVnfmBasicHttpConfigProvider;
+
+import org.junit.Test;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.VnfmAdapterUrlProvider;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+public class VnfmAdapterUrlProviderTest {
+
+
+ @Test
+ public void test_getCreateInstantiateUrl_returnValidCreationInstantiationRequest() {
+ final VnfmAdapterUrlProvider objUnderTest = new VnfmAdapterUrlProvider(getVnfmBasicHttpConfigProvider());
+
+ final String actual = objUnderTest.getCreateInstantiateUrl(DUMMY_GENERIC_VND_ID);
+
+ assertEquals(EXPECTED_URL, actual);
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java
new file mode 100644
index 0000000000..d21942d08f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/InputParametersProviderImplTest.java
@@ -0,0 +1,181 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.DUMMY_GENERIC_VND_ID;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.MapperException;
+import org.onap.so.client.sdnc.SDNCClient;
+import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class InputParametersProviderImplTest {
+
+ private static final String BASE_DIR = "src/test/resources/__files/";
+
+ private static final Path PRE_LOAD_SDNC_RESPONSE = Paths.get(BASE_DIR + "SDNCClientPrelaodDataResponse.json");
+
+ private static final Path INVALID_PRE_LOAD_SDNC_RESPONSE =
+ Paths.get(BASE_DIR + "SDNCClientPrelaodDataResponseWithInvalidData.json");
+
+ private static final Path INVALID_ADDITIONAL_AND_EXT_VM_DATA =
+ Paths.get(BASE_DIR + "SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json");
+
+
+ private static final Path INVALID_VNF_PARAMS =
+ Paths.get(BASE_DIR + "SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json");
+
+
+ private static final String MODEL_NAME = "MODEL_NAME";
+
+ private static final String GENERIC_VNF_NAME = "GENERIC_VNF_NAME";
+
+ private static final String URL = PRELOAD_VNFS_URL + GENERIC_VNF_NAME + FORWARD_SLASH + MODEL_NAME;
+
+ private static final String GENERIC_VNF_TYPE = MODEL_NAME;
+
+ @Mock
+ private SDNCClient mockedSdncClient;
+
+ @Test
+ public void testGetInputParameter_ValidResponseFromSdnc_NotEmptyInputParameter() throws Exception {
+ assertValues(getGenericVnf());
+ }
+
+ @Test
+ public void testGetInputParameter_ValidResponseFromSdncAndVnfType_NotEmptyInputParameter() throws Exception {
+ assertValues(getGenericVnf(GENERIC_VNF_TYPE));
+ }
+
+ @Test
+ public void testGetInputParameter_ValidResponseFromSdncInvalidData_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(INVALID_PRE_LOAD_SDNC_RESPONSE));
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ @Test
+ public void testGetInputParameter_ExceptionThrownFromSdnc_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenThrow(RuntimeException.class);
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual instanceof NullInputParameter);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ @Test
+ public void testGetInputParameter_InvalidResponseData_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(INVALID_ADDITIONAL_AND_EXT_VM_DATA));
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ @Test
+ public void testGetInputParameter_EmptyResponseData_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn("");
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual instanceof NullInputParameter);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ @Test
+ public void testGetInputParameter_InvalidVnfParamsResponseData_EmptyInputParameter() throws Exception {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(INVALID_VNF_PARAMS));
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(getGenericVnf());
+ assertNotNull(actual);
+ assertTrue(actual.getAdditionalParams().isEmpty());
+ assertTrue(actual.getExtVirtualLinks().isEmpty());
+ }
+
+ private void assertValues(final GenericVnf genericVnf) throws MapperException, BadResponseException, IOException {
+ when(mockedSdncClient.get(Mockito.eq(URL))).thenReturn(getReponseAsString(PRE_LOAD_SDNC_RESPONSE));
+ final InputParametersProvider objUnderTest = new InputParametersProviderImpl(mockedSdncClient);
+ final InputParameter actual = objUnderTest.getInputParameter(genericVnf);
+ assertNotNull(actual);
+
+ final Map<String, String> actualAdditionalParams = actual.getAdditionalParams();
+ assertEquals(3, actualAdditionalParams.size());
+
+ final String actualInstanceType = actualAdditionalParams.get("instance_type");
+ assertEquals("m1.small", actualInstanceType);
+
+ final List<ExternalVirtualLink> actualExtVirtualLinks = actual.getExtVirtualLinks();
+ assertEquals(1, actualExtVirtualLinks.size());
+
+ final ExternalVirtualLink actualExternalVirtualLink = actualExtVirtualLinks.get(0);
+ assertEquals("ac1ed33d-8dc1-4800-8ce8-309b99c38eec", actualExternalVirtualLink.getId());
+ }
+
+ private String getReponseAsString(final Path filePath) throws IOException {
+ return new String(Files.readAllBytes(filePath));
+ }
+
+ private GenericVnf getGenericVnf() {
+ final GenericVnf genericVnf = getGenericVnf(GENERIC_VNF_TYPE);
+ final ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelName(MODEL_NAME);
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ return genericVnf;
+ }
+
+ private GenericVnf getGenericVnf(final String vnfType) {
+ final GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(DUMMY_GENERIC_VND_ID);
+ genericVnf.setVnfName(GENERIC_VNF_NAME);
+ genericVnf.setVnfType(vnfType);
+ return genericVnf;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java
index 6c62920781..46018b8f39 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameterTest.java
@@ -1,8 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,41 +13,26 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.utils;
-package org.onap.so.bpmn.mock;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
+import org.junit.Test;
-import org.junit.Ignore;
+import nl.jqno.equalsverifier.EqualsVerifier;
+import nl.jqno.equalsverifier.Warning;
/**
- *
- * JAX RS Application wiring for Mock Resource
+ * @author waqas.ikram@est.tech
+ *
*/
-@ApplicationPath("/console")
-@Ignore
-public class MockResourceApplication extends Application {
-
- private Set<Object> singletons = new HashSet<>();
- private Set<Class<?>> classes = new HashSet<>();
-
- public MockResourceApplication() {
- singletons.add(new MockResource());
- }
-
- @Override
- public Set<Class<?>> getClasses() {
- return classes;
- }
+public class VnfParameterTest {
+ @Test
+ public void testVnfParameter_equalAndHasCode() throws ClassNotFoundException {
+ EqualsVerifier.forClass(VnfParameter.class).suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS)
+ .verify();
+ }
- @Override
- public Set<Object> getSingletons() {
- return singletons;
- }
}
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 7495cc1e8d..a8518d9016 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
@@ -73,7 +73,7 @@ public class AppcRunTasksTest extends BaseTaskTest {
public void runAppcCommandVnfNull() throws BBObjectNotFoundException {
execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "NULL-TEST");
fillRequiredAppcExecutionFields();
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID), eq("NULL-TEST")))
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID)))
.thenReturn(null);
when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(
isNull(), eq(Action.Lock.toString()))).
@@ -92,7 +92,7 @@ public class AppcRunTasksTest extends BaseTaskTest {
public void runAppcCommandBBObjectNotFoundException() throws BBObjectNotFoundException {
execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "EXCEPTION-TEST");
fillRequiredAppcExecutionFields();
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID), eq("EXCEPTION-TEST")))
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID)))
.thenThrow(new BBObjectNotFoundException());
appcRunTasks.runAppcCommand(execution, Action.Lock);
@@ -107,11 +107,11 @@ public class AppcRunTasksTest extends BaseTaskTest {
execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "SUCCESS-TEST");
fillRequiredAppcExecutionFields();
GenericVnf genericVnf = getTestGenericVnf();
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID), eq("SUCCESS-TEST")))
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID)))
.thenReturn(genericVnf);
mockReferenceResponse();
execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID), eq("VF-MODULE-ID-TEST")))
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID)))
.thenReturn(null);
when(appCClient.getErrorCode()).thenReturn("0");
@@ -125,13 +125,13 @@ public class AppcRunTasksTest extends BaseTaskTest {
execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "SUCCESS-TEST");
fillRequiredAppcExecutionFields();
GenericVnf genericVnf = getTestGenericVnf();
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID), eq("SUCCESS-TEST")))
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID)))
.thenReturn(genericVnf);
mockReferenceResponse();
execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("VF-MODULE-ID");
- when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID), eq("VF-MODULE-ID-TEST")))
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID)))
.thenReturn(vfModule);
when(appCClient.getErrorCode()).thenReturn("0");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java
index 7a9e2bb6cf..3542d7fdb3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java
@@ -56,9 +56,9 @@ public class AuditTasksTest extends BaseTaskTest{
genericVnf = setGenericVnf();
vfModule = setVfModule();
setCloudRegion();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java
index befeea411d..19981bc45a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java
@@ -48,14 +48,14 @@ public class AssignNetworkTest extends BaseTaskTest {
public void before() throws BBObjectNotFoundException {
network = setL3Network();
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
}
@Test
public void networkNotFoundTest() throws Exception {
//network status to PRECREATED - when it was NOT found by name
try {
- network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
} catch(BBObjectNotFoundException e) {
}
@@ -67,7 +67,7 @@ public class AssignNetworkTest extends BaseTaskTest {
@Test
public void networkFoundTest() throws Exception {
try {
- network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
} catch(BBObjectNotFoundException e) {
}
boolean networkFound = assignNetwork.networkFoundByName(execution);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java
index 4ad6fba910..834990db5a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java
@@ -92,7 +92,7 @@ public class AssignVnfTest extends BaseTaskTest {
doNothing().when(aaiInstanceGroupResources).createInstanceGroup(isA(InstanceGroup.class));
doNothing().when(aaiInstanceGroupResources).connectInstanceGroupToVnf(isA(InstanceGroup.class), isA(GenericVnf.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
new file mode 100644
index 0000000000..07983ccd50
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 TechMahindra.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.when;
+
+import java.util.UUID;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentMatchers;
+import org.mockito.InjectMocks;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+
+public class ConfigAssignVnfTest extends BaseTaskTest {
+ @InjectMocks
+ private ConfigAssignVnf configAssignVnf = new ConfigAssignVnf();
+
+ private GenericVnf genericVnf;
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ genericVnf = setGenericVnf();
+ serviceInstance = setServiceInstance();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
+
+ @Test
+ public void preProcessAbstractCDSProcessingTest() throws Exception {
+
+ configAssignVnf.preProcessAbstractCDSProcessing(execution);
+
+ assertTrue(true);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java
new file mode 100644
index 0000000000..e5aa702dad
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java
@@ -0,0 +1,97 @@
+
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2019 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.when;
+
+import java.util.UUID;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentMatchers;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.aai.tasks.AAIUpdateTasks;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+
+public class ConfigDeployVnfTest extends BaseTaskTest {
+
+ @InjectMocks
+ private ConfigDeployVnf configDeployVnf = new ConfigDeployVnf();
+ @Mock
+ AAIUpdateTasks aAIUpdateTasks = new AAIUpdateTasks();
+
+
+ private GenericVnf genericVnf;
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ genericVnf = setGenericVnf();
+ serviceInstance = setServiceInstance();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
+ }
+
+
+
+ @Test
+ public void preProcessAbstractCDSProcessingTest() throws Exception {
+
+ configDeployVnf.preProcessAbstractCDSProcessing(execution);
+
+ assertTrue(true);
+ }
+
+ @Test
+ public void updateAAIConfigureTaskTest() throws Exception {
+
+ configDeployVnf.updateAAIConfigure(execution);
+ assertTrue(true);
+ }
+
+ @Test
+ public void updateAAIConfiguredTaskTest() throws Exception {
+ configDeployVnf.updateAAIConfigured(execution);
+ assertTrue(true);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
index ad848a4d49..6390268a0c 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
@@ -81,8 +81,8 @@ public class ConfigurationScaleOutTest extends BaseTaskTest {
gBBInput.setRequestContext(requestContext);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java
index 7202bd5298..423029c59b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java
@@ -70,8 +70,8 @@ public class CreateNetworkCollectionTest extends BaseTaskTest{
orchestrationContext.setIsRollbackEnabled(true);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java
index ddfd636a64..de1aa63f55 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java
@@ -70,8 +70,8 @@ public class CreateNetworkTest extends BaseTaskTest{
userInput = setUserInput();
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
index 7fdf2535bf..2386da743b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
@@ -66,7 +66,7 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest {
gBBInput.setRequestContext(requestContext);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
index ccfcabaf09..ecdf11bd05 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
@@ -72,7 +72,7 @@ public class UnassignNetworkBBTest extends BaseTaskTest {
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
Optional<org.onap.aai.domain.yang.L3Network> l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
- doReturn(network).when(extractPojosForBB).extractByKey(execution, ResourceKey.NETWORK_ID, "testNetworkId1");
+ doReturn(network).when(extractPojosForBB).extractByKey(execution, ResourceKey.NETWORK_ID);
doReturn(aaiResultWrapper).when(aaiNetworkResources).queryNetworkWrapperById(network);
doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(any(Optional.class), eq("vf-module"));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java
index 688f95c3c0..394ffcf0ac 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java
@@ -68,7 +68,7 @@ public class UnassignVnfTest extends BaseTaskTest{
instanceGroup2.setId("test-002");
instanceGroup2.setModelInfoInstanceGroup(modelVnfc);
genericVnf.getInstanceGroups().add(instanceGroup2);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
unassignVnf.deleteInstanceGroups(execution);
verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup1));
verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup2));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java
index 41739f37e6..67c48d1e91 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.namingservice.tasks;
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.doThrow;
import static org.mockito.Mockito.times;
@@ -47,7 +46,7 @@ public class NamingServiceCreateTasksTest extends BaseTaskTest {
@Before
public void before() throws BBObjectNotFoundException {
instanceGroup = setInstanceGroup();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup);
}
@Test
@@ -68,7 +67,7 @@ public class NamingServiceCreateTasksTest extends BaseTaskTest {
public void createInstanceGroupExceptionTest() throws Exception {
expectedException.expect(BBObjectNotFoundException.class);
lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound");
- doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID),eq("notfound"));
+ doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID));
String policyInstanceName = "policyInstanceName";
String nfNamingCode = "nfNamingCode";
execution.setVariable(policyInstanceName, policyInstanceName);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java
index 97dcc617ac..56226dfa96 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.infrastructure.namingservice.tasks;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
@@ -46,7 +45,7 @@ public class NamingServiceDeleteTasksTest extends BaseTaskTest {
@Before
public void before() throws BBObjectNotFoundException {
instanceGroup = setInstanceGroup();
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup);
}
@Test
@@ -62,7 +61,7 @@ public class NamingServiceDeleteTasksTest extends BaseTaskTest {
public void deleteInstanceGroupExceptionTest() throws Exception {
expectedException.expect(BBObjectNotFoundException.class);
lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound");
- doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID),eq("notfound"));
+ doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID));
doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup);
namingServiceDeleteTasks.deleteInstanceGroupName(execution);
verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java
index 65e7d249c5..cbd7605aa4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java
@@ -78,10 +78,10 @@ public class SDNCActivateTaskTest extends BaseTaskTest{
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java
index d021df56e0..b5509b1e12 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java
@@ -80,11 +80,11 @@ public class SDNCAssignTasksTest extends BaseTaskTest{
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java
index f01596c86f..be792115c9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java
@@ -69,9 +69,9 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest{
requestContext = setRequestContext();
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java
index 3d25addb9c..18048da50d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java
@@ -75,10 +75,10 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest {
network = setL3Network();
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
}
@@ -142,7 +142,7 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest {
@Test
public void test_deactivateNetwork_exception() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any());
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID));
sdncDeactivateTasks.deactivateNetwork(execution);
verify(sdncNetworkResources, times(0)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
index 4c5c50ebbf..28551baa7a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
@@ -63,11 +63,11 @@ public class SDNCQueryTasksTest extends BaseTaskTest{
vfModule = setVfModule();
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
}
@@ -124,7 +124,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest{
@Test
public void queryVfModuleForVolumeGroupVfObjectExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any());
+ doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID));
sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
verify(sdncVfModuleResources, times(0)).queryVfModule(any(VfModule.class));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java
index 1301787dff..527fe0d916 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java
@@ -76,10 +76,10 @@ public class SDNCUnassignTasksTest extends BaseTaskTest{
cloudRegion = setCloudRegion();
network = setL3Network();
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java
index 6eb22a6dcc..329f2cf8c1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java
@@ -69,7 +69,7 @@ public class SDNOHealthCheckTasksTest extends TestDataSetup {
public void before() throws BBObjectNotFoundException {
genericVnf = setGenericVnf();
requestContext = setRequestContext();
- when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),any())).thenReturn(genericVnf);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index a8e9a7e57e..d5b529288f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -74,24 +74,27 @@ public class AAIObjectMapperTest {
Configuration configuration = new Configuration();
configuration.setConfigurationId("configId");
configuration.setConfigurationName("VNR");
- configuration.setConfigurationType("VNR-TYPE");
configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
configuration.setManagementOption("managementOption");
ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
modelInfoConfiguration.setModelCustomizationId("modelCustId");
modelInfoConfiguration.setModelInvariantId("modelInvariantId");
modelInfoConfiguration.setModelVersionId("modelVersionId");
+ modelInfoConfiguration.setConfigurationType("5G");
+ modelInfoConfiguration.setConfigurationRole("ConfigurationRole");
configuration.setModelInfoConfiguration(modelInfoConfiguration);
org.onap.aai.domain.yang.Configuration expectedConfiguration = new org.onap.aai.domain.yang.Configuration();
expectedConfiguration.setConfigurationId(configuration.getConfigurationId());
expectedConfiguration.setConfigurationName(configuration.getConfigurationName());
- expectedConfiguration.setConfigurationType(configuration.getConfigurationType());
+ expectedConfiguration.setConfigurationType(configuration.getModelInfoConfiguration().getConfigurationType());
expectedConfiguration.setOrchestrationStatus(configuration.getOrchestrationStatus().toString());
expectedConfiguration.setManagementOption(configuration.getManagementOption());
expectedConfiguration.setModelInvariantId(configuration.getModelInfoConfiguration().getModelInvariantId());
expectedConfiguration.setModelVersionId(configuration.getModelInfoConfiguration().getModelVersionId());
expectedConfiguration.setModelCustomizationId(configuration.getModelInfoConfiguration().getModelCustomizationId());
+ expectedConfiguration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole());
+ expectedConfiguration.setConfigPolicyName(configuration.getModelInfoConfiguration().getPolicyName());
org.onap.aai.domain.yang.Configuration actualConfiguration = aaiObjectMapper.mapConfiguration(configuration);
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 4aeed71177..4bf445949a 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
@@ -98,7 +98,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
aaiConfigurationResources.createConfiguration(configuration);
- assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus());
+ assertEquals(OrchestrationStatus.ASSIGNED, configuration.getOrchestrationStatus());
verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
}
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 b87b5e4166..d499bcd36e 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
@@ -21,6 +21,7 @@
package org.onap.so.client.orchestration;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
@@ -29,6 +30,7 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.io.IOException;
import java.util.Optional;
import org.junit.Before;
@@ -47,6 +49,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.AAIValidatorImpl;
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;
@@ -70,6 +73,9 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Mock
protected InjectionHelper MOCK_injectionHelper;
+ @Mock
+ protected AAIValidatorImpl MOCK_aaiValidatorImpl;
+
@InjectMocks
AAIVnfResources aaiVnfResources = new AAIVnfResources();
@@ -182,4 +188,29 @@ public class AAIVnfResourcesTest extends TestDataSetup {
eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())));
}
+
+
+ @Test
+ public void checkVnfClosedLoopDisabledFlagTest () {
+ Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf());
+ vnf.get().setVnfId("vnfId");
+ vnf.get().setIsClosedLoopDisabled(true);
+ doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ boolean isCheckVnfClosedLoopDisabledFlag = aaiVnfResources.checkVnfClosedLoopDisabledFlag("vnfId");
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ assertEquals(isCheckVnfClosedLoopDisabledFlag, true);
+ }
+
+ @Test
+ public void checkVnfPserversLockedFlagTest () throws IOException {
+
+ Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf());
+ vnf.get().setVnfId("vnfId");
+ doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ doReturn(true).when(MOCK_aaiValidatorImpl).isPhysicalServerLocked("vnfId");
+ 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)).isPhysicalServerLocked(isA(String.class));
+ assertTrue(isVnfPserversLockedFlag);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
index f4d442bbc3..0ca80c75f7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
@@ -62,6 +62,7 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
serviceInstance.setServiceInstanceId("ServiceInstanceId");
Configuration Configuration = new Configuration();
Configuration.setConfigurationId("ConfigurationId");
+ Configuration.setConfigurationType("VLAN-NETWORK-RECEPTOR");
GenericResourceApiGcTopologyOperationInformation genericInfo = genObjMapper.deactivateOrUnassignVnrReqMapper
(SDNCSvcAction.UNASSIGN, serviceInstance, requestContext, Configuration,"uuid",new URI("http://localhost"));
@@ -70,6 +71,8 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
Assert.assertNotNull(genericInfo.getSdncRequestHeader());
Assert.assertNotNull(genericInfo.getClass());
Assert.assertNotNull(genericInfo.getServiceInformation());
+ Assert.assertEquals("ConfigurationId", genericInfo.getConfigurationInformation().getConfigurationId());
+ Assert.assertEquals("VLAN-NETWORK-RECEPTOR", genericInfo.getConfigurationInformation().getConfigurationType());
Assert.assertEquals("uuid",genericInfo.getSdncRequestHeader().getSvcRequestId());
Assert.assertEquals("http://localhost",genericInfo.getSdncRequestHeader().getSvcNotificationUrl());
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponse.json
new file mode 100644
index 0000000000..0de25616e3
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponse.json
@@ -0,0 +1,127 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "extra_console",
+ "vnf-parameter-value": "ttyS1"
+ },
+ {
+ "vnf-parameter-name": "vnfUsername",
+ "vnf-parameter-value": "vnf_user"
+ },
+ {
+ "vnf-parameter-name": "additionalParams",
+ "vnf-parameter-value": "{\"image_id\": \"DUMMYVNF\",\"instance_type\": \"m1.small\",\"ftp_address\": \"ftp://0.0.0.0:2100/\"}"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_gateway_ip_1",
+ "vnf-parameter-value": "0.0.0.0"
+ },
+ {
+ "vnf-parameter-name": "availability_zone_1"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_gateway_ip_2"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_prefix_length",
+ "vnf-parameter-value": "28"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_OMCN_vLC_P4_prefix_length",
+ "vnf-parameter-value": "28"
+ },
+ {
+ "vnf-parameter-name": "gpbs",
+ "vnf-parameter-value": "2"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_ip_2",
+ "vnf-parameter-value": "192.0.0.1"
+ },
+ {
+ "vnf-parameter-name": "internal_mtu",
+ "vnf-parameter-value": "1500"
+ },
+ {
+ "vnf-parameter-name": "storage_drbd_sync_rate",
+ "vnf-parameter-value": "0"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_MEDIA_vLC_P3_net_id",
+ "vnf-parameter-value": "ONAPMME_MEDIA_vLC_P3"
+ },
+ {
+ "vnf-parameter-name": "extVirtualLinks",
+ "vnf-parameter-value": "[{\"id\":\"ac1ed33d-8dc1-4800-8ce8-309b99c38eec\",\"tenant\":{\"cloudOwner\":\"CloudOwner\",\"regionName\":\"RegionOne\",\"tenantId\":\"80c26954-2536-4bca-9e20-10f8a2c9c2ad\"},\"resourceId\":\"8ef8cd54-75fd-4372-a6dd-2e05ea8fbd9b\",\"extCps\":[{\"cpdId\":\"f449292f-2f0f-4656-baa3-a18d86bac80f\",\"cpConfig\":[{\"cpInstanceId\":\"07876709-b66f-465c-99a7-0f4d026197f2\",\"linkPortId\":null,\"cpProtocolData\":null}]}],\"extLinkPorts\":null}]"
+ },
+ {
+ "vnf-parameter-name": "vnfIpAddress",
+ "vnf-parameter-value": "127.0.0.0"
+ },
+ {
+ "vnf-parameter-name": "node_type",
+ "vnf-parameter-value": "sgsnl"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_SIG_vLC_P2_net_id",
+ "vnf-parameter-value": "ONAPMME_SIG_vLC_P2"
+ },
+ {
+ "vnf-parameter-name": "updateOss",
+ "vnf-parameter-value": "false"
+ },
+ {
+ "vnf-parameter-name": "tmo",
+ "vnf-parameter-value": "0"
+ },
+ {
+ "vnf-parameter-name": "ss7",
+ "vnf-parameter-value": "Not_Applicable"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_OMCN_vLC_P4_net_id",
+ "vnf-parameter-value": "ONAPMME_OMCN_vLC_P4"
+ },
+ {
+ "vnf-parameter-name": "key_name"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_dns_server_ip_2"
+ },
+ {
+ "vnf-parameter-name": "time_zone",
+ "vnf-parameter-value": "GMT"
+ },
+ {
+ "vnf-parameter-name": "enableRollback",
+ "vnf-parameter-value": "false"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json
new file mode 100644
index 0000000000..c2cf2b2f28
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json
@@ -0,0 +1,47 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "extra_console",
+ "vnf-parameter-value": "ttyS1"
+ },
+ {
+ "vnf-parameter-name": "vnfUsername",
+ "vnf-parameter-value": "vnf_user"
+ },
+ {
+ "vnf-parameter-name": "additionalParams",
+ "vnf-parameter-value": "[\"abc\"]"
+ },
+ {
+ "vnf-parameter-name": "extVirtualLinks",
+ "vnf-parameter-value": "{\"def\":\"123\"}"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json
new file mode 100644
index 0000000000..552adb9125
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json
@@ -0,0 +1,39 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "extra_console",
+ "vnf-parameter-value": "ttyS1"
+ },
+ {
+ "vnf-parameter-name": "vnfUsername",
+ "vnf-parameter-value": "vnf_user"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json
new file mode 100644
index 0000000000..e19ad1c9d3
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json
@@ -0,0 +1,34 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "hello": "world"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/common/pom.xml b/common/pom.xml
index 883d48c21c..2a9f88f6d2 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -15,7 +15,7 @@
<grpc.version>1.17.1</grpc.version>
<protobuf.version>3.6.1</protobuf.version>
<grpc.netty.version>4.1.30.Final</grpc.netty.version>
- <ccsdk.version>0.4.1-SNAPSHOT</ccsdk.version>
+ <ccsdk.version>0.4.2-SNAPSHOT</ccsdk.version>
</properties>
<dependencies>
@@ -143,7 +143,7 @@
<!-- CDS dependencies -->
<dependency>
- <groupId>org.onap.ccsdk.apps.components</groupId>
+ <groupId>org.onap.ccsdk.cds.components</groupId>
<artifactId>proto-definition</artifactId>
<version>${ccsdk.version}</version>
</dependency>
diff --git a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
index 14556f1211..0633ae74c9 100644
--- a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
+++ b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
@@ -20,9 +20,13 @@
package org.onap.so.client;
+import org.onap.so.configuration.rest.HttpComponentsClientConfiguration;
import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
@@ -30,11 +34,29 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig {
- @Bean
- public RestTemplate restTemplate() {
- RestTemplate restTemplate = new RestTemplate();
- restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- restTemplate.getInterceptors().add(new SpringClientFilter());
- return restTemplate;
- }
+ public static final String CONFIGURABLE_REST_TEMPLATE = "configurableRestTemplate";
+
+ @Autowired
+ private HttpComponentsClientConfiguration httpComponentsClientConfiguration;
+
+ @Bean
+ @Primary
+ public RestTemplate restTemplate() {
+ final RestTemplate restTemplate = new RestTemplate();
+ restTemplate
+ .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
+ restTemplate.getInterceptors().add(new SpringClientFilter());
+ return restTemplate;
+ }
+
+ @Bean
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ public RestTemplate configurableRestTemplate() {
+ final HttpComponentsClientHttpRequestFactory clientHttpRequestFactory =
+ httpComponentsClientConfiguration.httpComponentsClientHttpRequestFactory();
+ final RestTemplate restTemplate =
+ new RestTemplate(new BufferingClientHttpRequestFactory(clientHttpRequestFactory));
+ restTemplate.getInterceptors().add(new SpringClientFilter());
+ return restTemplate;
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
index ffc474a55a..6c6cf9024d 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
@@ -32,7 +32,6 @@ import javax.ws.rs.ext.Provider;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.ResponseExceptionMapper;
import org.onap.so.client.aai.entities.AAIError;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.MDC;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index 21e36cde6c..34d560210c 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -21,7 +21,6 @@
package org.onap.so.client.aai;
import java.io.Serializable;
-import java.lang.reflect.Field;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -39,7 +38,9 @@ import org.onap.aai.domain.yang.Connector;
import org.onap.aai.domain.yang.Customer;
import org.onap.aai.domain.yang.Device;
import org.onap.aai.domain.yang.ExtAaiNetwork;
+import org.onap.aai.domain.yang.Flavor;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Image;
import org.onap.aai.domain.yang.InstanceGroup;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.LInterface;
@@ -134,6 +135,8 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType EXT_AAI_NETWORK = new AAIObjectType(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class);
public static final AAIObjectType AGGREGATE_ROUTE = new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class);
public static final AAIObjectType L_INTERFACE = new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class);
+ public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class);
+ public static final AAIObjectType FLAVOR = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class);
public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown");
public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl");
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 6ece8a2620..1bd7720e55 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
@@ -26,8 +26,7 @@ import java.util.List;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Pserver;
import org.springframework.beans.factory.annotation.Autowired;
-
-
+import org.springframework.stereotype.Component;
public class AAIValidatorImpl implements AAIValidator {
@@ -50,10 +49,12 @@ public class AAIValidatorImpl implements AAIValidator {
List<Pserver> pservers;
boolean isLocked = false;
pservers = client.getPhysicalServerByVnfId(vnfId);
- for (Pserver pserver : pservers)
- if (pserver.isInMaint())
+ for (Pserver pserver : pservers) {
+ if (pserver.isInMaint()) {
isLocked = true;
-
+ return isLocked;
+ }
+ }
return isLocked;
}
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
index 756c26ddef..9b2fd3fdb0 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
@@ -25,7 +25,7 @@ import io.grpc.internal.DnsNameResolverProvider;
import io.grpc.internal.PickFirstLoadBalancerProvider;
import io.grpc.netty.NettyChannelBuilder;
import java.util.concurrent.CountDownLatch;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.so.client.PreconditionFailedException;
import org.onap.so.client.RestPropertiesLoader;
import org.slf4j.Logger;
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
index 1791be2991..4b86493f79 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingHandler.java
@@ -23,11 +23,11 @@ package org.onap.so.client.cds;
import io.grpc.ManagedChannel;
import io.grpc.stub.StreamObserver;
import java.util.concurrent.CountDownLatch;
-import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceStub;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceStub;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java
index 8c92a5810c..ed7b4e51ba 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingListener.java
@@ -20,7 +20,7 @@
package org.onap.so.client.cds;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
public interface CDSProcessingListener {
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
index 42a4b47aa2..59c64e0459 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
@@ -1,23 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 Bell Canada.
- * ================================================================================
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
-
package org.onap.so.client.cds;
import org.onap.so.client.RestProperties;
@@ -30,4 +25,6 @@ public interface CDSProperties extends RestProperties {
int getPort();
String getBasicAuth();
+
+ int getTimeout();
}
diff --git a/common/src/main/java/org/onap/so/configuration/rest/BasicHttpHeadersProvider.java b/common/src/main/java/org/onap/so/configuration/rest/BasicHttpHeadersProvider.java
new file mode 100644
index 0000000000..7606f3a8d3
--- /dev/null
+++ b/common/src/main/java/org/onap/so/configuration/rest/BasicHttpHeadersProvider.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.configuration.rest;
+
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class BasicHttpHeadersProvider implements HttpHeadersProvider {
+
+ public static final String AUTHORIZATION_HEADER = "Authorization";
+
+ private final HttpHeaders headers = new HttpHeaders();
+
+ public BasicHttpHeadersProvider(final String authorization) {
+ headers.add(AUTHORIZATION_HEADER, authorization);
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ }
+
+ public BasicHttpHeadersProvider() {
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ }
+
+ @Override
+ public HttpHeaders getHttpHeaders() {
+ return headers;
+ }
+
+ @Override
+ public String toString() {
+ return "BasicHttpHeadersProvider [headers=" + headers + "]";
+ }
+
+}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpClientConnectionConfiguration.java b/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
index 1260e535a1..a5a4cb7d53 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpClientConnectionConfiguration.java
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java
@@ -1,29 +1,36 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.monitoring.configuration.rest;
+
+package org.onap.so.configuration.rest;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
+/**
+ * This class is used configure the parameters needed for
+ * {@link org.apache.http.impl.client.CloseableHttpClient}
+ *
+ * @author waqas.ikram@est.tech
+ */
@Service
public class HttpClientConnectionConfiguration {
@@ -43,45 +50,38 @@ public class HttpClientConnectionConfiguration {
private int maxConnectionsPerRoute;
/**
- * @return the socketTimeOut
+ * @return the socket connection time out in milliseconds
*/
public int getSocketTimeOutInMiliSeconds() {
return (int) TimeUnit.SECONDS.toMillis(socketTimeOutInSeconds);
}
/**
- * @return the maxConnections
+ * @return the maximum total connection value.
*/
public int getMaxConnections() {
return maxConnections;
}
/**
- * @return the maxConnectionsPerRoute
+ * @return the maximum connection per route value.
*/
public int getMaxConnectionsPerRoute() {
return maxConnectionsPerRoute;
}
/**
- * @return the connectionTimeOut
+ * @return the connect time out value in milliseconds.
*/
public int getConnectionTimeOutInMilliSeconds() {
return (int) TimeUnit.SECONDS.toMillis(connectionTimeOutInSeconds);
}
/**
- * @return the timeToLive
+ * @return the connection time to live value in mintues.
*/
public int getTimeToLiveInMins() {
return (int) TimeUnit.SECONDS.toMinutes(timeToLiveInSeconds);
}
- @Override
- public String toString() {
- return "HttpClientConnectionConfiguration [connectionTimeOutInSeconds=" + connectionTimeOutInSeconds
- + ", socketTimeOutInSeconds=" + socketTimeOutInSeconds + ", timeToLiveInSeconds=" + timeToLiveInSeconds
- + ", maxConnections=" + maxConnections + ", maxConnectionsPerRoute=" + maxConnectionsPerRoute + "]";
- }
-
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/RestTemplateConfiguration.java b/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
index f8f0f687cf..e943aef159 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/RestTemplateConfiguration.java
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java
@@ -17,8 +17,8 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
-package org.onap.so.monitoring.configuration.rest;
+
+package org.onap.so.configuration.rest;
import java.util.concurrent.TimeUnit;
@@ -27,35 +27,23 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
-import org.springframework.web.client.RestTemplate;
/**
- * @author waqas.ikram@ericsson.com
+ * Allow user to configure {@link org.apache.http.client.HttpClient}
+ *
+ * @author waqas.ikram@est.tech
*/
@Configuration
-public class RestTemplateConfiguration {
+public class HttpComponentsClientConfiguration {
- public static final String DATABASE_REST_TEMPLATE = "databaseRestTemplate";
-
- public static final String CAMUNDA_REST_TEMPLATE = "camundaRestTemplate";
+ private final HttpClientConnectionConfiguration clientConnectionConfiguration;
@Autowired
- private HttpClientConnectionConfiguration clientConnectionConfiguration;
-
- @Bean
- @Qualifier(CAMUNDA_REST_TEMPLATE)
- public RestTemplate camundaRestTemplate() {
- return new RestTemplate(httpComponentsClientHttpRequestFactory());
- }
-
- @Bean
- @Qualifier(DATABASE_REST_TEMPLATE)
- public RestTemplate dataBasecamundaRestTemplate() {
- return new RestTemplate(httpComponentsClientHttpRequestFactory());
+ public HttpComponentsClientConfiguration(final HttpClientConnectionConfiguration clientConnectionConfiguration) {
+ this.clientConnectionConfiguration = clientConnectionConfiguration;
}
@Bean
diff --git a/common/src/main/java/org/onap/so/configuration/rest/HttpHeadersProvider.java b/common/src/main/java/org/onap/so/configuration/rest/HttpHeadersProvider.java
new file mode 100644
index 0000000000..0cff7b4ba0
--- /dev/null
+++ b/common/src/main/java/org/onap/so/configuration/rest/HttpHeadersProvider.java
@@ -0,0 +1,35 @@
+/*-
+ * ============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.configuration.rest;
+
+import org.springframework.http.HttpHeaders;
+
+/**
+ * Providers {@link org.springframework.http.HttpHeaders} for HTTP requests
+ *
+ * @author waqas.ikram@est.tech
+ *
+ */
+public interface HttpHeadersProvider {
+
+ HttpHeaders getHttpHeaders();
+
+}
diff --git a/common/src/main/java/org/onap/so/logger/ErrorCode.java b/common/src/main/java/org/onap/so/logger/ErrorCode.java
new file mode 100644
index 0000000000..b58189efda
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logger/ErrorCode.java
@@ -0,0 +1,16 @@
+package org.onap.so.logger;
+
+public enum ErrorCode {
+ PermissionError(100), AvailabilityError(200), DataError(300), SchemaError(400), BusinessProcesssError(
+ 500), UnknownError(900);
+
+ private int value;
+
+ ErrorCode(int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return this.value;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
new file mode 100644
index 0000000000..f34b4b5a9a
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
@@ -0,0 +1,13 @@
+package org.onap.so.logger;
+
+public class HttpHeadersConstants {
+ public static final String HEADER_FROM_APP_ID = "X-FromAppId";
+ public static final String ONAP_PARTNER_NAME = "X-ONAP-PartnerName";
+ public static final String HEADER_REQUEST_ID = "X-RequestId";
+ public static final String TRANSACTION_ID = "X-TransactionID";
+ public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID";
+ public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID";
+ public static final String CLIENT_ID = "X-ClientID";
+ public static final String INVOCATION_ID_HEADER = "X-InvocationID";
+ public static final String REQUESTOR_ID = "X-RequestorID";
+}
diff --git a/common/src/main/java/org/onap/so/logger/MdcConstants.java b/common/src/main/java/org/onap/so/logger/MdcConstants.java
new file mode 100644
index 0000000000..9f8417e047
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logger/MdcConstants.java
@@ -0,0 +1,13 @@
+package org.onap.so.logger;
+
+public class MdcConstants {
+ public static final String INVOCATION_ID = "InvocationID";
+ public static final String RESPONSECODE = "ResponseCode";
+ public static final String RESPONSEDESC = "ResponseDesc";
+ public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID";
+ public static final String CLIENT_ID = "X-ClientID";
+ public static final String PARTNERNAME = "PartnerName";
+ public static final String SERVICE_NAME = "ServiceName";
+ public static final String STATUSCODE = "StatusCode";
+ public static final String ENDTIME = "EndTimestamp";
+}
diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java
deleted file mode 100644
index 9715695d7c..0000000000
--- a/common/src/main/java/org/onap/so/logger/MsoLogger.java
+++ /dev/null
@@ -1,1092 +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.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.logger;
-
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.invoke.MethodHandles;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.apache.commons.lang3.StringUtils;
-import org.onap.so.entity.MsoRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.slf4j.Marker;
-import org.slf4j.MarkerFactory;
-
-
-/**
- * This class supports all of the normal logging functions (debug, info, etc.), prepending
- * a string of format "[<requestId>|<serviceId]" to each message.
- *
- * SO code should initialize with these IDs when available, so that individual
- * requests and/or services can be tracked throughout the various MSO component
- * logs (API Handler, BPEL, and Adapters).
- *
- *
- */
-
-public class MsoLogger {
- // Required MDC parameters
- public static final String REQUEST_ID = "RequestID";
- public static final String INVOCATION_ID = "InvocationID";
- public static final String INSTANCE_UUID = "InstanceUUID";
- public static final String SERVICE_NAME = "ServiceName";
- public static final String STATUSCODE = "StatusCode";
- public static final String RESPONSECODE = "ResponseCode";
- public static final String RESPONSEDESC = "ResponseDesc";
- public static final String FQDN = "ServerFQDN";
- public static final String ENTRY_TIMESTAMP = "EntryTimestamp";
- public static final String CLIENT_IPADDRESS = "EntryTimestamp";
-
-
- //HTTP Headers
- public static final String HEADER_FROM_APP_ID = "X-FromAppId";
- public static final String ONAP_PARTNER_NAME = "X-ONAP-PartnerName";
- public static final String HEADER_REQUEST_ID = "X-RequestId";
- public static final String TRANSACTION_ID = "X-TransactionID";
- public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID";
- public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID";
- public static final String CLIENT_ID = "X-ClientID";
- public static final String INVOCATION_ID_HEADER = "X-InvocationID";
- public static final String REQUESTOR_ID = "X-RequestorID";
-
- //Default values for not found
- public static final String UNKNOWN_PARTNER = "UnknownPartner";
-
- public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
- public static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName";
- public static final String SERVER_IP = "ServerIPAddress";
-
- public static final String REMOTE_HOST = "RemoteHost";
- public static final String ALERT_SEVERITY = "AlertSeverity";
- public static final String TIMER = "Timer";
- public static final String USER = "User";
- public static final String DUMMY_VALUE = "trace-#";
- public static final String UNKNOWN = "UNKNOWN";
- public static final String CAT_LOG_LEVEL = "CategoryLogLevel";
- public static final String AUDI_CAT_LOG_LEVEL = "AuditCategoryLogLevel";
-
-
-
- public static final String PARTNER_NAME = "PartnerName";
-
- // Audit/Metric log specific
- public static final String BEGINTIME = "BeginTimestamp";
- public static final String STARTTIME = "StartTimeMilis";
- public static final String ENDTIME = "EndTimestamp";
- public static final String PARTNERNAME = "PartnerName";
-
-
-
- // Metric log specific
- public static final String METRIC_BEGIN_TIME = "MetricBeginTime";
- public static final String METRIC_START_TIME = "MetricStartTime";
- public static final String METRIC_END_TIME = "MetricEndTime";
- public static final String METRIC_TIMER = "MetricEndTime";
- public static final String TARGETENTITY = "TargetEntity";
- public static final String TARGETSERVICENAME = "TargetServiceName";
- public static final String TARGETVIRTUALENTITY = "TargetVirtualEntity";
-
- public static final String FATAL_LEVEL = "FATAL";
- public static final String ERROR_LEVEL = "ERROR";
- public static final String WARN_LEVEL = "WARN";
- public static final String INFO_LEVEL = "INFO";
- public static final String DEBUG_LEVEL = "DEBUG";
-
- public static final String ERRORCODE = "ErrorCode";
- public static final String ERRORDESC = "ErrorDesc";
-
- //Status Codes
- public static final String COMPLETE = "COMPLETE";
- public static final String INPROGRESS = "INPROGRESS";
-
- public enum Catalog {
- APIH, BPEL, RA, ASDC, GENERAL
- }
-
- public enum StatusCode {
- COMPLETE, ERROR
- }
-
- public enum TargetEntity {
- CAMUNDA("Camunda");
-
- private String name;
-
- TargetEntity(String name) {
- this.name = name;
- }
-
- public String getUrl() {
- return name;
- }
- }
-
- public enum ResponseCode {
- Suc(0), PermissionError(100), DataError(300), DataNotFound(301), BadRequest(302), SchemaError(
- 400), BusinessProcesssError(500), ServiceNotAvailable(501), InternalError(
- 502), Conflict(503), DBAccessError(504), CommunicationError(505), UnknownError(900);
-
- private int value;
-
- public int getValue() {
- return this.value;
- }
-
- private ResponseCode(int value) {
- this.value = value;
- }
- }
-
- public enum ErrorCode {
- PermissionError(100), AvailabilityError(200), DataError(300), SchemaError(400), BusinessProcesssError(
- 500), UnknownError(900);
-
- private int value;
-
- public int getValue() {
- return this.value;
- }
-
- private ErrorCode(int value) {
- this.value = value;
- }
- }
-
-
- private Logger logger;
- private Logger metricsLogger;
- private Logger auditLogger;
- private static String instanceUUID, serverIP, serverName;
- private MessageEnum exceptionArg, defaultException, defaultWarning, defaultAudit, defaultMetrics;
-
- private MsoLogger() {
- this(MsoLogger.Catalog.GENERAL);
- }
-
- private MsoLogger(MsoLogger.Catalog cat) {
- this(cat, MethodHandles.lookup().lookupClass());
- }
-
- private MsoLogger(MsoLogger.Catalog cat, Class<?> clazz) {
- this.logger = LoggerFactory.getLogger(clazz);
- this.auditLogger = LoggerFactory.getLogger("AUDIT");
- this.metricsLogger = LoggerFactory.getLogger("METRIC");
- setDefaultLogCatalog(cat);
- }
-
- public static MsoLogger getMsoLogger(MsoLogger.Catalog cat, Class<?> clazz) {
- return new MsoLogger(cat,clazz);
- }
-
-
-
- /**
- * Record the Metrics event with no argument
- *
- * @param startTime
- * Transaction starting time in millieseconds
- * @param statusCode
- * StatusCode of the transaction, either COMPLETE or ERROR
- * @param responseCode
- * The response code returned by the sub-components
- * @param responseDesc
- * Human redable description of the response code
- * @param targetEntity
- * The component which is invoked for this sub-operation
- * @param targetServiceName
- * API invoked on the TargetEntity
- * @param targetVEntity
- * Target VNF or VM acted opon by the component, if available
- */
-
- public void recordMetricEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, String responseDesc,
- String targetEntity, String targetServiceName, String targetVEntity) {
- prepareMetricMsg(startTime, statusCode, responseCode.getValue(), responseDesc, targetEntity, targetServiceName,
- targetVEntity);
- metricsLogger.info("");
- MDC.remove(TIMER);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
-
- /**
- * Record the Audit event
- *
- * @param startTime
- * Transaction starting time in millieseconds
- * @param statusCode
- * StatusCode of the transaction, either COMPLETE or ERROR
- * @param responseCode
- * The application specific response code
- * @param responseDesc
- * Human redable description of the application response code
- */
-
- public void recordAuditEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode,
- String responseDesc) {
- if (StringUtils.isEmpty(MDC.get(MsoLogger.PARTNERNAME))) {
- MDC.put(MsoLogger.PARTNERNAME, "UNKNOWN");
- }
- prepareAuditMsg(startTime, statusCode, responseCode.getValue(), responseDesc);
- auditLogger.info("");
- MDC.remove(TIMER);
- }
-
- // Debug methods
- /**
- * Record the Debug event
- *
- * @param msg
- * The log message to put
- */
- public void debug(String msg) {
- prepareMsg(DEBUG_LEVEL);
- logger.debug(msg);
- }
-
- /**
- * Record the Debug event
- *
- * @param msg
- * The log message to put
- * @param t
- * The exception to put
- */
- public void debug(String msg, Throwable t) {
- prepareMsg(DEBUG_LEVEL);
- logger.debug(msg, t);
- }
-
- public void info(String msg) {
- prepareMsg(DEBUG_LEVEL);
- logger.info(msg);
- }
-
-
- /**
- * Log error message with the details of the exception that caused the error.
- * @param msg
- * @param throwable
- */
- public void error(String msg) {
- prepareMsg(ERROR_LEVEL);
- logger.error(msg);
- }
-
- /**
- * Log error message with the details of the exception that caused the error.
- * @param msg
- * @param throwable
- */
- public void error(String msg, Throwable throwable) {
- prepareMsg(ERROR_LEVEL);
- logger.error(msg, throwable);
- }
-
- // Info methods
- /**
- * Record the Info event
- *
- * @param msg
- * The log message to put
- */
- public void info(String msg, String targetEntity, String targetServiceName) {
- prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
-
- logger.info(msg);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Info event with 1 argument
- *
- * @param msg
- * The log message to put
- * @param arg0
- * The argument used in the log message
- */
- public void info(MessageEnum msg, String arg0, String targetEntity, String targetServiceName) {
- prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
-
- logger.info(msg.toString(), normalize(arg0));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Info event with 2 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1
- * The arguments used in the log message
- */
- public void info(String msg, String arg0, String arg1, String targetEntity,
- String targetServiceName) {
- prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
-
- logger.info(msg, normalize(arg0), normalize(arg1));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Info event with 3 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2
- * The arguments used in the log message
- */
- public void info(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity,
- String targetServiceName) {
- prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
-
- logger.info(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Info event with 4 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3
- * The arguments used in the log message
- */
- public void info(String msg, String arg0, String arg1, String arg2, String arg3,
- String targetEntity, String targetServiceName) {
- prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
-
- logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Info event with 5 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3,arg4
- * The arguments used in the log message
- */
- public void info(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
- String targetEntity, String targetServiceName) {
- prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
-
- logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Info event with 6 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3,arg4,arg5
- * The arguments used in the log message
- */
- public void info(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
- String arg5, String targetEntity, String targetServiceName) {
- prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
-
- logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4),
- normalize(arg5));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- // Warning methods
-
-
- /**
- * Record the Warning event
- *
- * @param msg
- * The log message to put
- */
- public void warnSimple( String targetServiceName, String errorDesc) {
- logger.warn("Service Name: {} Error: {}" , targetServiceName, errorDesc);
- }
- /**
- * Record the Warning event
- *
- * @param msg
- * The log message to put
- */
- public void warn(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
- String errorDesc) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
-
- logger.warn(msg.toString());
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warning event
- *
- * @param msg
- * The log message to put
- * @param t
- * The exception info
- */
- public void warn(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
- String errorDesc, Throwable t) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn("Warning: "+msg, t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 1 argument
- *
- * @param msg
- * The log message to put
- * @param arg
- * The argument used in the log message
- */
- public void warn(MessageEnum msg, String arg, String targetEntity, String targetServiceName,
- ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg.toString(), arg);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 1 argument
- *
- * @param msg
- * The log message to put
- * @param arg
- * The arguments used in the log message
- * @param t
- * The exception info
- */
- public void warn(MessageEnum msg, String arg, String targetEntity, String targetServiceName,
- ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg.toString(), arg);
- logger.debug("Exception raised", t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 2 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1
- * The arguments used in the log message
- */
- public void warn(MessageEnum msg, String arg0, String arg1, String targetEntity,
- String targetServiceName, ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg.toString(), normalize(arg0), normalize(arg1));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 2 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1
- * The arguments used in the log message
- * @param t
- * The exception info
- */
- public void warn(String msg, String arg0, String arg1, String targetEntity,
- String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, normalize(arg0), normalize(arg1));
- logger.warn(msg, t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 3 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2
- * The arguments used in the log message
- */
- public void warn(String msg, String arg0, String arg1, String arg2, String targetEntity,
- String targetServiceName, ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 3 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2
- * The arguments used in the log message
- * @param t
- * The exception info
- */
- public void warn(String msg, String arg0, String arg1, String arg2, String targetEntity,
- String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
- logger.warn(msg, t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 4 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3
- * The arguments used in the log message
- */
- public void warn(String msg, String arg0, String arg1, String arg2, String arg3,
- String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 4 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,
- * arg3 The arguments used in the log message
- * @param t
- * The exception info
- */
- public void warn(String msg, String arg0, String arg1, String arg2, String arg3,
- String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
- logger.warn(msg, t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 5 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3,arg4
- * The arguments used in the log message
- */
- public void warn(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
- String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Warn event with 5 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3,arg4
- * The arguments used in the log message
- * @param t
- * The exception info
- */
- public void warn(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
- String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
- logger.warn(msg, t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
-
-
- // Error methods
- /**
- * Record the Error event
- *
- * @param generalException
- * The log message to put
- */
- public void error(MessageEnum generalException, String targetEntity, String targetServiceName, ErrorCode errorCode,
- String errorDesc) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(generalException.toString() + ": " +errorDesc);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
-
- /**
- * Record the Error event
- *
- * @param msg
- * The log message to put
- * @param t
- * The exception info
- */
- public void trace(String traceMessage) {
- logger.trace(traceMessage);
- }
-
-
- /**
- * Record the Error event
- *
- * @param msg
- * The log message to put
- * @param t
- * The exception info
- */
- public void error( Throwable t) {
- logger.error(t.getMessage(), t);
- }
-
-
- /**
- * Record the Error event
- *
- * @param msg
- * The log message to put
- * @param t
- * The exception info
- */
- public void error(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
- String errorDesc, Throwable t) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 1 argument
- *
- * @param msg
- * The log message to put
- * @param arg0
- * The arguments used in the log message
- */
- public void error(MessageEnum msg, String arg0, String targetEntity, String targetServiceName,
- ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 1 argument
- *
- * @param msg
- * The log message to put
- * @param arg0
- * The arguments used in the log message
- * @param t
- * The exception info
- */
- public void error(MessageEnum msg, String arg0, String targetEntity, String targetServiceName,
- ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0), t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 2 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1
- * The arguments used in the log message
- */
- public void error(MessageEnum msg, String arg0, String arg1, String targetEntity,
- String targetServiceName, ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0), normalize(arg1));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 2 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1
- * The arguments used in the log message
- * @param t
- * The exception info
- */
- public void error(MessageEnum msg, String arg0, String arg1, String targetEntity,
- String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0), normalize(arg1), t);
- logger.debug("Exception raised", t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 3 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2
- * The arguments used in the log message
- */
- public void error(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity,
- String targetServiceName, ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 3 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2
- * The arguments used in the log message
- * @param t
- * The exception info
- */
- public void error(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity,
- String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 4 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3
- * The arguments used in the log message
- */
- public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3,
- String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 4 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3
- * The arguments used in the log message
- * @param t
- * The exception info
- */
- public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3,
- String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), t);
-
- logger.debug("Exception raised", t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 5 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3,arg4
- * The arguments used in the log message
- */
- public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
- String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- /**
- * Record the Error event with 5 arguments
- *
- * @param msg
- * The log message to put
- * @param arg0,arg1,arg2,arg3,arg4
- * The arguments used in the log message
- * @param t
- * The exception info
- */
- public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
- String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4), t);
- logger.debug("Exception raised", t);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
-
- public void error(String errorMessage, String errorSource, String targetEntity, String targetServiceName,
- ErrorCode errorCode, String errorText) {
- prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorText);
- logger.error(errorMessage);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
-
- }
-
- private void prepareMsg(String loggingLevel) {
- prepareMsg(loggingLevel, null, null);
- }
-
- private void prepareMsg(String loggingLevel, String serviceNamep, String timer) {
- String reqId = MDC.get(REQUEST_ID);
- String svcId = MDC.get(SERVICE_INSTANCE_ID);
-
- // Based on the discussion with Adrian,
- // if these 2 parameters is not available, using dummy value "trace-#"
- if (reqId == null || reqId.isEmpty()) {
- MDC.put(REQUEST_ID, DUMMY_VALUE);
- }
-
- if (timer != null) {
- MDC.put(TIMER, timer);
- }
-
- writeIfNotNullorEmpty(SERVICE_NAME,getFinalServiceName(serviceNamep));
- writeIfNotNullorEmpty(ALERT_SEVERITY,getSeverityLevel(loggingLevel));
- writeIfNotNullorEmpty(INSTANCE_UUID,instanceUUID);
- writeIfNotNullorEmpty(SERVER_IP,serverIP);
- writeIfNotNullorEmpty(FQDN,serverName);
-
- }
-
- private void writeIfNotNullorEmpty(String Key, String value) {
- if (MDC.get(Key) == null|| MDC.get(Key).isEmpty()) {
- MDC.put(Key, value);
- }
- }
-
- private void prepareAuditMsg(long startTime, StatusCode statusCode, int responseCode, String responseDesc) {
- long endTime = System.currentTimeMillis();
- prepareMsg(INFO_LEVEL, null, String.valueOf(endTime - startTime));
- prepareAuditMetricMsg(startTime, endTime, statusCode, responseCode, responseDesc);
- }
-
- private void prepareAuditMetricMsg(long startTime, long endTime, StatusCode statusCode, int responseCode,
- String responseDesc) {
- Date startDate = new Date(startTime);
- Date endDate = new Date(endTime);
- DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
-
- MDC.put(BEGINTIME, String.valueOf(formatter.format(startDate)));
- MDC.put(ENDTIME, String.valueOf(formatter.format(endDate)));
- MDC.put(STATUSCODE, statusCode.name());
- MDC.put(RESPONSECODE, String.valueOf(responseCode));
- MDC.put(RESPONSEDESC, responseDesc);
- }
-
- private void prepareErrorMsg(String loggingLevel, String targetEntity, String targetServiceName,
- ErrorCode errorCode, String errorDesc) {
- MDC.put(ALERT_SEVERITY, getSeverityLevel(loggingLevel));
- if(errorCode != null) {
- MDC.put(ERRORCODE, Integer.toString(errorCode.getValue()));
- }
- MDC.put(ERRORDESC, errorDesc);
- MDC.put(TARGETENTITY, targetEntity);
- MDC.put(TARGETSERVICENAME, targetServiceName);
- }
-
- private void prepareMetricMsg(long startTime, StatusCode statusCode, int responseCode, String responseDesc,
- String targetEntity, String targetServiceName, String targetVEntity) {
- long endTime = System.currentTimeMillis();
- prepareMsg(INFO_LEVEL, null, String.valueOf(endTime - startTime));
- prepareAuditMetricMsg(startTime, endTime, statusCode, responseCode, responseDesc);
-
- // Populate Metric log specific parameter
- MDC.put(TARGETENTITY, targetEntity);
- MDC.put(TARGETSERVICENAME, targetServiceName);
-
- if (null != targetVEntity) {
- MDC.put(TARGETVIRTUALENTITY, targetVEntity);
- }
- }
-
- private String getSeverityLevel(String loggingLevel) {
- String severity;
- // According to the Nagios alerting: 0=OK; 1=WARNING; 2=UNKOWN;
- // 3=CRITICAL
- switch (loggingLevel) {
- case ERROR_LEVEL:
- severity = "2";
- break;
- case FATAL_LEVEL:
- severity = "3";
- break;
- case WARN_LEVEL:
- severity = "1";
- break;
- default:
- severity = "0";
- break;
- }
- return severity;
- }
-
- private String getFinalServiceName(String serviceNamep) {
- // This step to set the serviceName should be put after the className is
- // get,
- // since the default serviceName is obtained during the method to get
- // the className.
- //
- // There's 3 ways to set the serviceName. The first method has the most
- // priority to set the value.
- // a) If the serviceName is set within the log method, this value will
- // be used first
- // b) If serviceName is not set within the log method, the value defined
- // in the MDC will be used
- // c) If nothing is set specifically, then MsoLogger will assign a
- // default(MSO.<method_name>) value to it
- String serName = MDC.get(MsoLogger.SERVICE_NAME);
-
- // Check if service name was already set as the method name by a
- // previous call to this method.
- String isMethodNameStr = MDC.get(MsoLogger.SERVICE_NAME_IS_METHOD_NAME);
- boolean isMethodName = isMethodNameStr != null && isMethodNameStr.equals(Boolean.TRUE.toString());
- if (serviceNamep != null) {
- return serviceNamep;
- } else if (serName != null && !isMethodName) {
- return serName;
- }
-
- MDC.put(MsoLogger.SERVICE_NAME_IS_METHOD_NAME, Boolean.TRUE.toString());
- int limit;
- StackTraceElement[] classArr = new Exception().getStackTrace();
- if (classArr.length >= 6) {
- limit = 7;
- } else {
- limit = classArr.length;
- }
- for (int i = 1; i < limit; i++) {
- if (!classArr[i].getClassName().equals(this.getClass().getName())) {
- return classArr[i].getMethodName();
- }
- }
- return classArr[0].getMethodName();
- }
-
- /**
- * Set the requestId and serviceInstanceId
- *
- * @param reqId
- * The requestId
- * @param svcId
- * The serviceInstanceId
- */
- public static void setLogContext(String reqId, String svcId) {
- if (null != reqId) {
- MDC.put(REQUEST_ID, reqId);
- }
-
- if (null != svcId) {
- MDC.put(SERVICE_INSTANCE_ID, svcId);
- }
- }
-
- private String normalize(String input) {
- if (input == null) {
- return null;
- }
- String result = input.replace('|', '!');
- result = result.replace("\n", " - ");
- return result;
- }
-
- private void setDefaultLogCatalog(MsoLogger.Catalog cat) {
- if ("APIH".equals(cat.toString())) {
- exceptionArg = MessageEnum.APIH_GENERAL_EXCEPTION_ARG;
- defaultException = MessageEnum.APIH_GENERAL_EXCEPTION;
- defaultWarning = MessageEnum.APIH_GENERAL_WARNING;
- defaultAudit = MessageEnum.APIH_AUDIT_EXEC;
- defaultMetrics = MessageEnum.APIH_GENERAL_METRICS;
- } else if ("RA".equals(cat.toString())) {
- exceptionArg = MessageEnum.RA_GENERAL_EXCEPTION_ARG;
- defaultException = MessageEnum.RA_GENERAL_EXCEPTION;
- defaultWarning = MessageEnum.RA_GENERAL_WARNING;
- defaultAudit = MessageEnum.RA_AUDIT_EXEC;
- defaultMetrics = MessageEnum.RA_GENERAL_METRICS;
- } else if ("BPEL".equals(cat.toString())) {
- exceptionArg = MessageEnum.BPMN_GENERAL_EXCEPTION_ARG;
- defaultException = MessageEnum.BPMN_GENERAL_EXCEPTION;
- defaultWarning = MessageEnum.BPMN_GENERAL_WARNING;
- defaultAudit = MessageEnum.BPMN_AUDIT_EXEC;
- defaultMetrics = MessageEnum.BPMN_GENERAL_METRICS;
- } else if ("ASDC".equals(cat.toString())) {
- exceptionArg = MessageEnum.ASDC_GENERAL_EXCEPTION_ARG;
- defaultException = MessageEnum.ASDC_GENERAL_EXCEPTION;
- defaultWarning = MessageEnum.ASDC_GENERAL_WARNING;
- defaultAudit = MessageEnum.ASDC_AUDIT_EXEC;
- defaultMetrics = MessageEnum.ASDC_GENERAL_METRICS;
- } else {
- exceptionArg = MessageEnum.GENERAL_EXCEPTION_ARG;
- defaultException = MessageEnum.GENERAL_EXCEPTION;
- defaultWarning = MessageEnum.GENERAL_WARNING;
- defaultAudit = MessageEnum.AUDIT_EXEC;
- defaultMetrics = MessageEnum.GENERAL_METRICS;
- }
- }
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
index 29264f4e42..7f88f22b79 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
@@ -39,7 +39,6 @@ import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.WriterInterceptor;
import javax.ws.rs.ext.WriterInterceptorContext;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -156,4 +155,4 @@ public class PayloadLoggingFilter implements ClientRequestFilter, ClientResponse
return method;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
index cecef1945b..ed63a706a2 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
@@ -57,6 +57,7 @@ public class SpringClientFilter implements ClientHttpRequestInterceptor {
}
private void processRequest(HttpRequest request, byte[] body) throws IOException {
+ setInvocationId();
setupHeaders(request);
setupMDC(request);
if (log.isDebugEnabled()) {
@@ -89,7 +90,6 @@ public class SpringClientFilter implements ClientHttpRequestInterceptor {
MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getURI().toString());
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- setInvocationId();
MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY,extractTargetEntity(clientRequest));
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/InvalidRestRequestException.java b/common/src/main/java/org/onap/so/rest/exceptions/InvalidRestRequestException.java
index 4d3c489fa9..2a9799315e 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/InvalidRestRequestException.java
+++ b/common/src/main/java/org/onap/so/rest/exceptions/InvalidRestRequestException.java
@@ -1,26 +1,27 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.monitoring.exception;
+
+package org.onap.so.rest.exceptions;
/**
- * @author waqas.ikram@ericsson.com
+ * @author waqas.ikram@est.tech
*
*/
public class InvalidRestRequestException extends RuntimeException {
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/RestProcessingException.java b/common/src/main/java/org/onap/so/rest/exceptions/RestProcessingException.java
index ab25854542..e8ce00c7e5 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/exception/RestProcessingException.java
+++ b/common/src/main/java/org/onap/so/rest/exceptions/RestProcessingException.java
@@ -1,26 +1,26 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.monitoring.exception;
+package org.onap.so.rest.exceptions;
/**
- * @author waqas.ikram@ericsson.com
+ * @author waqas.ikram@est.tech
*
*/
public class RestProcessingException extends RuntimeException {
diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
new file mode 100644
index 0000000000..43b2fb4292
--- /dev/null
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
@@ -0,0 +1,72 @@
+/*-
+ * ============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.rest.service;
+
+import org.springframework.http.ResponseEntity;
+
+import com.google.common.base.Optional;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public interface HttpRestServiceProvider {
+
+ /**
+ * Execute the HTTP GET to the given URI template
+ *
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the body of this entity.
+ */
+ public <T> Optional<T> get(final String url, final Class<T> clazz);
+
+ /**
+ * Execute the HTTP GET to the given URI template
+ *
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the {@link ResponseEntity}.
+ */
+ public <T> ResponseEntity<T> getHttpResponse(final String url, final Class<T> clazz);
+
+
+ /**
+ * Execute the HTTP POST to the given URI template
+ *
+ * @param object the entity (i.e. body) to write to the request
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the body of this entity.
+ */
+ public <T> Optional<T> post(final Object object, final String url, final Class<T> clazz);
+
+ /**
+ * Execute the HTTP POST to the given URI template
+ *
+ * @param object the entity (i.e. body) to write to the request
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @return Returns the {@link ResponseEntity}.
+ */
+ public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz);
+
+
+}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProviderImpl.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
index 82a54c10a2..032df84a98 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/HttpRestServiceProviderImpl.java
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
@@ -1,27 +1,33 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.monitoring.rest.service;
-import org.onap.so.monitoring.exception.InvalidRestRequestException;
-import org.onap.so.monitoring.exception.RestProcessingException;
+package org.onap.so.rest.service;
+
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -31,39 +37,54 @@ import org.springframework.web.client.RestTemplate;
import com.google.common.base.Optional;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
- * @author waqas.ikram@ericsson.com
+ * A Service to perform HTTP requests
+ *
+ * @author waqas.ikram@est.tech
*/
public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpRestServiceProviderImpl.class);
private final RestTemplate restTemplate;
+ private final HttpHeadersProvider httpHeadersProvider;
public HttpRestServiceProviderImpl(final RestTemplate restTemplate) {
this.restTemplate = restTemplate;
+ this.httpHeadersProvider = new BasicHttpHeadersProvider();
+ }
+
+ public HttpRestServiceProviderImpl(final RestTemplate restTemplate, final HttpHeadersProvider httpHeadersProvider) {
+ this.restTemplate = restTemplate;
+ this.httpHeadersProvider = httpHeadersProvider;
+ }
+
+ @Override
+ public <T> Optional<T> get(final String url, final Class<T> clazz) {
+ final ResponseEntity<T> response = getHttpResponse(url, clazz);
+ if (!response.getStatusCode().equals(HttpStatus.OK)) {
+ final String message =
+ "Unable to invoke HTTP GET using URL: " + url + ", Response Code: " + response.getStatusCode();
+ LOGGER.error(message);
+ return Optional.absent();
+ }
+
+ if (response.hasBody()) {
+ return Optional.of(response.getBody());
+ }
+ return Optional.absent();
}
+
@Override
- public <T> Optional<T> getHttpResponse(final String url, final Class<T> clazz) {
- LOGGER.trace("Will invoke HTTP GET using URL: " + url);
+ public <T> ResponseEntity<T> getHttpResponse(final String url, final Class<T> clazz) {
+ LOGGER.trace("Will invoke HTTP GET using URL: {}", url);
try {
- final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.GET, null, clazz);
- if (!response.getStatusCode().equals(HttpStatus.OK)) {
- final String message = "Unable to invoke HTTP GET using URL: " + url +
- ", Response Code: " + response.getStatusCode();
- LOGGER.error(message);
- return Optional.absent();
- }
+ final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders());
+ return restTemplate.exchange(url, HttpMethod.GET, request, clazz);
- if (response.hasBody()) {
- return Optional.of(response.getBody());
- }
} catch (final HttpClientErrorException httpClientErrorException) {
- final String message = "Unable to invoke HTTP GET using url: " + url + ", Response: " +
- httpClientErrorException.getRawStatusCode();
+ final String message = "Unable to invoke HTTP GET using url: " + url + ", Response: "
+ + httpClientErrorException.getRawStatusCode();
LOGGER.error(message, httpClientErrorException);
final int rawStatusCode = httpClientErrorException.getRawStatusCode();
if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) {
@@ -72,48 +93,52 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url);
} catch (final RestClientException restClientException) {
- LOGGER.error("Unable to invoke HTTP GET using url: " + url, restClientException);
- throw new RestProcessingException("Unable to invoke HTTP GET using URL: " +
- url, restClientException);
+ LOGGER.error("Unable to invoke HTTP GET using url: {}", url, restClientException);
+ throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url, restClientException);
+ }
+ }
+
+ @Override
+ public <T> Optional<T> post(final Object object, final String url, final Class<T> clazz) {
+ final ResponseEntity<T> response = postHttpRequest(object, url, clazz);
+ if (!response.getStatusCode().equals(HttpStatus.OK)) {
+ final String message =
+ "Unable to invoke HTTP GET using URL: " + url + ", Response Code: " + response.getStatusCode();
+ LOGGER.error(message);
+ return Optional.absent();
+ }
+
+ if (response.hasBody()) {
+ return Optional.of(response.getBody());
}
return Optional.absent();
}
+
@Override
- public <T> Optional<T> postHttpRequest(final Object object, final String url, final Class<T> clazz) {
+ public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz) {
try {
- final HttpEntity<?> request = new HttpEntity<>(object);
- final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.POST, request, clazz);
- if (!response.getStatusCode().equals(HttpStatus.OK)) {
- final String message = "Unable to invoke HTTP GET using URL: " + url +
- ", Response Code: " + response.getStatusCode();
- LOGGER.error(message);
- return Optional.absent();
- }
-
- if (response.hasBody()) {
- return Optional.of(response.getBody());
- }
+ final HttpEntity<?> request = new HttpEntity<>(object, getHttpHeaders());
+ return restTemplate.exchange(url, HttpMethod.POST, request, clazz);
} catch (final HttpClientErrorException httpClientErrorException) {
- final String message = "Unable to invoke HTTP POST using url: " + url +
- ", Response: " + httpClientErrorException.getRawStatusCode();
+ final String message = "Unable to invoke HTTP POST using url: " + url + ", Response: "
+ + httpClientErrorException.getRawStatusCode();
LOGGER.error(message, httpClientErrorException);
final int rawStatusCode = httpClientErrorException.getRawStatusCode();
if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) {
throw new InvalidRestRequestException("No result found for given url: " + url);
}
- throw new RestProcessingException("Unable to invoke HTTP POST using URL: " + url);
+ throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url);
} catch (final RestClientException restClientException) {
- LOGGER.error("Unable to invoke HTTP POST using url: " + url, restClientException);
- throw new RestProcessingException("Unable to invoke HTTP POST using URL: "
- + url, restClientException);
+ LOGGER.error("Unable to invoke HTTP POST using url: {}", url, restClientException);
+ throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url, restClientException);
}
-
- return Optional.absent();
}
-
+ private HttpHeaders getHttpHeaders() {
+ return httpHeadersProvider.getHttpHeaders();
+ }
}
diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
index a1097780c0..7d272e39c7 100644
--- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java
+++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
@@ -23,8 +23,8 @@
package org.onap.so.utils;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -92,7 +92,7 @@ public final class CryptoUtils {
return CryptoUtils.encrypt(message, CLOUD_KEY);
} catch (GeneralSecurityException e) {
logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
return null;
}
}
@@ -101,7 +101,7 @@ public final class CryptoUtils {
return CryptoUtils.decrypt(message, CLOUD_KEY);
} catch (GeneralSecurityException e) {
logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
return null;
}
}
diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
index 864266bf40..4aeecf88d8 100644
--- a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
+++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
@@ -35,8 +35,8 @@ import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;
import org.onap.so.exceptions.MarshallerException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
@@ -55,8 +55,8 @@ public class XmlMarshaller {
jaxbMarshaller.marshal(object, stringWriter);
} catch (JAXBException e) {
logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(),
- MsoLogger.ErrorCode.SchemaError.getValue(), e.getMessage(), e);
- throw new MarshallerException(e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ ErrorCode.SchemaError.getValue(), e.getMessage(), e);
+ throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e);
}
return stringWriter.toString();
@@ -80,8 +80,8 @@ public class XmlMarshaller {
object = jaxbUnmarshaller.unmarshal(source, object.getClass()).getValue();
} catch (Exception e) {
logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(),
- MsoLogger.ErrorCode.SchemaError.getValue(), e.getMessage(), e);
- throw new MarshallerException(e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ ErrorCode.SchemaError.getValue(), e.getMessage(), e);
+ throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e);
}
return object;
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 f32633122d..85d690feaf 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
@@ -49,11 +49,25 @@ public class AAIValidatorTest {
validator.setClient(client);
}
- public List<Pserver> getPservers(boolean locked){
- Pserver pserver = new Pserver();
- pserver.setInMaint(locked);
+ public List<Pserver> getPserversLocked(){
+ Pserver pserver1 = new Pserver();
+ pserver1.setInMaint(true);
+ Pserver pserver2 = new Pserver();
+ pserver2.setInMaint(false);
List<Pserver> pservers = new ArrayList<Pserver>();
- pservers.add(pserver);
+ pservers.add(pserver1);
+ pservers.add(pserver2);
+ return pservers;
+ }
+
+ public List<Pserver> getPserversNotLocked(){
+ Pserver pserver1 = new Pserver();
+ pserver1.setInMaint(false);
+ Pserver pserver2 = new Pserver();
+ pserver2.setInMaint(false);
+ List<Pserver> pservers = new ArrayList<Pserver>();
+ pservers.add(pserver1);
+ pservers.add(pserver2);
return pservers;
}
@@ -64,15 +78,15 @@ public class AAIValidatorTest {
}
@Test
- public void test_IsPhysicalServerLocked_True() throws IOException{
- when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPservers(true));
+ public void test_IsPhysicalServerLocked_True() throws IOException{
+ when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversLocked());
boolean locked = validator.isPhysicalServerLocked(vnfName);
assertEquals(true, locked);
}
@Test
public void test_IsPhysicalServerLocked_False() throws IOException {
- when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPservers(false));
+ when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversNotLocked());
boolean locked = validator.isPhysicalServerLocked(vnfName);
assertEquals(false, locked);
}
diff --git a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
index 135277fa47..f6bf21458d 100644
--- a/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
+++ b/common/src/test/java/org/onap/so/client/cds/CDSProcessingClientTest.java
@@ -42,10 +42,10 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mock;
-import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
@RunWith(JUnit4.class)
public class CDSProcessingClientTest {
diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java b/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java
index 977f1d41be..ce515e162e 100644
--- a/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java
+++ b/common/src/test/java/org/onap/so/client/cds/TestCDSProcessingListener.java
@@ -21,7 +21,7 @@
package org.onap.so.client.cds;
import io.grpc.Status;
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
index 514c595100..636f92835f 100644
--- a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
+++ b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
@@ -1,26 +1,20 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 Bell Canada.
- * ================================================================================
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
-
package org.onap.so.client.cds;
-import java.net.MalformedURLException;
import java.net.URL;
public class TestCDSPropertiesImpl implements CDSProperties {
@@ -68,4 +62,9 @@ public class TestCDSPropertiesImpl implements CDSProperties {
public boolean mapNotFoundToEmpty() {
return false;
}
+
+ @Override
+ public int getTimeout() {
+ return 60;
+ }
}
diff --git a/common/src/test/java/org/onap/so/configuration/rest/BasicHttpHeadersProviderTest.java b/common/src/test/java/org/onap/so/configuration/rest/BasicHttpHeadersProviderTest.java
new file mode 100644
index 0000000000..3e762cfbe7
--- /dev/null
+++ b/common/src/test/java/org/onap/so/configuration/rest/BasicHttpHeadersProviderTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============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.configuration.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.onap.so.configuration.rest.BasicHttpHeadersProvider.AUTHORIZATION_HEADER;
+
+import java.util.Arrays;
+
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+public class BasicHttpHeadersProviderTest {
+
+ private static final String BASIC_AUTH_VALUE = "Basic AuthValue";
+
+ @Test
+ public void test_getHttpHeaders_ContentTypeIsJson() {
+ final HttpHeadersProvider objUnderTest = new BasicHttpHeadersProvider();
+ final HttpHeaders actualHttpHeaders = objUnderTest.getHttpHeaders();
+ assertNull(actualHttpHeaders.get(AUTHORIZATION_HEADER));
+ assertEquals(MediaType.APPLICATION_JSON, actualHttpHeaders.getContentType());
+ }
+
+ @Test
+ public void test_getHttpHeaders_ContainAuthorizationHeader() {
+ final HttpHeadersProvider objUnderTest = new BasicHttpHeadersProvider(BASIC_AUTH_VALUE);
+ final HttpHeaders actualHttpHeaders = objUnderTest.getHttpHeaders();
+ assertEquals(Arrays.asList(BASIC_AUTH_VALUE), actualHttpHeaders.get(AUTHORIZATION_HEADER));
+ assertEquals(MediaType.APPLICATION_JSON, actualHttpHeaders.getContentType());
+ }
+
+}
diff --git a/common/src/test/java/org/onap/so/configuration/rest/HttpComponentsClientConfigurationTest.java b/common/src/test/java/org/onap/so/configuration/rest/HttpComponentsClientConfigurationTest.java
new file mode 100644
index 0000000000..5084acc934
--- /dev/null
+++ b/common/src/test/java/org/onap/so/configuration/rest/HttpComponentsClientConfigurationTest.java
@@ -0,0 +1,45 @@
+/*-
+ * ============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.configuration.rest;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+public class HttpComponentsClientConfigurationTest {
+
+ @Test
+ public void test_httpComponentsClientHttpRequestFactory_HttpComponentsClientHttpRequestFactoryNotNull() {
+ final HttpClientConnectionConfiguration clientConnectionConfiguration = new HttpClientConnectionConfiguration();
+ final HttpComponentsClientConfiguration objUnderTest =
+ new HttpComponentsClientConfiguration(clientConnectionConfiguration);
+
+ final HttpComponentsClientHttpRequestFactory factory = objUnderTest.httpComponentsClientHttpRequestFactory();
+ assertNotNull(factory);
+ assertNotNull(factory.getHttpClient());
+
+ }
+
+}
diff --git a/common/src/test/java/org/onap/so/rest/service/HttpRestServiceProviderImplTest.java b/common/src/test/java/org/onap/so/rest/service/HttpRestServiceProviderImplTest.java
new file mode 100644
index 0000000000..a738afe565
--- /dev/null
+++ b/common/src/test/java/org/onap/so/rest/service/HttpRestServiceProviderImplTest.java
@@ -0,0 +1,252 @@
+/*-
+ * ============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.rest.service;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestTemplate;
+
+import com.google.common.base.Optional;
+
+
+/**
+ * @author waqas.ikram@est.tech
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class HttpRestServiceProviderImplTest {
+
+ private static final String BODY = "{}";
+ private static final String DUMMY_URL = "http://localhost:9000/dummy/url";
+
+ @Mock
+ private RestTemplate mockRestTemplate;
+
+ @Mock
+ private ResponseEntity<String> mockEntity;
+
+ @Test
+ public void test_get_returnOptionalPresentIfResponseIsOKAndHasBody() {
+
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockEntity.hasBody()).thenReturn(true);
+ when(mockEntity.getBody()).thenReturn(BODY);
+
+ final Optional<String> actual = objUnderTest.get(DUMMY_URL, String.class);
+
+ assertTrue(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test
+ public void test_get_returnOptionalPresentIfResponseIsNotOK() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.INTERNAL_SERVER_ERROR);
+
+ final Optional<String> actual = objUnderTest.get(DUMMY_URL, String.class);
+
+ assertFalse(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test
+ public void test_get_returnOptionalPresentIfResponseIsOKAndNoBody() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockEntity.hasBody()).thenReturn(false);
+
+ final Optional<String> actual = objUnderTest.get(DUMMY_URL, String.class);
+
+ assertFalse(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test(expected = InvalidRestRequestException.class)
+ public void test_get_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionWithHttpStatusBadRequest() {
+ assertGetErrorScenario(HttpStatus.BAD_REQUEST);
+
+ }
+
+ @Test(expected = InvalidRestRequestException.class)
+ public void test_get_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionWithHttpStatusNotFoundHttpStatus() {
+ assertGetErrorScenario(HttpStatus.NOT_FOUND);
+ }
+
+ @Test(expected = RestProcessingException.class)
+ public void test_get_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionOccured() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(HttpClientErrorException.class);
+
+ objUnderTest.get(DUMMY_URL, String.class);
+ }
+
+ @Test(expected = RestProcessingException.class)
+ public void test_get_ThrowsInvalidRestRequestExceptionifRestProcessingExceptionOccured() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(RestClientException.class);
+
+ objUnderTest.get(DUMMY_URL, String.class);
+ }
+
+ @Test
+ public void test_post_returnOptionalPresentIfResponseIsOKAndHasBody() {
+
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockEntity.hasBody()).thenReturn(true);
+ when(mockEntity.getBody()).thenReturn(BODY);
+
+ final Optional<String> actual = objUnderTest.post(BODY, DUMMY_URL, String.class);
+
+ assertTrue(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test
+ public void test_post_returnOptionalPresentIfResponseIsOKAndHasNoBody() {
+
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.OK);
+ when(mockEntity.hasBody()).thenReturn(false);
+
+ final Optional<String> actual = objUnderTest.post(BODY, DUMMY_URL, String.class);
+
+ assertFalse(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+
+ @Test
+ public void test_post_returnOptionalPresentIfResponseIsNotOKAndHasBody() {
+
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenReturn(mockEntity);
+
+ when(mockEntity.getStatusCode()).thenReturn(HttpStatus.PARTIAL_CONTENT);
+
+ final Optional<String> actual = objUnderTest.post(BODY, DUMMY_URL, String.class);
+
+ assertFalse(actual.isPresent());
+ verify(mockRestTemplate, atLeastOnce()).exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class),
+ eq(String.class));
+ }
+
+ @Test(expected = InvalidRestRequestException.class)
+ public void test_post_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionWithHttpStatusBadRequest() {
+ assertPostErrorScenario(HttpStatus.BAD_REQUEST);
+
+ }
+
+ @Test(expected = InvalidRestRequestException.class)
+ public void test_post_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionWithHttpStatusNotFoundHttpStatus() {
+ assertPostErrorScenario(HttpStatus.NOT_FOUND);
+ }
+
+ @Test(expected = RestProcessingException.class)
+ public void test_post_ThrowsInvalidRestRequestExceptionifHttpClientErrorExceptionOccured() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(HttpClientErrorException.class);
+
+ objUnderTest.post(BODY, DUMMY_URL, String.class);
+ }
+
+ @Test(expected = RestProcessingException.class)
+ public void test_post_ThrowsInvalidRestRequestExceptionifRestProcessingExceptionOccured() {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(RestClientException.class);
+
+ objUnderTest.post(BODY, DUMMY_URL, String.class);
+ }
+
+ private void assertPostErrorScenario(final HttpStatus status) {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ final HttpClientErrorException errorException = new HttpClientErrorException(status);
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.POST), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(errorException);
+
+ objUnderTest.post(BODY, DUMMY_URL, String.class);
+ }
+
+ private void assertGetErrorScenario(final HttpStatus status) {
+ final HttpRestServiceProvider objUnderTest = new HttpRestServiceProviderImpl(mockRestTemplate);
+
+ final HttpClientErrorException errorException = new HttpClientErrorException(status);
+ when(mockRestTemplate.exchange(eq(DUMMY_URL), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)))
+ .thenThrow(errorException);
+
+ objUnderTest.get(DUMMY_URL, String.class);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
index d3e8323f37..9b77c1469b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
@@ -40,8 +40,8 @@ import org.onap.so.apihandler.camundabeans.CamundaInput;
import org.onap.so.apihandler.camundabeans.CamundaIntegerInput;
import org.onap.so.apihandler.camundabeans.CamundaRequest;
import org.onap.so.apihandler.camundabeans.CamundaVIDRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -195,7 +195,7 @@ public class CamundaClient extends RequestClient{
logger.trace("request body is {}", jsonReq);
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
@@ -288,7 +288,7 @@ public class CamundaClient extends RequestClient{
logger.trace("request body is {}", jsonReq);
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
index 3d09a30731..6b43e96b08 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
@@ -35,8 +35,8 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
@@ -78,7 +78,7 @@ public class ResponseHandler {
HttpEntity entity = httpResponse.getEntity();
responseBody = EntityUtils.toString(entity);
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("IOException getting Camunda response body", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
@@ -90,7 +90,7 @@ public class ResponseHandler {
try {
response = mapper.readValue(responseBody, CamundaResponse.class);
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
@@ -100,7 +100,7 @@ public class ResponseHandler {
if(response!=null){
responseBody = response.getResponse();
}else{
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError)
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError)
.targetEntity("Camunda").targetServiceName("parseCamunda").build();
BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
.errorInfo(errorLoggerInfo).build();
@@ -117,13 +117,13 @@ public class ResponseHandler {
}
}catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Could not convert BPEL response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
throw validateException;
}
if(status!=HttpStatus.SC_ACCEPTED){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError)
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError)
.targetEntity("BPEL").targetServiceName("parseBpel").build();
@@ -144,7 +144,7 @@ public class ResponseHandler {
responseBody = EntityUtils.toString(camundataskEntity);
}
}catch(IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Could not convert CamundaTask response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
@@ -152,7 +152,7 @@ public class ResponseHandler {
throw validateException;
}
if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError)
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError)
.targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask").build();
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
index da13ff509b..c3dfe2c685 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
@@ -34,9 +34,9 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.apache.commons.io.IOUtils;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
@@ -98,7 +98,7 @@ public class XMLValidator {
} catch (Exception e) {
logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(),
- MsoLogger.ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e);
+ ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e);
return "ErrorDetails: " + "Unable to read the schema file";
}
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 282ca12e2b..4c069d5b1a 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
@@ -40,9 +40,9 @@ import javax.xml.bind.Marshaller;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
@@ -137,7 +137,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
} catch (JsonProcessingException | JAXBException e) {
String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage();
logger.error("{} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), "BuildServiceErrorResponse",
- MsoLogger.ErrorCode.DataError.getValue(), errorMsg, e);
+ ErrorCode.DataError.getValue(), errorMsg, e);
return errorMsg;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
index b0b154bc5c..058d80868c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
@@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.logging;
import java.io.Serializable;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger.ErrorCode;
+import org.onap.so.logger.ErrorCode;
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
index 0958905720..edab3b07b6 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -189,5 +190,22 @@ public class CamundaClientTest{
}
+ @Test
+ public void testPostWithRequestClientParameter() throws Exception {
+ CamundaClient testClient = new CamundaClient();
+ String orchestrationURI = "/engine-rest/process-definition/key/dummy/start";
+ HttpResponse mockResponse = createResponse(200, "{}");
+ mockHttpClient = Mockito.mock(HttpClient.class);
+ Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))).thenReturn(mockResponse);
+
+ testClient.setClient(mockHttpClient);
+ testClient.setUrl(orchestrationURI);
+
+ HttpResponse response = testClient.post(new RequestClientParameter.Builder().build());
+
+ assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
index 1be521952a..42190a4a1e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
@@ -28,10 +28,9 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.*;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
@@ -89,7 +88,7 @@ public class ApiExceptionTest {
@Test
public void testDuplicateRequestException() throws ApiException {
- ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
thrown.expect(DuplicateRequestException.class);
thrown.expectMessage(startsWith("Error: Locked instance"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));
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 84cac6ce5c..de38bc717a 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
@@ -62,9 +62,9 @@ import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -235,7 +235,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString());
return response;
@@ -282,7 +282,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine",e);
+ ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine",e);
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
return resp;
}
@@ -291,7 +291,7 @@ public class E2EServiceInstances {
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
"bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
return resp;
}
@@ -318,7 +318,7 @@ public class E2EServiceInstances {
operationId);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(),
+ ErrorCode.AvailabilityError.getValue(),
"Exception while communciate with Request DB - Infra Request Lookup", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
@@ -335,7 +335,7 @@ public class E2EServiceInstances {
"E2E serviceId " + serviceId + " is not found in DB",
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Null response from RequestDB when searching by serviceId");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -368,7 +368,7 @@ public class E2EServiceInstances {
+ e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -380,7 +380,7 @@ public class E2EServiceInstances {
recipeLookupResult = getServiceInstanceOrchestrationURI(null, action);
} catch (Exception e) {
logger.error(MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
@@ -395,7 +395,7 @@ public class E2EServiceInstances {
}
if (recipeLookupResult == null) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
+ ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
"Recipe does not exist in catalog DB",
@@ -441,7 +441,7 @@ public class E2EServiceInstances {
"Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
logger.debug("End of the transaction, the final response is: " + resp.getEntity());
return resp;
}
@@ -452,7 +452,7 @@ public class E2EServiceInstances {
"bpelResponse is null",
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -484,7 +484,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -502,7 +502,7 @@ public class E2EServiceInstances {
logger.debug("Logging failed message to the database");
}
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -512,7 +512,7 @@ public class E2EServiceInstances {
recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
@@ -524,7 +524,7 @@ public class E2EServiceInstances {
if (recipeLookupResult == null) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
+ ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
@@ -565,7 +565,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
return getBPMNResp;
@@ -575,7 +575,7 @@ public class E2EServiceInstances {
Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
return getBPMNResp;
}
@@ -606,7 +606,7 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -624,7 +624,7 @@ public class E2EServiceInstances {
logger.debug("Logging failed message to the database");
}
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -634,7 +634,7 @@ public class E2EServiceInstances {
recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
@@ -644,7 +644,7 @@ public class E2EServiceInstances {
if (recipeLookupResult == null) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
+ ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
@@ -684,7 +684,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -693,7 +693,7 @@ public class E2EServiceInstances {
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -727,7 +727,7 @@ public class E2EServiceInstances {
+ e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e);
+ ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -738,7 +738,7 @@ public class E2EServiceInstances {
recipeLookupResult = getServiceInstanceOrchestrationURI(null, action);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
@@ -751,7 +751,7 @@ public class E2EServiceInstances {
}
if (recipeLookupResult == null) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB");
+ ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(
HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
@@ -797,7 +797,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e);
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e);
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -808,7 +808,7 @@ public class E2EServiceInstances {
"bpelResponse is null",
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -846,7 +846,7 @@ public class E2EServiceInstances {
+ '\n' + camundaJSONResponseBody,
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version);
logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -859,7 +859,7 @@ public class E2EServiceInstances {
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
variables, version);
logger.error("", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(),
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ ErrorCode.BusinessProcesssError.getValue(),
"Response from BPEL engine is empty");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -1023,7 +1023,7 @@ public class E2EServiceInstances {
try {
msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte);
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
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 07c98c19b9..ad20c5c527 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
@@ -45,7 +45,6 @@ import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
@@ -116,7 +115,6 @@ public class GlobalHealthcheckHandler {
try{
// Generated RequestId
String requestId = requestContext.getProperty("requestId").toString();
- MsoLogger.setLogContext(requestId, null);
logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
// set APIH status, this is the main entry point
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 d686e80352..ad589ddc9c 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
@@ -54,9 +54,9 @@ import org.onap.so.apihandlerinfra.tasksbeans.Value;
import org.onap.so.apihandlerinfra.tasksbeans.Variables;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -97,8 +97,7 @@ public class ManualTasks {
@Context ContainerRequestContext requestContext) throws ApiException {
String requestId = requestContext.getProperty("requestId").toString();
- MsoLogger.setLogContext(requestId, null);
- logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
+ logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
long startTime = System.currentTimeMillis ();
logger.debug ("requestId is: {}", requestId);
TasksRequest taskRequest = null;
@@ -122,7 +121,7 @@ public class ManualTasks {
}
}catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed: " + e.getMessage(),
@@ -131,7 +130,7 @@ public class ManualTasks {
throw validateException;
}
catch(ValidationException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON Object failed. " + e.getMessage(),
@@ -161,7 +160,7 @@ public class ManualTasks {
camundaJsonReq = mapper.writeValueAsString(variablesForComplete);
} catch(JsonProcessingException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.UnknownError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.UnknownError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Mapping of JSON object to Camunda request failed",
@@ -181,7 +180,7 @@ public class ManualTasks {
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -192,7 +191,7 @@ public class ManualTasks {
}
if (response == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
@@ -218,7 +217,7 @@ public class ManualTasks {
}
catch (JsonProcessingException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Request Failed due to bad response format" ,
@@ -230,7 +229,7 @@ public class ManualTasks {
logger.debug ("End of the transaction, the final response is: {}", completeResp);
return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, completeResp, apiVersion);
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).build();
BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index 886e0d5133..de7d26379c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -69,9 +69,9 @@ import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.LogConstants;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.InstanceDirection;
import org.onap.so.serviceinstancebeans.ModelInfo;
@@ -153,7 +153,7 @@ public class MsoRequest {
mapper.setSerializationInclusion(Include.NON_DEFAULT);
requestErrorStr = mapper.writeValueAsString(re);
}catch(Exception e){
- logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), ErrorCode.DataError.getValue(),
"Exception in buildServiceErrorResponse writing exceptionType to string ", e);
}
@@ -384,7 +384,7 @@ public class MsoRequest {
aq.setRequestStatus (status.toString ());
aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), ErrorCode.DataError.getValue(),
"Exception when creation record request", e);
if (!status.equals (Status.FAILED)) {
@@ -424,7 +424,7 @@ public class MsoRequest {
aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER);
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), ErrorCode.DataError.getValue(),
"Exception when creation record request", e);
if (!status.equals (Status.FAILED)) {
@@ -452,7 +452,7 @@ public class MsoRequest {
requestsDbClient.save(request);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(),
- MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB");
+ ErrorCode.DataError.getValue(), "Exception when updating record in DB");
logger.debug("Exception: ", e);
}
}
@@ -536,7 +536,7 @@ public class MsoRequest {
return null;
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), MsoLogger.ErrorCode.DataError.getValue(),
+ logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), ErrorCode.DataError.getValue(),
"Exception in domToStr", e);
}
return null;
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 d74a4de451..f613d3e193 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
@@ -54,9 +54,9 @@ import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
import org.onap.so.serviceinstancebeans.InstanceReferences;
@@ -111,7 +111,7 @@ public class OrchestrationRequests {
} catch (Exception e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
@@ -126,7 +126,7 @@ public class OrchestrationRequests {
if(infraActiveRequest == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB",
@@ -169,7 +169,7 @@ public class OrchestrationRequests {
}
}catch(ValidationException ex){
logger.error("Exception occurred", ex);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder(ex.getMessage(),
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
throw validateException;
@@ -217,7 +217,7 @@ public class OrchestrationRequests {
sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
} catch(IOException e){
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
@@ -228,7 +228,7 @@ public class OrchestrationRequests {
msoRequest.parseOrchestration(sir);
} catch (Exception e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
throw validateException;
@@ -236,7 +236,7 @@ public class OrchestrationRequests {
infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
if(infraActiveRequest == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Null response from RequestDB when searching by RequestId",
@@ -253,7 +253,7 @@ public class OrchestrationRequests {
requestsDbClient.save(infraActiveRequest);
}else{
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
@@ -324,7 +324,7 @@ public class OrchestrationRequests {
}
} catch (IOException e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : ",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
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 ec1c4cb362..8c5904fb21 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
@@ -66,9 +66,9 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.LogConstants;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -125,6 +125,8 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+
@Component
@Path("/onap/so/infra/serviceInstantiation")
@Api(value="/onap/so/infra/serviceInstantiation",description="Infrastructure API Requests for Service Instances")
@@ -703,8 +705,8 @@ public class ServiceInstances {
if(!headers.containsKey(ONAPLogConstants.Headers.PARTNER_NAME)){
throw new ValidationException(ONAPLogConstants.Headers.PARTNER_NAME + " header", true);
}
- if(!headers.containsKey(MsoLogger.REQUESTOR_ID)){
- throw new ValidationException(MsoLogger.REQUESTOR_ID + " header", true);
+ if(!headers.containsKey(REQUESTOR_ID)){
+ throw new ValidationException(REQUESTOR_ID + " header", true);
}
}
@@ -799,7 +801,7 @@ public class ServiceInstances {
}
String errorMessage = "VnfType " + vnfType + " and VF Module Model Name " + modelInfo.getModelName() + serviceVersionText + " not found in MSO Catalog DB";
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
VfModuleNotFoundException vfModuleException = new VfModuleNotFoundException.Builder(errorMessage, HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, vfModuleException.getMessage());
@@ -840,7 +842,7 @@ public class ServiceInstances {
try{
infraActiveRequestsClient.save(currentActiveReq);
}catch(Exception e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
}
@@ -874,7 +876,7 @@ public class ServiceInstances {
.setRequestUri(requestUri)
.setInstanceGroupId(instanceGroupId).build();
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER)
.errorInfo(errorLoggerInfo).build();
}
@@ -895,7 +897,7 @@ public class ServiceInstances {
validateHeaders(requestContext);
} catch (ValidationException e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_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();
updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
@@ -927,7 +929,7 @@ public class ServiceInstances {
try{
infraActiveRequestsClient.save(currentActiveReq);
}catch(Exception e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
}
@@ -993,7 +995,7 @@ public class ServiceInstances {
response = requestClient.post(requestClientParameter);
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
String url = requestClient != null ? requestClient.getUrl() : "";
ClientConnectionException clientException = new ClientConnectionException.Builder(url, HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
@@ -1003,7 +1005,7 @@ public class ServiceInstances {
if (response == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ClientConnectionException clientException = new ClientConnectionException.Builder(requestClient.getUrl(), HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
@@ -1018,7 +1020,7 @@ public class ServiceInstances {
bpelStatus = respHandler.getStatus ();
} catch (ApiException e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
@@ -1043,7 +1045,7 @@ public class ServiceInstances {
}
} catch (IOException e) {
logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Exception caught mapping Camunda JSON response to object", HttpStatus.SC_NOT_ACCEPTABLE, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
@@ -1058,7 +1060,7 @@ public class ServiceInstances {
String camundaJSONResponseBody = respHandler.getResponseBody ();
if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
BPMNFailureException bpmnException = new BPMNFailureException.Builder(String.valueOf(bpelStatus) + camundaJSONResponseBody, bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
.errorInfo(errorLoggerInfo).build();
@@ -1067,7 +1069,7 @@ public class ServiceInstances {
throw bpmnException;
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError).errorSource(requestClient.getUrl()).build();
BPMNFailureException servException = new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
@@ -1153,7 +1155,7 @@ public class ServiceInstances {
}
//List<String> variables = new ArrayList<String>();
//variables.add(dup.getRequestStatus());
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
DuplicateRequestException dupException = new DuplicateRequestException.Builder(requestScope,instance,dup.getRequestStatus(),dup.getRequestId(), HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
@@ -1172,7 +1174,7 @@ public class ServiceInstances {
dup = infraActiveRequestsClient.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
}
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
RequestDbFailureException requestDbFailureException = new RequestDbFailureException.Builder("check for duplicate instance", e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, requestDbFailureException.getMessage());
@@ -1190,7 +1192,7 @@ public class ServiceInstances {
try{
response = restTemplate.exchange(targetUrl, HttpMethod.GET, requestEntity, new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>(){});
}catch(HttpStatusCodeException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ContactCamundaException contactCamundaException= new ContactCamundaException.Builder(requestId, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, contactCamundaException.getMessage());
@@ -1232,7 +1234,7 @@ public class ServiceInstances {
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Error mapping request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
@@ -1251,7 +1253,7 @@ public class ServiceInstances {
msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte);
} catch (Exception e) {
logger.error("failed to parse request", e);
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
@@ -1276,7 +1278,7 @@ public class ServiceInstances {
try {
recipeLookupResult = getServiceURI(sir, action,alaCarteFlag);
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = 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)
@@ -1291,7 +1293,7 @@ public class ServiceInstances {
try {
recipeLookupResult = getVnfOrVfModuleUri( sir, action);
} catch (ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = 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)
@@ -1306,7 +1308,7 @@ public class ServiceInstances {
recipeLookupResult = getNetworkUri( sir, action);
} catch (ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = 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)
@@ -1320,7 +1322,7 @@ public class ServiceInstances {
}
if (recipeLookupResult == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = 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)
@@ -1852,7 +1854,7 @@ public class ServiceInstances {
if (StringUtils.isBlank(orchestrationUri) || StringUtils.isBlank(timeOut)) {
String error = StringUtils.isBlank(orchestrationUri) ? "ALaCarte Orchestration URI not found in properties" : "ALaCarte Recipe Timeout not found in properties";
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = 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)
@@ -1881,7 +1883,7 @@ public class ServiceInstances {
try{
infraActiveRequestsClient.save(currentActiveReq);
}catch(Exception e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
}
@@ -1906,7 +1908,7 @@ public class ServiceInstances {
.setALaCarte(aLaCarte)
.setRequestUri(requestUri).build();
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER)
.errorInfo(errorLoggerInfo).build();
}
@@ -1922,7 +1924,7 @@ public class ServiceInstances {
if (UUIDChecker.isValidUUID(requestId)) {
return requestId;
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ 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();
@@ -1939,7 +1941,7 @@ public class ServiceInstances {
try{
infraActiveRequestsClient.save(aq);
}catch(Exception e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
}
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 98227f8495..b7bd28f45f 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
@@ -54,9 +54,9 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskList;
import org.onap.so.apihandlerinfra.tasksbeans.TaskVariableValue;
import org.onap.so.apihandlerinfra.tasksbeans.TaskVariables;
import org.onap.so.apihandlerinfra.tasksbeans.TasksGetResponse;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -163,7 +163,7 @@ public class TasksHandler {
response = requestClient.post(camundaJsonReq);
} catch(JsonProcessingException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
@@ -171,7 +171,7 @@ public class TasksHandler {
throw validateException;
} catch(IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ 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;
}
@@ -203,7 +203,7 @@ public class TasksHandler {
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ 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)
@@ -218,7 +218,7 @@ public class TasksHandler {
jsonResponse = mapper.writeValueAsString(trr);
}
catch (JsonProcessingException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
@@ -241,7 +241,7 @@ public class TasksHandler {
try {
getResponse = requestClient.get();
}catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ 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;
}
@@ -253,7 +253,7 @@ public class TasksHandler {
taskList = buildTaskList(taskId, respBody);
}
else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build();
@@ -265,7 +265,7 @@ public class TasksHandler {
}
else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError).build();
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 00f1d6889d..be8f603a28 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
@@ -55,8 +55,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantSyncResponse;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -124,7 +124,6 @@ public class CloudOrchestration {
private Response cloudOrchestration(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version, String requestId) throws ApiException{
- MsoLogger.setLogContext(requestId, null);
logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
long startTime = System.currentTimeMillis ();
CloudOrchestrationRequest cor = null;
@@ -135,7 +134,8 @@ public class CloudOrchestration {
try {
tenantIsolationRequest.parse(cor, instanceIdMap, action);
}catch(ValidationException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ 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)
@@ -160,7 +160,7 @@ public class CloudOrchestration {
instance = instanceIdMap.get(resourceType + "InstanceId");
}
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_FOUND, ErrorCode.SchemaError).build();
throw new DuplicateRequestException.Builder(resourceType,instance,dup.getRequestStatus(),dup.getRequestId(), HttpStatus.SC_CONFLICT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
@@ -189,7 +189,8 @@ public class CloudOrchestration {
try {
encodedValue = new String(instanceId.getBytes("UTF-8"));
} catch(UnsupportedEncodingException ex) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.DataError).build();
throw new ValidateException.Builder("Could not encode instanceID" + ex.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
@@ -210,7 +211,7 @@ public class CloudOrchestration {
try {
return requestsDbClient.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
throw new ValidateException.Builder("Duplicate Check Request", HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
@@ -226,7 +227,8 @@ public class CloudOrchestration {
return mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
} catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
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 9305b80c13..fe74b108ba 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
@@ -45,7 +45,6 @@ import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Messages;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
@@ -59,9 +58,9 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestStatus;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -103,7 +102,8 @@ public class CloudResourcesOrchestration {
ObjectMapper mapper = new ObjectMapper();
cor = mapper.readValue(requestJSON, CloudOrchestrationRequest.class);
} catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
.cause(e).errorInfo(errorLoggerInfo).build();
@@ -113,7 +113,8 @@ public class CloudResourcesOrchestration {
try{
msoRequest.parseOrchestration(cor);
} catch (ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
.cause(e).errorInfo(errorLoggerInfo).build();
throw validateException;
@@ -126,7 +127,7 @@ public class CloudResourcesOrchestration {
}
if(infraActiveRequest == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB", HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
.errorInfo(errorLoggerInfo).build();
@@ -140,7 +141,8 @@ public class CloudResourcesOrchestration {
infraActiveRequest.setRequestId(requestId);
requestDbClient.save(infraActiveRequest);
}else{
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
+ ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
@@ -173,14 +175,14 @@ public class CloudResourcesOrchestration {
try {
requestDB = requestDbClient.getInfraActiveRequestbyRequestId(requestId);
} catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, MsoLogger.ErrorCode.AvailabilityError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
.errorInfo(errorLoggerInfo).build();
throw validateException;
}
if(requestDB == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB",
HttpStatus.SC_NO_CONTENT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
.errorInfo(errorLoggerInfo).build();
@@ -202,7 +204,7 @@ public class CloudResourcesOrchestration {
try{
orchestrationMap = tenantIsolationRequest.getOrchestrationFilters(queryParams);
}catch(ValidationException ex){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder(ex.getMessage(),
HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).cause(ex)
.errorInfo(errorLoggerInfo).build();
@@ -251,7 +253,7 @@ public class CloudResourcesOrchestration {
ObjectMapper mapper = new ObjectMapper();
requestDetails = mapper.readValue(requestBody, RequestDetails.class);
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
.cause(e).errorInfo(errorLoggerInfo).build();
throw validateException;
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 3ec3ade959..4be1ec9187 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
@@ -46,8 +46,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
import org.slf4j.Logger;
@@ -85,7 +85,8 @@ public class ModelDistributionRequest {
ObjectMapper mapper = new ObjectMapper();
distributionRequest = mapper.readValue(requestJSON, Distribution.class);
} catch(IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
@@ -98,7 +99,8 @@ public class ModelDistributionRequest {
parse(distributionRequest);
} catch(ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,
+ ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
@@ -148,7 +150,7 @@ public class ModelDistributionRequest {
requestErrorStr = mapper.writeValueAsString(re);
}catch(JsonProcessingException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR,MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed. " + e.getMessage(), HttpStatus.SC_BAD_REQUEST,ErrorNumbers.SVC_BAD_PARAMETER)
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 47cbb0c895..82a5d1ebbf 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
@@ -47,8 +47,8 @@ import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.UUIDChecker;
import org.slf4j.Logger;
@@ -84,11 +84,9 @@ public class TenantIsolationRequest {
TenantIsolationRequest (String requestId) {
this.requestId = requestId;
- MsoLogger.setLogContext (requestId, null);
}
TenantIsolationRequest () {
- MsoLogger.setLogContext (requestId, null);
}
void parse(CloudOrchestrationRequest request, HashMap<String,String> instanceIdMap, Action action) throws ValidationException {
@@ -356,7 +354,7 @@ public class TenantIsolationRequest {
requestsDbClient.save(request);
} catch (Exception e) {
logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(),
- MsoLogger.ErrorCode.DataError.getValue(), "Exception when updating record in DB");
+ ErrorCode.DataError.getValue(), "Exception when updating record in DB");
logger.debug("Exception: ", e);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
index 00ce137ee3..98104e9073 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
@@ -34,8 +34,8 @@ import org.onap.so.apihandlerinfra.tenantisolation.process.CreateVnfOperationalE
import org.onap.so.apihandlerinfra.tenantisolation.process.DeactivateVnfOperationalEnvironment;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -76,7 +76,7 @@ public class TenantIsolationRunnable {
} else if(OperationalEnvironment.VNF.name().equalsIgnoreCase(operationalEnvType)) {
createVnfOpEnv.execute(requestId, cor);
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Invalid OperationalEnvironment Type specified for Create Action",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
.build();
@@ -90,7 +90,7 @@ public class TenantIsolationRunnable {
} else if(Action.distributionStatus.equals(action)) {
activateVnfStatusOpEnv.execute(requestId, cor);
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Invalid Action specified: " + action,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
throw validateException;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
index f718431534..55b1ea6198 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
@@ -29,8 +29,8 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -55,7 +55,7 @@ public class DmaapOperationalEnvClient {
try {
return this.getJson(operationalEnv);
}catch(JsonProcessingException ex){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
ValidateException validateException = new ValidateException.Builder("Mapping of request to JSON object failed : " + ex.getMessage(),
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(ex).errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
index eb0721270d..de1d9e9cfb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java
@@ -50,7 +50,8 @@ public class ActivateVnfDBHelper {
String status,
String recoveryAction,
int retryCount,
- String workloadContext) {
+ String workloadContext,
+ String vnfOperationalEnvironmentId) {
OperationalEnvServiceModelStatus serviceModelStatus = new OperationalEnvServiceModelStatus();
serviceModelStatus.setRequestId(requestId);
serviceModelStatus.setOperationalEnvId(operationalEnvironmentId);
@@ -59,6 +60,7 @@ public class ActivateVnfDBHelper {
serviceModelStatus.setRecoveryAction(recoveryAction);
serviceModelStatus.setRetryCount(new Integer(retryCount));
serviceModelStatus.setWorkloadContext(workloadContext);
+ serviceModelStatus.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
return serviceModelStatus;
}
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 9303e12071..bf5623a9da 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
@@ -37,8 +37,8 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
@@ -86,7 +86,7 @@ public class SDCClientHelper {
String basicAuthCred = getBasicAuth();
if ( basicAuthCred == null || "".equals(basicAuthCred) ) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = 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();
@@ -131,7 +131,7 @@ public class SDCClientHelper {
try {
return client.post(jsonPayload);
}catch(Exception ex){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ 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();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
index f70fe71554..dde45a81c9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
@@ -28,9 +28,6 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
import org.onap.aai.domain.yang.OperationalEnvironment;
-import org.onap.aai.domain.yang.RelationshipList;
-import org.onap.aai.domain.yang.Relationship;
-import org.onap.aai.domain.yang.RelationshipData;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
@@ -47,8 +44,8 @@ import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -109,17 +106,17 @@ public class ActivateVnfOperationalEnvironment {
String workloadContext = operationalEnv.getWorkloadContext();
logger.debug(" aai workloadContext: {}", workloadContext);
if (!vidWorkloadContext.equals(workloadContext)) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
throw new ValidateException.Builder(" The vid workloadContext did not match from aai record. " + " vid workloadContext:" + vidWorkloadContext + " aai workloadContext:" + workloadContext,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
if (ecompOperationalEnvironmentId==null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
throw new ValidateException.Builder(" The ECOMP OE was not in aai record; the value of relationship.relationship-data key: " + OPER_ENVIRONMENT_ID_KEY,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
- processActivateSDCRequest(requestId, ecompOperationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ processActivateSDCRequest(requestId, ecompOperationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
@@ -134,7 +131,7 @@ public class ActivateVnfOperationalEnvironment {
*/
public void processActivateSDCRequest(String requestId, String operationalEnvironmentId,
List<ServiceModelList> serviceModelVersionIdList,
- String workloadContext) throws ApiException {
+ String workloadContext, String vnfOperationalEnvironmentId) throws ApiException {
JSONObject jsonResponse = null;
int retryCount = 0;
@@ -157,7 +154,8 @@ public class ActivateVnfOperationalEnvironment {
DISTRIBUTION_STATUS_SENT,
recoveryAction,
retryCount,
- workloadContext);
+ workloadContext,
+ vnfOperationalEnvironmentId);
client.save(serviceModelStatus);
String distributionId = "";
@@ -178,7 +176,7 @@ public class ActivateVnfOperationalEnvironment {
client.save(distStatus);
} else {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
String dbErrorMessage = " Failure calling SDC: statusCode: " + statusCode +
"; messageId: " + jsonResponse.get("messageId") +
"; message: " + jsonResponse.get("message");
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 352bf8fb0b..cd05aa558e 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
@@ -24,25 +24,29 @@ package org.onap.so.apihandlerinfra.tenantisolation.process;
import java.util.List;
+import java.util.Optional;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
+import org.onap.aai.domain.yang.OperationalEnvironment;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
+import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.SDCClientHelper;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,7 +61,8 @@ public class ActivateVnfStatusOperationalEnvironment {
private String errorMessage = "";
private OperationalEnvDistributionStatus queryDistributionDbResponse = null;
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";
@@ -77,6 +82,8 @@ public class ActivateVnfStatusOperationalEnvironment {
private SDCClientHelper sdcClientHelper;
@Autowired
private RequestsDbClient client;
+ @Autowired
+ private AAIClientHelper aaiHelper;
/**
* The Point-Of-Entry from APIH with activate status from SDC
@@ -107,8 +114,20 @@ public class ActivateVnfStatusOperationalEnvironment {
// to determine the OVERALL status if "COMPLETE" or "FAILURE":
checkOrUpdateOverallStatus(operationalEnvironmentId, this.origRequestId);
+ // Update AAI to ACTIVE if Overall success
+ if (isOverallSuccess) {
+ String vnfOperationalEnvironmentId = this.queryServiceModelResponse.getVnfOperationalEnvId();
+ OperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(vnfOperationalEnvironmentId);
+ if (aaiOpEnv != null) {
+ aaiOpEnv.setOperationalEnvironmentStatus("ACTIVE");
+ aaiHelper.updateAaiOperationalEnvironment(vnfOperationalEnvironmentId, aaiOpEnv);
+ }else {
+ requestDb.updateInfraFailureCompletion("Unable to update ACTIVATE status in AAI. ", this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId());
+ }
+ }
+
} catch(Exception e) {
- requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryDistributionDbResponse.getOperationalEnvId());
+ requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId());
}
}
@@ -236,7 +255,7 @@ public class ActivateVnfStatusOperationalEnvironment {
String dbErrorMessage = "Failure calling SDC: statusCode: " + statusCode +
"; messageId: " + jsonResponse.get("messageId") +
"; message: " + jsonResponse.get("message");
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder(dbErrorMessage,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
requestDb.updateInfraFailureCompletion(dbErrorMessage, this.origRequestId, operEnvironmentId);
@@ -280,11 +299,12 @@ public class ActivateVnfStatusOperationalEnvironment {
if (status.equals("Completed") && queryServiceModelResponseList.size() == count) {
String messageStatus = "Overall Activation process is complete. " + status;
+ isOverallSuccess = true;
requestDb.updateInfraSuccessCompletion(messageStatus, origRequestId, operationalEnvironmentId);
} else {
if (status.equals("Failure") && queryServiceModelResponseList.size() == count) {
this.errorMessage = "Overall Activation process is a Failure. " + status;
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError).build();
ValidateException validateException = new ValidateException.Builder(this.errorMessage,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
requestDb.updateInfraFailureCompletion(this.errorMessage, origRequestId, operationalEnvironmentId);
@@ -293,4 +313,15 @@ public class ActivateVnfStatusOperationalEnvironment {
}
}
+
+ /**
+ * Get OperationalEnvironment object
+ * @param operationalEnvironmentId - String
+ * @return operationalEnv - OperationalEnvironment object
+ */
+ private OperationalEnvironment getAAIOperationalEnvironment(String operationalEnvironmentId) {
+ AAIResultWrapper aaiResult = aaiHelper.getAaiOperationalEnvironment(operationalEnvironmentId);
+ Optional<OperationalEnvironment> operationalEnvironmentOpt = aaiResult.asBean(OperationalEnvironment.class);
+ return operationalEnvironmentOpt.isPresent() ? operationalEnvironmentOpt.get() : null;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
index 6ba78aa175..e9c9be9dd4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
@@ -31,8 +31,8 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolation.dmaap.DmaapOperationalEnvClient;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,7 +75,7 @@ public class CreateEcompOperationalEnvironment {
request.getRequestDetails().getRequestParameters().getWorkloadContext(),
"Create");
}catch(Exception e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Could not publish DMaap", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
requestDb.updateInfraFailureCompletion(e.getMessage(), requestId, request.getOperationalEnvironmentId());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
index 2eaba25234..cc3e3aeb16 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
@@ -47,8 +47,8 @@ import org.onap.so.client.grm.beans.ServiceEndPoint;
import org.onap.so.client.grm.beans.ServiceEndPointList;
import org.onap.so.client.grm.beans.ServiceEndPointRequest;
import org.onap.so.client.grm.beans.Version;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -108,7 +108,7 @@ public class CreateVnfOperationalEnvironment {
requestDb.updateInfraSuccessCompletion("SUCCESSFULLY created VNF operational environment", requestId, request.getOperationalEnvironmentId());
}catch(Exception e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(),
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
index 2181215ca7..7f8b330727 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
@@ -34,8 +34,8 @@ import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -62,7 +62,7 @@ public class DeactivateVnfOperationalEnvironment {
if(StringUtils.isBlank(operationalEnvironmentStatus)) {
String error = "OperationalEnvironmentStatus is null on OperationalEnvironmentId: " + operationalEnvironmentId;
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
throw new ValidateException.Builder(error, HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
.errorInfo(errorLoggerInfo)
.build();
@@ -75,7 +75,7 @@ public class DeactivateVnfOperationalEnvironment {
} else if(!operationalEnvironmentStatus.equalsIgnoreCase("INACTIVE")) {
String error = "Invalid OperationalEnvironmentStatus on OperationalEnvironmentId: " + operationalEnvironmentId;
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder(error,
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
requestDb.updateInfraFailureCompletion(error, requestId, operationalEnvironmentId);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
index 7bb1bdf71a..6efcdc47e5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
@@ -28,10 +28,9 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.*;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
@@ -89,7 +88,7 @@ public class ApiExceptionTest extends BaseTest {
@Test
public void testDuplicateRequestException() throws ApiException {
- ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
thrown.expect(DuplicateRequestException.class);
thrown.expectMessage(startsWith("Error: Locked instance"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
index bb78c822f7..1943b42404 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
@@ -29,6 +29,15 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static org.onap.so.logger.MdcConstants.ECOMP_REQUEST_ID;
+import static org.onap.so.logger.MdcConstants.ENDTIME;
+import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
+import static org.onap.so.logger.MdcConstants.PARTNERNAME;
+import static org.onap.so.logger.MdcConstants.RESPONSECODE;
+import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
+import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
+import static org.onap.so.logger.MdcConstants.STATUSCODE;
+import static org.onap.so.logger.MdcConstants.CLIENT_ID;
import java.io.IOException;
import java.util.Map;
@@ -44,7 +53,6 @@ import org.onap.so.apihandlerinfra.tasksbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference;
import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
import org.onap.so.apihandlerinfra.tasksbeans.ValidResponses;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
import org.springframework.http.HttpEntity;
@@ -64,8 +72,6 @@ public class ManualTasksTest extends BaseTest{
private final String basePath = "/tasks/v1/";
-
-
@Test
public void testCreateOpEnvObjectMapperError() throws IOException {
TestAppender.events.clear();
@@ -88,8 +94,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
@@ -116,22 +122,22 @@ public class ManualTasksTest extends BaseTest{
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("tasks/v1/55/complete",mdc.get(SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(STATUSCODE));
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(ENDTIME));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
- assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("202",mdc.get(RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("tasks/v1/55/complete",mdc.get(SERVICE_NAME));
+ assertEquals("COMPLETE",mdc.get(STATUSCODE));
+ assertNotNull(mdc.get(RESPONSEDESC));
assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
@@ -151,8 +157,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<String> entity = new HttpEntity<String>(invalidRequest, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + "55" + "/complete");
@@ -187,8 +193,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
@@ -227,8 +233,8 @@ public class ManualTasksTest extends BaseTest{
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
- headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321");
- headers.set(MsoLogger.CLIENT_ID, "VID");
+ headers.set(ECOMP_REQUEST_ID, "987654321");
+ headers.set(CLIENT_ID, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete");
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 d6c794ef2e..17fa011c93 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
@@ -34,6 +34,18 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
+import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+import static org.onap.so.logger.MdcConstants.CLIENT_ID;
+import static org.onap.so.logger.MdcConstants.ENDTIME;
+import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
+import static org.onap.so.logger.MdcConstants.PARTNERNAME;
+import static org.onap.so.logger.MdcConstants.RESPONSECODE;
+import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
+import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
+import static org.onap.so.logger.MdcConstants.STATUSCODE;
+import static org.onap.so.logger.HttpHeadersConstants.TRANSACTION_ID;
+
import java.io.File;
import java.io.IOException;
@@ -59,8 +71,7 @@ import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.logger.LogConstants;
-import org.onap.so.logger.MsoLogger;
+import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -117,11 +128,11 @@ public class ServiceInstancesTest extends BaseTest{
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(MsoLogger.CLIENT_ID, "VID");
- headers.set(MsoLogger.REQUESTOR_ID, "xxxxxx");
+ headers.set(CLIENT_ID, "VID");
+ headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
initialPort = initialUrl.getPort();
@@ -263,22 +274,22 @@ public class ServiceInstancesTest extends BaseTest{
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(MsoLogger.STATUSCODE));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(STATUSCODE));
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(MsoLogger.ENDTIME));
+ assertNotNull(mdc.get(ENDTIME));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
- assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
- assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME));
- assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE));
- assertNotNull(mdc.get(MsoLogger.RESPONSEDESC));
+ assertNotNull(mdc.get(INVOCATION_ID));
+ assertEquals("202",mdc.get(RESPONSECODE));
+ assertEquals("UNKNOWN",mdc.get(PARTNERNAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(SERVICE_NAME));
+ assertEquals("COMPLETE",mdc.get(STATUSCODE));
+ assertNotNull(mdc.get(RESPONSEDESC));
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0));
@@ -2387,14 +2398,14 @@ public class ServiceInstancesTest extends BaseTest{
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
- assertEquals(response.getHeaders().get(MsoLogger.TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ assertEquals(response.getHeaders().get(TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d");
for(ILoggingEvent logEvent : TestAppender.events){
if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging") &&
logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertEquals("VID",mdc.get(MsoLogger.PARTNERNAME));
+ assertEquals("VID",mdc.get(PARTNERNAME));
}
}
}
@@ -2451,7 +2462,7 @@ public class ServiceInstancesTest extends BaseTest{
public void deleteInstanceGroupNoPartnerNameHeader() throws IOException{
HttpHeaders noPartnerHeaders = new HttpHeaders();
noPartnerHeaders.set(ONAPLogConstants.Headers.REQUEST_ID, "eca3a1b1-43ab-457e-ab1c-367263d148b4");
- noPartnerHeaders.set(MsoLogger.REQUESTOR_ID, "xxxxxx");
+ noPartnerHeaders.set(REQUESTOR_ID, "xxxxxx");
uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c";
ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, noPartnerHeaders);
//then
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
index b799394b7a..78315e9fad 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java
@@ -92,6 +92,7 @@ public class AAIClientHelperTest extends BaseTest{
Map<String, String> payload = new HashMap<String, String>();
payload.put("tenant-context", "Test");
payload.put("workload-context", "ECOMPL_PSL");
+ payload.put("operational-environment-status", "ACTIVE");
try {
AAIClientHelper clientHelper = mock(AAIClientHelper.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
index 3e06275fca..6fda6afc50 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelperTest.java
@@ -41,6 +41,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
public class ActivateVnfDBHelperTest extends BaseTest{
String operationalEnvironmentId = "TEST_operationalEnvironmentId";
+ String vnfOperationalEnvironmentId = "VNF_operationalEnvironmentId";
String requestId = "TEST_requestId";
String origRequestId = "TEST_requestId";
@@ -81,6 +82,7 @@ public class ActivateVnfDBHelperTest extends BaseTest{
expectedServiceModelStatus.setRecoveryAction(recoveryActionRetry);
expectedServiceModelStatus.setRetryCount(new Integer(retryCountThree));
expectedServiceModelStatus.setWorkloadContext(workloadContext1);
+ expectedServiceModelStatus.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
}
@Test
@@ -122,7 +124,8 @@ public class ActivateVnfDBHelperTest extends BaseTest{
statusOk,
recoveryActionRetry,
retryCountThree,
- workloadContext1);
+ workloadContext1,
+ vnfOperationalEnvironmentId);
assertThat(serviceModelStatus1, sameBeanAs(expectedServiceModelStatus));
// prepare updated expected object
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
index 18af7fbaa0..418ed4270a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
@@ -74,6 +74,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
private final String requestId = "TEST_requestId";
private final String operationalEnvironmentId = "1dfe7154-eae0-44f2-8e7a-8e5e7882e55d";
+ private final String vnfOperationalEnvironmentId = "1dfe7154-eae0-44f2-8e7a-8e5e7882e66d";
private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
private final String workloadContext = "PVT";
String recoveryActionRetry = "RETRY";
@@ -86,7 +87,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
@Before
public void init(){
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e66d\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
@@ -130,7 +131,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
requestParameters.setWorkloadContext(workloadContext);
requestDetails.setRequestParameters(requestParameters);
- request.setOperationalEnvironmentId(operationalEnvironmentId);
+ request.setOperationalEnvironmentId(vnfOperationalEnvironmentId);
request.setRequestDetails(requestDetails);
JSONObject jsonObject = new JSONObject();
@@ -139,7 +140,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
jsonObject.put("distributionId", sdcDistributionId);
stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED)));
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/activateOperationalEnvironmentWithRelationship.json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
activateVnf.execute(requestId, request);
@@ -165,7 +166,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
@Test
@@ -205,7 +206,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
thrown.expect(ValidateException.class);
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, vnfOperationalEnvironmentId);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
index a26848bf21..c0250f7315 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
@@ -23,6 +23,7 @@ package org.onap.so.apihandlerinfra.tenantisolation.process;
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.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
@@ -48,6 +49,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
+import org.onap.so.client.aai.AAIVersion;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
@@ -66,6 +68,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
private final String requestId = "TEST_requestId";
private final String requestIdOrig = "TEST_requestIdOrig";
private final String operationalEnvironmentId = "TEST_operationalEnvironmentId";
+ private final String vnfOperationalEnvironmentId = "VNF_operationalEnvironmentId";
private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
private final String workloadContext = "TEST_workloadContext";
private final String recoveryActionRetry = "RETRY";
@@ -81,6 +84,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
private final String statusOk = Status.DISTRIBUTION_COMPLETE_OK.toString();
private final String statusError = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
private final String statusSent = "SENT";
+ String json = "{\"operational-environment-status\" : \"INACTIVE\"}";
private final ObjectMapper mapper = new ObjectMapper();
@@ -96,6 +100,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
serviceModelDb.setRequestId(requestIdOrig);
serviceModelDb.setServiceModelVersionId(serviceModelVersionId1);
@@ -104,6 +109,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
@@ -134,6 +140,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -169,6 +176,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountTwo);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -188,6 +196,8 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusSent);
+ serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -221,7 +231,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -229,7 +239,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
-
+
+ stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -244,6 +259,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceModelDb))
@@ -294,10 +310,15 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -312,6 +333,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -360,6 +382,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
@@ -382,6 +409,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -391,8 +419,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
-
-
// prepare distribution obj
Distribution distribution = new Distribution();
distribution.setStatus(Status.DISTRIBUTION_COMPLETE_ERROR);
@@ -428,13 +454,18 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
- .withRequestBody(containing("operationalEnvId\":\"TEST_operationalEnvironmentId\""))
+ .withRequestBody(containing("operationalEnvId\":\"VNF_operationalEnvironmentId\""))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonMessages.toString()).withStatus(HttpStatus.SC_CONFLICT)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
@@ -455,6 +486,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -490,7 +522,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withBody(mapper.writeValueAsString(iar))
.withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
- .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null}"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"vnfOperationalEnvId\":\"VNF_operationalEnvironmentId\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -499,6 +531,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
activateVnfStatus.execute(requestId, request);
}
@@ -514,6 +551,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
+ serviceModelDb.setVnfOperationalEnvId(vnfOperationalEnvironmentId);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -558,6 +596,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withRequestBody(containing("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_ERROR\""))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
+
try {
activateVnfStatus.execute(requestId, request);
}catch(ApiException e) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
index ce1dde835d..65ec5fade6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
@@ -40,8 +40,8 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters;
import org.onap.so.client.aai.AAIVersion;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import javax.ws.rs.core.HttpHeaders;
@@ -102,7 +102,7 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/events/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException expectedException = new ValidateException.Builder("Could not publish DMaap", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER)
.errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json
new file mode 100644
index 0000000000..974a824467
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/activateOperationalEnvironmentWithRelationship.json
@@ -0,0 +1,27 @@
+{
+ "operational-environment-id": "1dfe7154-eae0-44f2-8e7a-8e5e7882e66d",
+ "operational-environment-name": "Test Managing ECOMP Environment",
+ "operational-environment-type": "ECOMP",
+ "operational-environment-status": "INACTIVE",
+ "tenant-context": "Test",
+ "workload-context": "PVT",
+ "resource-version": "1505228226913",
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "operational-environment",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v13/cloud-infrastructure/operational-environments/operational-environment/1dfe7154-eae0-44f2-8e7a-8e5e7882e55d",
+ "relationship-data": [{
+ "relationship-key": "operational-environment.operational-environment-id",
+ "relationship-value": "1dfe7154-eae0-44f2-8e7a-8e5e7882e55d"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "operational-environment.operational-environment-name",
+ "property-value": "myOpEnv_IST_un577h_0119"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
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 f99f89653f..765b8cf75e 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
@@ -22,9 +22,9 @@ INSERT INTO requestdb.site_status(SITE_NAME, STATUS, CREATION_TIMESTAMP) VALUES
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status(OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID, SERVICE_MOD_VER_FINAL_DISTR_STATUS, RECOVERY_ACTION, RETRY_COUNT_LEFT, WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME) VALUES
- ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'RETRY', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:45:06'),
- ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'SKIP', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:44:56');
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status(OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID, SERVICE_MOD_VER_FINAL_DISTR_STATUS, RECOVERY_ACTION, RETRY_COUNT_LEFT, WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID) VALUES
+ ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'RETRY', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:45:06', 'vnf_1234'),
+ ('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'SKIP', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:44:56', 'vnf_1235');
INSERT INTO requestdb.activate_operational_env_per_distributionid_status(DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, DISTRIBUTION_ID_ERROR_REASON, CREATE_TIME, MODIFY_TIME, OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID) VALUES
('TEST_distributionId', 'DISTRIBUTION_COMPLETE_OK', NULL, '2018-02-02 18:44:27', '2018-02-02 18:44:56', '1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74'),
@@ -276,12 +276,12 @@ VALUES
('vfModule', 'replaceInstance', '1', 'Gr api recipe to replace vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'),
('vfModule', 'deactivateAndCloudDelete', '1', 'Gr api recipe to deactivateAndCloudDelete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'),
('vfModule', 'scaleOut', '1', 'Gr api recipe to scale out vfModule', '/mso/async/services/WorkflowActionBB', '180', 'GR-API-DEFAULT');
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
-INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME)
+('1234', 'TEST1234', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 1, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
+INSERT INTO requestdb.activate_operational_env_service_model_distribution_status (OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID,SERVICE_MOD_VER_FINAL_DISTR_STATUS,RECOVERY_ACTION,RETRY_COUNT_LEFT,WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID)
VALUES
-('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59');
+('1234', 'TEST1235', '00032ab7-3fb3-42e5-965d-8ea592502017', "Test", "Test", 2, 'DEFAULT', '2018-08-14 16:50:59', '2018-08-14 16:50:59', 'vnf_1234');
INSERT INTO requestdb.activate_operational_env_per_distributionid_status (DISTRIBUTION_ID, DISTRIBUTION_ID_STATUS, DISTRIBUTION_ID_ERROR_REASON, CREATE_TIME, MODIFY_TIME, OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID)
VALUES
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml
index 4da57a15f9..5e6b88c039 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml
@@ -38,4 +38,4 @@
<logger name="wiremock.org" level="ERROR" />
-</configuration> \ No newline at end of file
+</configuration>
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 5873e147bc..e46996181e 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
@@ -776,61 +776,105 @@ AUTO_INCREMENT = 20654
DEFAULT CHARACTER SET = latin1;
CREATE TABLE IF NOT EXISTS cvnfc_customization (
-`ID` INT(11) NOT NULL AUTO_INCREMENT,
-`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
-`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
-`MODEL_UUID` VARCHAR(200) NOT NULL,
-`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
-`MODEL_VERSION` VARCHAR(20) NOT NULL,
-`MODEL_NAME` VARCHAR(200) NOT NULL,
-`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
-`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
-`NFC_FUNCTION` VARCHAR(200) NULL,
-`NFC_NAMING_CODE` VARCHAR(200) NULL,
-`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
-`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
-`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
-DELETE CASCADE ON
-UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
-DELETE CASCADE ON
-UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
-DELETE CASCADE ON
-UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1;
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `MODEL_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_VERSION` VARCHAR(20) NOT NULL,
+ `MODEL_NAME` VARCHAR(200) NOT NULL,
+ `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+ `NFC_FUNCTION` VARCHAR(200) NULL,
+ `NFC_NAMING_CODE` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ UNIQUE INDEX `UK_cvnfc_customization` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1;
CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
- `ID` INT(11) NOT NULL AUTO_INCREMENT,
- `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
- `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
- `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
- `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
- `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
- `CONFIGURATION_TYPE` VARCHAR(200) NULL,
- `CONFIGURATION_ROLE` VARCHAR(200) NULL,
- `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
- `POLICY_NAME` VARCHAR(200) NULL,
- `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
- PRIMARY KEY (`ID`),
- INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
- UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC),
- INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC),
- INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC),
- INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC),
- CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
- REFERENCES `configuration` (`MODEL_UUID`)
- ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`)
- REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`)
- ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`)
- REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`)
- ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`)
- REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`)
- ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1;
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `CONFIGURATION_TYPE` VARCHAR(200) NULL,
+ `CONFIGURATION_ROLE` VARCHAR(200) NULL,
+ `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
+ `POLICY_NAME` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL,
+ `CVNFC_CUSTOMIZATION_ID` INT(11) DEFAULT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
+
+ CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource` (
+ `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT',
+ `DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODEL_UUID` varchar(200) NOT NULL,
+ `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL,
+ `MODEL_VERSION` varchar(20) NOT NULL,
+ `MODEL_NAME` varchar(200) DEFAULT NULL,
+ `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
+ `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL,
+ `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_UUID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
+ `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` varchar(200) NOT NULL,
+ `NF_TYPE` varchar(200) DEFAULT NULL,
+ `NF_ROLE` varchar(200) DEFAULT NULL,
+ `NF_FUNCTION` varchar(200) DEFAULT NULL,
+ `NF_NAMING_CODE` varchar(200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
+ `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
+ `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
+ KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
+ CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` (
+ `SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`)
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
--------START Request DB SCHEMA --------
CREATE DATABASE requestdb;
USE requestdb;
@@ -980,6 +1024,7 @@ CREATE TABLE `activate_operational_env_service_model_distribution_status` (
`WORKLOAD_CONTEXT` varchar(80) NOT NULL,
`CREATE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFY_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
+ `VNF_OPERATIONAL_ENV_ID` varchar(45) NOT NULL,
PRIMARY KEY (`OPERATIONAL_ENV_ID`,`SERVICE_MODEL_VERSION_ID`,`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
index 9eec860cc9..f1f26fa7cc 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java
@@ -51,12 +51,14 @@ public class OperationalEnvServiceModelStatusTest {
status.setRequestId("request-id-1");
status.setOperationalEnvId("oper-env-id-1");
status.setServiceModelVersionId("service-model-ver-id-1");
+ status.setVnfOperationalEnvId("vnf-oper-env-id-1");
status.setRetryCount(0);
repository.saveAndFlush(status);
OperationalEnvServiceModelStatus status2 = repository.findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId("oper-env-id-1", "service-model-ver-id-1", "request-id-1");
status2.setRetryCount(1);
assertEquals("request-id-1", status2.getRequestId());
+ assertEquals("vnf-oper-env-id-1", status2.getVnfOperationalEnvId());
repository.saveAndFlush(status2);
@@ -65,6 +67,7 @@ public class OperationalEnvServiceModelStatusTest {
status3.setRequestId("request-id-2");
status3.setOperationalEnvId("oper-env-id-1");
status3.setServiceModelVersionId("service-model-ver-id-2");
+ status3.setVnfOperationalEnvId("vnf-oper-env-id-2");
status3.setRetryCount(2);
repository.saveAndFlush(status3);
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 4ff7025dee..2bd9936b3a 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
@@ -9,6 +9,7 @@ create table ACTIVATE_OPERATIONAL_ENV_SERVICE_MODEL_DISTRIBUTION_STATUS (
WORKLOAD_CONTEXT varchar(255),
CREATE_TIME datetime,
MODIFY_TIME datetime,
+ VNF_OPERATIONAL_ENV_ID varchar(255) not null,
primary key (REQUEST_ID,OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID)
);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
index 588822cce0..79168f8f0b 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OperationalEnvServiceModelStatus.java
@@ -72,7 +72,9 @@ public class OperationalEnvServiceModelStatus implements Serializable {
@Column(name = "MODIFY_TIME")
@Temporal(TemporalType.TIMESTAMP)
private Date modifyTime;
-
+ @Column(name = "VNF_OPERATIONAL_ENV_ID", length=45)
+ private String vnfOperationalEnvId;
+
public OperationalEnvServiceModelStatus() {
}
@@ -146,6 +148,14 @@ public class OperationalEnvServiceModelStatus implements Serializable {
public Date getModifyTime() {
return modifyTime;
}
+
+ public String getVnfOperationalEnvId() {
+ return vnfOperationalEnvId;
+ }
+
+ public void setVnfOperationalEnvId(String vnfOperationalEnvId) {
+ this.vnfOperationalEnvId = vnfOperationalEnvId;
+ }
@PrePersist
protected void onCreate() {
@@ -183,7 +193,8 @@ public class OperationalEnvServiceModelStatus implements Serializable {
.append("serviceModelVersionDistrStatus", getServiceModelVersionDistrStatus())
.append("recoveryAction", getRecoveryAction()).append("retryCount", getRetryCount())
.append("workloadContext", getWorkloadContext()).append("createTime", getCreateTime())
- .append("modifyTime", getModifyTime()).toString();
+ .append("modifyTime", getModifyTime())
+ .append("vnfOperationalEnvId", getVnfOperationalEnvId()).toString();
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
index 34832b9917..0a74c1d7be 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
@@ -33,10 +33,12 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.openpojo.business.annotation.BusinessKey;
/**
@@ -50,6 +52,8 @@ import com.openpojo.business.annotation.BusinessKey;
*/
@Entity
+
+@JsonInclude(Include.NON_NULL)
@Table(name = "request_processing_data")
public class RequestProcessingData implements Serializable{
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java
index 4e83ea5911..e7a0c39702 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/SiteStatus.java
@@ -32,7 +32,6 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import org.onap.so.logger.MsoLogger;
import java.util.Objects;
import org.apache.commons.lang3.builder.ToStringBuilder;
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 5958397851..9c29d968c9 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
@@ -308,7 +308,7 @@ public class RequestsDbClient {
public void saveRequestProcessingData(RequestProcessingData requestProcessingData) {
HttpHeaders headers = getHttpHeaders();
- URI uri = getUri(endpoint + requestProcessingDataURI);
+ URI uri = getUri(requestProcessingDataURI);
HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers);
restTemplate.postForLocation(uri, entity);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java
index eb9078fd57..30ebca8699 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudifyManager.java
@@ -24,7 +24,6 @@ import java.util.Date;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.openpojo.business.annotation.BusinessKey;
-import org.onap.so.logger.MsoLogger;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -205,4 +204,4 @@ public class CloudifyManager {
return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername())
.append(getPassword()).append(getVersion()).toHashCode();
}
-} \ No newline at end of file
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
index b1ad0de5ca..9f081ccd34 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
@@ -121,7 +121,7 @@ public class CvnfcCustomization implements Serializable {
@Override
public int hashCode() {
- return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ return new HashCodeBuilder().append(modelCustomizationUUID).append(vfModuleCustomization).append(vnfcCustomization).append(vnfResourceCustomization).toHashCode();
}
@Override
@@ -249,6 +249,7 @@ public class CvnfcCustomization implements Serializable {
this.created = created;
}
+ @LinkedResource
public VfModuleCustomization getVfModuleCustomization() {
return vfModuleCustomization;
}
@@ -257,6 +258,7 @@ public class CvnfcCustomization implements Serializable {
this.vfModuleCustomization = vfModuleCustomization;
}
+ @LinkedResource
public VnfcCustomization getVnfcCustomization() {
return vnfcCustomization;
}
@@ -265,6 +267,7 @@ public class CvnfcCustomization implements Serializable {
this.vnfcCustomization = vnfcCustomization;
}
+ @LinkedResource
public VnfResourceCustomization getVnfResourceCustomization() {
return vnfResourceCustomization;
}
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 b893cec0f2..0fa07cfe0f 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
@@ -29,7 +29,10 @@ public enum OrchestrationStatus {
PENDING_ACTIVATION("PendingActivation", "pending.?activation"),
PENDING_CREATE("PendingCreate", "pending.?create"),
PENDING_DELETE("PendingDelete", "pending.?delete"),
- PRECREATED("PreCreated", "pre.?created");
+ PRECREATED("PreCreated", "pre.?created"),
+ CONFIGASSIGNED("ConfigAssigned", "config.?assigned"),
+ CONFIGURE("Configure" , "configure"),
+ CONFIGURED("Configured" , "configured");
private final String name;
private final String fuzzyMatcher;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
index 7ce657c5c7..e425ebbc64 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
@@ -31,6 +31,7 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
@@ -74,7 +75,8 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable
private String configurationFunction;
@Column(name = "POLICY_NAME")
- private String policyName;
+ private String policyName;
+
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@@ -87,7 +89,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable
@BusinessKey
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
- @JoinColumn(name = "CVNFC_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID")
+ @JoinColumn(name = "CVNFC_CUSTOMIZATION_ID")
private CvnfcCustomization cvnfcCustomization;
@BusinessKey
@@ -98,7 +100,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable
@BusinessKey
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID")
- private VnfResourceCustomization vnfResourceCustomization;
+ private VnfResourceCustomization vnfResourceCustomization;
@Override
public boolean equals(final Object other) {
@@ -222,6 +224,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable
this.cvnfcCustomization = cvnfcCustomization;
}
+ @LinkedResource
public VfModuleCustomization getVfModuleCustomization() {
return vfModuleCustomization;
}
@@ -230,6 +233,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable
this.vfModuleCustomization = vfModuleCustomization;
}
+ @LinkedResource
public VnfResourceCustomization getVnfResourceCustomization() {
return vnfResourceCustomization;
}
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 f73044747c..3e35e78e7a 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
@@ -234,8 +234,6 @@ public class CatalogDbClient {
private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
- private final Client<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationClient;
-
private final Client<PnfResource> pnfResourceClient;
private final Client<PnfResourceCustomization> pnfResourceCustomizationClient;
@@ -365,7 +363,6 @@ public class CatalogDbClient {
cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
- vnfVfmoduleCvnfcConfigurationCustomizationClient = clientFactory.create(VnfVfmoduleCvnfcConfigurationCustomization.class);
pnfResourceClient = clientFactory.create(PnfResource.class);
pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
}
@@ -415,7 +412,6 @@ public class CatalogDbClient {
cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
- vnfVfmoduleCvnfcConfigurationCustomizationClient = clientFactory.create(VnfVfmoduleCvnfcConfigurationCustomization.class);
pnfResourceClient = clientFactory.create(PnfResource.class);
pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
}
@@ -801,12 +797,26 @@ public class CatalogDbClient {
.queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString()));
}
- public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(String vnfCustomizationUuid,
- String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) {
- return this.getSingleResource(vnfVfmoduleCvnfcConfigurationCustomizationClient, getUri(UriBuilder
- .fromUri(endpoint + "/vnfVfmoduleCvnfcConfigurationCustomization/search/findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization")
- .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUuid)
- .queryParam("VF_MODULE_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUuid)
- .queryParam("CVNFC_MODEL_CUSTOMIZATION_UUID", cvnfcCustomizationUuid).build().toString()));
+ public CvnfcCustomization getCvnfcCustomizationByCustomizationUUID(String cvnfcCustomizationUuid){
+ return this.getSingleResource(cvnfcCustomizationClient,getUri(UriBuilder
+ .fromUri(endpoint + "/cvnfcCustomization/search/findOneByModelCustomizationUUID").queryParam("modelCustomizationUuid", cvnfcCustomizationUuid)
+ .build().toString()));
+ }
+
+ //fetch all VnfVfmoduleCvnfcConfigurationCustomization underneath a vnfc
+ //find the VnfVfmoduleCvnfcConfigurationCustomization that is related to our vnf and our vf-module, filter all others.
+ public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(
+ String vnfCustomizationUuid, String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) {
+ CvnfcCustomization cvnfc = getCvnfcCustomizationByCustomizationUUID(cvnfcCustomizationUuid);
+ if (cvnfc != null) {
+ for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfModuleCvnfcCust: cvnfc.getVnfVfmoduleCvnfcConfigurationCustomization()){
+ if(vnfVfModuleCvnfcCust.getVnfResourceCustomization().getModelCustomizationUUID().equals(vnfCustomizationUuid) &&
+ vnfVfModuleCvnfcCust.getVfModuleCustomization().getModelCustomizationUUID().equals(vfModuleCustomizationUuid)){
+ return vnfVfModuleCvnfcCust;
+ }
+ }
+ }
+ return null;
+
}
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java
index 8252b2427e..7527a79842 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java
@@ -21,11 +21,8 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-import java.util.List;
-
@RepositoryRestResource(collectionResourceRel = "pnfResourceCustomization", path = "pnfResourceCustomization")
public interface PnfCustomizationRepository extends JpaRepository<PnfResourceCustomization, String> {
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java
index 17ae017da4..525c628e1c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,6 @@
package org.onap.so.db.catalog.data.repository;
import java.util.List;
-
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
@@ -29,11 +28,13 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "vnfResourceCustomization", path = "vnfResourceCustomization")
public interface VnfCustomizationRepository extends JpaRepository<VnfResourceCustomization, String> {
- List<VnfResourceCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
- VnfResourceCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid);
+ List<VnfResourceCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
+
+ VnfResourceCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid);
- @Query(value = "SELECT * FROM vnf_resource_customization WHERE MODEL_INSTANCE_NAME = ?1 AND VNF_RESOURCE_MODEL_UUID = ?2 LIMIT 1;", nativeQuery = true)
- VnfResourceCustomization findByModelInstanceNameAndVnfResources(String modelInstanceName, String vnfResourceModelUUID);
+ @Query(value = "SELECT * FROM vnf_resource_customization WHERE MODEL_INSTANCE_NAME = ?1 AND VNF_RESOURCE_MODEL_UUID = ?2 LIMIT 1;", nativeQuery = true)
+ VnfResourceCustomization findByModelInstanceNameAndVnfResources(String modelInstanceName,
+ String vnfResourceModelUUID);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java
index aad75a15be..8664c1e2bc 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java
@@ -20,21 +20,11 @@
package org.onap.so.db.catalog.data.repository;
-import java.util.List;
-
import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "vnfVfmoduleCvnfcConfigurationCustomization", path = "vnfVfmoduleCvnfcConfigurationCustomization")
public interface VnfVfmoduleCvnfcConfigurationCustomizationRepository extends JpaRepository<VnfVfmoduleCvnfcConfigurationCustomization, Integer> {
- List<VnfVfmoduleCvnfcConfigurationCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
-
- @Query(value = "SELECT * FROM vnf_vfmodule_cvnfc_configuration_customization WHERE VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID = ?1 AND VF_MODULE_MODEL_CUSTOMIZATION_UUID = ?2 AND CVNFC_MODEL_CUSTOMIZATION_UUID = ?3", nativeQuery = true)
- VnfVfmoduleCvnfcConfigurationCustomization findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization (
- @Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomizationUuid,
- @Param("VF_MODULE_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomizationUuid,
- @Param("CVNFC_MODEL_CUSTOMIZATION_UUID") String cvnfcCustomizationUuid);
+
} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
index 8de5366ff3..4b6598427e 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
@@ -309,6 +309,8 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
vnfVfmoduleCvnfcConfigurationCustomizationSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet);
+ vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet);
+ vnfResourceCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet);
cvnfcCustomizationRepository.save(cvnfcCustomization);
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
index c5e95fcfbc..7ac80e222f 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
@@ -20,7 +20,6 @@
package org.onap.so.db.catalog.data.repository;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
@@ -29,9 +28,6 @@ import org.onap.so.db.catalog.beans.PnfResource;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
-
-import java.util.List;
public class PnfCustomizationRepositoryTest extends BaseTest {
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java
index 8e2e1e0446..be21ea9b35 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import java.util.List;
import org.junit.Test;
import org.onap.so.db.catalog.BaseTest;
import org.onap.so.db.catalog.beans.VnfResource;
@@ -30,8 +31,6 @@ import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
-import java.util.List;
-
public class VnfCustomizationRepositoryTest extends BaseTest {
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
deleted file mode 100644
index a953fc8a3c..0000000000
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
+++ /dev/null
@@ -1,133 +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.db.catalog.data.repository;
-
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.so.db.catalog.BaseTest;
-import org.onap.so.db.catalog.beans.ConfigurationResource;
-import org.onap.so.db.catalog.beans.CvnfcCustomization;
-import org.onap.so.db.catalog.beans.VfModule;
-import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
-import org.onap.so.db.catalog.beans.VnfcCustomization;
-import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends BaseTest {
- @Autowired
- private VnfVfmoduleCvnfcConfigurationCustomizationRepository vnfVfmoduleCvnfcConfigurationCustomizationRepository;
- @Autowired
- private CvnfcCustomizationRepository cvnfcCustomizationRepository;
-
- @Test
- public void findAllTest() throws Exception {
- List<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationList = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findAll();
- Assert.assertFalse(CollectionUtils.isEmpty(vnfVfmoduleCvnfcConfigurationCustomizationList));
-
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
- vnfVfmoduleCvnfcConfigurationCustomizationRepository.findById(1).orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
-
-
- Assert.assertTrue(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equalsIgnoreCase("testConfigurationFunction"));
- }
-
- @Test
- @Transactional
- public void createAndGetTest() throws Exception {
-
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
- vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
- vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("testModelInstanceName");
- vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationType("testConfigurationType");
- vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationRole("testConfigurationRole");
- vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("testConfigurationFunction");
- vnfVfmoduleCvnfcConfigurationCustomization.setPolicyName("testPolicyName");
-
- ConfigurationResource configurationResource = new ConfigurationResource();
- configurationResource.setModelUUID("98b42780-9f13-11e8-98d0-529269fb1459");
- configurationResource.setModelInvariantUUID("c9338d1a-9f13-11e8-98d0-529269fb1459");
- configurationResource.setModelVersion("testModelVertsion");
- configurationResource.setModelName("testModelName");
- configurationResource.setToscaNodeType("testToscaNodeType");
- configurationResource.setDescription("testConfigurationDescription");
- vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
-
- CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
- cvnfcCustomization.setModelCustomizationUUID("0c3a8b76-3f5b-11e9-b210-d663bd873d93");
-
- VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
- vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
-
- VfModule vFModule = setUpVfModule();
- VnfResource vnfResource = setUpVnfResource();
-
- vFModule.setVnfResources(vnfResource);
- vfModuleCustomization.setVfModule(vFModule);
- cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
-
- VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
- vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
- vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
-
- List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
- vnfResourceCustomizations.add(vnfResourceCustomization);
- vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
- vnfResourceCustomization.setVnfResources(vnfResource);
-
- cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
-
- VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
- vnfcCustomization.setModelCustomizationUUID("0aa015ea-9ff3-11e8-98d0-529269fb1459");
- cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
-
- cvnfcCustomizationRepository.save(cvnfcCustomization);
-
- vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
- vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization);
- vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization);
-
- vnfVfmoduleCvnfcConfigurationCustomizationRepository.save(vnfVfmoduleCvnfcConfigurationCustomization);
-
- VnfVfmoduleCvnfcConfigurationCustomization foundVnfVfmoduleCvnfcConfigurationCustomization =
- vnfVfmoduleCvnfcConfigurationCustomizationRepository.findById(1).orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
-
-
- if(foundVnfVfmoduleCvnfcConfigurationCustomization == null)
- fail("should not be null");
-
- VnfVfmoduleCvnfcConfigurationCustomization foundOneVnfVfmoduleCvnfcConfigurationCustomization =
- vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization("cf9f6efc-9f14-11e8-98d0-529269fb1459", "cf9f6efc-9f14-11e8-98d0-529269fb1459", "0c3a8b76-3f5b-11e9-b210-d663bd873d93");
-
- if(foundOneVnfVfmoduleCvnfcConfigurationCustomization == null)
- fail("should not be null");
- Assert.assertTrue(foundOneVnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equalsIgnoreCase("testConfigurationFunction"));
- }
-} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index a59137d023..ffd126545d 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -736,9 +736,7 @@ VALUES ( '1',
INSERT INTO vnf_vfmodule_cvnfc_configuration_customization
(id,
model_customization_uuid,
- vnf_resource_cust_model_customization_uuid,
- vf_module_model_customization_uuid,
- cvnfc_model_customization_uuid,
+ CVNFC_CUSTOMIZATION_ID,
model_instance_name,
configuration_type,
configuration_role,
@@ -748,9 +746,7 @@ INSERT INTO vnf_vfmodule_cvnfc_configuration_customization
configuration_model_uuid)
VALUES ( '1',
'7bcce658-9b37-11e8-98d0-529269fb1450',
- '68dc9a92-214c-11e7-93ae-92361f002671',
- 'cb82ffd8-252a-11e7-93ae-92361f002671',
- '9bcce658-9b37-11e8-98d0-529269fb1459',
+ '1',
'testModelInstanceName',
'testConfigurationType',
'testConfigurationRole',
diff --git a/mso-catalog-db/src/test/resources/logback-test.xml b/mso-catalog-db/src/test/resources/logback-test.xml
index 0bf39bdad1..68e4fcf64d 100644
--- a/mso-catalog-db/src/test/resources/logback-test.xml
+++ b/mso-catalog-db/src/test/resources/logback-test.xml
@@ -39,9 +39,14 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <logger name="org.onap" level="DEBUG" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
+
+ <logger name="org.hibernate" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
<root level="info">
<appender-ref ref="STDOUT" />
</root>
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 6bd9baee80..7068ef9ba5 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -893,64 +893,70 @@ AUTO_INCREMENT = 20654
DEFAULT CHARACTER SET = latin1;
CREATE TABLE IF NOT EXISTS cvnfc_customization (
-`ID` INT(11) NOT NULL AUTO_INCREMENT,
-`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
-`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
-`MODEL_UUID` VARCHAR(200) NOT NULL,
-`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
-`MODEL_VERSION` VARCHAR(20) NOT NULL,
-`MODEL_NAME` VARCHAR(200) NOT NULL,
-`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
-`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
-`NFC_FUNCTION` VARCHAR(200) NULL,
-`NFC_NAMING_CODE` VARCHAR(200) NULL,
-`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
-`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
-`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
-`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
-DELETE CASCADE ON
-UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
-DELETE CASCADE ON
-UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
-DELETE CASCADE ON
-UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1;
-
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `MODEL_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_VERSION` VARCHAR(20) NOT NULL,
+ `MODEL_NAME` VARCHAR(200) NOT NULL,
+ `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+ `NFC_FUNCTION` VARCHAR(200) NULL,
+ `NFC_NAMING_CODE` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ UNIQUE INDEX `UK_cvnfc_customization` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1;
CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
- `ID` INT(11) NOT NULL AUTO_INCREMENT,
- `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
- `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
- `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
- `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
- `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
- `CONFIGURATION_TYPE` VARCHAR(200) NULL,
- `CONFIGURATION_ROLE` VARCHAR(200) NULL,
- `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
- `POLICY_NAME` VARCHAR(200) NULL,
- `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
- PRIMARY KEY (`ID`),
- INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
- UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC),
- INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC),
- INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC),
- INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC),
- CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
- REFERENCES `configuration` (`MODEL_UUID`)
- ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`)
- REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`)
- ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`)
- REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`)
- ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`)
- REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`)
- ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1;
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `CONFIGURATION_TYPE` VARCHAR(200) NULL,
+ `CONFIGURATION_ROLE` VARCHAR(200) NULL,
+ `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
+ `POLICY_NAME` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) DEFAULT NULL,
+ `CVNFC_CUSTOMIZATION_ID` INT(11) DEFAULT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
+
+ CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1;
CREATE TABLE IF NOT EXISTS `pnf_resource` (
- `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT',
+ `ORCHESTRATION_MODE` varchar(20) DEFAULT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODEL_UUID` varchar(200) NOT NULL,
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
index de446b734a..cf50868ca5 100644
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
+++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
@@ -11,7 +11,7 @@ ENV https_proxy=$HTTPS_PROXY
RUN apk update && apk upgrade
# Install commonly needed tools
-RUN apk --no-cache add curl netcat-openbsd sudo
+RUN apk --no-cache add curl netcat-openbsd sudo nss
# Create 'so' user
RUN addgroup -g 1000 so && adduser -S -u 1000 -G so -s /bin/sh so
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java
deleted file mode 100644
index 34afd825cb..0000000000
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-package org.onap.so.monitoring.configuration.rest;
-
-import java.io.IOException;
-
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpRequest;
-import org.springframework.http.client.ClientHttpRequestExecution;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
-
-/**
- * @author waqas.ikram@ericsson.com
- *
- */
-public class BasicAuthorizationHttpRequestInterceptor implements ClientHttpRequestInterceptor {
-
- private final String authorization;
-
- public BasicAuthorizationHttpRequestInterceptor(final String authorization) {
- this.authorization = authorization;
- }
-
- @Override
- public ClientHttpResponse intercept(final HttpRequest request, final byte[] body,
- final ClientHttpRequestExecution execution) throws IOException {
- final HttpHeaders headers = request.getHeaders();
- headers.add("Authorization", authorization);
- return execution.execute(request, body);
- }
-}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java
index a590d7908f..11c4d1b4f4 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java
@@ -19,17 +19,17 @@
*/
package org.onap.so.monitoring.configuration.rest;
-import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.CAMUNDA_REST_TEMPLATE;
-import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.DATABASE_REST_TEMPLATE;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProvider;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProviderImpl;
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.web.client.RestTemplate;
/**
@@ -45,28 +45,22 @@ public class HttpServiceProviderConfiguration {
@Bean
@Qualifier(CAMUNDA_HTTP_REST_SERVICE_PROVIDER)
public HttpRestServiceProvider camundaHttpRestServiceProvider(
- @Qualifier(CAMUNDA_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
@Value(value = "${camunda.rest.api.auth:#{null}}") final String authorization) {
- return getHttpRestServiceProvider(restTemplate, authorization);
+ return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(authorization));
}
@Bean
@Qualifier(DATABASE_HTTP_REST_SERVICE_PROVIDER)
public HttpRestServiceProvider databaseHttpRestServiceProvider(
- @Qualifier(DATABASE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
@Value(value = "${mso.database.rest.api.auth:#{null}}") final String authorization) {
-
- return getHttpRestServiceProvider(restTemplate, authorization);
+ return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(authorization));
}
private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
- final String authorization) {
- if (authorization != null && !authorization.isEmpty()) {
- final ClientHttpRequestInterceptor authorizationInterceptor =
- new BasicAuthorizationHttpRequestInterceptor(authorization);
- restTemplate.getInterceptors().add(authorizationInterceptor);
- }
- return new HttpRestServiceProviderImpl(restTemplate);
+ final HttpHeadersProvider httpHeadersProvider) {
+ return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java
index 6be6367302..49e3d4f92f 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java
@@ -30,7 +30,7 @@ import org.onap.so.monitoring.camunda.model.SoActiveInfraRequests;
import org.onap.so.monitoring.configuration.database.DatabaseUrlProvider;
import org.onap.so.monitoring.model.SoInfraRequest;
import org.onap.so.monitoring.model.SoInfraRequestBuilder;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
@@ -60,7 +60,7 @@ public class DatabaseServiceProviderImpl implements DatabaseServiceProvider {
final String url = urlProvider.getSearchUrl(startTime, endTime, maxResult);
final Optional<SoActiveInfraRequests[]> optionalRequests =
- httpRestServiceProvider.postHttpRequest(filters, url, SoActiveInfraRequests[].class);
+ httpRestServiceProvider.post(filters, url, SoActiveInfraRequests[].class);
if (optionalRequests.isPresent()) {
return getSoInfraRequest(optionalRequests.get());
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java
index e6fbb68456..b7a439fc28 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java
@@ -35,15 +35,15 @@ import org.onap.so.monitoring.model.ProcessDefinitionDetail;
import org.onap.so.monitoring.model.ProcessInstanceDetail;
import org.onap.so.monitoring.model.ProcessInstanceIdDetail;
import org.onap.so.monitoring.model.ProcessInstanceVariableDetail;
+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.stereotype.Service;
import com.google.common.base.Optional;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* @author waqas.ikram@ericsson.com
*/
@@ -64,13 +64,12 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
@Override
public Optional<ProcessInstanceIdDetail> getProcessInstanceIdDetail(final String requestId) {
final String url = urlProvider.getHistoryProcessInstanceUrl(requestId);
- final Optional<ProcessInstance[]> processInstances =
- httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class);
+ final Optional<ProcessInstance[]> processInstances = httpRestServiceProvider.get(url, ProcessInstance[].class);
if (processInstances.isPresent()) {
final ProcessInstance[] instances = processInstances.get();
- final String message = "found process instance for request id: " + requestId +
- ", result size: " + instances.length;
+ final String message =
+ "found process instance for request id: " + requestId + ", result size: " + instances.length;
LOGGER.debug(message);
if (instances.length > 0) {
@@ -79,8 +78,8 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
if (processInstance.getSuperProcessInstanceId() == null) {
return Optional.of(new ProcessInstanceIdDetail(processInstance.getId()));
}
- LOGGER.debug("found sub process instance id with super process instanceId: " +
- processInstance.getSuperProcessInstanceId());
+ LOGGER.debug("found sub process instance id with super process instanceId: "
+ + processInstance.getSuperProcessInstanceId());
}
}
}
@@ -91,8 +90,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
@Override
public Optional<ProcessInstanceDetail> getSingleProcessInstanceDetail(final String processInstanceId) {
final String url = urlProvider.getSingleProcessInstanceUrl(processInstanceId);
- final Optional<ProcessInstance> processInstances =
- httpRestServiceProvider.getHttpResponse(url, ProcessInstance.class);
+ final Optional<ProcessInstance> processInstances = httpRestServiceProvider.get(url, ProcessInstance.class);
if (processInstances.isPresent()) {
final ProcessInstance processInstance = processInstances.get();
@@ -111,8 +109,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
@Override
public Optional<ProcessDefinitionDetail> getProcessDefinition(final String processDefinitionId) {
final String url = urlProvider.getProcessDefinitionUrl(processDefinitionId);
- final Optional<ProcessDefinition> response =
- httpRestServiceProvider.getHttpResponse(url, ProcessDefinition.class);
+ final Optional<ProcessDefinition> response = httpRestServiceProvider.get(url, ProcessDefinition.class);
if (response.isPresent()) {
final ProcessDefinition processDefinition = response.get();
final String xmlDefinition = processDefinition.getBpmn20Xml();
@@ -120,16 +117,14 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
return Optional.of(new ProcessDefinitionDetail(processDefinitionId, xmlDefinition));
}
}
- LOGGER.error("Unable to find process definition for processDefinitionId: " +
- processDefinitionId);
+ LOGGER.error("Unable to find process definition for processDefinitionId: " + processDefinitionId);
return Optional.absent();
}
@Override
public List<ActivityInstanceDetail> getActivityInstance(final String processInstanceId) {
final String url = urlProvider.getActivityInstanceUrl(processInstanceId);
- final Optional<ActivityInstance[]> response =
- httpRestServiceProvider.getHttpResponse(url, ActivityInstance[].class);
+ final Optional<ActivityInstance[]> response = httpRestServiceProvider.get(url, ActivityInstance[].class);
if (response.isPresent()) {
final ActivityInstance[] activityInstances = response.get();
final List<ActivityInstanceDetail> activityInstanceDetails = new ArrayList<>(activityInstances.length);
@@ -148,8 +143,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
}
return activityInstanceDetails;
}
- LOGGER.error("Unable to find activity intance detail for process instance id: " +
- processInstanceId);
+ LOGGER.error("Unable to find activity intance detail for process instance id: " + processInstanceId);
return Collections.emptyList();
}
@@ -157,7 +151,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
public List<ProcessInstanceVariableDetail> getProcessInstanceVariable(final String processInstanceId) {
final String url = urlProvider.getProcessInstanceVariablesUrl(processInstanceId);
final Optional<ProcessInstanceVariable[]> response =
- httpRestServiceProvider.getHttpResponse(url, ProcessInstanceVariable[].class);
+ httpRestServiceProvider.get(url, ProcessInstanceVariable[].class);
if (response.isPresent()) {
final ProcessInstanceVariable[] instanceVariables = response.get();
final List<ProcessInstanceVariableDetail> instanceVariableDetails =
@@ -171,8 +165,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
}
return instanceVariableDetails;
}
- LOGGER.error("Unable to find process intance variable details for process instance id: "
- + processInstanceId);
+ LOGGER.error("Unable to find process intance variable details for process instance id: " + processInstanceId);
return Collections.emptyList();
}
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java
index 1b3e168c12..9df24c1921 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.onap.so.monitoring.configuration.rest.HttpServiceProviderConfiguration;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
import org.springframework.web.client.RestTemplate;
/**
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java
index 58666671a7..3a7ce18bf7 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java
@@ -38,7 +38,7 @@ import org.onap.so.monitoring.configuration.database.DatabaseUrlProvider;
import org.onap.so.monitoring.db.service.DatabaseServiceProvider;
import org.onap.so.monitoring.db.service.DatabaseServiceProviderImpl;
import org.onap.so.monitoring.model.SoInfraRequest;
-import org.onap.so.monitoring.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
import com.google.common.base.Optional;
@@ -57,8 +57,8 @@ public class DatabaseServiceProviderTest {
final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null);
final Optional<SoActiveInfraRequests[]> response = Optional.of(new SoActiveInfraRequests[] {});
- when(mockServiceProvider.postHttpRequest(eq(Collections.emptyMap()), eq(searchUrl),
- eq(SoActiveInfraRequests[].class))).thenReturn(response);
+ when(mockServiceProvider.post(eq(Collections.emptyMap()), eq(searchUrl), eq(SoActiveInfraRequests[].class)))
+ .thenReturn(response);
final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider);
@@ -71,8 +71,8 @@ public class DatabaseServiceProviderTest {
final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null);
final Optional<SoActiveInfraRequests[]> response = Optional.absent();
- when(mockServiceProvider.postHttpRequest(eq(Collections.emptyMap()), eq(searchUrl),
- eq(SoActiveInfraRequests[].class))).thenReturn(response);
+ when(mockServiceProvider.post(eq(Collections.emptyMap()), eq(searchUrl), eq(SoActiveInfraRequests[].class)))
+ .thenReturn(response);
final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider);
@@ -94,7 +94,7 @@ public class DatabaseServiceProviderTest {
final HttpRestServiceProvider mockServiceProvider = mock(HttpRestServiceProvider.class);
- when(mockServiceProvider.postHttpRequest(eq(filters), eq(searchUrl), eq(SoActiveInfraRequests[].class)))
+ when(mockServiceProvider.post(eq(filters), eq(searchUrl), eq(SoActiveInfraRequests[].class)))
.thenReturn(response);
final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider);
diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java
index c3930df196..d21cf6d02b 100644
--- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java
+++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java
@@ -38,6 +38,7 @@ import org.onap.so.monitoring.model.ActivityInstanceDetail;
import org.onap.so.monitoring.model.ProcessDefinitionDetail;
import org.onap.so.monitoring.model.ProcessInstanceIdDetail;
import org.onap.so.monitoring.model.ProcessInstanceVariableDetail;
+import org.onap.so.rest.service.HttpRestServiceProvider;
import com.google.common.base.Optional;
@@ -65,7 +66,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessInstanceDetail_EmptyResponse() {
final Optional<ProcessInstance[]> response = Optional.<ProcessInstance[]>absent();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -77,7 +78,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessInstanceDetail_NonEmptyResponseWithSuperProcessIdNull() {
final Optional<ProcessInstance[]> response = Optional.of(getProcessInstance());
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -92,7 +93,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessInstanceDetail_NonEmptyResponseWithSuperProcessIdNotNull() {
final Optional<ProcessInstance[]> response = Optional.of(getProcessInstance(SUPER_PROCESS_ID));
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -105,7 +106,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessDefinition_EmptyResponse() {
final Optional<ProcessDefinition> response = Optional.<ProcessDefinition>absent();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/process-definition/" + ID + "/xml";
- when(httpRestServiceProvider.getHttpResponse(url, ProcessDefinition.class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessDefinition.class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -117,7 +118,7 @@ public class CamundaProcessDataServiceProviderTest {
public void test_GetProcessDefinition_NonEmptyResponse() {
final Optional<ProcessDefinition> response = getProcessDefinition();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/process-definition/" + PROCESS_ID + "/xml";
- when(httpRestServiceProvider.getHttpResponse(url, ProcessDefinition.class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessDefinition.class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -132,7 +133,7 @@ public class CamundaProcessDataServiceProviderTest {
final Optional<ActivityInstance[]> response = Optional.<ActivityInstance[]>absent();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/activity-instance?processInstanceId=" + PROCESS_ID
+ "&sortBy=startTime&sortOrder=asc";
- when(httpRestServiceProvider.getHttpResponse(url, ActivityInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ActivityInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -146,7 +147,7 @@ public class CamundaProcessDataServiceProviderTest {
final Optional<ActivityInstance[]> response = getActivityInstance();
final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/activity-instance?processInstanceId=" + PROCESS_ID
+ "&sortBy=startTime&sortOrder=asc";
- when(httpRestServiceProvider.getHttpResponse(url, ActivityInstance[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ActivityInstance[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -164,7 +165,7 @@ public class CamundaProcessDataServiceProviderTest {
final Optional<ProcessInstanceVariable[]> response = Optional.<ProcessInstanceVariable[]>absent();
final String url =
CAMUNDA_REST_API_URL + DEFAULT + "/history/variable-instance?processInstanceId=" + PROCESS_ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstanceVariable[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstanceVariable[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
@@ -178,7 +179,7 @@ public class CamundaProcessDataServiceProviderTest {
final Optional<ProcessInstanceVariable[]> response = getProcessInstanceVariable();
final String url =
CAMUNDA_REST_API_URL + DEFAULT + "/history/variable-instance?processInstanceId=" + PROCESS_ID;
- when(httpRestServiceProvider.getHttpResponse(url, ProcessInstanceVariable[].class)).thenReturn(response);
+ when(httpRestServiceProvider.get(url, ProcessInstanceVariable[].class)).thenReturn(response);
final CamundaProcessDataServiceProvider objUnderTest =
new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider);
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
index 155b4e65a4..d2fa08fdfd 100644
--- a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
+++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
@@ -33,8 +33,6 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.onap.so.monitoring.db.service.DatabaseServiceProvider;
-import org.onap.so.monitoring.exception.InvalidRestRequestException;
-import org.onap.so.monitoring.exception.RestProcessingException;
import org.onap.so.monitoring.model.ActivityInstanceDetail;
import org.onap.so.monitoring.model.ProcessDefinitionDetail;
import org.onap.so.monitoring.model.ProcessInstanceDetail;
@@ -42,14 +40,15 @@ import org.onap.so.monitoring.model.ProcessInstanceIdDetail;
import org.onap.so.monitoring.model.ProcessInstanceVariableDetail;
import org.onap.so.monitoring.model.SoInfraRequest;
import org.onap.so.monitoring.rest.service.CamundaProcessDataServiceProvider;
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.base.Optional;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* @author waqas.ikram@ericsson.com
*/
@@ -134,8 +133,7 @@ public class SoMonitoringController {
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getProcessDefinitionXml(final @PathParam("processDefinitionId") String processDefinitionId) {
if (processDefinitionId == null || processDefinitionId.isEmpty()) {
- return Response.status(Status.BAD_REQUEST).entity("Invalid process definition id: " +
- processDefinitionId)
+ return Response.status(Status.BAD_REQUEST).entity("Invalid process definition id: " + processDefinitionId)
.build();
}
try {
@@ -145,18 +143,15 @@ public class SoMonitoringController {
final ProcessDefinitionDetail definitionDetail = response.get();
return Response.status(Status.OK).entity(definitionDetail).build();
}
- LOGGER.error("Unable to find process definition xml for processDefinitionId: " +
- processDefinitionId);
+ LOGGER.error("Unable to find process definition xml for processDefinitionId: " + processDefinitionId);
return Response.status(Status.NO_CONTENT).build();
} catch (final InvalidRestRequestException extensions) {
final String message =
- "Unable to find process definition xml for processDefinitionId: {}" +
- processDefinitionId;
+ "Unable to find process definition xml for processDefinitionId: {}" + processDefinitionId;
return Response.status(Status.BAD_REQUEST).entity(message).build();
} catch (final RestProcessingException restProcessingException) {
- final String message = "Unable to get process definition xml for id: " +
- processDefinitionId;
+ final String message = "Unable to get process definition xml for id: " + processDefinitionId;
LOGGER.error(message);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build();
}
@@ -175,13 +170,11 @@ public class SoMonitoringController {
camundaProcessDataServiceProvider.getActivityInstance(processInstanceId);
return Response.status(Status.OK).entity(activityInstanceDetails).build();
} catch (final InvalidRestRequestException extensions) {
- final String message = "Unable to find activity instance for processInstanceId: " +
- processInstanceId;
+ final String message = "Unable to find activity instance for processInstanceId: " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.BAD_REQUEST).entity(message).build();
} catch (final RestProcessingException restProcessingException) {
- final String message = "Unable to get activity instance detail for id: " +
- processInstanceId;
+ final String message = "Unable to get activity instance detail for id: " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build();
}
@@ -201,13 +194,11 @@ public class SoMonitoringController {
return Response.status(Status.OK).entity(processInstanceVariable).build();
} catch (final InvalidRestRequestException extensions) {
final String message =
- "Unable to find process instance variables for processInstanceId: " +
- processInstanceId;
+ "Unable to find process instance variables for processInstanceId: " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.BAD_REQUEST).entity(message).build();
} catch (final RestProcessingException restProcessingException) {
- final String message = "Unable to get process instance variables for id: " +
- processInstanceId;
+ final String message = "Unable to get process instance variables for id: " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build();
}
@@ -230,13 +221,13 @@ public class SoMonitoringController {
return Response.status(Status.OK).entity(requests).build();
} catch (final InvalidRestRequestException extensions) {
- final String message = "Unable to search request for filters: " + filters + ", from: " +
- startTime + ", to: " + endTime + ", maxResult: " + maxResult;
+ final String message = "Unable to search request for filters: " + filters + ", from: " + startTime
+ + ", to: " + endTime + ", maxResult: " + maxResult;
LOGGER.error(message);
return Response.status(Status.BAD_REQUEST).entity(message).build();
} catch (final RestProcessingException restProcessingException) {
- final String message = "Unable to search request for filters: " + filters + ", from: " +
- startTime + ", to: " + endTime + ", maxResult: " + maxResult;
+ final String message = "Unable to search request for filters: " + filters + ", from: " + startTime
+ + ", to: " + endTime + ", maxResult: " + maxResult;
LOGGER.error(message);
return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build();
}
diff --git a/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java b/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java
index 3ca184ebaa..2c4d036397 100644
--- a/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java
+++ b/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java
@@ -22,8 +22,8 @@ package org.onap.so.monitoring.rest.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.CAMUNDA_REST_TEMPLATE;
-import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.DATABASE_REST_TEMPLATE;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.onap.so.configuration.rest.BasicHttpHeadersProvider.AUTHORIZATION_HEADER;
import static org.onap.so.monitoring.rest.api.Constants.ACTIVITY_INSTANCE_RESPONSE_JSON_FILE;
import static org.onap.so.monitoring.rest.api.Constants.EMPTY_ARRAY_RESPONSE;
import static org.onap.so.monitoring.rest.api.Constants.EMPTY_STRING;
@@ -37,6 +37,7 @@ import static org.onap.so.monitoring.rest.api.Constants.PROCRESS_DEF_ID;
import static org.onap.so.monitoring.rest.api.Constants.SEARCH_RESULT_RESPONSE_JSON_FILE;
import static org.onap.so.monitoring.rest.api.Constants.SINGLE_PROCCESS_INSTANCE_RESPONSE_JSON_FILE;
import static org.onap.so.monitoring.rest.api.Constants.START_TIME_IN_MS;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.header;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withBadRequest;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
@@ -81,14 +82,14 @@ import org.springframework.web.client.RestTemplate;
@ActiveProfiles("test")
@SpringBootTest
public class SoMonitoringControllerTest {
+ private static final String CAMUNDA_BASIC_AUTH =
+ "Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==";
- @Autowired
- @Qualifier(CAMUNDA_REST_TEMPLATE)
- private RestTemplate restTemplate;
+ private static final String DATABASE_BASIC_AUTH = "Basic YnBlbDpwYXNzd29yZDEk";
@Autowired
- @Qualifier(DATABASE_REST_TEMPLATE)
- private RestTemplate dataBaseRestTemplate;
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ private RestTemplate restTemplate;
@Autowired
private CamundaRestUrlProvider urlProvider;
@@ -96,23 +97,22 @@ public class SoMonitoringControllerTest {
@Autowired
private DatabaseUrlProvider databaseUrlProvider;
- private MockRestServiceServer camundaMockServer;
+ private MockRestServiceServer mockRestServiceServer;
- private MockRestServiceServer databaseMockServer;
@Autowired
private SoMonitoringController objUnderTest;
@Before
public void setUp() throws Exception {
- camundaMockServer = MockRestServiceServer.bindTo(restTemplate).build();
- databaseMockServer = MockRestServiceServer.bindTo(dataBaseRestTemplate).build();
+ mockRestServiceServer = MockRestServiceServer.bindTo(restTemplate).build();
}
@Test
public void test_GetProcessInstance_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(PROCCESS_INSTANCE_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ .andExpect(header(AUTHORIZATION_HEADER, CAMUNDA_BASIC_AUTH))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessInstanceId(ID);
@@ -125,7 +125,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstance_SuccessResponseWithEmptyDataFromCamunda() throws Exception {
final String jsonString = EMPTY_ARRAY_RESPONSE;
- this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessInstanceId(ID);
@@ -135,7 +135,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstance_FailureResponseWithEmptyDataFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getProcessInstanceId(ID);
@@ -144,7 +144,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstance_UnauthorizedRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getProcessInstanceId(ID);
@@ -155,7 +155,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetSinlgeProcessInstance_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(SINGLE_PROCCESS_INSTANCE_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getSingleProcessInstance(PROCESS_INSTACE_ID);
@@ -171,7 +171,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetSingleProcessInstance_WithBadRequestResponseFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getSingleProcessInstance(PROCESS_INSTACE_ID);
@@ -181,7 +181,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetSingleProcessInstance_WithUnauthorizedRequestResponseFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getSingleProcessInstance(PROCESS_INSTACE_ID);
@@ -216,7 +216,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessDefinitionXml_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(PROCESS_DEF_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessDefinitionXml(PROCRESS_DEF_ID);
@@ -228,7 +228,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessDefinitionXml_BadRequestResponseFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getProcessDefinitionXml(PROCRESS_DEF_ID);
@@ -238,7 +238,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessDefinitionXml_UnauthorizedRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getProcessDefinitionXml(PROCRESS_DEF_ID);
@@ -260,7 +260,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetActivityInstanceDetail_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(ACTIVITY_INSTANCE_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID);
@@ -287,7 +287,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetActivityInstanceDetail_SuccessResponseWithEmptyDataFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(EMPTY_ARRAY_RESPONSE, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID);
@@ -297,7 +297,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetActivityInstanceDetail_UnauthorizedRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID);
@@ -307,7 +307,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetActivityInstanceDetail_BadRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID);
@@ -329,7 +329,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstanceVariables_SuccessResponseWithDataFromCamunda() throws Exception {
final String jsonString = getJsonResponse(PROCESS_INSTANCE_VARIABLES_RESPONSE_JSON_FILE);
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID);
@@ -347,7 +347,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstanceVariables_SuccessResponseWithEmptyDataFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
.andRespond(withSuccess(EMPTY_ARRAY_RESPONSE, MediaType.APPLICATION_JSON));
final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID);
@@ -358,7 +358,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstanceVariables_BadRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
.andRespond(withBadRequest());
final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID);
@@ -369,7 +369,7 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetProcessInstanceVariables_UnauthorizedRequestFromCamunda() throws Exception {
- this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
+ this.mockRestServiceServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID)))
.andRespond(withUnauthorizedRequest());
final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID);
@@ -396,8 +396,9 @@ public class SoMonitoringControllerTest {
@Test
public void test_GetInfraActiveRequests_SuccessResponseWithSoInfraRequestList() throws Exception {
final String jsonString = getJsonResponse(SEARCH_RESULT_RESPONSE_JSON_FILE);
- this.databaseMockServer
+ this.mockRestServiceServer
.expect(requestTo(databaseUrlProvider.getSearchUrl(START_TIME_IN_MS, END_TIME_IN_MS, null)))
+ .andExpect(header(AUTHORIZATION_HEADER, DATABASE_BASIC_AUTH))
.andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
final Response response =
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
index 8205226f9e..8f2af84b0d 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
@@ -1,138 +1,218 @@
-/**
-============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
- limitations under the License.
-
-SPDX-License-Identifier: Apache-2.0
-============LICENSE_END=========================================================
-
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
-*/
-
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { DetailsComponent } from './details.component';
-import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
-import { RouterTestingModule } from '@angular/router/testing';
-import { MatTableModule } from '@angular/material';
-import { inject } from '@angular/core/testing';
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClient } from '@angular/common/http';
-import { RouterModule } from '@angular/router';
-import { APP_BASE_HREF } from '@angular/common';
-import { ToastrNotificationService } from '../toastr-notification-service.service';
-import { DataService } from '../data.service';
-import { Observable, of } from 'rxjs';
-import { ACTINST } from '../model/activityInstance.model';
-import { PDI } from '../model/processDefinition.model';
-import { PII } from '../model/processInstance.model';
-import { VarInstance } from '../model/variableInstance.model';
-
-// Generate stub for toastr popup notifications
-class StubbedToastrNotificationService extends ToastrNotificationService {
- toastrSettings() {
- }
-}
-
-// Create SPY Object for Jasmine tests to mock DataService
-let spyDataService: jasmine.SpyObj<DataService>;
-
-describe('DetailsComponent', () => {
- beforeEach(async(() => {
- spyDataService = jasmine.createSpyObj('DataService', ['getActivityInstance', 'getVariableInstance']);
-
- TestBed.configureTestingModule({
- providers: [DetailsComponent, HttpClient, HttpTestingController,
- { provide: APP_BASE_HREF, useValue: '/' },
- { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService },
- { provide: DataService, useValue: spyDataService }],
- imports: [RouterTestingModule, MatTableModule, HttpClientModule, RouterModule.forRoot([])],
- schemas: [
- CUSTOM_ELEMENTS_SCHEMA
- ]
- })
- .compileComponents();
- }));
-
- // Ensure creation of DetailsComponent component
- it('component should be created', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- expect(detailsComponent).toBeTruthy();
- }));
-
-
- // Mock an activityInstance and ensure array is populated
- it('activityInstance should be defined if data service returns activities', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- const activity: ACTINST = {
- activityId: "",
- processInstanceId: "",
- calledProcessInstanceId: "",
- activityName: "",
- activityType: "",
- durationInMillis: "1",
- endTime: "",
- startTime: ""
- };
- spyDataService.getActivityInstance.and.returnValue(of([activity]));
- detailsComponent.getActInst("");
- expect(detailsComponent.activityInstance.length).toEqual(1);
- }));
-
-
- // Create a processDefinition and ensure it is defined
- it('processDefinition should be defined if PDI populated', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- const activity: PDI = {
- processDefinitionId: "1",
- processDefinitionXml: ""
- };
- detailsComponent.getProcessDefinition("");
- detailsComponent.processDefinition = activity;
- expect(detailsComponent.processDefinition).toBeDefined();
- }));
-
-
- // Create a processInstance and ensure it is defined
- it('processInstance should be defined if PII populated', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- const testVals: PII = {
- processInstancId: "1",
- processDefinitionId: "1",
- processDefinitionName: "test",
- superProcessInstanceId: "1"
- };
- detailsComponent.getProcInstance("");
- detailsComponent.processInstance = testVals;
- expect(detailsComponent.processInstance).toBeDefined();
- }));
-
-
- // displayCamundaflow test
- // TODO
-
- // Mock an variableInstance and ensure array is populated
- it('variableInstance should be defined if data service returns activities', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- const activity2: VarInstance = {
- name: "a",
- type: "a",
- value: "1"
- };
- spyDataService.getVariableInstance.and.returnValue(of([activity2]));
- detailsComponent.getVarInst("");
- expect(detailsComponent.variableInstance.length).toEqual(1);
- }));
-});
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com, andrei.barcovschi@ericsson.com
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DetailsComponent } from './details.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { RouterTestingModule } from '@angular/router/testing';
+import { MatTableModule } from '@angular/material';
+import { inject } from '@angular/core/testing';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { DataService } from '../data.service';
+import { Observable, of, throwError } from 'rxjs';
+import { ACTINST } from '../model/activityInstance.model';
+import { PDI } from '../model/processDefinition.model';
+import { PII } from '../model/processInstance.model';
+import { VarInstance } from '../model/variableInstance.model';
+import { ActivatedRoute } from '@angular/router';
+import { Params } from '@angular/router';
+
+// Generate stub for toastr popup notifications
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {}
+ info() {}
+ error() {}
+}
+
+const startActivity: ACTINST = {
+ activityId: "StartEvent_1",
+ processInstanceId: "processInstanceId-val-1234",
+ calledProcessInstanceId: "",
+ activityName: "",
+ activityType: "",
+ durationInMillis: "1",
+ endTime: "",
+ startTime: ""
+};
+
+const subProcessActivity: ACTINST = {
+ activityId: "CallActivity_14h26ae",
+ processInstanceId: "processInstanceId-val-1234",
+ calledProcessInstanceId: "1234",
+ activityName: "",
+ activityType: "",
+ durationInMillis: "1",
+ endTime: "",
+ startTime: ""
+};
+
+const processDefinition: PDI = {
+ processDefinitionId: "processDefinitionId-val-1234",
+ processDefinitionXml: "<?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\" id=\"Definitions_01lwydo\" targetNamespace=\"http://bpmn.io/schema/bpmn\" exporter=\"Camunda Modeler\" exporterVersion=\"2.2.4\">" +
+ " <bpmn:process id=\"Process_1\" isExecutable=\"true\">" +
+ " <bpmn:startEvent id=\"StartEvent_1\">" +
+ " <bpmn:outgoing>SequenceFlow_1rrp6qt</bpmn:outgoing>" +
+ " </bpmn:startEvent>" +
+ " <bpmn:callActivity id=\"CallActivity_14h26ae\" name=\"Sub Process\" calledElement=\"DecomposeService\">" +
+ " <bpmn:incoming>SequenceFlow_1rrp6qt</bpmn:incoming>" +
+ " <bpmn:outgoing>SequenceFlow_0yvdjct</bpmn:outgoing>" +
+ " </bpmn:callActivity>" +
+ " <bpmn:sequenceFlow id=\"SequenceFlow_1rrp6qt\" sourceRef=\"StartEvent_1\" targetRef=\"CallActivity_14h26ae\" />" +
+ " <bpmn:endEvent id=\"EndEvent_039q5o1\">" +
+ " <bpmn:incoming>SequenceFlow_0yvdjct</bpmn:incoming>" +
+ " </bpmn:endEvent>" +
+ " <bpmn:sequenceFlow id=\"SequenceFlow_0yvdjct\" sourceRef=\"CallActivity_14h26ae\" targetRef=\"EndEvent_039q5o1\" />" +
+ " </bpmn:process>" +
+ " <bpmndi:BPMNDiagram id=\"BPMNDiagram_1\">" +
+ " <bpmndi:BPMNPlane id=\"BPMNPlane_1\" bpmnElement=\"Process_1\">" +
+ " <bpmndi:BPMNShape id=\"_BPMNShape_StartEvent_2\" bpmnElement=\"StartEvent_1\">" +
+ " <dc:Bounds x=\"173\" y=\"102\" width=\"36\" height=\"36\" />" +
+ " </bpmndi:BPMNShape>" +
+ " <bpmndi:BPMNShape id=\"CallActivity_14h26ae_di\" bpmnElement=\"CallActivity_14h26ae\">" +
+ " <dc:Bounds x=\"267\" y=\"80\" width=\"100\" height=\"80\" />" +
+ " </bpmndi:BPMNShape>" +
+ " <bpmndi:BPMNEdge id=\"SequenceFlow_1rrp6qt_di\" bpmnElement=\"SequenceFlow_1rrp6qt\">" +
+ " <di:waypoint x=\"209\" y=\"120\" />" +
+ " <di:waypoint x=\"267\" y=\"120\" />" +
+ " </bpmndi:BPMNEdge>" +
+ " <bpmndi:BPMNShape id=\"EndEvent_039q5o1_di\" bpmnElement=\"EndEvent_039q5o1\">" +
+ " <dc:Bounds x=\"451\" y=\"102\" width=\"36\" height=\"36\" />" +
+ " </bpmndi:BPMNShape>" +
+ " <bpmndi:BPMNEdge id=\"SequenceFlow_0yvdjct_di\" bpmnElement=\"SequenceFlow_0yvdjct\">" +
+ " <di:waypoint x=\"367\" y=\"120\" />" +
+ " <di:waypoint x=\"451\" y=\"120\" />" +
+ " </bpmndi:BPMNEdge>" +
+ " </bpmndi:BPMNPlane>" +
+ " </bpmndi:BPMNDiagram>" +
+ "</bpmn:definitions>"
+};
+
+const emptyProcessDefinition: PDI = {
+ processDefinitionId: "processDefinitionId-val",
+ processDefinitionXml: ""
+};
+
+const processInstance: PII = {
+ processInstancId: "processInstanceId-val-1234",
+ processDefinitionId: "1",
+ processDefinitionName: "test",
+ superProcessInstanceId: "1"
+};
+
+const varInstanceObj: VarInstance = {
+ name: 'ABC',
+ type: 'Object',
+ value: '{value: 1234}'
+};
+
+const varInstanceStr: VarInstance = {
+ name: 'NameStr',
+ type: 'String',
+ value: 'valOfStr'
+};
+
+describe('DetailsComponent', (displayCamundaflow = {}) => {
+ // Create SPY Object for Jasmine tests to mock DataService
+ let spyDataService: jasmine.SpyObj<DataService>;
+ let component: DetailsComponent;
+ let fixture: ComponentFixture<DetailsComponent>;
+
+ beforeEach(async(() => {
+ spyDataService = jasmine.createSpyObj('DataService', ['getActivityInstance', 'getVariableInstance', 'getProcessDefinition', 'getProcessInstance']);
+
+ TestBed.configureTestingModule({
+ providers: [DetailsComponent, HttpClient, HttpTestingController,
+ { provide: APP_BASE_HREF, useValue: '/' },
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService },
+ { provide: DataService, useValue: spyDataService },
+ { provide: ActivatedRoute, useValue: { params: of({ id: '1234' }) } }],
+ imports: [RouterTestingModule, MatTableModule, HttpClientModule, RouterModule.forRoot([])],
+ declarations: [DetailsComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
+ });
+ fixture = TestBed.createComponent(DetailsComponent);
+ component = fixture.componentInstance;
+ }));
+
+ // Ensure creation of DetailsComponent component
+ it('component should be created', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ expect(detailsComponent).toBeTruthy();
+ }));
+
+ // Create a processInstance and ensure it is defined
+ it('processInstance should be defined if PII populated', async(() => {
+ spyDataService.getActivityInstance.and.returnValue(Promise.resolve([startActivity, subProcessActivity]));
+ spyDataService.getProcessDefinition.and.returnValue(of(processDefinition));
+ spyDataService.getProcessInstance.and.returnValue(Promise.resolve(processInstance));
+ spyDataService.getVariableInstance.and.returnValue(of([varInstanceObj]));
+ component.ngOnInit();
+
+ fixture.whenStable().then(() => {
+ expect(component.processInstance).toBeDefined();
+ });
+ }));
+
+ it('should handle bpmnViewer.importXML error', () => {
+ spyDataService.getActivityInstance.and.returnValue(Promise.resolve([startActivity, subProcessActivity]));
+ spyDataService.getProcessDefinition.and.returnValue(of(emptyProcessDefinition));
+ spyDataService.getProcessInstance.and.returnValue(Promise.resolve(processInstance));
+ spyDataService.getVariableInstance.and.returnValue(of([varInstanceObj]));
+ component.ngOnInit();
+ });
+
+ it('should handle error when dataService.getProcessInstance returns an error', () => {
+ spyDataService.getVariableInstance.and.returnValue(of([varInstanceObj]));
+ spyDataService.getProcessInstance.and.returnValue(Promise.reject(new Error('getProcessInstance Promise should not be resolved')));
+ component.ngOnInit();
+ });
+
+ it('should handle error when data.getVariableInstance returns an error', () => {
+ spyDataService.getActivityInstance.and.returnValue(Promise.resolve([startActivity, subProcessActivity]));
+ spyDataService.getProcessDefinition.and.returnValue(of(processDefinition));
+ spyDataService.getProcessInstance.and.returnValue(Promise.resolve(processInstance));
+ spyDataService.getVariableInstance.and.callFake(() => {
+ return throwError(new Error('getVariableInstance error'));
+ });
+ component.ngOnInit();
+ });
+
+ it('should handle error when data.getActivityInstance and data.getProcessDefinition return errors', () => {
+ spyDataService.getProcessInstance.and.returnValue(Promise.resolve(processInstance));
+ spyDataService.getVariableInstance.and.returnValue(of([varInstanceObj]));
+ spyDataService.getProcessDefinition.and.returnValue(of(processDefinition));
+ spyDataService.getActivityInstance.and.returnValue(Promise.reject(new Error('getActivityInstance Promise should not be resolved')));
+ spyDataService.getProcessDefinition.and.callFake(() => {
+ return throwError(new Error('getProcessDefinition error'));
+ });
+ component.ngOnInit();
+ });
+});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html
index 0c0e1c04c3..39fcdcb293 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html
@@ -30,7 +30,7 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown Filter and TextBox for Service Instance Id -->
<div class="container-home">
<mat-form-field class="selectFilter">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedValueSII" name="sel" placeholder="Select Filter">
+ <mat-select class="formatBox" [(value)]="searchData.selectedValueSII" placeholder="Select Filter">
<mat-option *ngFor="let option of options" [value]="option.value">{{option.name}}</mat-option>
</mat-select>
</mat-form-field>
@@ -42,7 +42,7 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown Filter and TextBox for Request Id -->
<div class="container-home">
<mat-form-field class="selectFilter">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedValueRI" name="sel" placeholder="Select Filter">
+ <mat-select class="formatBox" [(value)]="searchData.selectedValueRI" placeholder="Select Filter">
<mat-option *ngFor="let option of options" [value]="option.value">{{option.name}}</mat-option>
</mat-select>
</mat-form-field>
@@ -59,14 +59,14 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown box for Start Hour selection -->
<mat-form-field class="selectHour">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartHour" name="hourFrom" placeholder="Select Hour">
+ <mat-select class="formatBox" [(value)]="searchData.selectedStartHour" placeholder="Select Hour">
<mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
</mat-select>
</mat-form-field>
<!-- Dropdown box for Start Minute selection -->
<mat-form-field class="selectMinute">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartMinute" name="minuteFrom" placeholder="Select Minute">
+ <mat-select class="formatBox" [(value)]="searchData.selectedStartMinute" placeholder="Select Minute">
<mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
</mat-select>
</mat-form-field>
@@ -75,7 +75,7 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown Filter and TextBox for Service Name -->
<div class="container-home">
<mat-form-field class="selectFilter">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedValueSN" name="sel" placeholder="Select Filter">
+ <mat-select class="formatBox" [(value)]="searchData.selectedValueSN" placeholder="Select Filter">
<mat-option *ngFor="let option of options" [value]="option.value">{{option.name}}</mat-option>
</mat-select>
</mat-form-field>
@@ -92,14 +92,14 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown box for End Hour selection -->
<mat-form-field class="selectHour">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndHour" name="hourTo" placeholder="Select Hour">
+ <mat-select class="formatBox" [(value)]="searchData.selectedEndHour" placeholder="Select Hour">
<mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
</mat-select>
</mat-form-field>
<!-- Dropdown box for End Minute selection -->
<mat-form-field class="selectMinute">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndMinute" name="minuteTo" placeholder="Select Minute">
+ <mat-select class="formatBox" [(value)]="searchData.selectedEndMinute" placeholder="Select Minute">
<mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
</mat-select>
</mat-form-field>
@@ -108,7 +108,7 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown Filter for Status -->
<div class="container-home">
<mat-form-field class="selectFilter">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedValueSTATUS" name="sel" placeholder="Status">
+ <mat-select class="formatBox" [(value)]="searchData.selectedValueSTATUS" placeholder="Status">
<mat-option *ngFor="let statusOption of statusOptions" [value]="statusOption.value">{{ statusOption.name }}</mat-option>
</mat-select>
</mat-form-field>
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
index 1e1485eaca..cc11ebc05d 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
@@ -1,78 +1,178 @@
-/**
-============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
- limitations under the License.
-
-SPDX-License-Identifier: Apache-2.0
-============LICENSE_END=========================================================
-
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
-*/
-
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { HomeComponent } from './home.component';
-import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
-import { MatTableModule } from '@angular/material';
-import { FormsModule } from '@angular/forms';
-import { MatDatepickerModule } from '@angular/material/datepicker';
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClient } from '@angular/common/http';
-import { inject } from '@angular/core/testing';
-import { RouterModule } from '@angular/router';
-import { APP_BASE_HREF } from '@angular/common';
-import { ToastrNotificationService } from '../toastr-notification-service.service';
-import { environment } from '../../environments/environment.prod';
-
-class StubbedToastrNotificationService extends ToastrNotificationService {
- toastrSettings() {
- }
-}
-
-describe('HomeComponent', () => {
- let component: HomeComponent;
- let fixture: ComponentFixture<HomeComponent>;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- providers: [HomeComponent, HttpClient, HttpTestingController,
- { provide: APP_BASE_HREF, useValue: '/' },
- { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
- imports: [MatTableModule, FormsModule, MatDatepickerModule, HttpClientModule, RouterModule.forRoot([])],
- declarations: [HomeComponent],
- schemas: [
- CUSTOM_ELEMENTS_SCHEMA
- ]
- })
- .compileComponents();
- }));
-
- // Ensure creation of HomeComponent component
- it('component should be created', inject([HttpTestingController, HomeComponent],
- (httpClient: HttpTestingController, service: HomeComponent) => {
- expect(service).toBeTruthy();
- }));
-
- // Ensure all statistic variables are initialised to zero
- it('ensure statistic variables are defaulted at zero', async(inject([HttpTestingController, HomeComponent],
- (httpClient: HttpTestingController, service: HomeComponent) => {
- expect(service.totalVal === 0 && service.completeVal === 0 &&
- service.inProgressVal === 0 && service.failedVal === 0 &&
- service.pendingVal === 0 && service.unlockedVal === 0 &&
- service.percentageComplete === 0 && service.percentageFailed === 0 &&
- service.percentageInProg === 0 && service.percentagePending === 0 &&
- service.percentageUnlocked === 0).toBeTruthy();
- })));
-});
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com, andrei.barcovschi@ericsson.com
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { HomeComponent } from './home.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { MatTableModule, MatNativeDateModule, MatTableDataSource, MatPaginatorModule } from '@angular/material';
+import { FormsModule } from '@angular/forms';
+import { MatDatepickerModule } from '@angular/material/datepicker';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
+import { inject } from '@angular/core/testing';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { environment } from '../../environments/environment.prod';
+import { Observable, of, throwError } from 'rxjs';
+import { SearchRequest } from '../model/SearchRequest.model';
+import { DataService } from '../data.service'; // may be able to remove
+import { Process } from '../model/process.model';
+import { By } from '@angular/platform-browser';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { ProcessInstanceId } from '../model/processInstanceId.model';
+import { HttpResponse } from '@angular/common/http';
+import { Router } from '@angular/router';
+import { Routes } from '@angular/router';
+import { RouterTestingModule } from '@angular/router/testing';
+import { DetailsComponent } from '../details/details.component';
+
+// Generate stub for toastr popup notifications
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {}
+ info() {}
+ error() {}
+}
+
+const routes: Routes = [ { path: 'details/114e9ae4-4a32-11e9-8646-d663bd873d93' , component: DetailsComponent} ]
+
+describe('HomeComponent', () => {
+ let spyDataService: jasmine.SpyObj<DataService>;
+ let router: Router;
+ let component: HomeComponent;
+ let fixture: ComponentFixture<HomeComponent>;
+
+ beforeEach(() => {
+ spyDataService = jasmine.createSpyObj('DataService', ['retrieveInstance', 'getProcessInstanceId']);
+
+ TestBed.configureTestingModule({
+ providers: [
+ { provide: DataService, useValue: spyDataService },
+ { provide: APP_BASE_HREF, useValue: '/' },
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
+ imports: [MatPaginatorModule, BrowserAnimationsModule, MatTableModule, FormsModule, MatDatepickerModule, MatNativeDateModule, HttpClientModule, RouterTestingModule.withRoutes(routes)],
+ declarations: [HomeComponent, DetailsComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
+ });
+
+ fixture = TestBed.createComponent(HomeComponent);
+ router = TestBed.get(Router);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ // Ensure creation of HomeComponent component
+ it('component should be created', () => {
+ expect(component).toBeTruthy();
+ });
+
+ // Ensure all statistic variables are initialised to zero
+ it('should ensure statistic variables are defaulted at zero', () => {
+ expect(component.totalVal === 0 && component.completeVal === 0 &&
+ component.inProgressVal === 0 && component.failedVal === 0 &&
+ component.pendingVal === 0 && component.unlockedVal === 0 &&
+ component.percentageComplete === 0 && component.percentageFailed === 0 &&
+ component.percentageInProg === 0 && component.percentagePending === 0 &&
+ component.percentageUnlocked === 0).toBeTruthy();
+ });
+
+ it('should should navigate to a process if response status is OK', async(() => {
+ spyDataService.getProcessInstanceId.and.returnValue(of(<HttpResponse<ProcessInstanceId>>{body: {processInstanceId: '114e9ae4-4a32-11e9-8646-d663bd873d93'}, status: 200}));
+ spyOn(router, 'navigate');
+ component.getProcessIsntanceId('e8a75940-4a32-11e9-8646-d663bd873d93');
+
+ fixture.whenStable().then(() => {
+ expect(router.navigate).toHaveBeenCalledWith(['/details/114e9ae4-4a32-11e9-8646-d663bd873d93']);
+ });
+ }));
+
+ it('should handle error if no process instance id found', () => {
+ spyDataService.getProcessInstanceId.and.returnValue(of(<HttpResponse<ProcessInstanceId>>{body: {processInstanceId: 'getProcessInstanceId error not found'}, status: 404}));
+ component.getProcessIsntanceId('e8a75940-4a32-11e9-8646-d663bd873d93');
+ });
+
+ it('should handle error when searchData.getSearchRequest returns an error', () => {
+ spyOn(component.searchData, 'getSearchRequest').and.callFake(() => {
+ return throwError(new Error('getSearchRequest error'));
+ });
+ component.makeCall();
+ });
+
+ it('should handle error when dataService.retrieveInstance returns an error', () => {
+ spyOn(component.searchData, 'getSearchRequest').and.returnValue(of(getSearchRequest("965d3c92-44e0-11e9-b210-d663bd873d93", "85a7c354-44e0-11e9-b210-d663bd873d93", undefined, undefined, undefined, undefined, undefined, undefined, "ALL")));
+ spyDataService.retrieveInstance.and.callFake(() => {
+ return throwError(new Error('retrieveInstance error'));
+ });
+ component.makeCall();
+ });
+
+ it('should calculate statistics correctly', async(() => {
+ let requestStatusTypes: string[] = ["COMPLETE", "IN_PROGRESS", "FAILED", "PENDING", "UNLOCKED"];
+ let processArr: Process[] = [];
+
+ // create 5 processes, one of each requestStatusType, with default time.
+ requestStatusTypes.forEach((status) => {
+ let serviceName = "service-" + status;
+ var process = getProcess("85a7c354-44e0-11e9-b210-d663bd873d93", "965d3c92-44e0-11e9-b210-d663bd873d93", serviceName, "048a6212-44e1-11e9-b210-d663bd873d93", status, "TestType", undefined, undefined);
+ processArr.push(process);
+ })
+
+ // search request has default filter.
+ spyOn(component.searchData, 'getSearchRequest').and.returnValue(of(getSearchRequest(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "ALL")));
+ spyDataService.retrieveInstance.and.returnValue(of(processArr));
+ component.makeCall();
+
+ fixture.whenStable().then(() => {
+ fixture.detectChanges();
+
+ expect(
+ component.totalVal === 5 && component.completeVal === 1 &&
+ component.inProgressVal === 1 && component.failedVal === 1 &&
+ component.pendingVal === 1 && component.unlockedVal === 1 &&
+ component.percentageComplete === 20 &&
+ component.percentageFailed === 20 &&
+ component.percentageInProg === 20 &&
+ component.percentagePending === 20 &&
+ component.percentageUnlocked === 20)
+ .toBeTruthy();
+ });
+ }));
+
+ function getSearchRequest(selectedValueSII = "EQ", serviceInstanceIdVal: string, selectedValueRI = "EQ", requestIdVal: string, selectedValueSN = "EQ", serviceInstanceNameVal: string, startTimeInMilliseconds = 0, endTimeInMilliseconds = 4, selectedValueSTATUS?: string): SearchRequest {
+ if (startTimeInMilliseconds > endTimeInMilliseconds) {
+ console.error("End time cannot be greater than start time.");
+ return undefined;
+ }
+ if (typeof selectedValueSTATUS === "string")
+ return new SearchRequest({ serviceInstanceId: [selectedValueSII, serviceInstanceIdVal], requestId: [selectedValueRI, requestIdVal], serviceInstanceName: [selectedValueSN, serviceInstanceNameVal], requestStatus: ["EQ", selectedValueSTATUS] }, startTimeInMilliseconds, endTimeInMilliseconds);
+ else
+ return new SearchRequest({ serviceInstanceId: [selectedValueSII, serviceInstanceIdVal], requestId: [selectedValueRI, requestIdVal], serviceInstanceName: [selectedValueSN, serviceInstanceNameVal] }, startTimeInMilliseconds, endTimeInMilliseconds);
+ }
+
+ function getProcess(requestIdVal: string, serviceInstanceIdVal: string, serviceIstanceNameVal: string, networkIdVal: string, requestStatusVal: string, serviceTypeVal: string, startTimeVal = "1", endTimeVal = "2"): Process {
+ return <Process>{ requestId: requestIdVal, serviceInstanceId: serviceInstanceIdVal, serviceIstanceName: serviceIstanceNameVal, networkId: networkIdVal, requestStatus: requestStatusVal, serviceType: serviceTypeVal, startTime: startTimeVal, endTime: endTimeVal };
+ }
+});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.spec.ts
new file mode 100644
index 0000000000..5323cce1fd
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.spec.ts
@@ -0,0 +1,78 @@
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: andrei.barcovschi@ericsson.com
+*/
+
+import { SearchData } from './searchData.model';
+import { SearchRequest } from './SearchRequest.model';
+import { Observable, throwError } from 'rxjs';
+
+describe('SearchData', () => {
+ let searchRequest: SearchRequest;
+ let searchData: SearchData;
+
+ beforeEach(() => {
+ searchData = new SearchData();
+ });
+
+ it('should return a SearchRequest observable with selectedValueSTATUS != ALL', () => { // NOT ALL CHANGE TEST TO TEST THIS ISNTESASD
+ searchData.serviceInstanceId = "bd827d8c-4b07-11e9-8646-d663bd873d93";
+ searchData.requestId = "cf1343d8-4b07-11e9-8646-d663bd873d93";
+ searchData.serviceInstanceName = "service-123";
+ searchData.selectedValueSTATUS = "COMPLETE";
+
+ searchData.getSearchRequest().subscribe((request: SearchRequest) => {
+ searchRequest = request;
+ });
+ let filters = searchRequest.getFilters();
+ expect(searchRequest.getFilters()).toEqual({ serviceInstanceId: [ 'EQ', 'bd827d8c-4b07-11e9-8646-d663bd873d93' ],
+ requestId: [ 'EQ', 'cf1343d8-4b07-11e9-8646-d663bd873d93' ],
+ serviceInstanceName: [ 'EQ', 'service-123' ],
+ requestStatus: [ 'EQ', 'COMPLETE' ]
+ });
+ expect(searchRequest.getStartTimeInMilliseconds()).toBe(searchData.startDate.getTime());
+ expect(searchRequest.getEndTimeInMilliseconds()).toBe(searchData.endDate.getTime());
+ });
+
+ it('should throw an error if found incorrect start or end date', () => {
+ searchData.startDate = null;
+ searchData.endDate = undefined;
+ searchData.getSearchRequest().subscribe({
+ error: (err) => {
+ expect(err).toEqual('Found end or start date empty, Please enter start and end date')
+ }
+ });
+ });
+
+ it('should throw an error if startTimeInMilliseconds > endTimeInMilliseconds', () => {
+ searchData.startDate = new Date('March 20, 2019 02:00:00');
+ searchData.endDate = new Date('March 20, 2019 01:00:00');
+ searchData.selectedStartHour = '02';
+ searchData.selectedEndHour = '01';
+ searchData.selectedStartMinute = '00';
+ searchData.selectedEndMinute = '00';
+
+ searchData.getSearchRequest().subscribe({
+ error: (err) => {
+ expect(err).toEqual("End time: " + searchData.endDate + " can not be greater then start time: " + searchData.startDate)
+ }
+ });
+ });
+});