aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INFO.yaml21
-rw-r--r--adapters/mso-adapter-utils/pom.xml5
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/audit/beans/AuditInventory.java36
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneAuthHolder.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java17
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java16
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java46
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java36
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientException.java34
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java97
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientException.java34
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java84
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/HeatClientException.java37
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java177
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java37
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java830
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java45
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java41
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java74
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java14
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java9
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudRequest.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientException.java33
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java113
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientException.java33
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java207
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java31
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackResultWrapper.java82
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackRollbackException.java31
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java69
-rw-r--r--adapters/mso-adapter-utils/src/main/resources/application-local.yaml64
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java4
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java219
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java624
-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/StackStatusHandlerTest.java89
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json2
-rw-r--r--adapters/mso-adapters-rest-interface/pom.xml15
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java4
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java14
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java20
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java12
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java3
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java10
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java8
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java19
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java14
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml16
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java30
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBConfig.java83
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java9
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java99
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java15
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java121
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java17
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java38
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java165
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java86
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java37
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java107
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml35
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/application.yaml15
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql11
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql1
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql3
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java20
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java74
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java67
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java155
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java387
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json53
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml79
-rw-r--r--adapters/mso-openstack-adapters/pom.xml36
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java25
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java38
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java77
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java42
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java71
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java62
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java39
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java62
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java18
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java35
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java184
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java78
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java42
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CatalogDBConfig.java77
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java189
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java386
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java270
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java146
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java67
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java64
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java32
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java32
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java69
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeException.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java33
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientException.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV2ClientImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackV3ClientImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactory.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java28
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application-local.yaml103
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application.yaml20
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/AllTestsTestSuite.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java101
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java26
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java91
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java74
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java24
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java30
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java23
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java7
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java65
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java20
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/GetResources.json2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json30
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json30
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json3
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml17
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml20
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/logback-test.xml14
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql145
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/vfModule.json38
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java5
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/RequestDbRepositoryConfiguration.java23
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java6
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java7
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.java25
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml51
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/application.yaml15
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.10__Add_Column_IS_DATA_INTERNAL.sql3
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.7__Add_OpenStack_Request_Information.sql13
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.8__Add_Column_Original_Request_Id.sql4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.9__Add_Column_Ext_System_Error_Source.sql4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.1__Add_Column_Rollback_Ext_System_Error_Source.sql4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.2__Expand_Column_Size_Infra_Active_Requests_Request_Status.sql3
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.3__Expand_Column_Size_Archived_Infra_Active_Requests_Request_Status.sql3
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java20
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java25
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java93
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml17
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java3
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java13
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java34
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java13
-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.java15
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java11
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml133
-rw-r--r--adapters/mso-sdnc-adapter/src/main/resources/application.yaml4
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/WebSecurityConfigImpl.java6
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java4
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java13
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java10
-rw-r--r--adapters/mso-vfc-adapter/src/main/resources/application-local.yaml34
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java156
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt128
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml23
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java7
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java16
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java3
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java18
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java27
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java119
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java55
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java26
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java51
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java55
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java51
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java52
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java22
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml13
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jksbin0 -> 1413 bytes
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12bin0 -> 4079 bytes
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java40
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java45
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml)14
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java25
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/Application.java6
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java14
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java12
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java16
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java17
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java25
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java13
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java143
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java6
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java8
-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.java7
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java103
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ASDCElementInfo.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java6
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java5
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java15
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java17
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java17
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java984
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java14
-rw-r--r--asdc-controller/src/main/resources/application-local.yaml95
-rw-r--r--asdc-controller/src/main/resources/application.yaml30
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java31
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java31
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java30
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java360
-rw-r--r--asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json47
-rw-r--r--asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csarbin0 -> 55786 bytes
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csarbin115651 -> 115053 bytes
-rw-r--r--asdc-controller/src/test/resources/schema.sql12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy19
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy195
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy16
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy17
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy26
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy57
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy37
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy15
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy84
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BBConstants.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/PostCompletionRequestsDbListener.java33
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java65
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulator.java33
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java65
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/BuildingBlockValidatorRunner.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java)21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidator.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java)4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidatorRunner.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidatorRunner.java)46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PostBuildingBlockValidator.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java)2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PostWorkflowValidator.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostWorkflowValidator.java)2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PreBuildingBlockValidator.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java)2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PreWorkflowValidator.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreWorkflowValidator.java)2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowValidatorRunner.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java)20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java153
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java351
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java71
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapper.java52
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/exceptions/ServiceProxyNotFoundException.java34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java117
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java72
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java163
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java124
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/DuplicateNameException.java38
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java184
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExpectedDataException.java37
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java37
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy135
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java)14
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java)14
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java)4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorFour.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java)3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorOne.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java)3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorThree.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java)3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorTwo.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java)3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/ValidationConfig.java)6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/WorkflowPreValidatorOne.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java)3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/WorkflowPreValidatorTwo.java (renamed from bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java)3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java112
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java419
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapperTest.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java126
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java129
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java122
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java96
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java90
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java98
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacroVrf.json48
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json83
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json64
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json201
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json299
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json22
-rw-r--r--bpmn/MSOCoreBPMN/pom.xml2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java407
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java9
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java27
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java17
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java46
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java1
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java23
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.java7
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java1
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.java3
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.java9
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java27
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java4
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java26
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java45
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java29
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java241
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java16
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java20
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json58
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml22
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java19
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java32
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java3
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java7
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java31
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java11
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CamundaDBConfig.java84
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java11
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java4
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml13
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12bin0 -> 4095 bytes
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jksbin0 -> 1413 bytes
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java3
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java3
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java176
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java41
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java5
-rw-r--r--bpmn/pom.xml4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java27
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn10
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn6
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn251
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn1
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn1
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn503
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn137
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn1
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn206
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java5
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java28
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java3
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy178
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy100
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy30
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy397
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy40
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy159
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy25
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy238
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy15
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy153
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy124
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy15
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy35
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy31
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy221
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy168
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy29
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java27
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java73
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java280
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java55
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/resources/application.properties3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy67
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java39
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/CreateNetworkCollection.json4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/ServiceMacroAssign.json4
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn30
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn7
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn72
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn105
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn206
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn193
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn5
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/CreateNetworkCollection.json4
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/ServiceMacroAssign.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java113
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java145
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java110
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java197
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java60
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java94
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java39
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java100
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java68
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java40
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java45
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java155
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfBondingServiceException.java32
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java163
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java746
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java98
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java51
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java87
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/exceptions/MissingValueTagException.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java113
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceConstants.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceUtils.java87
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIEntityNotFoundException.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java50
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java30
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java104
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java40
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/InputParameterRetrieverTaskTest.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnfTest.java30
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java79
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java65
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java73
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java219
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java106
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java547
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java129
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectTest.java82
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestUtilsTest.java136
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java40
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java62
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json46
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnf.json57
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnfWithVservers.json434
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiNetworkWrapper.json42
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverFullQueryResponse.json13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverQueryResponse.json6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json4
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java7
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java6
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java4
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java42
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java10
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java19
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java6
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java7
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java9
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java7
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java4
-rw-r--r--common/pom.xml23
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClient.java12
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java17
-rw-r--r--common/src/main/java/org/onap/so/client/RestRequest.java6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClient.java1
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java2
-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/AAIRestClient.java2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java14
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java12
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java1
-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/aai/AAIVersion.java2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java5
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java17
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java1
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java1
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java8
-rw-r--r--common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java9
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java10
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java3
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java1
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/Format.java11
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java1
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java18
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java15
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java18
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java23
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java4
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/__.java2
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java1
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java11
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java1
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMRestClient.java2
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java2
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java17
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java1
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/Body.java4
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/Input.java2
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java2
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java4
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java2
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java4
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java6
-rw-r--r--common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java)9
-rw-r--r--common/src/main/java/org/onap/so/constants/Status.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java)15
-rw-r--r--common/src/main/java/org/onap/so/db/connections/DbDnsIpAddress.java20
-rw-r--r--common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java78
-rw-r--r--common/src/main/java/org/onap/so/listener/ListenerRunner.java56
-rw-r--r--common/src/main/java/org/onap/so/listener/Skip.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java)2
-rw-r--r--common/src/main/java/org/onap/so/logger/ErrorCode.java28
-rw-r--r--common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java20
-rw-r--r--common/src/main/java/org/onap/so/logger/LoggingAnchor.java29
-rw-r--r--common/src/main/java/org/onap/so/logger/MdcConstants.java21
-rw-r--r--common/src/main/java/org/onap/so/logger/MessageEnum.java197
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java10
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java9
-rw-r--r--common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java1
-rw-r--r--common/src/main/java/org/onap/so/objects/audit/AAIObjectAudit.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java)25
-rw-r--r--common/src/main/java/org/onap/so/objects/audit/AAIObjectAuditList.java66
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java6
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java3
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java2
-rw-r--r--common/src/main/java/org/onap/so/rest/exceptions/ExhaustedRetriesException.java19
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/CloudRequestData.java59
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java1
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java69
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Request.java23
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java39
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java56
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java1
-rw-r--r--common/src/main/java/org/onap/so/utils/CryptoUtils.java5
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntities.java (renamed from mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java)17
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntity.java22
-rw-r--r--common/src/main/java/org/onap/so/utils/UUIDChecker.java3
-rw-r--r--common/src/main/java/org/onap/so/utils/XmlMarshaller.java9
-rw-r--r--common/src/test/java/org/onap/so/client/RestClientTest.java28
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java16
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java12
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java7
-rw-r--r--common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java37
-rw-r--r--common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java58
-rw-r--r--common/src/test/java/org/onap/so/db/connections/DbDnsIpAddressTest.java19
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java58
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java44
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/test-request.json6
-rw-r--r--common/src/test/resources/__files/aai/singletransaction/sample-request.json6
-rw-r--r--docs/Developer_Info.rst14
-rw-r--r--docs/api/apis/consumed-apis.rst (renamed from docs/api/apis/SO_Interface.rst)1586
-rw-r--r--docs/api/apis/e2eServiceInstances-api.rst185
-rw-r--r--docs/api/apis/serviceInstances-api.rst1192
-rw-r--r--docs/api/offered_consumed_apis.rst13
-rw-r--r--docs/architecture/architecture.rst32
-rw-r--r--docs/bak/Developer_Info.rst14
-rw-r--r--docs/bak/installation.rst (renamed from docs/installation.rst)0
-rw-r--r--docs/developer_info/developer_information.rst13
-rw-r--r--docs/developer_info/instantiate/index.rst31
-rw-r--r--docs/developer_info/instantiate/instantiation/index.rst28
-rw-r--r--docs/developer_info/instantiate/instantiation/nbi/index.rst97
-rw-r--r--docs/developer_info/instantiate/instantiation/pnf_instance/index.rst107
-rw-r--r--docs/developer_info/instantiate/instantiation/so1/index.rst366
-rw-r--r--docs/developer_info/instantiate/instantiation/so2/index.rst197
-rw-r--r--docs/developer_info/instantiate/instantiation/uui/index.rst14
-rw-r--r--docs/developer_info/instantiate/instantiation/vid/index.rst13
-rw-r--r--docs/developer_info/instantiate/pre_instantiation/index.rst225
-rw-r--r--docs/images/SO_1.pngbin75897 -> 58590 bytes
-rw-r--r--docs/installconfigure/Configure_git_and_gerrit.rst6
-rw-r--r--docs/installconfigure/Install_Configure_SO.rst20
-rw-r--r--docs/installconfigure/Install_Docker.rst6
-rw-r--r--docs/release-notes.rst2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java87
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java22
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java48
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java5
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java37
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdateFilter.java103
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdater.java34
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java24
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java14
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java8
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java5
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java31
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java1
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java5
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/RequestClientTest.java60
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java80
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java61
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java180
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java185
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GenericStringConverter.java33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java146
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheck.java84
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConfig.java83
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConverter.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckResponse.java49
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckStatus.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckStatus.java)4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckSubsystem.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckResponse.java116
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java25
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java44
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java209
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java228
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java277
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java283
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SoSubsystems.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoSubsystems.java)15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Subsystem.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java96
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java85
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java410
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java89
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java89
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java94
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java87
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java97
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/AAIEntityNotFound.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java)12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/CloudConfigurationNotFoundException.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/NoRecipeException.java31
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/RequestConflictedException.java30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/WorkflowEngineConnectionException.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/AAIEntityNotFoundMapper.java48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/CloudConfigurationNotFoundMapper.java48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/NoRecipeExceptionMapper.java48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/RequestConflictMapper.java48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/WorkflowEngineConnectionMapper.java48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java214
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandler.java113
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandler.java116
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VFModuleRestHandler.java125
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java110
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandler.java104
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java80
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/ActivateVnfDBHelper.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml179
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java340
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java182
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java47
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java152
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java330
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java444
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java483
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java221
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java147
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java64
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java143
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java189
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java190
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java154
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java145
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java83
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/ServiceInstanceVpnBondingService.json57
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/ProcessInstanceHistoryResponse.json44
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationOpenstackRequestDetails.json62
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/ALaCarteNull.json13
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBody.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBodyNewRequestorId.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleRetainAssignments.json33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceVpnBondingService.json57
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceId.json56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceNameNetwork.json56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceNameVpnBinding.json56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoModelInvariantId.json57
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoModelType.json56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedServiceRequest.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVfModuleRequest.json25
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVnfRequest.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVolumeGroupRequest.json25
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ServiceInstance.json35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VfModule.json37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json131
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VolumeGroup.json56
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql27
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/pom.xml1
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/configuration/ExposeEntityIdResourceConfiguration.java21
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java6
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java3
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java20
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java13
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql22
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/CloudApiRequests.java138
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java5
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java54
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java13
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java108
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java10
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java35
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/requestsdb/RequestsDBHelperTest.java81
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java10
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java5
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java52
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java7
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java54
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java14
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java24
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java12
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java38
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java19
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java28
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java42
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java14
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java34
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java186
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java15
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java136
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java160
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java115
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java147
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java73
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java167
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java203
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java237
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java4
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java174
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java3
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java1
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql7
-rw-r--r--packages/docker/pom.xml2
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image2
-rw-r--r--packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml26
-rw-r--r--pom.xml30
-rw-r--r--project-configs/code-tools/onap-eclipse-format.xml6
-rw-r--r--readme.md173
-rw-r--r--so-monitoring/readme.md35
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java2
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceIdDetail.java2
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequest.java14
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequestBuilder.java12
-rw-r--r--so-monitoring/so-monitoring-service/pom.xml4
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java35
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java9
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java39
-rw-r--r--so-monitoring/so-monitoring-service/src/main/resources/application.yaml9
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/README.md9
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/package-lock.json28
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app-routing.module.ts102
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts18
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/auth.guard.ts46
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/authentication.service.ts50
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/basic-auth.interceptor.ts43
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts6
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts190
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts24
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts352
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/error.interceptor.ts45
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html6
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts22
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts18
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.constant.ts2
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.html43
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.spec.ts108
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts81
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/activityInstance.model.ts64
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/bpmnInfraRequest.model.ts (renamed from so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/process.model.ts)64
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processDefinition.model.ts52
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processInstance.model.ts56
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.ts212
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/variableInstance.model.ts54
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.html63
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.ts79
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.ts71
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/environments/environment.ts5
-rw-r--r--version.properties4
-rw-r--r--vnfm-simulator/vnfm-service/pom.xml314
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java18
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java10
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java9
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java9
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java9
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java28
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java49
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java31
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java36
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java113
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java82
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java6
-rw-r--r--vnfm-simulator/vnfm-service/src/main/resources/application.yaml7
-rw-r--r--vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem30
-rw-r--r--vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-simulator.p12bin0 -> 4079 bytes
-rw-r--r--vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java158
-rw-r--r--vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java112
-rw-r--r--vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/VnfmHelperTest.java104
1076 files changed, 39194 insertions, 13398 deletions
diff --git a/INFO.yaml b/INFO.yaml
index 95b0c6a96a..7e1f91f30c 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -44,12 +44,17 @@ committers:
email: 'byung-woo.jun@ericsson.com'
company: 'Ericsson'
id: 'byungwoojun'
- timezone: ''
+ timezone: 'America/New_York'
- name: 'DeWayne Filppi'
email: 'dewayne@cloudify.co'
company: 'Cloudify'
id: 'dfilppi'
- timezone: ''
+ timezone: 'America/Los_Angeles'
+ - name: 'Max Benjamin'
+ email: 'max.benjamin@att.com'
+ company: 'ATT'
+ id: 'mfour'
+ timezone: 'America/New_York'
- name: 'Yan Yang'
email: 'yangyanyj@chinamobile.com'
company: 'China Mobile'
@@ -59,7 +64,12 @@ committers:
email: 'marcus.williams@intel.com'
company: 'Intel'
id: 'mgkwill'
- timezone: 'America/Los Angeles'
+ timezone: 'America/Los_Angeles'
+ - name: 'Sanchita Pathak'
+ email: 'sanchita@techmahindra.com'
+ company: 'Tech Mahindra'
+ id: 'sanchitap'
+ timezone: 'Asia/Kolkata'
- name: 'Steve Smokowski'
email: 'ss835w@att.com'
company: 'ATT'
@@ -75,11 +85,6 @@ committers:
company: 'Nokia'
id: 'lukaszM'
timezone: 'Europe/Warsaw'
- - name: 'Max Benjamin'
- email: 'max.benjamin@att.com'
- company: 'ATT'
- id: 'mfour'
- timezone: ''
tsc:
approval: 'https://lists.onap.org/pipermail/onap-tsc'
changes:
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml
index 7918072323..aa9a1cea9e 100644
--- a/adapters/mso-adapter-utils/pom.xml
+++ b/adapters/mso-adapter-utils/pom.xml
@@ -147,5 +147,10 @@
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/audit/beans/AuditInventory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/audit/beans/AuditInventory.java
index 7e612b3b41..eff32cf826 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/audit/beans/AuditInventory.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/audit/beans/AuditInventory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,18 +25,24 @@ import java.io.Serializable;
public class AuditInventory implements Serializable {
/**
- *
+ *
*/
private static final long serialVersionUID = 4937350343452380760L;
+ private String msoRequestId;
+
private String cloudRegion;
private String cloudOwner;
private String tenantId;
+ private String vfModuleId;
+
private String heatStackName;
+ private String genericVnfId;
+
public String getCloudRegion() {
return cloudRegion;
}
@@ -69,6 +75,30 @@ public class AuditInventory implements Serializable {
this.heatStackName = heatStackName;
}
+ public String getGenericVnfId() {
+ return genericVnfId;
+ }
+
+ public void setGenericVnfId(String genericVnfId) {
+ this.genericVnfId = genericVnfId;
+ }
+
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ public void setVfModuleId(String vfModuleId) {
+ this.vfModuleId = vfModuleId;
+ }
+
+ public String getMsoRequestId() {
+ return msoRequestId;
+ }
+
+ public void setMsoRequestId(String msoRequestId) {
+ this.msoRequestId = msoRequestId;
+ }
+
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneAuthHolder.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneAuthHolder.java
index 4df8a91515..eadbc511d0 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneAuthHolder.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneAuthHolder.java
@@ -51,7 +51,7 @@ public class KeystoneAuthHolder implements Serializable {
return serviceUrl;
}
- public void setHeatUrl(String serviceUrl) {
+ public void setServiceUrl(String serviceUrl) {
this.serviceUrl = serviceUrl;
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
index f717144562..16906957a7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
@@ -20,10 +20,10 @@
package org.onap.so.cloud.authentication;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import org.onap.so.config.beans.PoConfig;
import org.onap.so.db.catalog.beans.CloudIdentity;
@@ -72,9 +72,7 @@ public class KeystoneV3Authentication {
OpenStackRequest<Token> v3Request = keystoneTenantClient.tokens().authenticate(v3Credentials);
- KeystoneAuthHolder holder = makeRequest(v3Request, type, region);
-
- return holder;
+ return makeRequest(v3Request, type, region);
}
protected KeystoneAuthHolder makeRequest(OpenStackRequest<Token> v3Request, String type, String region) {
@@ -87,12 +85,11 @@ public class KeystoneV3Authentication {
KeystoneAuthHolder result = new KeystoneAuthHolder();
result.setId(id);
result.setexpiration(token.getExpiresAt());
- result.setHeatUrl(findEndpointURL(token.getCatalog(), type, region, "public"));
+ result.setServiceUrl(findEndpointURL(token.getCatalog(), type, region, "public"));
return result;
}
- protected RetryPolicy createRetryPolicy() {
- RetryPolicy policy = new RetryPolicy();
+ protected RetryPolicy<OpenStackResponse> createRetryPolicy() {
List<Predicate<Throwable>> result = new ArrayList<>();
result.add(e -> {
return e.getCause() instanceof OpenStackResponseException
@@ -104,10 +101,8 @@ public class KeystoneV3Authentication {
});
Predicate<Throwable> pred = result.stream().reduce(Predicate::or).orElse(x -> false);
-
- policy.retryOn(error -> pred.test(error));
-
- policy.withDelay(poConfig.getRetryDelay(), TimeUnit.SECONDS).withMaxRetries(poConfig.getRetryCount());
+ RetryPolicy<OpenStackResponse> policy = new RetryPolicy<OpenStackResponse>().handleIf(error -> pred.test(error))
+ .withDelay(Duration.ofSeconds(poConfig.getRetryDelay())).withMaxRetries(poConfig.getRetryCount());
return policy;
}
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 02ace5665d..072bf404e7 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
@@ -72,22 +72,22 @@ public final class DeploymentInfoBuilder {
this.errorMessage = execution.getError();
// Compute the status based on the last workflow
- if (lastAction.equals("install")) {
- if (actionStatus.equals("terminated")) {
+ if (("install").equals(lastAction)) {
+ if (("terminated").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.INSTALLED;
- } else if (actionStatus.equals("failed")) {
+ } else if (("failed").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.FAILED;
- } else if (actionStatus.equals("started") || actionStatus.equals("pending")) {
+ } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.INSTALLING;
} else {
this.deploymentStatus = DeploymentStatus.UNKNOWN;
}
- } else if (lastAction.equals("uninstall")) {
- if (actionStatus.equals("terminated")) {
+ } else if (("uninstall").equals(lastAction)) {
+ if (("terminated").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.CREATED;
- } else if (actionStatus.equals("failed")) {
+ } else if (("failed").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.FAILED;
- } else if (actionStatus.equals("started") || actionStatus.equals("pending")) {
+ } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.UNINSTALLING;
} else {
this.deploymentStatus = DeploymentStatus.UNKNOWN;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
index 5c2348dffa..2251575671 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
@@ -38,8 +38,8 @@ public class MsoCloudifyWorkflowException extends MsoCloudifyException {
super(0, "Workflow Exception",
"Workflow " + workflowId + " failed on deployment " + deploymentId + ": " + message);
this.workflowStatus = workflowStatus;
- if (workflowStatus.equals("pending") || workflowStatus.equals("started") || workflowStatus.equals("cancelling")
- || workflowStatus.equals("force_cancelling")) {
+ if (("pending").equals(workflowStatus) || ("started").equals(workflowStatus)
+ || ("cancelling").equals(workflowStatus) || ("force_cancelling").equals(workflowStatus)) {
workflowStillRunning = true;
}
}
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 0a0f2787da..2a17656f1d 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -109,6 +109,8 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
private static final String DELETE_DEPLOYMENT = "DeleteDeployment";
private static final String TERMINATED = "terminated";
private static final String CANCELLED = "cancelled";
+ private static final String UNINSTALL = "uninstall";
+ private static final String UPLOAD_BLUEPRINT = "UPLOAD_BLUEPRINT";
// Fetch cloud configuration each time (may be cached in CloudConfig class)
@Autowired
@@ -181,11 +183,11 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
Map<String, Object> expandedInputs = new HashMap<>(inputs);
String platform = cloudSite.get().getPlatform();
- if (platform == null || platform.equals("") || platform.equalsIgnoreCase("OPENSTACK")) {
+ if (platform == null || platform.isEmpty() || ("OPENSTACK").equalsIgnoreCase(platform)) {
// Create the Cloudify OpenstackConfig with the credentials
OpenstackConfig openstackConfig = getOpenstackConfig(cloudSite.get(), tenantId);
expandedInputs.put("openstack_config", openstackConfig);
- } else if (platform.equalsIgnoreCase("AZURE")) {
+ } else if (("AZURE").equalsIgnoreCase(platform)) {
// Create Cloudify AzureConfig with the credentials
AzureConfig azureConfig = getAzureConfig(cloudSite.get(), tenantId);
expandedInputs.put("azure_config", azureConfig);
@@ -265,7 +267,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
// Run the uninstall to undo the install
- Execution uninstallWorkflow = executeWorkflow(cloudify, deploymentId, "uninstall", null,
+ Execution uninstallWorkflow = executeWorkflow(cloudify, deploymentId, UNINSTALL, null,
pollForCompletion, deletePollTimeout, deletePollInterval);
if (uninstallWorkflow.getStatus().equals(TERMINATED)) {
@@ -306,7 +308,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
// Run the uninstall to undo the install.
// Always try to run it, as it should be idempotent
- executeWorkflow(cloudify, deploymentId, "uninstall", null, pollForCompletion, deletePollTimeout,
+ executeWorkflow(cloudify, deploymentId, UNINSTALL, null, pollForCompletion, deletePollTimeout,
deletePollInterval);
// Delete the deployment itself
@@ -402,7 +404,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
GetExecution queryExecution = cloudify.executions().byId(executionId);
command = "query";
- while (!timedOut && !(status.equals(TERMINATED) || status.equals("failed") || status.equals(CANCELLED))) {
+ while (!timedOut && !(status.equals(TERMINATED) || ("failed").equals(status) || status.equals(CANCELLED))) {
// workflow is still running; check for timeout
if (pollTimeout <= 0) {
logger.debug("workflow {} timed out on deployment {}", execution.getWorkflowId(),
@@ -425,7 +427,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
// Success!
logger.debug("Workflow '{}' completed successfully on deployment '{}'", workflowId, deploymentId);
return execution;
- } else if (status.equals("failed")) {
+ } else if (("failed").equals(status)) {
// 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(),
@@ -476,12 +478,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
boolean timedOut = false;
int cancelTimeout = timeout; // TODO: For now, just use same timeout
- String status = cancelExecution.getStatus();
-
+ String status = null;
+ if (cancelExecution != null) {
+ status = cancelExecution.getStatus();
+ }
// Poll for completion. Create a reusable cloudify query request
GetExecution queryExecution = cloudify.executions().byId(executionId);
- while (!timedOut && !status.equals(CANCELLED)) {
+ while (!timedOut && !CANCELLED.equals(status)) {
// workflow is still running; check for timeout
if (cancelTimeout <= 0) {
logger.debug("Cancel timeout for workflow {} on deployment {}", workflowId, deploymentId);
@@ -495,11 +499,13 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("pollTimeout remaining: {}", cancelTimeout);
execution = queryExecution.execute();
- status = execution.getStatus();
+ if (execution != null) {
+ status = execution.getStatus();
+ }
}
// Broke the loop. Check again for a terminal state
- if (status.equals(CANCELLED)) {
+ if (CANCELLED.equals(status)) {
// Finished cancelling. Return the original exception
logger.debug("Cancel workflow {} completed on deployment {}", workflowId, deploymentId);
throw new MsoCloudifyException(-1, "", "", savedException);
@@ -665,7 +671,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
uninstallWorkflow =
- executeWorkflow(cloudify, deploymentId, "uninstall", null, true, pollTimeout, deletePollInterval);
+ executeWorkflow(cloudify, deploymentId, UNINSTALL, null, true, pollTimeout, deletePollInterval);
if (uninstallWorkflow.getStatus().equals(TERMINATED)) {
// Successful uninstall.
@@ -812,7 +818,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
// Put the root directory
- String rootDir = blueprintId + ((blueprintId.endsWith("/") ? "" : "/"));
+ String rootDir = blueprintId + (blueprintId.endsWith("/") ? "" : "/");
zipOut.putNextEntry(new ZipEntry(rootDir));
zipOut.closeEntry();
@@ -836,13 +842,13 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
Blueprint blueprint = uploadRequest.execute();
logger.debug("Successfully uploaded blueprint {}", blueprint.getId());
} catch (CloudifyResponseException | CloudifyConnectException e) {
- throw cloudifyExceptionToMsoException(e, "UPLOAD_BLUEPRINT");
+ throw cloudifyExceptionToMsoException(e, UPLOAD_BLUEPRINT);
} catch (RuntimeException e) {
// Catch-all
- throw runtimeExceptionToMsoException(e, "UPLOAD_BLUEPRINT");
+ throw runtimeExceptionToMsoException(e, UPLOAD_BLUEPRINT);
} catch (IOException e) {
// for try-with-resources
- throw ioExceptionToMsoException(e, "UPLOAD_BLUEPRINT");
+ throw ioExceptionToMsoException(e, UPLOAD_BLUEPRINT);
}
return true;
@@ -960,14 +966,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
String type = templateParam.getParamType();
logger.debug("Parameter: {} is of type {}", templateParam.getParamName(), type);
- if (type.equalsIgnoreCase("number")) {
+ if (("number").equalsIgnoreCase(type)) {
try {
return Integer.valueOf(inputValue.toString());
} catch (Exception e) {
logger.debug("Unable to convert {} to an integer!", inputValue);
return null;
}
- } else if (type.equalsIgnoreCase("json")) {
+ } else if (("json").equalsIgnoreCase(type)) {
try {
if (inputValue instanceof String) {
return JSON_MAPPER.readTree(inputValue.toString());
@@ -978,8 +984,8 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("Unable to convert {} to a JsonNode!", inputValue);
return null;
}
- } else if (type.equalsIgnoreCase("boolean")) {
- return new Boolean(inputValue.toString());
+ } else if (("boolean").equalsIgnoreCase(type)) {
+ return Boolean.valueOf(inputValue.toString());
}
// Nothing else matched. Return the original string
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java
new file mode 100644
index 0000000000..86be9ec3d8
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java
@@ -0,0 +1,36 @@
+package org.onap.so.openstack.beans;
+
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class CreateStackRequest {
+
+ @JsonProperty("parameters")
+ private Map<String, Object> parameters;
+
+ @JsonProperty("environment")
+ private String environment;
+
+ public Map<String, Object> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, Object> parameters) {
+ this.parameters = parameters;
+ }
+
+ public String getEnvironment() {
+ return environment;
+ }
+
+ public void setEnvironment(String environment) {
+ this.environment = environment;
+ }
+
+ @Override
+ public String toString() {
+ return "CreateStackRequest [parameters=" + parameters + ", environment=" + environment + "]";
+ }
+
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientException.java
new file mode 100644
index 0000000000..f7f521e6f7
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientException.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+public class CinderClientException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6865047344405492982L;
+
+ public CinderClientException(String errorMessage, Exception e) {
+ super(errorMessage, e);
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java
new file mode 100644
index 0000000000..71cdcf6078
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.openstack.utils;
+
+import org.onap.so.cloud.authentication.KeystoneAuthHolder;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.cinder.Cinder;
+import com.woorea.openstack.cinder.model.Volume;
+import com.woorea.openstack.cinder.model.Volumes;
+
+
+
+@Component
+public class CinderClientImpl extends MsoCommonUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(CinderClientImpl.class);
+
+ /**
+ * Gets the Cinder client.
+ *
+ * @param cloudSiteId the cloud site
+ * @param tenantId the tenant id
+ * @return the glance client
+ * @throws MsoException the mso exception
+ */
+ private Cinder getCinderClient(String cloudSiteId, String tenantId) throws MsoException {
+ KeystoneAuthHolder keystone = getKeystoneAuthHolder(cloudSiteId, tenantId, "volumev2");
+ Cinder cinderClient = new Cinder(keystone.getServiceUrl());
+ cinderClient.token(keystone.getId());
+ return cinderClient;
+ }
+
+
+ /**
+ * Query images
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param limit limits the number of records returned
+ * @param marker the last viewed record
+ * @return the list of images in openstack
+ * @throws CinderClientException the glance client exception
+ */
+ public Volumes queryVolumes(String cloudSiteId, String tenantId, int limit, String marker)
+ throws CinderClientException {
+ try {
+ Cinder cinderClient = getCinderClient(cloudSiteId, tenantId);
+ // list is set to false, otherwise an invalid URL is appended
+ OpenStackRequest<Volumes> request =
+ cinderClient.volumes().list(false).queryParam("limit", limit).queryParam("marker", marker);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ String errorMsg = "Error building Cinder Client";
+ logger.error(errorMsg, e);
+ throw new CinderClientException(errorMsg, e);
+ }
+ }
+
+
+ public Volume queryVolume(String cloudSiteId, String tenantId, String volumeId) throws CinderClientException {
+ try {
+ Cinder cinderClient = getCinderClient(cloudSiteId, tenantId);
+ // list is set to false, otherwise an invalid URL is appended
+ OpenStackRequest<Volume> request = cinderClient.volumes().show(volumeId);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ String errorMsg = "Error building Cinder Client";
+ logger.error(errorMsg, e);
+ throw new CinderClientException(errorMsg, e);
+ }
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientException.java
new file mode 100644
index 0000000000..065fb83844
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientException.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+public class GlanceClientException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5202512087480589226L;
+
+ public GlanceClientException(String errorMessage, Exception e) {
+ super(errorMessage, e);
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
new file mode 100644
index 0000000000..698b605be3
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.onap.so.cloud.authentication.KeystoneAuthHolder;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.glance.Glance;
+import com.woorea.openstack.glance.model.Images;
+
+
+@Component
+public class GlanceClientImpl extends MsoCommonUtils {
+
+ /** The Constant logger. */
+ private static final Logger logger = LoggerFactory.getLogger(GlanceClientImpl.class);
+
+ /**
+ * Gets the glance client.
+ *
+ * @param cloudSite the cloud site
+ * @param tenantId the tenant id
+ * @return the glance client
+ * @throws MsoException the mso exception
+ */
+ private Glance getGlanceClient(String cloudSiteId, String tenantId) throws MsoException {
+ KeystoneAuthHolder keystone = getKeystoneAuthHolder(cloudSiteId, tenantId, "image");
+ Glance glanceClient = new Glance(keystone.getServiceUrl() + "/v2.0/");
+ glanceClient.token(keystone.getId());
+ return glanceClient;
+ }
+
+
+ /**
+ * Query images
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param limit limits the number of records returned
+ * @param visibility visibility in the image in openstack
+ * @param marker the last viewed record
+ * @param name the image names
+ * @return the list of images in openstack
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws GlanceClientException the glance client exception
+ */
+ public Images queryImages(String cloudSiteId, String tenantId, int limit, String visibility, String marker,
+ String name) throws MsoCloudSiteNotFound, GlanceClientException {
+ try {
+ Glance glanceClient = getGlanceClient(cloudSiteId, tenantId);
+ // list is set to false, otherwise an invalid URL is appended
+ OpenStackRequest<Images> request = glanceClient.images().list(false).queryParam("visibility", visibility)
+ .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Glance Client", e);
+ throw new GlanceClientException("Error building Glance Client", e);
+ }
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/HeatClientException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/HeatClientException.java
new file mode 100644
index 0000000000..b49d632fdb
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/HeatClientException.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.openstack.utils;
+
+public class HeatClientException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3143699004848022343L;
+
+ public HeatClientException(String errorMessage, Exception e) {
+ super(errorMessage, e);
+ }
+
+ public HeatClientException(String error) {
+ super(error);
+ }
+
+}
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 c9a548d5f1..576784ae3e 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
@@ -24,24 +24,23 @@
package org.onap.so.openstack.utils;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-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.heat.model.CreateStackParam;
-import com.woorea.openstack.heat.model.Explanation;
-import com.woorea.openstack.keystone.model.Error;
-import com.woorea.openstack.quantum.model.NeutronError;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
+import org.onap.so.cloud.authentication.KeystoneAuthHolder;
+import org.onap.so.cloud.authentication.KeystoneV3Authentication;
+import org.onap.so.cloud.authentication.ServiceEndpointNotFoundException;
import org.onap.so.config.beans.PoConfig;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.exceptions.MsoAdapterException;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.onap.so.openstack.exceptions.MsoIOException;
@@ -50,15 +49,48 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+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.heat.model.CreateStackParam;
+import com.woorea.openstack.heat.model.Explanation;
+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.model.Error;
+import com.woorea.openstack.keystone.utils.KeystoneUtils;
+import com.woorea.openstack.quantum.model.NeutronError;
@Component("CommonUtils")
public class MsoCommonUtils {
private static Logger logger = LoggerFactory.getLogger(MsoCommonUtils.class);
+ /** The Constant TOKEN_AUTH. */
+ protected static final String TOKEN_AUTH = "TokenAuth";
+
+ /** The cloud config. */
+ @Autowired
+ protected CloudConfig cloudConfig;
+ /** The authentication method factory. */
@Autowired
- private PoConfig poConfig;
+ protected AuthenticationMethodFactory authenticationMethodFactory;
+
+ /** The tenant utils factory. */
+ @Autowired
+ protected MsoTenantUtilsFactory tenantUtilsFactory;
+
+ /** The keystone V 3 authentication. */
+ @Autowired
+ protected KeystoneV3Authentication keystoneV3Authentication;
+
+ @Autowired
+ protected PoConfig poConfig;
+
/*
* Method to execute an Openstack command and track its execution time. For the metrics log, a category of
* "Openstack" is used along with a sub-category that identifies the specific call (using the real
@@ -66,22 +98,23 @@ public class MsoCommonUtils {
*/
protected <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request) {
+ return executeAndRecordOpenstackRequest(request, true);
+ }
- int limit;
-
- long start = System.currentTimeMillis();
- String requestType;
- if (request.getClass().getEnclosingClass() != null) {
- requestType =
- request.getClass().getEnclosingClass().getSimpleName() + "." + request.getClass().getSimpleName();
- } else {
- requestType = request.getClass().getSimpleName();
- }
+ /*
+ * Method to execute an Openstack command and track its execution time. For the metrics log, a category of
+ * "Openstack" is used along with a sub-category that identifies the specific call (using the real
+ * openstack-java-sdk classname of the OpenStackRequest<T> parameter). boolean isNoRetry - true if No retry; and
+ * false if Retry.
+ */
+ protected <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request, boolean shouldRetry) {
int retryDelay = poConfig.getRetryDelay();
int retryCount = poConfig.getRetryCount();
String retryCodes = poConfig.getRetryCodes();
-
+ if (!shouldRetry) {
+ retryCodes = null;
+ }
// Run the actual command. All exceptions will be propagated
while (true) {
try {
@@ -98,8 +131,8 @@ public class MsoCommonUtils {
retryCount--;
retry = true;
logger.debug(
- "OpenStackResponseException ResponseCode: {} request:{} Retry indicated. Attempts remaining:{}",
- code, requestType, retryCount);
+ "OpenStackResponseException ResponseCode: {} Retry indicated. Attempts remaining:{}",
+ code, retryCount);
break;
}
} catch (NumberFormatException e1) {
@@ -123,7 +156,7 @@ public class MsoCommonUtils {
// Connection to Openstack failed
if (retryCount > 0) {
retryCount--;
- logger.debug(" request: {} Retry indicated. Attempts remaining:{}", requestType, retryCount);
+ logger.debug("Retry indicated. Attempts remaining:{}", retryCount);
try {
Thread.sleep(retryDelay * 1000L);
} catch (InterruptedException e1) {
@@ -194,40 +227,29 @@ public class MsoCommonUtils {
try {
// 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,
- ErrorCode.DataError.getValue(), context, explanation.toString());
+ logger.error("Exception - Openstack Error on {} : {}", context, explanation);
String fullError = explanation.getExplanation() + ", error.type=" + explanation.getError().getType()
+ ", error.message=" + explanation.getError().getMessage();
- logger.debug(fullError);
- me = new MsoOpenstackException(explanation.getCode(), explanation.getTitle(),
- // explanation.getExplanation ());
- fullError);
+ logger.error(fullError);
+ me = new MsoOpenstackException(explanation.getCode(), explanation.getTitle(), fullError);
} 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,
ErrorCode.DataError.getValue(), context, re.getStatus(), e.getMessage(), e2);
- me = new MsoOpenstackException(re.getStatus(), re.getMessage(), "");
+ me = new MsoOpenstackException(re.getStatus(), re.getMessage(), re.getMessage());
}
// Add the context of the error
me.addContext(context);
- // Generate an alarm for 5XX and higher errors.
- if (re.getStatus() >= 500) {
-
- }
} else if (e instanceof OpenStackConnectException) {
OpenStackConnectException ce = (OpenStackConnectException) e;
-
me = new MsoIOException(ce.getMessage());
me.addContext(context);
-
// Generate an alarm for all connection errors.
-
logger.error("{} {} Openstack Heat connection error on {}: ", MessageEnum.RA_CONNECTION_EXCEPTION,
ErrorCode.DataError.getValue(), context, e);
}
-
return me;
}
@@ -404,4 +426,79 @@ public class MsoCommonUtils {
return stack;
}
+
+ /**
+ * Gets the Keystone Authorization
+ *
+ * @param cloudSite the cloud site
+ * @param tenantId the tenant id
+ * @return the Neutron client
+ * @throws MsoException the mso exception
+ */
+ protected KeystoneAuthHolder getKeystoneAuthHolder(String cloudSiteId, String tenantId, String serviceName)
+ throws MsoException {
+ CloudSite cloudSite =
+ cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
+ String cloudId = cloudSite.getId();
+ String region = cloudSite.getRegionId();
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
+ MsoTenantUtils tenantUtils =
+ tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
+ String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
+ try {
+ if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) {
+ Access access = getKeystone(tenantId, cloudIdentity, keystoneUrl);
+ try {
+ KeystoneAuthHolder keystoneAuthV2 = new KeystoneAuthHolder();
+ keystoneAuthV2.setServiceUrl(
+ KeystoneUtils.findEndpointURL(access.getServiceCatalog(), serviceName, region, "public"));
+ keystoneAuthV2.setId(access.getToken().getId());
+ return keystoneAuthV2;
+ } catch (RuntimeException e) {
+ String error = "Openstack did not match an orchestration service for: region=" + region + ",cloud="
+ + cloudIdentity.getIdentityUrl();
+ throw new MsoAdapterException(error, e);
+ }
+ } else if (ServerType.KEYSTONE_V3.equals(cloudIdentity.getIdentityServerType())) {
+ try {
+ return keystoneV3Authentication.getToken(cloudSite, tenantId, serviceName);
+ } catch (ServiceEndpointNotFoundException e) {
+ String error = "cloud did not match an orchestration service for: region=" + region + ",cloud="
+ + cloudIdentity.getIdentityUrl();
+ throw new MsoAdapterException(error, e);
+ }
+ } else {
+ throw new MsoAdapterException("Unknown Keystone Server Type");
+ }
+ } catch (OpenStackResponseException e) {
+ if (e.getStatus() == 401) {
+ String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId();
+ throw new MsoAdapterException(error);
+ } else {
+ throw keystoneErrorToMsoException(e, TOKEN_AUTH);
+ }
+ } catch (OpenStackConnectException e) {
+ MsoIOException me = new MsoIOException(e.getMessage(), e);
+ me.addContext(TOKEN_AUTH);
+ throw me;
+ } catch (RuntimeException e) {
+ throw runtimeExceptionToMsoException(e, TOKEN_AUTH);
+ }
+ }
+
+ /**
+ * @param tenantId
+ * @param cloudIdentity
+ * @param keystoneUrl
+ * @return
+ */
+ protected Access getKeystone(String tenantId, CloudIdentity cloudIdentity, String keystoneUrl) {
+ 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);
+ return access;
+ }
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
index a21db78cee..47ba076e0e 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java
@@ -58,9 +58,12 @@ public class MsoHeatEnvironmentEntry {
return;
byte[] b = this.rawEntry.toString().getBytes();
MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(b);
- this.parameters = yaml.getParameterListFromEnvt();
- // this.resources = yaml.getResourceListFromEnvt();
- StringBuilder sb = this.getResourceRegistryRawEntry();
+ StringBuilder sb = null;
+ if (yaml != null) {
+ this.parameters = yaml.getParameterListFromEnvt();
+ // this.resources = yaml.getResourceListFromEnvt();
+ sb = this.getResourceRegistryRawEntry();
+ }
if (sb == null) {
this.resourceRegistryEntryRaw = new StringBuilder("");
} else {
@@ -70,7 +73,7 @@ public class MsoHeatEnvironmentEntry {
logger.debug("Exception:", e);
this.valid = false;
this.errorString = e.getMessage();
- // e.printStackTrace();
+
}
}
@@ -129,14 +132,14 @@ public class MsoHeatEnvironmentEntry {
}
public boolean hasResources() {
- if (this.resources != null && this.resources.size() > 0) {
+ if (this.resources != null && !this.resources.isEmpty()) {
return true;
}
return false;
}
public boolean hasParameters() {
- if (this.parameters != null && this.parameters.size() > 0) {
+ if (this.parameters != null && !this.parameters.isEmpty()) {
return true;
}
return false;
@@ -144,7 +147,7 @@ public class MsoHeatEnvironmentEntry {
public boolean containsParameter(String paramName) {
boolean contains = false;
- if (this.parameters == null || this.parameters.size() < 1) {
+ if (this.parameters == null || this.parameters.isEmpty()) {
return false;
}
if (this.parameters.contains(new MsoHeatEnvironmentParameter(paramName))) {
@@ -173,7 +176,7 @@ public class MsoHeatEnvironmentEntry {
// Basically give back the envt - but exclude the params that aren't in the HeatTemplate
StringBuilder sb = new StringBuilder();
- ArrayList<String> paramNameList = new ArrayList<String>(params.size());
+ ArrayList<String> paramNameList = new ArrayList<>(params.size());
for (HeatTemplateParam htp : params) {
paramNameList.add(htp.getParamName());
}
@@ -243,22 +246,4 @@ public class MsoHeatEnvironmentEntry {
sb.append(this.rawEntry.substring(indexOf));
return sb;
}
-
- public void setHPAParameters(StringBuilder hpasb) {
- try {
- MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(hpasb.toString().getBytes());
- Set<MsoHeatEnvironmentParameter> hpaParams = yaml.getParameterListFromEnvt();
- for (MsoHeatEnvironmentParameter hpaparam : hpaParams) {
- for (MsoHeatEnvironmentParameter param : this.parameters) {
- if (param.getName() == hpaparam.getName()) {
- param.setValue(hpaparam.getValue());
- }
- }
- }
- } catch (Exception e) {
- logger.debug("Exception:", e);
- this.errorString = e.getMessage();
- // e.printStackTrace();
- }
- }
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index b54301509f..b5a97f7559 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -23,30 +23,17 @@
package org.onap.so.openstack.utils;
-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;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.PluginAction;
import org.onap.so.adapters.vdu.VduArtifact;
@@ -57,65 +44,80 @@ import org.onap.so.adapters.vdu.VduModelInfo;
import org.onap.so.adapters.vdu.VduPlugin;
import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.adapters.vdu.VduStatus;
-import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
-import org.onap.so.cloud.authentication.KeystoneV3Authentication;
-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.HeatTemplate;
import org.onap.so.db.catalog.beans.HeatTemplateParam;
-import org.onap.so.db.catalog.beans.ServerType;
+import org.onap.so.db.request.beans.CloudApiRequests;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
+import org.onap.so.openstack.beans.CreateStackRequest;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
-import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
-import org.onap.so.openstack.exceptions.MsoIOException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.onap.so.openstack.exceptions.MsoStackAlreadyExists;
import org.onap.so.openstack.exceptions.MsoTenantNotFound;
import org.onap.so.openstack.mappers.StackInfoMapper;
-import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Strings;
+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.Events;
+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;
+
@Primary
@Component
public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
- private static final String TOKEN_AUTH = "TokenAuth";
+ private static final String CREATE_COMPLETE = "CREATE_COMPLETE";
- private static final String QUERY_ALL_STACKS = "QueryAllStacks";
+ private static final String DELETE_COMPLETE = "DELETE_COMPLETE";
+
+ private static final String DELETE_IN_PROGRESS = "DELETE_IN_PROGRESS";
+
+ private static final String CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS";
private static final String DELETE_STACK = "DeleteStack";
protected static final String HEAT_ERROR = "HeatError";
protected static final String CREATE_STACK = "CreateStack";
-
- // Fetch cloud configuration each time (may be cached in CloudConfig class)
- @Autowired
- protected CloudConfig cloudConfig;
+ public static final String FOUND = "Found: {}";
+ public static final String EXCEPTION_ROLLING_BACK_STACK =
+ "{} Create Stack: Nested exception rolling back stack: {} ";
+ public static final String IN_PROGRESS = "in_progress";
@Autowired
private Environment environment;
@Autowired
- private AuthenticationMethodFactory authenticationMethodFactory;
+ RequestsDbClient requestDBClient;
@Autowired
- private MsoTenantUtilsFactory tenantUtilsFactory;
+ StackStatusHandler statusHandler;
@Autowired
- private KeystoneV3Authentication keystoneV3Authentication;
+ NovaClientImpl novaClient;
private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtils.class);
@@ -123,9 +125,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
protected String createPollIntervalProp = "org.onap.so.adapters.po.pollInterval";
private String deletePollIntervalProp = "org.onap.so.adapters.po.pollInterval";
private String deletePollTimeoutProp = "org.onap.so.adapters.po.pollTimeout";
+ private String pollingMultiplierProp = "org.onap.so.adapters.po.pollMultiplier";
- protected static final String createPollIntervalDefault = "15";
- private static final String deletePollIntervalDefault = "15";
+ protected static final String CREATE_POLL_INTERVAL_DEFAULT = "15";
+ private static final String DELETE_POLL_INTERVAL_DEFAULT = "15";
+ private static final String POLLING_MULTIPLIER_DEFAULT = "60";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
@@ -191,7 +195,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
* @param cloudOwner the cloud owner of the cloud site in which to create the stack
* @param tenantId The Openstack ID of the tenant in which to create the Stack
* @param stackName The name of the stack to create
- * @param vduModelInfo contains information about the vdu model (added for plugin adapter)
+ * @param vduModel contains information about the vdu model (added for plugin adapter)
* @param heatTemplate The Heat template
* @param stackInputs A map of key/value inputs
* @param pollForCompletion Indicator that polling should be handled in Java vs. in the client
@@ -210,6 +214,25 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
int timeoutMinutes, String environment, Map<String, Object> files, Map<String, Object> heatFiles,
boolean backout) throws MsoException {
+ stripMultiCloudInputs(stackInputs);
+ CreateStackParam createStack =
+ createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles);
+ Stack currentStack = createStack(createStack, cloudSiteId, tenantId);
+ currentStack.setStackName(stackName);
+ if (pollForCompletion) {
+ currentStack =
+ processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack, createStack, true);
+ } else {
+ currentStack =
+ queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(), cloudSiteId, tenantId);
+ }
+ return new StackInfoMapper(currentStack).map();
+ }
+
+ /**
+ * @param stackInputs
+ */
+ protected void stripMultiCloudInputs(Map<String, ?> stackInputs) {
// Take out the multicloud inputs, if present.
for (String key : MsoMulticloudUtils.MULTICLOUD_INPUTS) {
if (stackInputs.containsKey(key)) {
@@ -219,35 +242,20 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
}
}
+ }
- CreateStackParam stack =
- createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles);
-
- // Obtain the cloud site information where we will create the stack
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- logger.debug("Found: {}", cloudSite);
- // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
- // This could throw MsoTenantNotFound or MsoOpenstackException (both propagated)
- Heat heatClient = getHeatClient(cloudSite, tenantId);
- logger.debug("Found: {}", heatClient);
-
- logger.debug("Ready to Create Stack ({}) with input params: {}", heatTemplate, stackInputs);
-
- Stack heatStack = null;
+ protected Stack createStack(CreateStackParam stack, String cloudSiteId, String tenantId) throws MsoException {
try {
- OpenStackRequest<Stack> request = heatClient.getStacks().create(stack);
- CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- request.header("X-Auth-User", cloudIdentity.getMsoId());
- request.header("X-Auth-Key", CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass()));
- heatStack = executeAndRecordOpenstackRequest(request);
+ OpenStackRequest<Stack> request = getHeatClient(cloudSiteId, tenantId).getStacks().create(stack);
+ saveStackRequest(stack, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID), stack.getStackName());
+ return executeAndRecordOpenstackRequest(request);
} catch (OpenStackResponseException e) {
if (e.getStatus() == 409) {
- MsoStackAlreadyExists me = new MsoStackAlreadyExists(stackName, tenantId, cloudSiteId);
+ MsoStackAlreadyExists me = new MsoStackAlreadyExists(stack.getStackName(), tenantId, cloudSiteId);
me.addContext(CREATE_STACK);
throw me;
} else {
- logger.debug("ERROR STATUS = {},\n{}\n{}", e.getStatus(), e.getMessage(), e.getLocalizedMessage());
+ logger.error("ERROR STATUS = {},\n{}\n{}", e.getStatus(), e.getMessage(), e.getLocalizedMessage());
throw heatExceptionToMsoException(e, CREATE_STACK);
}
} catch (OpenStackConnectException e) {
@@ -255,225 +263,162 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
} catch (RuntimeException e) {
throw runtimeExceptionToMsoException(e, CREATE_STACK);
}
+ }
- // Subsequent access by the canonical name "<stack name>/<stack-id>".
- // 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);
- } else {
- // Get initial status, since it will have been null after the create.
- heatStack = queryHeatStack(heatClient, canonicalName);
- logger.debug(heatStack.getStackStatus());
+ protected Stack processCreateStack(String cloudSiteId, String tenantId, int timeoutMinutes, boolean backout,
+ Stack heatStack, CreateStackParam stackCreate, boolean keyPairCleanUp) throws MsoException {
+ Stack latestStack = null;
+ try {
+ latestStack = pollStackForStatus(timeoutMinutes, heatStack, CREATE_IN_PROGRESS, cloudSiteId, tenantId);
+ } catch (MsoException me) {
+ logger.error("Exception in Create Stack", me);
}
- return new StackInfoMapper(heatStack).map();
+ return postProcessStackCreate(latestStack, backout, timeoutMinutes, keyPairCleanUp, cloudSiteId, tenantId,
+ stackCreate);
}
- private Stack pollStackForCompletion(String cloudSiteId, String tenantId, String stackName, int timeoutMinutes,
- boolean backout, Heat heatClient, Stack heatStack, String canonicalName)
- throws MsoException, MsoOpenstackException {
- int createPollInterval =
- Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
- int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
- int deletePollInterval = createPollInterval;
- int deletePollTimeout = pollTimeout;
- boolean createTimedOut = false;
- StringBuilder stackErrorStatusReason = new StringBuilder("");
- logger.debug("createPollInterval={}, pollTimeout={}", createPollInterval, pollTimeout);
+ protected Stack postProcessStackCreate(Stack stack, boolean backout, int timeoutMinutes, boolean cleanUpKeyPair,
+ String cloudSiteId, String tenantId, CreateStackParam stackCreate) throws MsoException {
+ if (stack == null) {
+ throw new StackCreationException("Unknown Error in Stack Creation");
+ }
- while (true) {
- try {
- heatStack = queryHeatStack(heatClient, canonicalName);
- logger.debug("{} ({})", heatStack.getStackStatus(), canonicalName);
+ logger.info("Performing post processing backout: {} cleanUpKeyPair: {}, stack {}", backout, cleanUpKeyPair,
+ stack);
+ if (!CREATE_COMPLETE.equals(stack.getStackStatus())) {
+ if (cleanUpKeyPair && !Strings.isNullOrEmpty(stack.getStackStatusReason())
+ && isKeyPairFailure(stack.getStackStatusReason())) {
+ return handleKeyPairConflict(cloudSiteId, tenantId, stackCreate, timeoutMinutes, backout, stack);
+ }
+ if (!backout) {
+ logger.info("Status is not CREATE_COMPLETE, stack deletion suppressed");
+ throw new StackCreationException("Stack rollback suppressed, stack not deleted");
+ } else {
+ logger.info("Status is not CREATE_COMPLETE, stack deletion will be executed");
+ String errorMessage = "Stack Creation Failed Openstack Status: " + stack.getStackStatus()
+ + " Status Reason: " + stack.getStackStatusReason();
try {
- logger.debug("Current stack {}", this.getOutputsAsStringBuilder(heatStack).toString());
- } catch (Exception e) {
- logger.debug("an error occurred trying to print out the current outputs of the stack", e);
+ Stack deletedStack = handleUnknownCreateStackFailure(stack, timeoutMinutes, cloudSiteId, tenantId);
+ errorMessage = errorMessage + " , Rollback of Stack Creation completed with status: "
+ + deletedStack.getStackStatus() + " Status Reason: " + deletedStack.getStackStatusReason();
+ } catch (StackRollbackException se) {
+ logger.error("Sync Error Deleting Stack during rollback process", se);
+ errorMessage = errorMessage + se.getMessage();
+ } catch (MsoException e) {
+ logger.error("Sync Error Deleting Stack during rollback", e);
+
+ errorMessage =
+ errorMessage + " , Rollback of Stack Creation failed with sync error: " + e.getMessage();
}
+ throw new StackCreationException(errorMessage);
+ }
+ } else {
+ return stack;
+ }
+
+ }
- 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(), ErrorCode.AvailabilityError.getValue());
- createTimedOut = true;
- break;
+ protected Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId,
+ String tenantId) throws MsoException {
+ int pollingFrequency =
+ Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
+ int pollingMultiplier =
+ Integer.parseInt(this.environment.getProperty(pollingMultiplierProp, POLLING_MULTIPLIER_DEFAULT));
+ int numberOfPollingAttempts = Math.floorDiv((timeoutMinutes * pollingMultiplier), pollingFrequency);
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
+ while (true) {
+ Stack latestStack = queryHeatStack(heatClient, stack.getStackName() + "/" + stack.getId());
+ if (latestStack != null) {
+ statusHandler.updateStackStatus(latestStack);
+ logger.debug("Polling: {} ({})", latestStack.getStackStatus(), latestStack.getStackName());
+ if (stackStatus.equals(latestStack.getStackStatus())) {
+ if (numberOfPollingAttempts <= 0) {
+ logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus());
+ return latestStack;
}
- sleep(createPollInterval * 1000L);
- pollTimeout -= createPollInterval;
- logger.debug("pollTimeout remaining: {}", pollTimeout);
+ sleep(pollingFrequency * 1000L);
+ numberOfPollingAttempts -= 1;
} else {
- stackErrorStatusReason.append(
- "Stack error (" + heatStack.getStackStatus() + "): " + heatStack.getStackStatusReason());
- break;
- }
- } catch (MsoException me) {
- // Cannot query the stack status. Something is wrong.
- // Try to roll back the stack
- if (!backout) {
- logger.warn("{} Exception in Create Stack, stack deletion suppressed {}",
- MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue());
- } else {
- try {
- logger.debug(
- "Create Stack error - unable to query for stack status - attempting to delete stack: {}"
- + " - This will likely fail and/or we won't be able to query to see if delete worked",
- canonicalName);
- OpenStackRequest<Void> request = heatClient.getStacks().deleteByName(canonicalName);
- executeAndRecordOpenstackRequest(request);
- boolean deleted = false;
- while (!deleted) {
- try {
- heatStack = queryHeatStack(heatClient, canonicalName);
- if (heatStack != null) {
- logger.debug(heatStack.getStackStatus());
- if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) {
- if (deletePollTimeout <= 0) {
- logger.error(
- "{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Rollback: DELETE stack timeout",
- MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId,
- stackName, heatStack.getStackStatus(),
- ErrorCode.AvailabilityError.getValue());
- break;
- } else {
- sleep(deletePollInterval * 1000L);
- deletePollTimeout -= deletePollInterval;
- }
- } else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())) {
- logger.debug("DELETE_COMPLETE for {}", canonicalName);
- deleted = true;
- continue;
- } else {
- // got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and
- // evaluate
- break;
- }
- } else {
- // assume if we can't find it - it's deleted
- logger.debug("heatStack returned null - assume the stack {} has been deleted",
- canonicalName);
- deleted = true;
- continue;
- }
-
- } 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, 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, ErrorCode.BusinessProcesssError.getValue(), e2);
- }
+ return latestStack;
}
+ } else {
+ logger.error("latestStack is null");
+ return null;
+ }
+ }
+ }
- // Propagate the original exception from Stack Query.
- me.addContext(CREATE_STACK);
- throw me;
+ protected void saveStackRequest(CreateStackParam request, String requestId, String stackName) {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ InfraActiveRequests foundRequest = requestDBClient.getInfraActiveRequestbyRequestId(requestId);
+ CreateStackRequest createStackRequest = new CreateStackRequest();
+ createStackRequest.setEnvironment(request.getEnvironment());
+ createStackRequest.setParameters(request.getParameters());
+ String stackRequest = mapper.writeValueAsString(createStackRequest);
+ CloudApiRequests cloudReq = new CloudApiRequests();
+ cloudReq.setCloudIdentifier(stackName);
+ cloudReq.setRequestBody(stackRequest);
+ cloudReq.setRequestId(requestId);
+ CloudApiRequests foundCloudReq = foundRequest.getCloudApiRequests().stream()
+ .filter(cloudReqToFind -> stackName.equals(cloudReq.getCloudIdentifier())).findAny().orElse(null);
+ if (foundCloudReq != null) {
+ foundCloudReq.setRequestBody(stackRequest);
+ } else {
+ foundRequest.getCloudApiRequests().add(cloudReq);
}
+ requestDBClient.updateInfraActiveRequests(foundRequest);
+ } catch (Exception e) {
+ logger.error("Error updating in flight request with Openstack Create Request", e);
}
+ }
- 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(),
- ErrorCode.BusinessProcesssError.getValue());
+ protected boolean isKeyPairFailure(String errorMessage) {
+ return Pattern.compile(".*Key pair.*already exists.*").matcher(errorMessage).matches();
+ }
- // 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, ErrorCode.BusinessProcesssError.getValue());
- } else {
- try {
- logger.debug("Create Stack errored - attempting to DELETE stack: {}", canonicalName);
- logger.debug("deletePollInterval={}, deletePollTimeout={}", deletePollInterval, deletePollTimeout);
- OpenStackRequest<Void> request = heatClient.getStacks().deleteByName(canonicalName);
- executeAndRecordOpenstackRequest(request);
- boolean deleted = false;
- while (!deleted) {
- try {
- heatStack = queryHeatStack(heatClient, canonicalName);
- if (heatStack != null) {
- logger.debug("{} ({})", heatStack.getStackStatus(), canonicalName);
- if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) {
- if (deletePollTimeout <= 0) {
- logger.error(
- "{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Rollback: DELETE stack timeout",
- MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
- heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue());
- break;
- } else {
- sleep(deletePollInterval * 1000L);
- deletePollTimeout -= deletePollInterval;
- logger.debug("deletePollTimeout remaining: {}", deletePollTimeout);
- }
- } else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())) {
- logger.debug("DELETE_COMPLETE for {}", canonicalName);
- deleted = true;
- continue;
- } else if ("DELETE_FAILED".equals(heatStack.getStackStatus())) {
- // 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,
- ErrorCode.BusinessProcesssError.getValue());
- logger.debug(
- "Stack deletion FAILED on a rollback of a create - {}, status={}, reason={}",
- canonicalName, heatStack.getStackStatus(),
- heatStack.getStackStatusReason());
- break;
- } else {
- // got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and
- // evaluate
- break;
- }
- } else {
- // assume if we can't find it - it's deleted
- logger.debug("heatStack returned null - assume the stack {} has been deleted",
- canonicalName);
- deleted = true;
- continue;
- }
-
- } catch (MsoException me2) {
- // We got an exception on the delete - don't throw this exception - throw the original -
- // just log.
- 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, ErrorCode.BusinessProcesssError.getValue(),
- me2.getContextMessage());
- }
-
- } // end while !deleted
- StringBuilder errorContextMessage;
- if (createTimedOut) {
- errorContextMessage = new StringBuilder("Stack Creation Timeout");
- } else {
- errorContextMessage = stackErrorStatusReason;
- }
- if (deleted) {
- errorContextMessage.append(" - stack successfully deleted");
- } else {
- errorContextMessage.append(" - encountered an error trying to delete the stack");
- }
- } catch (Exception e2) {
- // shouldn't happen - but handle
- logger.error("{} Create Stack: Nested exception rolling back stack: {} ",
- MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e2);
- }
+ protected Stack handleUnknownCreateStackFailure(Stack stack, int timeoutMinutes, String cloudSiteId,
+ String tenantId) throws MsoException {
+ if (stack != null && !Strings.isNullOrEmpty(stack.getStackName()) && !Strings.isNullOrEmpty(stack.getId())) {
+ OpenStackRequest<Void> request = getHeatClient(cloudSiteId, tenantId).getStacks()
+ .deleteByName(stack.getStackName() + "/" + stack.getId());
+ executeAndRecordOpenstackRequest(request);
+ Stack currentStack = pollStackForStatus(timeoutMinutes, stack, DELETE_IN_PROGRESS, cloudSiteId, tenantId);
+ postProcessStackDelete(currentStack);
+ return currentStack;
+ } else {
+ throw new StackCreationException("Cannot Find Stack Name or Id");
+ }
+ }
+
+ protected void postProcessStackDelete(Stack stack) throws MsoException {
+ logger.info("Performing post processing on delete stack {}", stack);
+ if (stack != null && !Strings.isNullOrEmpty(stack.getStackStatus())) {
+ if (!DELETE_COMPLETE.equals(stack.getStackStatus()))
+ throw new StackRollbackException("Stack Deletion completed with status: " + stack.getStackStatus()
+ + " Status Reason: " + stack.getStackStatusReason());
+ } else {
+ throw new StackRollbackException("Cannot Find Stack Name or Id");
+ }
+ }
+
+ protected Stack handleKeyPairConflict(String cloudSiteId, String tenantId, CreateStackParam stackCreate,
+ int timeoutMinutes, boolean backout, Stack stack) throws MsoException {
+ logger.info("Keypair conflict found on stack, attempting to clean up");
+ try {
+ Matcher m = Pattern.compile("'([^']+?)'").matcher(stack.getStackStatusReason());
+ if (m.find()) {
+ novaClient.deleteKeyPair(cloudSiteId, tenantId, m.group(1));
}
- MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString());
- me.addContext(CREATE_STACK);
- throw me;
+ } catch (NovaClientException e) {
+ logger.warn("Could not delete keypair", e);
}
- return heatStack;
+
+ handleUnknownCreateStackFailure(stack, timeoutMinutes, cloudSiteId, tenantId);
+ Stack newStack = createStack(stackCreate, cloudSiteId, tenantId);
+ newStack.setStackName(stackCreate.getStackName());
+ return processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, newStack, stackCreate, false);
}
/**
@@ -490,19 +435,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
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
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- logger.debug("Found: {}", cloudSite.toString());
-
- // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
Heat heatClient = null;
try {
- heatClient = getHeatClient(cloudSite, tenantId);
- if (heatClient != null) {
- logger.debug("Found: {}", heatClient.toString());
- }
+ heatClient = getHeatClient(cloudSiteId, tenantId);
} catch (MsoTenantNotFound e) {
// Tenant doesn't exist, so stack doesn't either
logger.debug("Tenant with id " + tenantId + "not found.", e);
@@ -550,24 +485,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
*/
public StackInfo deleteStack(String tenantId, String cloudOwner, String cloudSiteId, String stackName,
boolean pollForCompletion) throws MsoException {
- // Obtain the cloud site information where we will create the stack
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- logger.debug("Found: {}", cloudSite.toString());
-
- // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
Heat heatClient = null;
try {
- heatClient = getHeatClient(cloudSite, tenantId);
- if (heatClient != null) {
- logger.debug("Found: {}", heatClient.toString());
- }
+ heatClient = getHeatClient(cloudSiteId, tenantId);
} catch (MsoTenantNotFound e) {
- // Tenant doesn't exist, so stack doesn't either
logger.debug("Tenant with id " + tenantId + "not found.", e);
return new StackInfo(stackName, HeatStatus.NOTFOUND);
} catch (MsoException me) {
- // Got an Openstack error. Propagate it
logger.error("{} {} Openstack Exception on Token request: ", MessageEnum.RA_CONNECTION_EXCEPTION,
ErrorCode.AvailabilityError.getValue(), me);
me.addContext(DELETE_STACK);
@@ -576,13 +500,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// OK if stack not found, perform a query first
Stack heatStack = queryHeatStack(heatClient, stackName);
- if (heatStack == null || "DELETE_COMPLETE".equals(heatStack.getStackStatus())) {
+ if (heatStack == null || DELETE_COMPLETE.equals(heatStack.getStackStatus())) {
// Not found. Return a StackInfo with status NOTFOUND
return new StackInfo(stackName, HeatStatus.NOTFOUND);
}
- // Delete the stack.
-
// Use canonical name "<stack name>/<stack-id>" to delete.
// Otherwise, deletion by name returns a 302 redirect.
// NOTE: This is specific to the v1 Orchestration API.
@@ -595,7 +517,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
} else {
logger.debug("Heat Client is NULL");
}
-
executeAndRecordOpenstackRequest(request);
} catch (OpenStackResponseException e) {
if (e.getStatus() == 404) {
@@ -616,18 +537,16 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Requery the stack for current status.
// It will probably still exist with "DELETE_IN_PROGRESS" status.
heatStack = queryHeatStack(heatClient, canonicalName);
-
+ statusHandler.updateStackStatus(heatStack);
if (pollForCompletion) {
- // Set a timeout on polling
-
int pollInterval = Integer
- .parseInt(this.environment.getProperty(deletePollIntervalProp, "" + deletePollIntervalDefault));
+ .parseInt(this.environment.getProperty(deletePollIntervalProp, "" + DELETE_POLL_INTERVAL_DEFAULT));
int pollTimeout = Integer
- .parseInt(this.environment.getProperty(deletePollTimeoutProp, "" + deletePollIntervalDefault));
-
+ .parseInt(this.environment.getProperty(deletePollTimeoutProp, "" + DELETE_POLL_INTERVAL_DEFAULT));
+ statusHandler.updateStackStatus(heatStack);
// When querying by canonical name, Openstack returns DELETE_COMPLETE status
// instead of "404" (which would result from query by stack name).
- while (heatStack != null && !"DELETE_COMPLETE".equals(heatStack.getStackStatus())) {
+ while (heatStack != null && !DELETE_COMPLETE.equals(heatStack.getStackStatus())) {
logger.debug("Stack status: {}", heatStack.getStackStatus());
if ("DELETE_FAILED".equals(heatStack.getStackStatus())) {
@@ -669,67 +588,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// The stack is gone when this point is reached
return new StackInfo(stackName, HeatStatus.NOTFOUND);
}
-
// Return the current status (if not polling, the delete may still be in progress)
StackInfo stackInfo = new StackInfoMapper(heatStack).map();
stackInfo.setName(stackName);
-
return stackInfo;
}
/**
- * Query for all stacks in a tenant site. This call will return a List of StackInfo objects, one for each deployed
- * stack.
- *
- * Note that this is limited to a single site. To ensure that a tenant is truly empty would require looping across
- * all tenant endpoints.
- *
- * @param tenantId The Openstack ID of the tenant to query
- * @param cloudSiteId The cloud identifier (may be a region) in which to query.
- * @return A List of StackInfo objects
- * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
- * @throws MsoCloudSiteNotFound
- */
- public List<StackInfo> queryAllStacks(String tenantId, String cloudSiteId) throws MsoException {
- // Obtain the cloud site information where we will create the stack
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
- Heat heatClient = getHeatClient(cloudSite, tenantId);
-
- try {
- OpenStackRequest<Stacks> request = heatClient.getStacks().list();
- Stacks stacks = executeAndRecordOpenstackRequest(request);
-
- List<StackInfo> stackList = new ArrayList<>();
-
- // Not sure if returns an empty list or null if no stacks exist
- if (stacks != null) {
- for (Stack stack : stacks) {
- stackList.add(new StackInfoMapper(stack).map());
- }
- }
-
- return stackList;
- } catch (OpenStackResponseException e) {
- if (e.getStatus() == 404) {
- // Not sure if this can happen, but return an empty list
- logger.debug("queryAllStacks - stack not found: ");
- return new ArrayList<>();
- } else {
- // Convert the OpenStackResponseException to an MsoOpenstackException
- throw heatExceptionToMsoException(e, QUERY_ALL_STACKS);
- }
- } catch (OpenStackConnectException e) {
- // Error connecting to Openstack instance. Convert to an MsoException
- throw heatExceptionToMsoException(e, QUERY_ALL_STACKS);
- } catch (RuntimeException e) {
- // Catch-all
- throw runtimeExceptionToMsoException(e, QUERY_ALL_STACKS);
- }
- }
-
- /**
* Validate parameters to be passed to Heat template. This method performs three functions: 1. Apply default values
* to parameters which have them defined 2. Report any required parameters that are missing. This will generate an
* exception in the caller, since stack create/update operations would fail. 3. Report and remove any extraneous
@@ -785,8 +650,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
return updatedParams;
}
- // ---------------------------------------------------------------
- // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS
/**
* Get a Heat client for the Openstack Identity service. This requires a 'member'-level userId + password, which
@@ -798,91 +661,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
*
* @return an authenticated Heat object
*/
- public Heat getHeatClient(CloudSite cloudSite, String tenantId) throws MsoException {
- String cloudId = cloudSite.getId();
- // For DCP/LCP, the region should be the cloudId.
- String region = cloudSite.getRegionId();
-
- // Obtain an MSO token for the tenant
- CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- logger.debug("Found: {}", cloudIdentity.toString());
- MsoTenantUtils tenantUtils =
- tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
- String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
- logger.debug("keystoneUrl={}", keystoneUrl);
- String heatUrl = null;
- String tokenId = null;
- Calendar expiration = null;
- try {
- 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 {
- logger.debug("access={}", access.toString());
- for (Access.Service service : access.getServiceCatalog()) {
- List<Access.Service.Endpoint> endpoints = service.getEndpoints();
- for (Access.Service.Endpoint endpoint : endpoints) {
- logger.debug("AIC returned region={}", endpoint.getRegion());
- }
- }
- } catch (Exception e) {
- logger.debug("Encountered an error trying to printout Access object returned from AIC. {}",
- e.getMessage(), e);
- }
- heatUrl = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "orchestration", region,
- "public");
- logger.debug("heatUrl={}, region={}", heatUrl, region);
- } catch (RuntimeException e) {
- // This comes back for not found (probably an incorrect region ID)
- String error = "AIC did not match an orchestration service for: region=" + region + ",cloud="
- + cloudIdentity.getIdentityUrl();
- throw new MsoAdapterException(error, e);
- }
- tokenId = access.getToken().getId();
- expiration = access.getToken().getExpires();
- } else if (ServerType.KEYSTONE_V3.equals(cloudIdentity.getIdentityServerType())) {
- try {
- KeystoneAuthHolder holder = keystoneV3Authentication.getToken(cloudSite, tenantId, "orchestration");
- tokenId = holder.getId();
- expiration = holder.getexpiration();
- heatUrl = holder.getServiceUrl();
- } catch (ServiceEndpointNotFoundException e) {
- // This comes back for not found (probably an incorrect region ID)
- String error = "cloud did not match an orchestration service for: region=" + region + ",cloud="
- + cloudIdentity.getIdentityUrl();
- throw new MsoAdapterException(error, e);
- }
- }
- } catch (OpenStackResponseException e) {
- if (e.getStatus() == 401) {
- // Authentication error.
- String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId();
-
- throw new MsoAdapterException(error);
- } else {
- throw keystoneErrorToMsoException(e, TOKEN_AUTH);
- }
- } catch (OpenStackConnectException e) {
- // Connection to Openstack failed
- MsoIOException me = new MsoIOException(e.getMessage(), e);
- me.addContext(TOKEN_AUTH);
- throw me;
- } catch (RuntimeException e) {
- // Catch-all
- throw runtimeExceptionToMsoException(e, TOKEN_AUTH);
- }
- Heat heatClient = new Heat(heatUrl);
- heatClient.token(tokenId);
+ public Heat getHeatClient(String cloudSiteId, String tenantId) throws MsoException {
+ KeystoneAuthHolder keystone = getKeystoneAuthHolder(cloudSiteId, tenantId, "orchestration");
+ Heat heatClient = new Heat(keystone.getServiceUrl());
+ heatClient.token(keystone.getId());
return heatClient;
}
@@ -904,7 +686,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
*
* @throws MsoOpenstackException Thrown if the Openstack API call returns an exception
*/
- protected Stack queryHeatStack(Heat heatClient, String stackName) throws MsoException {
+ public Stack queryHeatStack(Heat heatClient, String stackName) throws MsoException {
if (stackName == null) {
return null;
}
@@ -926,6 +708,13 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
}
+ public Stack queryHeatStack(String stackName, String cloudSiteId, String tenantId) throws MsoException {
+ if (stackName == null) {
+ return null;
+ }
+ return queryHeatStack(getHeatClient(cloudSiteId, tenantId), stackName);
+ }
+
public Map<String, Object> queryStackForOutputs(String cloudSiteId, String cloudOwner, String tenantId,
String stackName) throws MsoException {
@@ -988,47 +777,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
return;
}
- public StringBuilder requestToStringBuilder(CreateStackParam stack) {
- StringBuilder sb = new StringBuilder();
- sb.append("Stack:\n");
- sb.append("\tStackName: " + stack.getStackName());
- sb.append("\tTemplateUrl: " + stack.getTemplateUrl());
- sb.append("\tTemplate: " + stack.getTemplate());
- sb.append("\tEnvironment: " + stack.getEnvironment());
- sb.append("\tTimeout: " + stack.getTimeoutMinutes());
- sb.append("\tParameters:\n");
- Map<String, Object> params = stack.getParameters();
- if (params == null || params.size() < 1) {
- sb.append("\nNONE");
- } else {
- for (String key : params.keySet()) {
- if (params.get(key) instanceof String) {
- sb.append("\n").append(key).append("=").append((String) params.get(key));
- } else if (params.get(key) instanceof JsonNode) {
- String jsonStringOut = this.convertNode((JsonNode) params.get(key));
- sb.append("\n").append(key).append("=").append(jsonStringOut);
- } else if (params.get(key) instanceof Integer) {
- String integerOut = "" + params.get(key);
- sb.append("\n").append(key).append("=").append(integerOut);
-
- } else {
- try {
- String str = params.get(key).toString();
- sb.append("\n").append(key).append("=").append(str);
- } catch (Exception e) {
- logger.debug("Exception :", e);
- }
- }
- }
- }
- return sb;
- }
-
private String convertNode(final JsonNode node) {
try {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
- final String json = JSON_MAPPER.writeValueAsString(obj);
- return json;
+ return JSON_MAPPER.writeValueAsString(obj);
} catch (Exception e) {
logger.debug("Error converting json to string {} ", e.getMessage(), e);
}
@@ -1192,44 +944,32 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
HashMap<String, HeatTemplateParam> paramAliases = new HashMap<>();
if (inputs == null) {
- logger.debug("convertInputMap - inputs is null - nothing to do here");
return new HashMap<>();
}
-
- logger.debug("convertInputMap in MsoHeatUtils called, with {} inputs, and template {}", inputs.size(),
- template.getArtifactUuid());
try {
- logger.debug(template.toString());
Set<HeatTemplateParam> paramSet = template.getParameters();
- logger.debug("paramSet has {} entries", paramSet.size());
} catch (Exception e) {
logger.debug("Exception occurred in convertInputMap {} :", e.getMessage(), e);
}
for (HeatTemplateParam htp : template.getParameters()) {
- logger.debug("Adding {}", htp.getParamName());
params.put(htp.getParamName(), htp);
if (htp.getParamAlias() != null && !"".equals(htp.getParamAlias())) {
logger.debug("\tFound ALIAS {} -> {}", htp.getParamName(), htp.getParamAlias());
paramAliases.put(htp.getParamAlias(), htp);
}
}
- logger.debug("Now iterate through the inputs...");
+
for (String key : inputs.keySet()) {
- logger.debug("key={}", key);
boolean alias = false;
String realName = null;
if (!params.containsKey(key)) {
- logger.debug("{} is not a parameter in the template! - check for an alias", key);
// add check here for an alias
if (!paramAliases.containsKey(key)) {
- logger.debug("The parameter {} is in the inputs, but it's not a parameter for this template - omit",
- key);
continue;
} else {
alias = true;
realName = paramAliases.get(key).getParamName();
- logger.debug("FOUND AN ALIAS! Will use {} in lieu of give key/alias {}", realName, key);
}
}
String type = params.get(key).getParamType();
@@ -1237,7 +977,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("**PARAM_TYPE is null/empty for {}, will default to string", key);
type = "string";
}
- logger.debug("Parameter: {} is of type {}", key, type);
if ("string".equalsIgnoreCase(type)) {
// Easiest!
String str = inputs.get(key) != null ? inputs.get(key).toString() : null;
@@ -1321,92 +1060,21 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
* This helpful method added for Valet
*/
public String getCloudSiteKeystoneUrl(String cloudSiteId) throws MsoCloudSiteNotFound {
- String keystone_url = null;
+ String keystoneUrl = null;
try {
CloudSite cloudSite =
cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- keystone_url = cloudIdentity.getIdentityUrl();
+ keystoneUrl = cloudIdentity.getIdentityUrl();
} catch (Exception e) {
throw new MsoCloudSiteNotFound(cloudSiteId);
}
- if (keystone_url == null || keystone_url.isEmpty()) {
+ if (keystoneUrl == null || keystoneUrl.isEmpty()) {
throw new MsoCloudSiteNotFound(cloudSiteId);
}
- return keystone_url;
+ return keystoneUrl;
}
- /*
- * Create a string suitable for being dumped to a debug log that creates a pseudo-JSON request dumping what's being
- * sent to Openstack API in the create or update request
- */
-
- private String printStackRequest(String tenantId, Map<String, Object> heatFiles,
- Map<String, Object> nestedTemplates, String environment, Map<String, Object> inputs, String vfModuleName,
- String template, int timeoutMinutes, boolean backout, String cloudSiteId) {
- StringBuilder sb = new StringBuilder();
- sb.append("CREATE STACK REQUEST (formatted for readability)\n");
- sb.append("tenant=" + tenantId + ", cloud=" + cloudSiteId);
- sb.append("{\n");
- sb.append(" \"stack_name\": \"" + vfModuleName + "\",\n");
- sb.append(" \"disable_rollback\": " + backout + ",\n");
- sb.append(" \"timeout_mins\": " + timeoutMinutes + ",\n");
- sb.append(" \"template\": {\n");
- sb.append(template);
- sb.append(" },\n");
- sb.append(" \"environment\": {\n");
- if (environment == null)
- sb.append("<none>");
- else
- sb.append(environment);
- sb.append(" },\n");
- sb.append(" \"files\": {\n");
- int filesCounter = 0;
- if (heatFiles != null) {
- for (String key : heatFiles.keySet()) {
- filesCounter++;
- if (filesCounter > 1) {
- sb.append(",\n");
- }
- sb.append(" \"" + key + "\": {\n");
- sb.append(heatFiles.get(key).toString() + "\n }");
- }
- }
- if (nestedTemplates != null) {
- for (String key : nestedTemplates.keySet()) {
- filesCounter++;
- if (filesCounter > 1) {
- sb.append(",\n");
- }
- sb.append(" \"" + key + "\": {\n");
- sb.append(nestedTemplates.get(key).toString() + "\n }");
- }
- }
- sb.append("\n },\n");
- sb.append(" \"parameters\": {\n");
- int paramCounter = 0;
- for (String name : inputs.keySet()) {
- paramCounter++;
- if (paramCounter > 1) {
- sb.append(",\n");
- }
- Object o = inputs.get(name);
- if (o instanceof java.lang.String) {
- sb.append(" \"" + name + "\": \"" + inputs.get(name).toString() + "\"");
- } else if (o instanceof Integer) {
- sb.append(" \"" + name + "\": " + inputs.get(name).toString());
- } else if (o instanceof ArrayList) {
- sb.append(" \"" + name + "\": " + inputs.get(name).toString());
- } else if (o instanceof Boolean) {
- sb.append(" \"" + name + "\": " + inputs.get(name).toString());
- } else {
- sb.append(" \"" + name + "\": " + "\"(there was an issue trying to dump this value...)\"");
- }
- }
- sb.append("\n }\n}\n");
-
- return sb.toString();
- }
/*******************************************************************************
*
@@ -1550,7 +1218,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) {
vduStatus.setState(VduStateType.INSTANTIATING);
- vduStatus.setLastAction((new PluginAction("create", "in_progress", statusMessage)));
+ vduStatus.setLastAction((new PluginAction("create", IN_PROGRESS, statusMessage)));
} else if (heatStatus == HeatStatus.NOTFOUND) {
vduStatus.setState(VduStateType.NOTFOUND);
} else if (heatStatus == HeatStatus.CREATED) {
@@ -1561,10 +1229,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
vduStatus.setLastAction((new PluginAction("update", "complete", statusMessage)));
} else if (heatStatus == HeatStatus.UPDATING) {
vduStatus.setState(VduStateType.UPDATING);
- vduStatus.setLastAction((new PluginAction("update", "in_progress", statusMessage)));
+ vduStatus.setLastAction((new PluginAction("update", IN_PROGRESS, statusMessage)));
} else if (heatStatus == HeatStatus.DELETING) {
vduStatus.setState(VduStateType.DELETING);
- vduStatus.setLastAction((new PluginAction("delete", "in_progress", statusMessage)));
+ vduStatus.setLastAction((new PluginAction("delete", IN_PROGRESS, statusMessage)));
} else if (heatStatus == HeatStatus.FAILED) {
vduStatus.setState(VduStateType.FAILED);
vduStatus.setErrorMessage(stackInfo.getStatusMessage());
@@ -1577,21 +1245,39 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
public Resources queryStackResources(String cloudSiteId, String tenantId, String stackName, int nestedDepth)
throws MsoException {
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- Heat heatClient = getHeatClient(cloudSite, tenantId);
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
OpenStackRequest<Resources> request =
heatClient.getResources().listResources(stackName).queryParam("nested_depth", nestedDepth);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
+ }
+
+ public Events queryStackEvents(String cloudSiteId, String tenantId, String stackName, String stackId,
+ int nestedDepth) throws MsoException {
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
+ OpenStackRequest<Events> request =
+ heatClient.getEvents().listEvents(stackName, stackId).queryParam("nested_depth", nestedDepth);
+ return executeAndRecordOpenstackRequest(request, false);
+ }
+
+ public Stacks queryStacks(String cloudSiteId, String tenantId, int limit, String marker)
+ throws MsoCloudSiteNotFound, HeatClientException {
+ Heat heatClient;
+ try {
+ heatClient = getHeatClient(cloudSiteId, tenantId);
+ } catch (MsoException e) {
+ logger.error("Error Creating Heat Client", e);
+ throw new HeatClientException("Error Creating Heat Client", e);
+ }
+ OpenStackRequest<Stacks> request =
+ heatClient.getStacks().list().queryParam("limit", limit).queryParam("marker", marker);
+ return executeAndRecordOpenstackRequest(request, false);
}
public <R> R executeHeatClientRequest(String url, String cloudSiteId, String tenantId, Class<R> returnType)
throws MsoException {
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- Heat heatClient = getHeatClient(cloudSite, tenantId);
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
OpenStackRequest<R> request = heatClient.get(url, returnType);
- return executeAndRecordOpenstackRequest(request);
+ return executeAndRecordOpenstackRequest(request, false);
}
protected void sleep(long time) {
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 1bf780f6d3..684fe98bf3 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
@@ -24,25 +24,14 @@
package org.onap.so.openstack.utils;
-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.OpenStackBaseException;
-import com.woorea.openstack.base.client.OpenStackRequest;
-import com.woorea.openstack.heat.Heat;
-import com.woorea.openstack.heat.model.Stack;
-import com.woorea.openstack.heat.model.Stack.Output;
-import com.woorea.openstack.heat.model.UpdateStackParam;
import java.io.IOException;
import java.util.ArrayList;
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.openstack.beans.StackInfo;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.onap.so.openstack.exceptions.MsoStackNotFound;
@@ -52,6 +41,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.heat.Heat;
+import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.heat.model.Stack.Output;
+import com.woorea.openstack.heat.model.UpdateStackParam;
@Component
public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
@@ -60,6 +58,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtilsWithUpdate.class);
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+ public static final String EXCEPTION = "Exception :";
@Autowired
private Environment environment;
@@ -137,12 +136,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
haveHeatFiles = false;
}
- // Obtain the cloud site information where we will create the stack
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
- // This could throw MsoTenantNotFound or MsoOpenstackException (both propagated)
- Heat heatClient = getHeatClient(cloudSite, tenantId);
+ Heat heatClient = getHeatClient(cloudSiteId, tenantId);
// Perform a query first to get the current status
Stack heatStack = queryHeatStack(heatClient, stackName);
@@ -221,8 +215,8 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
// Set a time limit on overall polling.
// Use the resource (template) timeout for Openstack (expressed in minutes)
// and add one poll interval to give Openstack a chance to fail on its own.
- int createPollInterval =
- Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
+ int createPollInterval = Integer
+ .parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
boolean loopAgain = true;
@@ -335,7 +329,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
String str = JSON_MAPPER.writeValueAsString(obj);
sb.append(str).append(" (a java.util.LinkedHashMap)");
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
sb.append("(a LinkedHashMap value that would not convert nicely)");
}
} else if (obj instanceof Integer) {
@@ -343,7 +337,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
try {
str = obj.toString() + " (an Integer)\n";
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
str = "(an Integer unable to call .toString() on)";
}
sb.append(str);
@@ -352,7 +346,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
try {
str = obj.toString() + " (an ArrayList)";
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
str = "(an ArrayList unable to call .toString() on?)";
}
sb.append(str);
@@ -361,7 +355,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
try {
str = obj.toString() + " (a Boolean)";
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
str = "(an Boolean unable to call .toString() on?)";
}
sb.append(str);
@@ -370,7 +364,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
try {
str = obj.toString() + " (unknown Object type)";
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
str = "(a value unable to call .toString() on?)";
}
sb.append(str);
@@ -384,8 +378,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
private String convertNodeWithUpdate(final JsonNode node) {
try {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
- final String json = JSON_MAPPER.writeValueAsString(obj);
- return json;
+ return JSON_MAPPER.writeValueAsString(obj);
} catch (Exception e) {
logger.debug("Error converting json to string {} ", e.getMessage(), e);
}
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 cfc8c23c5f..f74a3f5f53 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
@@ -23,19 +23,6 @@
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.model.Metadata;
-import com.woorea.openstack.keystone.model.Role;
-import com.woorea.openstack.keystone.model.Roles;
-import com.woorea.openstack.keystone.model.Tenant;
-import com.woorea.openstack.keystone.model.User;
-import com.woorea.openstack.keystone.utils.KeystoneUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
@@ -54,10 +41,24 @@ import org.slf4j.Logger;
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.model.Metadata;
+import com.woorea.openstack.keystone.model.Role;
+import com.woorea.openstack.keystone.model.Roles;
+import com.woorea.openstack.keystone.model.Tenant;
+import com.woorea.openstack.keystone.model.User;
+import com.woorea.openstack.keystone.utils.KeystoneUtils;
@Component
public class MsoKeystoneUtils extends MsoTenantUtils {
+ public static final String DELETE_TENANT = "Delete Tenant";
private static Logger logger = LoggerFactory.getLogger(MsoKeystoneUtils.class);
@Autowired
@@ -207,7 +208,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
return null;
}
- Map<String, String> metadata = new HashMap<String, String>();
+ Map<String, String> metadata = new HashMap<>();
if (cloudSite.getIdentityService().getTenantMetadata()) {
OpenStackRequest<Metadata> request = keystoneAdminClient.tenants().showMetadata(tenant.getId());
Metadata tenantMetadata = executeAndRecordOpenstackRequest(request);
@@ -252,7 +253,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
return null;
}
- Map<String, String> metadata = new HashMap<String, String>();
+ Map<String, String> metadata = new HashMap<>();
if (cloudSite.getIdentityService().getTenantMetadata()) {
OpenStackRequest<Metadata> request = keystoneAdminClient.tenants().showMetadata(tenant.getId());
Metadata tenantMetadata = executeAndRecordOpenstackRequest(request);
@@ -304,10 +305,10 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
logger.debug("Deleted Tenant {} ({})", tenant.getId(), tenant.getName());
} catch (OpenStackBaseException e) {
// Convert Keystone OpenStackResponseException to MsoOpenstackException
- throw keystoneErrorToMsoException(e, "Delete Tenant");
+ throw keystoneErrorToMsoException(e, DELETE_TENANT);
} catch (RuntimeException e) {
// Catch-all
- throw runtimeExceptionToMsoException(e, "DeleteTenant");
+ throw runtimeExceptionToMsoException(e, DELETE_TENANT);
}
return true;
@@ -354,10 +355,10 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
} catch (OpenStackBaseException e) {
// Note: It doesn't seem to matter if tenant doesn't exist, no exception is thrown.
// Convert Keystone OpenStackResponseException to MsoOpenstackException
- throw keystoneErrorToMsoException(e, "DeleteTenant");
+ throw keystoneErrorToMsoException(e, DELETE_TENANT);
} catch (RuntimeException e) {
// Catch-all
- throw runtimeExceptionToMsoException(e, "DeleteTenant");
+ throw runtimeExceptionToMsoException(e, DELETE_TENANT);
}
return true;
@@ -379,7 +380,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
public Keystone getKeystoneAdminClient(CloudSite cloudSite) throws MsoException {
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- String cloudId = cloudIdentity.getId();
String adminTenantName = cloudIdentity.getAdminTenant();
String region = cloudSite.getRegionId();
@@ -414,7 +414,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
// Get the Identity service URL. Throws runtime exception if not found per region.
String adminUrl = null;
try {
- // TODO: FOR TESTING!!!!
adminUrl = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "identity", region, "public");
adminUrl = adminUrl.replaceFirst("5000", "35357");
} catch (RuntimeException 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 8c570e25d7..c75aa9a67e 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -22,15 +22,9 @@
package org.onap.so.openstack.utils;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.woorea.openstack.heat.model.CreateStackParam;
-import com.woorea.openstack.heat.model.Stack;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Scanner;
import javax.ws.rs.core.Response;
@@ -54,7 +48,6 @@ import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.exceptions.MsoAdapterException;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.onap.so.openstack.mappers.StackInfoMapper;
@@ -64,6 +57,11 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableSet;
+import com.woorea.openstack.heat.model.CreateStackParam;
+import com.woorea.openstack.heat.model.Stack;
@Component
public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
@@ -75,8 +73,8 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
public static final String VF_MODULE_ID = "vf_module_id";
public static final String TEMPLATE_TYPE = "template_type";
public static final String MULTICLOUD_QUERY_BODY_NULL = "multicloudQueryBody is null";
- public static final List<String> MULTICLOUD_INPUTS =
- Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE);
+ public static final ImmutableSet<String> MULTICLOUD_INPUTS =
+ ImmutableSet.of(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE);
private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class);
@@ -300,7 +298,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
responseBody = getQueryBody((java.io.InputStream) response.getEntity());
if (responseBody != null) {
if (logger.isDebugEnabled()) {
- logger.debug("Multicloud Create Response Body: " + responseBody.toString());
+ logger.debug("Multicloud Create Response Body: {}", responseBody);
}
Stack workloadStack = getWorkloadStack(responseBody.getWorkloadStatusReason());
if (workloadStack != null && !responseBody.getWorkloadStatus().equals("GET_FAILED")
@@ -355,7 +353,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
}
}
if (workloadStack != null)
- logger.debug("Multicloud getWorkloadStack() returning Stack Object: {} ", workloadStack.toString());
+ logger.debug("Multicloud getWorkloadStack() returning Stack Object: {} ", workloadStack);
return workloadStack;
}
@@ -458,8 +456,8 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
Response response = multicloudClient.post(multicloudRequest);
if (response.getStatus() != Response.Status.ACCEPTED.getStatusCode()) {
if (logger.isDebugEnabled())
- logger.debug(
- "Multicloud AAI update request failed: " + response.getStatus() + response.getStatusInfo());
+ logger.debug("Multicloud AAI update request failed: {} {}", response.getStatus(),
+ response.getStatusInfo());
return;
}
@@ -468,17 +466,17 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
}
int updatePollInterval =
- Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
+ Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollTimeout = (timeoutMinutes * 60) + updatePollInterval;
boolean updateTimedOut = false;
- logger.debug("updatePollInterval=" + updatePollInterval + ", pollTimeout=" + pollTimeout);
+ logger.debug("updatePollInterval={}, pollTimeout={}", updatePollInterval, pollTimeout);
StackInfo stackInfo = null;
while (true) {
try {
stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, workloadId);
if (logger.isDebugEnabled())
- logger.debug(stackInfo.getStatus() + " (" + workloadId + ")");
+ logger.debug("{} ({})", stackInfo.getStatus(), workloadId);
if (HeatStatus.UPDATING.equals(stackInfo.getStatus())) {
if (pollTimeout <= 0) {
@@ -495,7 +493,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
pollTimeout -= updatePollInterval;
if (logger.isDebugEnabled())
- logger.debug("pollTimeout remaining: " + pollTimeout);
+ logger.debug("pollTimeout remaining: {}", pollTimeout);
} else {
break;
}
@@ -509,15 +507,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
if (updateTimedOut) {
if (logger.isDebugEnabled())
logger.debug("Multicloud AAI update request failed: {} {}", response.getStatus(),
- response.getStatusInfo().toString());
+ response.getStatusInfo());
} else if (!HeatStatus.UPDATED.equals(stackInfo.getStatus())) {
if (logger.isDebugEnabled())
logger.debug("Multicloud AAI update request failed: {} {}", response.getStatus(),
- response.getStatusInfo().toString());
+ response.getStatusInfo());
} else {
if (logger.isDebugEnabled())
- logger.debug("Multicloud AAI update successful: {} {}", response.getStatus(),
- response.getStatusInfo().toString());
+ logger.debug("Multicloud AAI update successful: {} {}", response.getStatus(), response.getStatusInfo());
}
}
@@ -536,20 +533,20 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
// Use the resource (template) timeout for Openstack (expressed in minutes)
// and add one poll interval to give Openstack a chance to fail on its own.s
- int createPollInterval =
- Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
+ int createPollInterval = Integer
+ .parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
// New 1610 - poll on delete if we rollback - use same values for now
int deletePollInterval = createPollInterval;
int deletePollTimeout = pollTimeout;
boolean createTimedOut = false;
StringBuilder stackErrorStatusReason = new StringBuilder("");
- logger.debug("createPollInterval=" + createPollInterval + ", pollTimeout=" + pollTimeout);
+ logger.debug("createPollInterval={}, pollTimeout={} ", createPollInterval, pollTimeout);
while (true) {
try {
stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
- logger.debug(stackInfo.getStatus() + " (" + instanceId + ")");
+ logger.debug("{} ({})", stackInfo.getStatus(), instanceId);
if (HeatStatus.BUILDING.equals(stackInfo.getStatus())) {
// Stack creation is still running.
@@ -568,7 +565,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
sleep(createPollInterval * 1000L);
pollTimeout -= createPollInterval;
- logger.debug("pollTimeout remaining: " + pollTimeout);
+ logger.debug("pollTimeout remaining: {}", pollTimeout);
} else {
// save off the status & reason msg before we attempt delete
stackErrorStatusReason
@@ -597,7 +594,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
while (!deleted) {
try {
StackInfo queryInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
- logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus());
+ logger.debug("Deleting {}, status: {}", instanceId, queryInfo.getStatus());
if (HeatStatus.DELETING.equals(queryInfo.getStatus())) {
if (deletePollTimeout <= 0) {
logger.error(String.format("%s %s %s %s %s %s %s %s %d %s",
@@ -611,7 +608,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
deletePollTimeout -= deletePollInterval;
}
} else if (HeatStatus.NOTFOUND.equals(queryInfo.getStatus())) {
- logger.debug("DELETE_COMPLETE for " + instanceId);
+ logger.debug("DELETE_COMPLETE for {}", instanceId);
deleted = true;
continue;
} else {
@@ -665,7 +662,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
while (!deleted) {
try {
StackInfo queryInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
- logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus());
+ logger.debug("Deleting {}, status: {}", instanceId, queryInfo.getStatus());
if (HeatStatus.DELETING.equals(queryInfo.getStatus())) {
if (deletePollTimeout <= 0) {
logger.error(String.format("%s %s %s %s %s %s %s %s %d %s",
@@ -679,7 +676,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
deletePollTimeout -= deletePollInterval;
}
} else if (HeatStatus.NOTFOUND.equals(queryInfo.getStatus())) {
- logger.debug("DELETE_COMPLETE for " + instanceId);
+ logger.debug("DELETE_COMPLETE for {}", instanceId);
deleted = true;
continue;
} else {
@@ -731,7 +728,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
} else {
// Get initial status, since it will have been null after the create.
stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
- logger.debug("Multicloud stack query status is: " + stackInfo.getStatus());
+ logger.debug("Multicloud stack query status is: {}", stackInfo.getStatus());
}
return stackInfo;
}
@@ -770,7 +767,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
try {
return new ObjectMapper().readerFor(MulticloudCreateResponse.class).readValue(body);
} catch (Exception e) {
- logger.debug("Exception retrieving multicloud vfModule POST response body " + e);
+ logger.debug("Exception retrieving multicloud vfModule POST response body ", e);
}
return null;
}
@@ -787,7 +784,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
try {
return new ObjectMapper().readerFor(MulticloudQueryResponse.class).readValue(body);
} catch (Exception e) {
- logger.debug("Exception retrieving multicloud workload query response body " + e);
+ logger.debug("Exception retrieving multicloud workload query response body ", e);
}
return null;
}
@@ -829,14 +826,11 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
client.addAdditionalHeader("Project", tenantId);
}
} catch (MalformedURLException e) {
- logger.debug(
- String.format("Encountered malformed URL error getting multicloud rest client %s", e.getMessage()));
+ logger.debug("Encountered malformed URL error getting multicloud rest client ", e);
} catch (IllegalArgumentException e) {
- logger.debug(
- String.format("Encountered illegal argument getting multicloud rest client %s", e.getMessage()));
+ logger.debug("Encountered illegal argument getting multicloud rest client ", e);
} catch (UriBuilderException e) {
- logger.debug(
- String.format("Encountered URI builder error getting multicloud rest client %s", e.getMessage()));
+ logger.debug("Encountered URI builder error getting multicloud rest client ", e);
}
return client;
}
@@ -990,7 +984,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
// There are lots of HeatStatus values, so this is a bit long...
HeatStatus heatStatus = stackInfo.getStatus();
String statusMessage = stackInfo.getStatusMessage();
- logger.debug("HeatStatus = " + heatStatus + " msg = " + statusMessage);
+ logger.debug("HeatStatus = {} msg = {}", heatStatus, statusMessage);
if (logger.isDebugEnabled()) {
logger.debug(String.format("Stack Status: %s", heatStatus.toString()));
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
index 78db27f65e..44fc620b07 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
@@ -130,13 +130,13 @@ public class MsoNeutronUtils extends MsoCommonUtils {
network.setAdminStateUp(true);
if (type == NetworkType.PROVIDER) {
- if (provider != null && vlans != null && vlans.size() > 0) {
+ if (provider != null && vlans != null && !vlans.isEmpty()) {
network.setProviderPhysicalNetwork(provider);
network.setProviderNetworkType("vlan");
network.setProviderSegmentationId(vlans.get(0));
}
} else if (type == NetworkType.MULTI_PROVIDER) {
- if (provider != null && vlans != null && vlans.size() > 0) {
+ if (provider != null && vlans != null && !vlans.isEmpty()) {
List<Segment> segments = new ArrayList<>(vlans.size());
for (int vlan : vlans) {
Segment segment = new Segment();
@@ -373,7 +373,7 @@ public class MsoNeutronUtils extends MsoCommonUtils {
final String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
String neutronUrl = null;
String tokenId = null;
- Calendar expiration = null;
+
try {
if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) {
Keystone keystoneTenantClient = new Keystone(keystoneUrl);
@@ -382,7 +382,7 @@ public class MsoNeutronUtils extends MsoCommonUtils {
Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity);
OpenStackRequest<Access> request =
keystoneTenantClient.tokens().authenticate(credentials).withTenantId(tenantId);
- access = executeAndRecordOpenstackRequest(request);
+ access = executeAndRecordOpenstackRequest(request, true);
try {
@@ -396,12 +396,12 @@ public class MsoNeutronUtils extends MsoCommonUtils {
throw new MsoAdapterException(error, e);
}
tokenId = access.getToken().getId();
- expiration = access.getToken().getExpires();
+
} else if (ServerType.KEYSTONE_V3.equals(cloudIdentity.getIdentityServerType())) {
try {
KeystoneAuthHolder holder = keystoneV3Authentication.getToken(cloudSite, tenantId, "network");
tokenId = holder.getId();
- expiration = holder.getexpiration();
+
neutronUrl = holder.getServiceUrl();
if (!neutronUrl.endsWith("/")) {
neutronUrl += "/v2.0/";
@@ -499,7 +499,7 @@ public class MsoNeutronUtils extends MsoCommonUtils {
try {
OpenStackRequest<Port> request = neutronClient.ports().show(neutronPortId);
- Port port = executeAndRecordOpenstackRequest(request);
+ Port port = executeAndRecordOpenstackRequest(request, false);
return port;
} catch (OpenStackResponseException e) {
if (e.getStatus() == 404) {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java
index 0541a8f51b..9ee8a09ea6 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java
@@ -40,6 +40,7 @@ import org.yaml.snakeyaml.Yaml;
public class MsoYamlEditorWithEnvt {
private static final Logger logger = LoggerFactory.getLogger(MsoYamlEditorWithEnvt.class);
+ public static final String EXCEPTION = "Exception:";
private Map<String, Object> yml;
private Yaml yaml = new Yaml();
@@ -68,7 +69,7 @@ public class MsoYamlEditorWithEnvt {
try {
resourceMap = (Map<String, Object>) yml.get("parameters");
} catch (Exception e) {
- logger.debug("Exception:", e);
+ logger.debug(EXCEPTION, e);
return paramSet;
}
if (resourceMap == null) {
@@ -89,7 +90,7 @@ public class MsoYamlEditorWithEnvt {
try {
value = JSON_MAPPER.writeValueAsString(obj);
} catch (Exception e) {
- logger.debug("Exception:", e);
+ logger.debug(EXCEPTION, e);
value = "_BAD_JSON_MAPPING";
}
} else {
@@ -118,7 +119,7 @@ public class MsoYamlEditorWithEnvt {
}
return resourceList;
} catch (Exception e) {
- logger.debug("Exception:", e);
+ logger.debug(EXCEPTION, e);
}
return null;
}
@@ -137,7 +138,7 @@ public class MsoYamlEditorWithEnvt {
try {
value = resourceEntry.get("default");
} catch (ClassCastException cce) {
- logger.debug("Exception:", cce);
+ logger.debug(EXCEPTION, cce);
// This exception only - the value is an integer. For what we're doing
// here - we don't care - so set value to something - and it will
// get marked as not being required - which is correct.
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java
index a4cdba22a1..16671bbe50 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateHeatResponse.java
@@ -31,7 +31,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"id", "links"})
public class MulticloudCreateHeatResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("id")
private String id;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java
index e8a5b1480e..1f55aa92a2 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateLinkResponse.java
@@ -31,7 +31,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"href", "rel"})
public class MulticloudCreateLinkResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("href")
private String href;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java
index 732f9b5196..9fa4557a45 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java
@@ -33,7 +33,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({"template_type", "workload_id", "template_response", "workload_status_reason", "workload_status"})
public class MulticloudCreateResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("template_type")
private String templateType;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
index a22937aea3..c575304ade 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudQueryResponse.java
@@ -31,7 +31,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"template_type", "workload_id", "workload_status", "workload_status_reason"})
public class MulticloudQueryResponse implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("template_type")
private String templateType;
@@ -40,7 +40,7 @@ public class MulticloudQueryResponse implements Serializable {
@JsonProperty("workload_status")
private String workloadStatus;
@JsonProperty("workload_status_reason")
- private JsonNode workloadStatusReason;
+ private transient JsonNode workloadStatusReason;
@JsonCreator
public MulticloudQueryResponse(@JsonProperty("template_type") String templateType,
diff --git a/adapters/mso-adapter-utils/src/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 b733552a2b..95dd48caa6 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
@@ -33,7 +33,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
"vf-module-model-customization-id", "oof_directives", "sdnc_directives", "user_directives", "template_type",
"template_data"})
public class MulticloudRequest implements Serializable {
- private final static long serialVersionUID = -5215028275577848311L;
+ private static final long serialVersionUID = -5215028275577848311L;
@JsonProperty("generic-vnf-id")
private String genericVnfId;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientException.java
new file mode 100644
index 0000000000..e2c917c6eb
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientException.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.openstack.utils;
+
+public class NeutronClientException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -9047340957886416022L;
+
+ public NeutronClientException(String error, Exception e) {
+ super(error, e);
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
new file mode 100644
index 0000000000..938a888bbd
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.onap.so.cloud.authentication.KeystoneAuthHolder;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.quantum.Quantum;
+import com.woorea.openstack.quantum.model.Networks;
+import com.woorea.openstack.quantum.model.Subnets;
+
+
+
+@Component
+public class NeutronClientImpl extends MsoCommonUtils {
+
+ /** The Constant logger. */
+ private static final Logger logger = LoggerFactory.getLogger(NeutronClientImpl.class);
+
+ /**
+ * Gets the Neutron client, using old object named Quantum, now renamed Neutron
+ *
+ * @param cloudSite the cloud site
+ * @param tenantId the tenant id
+ * @return the Neutron client
+ * @throws MsoException the mso exception
+ */
+ private Quantum getNeutronClient(String cloudSiteId, String tenantId) throws MsoException {
+ KeystoneAuthHolder keystone = getKeystoneAuthHolder(cloudSiteId, tenantId, "network");
+ Quantum neutronClient = new Quantum(keystone.getServiceUrl() + "/v2.0/");
+ neutronClient.token(keystone.getId());
+ return neutronClient;
+ }
+
+
+ /**
+ * Query Networks
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param limit limits the number of records returned
+ * @param marker the last viewed record
+ * @param name of the newtork
+ * @param id of the network
+ * @return the list of networks in openstack
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public Networks queryNetworks(String cloudSiteId, String tenantId, int limit, String marker, String name, String id)
+ throws MsoCloudSiteNotFound, NeutronClientException {
+ try {
+ Quantum neutronClient = getNeutronClient(cloudSiteId, tenantId);
+ OpenStackRequest<Networks> request = neutronClient.networks().list().queryParam("id", id)
+ .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Neutron Client", e);
+ throw new NeutronClientException("Error building Neutron Client", e);
+ }
+ }
+
+
+ /**
+ * Query Networks
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param limit limits the number of records returned
+ * @param marker the last viewed record
+ * @param name of the subnet
+ * @param id of the subnet
+ * @return the list of subnets in openstack
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public Subnets querySubnets(String cloudSiteId, String tenantId, int limit, String marker, String name, String id)
+ throws MsoCloudSiteNotFound, NeutronClientException {
+ try {
+ Quantum neutronClient = getNeutronClient(cloudSiteId, tenantId);
+ OpenStackRequest<Subnets> request = neutronClient.subnets().list().queryParam("id", id)
+ .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Neutron Client", e);
+ throw new NeutronClientException("Error building Neutron Client", e);
+ }
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientException.java
new file mode 100644
index 0000000000..c5b6563dff
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientException.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.openstack.utils;
+
+public class NovaClientException extends Exception {
+
+ public NovaClientException(String error, Exception e) {
+ super(error, e);
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1920095376579954885L;
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
new file mode 100644
index 0000000000..99e8b589b1
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
@@ -0,0 +1,207 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.onap.so.cloud.authentication.KeystoneAuthHolder;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.nova.Nova;
+import com.woorea.openstack.nova.model.Flavor;
+import com.woorea.openstack.nova.model.Flavors;
+import com.woorea.openstack.nova.model.HostAggregate;
+import com.woorea.openstack.nova.model.HostAggregates;
+import com.woorea.openstack.nova.model.QuotaSet;
+
+
+@Component
+public class NovaClientImpl extends MsoCommonUtils {
+
+
+ /** The logger. */
+ private static final Logger logger = LoggerFactory.getLogger(NovaClientImpl.class);
+
+ /**
+ * Gets the Nova client
+ *
+ * @param cloudSiteId id of the cloud site
+ * @param tenantId the tenant id
+ * @return the Nova client
+ * @throws MsoException the mso exception
+ */
+ private Nova getNovaClient(String cloudSiteId, String tenantId) throws MsoException {
+ KeystoneAuthHolder keystone = getKeystoneAuthHolder(cloudSiteId, tenantId, "compute");
+ Nova novaClient = new Nova(keystone.getServiceUrl());
+ novaClient.token(keystone.getId());
+ return novaClient;
+ }
+
+
+ /**
+ * Query Networks
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param limit limits the number of records returned
+ * @param marker the last viewed record
+ * @param name of the newtork
+ * @param id of the network
+ * @return the list of networks in openstack
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public Flavors queryFlavors(String cloudSiteId, String tenantId, int limit, String marker)
+ throws MsoCloudSiteNotFound, NovaClientException {
+ try {
+ Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Flavors> request =
+ novaClient.flavors().list(false).queryParam("limit", limit).queryParam("marker", marker);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+
+ }
+
+ /**
+ * Query Networks
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param id of the network
+ * @return the the flavor from openstack
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public Flavor queryFlavorById(String cloudSiteId, String tenantId, String id)
+ throws MsoCloudSiteNotFound, NovaClientException {
+ try {
+ Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Flavor> request = novaClient.flavors().show(id);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
+
+ /**
+ * Query Host Aggregates
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param limit limits the number of records returned
+ * @param marker the last viewed record
+ * @return the list of host aggregates found in openstack
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public HostAggregates queryHostAggregates(String cloudSiteId, String tenantId, int limit, String marker)
+ throws MsoCloudSiteNotFound, NovaClientException {
+ try {
+ Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<HostAggregates> request =
+ novaClient.aggregates().list().queryParam("limit", limit).queryParam("marker", marker);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
+
+ /**
+ * Query Host Aggregate
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param limit limits the number of records returned
+ * @param marker the last viewed record
+ * @return a host aggregate
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public HostAggregate queryHostAggregateById(String cloudSiteId, String tenantId, String id)
+ throws MsoCloudSiteNotFound, NovaClientException {
+ try {
+ Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<HostAggregate> request = novaClient.aggregates().showAggregate(id);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
+
+ /**
+ * Query OS Quota Set
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param limit limits the number of records returned
+ * @param marker the last viewed record
+ * @return a host aggregate
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public QuotaSet queryOSQuotaSet(String cloudSiteId, String tenantId)
+ throws MsoCloudSiteNotFound, NovaClientException {
+ try {
+ Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<QuotaSet> request = novaClient.quotaSets().showQuota(tenantId);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
+
+ /**
+ * Deletes a keypair inside openstack
+ *
+ *
+ * @param cloudSiteId the cloud site id
+ * @param tenantId the tenant id
+ * @param keyPairName name of the keypair to be deleted
+ * @throws MsoCloudSiteNotFound the mso cloud site not found
+ * @throws NeutronClientException if the client cannot be built this is thrown
+ */
+ public void deleteKeyPair(String cloudSiteId, String tenantId, String keyPairName)
+ throws MsoCloudSiteNotFound, NovaClientException {
+ try {
+ Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Void> request = novaClient.keyPairs().delete(keyPairName);
+ executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java
new file mode 100644
index 0000000000..e3936e31f7
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.onap.so.openstack.exceptions.MsoException;
+
+public class StackCreationException extends MsoException {
+
+ public StackCreationException(String error) {
+ super(error);
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackResultWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackResultWrapper.java
new file mode 100644
index 0000000000..5e52a0a2ae
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackResultWrapper.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.woorea.openstack.heat.model.Stack;
+
+public class StackResultWrapper {
+
+ private Stack stack;
+ private boolean stackTimedOutPolling;
+ private boolean stackNotFound;
+ private String errorMessage;
+ private String errorCode;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("stack", stack).append("stackTimedOutPolling", stackTimedOutPolling)
+ .append("stackNotFound", stackNotFound).append("errorMessage", errorMessage)
+ .append("errorCode", errorCode).toString();
+ }
+
+ public Stack getStack() {
+ return stack;
+ }
+
+ public void setStack(Stack stack) {
+ this.stack = stack;
+ }
+
+ public boolean isStackTimedOutPolling() {
+ return stackTimedOutPolling;
+ }
+
+ public void setStackTimedOutPolling(boolean stackTimedOutPolling) {
+ this.stackTimedOutPolling = stackTimedOutPolling;
+ }
+
+ public boolean isStackNotFound() {
+ return stackNotFound;
+ }
+
+ public void setStackNotFound(boolean stackNotFound) {
+ this.stackNotFound = stackNotFound;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackRollbackException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackRollbackException.java
new file mode 100644
index 0000000000..ee284b11fe
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackRollbackException.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.onap.so.openstack.exceptions.MsoException;
+
+public class StackRollbackException extends MsoException {
+
+ public StackRollbackException(String error) {
+ super(error);
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java
new file mode 100644
index 0000000000..bf29c39f99
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackStatusHandler.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.woorea.openstack.heat.model.Stack;
+
+@Component
+public class StackStatusHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(StackStatusHandler.class);
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ @Autowired
+ private RequestsDbClient requestDBClient;
+
+ @Async
+ public void updateStackStatus(Stack stack) {
+ try {
+ String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+ String stackStatus = mapper.writeValueAsString(stack);
+ RequestProcessingData requestProcessingData =
+ requestDBClient.getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId,
+ stack.getStackName(), stack.getId());
+ if (requestProcessingData == null) {
+ requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setGroupingId(stack.getId());
+ requestProcessingData.setName(stack.getStackName());
+ requestProcessingData.setTag("StackInformation");
+ requestProcessingData.setSoRequestId(requestId);
+ requestProcessingData.setValue(stackStatus);
+ requestDBClient.saveRequestProcessingData(requestProcessingData);
+ } else {
+ requestProcessingData.setValue(stackStatus);
+ requestDBClient.updateRequestProcessingData(requestProcessingData);
+ }
+ } catch (Exception e) {
+ logger.warn("Error adding stack status to request database", e);
+ }
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/main/resources/application-local.yaml b/adapters/mso-adapter-utils/src/main/resources/application-local.yaml
deleted file mode 100644
index 5fc2144bd6..0000000000
--- a/adapters/mso-adapter-utils/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,64 +0,0 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-# MSO Properties go here
-mso:
- catalog:
- db:
- spring:
- endpoint: "http://localhost:8080"
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
-cloud_config:
- identity_services:
- MT_KEYSTONE:
- identity_url: "http://localhost:5000/v2.0"
- mso_id: "john"
- mso_pass: "313DECE408AF7759D442D7B06DD9A6AA"
- admin_tenant: "admin"
- member_role: "_member_"
- tenant_metadata: false
- identity_server_type: "KEYSTONE"
- identity_authentication_type: "USERNAME_PASSWORD"
- DAN_KEYSTONE:
- identity_url: "http://192.168.170.21:5000/v2.0"
- mso_id: "jc1348"
- mso_pass: "313DECE408AF7759D442D7B06DD9A6AA"
- admin_tenant: "service"
- member_role: "_member_"
- tenant_metadata: false
- identity_server_type: "KEYSTONE"
- identity_authentication_type: "USERNAME_PASSWORD"
- cloud_sites:
- regionOne:
- region_id: "regionOne"
- clli: "MT2"
- aic_version: "2.5"
- identity_service_id: "MT_KEYSTONE"
- DAN:
- region_id: "RegionOne"
- clli: "MT"
- aic_version: "2.5"
- identity_service_id: "DAN_KEYSTONE"
- DEFAULT:
- region_id: ""
- clli: "MTN6"
- aic_version: "3.0"
- identity_service_id: "ORDM3"
-adapters:
- po:
- retryCodes: "504"
- retryDelay: "5"
- retryCount: "3"
- tenant:
- tenant_description: "ECOMP Tenant"
- region_type: "single"
- user_role: "admin"
- success_status_string: "Success"
- no_regions_status_string: "no regions"
- orm_request_path: "/v1/orm/customers/"
- x_aic_orm_client_string: "ECOMP-MSO"
- keystone_url_version: "/v2.0"
- keystone_reg_ex: "/[vV][0-9]"
- orm_url_replace_this: "8080"
- orm_url_replace_with_this: "7080"
- quota_value: "10"
- set_default_quota: "false"
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java
index 5bd77d8e10..0137148835 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/KeystoneAuthHolderTest.java
@@ -65,7 +65,7 @@ public class KeystoneAuthHolderTest {
@Test
public void testGetServiceUrl() {
- keystoneAuthHolder.setHeatUrl("testURL");
+ keystoneAuthHolder.setServiceUrl("testURL");
assertEquals("testURL", keystoneAuthHolder.getServiceUrl());
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java
index 5cf7c86522..622ad4f94f 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java
@@ -69,6 +69,7 @@ public class MsoCommonUtilsTest extends BaseTest {
Mockito.when(openstackRequest.path()).thenReturn("/test");
// TODO:Must try a real connection
assertNull(commonUtils.executeAndRecordOpenstackRequest(openstackRequest));
+ assertNull(commonUtils.executeAndRecordOpenstackRequest(openstackRequest, true));
}
@Test
@@ -78,6 +79,7 @@ public class MsoCommonUtilsTest extends BaseTest {
doThrow(OpenStackResponseException.class).when(openstackRequest).execute();
commonUtils.executeAndRecordOpenstackRequest(openstackRequest);
+ commonUtils.executeAndRecordOpenstackRequest(openstackRequest, true);
}
@Test
@@ -86,7 +88,7 @@ public class MsoCommonUtilsTest extends BaseTest {
doThrow(OpenStackConnectException.class).when(openstackRequest).execute();
- commonUtils.executeAndRecordOpenstackRequest(openstackRequest);
+ commonUtils.executeAndRecordOpenstackRequest(openstackRequest, true);
}
@Test
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java
new file mode 100644
index 0000000000..7e783aa7a4
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java
@@ -0,0 +1,219 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 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.openstack.utils;
+
+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.urlPathEqualTo;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertNotNull;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.http.HttpStatus;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import org.onap.so.StubOpenStack;
+import org.onap.so.adapters.vdu.CloudInfo;
+import org.onap.so.adapters.vdu.PluginAction;
+import org.onap.so.adapters.vdu.VduArtifact;
+import org.onap.so.adapters.vdu.VduArtifact.ArtifactType;
+import org.onap.so.adapters.vdu.VduInstance;
+import org.onap.so.adapters.vdu.VduModelInfo;
+import org.onap.so.adapters.vdu.VduStateType;
+import org.onap.so.adapters.vdu.VduStatus;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.openstack.beans.StackInfo;
+import org.onap.so.openstack.exceptions.MsoAdapterException;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.exceptions.MsoOpenstackException;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.woorea.openstack.heat.Heat;
+
+public class MsoHeatUtilsITTest extends BaseTest {
+
+ @Autowired
+ private MsoHeatUtils heatUtils;
+
+ @Test
+ public void instantiateVduTest() throws MsoException, IOException {
+ VduInstance expected = new VduInstance();
+ expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b");
+ expected.setVduInstanceName("name");
+ VduStatus status = new VduStatus();
+ status.setState(VduStateType.INSTANTIATED);
+ status.setLastAction((new PluginAction("create", "complete", null)));
+ expected.setStatus(status);
+
+ CloudInfo cloudInfo = new CloudInfo();
+ cloudInfo.setCloudSiteId("MTN13");
+ cloudInfo.setTenantId("tenantId");
+ VduModelInfo vduModel = new VduModelInfo();
+ vduModel.setModelCustomizationUUID("blueprintId");
+ vduModel.setTimeoutMinutes(1);
+ VduArtifact artifact = new VduArtifact();
+ artifact.setName("name");
+ artifact.setType(ArtifactType.MAIN_TEMPLATE);
+ byte[] content = new byte[1];
+ artifact.setContent(content);
+ List<VduArtifact> artifacts = new ArrayList<>();
+ artifacts.add(artifact);
+ vduModel.setArtifacts(artifacts);
+ Map<String, byte[]> blueprintFiles = new HashMap<>();
+ blueprintFiles.put(artifact.getName(), artifact.getContent());
+ String instanceName = "stackname";
+ Map<String, Object> inputs = new HashMap<>();
+ boolean rollbackOnFailure = true;
+
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackname/stackId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+
+ VduInstance actual = heatUtils.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+
+ @Test
+ public void queryVduTest() throws Exception {
+ VduInstance expected = new VduInstance();
+ expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b");
+ expected.setVduInstanceName("name");
+ VduStatus status = new VduStatus();
+ status.setState(VduStateType.INSTANTIATED);
+ status.setLastAction((new PluginAction("create", "complete", null)));
+ expected.setStatus(status);
+
+ CloudInfo cloudInfo = new CloudInfo();
+ cloudInfo.setCloudSiteId("mtn13");
+ cloudInfo.setTenantId("tenantId");
+ String instanceId = "instanceId";
+
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+
+ VduInstance actual = heatUtils.queryVdu(cloudInfo, instanceId);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void deleteVduTest() throws Exception {
+ VduInstance expected = new VduInstance();
+ expected.setVduInstanceId("instanceId");
+ expected.setVduInstanceName("instanceId");
+ VduStatus status = new VduStatus();
+ status.setState(VduStateType.DELETED);
+ expected.setStatus(status);
+
+ CloudInfo cloudInfo = new CloudInfo();
+ cloudInfo.setCloudSiteId("mtn13");
+ cloudInfo.setTenantId("tenantId");
+ String instanceId = "instanceId";
+
+ int timeoutInMinutes = 1;
+
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
+ .willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+ StubOpenStack.mockOpenStackDelete(wireMockServer, "name/da886914-efb2-4917-b335-c8381528d90b");
+ wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b"))
+ .willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json")
+ .withStatus(HttpStatus.SC_OK)));
+
+ VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public final void copyBaseOutputsToInputsTest() {
+ Map<String, Object> inputs = new HashMap<>();
+ inputs.put("str1", "str");
+ Map<String, Object> otherStackOutputs = new HashMap<>();
+ otherStackOutputs.put("str", "str");
+ List<String> paramNames = new ArrayList<>();
+ Map<String, String> aliases = new HashMap<>();
+ aliases.put("str", "str");
+ heatUtils.copyBaseOutputsToInputs(inputs, otherStackOutputs, null, aliases);
+ Assert.assertEquals("str", otherStackOutputs.get("str"));
+ }
+
+ @Test
+ public final void getHeatClientSuccessTest() throws MsoException, IOException {
+ CloudSite cloudSite = getCloudSite(getCloudIdentity());
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ Heat heatClient = heatUtils.getHeatClient("MTN13", "TEST-tenant");
+ assertNotNull(heatClient);
+ }
+
+ @Test(expected = MsoOpenstackException.class)
+ public final void getHeatClientOpenStackResponseException404Test() throws MsoException, IOException {
+ CloudSite cloudSite = getCloudSite(getCloudIdentity());
+ // mo mocks setup will cause 404 response from wiremock
+ heatUtils.getHeatClient("MTN13", "TEST-tenant");
+ }
+
+ @Test(expected = MsoAdapterException.class)
+ public final void getHeatClientOpenStackResponseException401Test() throws MsoException, IOException {
+ CloudSite cloudSite = getCloudSite(getCloudIdentity());
+ StubOpenStack.mockOpenStackResponseUnauthorized(wireMockServer, wireMockPort);
+ heatUtils.getHeatClient("MTN13", "TEST-tenant");
+ }
+
+ @Test(expected = MsoOpenstackException.class)
+ public final void getHeatClientOpenStackConnectExceptionTest() throws MsoException, IOException {
+ CloudIdentity identity = getCloudIdentity();
+ identity.setIdentityUrl("http://unreachable");
+ CloudSite cloudSite = getCloudSite(identity);
+ // mo mocks setup will cause 404 response from wiremock
+ heatUtils.getHeatClient("MTN13", "TEST-tenant");
+ }
+
+ @Test
+ public final void createStackSuccessTest() throws MsoException, IOException {
+ CloudSite cloudSite = getCloudSite(getCloudIdentity());
+ StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+ StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId");
+ StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack",
+ "TEST-heat", new HashMap<>(), false, 1, "TEST-env", new HashMap<>(), new HashMap<>());
+ assertNotNull(stackInfo);
+ }
+
+
+
+}
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 3f5402cc99..e68364eab8 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -2,16 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,214 +20,520 @@
package org.onap.so.openstack.utils;
-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.urlPathEqualTo;
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-import org.apache.http.HttpStatus;
-import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
-import org.onap.so.BaseTest;
-import org.onap.so.StubOpenStack;
-import org.onap.so.adapters.vdu.CloudInfo;
-import org.onap.so.adapters.vdu.PluginAction;
-import org.onap.so.adapters.vdu.VduArtifact;
-import org.onap.so.adapters.vdu.VduArtifact.ArtifactType;
-import org.onap.so.adapters.vdu.VduInstance;
-import org.onap.so.adapters.vdu.VduModelInfo;
-import org.onap.so.adapters.vdu.VduStateType;
-import org.onap.so.adapters.vdu.VduStatus;
-import org.onap.so.db.catalog.beans.CloudIdentity;
-import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.openstack.beans.StackInfo;
-import org.onap.so.openstack.exceptions.MsoAdapterException;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.db.request.beans.CloudApiRequests;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.openstack.beans.CreateStackRequest;
import org.onap.so.openstack.exceptions.MsoException;
-import org.onap.so.openstack.exceptions.MsoIOException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.onap.so.openstack.exceptions.MsoStackAlreadyExists;
+import org.springframework.core.env.Environment;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.woorea.openstack.base.client.OpenStackResponseException;
import com.woorea.openstack.heat.Heat;
+import com.woorea.openstack.heat.StackResource;
+import com.woorea.openstack.heat.StackResource.CreateStack;
+import com.woorea.openstack.heat.StackResource.DeleteStack;
import com.woorea.openstack.heat.model.CreateStackParam;
+import com.woorea.openstack.heat.model.Resources;
+import com.woorea.openstack.heat.model.Stack;
-public class MsoHeatUtilsTest extends BaseTest {
+@RunWith(MockitoJUnitRunner.class)
+public class MsoHeatUtilsTest extends MsoHeatUtils {
- @Autowired
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
+ @Spy
+ @InjectMocks
private MsoHeatUtils heatUtils;
- @Test
- public void instantiateVduTest() throws MsoException, IOException {
- VduInstance expected = new VduInstance();
- expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b");
- expected.setVduInstanceName("name");
- VduStatus status = new VduStatus();
- status.setState(VduStateType.INSTANTIATED);
- status.setLastAction((new PluginAction("create", "complete", null)));
- expected.setStatus(status);
+ @Mock
+ private RequestsDbClient requestDbClient;
- CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("MTN13");
- cloudInfo.setTenantId("tenantId");
- VduModelInfo vduModel = new VduModelInfo();
- vduModel.setModelCustomizationUUID("blueprintId");
- vduModel.setTimeoutMinutes(1);
- VduArtifact artifact = new VduArtifact();
- artifact.setName("name");
- artifact.setType(ArtifactType.MAIN_TEMPLATE);
- byte[] content = new byte[1];
- artifact.setContent(content);
- List<VduArtifact> artifacts = new ArrayList<>();
- artifacts.add(artifact);
- vduModel.setArtifacts(artifacts);
- Map<String, byte[]> blueprintFiles = new HashMap<>();
- blueprintFiles.put(artifact.getName(), artifact.getContent());
- String instanceName = "instanceName";
- Map<String, Object> inputs = new HashMap<>();
- boolean rollbackOnFailure = true;
+ @Mock
+ private Heat heatClient;
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+ @Mock
+ private StackStatusHandler stackStatusHandler;
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceName/stackId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+ @Mock
+ private Environment env;
- VduInstance actual = heatUtils.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure);
+ @Mock
+ private StackResource stackResource;
- assertThat(actual, sameBeanAs(expected));
- }
+ @Mock
+ private NovaClientImpl novaClient;
+ @Mock
+ private DeleteStack mockDeleteStack;
+
+ @Mock
+ private Resources mockResources;
+
+ @Mock
+ private CreateStack mockCreateStack;
+
+ private String cloudSiteId = "cloudSiteId";
+ private String tenantId = "tenantId";
+
+ @Before
+ public void setup() {
+ doReturn("15").when(env).getProperty("org.onap.so.adapters.po.pollInterval", "15");
+ doReturn("1").when(env).getProperty("org.onap.so.adapters.po.pollMultiplier", "60");
+ }
@Test
- public void queryVduTest() throws Exception {
- VduInstance expected = new VduInstance();
- expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b");
- expected.setVduInstanceName("name");
- VduStatus status = new VduStatus();
- status.setState(VduStateType.INSTANTIATED);
- status.setLastAction((new PluginAction("create", "complete", null)));
- expected.setStatus(status);
+ public final void pollStackForStatus_Create_Complete_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+
+ Stack latestStack = new Stack();
+ latestStack.setId("id");
+ latestStack.setStackName("stackName");
+ latestStack.setStackStatus("CREATE_COMPLETE");
+ latestStack.setStackStatusReason("Stack Finished");
+ doReturn(latestStack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(latestStack);
+ Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ assertEquals(true, actual != null);
+ }
- CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("mtn13");
- cloudInfo.setTenantId("tenantId");
- String instanceId = "instanceId";
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
+ @Test
+ public final void pollStackForStatus_Polling_Exhausted_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+ doNothing().when(stackStatusHandler).updateStackStatus(stack);
+ doReturn(stack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(stack);
+ Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
+ assertEquals(true, actual != null);
+ }
+
+ @Test
+ public final void postProcessStackCreate_CREATE_IN_PROGRESS_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ exceptionRule.expect(StackCreationException.class);
+ exceptionRule.expectMessage("Stack rollback suppressed, stack not deleted");
+ heatUtils.postProcessStackCreate(stack, false, 120, false, cloudSiteId, tenantId, createStackParam);
+ }
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+ @Test
+ public final void postProcessStackCreate_Backout_True_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ doReturn(deletedStack).when(heatUtils).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ exceptionRule.expect(StackCreationException.class);
+ exceptionRule.expectMessage(
+ "Stack Creation Failed Openstack Status: CREATE_IN_PROGRESS Status Reason: Stack Finished , Rollback of Stack Creation completed with status: DELETE_COMPLETE Status Reason: Stack Deleted");
+ heatUtils.postProcessStackCreate(stack, true, 120, false, cloudSiteId, tenantId, createStackParam);
+ Mockito.verify(heatUtils, times(1)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ }
- VduInstance actual = heatUtils.queryVdu(cloudInfo, instanceId);
+ @Test
+ public final void postProcessStackCreate_Backout_True_Delete_Fail_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason("Stack Finished");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ doThrow(new MsoOpenstackException(500, "Error In Delete", "Error In Delete")).when(heatUtils)
+ .handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ exceptionRule.expect(MsoException.class);
+ exceptionRule.expectMessage(
+ "Stack Creation Failed Openstack Status: CREATE_IN_PROGRESS Status Reason: Stack Finished , Rollback of Stack Creation failed with sync error: Error In Delete");
+ heatUtils.postProcessStackCreate(stack, true, 120, false, cloudSiteId, tenantId, createStackParam);
+ Mockito.verify(heatUtils, times(1)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ }
- assertThat(actual, sameBeanAs(expected));
+ @Test
+ public final void postProcessStackCreate_Keypair_True_Test() throws MsoException, IOException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_IN_PROGRESS");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack createdStack = new Stack();
+ createdStack.setId("id");
+ createdStack.setStackName("stackName");
+ createdStack.setStackStatus("CREATE_COMPLETE");
+ createdStack.setStackStatusReason("Stack Created");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ doReturn(createdStack).when(heatUtils).handleKeyPairConflict(cloudSiteId, tenantId, createStackParam, 120, true,
+ stack);
+ heatUtils.postProcessStackCreate(stack, true, 120, true, cloudSiteId, tenantId, createStackParam);
+ Mockito.verify(heatUtils, times(1)).handleKeyPairConflict(cloudSiteId, tenantId, createStackParam, 120, true,
+ stack);
}
@Test
- public void deleteVduTest() throws Exception {
- VduInstance expected = new VduInstance();
- expected.setVduInstanceId("instanceId");
- expected.setVduInstanceName("instanceId");
- VduStatus status = new VduStatus();
- status.setState(VduStateType.DELETED);
- expected.setStatus(status);
+ public final void handleUnknownCreateStackFailure_Test() throws MsoException, IOException {
+
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doNothing().when(heatUtils).postProcessStackDelete(deletedStack);
+ doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(mockDeleteStack);
+ doReturn(stackResource).when(heatClient).getStacks();
+ doReturn(mockDeleteStack).when(stackResource).deleteByName("stackName/id");
+ doReturn(deletedStack).when(heatUtils).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId,
+ tenantId);
+
+ heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).executeAndRecordOpenstackRequest(mockDeleteStack);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).postProcessStackDelete(deletedStack);
+ }
- CloudInfo cloudInfo = new CloudInfo();
- cloudInfo.setCloudSiteId("mtn13");
- cloudInfo.setTenantId("tenantId");
- String instanceId = "instanceId";
- int timeoutInMinutes = 1;
+ @Test
+ public final void handleUnknownCreateStackFailure_Null_Stack_Test() throws MsoException, IOException {
+ Stack stack = null;
+ exceptionRule.expect(StackCreationException.class);
+ exceptionRule.expectMessage("Cannot Find Stack Name or Id");
+ heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ }
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId"))
- .willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
- StubOpenStack.mockOpenStackDelete(wireMockServer, "name/da886914-efb2-4917-b335-c8381528d90b");
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b"))
- .willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json")
- .withStatus(HttpStatus.SC_OK)));
+ @Test
+ public final void postProcessStackDelete_Stack_Test() throws MsoException, IOException {
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_FAILED");
+ deletedStack.setStackStatusReason("Stack DID NOT DELETE");
+ exceptionRule.expect(StackRollbackException.class);
+ exceptionRule.expectMessage(
+ "Stack Deletion completed with status: DELETE_FAILED Status Reason: Stack DID NOT DELETE");
+ heatUtils.postProcessStackDelete(deletedStack);
+ }
- VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes);
+ @Test
+ public final void postProcessStackDelete__Null_Stack_Test() throws MsoException, IOException {
+ Stack stack = null;
+ exceptionRule.expect(StackRollbackException.class);
+ exceptionRule.expectMessage("Cannot Find Stack Name or Id");
+ heatUtils.postProcessStackDelete(stack);
+ }
- assertThat(actual, sameBeanAs(expected));
+ @Test
+ public final void isKeyPairFailure_Test() throws MsoException, IOException {
+ boolean actual = heatUtils.isKeyPairFailure(
+ "Exception during create VF 0 : Stack error (CREATE_FAILED): Resource CREATE failed: Conflict: resources.bfnm_my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID:req-941b0af6-63ae-4d6a-afbc-90b728bacf82) - stack successfully deleted'rolledBack='true'");
+ assertEquals(true, actual);
}
@Test
- public final void requestToStringBuilderTest() {
- CreateStackParam param = new CreateStackParam();
- param.setDisableRollback(false);
- param.setEnvironment("environment");
- param.setFiles(new HashMap<String, Object>());
- param.setParameters(new HashMap<>());
- param.setStackName("stackName");
- param.setTemplate("template");
- param.setTemplateUrl("http://templateUrl");
- param.setTimeoutMinutes(1);
+ public final void handleKeyPairConflict_Test() throws MsoException, IOException, NovaClientException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack createdStack = new Stack();
+ createdStack.setId("id");
+ createdStack.setStackName("stackName");
+ createdStack.setStackStatus("CREATE_COMPLETE");
+ createdStack.setStackStatusReason("Stack Created");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ // doReturn(mockResources).when(heatUtils).queryStackResources(cloudSiteId, tenantId, "stackName", 2);
+ // doNothing().when(novaClient).deleteKeyPair(cloudSiteId, tenantId, "KeypairName");
+ doReturn(null).when(heatUtils).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ doReturn(createdStack).when(heatUtils).createStack(createStackParam, cloudSiteId, tenantId);
+ doReturn(createdStack).when(heatUtils).processCreateStack(cloudSiteId, tenantId, 120, true, createdStack,
+ createStackParam, false);
+
+ heatUtils.handleKeyPairConflict(cloudSiteId, tenantId, createStackParam, 120, true, stack);
+ Mockito.verify(novaClient, times(1)).deleteKeyPair(cloudSiteId, tenantId, "hst3bbfnm0011vm001");
+ Mockito.verify(heatUtils, times(1)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).createStack(createStackParam, cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).processCreateStack(cloudSiteId, tenantId, 120, true, createdStack,
+ createStackParam, false);
+ }
- StringBuilder stringBuilder = heatUtils.requestToStringBuilder(param);
+ @Test
+ public final void processCreateStack_Test() throws MsoException, IOException, NovaClientException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack createdStack = new Stack();
+ createdStack.setId("id");
+ createdStack.setStackName("stackName");
+ createdStack.setStackStatus("CREATE_COMPLETE");
+ createdStack.setStackStatusReason("Stack Created");
+
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doReturn(createdStack).when(heatUtils).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId,
+ tenantId);
+ doReturn(createdStack).when(heatUtils).postProcessStackCreate(createdStack, true, 120, true, cloudSiteId,
+ tenantId, createStackParam);
+
+ heatUtils.processCreateStack(cloudSiteId, tenantId, 120, true, stack, createStackParam, true);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).postProcessStackCreate(createdStack, true, 120, true, cloudSiteId, tenantId,
+ createStackParam);
+ }
- Assert.assertTrue(stringBuilder.toString().contains("StackName:"));
+ @Test
+ public final void processCreateStack_Exception_Backout_Test()
+ throws MsoException, IOException, NovaClientException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doThrow(new StackCreationException("Error")).when(heatUtils).pollStackForStatus(120, stack,
+ "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ exceptionRule.expect(MsoException.class);
+ exceptionRule.expectMessage("Error");
+ heatUtils.processCreateStack(cloudSiteId, tenantId, 120, true, stack, createStackParam, true);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).postProcessStackCreate(stack, true, 120, true, cloudSiteId, tenantId,
+ createStackParam);
}
+
@Test
- public final void copyBaseOutputsToInputsTest() {
- Map<String, Object> inputs = new HashMap<>();
- inputs.put("str1", "str");
- Map<String, Object> otherStackOutputs = new HashMap<>();
- otherStackOutputs.put("str", "str");
- List<String> paramNames = new ArrayList<>();
- Map<String, String> aliases = new HashMap<>();
- aliases.put("str", "str");
- heatUtils.copyBaseOutputsToInputs(inputs, otherStackOutputs, null, aliases);
- Assert.assertEquals("str", otherStackOutputs.get("str"));
+ public final void createStack_Test() throws MsoException, IOException, NovaClientException {
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doReturn(stackResource).when(heatClient).getStacks();
+ doReturn(mockCreateStack).when(stackResource).create(createStackParam);
+
+ doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(mockCreateStack);
+
+ heatUtils.createStack(createStackParam, cloudSiteId, tenantId);
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
+ Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), isNull(), eq("stackName"));
+ Mockito.verify(heatClient, times(1)).getStacks();
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
}
@Test
- public final void getHeatClientSuccessTest() throws MsoException, IOException {
- CloudSite cloudSite = getCloudSite(getCloudIdentity());
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- Heat heatClient = heatUtils.getHeatClient(cloudSite, "TEST-tenant");
- assertNotNull(heatClient);
+ public final void saveStack_Test() throws MsoException, IOException, NovaClientException {
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ Map<String, Object> parameters = new HashMap<String, Object>();
+ parameters.put("test", "value");
+ String environment =
+ "parameters:\n mmn_volume_name_1: \"data-mn-v-vdb\"\n mmn_volume_name_2: \"arch-mn-v-vdc\"\n";
+ createStackParam.setParameters(parameters);
+ createStackParam.setEnvironment(environment);
+
+ CreateStackRequest createStackRequest = new CreateStackRequest();
+ createStackRequest.setEnvironment(environment);
+ createStackRequest.setParameters(parameters);
+ ObjectMapper mapper = new ObjectMapper();
+ String stackRequest = mapper.writeValueAsString(createStackRequest);
+
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ doReturn(request).when(requestDbClient).getInfraActiveRequestbyRequestId("requestId");
+ doNothing().when(requestDbClient).updateInfraActiveRequests(request);
+ heatUtils.saveStackRequest(createStackParam, "requestId", "stackName");
+ Mockito.verify(requestDbClient, times(1)).updateInfraActiveRequests(request);
+ assertNotNull(request.getCloudApiRequests().get(0));
+ assertEquals("requestId", request.getCloudApiRequests().get(0).getRequestId());
+ assertEquals(stackRequest, request.getCloudApiRequests().get(0).getRequestBody());
}
- @Test(expected = MsoOpenstackException.class)
- public final void getHeatClientOpenStackResponseException404Test() throws MsoException, IOException {
- CloudSite cloudSite = getCloudSite(getCloudIdentity());
- // mo mocks setup will cause 404 response from wiremock
- heatUtils.getHeatClient(cloudSite, "TEST-tenant");
+ @Test
+ public final void saveStack__Exists_Test() throws MsoException, IOException, NovaClientException {
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+ Map<String, Object> parameters = new HashMap<String, Object>();
+ parameters.put("test", "value");
+ createStackParam.setParameters(parameters);
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ CloudApiRequests cloudRequest = new CloudApiRequests();
+ cloudRequest.setCloudIdentifier("stackName");
+ cloudRequest.setRequestBody("testMe");
+ cloudRequest.setRequestId("requestId");
+ request.getCloudApiRequests().add(cloudRequest);
+ doReturn(request).when(requestDbClient).getInfraActiveRequestbyRequestId("requestId");
+ doNothing().when(requestDbClient).updateInfraActiveRequests(request);
+ heatUtils.saveStackRequest(createStackParam, "requestId", "stackName");
+ Mockito.verify(requestDbClient, times(1)).updateInfraActiveRequests(request);
+ assertNotNull(request.getCloudApiRequests().get(0));
+ assertEquals("requestId", request.getCloudApiRequests().get(0).getRequestId());
+ assertNotEquals("testMe", request.getCloudApiRequests().get(0).getRequestBody());
}
- @Test(expected = MsoAdapterException.class)
- public final void getHeatClientOpenStackResponseException401Test() throws MsoException, IOException {
- CloudSite cloudSite = getCloudSite(getCloudIdentity());
- StubOpenStack.mockOpenStackResponseUnauthorized(wireMockServer, wireMockPort);
- heatUtils.getHeatClient(cloudSite, "TEST-tenant");
+ @Test
+ public final void createStack_Error_Test() throws MsoException, IOException, NovaClientException {
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doReturn(stackResource).when(heatClient).getStacks();
+ doReturn(mockCreateStack).when(stackResource).create(createStackParam);
+
+ doThrow(new OpenStackResponseException("Unknown Error", 500)).when(heatUtils)
+ .executeAndRecordOpenstackRequest(mockCreateStack);
+ exceptionRule.expect(MsoOpenstackException.class);
+ exceptionRule.expectMessage("Unknown Error");
+ heatUtils.createStack(createStackParam, cloudSiteId, tenantId);
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
+ Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), isNull(), eq("stackName"));
+ Mockito.verify(heatClient, times(1)).getStacks();
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
}
- @Test(expected = MsoIOException.class)
- public final void getHeatClientOpenStackConnectExceptionTest() throws MsoException, IOException {
- CloudIdentity identity = getCloudIdentity();
- identity.setIdentityUrl("http://unreachable");
- CloudSite cloudSite = getCloudSite(identity);
- // mo mocks setup will cause 404 response from wiremock
- heatUtils.getHeatClient(cloudSite, "TEST-tenant");
+ @Test
+ public final void createStack_Error_404_Test() throws MsoException, IOException, NovaClientException {
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
+ doReturn(stackResource).when(heatClient).getStacks();
+ doReturn(mockCreateStack).when(stackResource).create(createStackParam);
+
+ doThrow(new OpenStackResponseException("Not Found", 409)).when(heatUtils)
+ .executeAndRecordOpenstackRequest(mockCreateStack);
+ exceptionRule.expect(MsoStackAlreadyExists.class);
+ exceptionRule.expectMessage("Stack stackName already exists in Tenant tenantId in Cloud cloudSiteId");
+ heatUtils.createStack(createStackParam, cloudSiteId, tenantId);
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
+ Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), isNull(), eq("stackName"));
+ Mockito.verify(heatClient, times(1)).getStacks();
+ Mockito.verify(stackResource, times(1)).create(createStackParam);
}
@Test
- public final void createStackSuccessTest() throws MsoException, IOException {
- CloudSite cloudSite = getCloudSite(getCloudIdentity());
- StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
- StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId");
- 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);
+ public final void processCreateStack_Exception_No_Backout_Test()
+ throws MsoException, IOException, NovaClientException {
+ Stack stack = new Stack();
+ stack.setId("id");
+ stack.setStackName("stackName");
+ stack.setStackStatus("CREATE_FAILED");
+ stack.setStackStatusReason(
+ "Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
+
+ Stack deletedStack = new Stack();
+ deletedStack.setId("id");
+ deletedStack.setStackName("stackName");
+ deletedStack.setStackStatus("DELETE_COMPLETE");
+ deletedStack.setStackStatusReason("Stack Deleted");
+
+ CreateStackParam createStackParam = new CreateStackParam();
+ createStackParam.setStackName("stackName");
+
+ doThrow(new StackCreationException("Error")).when(heatUtils).pollStackForStatus(120, stack,
+ "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+
+ exceptionRule.expect(MsoException.class);
+ exceptionRule.expectMessage("Error");
+ heatUtils.processCreateStack(cloudSiteId, tenantId, 120, false, stack, createStackParam, true);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(0)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
}
+
}
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 8951f8a304..acd42dd8da 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
@@ -22,10 +22,8 @@ package org.onap.so.openstack.utils;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertThat;
-import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
@@ -98,7 +96,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
expectedStackInfo.setCanonicalName("stackName/id");
doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class));
- doReturn(heatClient).when(heatUtils).getHeatClient(isA(CloudSite.class), isA(String.class));
+ doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
@@ -123,7 +121,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
expectedStackInfo.setCanonicalName("stackName/id");
doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class));
- doReturn(heatClient).when(heatUtils).getHeatClient(isA(CloudSite.class), isA(String.class));
+ doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
@@ -150,7 +148,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
expectedStackInfo.setCanonicalName("stackName/id");
doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class));
- doReturn(heatClient).when(heatUtils).getHeatClient(isA(CloudSite.class), isA(String.class));
+ doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java
new file mode 100644
index 0000000000..985a39a76b
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/StackStatusHandlerTest.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import java.io.IOException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.openstack.exceptions.MsoException;
+import com.woorea.openstack.heat.model.Stack;
+
+@RunWith(MockitoJUnitRunner.class)
+public class StackStatusHandlerTest {
+
+ @InjectMocks
+ StackStatusHandler statusHandler;
+
+ @Mock
+ RequestsDbClient requestDBClient;
+
+ @Test
+ public final void recordExists_Test() throws MsoException, IOException {
+ RequestProcessingData requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setValue("testMe");
+
+ doReturn(requestProcessingData).when(requestDBClient)
+ .getRequestProcessingDataBySoRequestIdAndNameAndGrouping(null, "stackName", "id");
+ Stack latestStack = new Stack();
+ latestStack.setId("id");
+ latestStack.setStackName("stackName");
+ latestStack.setStackStatus("CREATE_COMPLETE");
+ latestStack.setStackStatusReason("Stack Finished");
+
+ statusHandler.updateStackStatus(latestStack);
+ Mockito.verify(requestDBClient, times(1)).updateRequestProcessingData(requestProcessingData);
+ assertNotEquals("testMe", requestProcessingData.getValue());
+ }
+
+ @Test
+ public final void record_Not_Exists_Test() throws MsoException, IOException {
+ ArgumentCaptor<RequestProcessingData> requestCaptor = ArgumentCaptor.forClass(RequestProcessingData.class);
+ doReturn(null).when(requestDBClient).getRequestProcessingDataBySoRequestIdAndNameAndGrouping(null, "stackName",
+ "id");
+ Stack latestStack = new Stack();
+ latestStack.setId("id");
+ latestStack.setStackName("stackName");
+ latestStack.setStackStatus("CREATE_COMPLETE");
+ latestStack.setStackStatusReason("Stack Finished");
+ statusHandler.updateStackStatus(latestStack);
+ Mockito.verify(requestDBClient, times(1)).saveRequestProcessingData(requestCaptor.capture());
+ RequestProcessingData actualRequest = requestCaptor.getValue();
+ assertEquals("id", actualRequest.getGroupingId());
+ assertEquals("StackInformation", actualRequest.getTag());
+ assertEquals("stackName", actualRequest.getName());
+ assertNotNull(actualRequest.getValue());
+
+ }
+
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json
index 477acadf81..7eae6d14a4 100644
--- a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json
+++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json
@@ -2,7 +2,7 @@
"stack": {
"description": null,
"links": null,
- "stack_status_reason": null,
+ "stack_status_reason": "Stack Created",
"stack_name": "stackname",
"updated_time": null,
"creation_time": null,
diff --git a/adapters/mso-adapters-rest-interface/pom.xml b/adapters/mso-adapters-rest-interface/pom.xml
index 17d4bc1e35..5f987e61ce 100644
--- a/adapters/mso-adapters-rest-interface/pom.xml
+++ b/adapters/mso-adapters-rest-interface/pom.xml
@@ -51,6 +51,21 @@
<version>${openstack.version}</version>
</dependency>
<dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>glance-client</artifactId>
+ <version>${openstack.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>cinder-client</artifactId>
+ <version>${openstack.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>nova-client</artifactId>
+ <version>${openstack.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.onap.so.libs.openstack-java-sdk.client-connectors</groupId>
<artifactId>http-connector</artifactId>
<version>${openstack.version}</version>
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java
index 4f3ed4c96e..6fa3afd4b4 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.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
@@ -28,8 +30,6 @@ import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import org.onap.so.entity.MsoRequest;
import org.onap.so.openstack.beans.Subnet;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java
index c9f42d1550..1b8372291d 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java
@@ -59,20 +59,6 @@ public class SDNCServiceRequest extends SDNCRequestCommon implements Serializabl
// The SDNC service data specified by SDNC "agnostic" API
private String sdncServiceData;
- public SDNCServiceRequest() {}
-
- public SDNCServiceRequest(String bpNotificationUrl, String bpTimeout, String sdncRequestId, String sdncService,
- String sdncOperation, RequestInformation requestInformation, ServiceInformation serviceInformation,
- String sdncServiceDataType, String sndcServiceData) {
- super(bpNotificationUrl, bpTimeout, sdncRequestId);
- this.requestInformation = requestInformation;
- this.serviceInformation = serviceInformation;
- this.sdncService = sdncService;
- this.sdncOperation = sdncOperation;
- this.sdncServiceDataType = sdncServiceDataType;
- this.sdncServiceData = sndcServiceData;
- }
-
@JsonProperty("requestInformation")
@XmlElement(name = "requestInformation")
public RequestInformation getRequestInformation() {
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java
index 2f99fed875..4a5a6119cd 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java
@@ -37,6 +37,16 @@ public class VduArtifact {
private byte[] content;
private ArtifactType type;
+ // Default constructor
+ public VduArtifact() {}
+
+ // Fully specified constructor
+ public VduArtifact(String name, byte[] content, ArtifactType type) {
+ this.name = name;
+ this.content = content;
+ this.type = type;
+ }
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof VduArtifact)) {
@@ -52,16 +62,6 @@ public class VduArtifact {
return new HashCodeBuilder().append(name).append(content).append(type).toHashCode();
}
- // Default constructor
- public VduArtifact() {}
-
- // Fully specified constructor
- public VduArtifact(String name, byte[] content, ArtifactType type) {
- this.name = name;
- this.content = content;
- this.type = type;
- }
-
public String getName() {
return name;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java
index 8870f5c7b5..d20e0494ae 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java
@@ -25,7 +25,13 @@ package org.onap.so.adapters.vdu;
* Enum status values to capture the state of a generic (cloud-agnostic) VDU.
*/
public enum VduStateType {
- NOTFOUND, INSTANTIATING, INSTANTIATED, DELETING, DELETED, // Note - only returned in success response to deleteVdu
- // call.
- UPDATING, FAILED, UNKNOWN
+ NOTFOUND,
+ INSTANTIATING,
+ INSTANTIATED,
+ DELETING,
+ DELETED, // Note - only returned in success response to deleteVdu
+ // call.
+ UPDATING,
+ FAILED,
+ UNKNOWN
}
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 fb8fb2ed84..6f24e60514 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
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
index ef5d4316d7..90b8024c18 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapAdapter.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 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
@@ -36,8 +38,8 @@ public class MapAdapter extends XmlAdapter<MapEntry, Map<String, Object>> {
MapEntry map = new MapEntry();
- for (String key : v.keySet()) {
- map.addEntry(key, v.get(key));
+ for (Map.Entry<String, Object> entry : v.entrySet()) {
+ map.addEntry(entry.getKey(), entry.getValue());
}
return map;
@@ -49,9 +51,9 @@ public class MapAdapter extends XmlAdapter<MapEntry, Map<String, Object>> {
return null;
}
- Map<String, Object> map = new HashMap<>(v.entry.size());
+ Map<String, Object> map = new HashMap<>(v.getEntry().size());
- for (MapElements entry : v.entry) {
+ for (MapElements entry : v.getEntry()) {
if (entry.value instanceof Element) {
map.put(entry.key, ((Element) entry.value).getTextContent());
} else {
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
index 0327fd67a3..3dd339dc68 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapElements.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 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
@@ -35,7 +37,9 @@ public class MapElements {
@XmlElement
public Object value;
- public MapElements() {} // Required by JAXB
+ public MapElements() {
+ // Required by JAXB
+ }
public MapElements(String key, Object value) {
this.key = key;
@@ -46,7 +50,7 @@ public class MapElements {
try {
this.value = new ObjectMapper().writeValueAsString(value);
} catch (JsonProcessingException e) {
- logger.warn("could not marshal value to json, calling toString");
+ logger.warn("could not marshal value to json, calling toString", e);
this.value = value.toString();
}
} else {
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
index 489e11e111..b6b121c820 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/MapEntry.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 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
@@ -25,12 +27,23 @@ import java.util.List;
public class MapEntry {
- public List<MapElements> entry = new ArrayList<>();
+ private List<MapElements> entry = new ArrayList<>();
- public MapEntry() {} // Required by JAXB
+ public MapEntry() {
+ // Required by JAXB
+ }
- public void addEntry(String key, Object value) {
+ void addEntry(String key, Object value) {
entry.add(new MapElements(key, value));
}
+ public List<MapElements> getEntry() {
+ // Required by JAXB
+ return entry;
+ }
+
+ public void setEntry(List<MapElements> entry) {
+ // Required by JAXB
+ this.entry = entry;
+ }
}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
index 189d4cca3e..5089ba1301 100644
--- a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/JAXBMarshallingTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 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
@@ -24,12 +26,13 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import org.junit.Test;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
-import com.fasterxml.jackson.databind.ObjectMapper;
public class JAXBMarshallingTest {
@@ -53,11 +56,16 @@ public class JAXBMarshallingTest {
CreateVfModuleRequest request = new CreateVfModuleRequest();
request.getVfModuleParams().put("test-null", null);
+ request.getVfModuleParams().put("vcpe_image_name", "ubuntu-16-04-cloud-amd64");
+ request.getVfModuleParams().put("test-empty", "");
request.getVfModuleParams().put("test array", Arrays.asList("a", "b", "c"));
+ request.getVfModuleParams().put("test map", Collections.singletonMap("d", "e"));
+ request.getVfModuleParams().put("marshalling error", new ArrayList());
- assertEquals("documents are equal",
+ assertEquals("documents should be equal",
new String(Files
- .readAllBytes(Paths.get("src/test/resources/VfRequest-marshalled-with-complex-object.xml"))),
+ .readAllBytes(Paths.get("src/test/resources/VfRequest-marshalled-with-complex-object.xml")))
+ .replaceAll("\\R", "\n"),
request.toXmlString());
}
diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml b/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml
index ce175127df..d4955f1b18 100644
--- a/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml
+++ b/adapters/mso-adapters-rest-interface/src/test/resources/VfRequest-marshalled-with-complex-object.xml
@@ -4,12 +4,28 @@
<backout>true</backout>
<vfModuleParams>
<entry>
+ <key>vcpe_image_name</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">ubuntu-16-04-cloud-amd64</value>
+ </entry>
+ <entry>
<key>test array</key>
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">["a","b","c"]</value>
</entry>
<entry>
+ <key>test map</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">{"d":"e"}</value>
+ </entry>
+ <entry>
<key>test-null</key>
</entry>
+ <entry>
+ <key>marshalling error</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">[]</value>
+ </entry>
+ <entry>
+ <key>test-empty</key>
+ <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value>
+ </entry>
</vfModuleParams>
<msoRequest/>
</createVfModuleRequest>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
index 469a7ad7e4..354c3d07f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/db/migration/R__CloudConfigMigration.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -67,35 +67,35 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
public void migrate(Connection connection) throws Exception {
logger.debug("Starting migration for CloudConfig");
- CloudConfig cloudConfig = null;
+ CloudConfig cloudConfiguration = null;
// Try the override file
String configLocation = System.getProperty("spring.config.additional-location");
if (configLocation != null) {
try (InputStream stream = new FileInputStream(Paths.get(configLocation).normalize().toString())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
} catch (Exception e) {
logger.warn("Error Loading override.yaml", e);
}
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", configLocation);
// Try the application.yaml file
try (InputStream stream = R__CloudConfigMigration.class.getResourceAsStream(getApplicationYamlName())) {
- cloudConfig = loadCloudConfig(stream);
+ cloudConfiguration = loadCloudConfig(stream);
}
- if (cloudConfig == null) {
+ if (cloudConfiguration == null) {
logger.debug("No CloudConfig defined in {}", getApplicationYamlName());
}
}
- if (cloudConfig != null) {
- migrateCloudIdentity(cloudConfig.getIdentityServices().values(), connection);
- migrateCloudSite(cloudConfig.getCloudSites().values(), connection);
- migrateCloudifyManagers(cloudConfig.getCloudifyManagers().values(), connection);
+ if (cloudConfiguration != null) {
+ migrateCloudIdentity(cloudConfiguration.getIdentityServices().values(), connection);
+ migrateCloudSite(cloudConfiguration.getCloudSites().values(), connection);
+ migrateCloudifyManagers(cloudConfiguration.getCloudifyManagers().values(), connection);
}
}
@@ -110,13 +110,13 @@ public class R__CloudConfigMigration implements JdbcMigration, MigrationInfoProv
private CloudConfig loadCloudConfig(InputStream stream) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
R__CloudConfigMigration cloudConfigMigration = mapper.readValue(stream, R__CloudConfigMigration.class);
- CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig();
+ CloudConfig cloudConfiguration = cloudConfigMigration.getCloudConfig();
- if (cloudConfig != null) {
- cloudConfig.populateId();
+ if (cloudConfiguration != null) {
+ cloudConfiguration.populateId();
}
- return cloudConfig;
+ return cloudConfiguration;
}
private String getApplicationYamlName() {
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
index a0a0756d3d..aa19aed515 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
@@ -24,12 +24,14 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client",
"org.onap.so.logging.jaxrs.filter", "org.onap.so.logging.spring.interceptor", "org.onap.so.client",
- "org.onap.so.configuration"})
+ "org.onap.so.configuration", "org.onap.so.db"})
@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
@EntityScan("org.onap.so.db.catalog.beans")
+@EnableScheduling
public class CatalogDBApplication {
private static final String LOGS_DIR = "logs_dir";
@@ -42,6 +44,7 @@ public class CatalogDBApplication {
public static void main(String[] args) {
SpringApplication.run(CatalogDBApplication.class, args);
+ java.security.Security.setProperty("networkaddress.cache.ttl", "10");
System.getProperties().setProperty("mso.db", "MARIADB");
System.getProperties().setProperty("server.name", "Springboot");
setLogsDir();
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBConfig.java
new file mode 100644
index 0000000000..f7faa1f709
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBConfig.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jmx.export.MBeanExporter;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.db.catalog.data.repository"})
+@Profile({"!test"})
+public class CatalogDBConfig {
+
+ @Autowired(required = false)
+ private MBeanExporter mBeanExporter;
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari")
+ public HikariConfig catalogDbConfig() {
+ return new HikariConfig();
+ }
+
+ @Primary
+ @Bean(name = "dataSource")
+ public DataSource dataSource() {
+ if (mBeanExporter != null) {
+ mBeanExporter.addExcludedBean("dataSource");
+ }
+ HikariConfig hikariConfig = this.catalogDbConfig();
+ return new HikariDataSource(hikariConfig);
+ }
+
+ @Primary
+ @Bean(name = "entityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ @Qualifier("dataSource") DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.catalog.beans").persistenceUnit("catalogDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "transactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
index db73d4afec..b43447f5c4 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
@@ -24,6 +24,8 @@ import javax.annotation.PostConstruct;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest;
+import org.onap.so.adapters.catalogdb.rest.ServiceRestImpl;
+import org.onap.so.adapters.catalogdb.rest.VnfRestImpl;
import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
import org.springframework.context.annotation.Configuration;
import io.swagger.jaxrs.config.BeanConfig;
@@ -40,12 +42,13 @@ public class JerseyConfiguration extends ResourceConfig {
register(ApiListingResource.class);
register(SwaggerSerializers.class);
register(JaxRsFilterLogging.class);
+ register(ServiceRestImpl.class);
+ register(VnfRestImpl.class);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.2");
- beanConfig.setSchemes(new String[] {"http"});
- beanConfig.setHost("localhost:8080");
+ beanConfig.setSchemes(new String[] {"https"});
beanConfig.setBasePath("/ecomp/mso/catalog");
- beanConfig.setResourcePackage("org.onap.so.adapters.catalogdb");
+ beanConfig.setResourcePackage("org.onap.so.adapters.catalogdb.rest");
beanConfig.setPrettyPrint(true);
beanConfig.setScan(true);
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index e550394931..c1acc319f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -104,7 +104,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
first = false;
- boolean arNull = o.getAllottedResource() == null ? true : false;
+ boolean arNull = o.getAllottedResource() == null;
put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName());
put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUUID());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java
new file mode 100644
index 0000000000..ed2526f400
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ *
+ * Copyright (C) 2019 IBM.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@XmlRootElement(name = "groups")
+public class QueryGroups extends CatalogQuery {
+
+ private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations;
+ private static final String TEMPLATE = "\n" + "\t{ \"modelInfo\" : {\n"
+ + "\t\t\"modelName\" : <MODEL_NAME>,\n" + "\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\"modelVersion\" : <MODEL_VERSION>\n" + "\t\t},\n" + "<_VNFCS_>\n" + "\t}";
+
+ public QueryGroups() {
+ super();
+ vnfcInstanceGroupCustomizations = new ArrayList<>();
+
+ }
+
+ public QueryGroups(List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
+ this.vnfcInstanceGroupCustomizations = new ArrayList<>();
+ if (vnfcInstanceGroupCustomizations != null) {
+ for (VnfcInstanceGroupCustomization g : vnfcInstanceGroupCustomizations) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(g.toString());
+ }
+ this.vnfcInstanceGroupCustomizations.add(g);
+ }
+ }
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"groups\": [");
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ for (VnfcInstanceGroupCustomization o : vnfcInstanceGroupCustomizations) {
+ if (first)
+ sb.append("\n");
+ first = false;
+
+ boolean vnfcCustomizationNull = o.getVnfcCustomizations() == null;
+ InstanceGroup instanceGroup = o.getInstanceGroup();
+
+ if (instanceGroup != null) {
+ put(valueMap, "MODEL_NAME", instanceGroup.getModelName());
+ put(valueMap, "MODEL_UUID", instanceGroup.getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", instanceGroup.getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", instanceGroup.getModelVersion());
+ }
+
+ String subItem = new QueryVnfcs(vnfcCustomizationNull ? null : o.getVnfcCustomizations()).JSON2(true, true);
+ valueMap.put("_VNFCS_", subItem.replaceAll("(?m)^", "\t\t"));
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
+ sep = ",\n";
+ }
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
+ return sb.toString();
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 96ea797631..5573b23a8d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -104,7 +104,7 @@ public class QueryServiceNetworks extends CatalogQuery {
if (first)
sb.append("\n");
first = false;
- boolean nrNull = o.getNetworkResource() == null ? true : false;
+ boolean nrNull = o.getNetworkResource() == null;
put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName());
put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID());
put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index b1bdeda445..0b8de60a81 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +29,7 @@ import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +48,8 @@ public class QueryServiceVnfs extends CatalogQuery {
+ "\t\"nfFunction\" : <NF_FUNCTION>,\n" + "\t\"nfType\" : <NF_TYPE>,\n"
+ "\t\"nfRole\" : <NF_ROLE>,\n" + "\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"
+ "\t\"multiStageDesign\" : <MULTI_STEP_DESIGN>,\n"
- + "\t\"resourceInput\" : <RESOURCE_INPUT>,\n" + "<_VFMODULES_>\n" + "\t}";
+ + "\t\"vnfcInstGroupOrder\" : <VNFC_INSTANCE_GROUP_ORDER>,\n"
+ + "\t\"resourceInput\" : <RESOURCE_INPUT>,\n" + "<_VFMODULES_>,\n" + "<_GROUPS_>\n" + "\t}";
public QueryServiceVnfs() {
super();
@@ -101,7 +105,7 @@ public class QueryServiceVnfs extends CatalogQuery {
sb.append("\n");
first = false;
- boolean vrNull = o.getVnfResources() == null ? true : false;
+ boolean vrNull = o.getVnfResources() == null;
put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResources().getModelName());
put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResources().getModelUUID());
@@ -114,12 +118,19 @@ public class QueryServiceVnfs extends CatalogQuery {
put(valueMap, "NF_TYPE", o.getNfType());
put(valueMap, "NF_ROLE", o.getNfRole());
put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
+ put(valueMap, "VNFC_INSTANCE_GROUP_ORDER", o.getVnfcInstanceGroupOrder());
put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true);
valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t"));
+ List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations =
+ o.getVnfcInstanceGroupCustomizations();
+
+ String grpSubItem = new QueryGroups(vrNull ? null : vnfcInstanceGroupCustomizations).JSON2(true, true);
+ valueMap.put("_GROUPS_", grpSubItem.replaceAll("(?m)^", "\t\t"));
+
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
index 1dec9cecae..1604e99a72 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
@@ -97,7 +97,7 @@ public class QueryVfModule extends CatalogQuery {
sb.append("\n");
first = false;
- boolean vfNull = o.getVfModule() == null ? true : false;
+ boolean vfNull = o.getVfModule() == null;
boolean hasVolumeGroup = false;
HeatEnvironment envt = o.getVolumeHeatEnv();
if (envt != null) {
@@ -109,10 +109,10 @@ public class QueryVfModule extends CatalogQuery {
put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUUID());
put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getModelVersion());
put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
- put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().getIsBase() ? true : false);
+ put(valueMap, "IS_BASE", !vfNull && (o.getVfModule().getIsBase()));
put(valueMap, "VF_MODULE_LABEL", o.getLabel());
put(valueMap, "INITIAL_COUNT", o.getInitialCount());
- put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup));
+ put(valueMap, "HAS_VOLUME_GROUP", hasVolumeGroup);
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
new file mode 100644
index 0000000000..dc73fe904d
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@XmlRootElement(name = "vnfcs")
+public class QueryVnfcs extends CatalogQuery {
+ private List<VnfcCustomization> vnfcCustomizations;
+ private static final String TEMPLATE =
+ "\t{\n" + "\t\t\"modelInfo\" : { \n" + "\t\t\t\"modelName\" : <MODEL_NAME>,\n"
+ + "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_ID>,\n"
+ + "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"
+ + "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>\n" + "\t\t},\n"
+ + "\t\t\"resourceInput\" : <RESOURCE_INPUT>\n" + "\t}";
+
+ public QueryVnfcs() {
+ super();
+ vnfcCustomizations = new ArrayList();
+ }
+
+ public QueryVnfcs(List<VnfcCustomization> vnfcCustomizations) {
+ this.vnfcCustomizations = new ArrayList();
+ if (vnfcCustomizations != null) {
+ for (VnfcCustomization vnfcCustomization : vnfcCustomizations) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(vnfcCustomization.toString());
+ }
+ this.vnfcCustomizations.add(vnfcCustomization);
+ }
+ }
+ }
+
+ public List<VnfcCustomization> getVnfcCustomizations() {
+ return vnfcCustomizations;
+ }
+
+ public void setVnfcCustomizations(List<VnfcCustomization> vnfcCustomizations) {
+ this.vnfcCustomizations = vnfcCustomizations;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ boolean first = true;
+ int i = 1;
+ for (VnfcCustomization o : vnfcCustomizations) {
+ sb.append(i).append("\t");
+ if (!first) {
+ sb.append("\n");
+ }
+ first = false;
+ sb.append(o);
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray) {
+ sb.append("{");
+ }
+
+ if (isArray) {
+ sb.append("\"vnfcs\": [");
+ }
+
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ for (VnfcCustomization o : vnfcCustomizations) {
+ if (first)
+ sb.append("\n");
+ first = false;
+
+ put(valueMap, "MODEL_NAME", o.getModelName());
+ put(valueMap, "MODEL_UUID", o.getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_ID", o.getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", o.getModelVersion());
+ put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
+ put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
+
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
+ sep = ",\n";
+ }
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
+ return sb.toString();
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index 6cc53e6ec9..f2e0762a79 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -48,6 +48,7 @@ import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs;
import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule;
import org.onap.so.db.catalog.beans.AllottedResource;
import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Recipe;
@@ -55,11 +56,13 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ToscaCsar;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfRecipe;
import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
import org.onap.so.db.catalog.data.repository.ArRecipeRepository;
+import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
@@ -120,6 +123,9 @@ public class CatalogDbAdapterRest {
@Autowired
private AllottedResourceRepository arResourceRepo;
+ @Autowired
+ private InstanceGroupRepository instanceGroupRepository;
+
private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
@@ -279,6 +285,7 @@ public class CatalogDbAdapterRest {
@QueryParam("serviceModelUuid") String modelUUID,
@QueryParam("serviceModelInvariantUuid") String modelInvariantUUID,
@QueryParam("serviceModelVersion") String modelVersion) {
+
QueryServiceMacroHolder qryResp;
int respStatus = HttpStatus.SC_OK;
String uuid = "";
@@ -535,6 +542,16 @@ public class CatalogDbAdapterRest {
arResource.getModelVersion());
}
}
+
+ if (null == recipe) {
+ InstanceGroup grpResource = instanceGroupRepository.findByModelUUID(rmUuid);
+ if (grpResource != null) {
+ recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndActionAndVersionStr(
+ grpResource.getModelName(), action, grpResource.getModelVersion());
+ }
+
+ }
+
if (recipe != null) {
QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
entity = resourceRecipe.JSON2(false, false);
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java
new file mode 100644
index 0000000000..f8a7ba6da4
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundException.java
@@ -0,0 +1,14 @@
+package org.onap.so.adapters.catalogdb.rest;
+
+public class CatalogEntityNotFoundException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -300157844846680791L;
+
+ public CatalogEntityNotFoundException(String errorMessage) {
+ super(errorMessage);
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java
new file mode 100644
index 0000000000..c42eaabea7
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogEntityNotFoundExceptionMapper.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.rest;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Provider
+public class CatalogEntityNotFoundExceptionMapper implements ExceptionMapper<CatalogEntityNotFoundException> {
+
+ private static final Logger logger = LoggerFactory.getLogger(CatalogEntityNotFoundExceptionMapper.class);
+
+ @Override
+ public Response toResponse(CatalogEntityNotFoundException e) {
+ return Response.status(Response.Status.NOT_FOUND).entity(e).build();
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
new file mode 100644
index 0000000000..e74663dbba
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
@@ -0,0 +1,165 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.rest;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.rest.catalog.beans.Cvnfc;
+import org.onap.so.rest.catalog.beans.Service;
+import org.onap.so.rest.catalog.beans.VfModule;
+import org.onap.so.rest.catalog.beans.Vnf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class ServiceMapper {
+ private static final Logger logger = LoggerFactory.getLogger(ServiceMapper.class);
+
+ public Service mapService(org.onap.so.db.catalog.beans.Service service, int depth) {
+ Service restService = new Service();
+ if (service.getCategory() != null) {
+ restService.setCategory(service.getCategory());
+ }
+ restService.setCreated(service.getCreated());
+ restService.setDescription(service.getDescription());
+
+ if (service.getDistrobutionStatus() != null) {
+ restService.setDistrobutionStatus(service.getDistrobutionStatus());
+ }
+ restService.setEnvironmentContext(service.getEnvironmentContext());
+ restService.setModelInvariantId(service.getModelInvariantUUID());
+ restService.setModelName(service.getModelName());
+ restService.setModelVersionId(service.getModelUUID());
+ restService.setModelVersion(service.getModelVersion());
+ if (service.getServiceRole() != null) {
+ restService.setServiceRole(service.getServiceRole());
+ }
+ restService.setServiceType(service.getServiceType());
+ restService.setWorkloadContext(service.getWorkloadContext());
+ if (depth > 0)
+ restService.setVnf(mapVnfs(service, depth));
+ return restService;
+ }
+
+ private List<Vnf> mapVnfs(org.onap.so.db.catalog.beans.Service service, int depth) {
+ List<Vnf> vnfs = new ArrayList<>();
+ logger.info("Vnf Count : {}", service.getVnfCustomizations().size());
+ service.getVnfCustomizations().parallelStream().forEach(vnf -> vnfs.add(mapVnf(vnf, depth)));
+ return vnfs;
+ }
+
+ protected Vnf mapVnf(org.onap.so.db.catalog.beans.VnfResourceCustomization vnfResourceCustomization, int depth) {
+ Vnf vnf = new Vnf();
+ vnf.setAvailabilityZoneMaxCount(vnfResourceCustomization.getAvailabilityZoneMaxCount());
+ vnf.setCategory(vnfResourceCustomization.getVnfResources().getCategory());
+ vnf.setCloudVersionMax(vnfResourceCustomization.getVnfResources().getAicVersionMax());
+ vnf.setCloudVersionMin(vnfResourceCustomization.getVnfResources().getAicVersionMin());
+ vnf.setMaxInstances(vnfResourceCustomization.getMaxInstances());
+ vnf.setMinInstances(vnfResourceCustomization.getMinInstances());
+ vnf.setModelCustomizationId(vnfResourceCustomization.getModelCustomizationUUID());
+ vnf.setModelInstanceName(vnfResourceCustomization.getModelInstanceName());
+ vnf.setModelInvariantId(vnfResourceCustomization.getVnfResources().getModelInvariantId());
+ vnf.setModelName(vnfResourceCustomization.getVnfResources().getModelName());
+ vnf.setModelVersionId(vnfResourceCustomization.getVnfResources().getModelUUID());
+ vnf.setModelVersion(vnfResourceCustomization.getVnfResources().getModelVersion());
+ vnf.setMultiStageDesign(vnfResourceCustomization.getMultiStageDesign());
+ vnf.setNfFunction(vnfResourceCustomization.getNfFunction());
+ vnf.setNfNamingCode(vnfResourceCustomization.getNfNamingCode());
+ vnf.setNfRole(vnfResourceCustomization.getNfRole());
+ vnf.setNfType(vnfResourceCustomization.getNfType());
+ vnf.setNfDataValid(vnfResourceCustomization.getNfDataValid());
+ vnf.setOrchestrationMode(vnfResourceCustomization.getVnfResources().getOrchestrationMode());
+ vnf.setSubCategory(vnfResourceCustomization.getVnfResources().getSubCategory());
+ vnf.setToscaNodeType(vnfResourceCustomization.getVnfResources().getToscaNodeType());
+
+ if (depth > 1) {
+ vnf.setVfModule(mapVfModules(vnfResourceCustomization, depth));
+ }
+ return vnf;
+ }
+
+ private List<VfModule> mapVfModules(VnfResourceCustomization vnfResourceCustomization, int depth) {
+ List<VfModule> vfModules = new ArrayList<>();
+ vnfResourceCustomization.getVfModuleCustomizations().parallelStream()
+ .forEach(vfModule -> vfModules.add(mapVfModule(vfModule, depth)));
+ return vfModules;
+ }
+
+ private VfModule mapVfModule(VfModuleCustomization vfModuleCust, int depth) {
+ VfModule vfModule = new VfModule();
+ vfModule.setAvailabilityZoneCount(vfModuleCust.getAvailabilityZoneCount());
+ vfModule.setCreated(vfModuleCust.getCreated());
+ vfModule.setDescription(vfModuleCust.getVfModule().getDescription());
+ vfModule.setInitialCount(vfModuleCust.getInitialCount());
+ vfModule.setIsBase(vfModuleCust.getVfModule().getIsBase());
+ vfModule.setIsVolumeGroup(getIsVolumeGroup(vfModuleCust));
+ vfModule.setMaxInstances(vfModuleCust.getMaxInstances());
+ vfModule.setMinInstances(vfModuleCust.getMinInstances());
+ vfModule.setLabel(vfModuleCust.getLabel());
+ vfModule.setModelCustomizationId(vfModuleCust.getModelCustomizationUUID());
+ vfModule.setModelInvariantId(vfModuleCust.getVfModule().getModelInvariantUUID());
+ vfModule.setModelName(vfModuleCust.getVfModule().getModelName());
+ vfModule.setModelVersionId(vfModuleCust.getVfModule().getModelUUID());
+ vfModule.setModelVersion(vfModuleCust.getVfModule().getModelVersion());
+ if (depth > 3) {
+ vfModule.setVnfc(mapCvnfcs(vfModuleCust));
+ }
+ return vfModule;
+ }
+
+ private List<Cvnfc> mapCvnfcs(VfModuleCustomization vfModuleCustomization) {
+ List<Cvnfc> cvnfcs = new ArrayList<>();
+ vfModuleCustomization.getCvnfcCustomization().parallelStream()
+ .forEach(cvnfcCust -> cvnfcs.add(mapCvnfcCus(cvnfcCust)));
+ return cvnfcs;
+ }
+
+ private Cvnfc mapCvnfcCus(CvnfcCustomization cvnfcCust) {
+ Cvnfc cvnfc = new Cvnfc();
+ cvnfc.setCreated(cvnfcCust.getCreated());
+ cvnfc.setDescription(cvnfcCust.getDescription());
+ cvnfc.setModelCustomizationId(cvnfcCust.getModelCustomizationUUID());
+ cvnfc.setModelInstanceName(cvnfcCust.getModelInstanceName());
+ cvnfc.setModelInvariantId(cvnfcCust.getModelInvariantUUID());
+ cvnfc.setModelName(cvnfcCust.getModelName());
+ cvnfc.setModelVersion(cvnfcCust.getModelVersion());
+ cvnfc.setModelVersionId(cvnfcCust.getModelUUID());
+ cvnfc.setNfcFunction(cvnfcCust.getNfcFunction());
+ cvnfc.setNfcNamingCode(cvnfcCust.getNfcNamingCode());
+ return cvnfc;
+ }
+
+ private boolean getIsVolumeGroup(VfModuleCustomization vfModuleCust) {
+ boolean isVolumeGroup = false;
+ HeatEnvironment envt = vfModuleCust.getVolumeHeatEnv();
+ if (envt != null) {
+ isVolumeGroup = true;
+ }
+ return isVolumeGroup;
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
new file mode 100644
index 0000000000..6f556edfa1
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.rest;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.rest.catalog.beans.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.google.common.base.Strings;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+@Api(value = "/v1", tags = "model")
+@Path("/v1/services")
+@Component
+public class ServiceRestImpl {
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private ServiceMapper serviceMapper;
+
+
+ @GET
+ @Path("/{modelUUID}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Service findService(@PathParam("modelUUID") String modelUUID, @QueryParam("depth") int depth) {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(modelUUID);
+ if (service == null) {
+ new CatalogEntityNotFoundException("Unable to find Service " + modelUUID);
+ }
+ return serviceMapper.mapService(service, depth);
+ }
+
+ @GET
+ @ApiOperation(value = "Find Service Models", response = Service.class, responseContainer = "List")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public List<Service> queryServices(
+ @ApiParam(value = "modelName", required = false) @QueryParam("modelName") String modelName,
+ @ApiParam(value = "distributionStatus",
+ required = false) @QueryParam("distributionStatus") String distributionStatus,
+ @ApiParam(value = "depth", required = false) @QueryParam("depth") int depth) {
+ List<Service> services = new ArrayList<>();
+ List<org.onap.so.db.catalog.beans.Service> serviceFromDB = new ArrayList<>();
+ if (!Strings.isNullOrEmpty(modelName) && !Strings.isNullOrEmpty(distributionStatus)) {
+ serviceFromDB = serviceRepo.findByModelNameAndDistrobutionStatus(modelName, distributionStatus);
+ } else if (!Strings.isNullOrEmpty(modelName)) {
+ serviceFromDB = serviceRepo.findByModelName(modelName);
+ } else {
+ serviceFromDB = serviceRepo.findAll();
+ }
+ serviceFromDB.stream().forEach(serviceDB -> services.add(serviceMapper.mapService(serviceDB, depth)));
+ return services;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java
new file mode 100644
index 0000000000..52a8ccb5a7
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfMapper.java
@@ -0,0 +1,37 @@
+package org.onap.so.adapters.catalogdb.rest;
+
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.rest.catalog.beans.Vnf;
+import org.springframework.stereotype.Component;
+import com.google.common.base.Strings;
+
+@Component
+public class VnfMapper {
+
+ public VnfResourceCustomization mapVnf(VnfResourceCustomization vnfCust, Vnf vnf) {
+
+ vnfCust.setAvailabilityZoneMaxCount(vnf.getAvailabilityZoneMaxCount());
+ vnfCust.setMaxInstances(vnf.getMaxInstances());
+ vnfCust.setMinInstances(vnf.getMinInstances());
+ vnfCust.setModelCustomizationUUID(vnf.getModelCustomizationId());
+ vnfCust.setModelInstanceName(vnf.getModelInstanceName());
+ vnfCust.setMultiStageDesign(vnf.getMultiStageDesign());
+ vnfCust.setNfDataValid(vnf.getNfDataValid());
+ vnfCust.setNfFunction(Strings.nullToEmpty(vnf.getNfFunction()));
+ vnfCust.setNfNamingCode(Strings.nullToEmpty(vnf.getNfNamingCode()));
+ vnfCust.setNfRole(Strings.nullToEmpty(vnf.getNfRole()));
+ vnfCust.setNfType(Strings.nullToEmpty(vnf.getNfType()));
+
+ VnfResource vnfRes = vnfCust.getVnfResources();
+ vnfRes.setOrchestrationMode(Strings.nullToEmpty(vnfRes.getOrchestrationMode()));
+ vnfRes.setSubCategory(Strings.nullToEmpty(vnfRes.getSubCategory()));
+ vnfRes.setToscaNodeType(Strings.nullToEmpty(vnfRes.getToscaNodeType()));
+ vnfRes.setModelInvariantUUID(vnfRes.getModelInvariantId());
+ vnfRes.setModelName(vnfRes.getModelName());
+ vnfRes.setModelUUID(vnfRes.getModelUUID());
+ vnfRes.setModelVersion(vnfRes.getModelVersion());
+ return vnfCust;
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
new file mode 100644
index 0000000000..4353526872
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.rest;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
+import org.onap.so.rest.catalog.beans.Vnf;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Api(value = "/v1/services/{modelUUID}/vnfs", tags = "model")
+@Path("/v1/services/{modelUUID}/vnfs")
+@Component
+public class VnfRestImpl {
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private ServiceMapper serviceMapper;
+
+ @Autowired
+ private VnfMapper vnfMapper;
+
+ @Autowired
+ private VnfCustomizationRepository vnfCustRepo;
+
+ @GET
+ @ApiOperation(value = "Find a VNF model contained within a service", response = Vnf.class)
+ @Path("/{modelCustomizationUUID}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Vnf findService(@PathParam("modelUUID") String serviceModelUUID,
+ @PathParam("modelCustomizationUUID") String modelCustomizationUUID, @QueryParam("depth") int depth) {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(serviceModelUUID);
+ if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
+ throw new WebApplicationException("Vnf Not Found", 404);
+ }
+ List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream()
+ .filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID))
+ .collect(Collectors.toList());
+ if (vnfCustom.isEmpty() || vnfCustom == null) {
+ return null;
+ } else if (vnfCustom.size() > 1) {
+ throw new RuntimeException(
+ "More than one Vnf model returned with model Customization UUID: " + modelCustomizationUUID);
+ }
+ return serviceMapper.mapVnf(vnfCustom.get(0), depth);
+ }
+
+ @PUT
+ @ApiOperation(value = "Update a VNF model contained within a service", response = Vnf.class)
+ @Path("/{modelCustomizationUUID}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional
+ public Response findService(@PathParam("modelUUID") String serviceModelUUID,
+ @PathParam("modelCustomizationUUID") String modelCustomizationUUID, Vnf vnf) {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(serviceModelUUID);
+ List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream()
+ .filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID))
+ .collect(Collectors.toList());
+ if (vnfCustom.isEmpty() || vnfCustom == null) {
+ throw new RuntimeException("No Vnf Found");
+ } else if (vnfCustom.size() > 1) {
+ throw new RuntimeException(
+ "More than one Vnf model returned with model Customization UUID: " + modelCustomizationUUID);
+ }
+ VnfResourceCustomization vnfCust = vnfMapper.mapVnf(vnfCustom.get(0), vnf);
+ vnfCustRepo.save(vnfCust);
+ return Response.ok().build();
+ }
+
+}
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml
deleted file mode 100644
index d7c13eaa14..0000000000
--- a/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-catalog:
- db:
- endpoint: http://localhost:8090
-
-ssl-enable: false
-mso:
- site-name: localDevEnv
- logPath: logs
- catalog:
- db:
- spring:
- endpoint: http://localhost:8090
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
-spring:
- security:
- usercredentials:
- -
- username: test
- password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
- role: BPEL-Client
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-
-server:
- port: 8090
-
-
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
index b1528a0897..1487cb21b2 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
@@ -16,11 +16,14 @@ mso:
spring:
datasource:
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
- initialization-mode: never
+ hikari:
+ jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: catdb-pool
+ registerMbeans: true
+
flyway:
baseline-on-migrate: false
url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
@@ -38,6 +41,8 @@ spring:
jackson:
serialization:
fail-on-empty-beans: false
+ main:
+ allow-bean-definition-overriding: true
#Actuator
management:
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql
new file mode 100644
index 0000000000..4a9c2cce9f
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql
@@ -0,0 +1,11 @@
+
+UPDATE catalogdb.service serv SET OVERALL_DISTRIBUTION_STATUS =(
+SELECT wds.DISTRIBUTION_ID_STATUS
+FROM requestdb.watchdog_distributionid_status wds
+INNER JOIN requestdb.watchdog_service_mod_ver_id_lookup wdlook
+ON wds.DISTRIBUTION_ID = wdlook.DISTRIBUTION_ID
+WHERE wdlook.SERVICE_MODEL_VERSION_ID = serv.MODEL_UUID
+ORDER BY wdlook.MODIFY_TIME DESC LIMIT 1);
+
+UPDATE catalogdb.service SET OVERALL_DISTRIBUTION_STATUS = 'DISTRIBUTION_COMPLETE_OK'
+WHERE service.OVERALL_DISTRIBUTION_STATUS = NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index eec8a82cc9..13d736e747 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -188,8 +188,8 @@ VALUES
('VnfAdapterBB', '*', '*', '*', '*' , 'Retry'),
('AAICheckVnfInMaintBB', '*', '*', '*', '*' , 'Abort'),
('AAISetVnfInMaintBB', '*', '*', '*', '*' , 'Abort'),
-('AAIUnsetVnfInMaintBB', '*', '*', '*', '*' , 'Abort');
-
+('AAIUnsetVnfInMaintBB', '*', '*', '*', '*' , 'Abort'),
+('ConfigDeployVnfBB', '*', '*', '*', '*' , 'Retry');
INSERT INTO building_block_detail (building_block_name, resource_type, target_action)
@@ -811,3 +811,7 @@ INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACT
VALUES
('ConfigAssignVnfBB', 'NO_VALIDATE', 'CUSTOM'),
('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM');
+
+UPDATE rainy_day_handler_macro SET reg_ex_error_message = '*' WHERE reg_ex_error_message IS null;
+
+UPDATE rainy_day_handler_macro SET SERVICE_ROLE = '*' WHERE SERVICE_ROLE IS null;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
index 3f76334bd9..137f73cf65 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__WorkflowDesignerData.sql
@@ -201,5 +201,5 @@ VALUES
INSERT INTO `workflow` (`ARTIFACT_UUID`,`ARTIFACT_NAME`,`NAME`,`OPERATION_NAME`,`VERSION`,`DESCRIPTION`,`RESOURCE_TARGET`,`SOURCE`)
VALUES
('9d45cd30-1a89-4993-87c1-6dd09c1696cf','VFModule-ScaleOut','VNF Scale Out','ScaleOut',1.0,'native static workflow to support ScaleOut','vfModule','native'),
-('da6478e4-ea33-3346-ac12-ab121284a333','VnfInPlaceUpdate.bpmn','VNF In Place Software Update','inPlaceSoftwareUpdate',1.0,'native static workflow to support inPlaceSoftwareUpdate','vnf','native'),
-('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VNF Config Update','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native'); \ No newline at end of file
+('da6478e4-ea33-3346-ac12-ab121284a333','VnfInPlaceUpdate.bpmn','VnfInPlaceUpdate','inPlaceSoftwareUpdate',1.0,'native static workflow to support inPlaceSoftwareUpdate','vnf','native'),
+('fdb3ac48-70f9-4584-bd92-253bdbdec1e1','VnfConfigUpdate.bpmn','VnfConfigUpdate','applyConfigModify',1.0,'native static workflow to support applyConfigModify','vnf','native');
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql
new file mode 100644
index 0000000000..16e6ecf4bf
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.11__AddVnfResourceOrder.sql
@@ -0,0 +1,7 @@
+use catalogdb;
+
+ALTER TABLE vnf_resource_customization
+ADD VNFCINSTANCEGROUP_ORDER varchar(255);
+
+ALTER TABLE vnfc_customization
+ADD RESOURCE_INPUT varchar(2000); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql
new file mode 100644
index 0000000000..95a2c25eb8
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.12__Add_Relation_VnfcCustomization.sql
@@ -0,0 +1,2 @@
+use catalogdb;
+ALTER TABLE vnfc_customization ADD vnfc_instance_group_customization_id INTEGER NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
index 5d940fb9ea..8e52fbeeaf 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.5.1__Correct_Default_NeutronNetwork.sql
@@ -30,3 +30,8 @@ resources:
INSERT INTO `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`, `HEAT_TEMPLATE_ARTIFACT_UUID`,`AIC_VERSION_MIN` , `AIC_VERSION_MAX` )
VALUES ('Generic NeutronNet','efee1d84-b8ec-11e7-abc4-cec278b6b50a','2.0','3.0');
+INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`)
+VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'network_name', 0, 'String', NULL);
+
+INSERT INTO `heat_template_params` (`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, `PARAM_TYPE`, `PARAM_ALIAS`)
+VALUES ('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'shared', 0, 'Boolean', NULL);
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql
new file mode 100644
index 0000000000..ae416ffbfe
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql
@@ -0,0 +1 @@
+ALTER TABLE catalogdb.service ADD COLUMN IF NOT EXISTS OVERALL_DISTRIBUTION_STATUS varchar(45); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql
new file mode 100644
index 0000000000..cf54d55fde
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.7.2__Add_Error_Message_Rainy_Day.sql
@@ -0,0 +1,2 @@
+use catalogdb;
+ALTER TABLE rainy_day_handler_macro ADD COLUMN IF NOT EXISTS REG_EX_ERROR_MESSAGE varchar(300) DEFAULT NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql
new file mode 100644
index 0000000000..3c45507b81
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.0__AddNamingPolicyToService.sql
@@ -0,0 +1,8 @@
+USE catalogdb;
+
+ALTER TABLE service
+ADD IF NOT EXISTS ONAP_GENERATED_NAMING tinyint(1) DEFAULT NULL;
+
+ALTER TABLE service
+ADD IF NOT EXISTS NAMING_POLICY varchar(200) DEFAULT NULL;
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql
new file mode 100644
index 0000000000..8fe3caf88f
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.1.1__AddServiceRoleToRainyDayHandling.sql
@@ -0,0 +1,2 @@
+use catalogdb;
+ALTER TABLE rainy_day_handler_macro ADD COLUMN IF NOT EXISTS SERVICE_ROLE varchar(300) DEFAULT NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql
new file mode 100644
index 0000000000..93dde1341e
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.2__AddNfValidData.sql
@@ -0,0 +1,5 @@
+USE catalogdb;
+
+ALTER TABLE vnf_resource_customization
+ADD IF NOT EXISTS NF_DATA_VALID tinyint(1) DEFAULT 0;
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql
new file mode 100644
index 0000000000..6f61b830f2
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V6.3__AlterColumnActionCategoryControllerSelectionCategory.sql
@@ -0,0 +1,3 @@
+USE catalogdb;
+
+ALTER TABLE controller_selection_reference MODIFY ACTION_CATEGORY VARCHAR(50) NOT NULL;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
index 3fb156d68a..499310748e 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/CatalogDbAdapterBaseTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.catalogdb;
import org.junit.Test;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java
new file mode 100644
index 0000000000..00db6d5938
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroupsTest.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import org.assertj.core.api.Assertions;
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.VFCInstanceGroup;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
+import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
+import org.onap.so.jsonpath.JsonPathUtil;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class QueryGroupsTest {
+
+ @Test
+ public void convertToJson_successful() {
+ QueryGroups queryGroups = new QueryGroups(createList());
+ String jsonResult = queryGroups.JSON2(true, false);
+
+ Assertions.assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.groups[0].modelInfo.modelName"))
+ .contains("test");
+ Assertions
+ .assertThat(
+ JsonPathUtil.getInstance().locateResult(jsonResult, "$.groups[0].vnfcs[0].modelInfo.modelName"))
+ .contains("test");
+ }
+
+ private List<VnfcInstanceGroupCustomization> createList() {
+
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("test");
+ vnfcCustomization.setModelVersion("test");
+ vnfcCustomization.setModelInvariantUUID("test");
+ vnfcCustomization.setModelName("test");
+
+ VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup();
+ vfcInstanceGroup.setModelName("test");
+ vfcInstanceGroup.setModelUUID("test");
+ vfcInstanceGroup.setModelInvariantUUID("test");
+ vfcInstanceGroup.setModelVersion("test");
+
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = new VnfcInstanceGroupCustomization();
+ vnfcInstanceGroupCustomization.setVnfcCustomizations(Arrays.asList(vnfcCustomization));
+ vnfcInstanceGroupCustomization.setInstanceGroup(vfcInstanceGroup);
+
+
+ vfcInstanceGroup.setVnfcInstanceGroupCustomizations(Arrays.asList(vnfcInstanceGroupCustomization));
+ return Arrays.asList(vnfcInstanceGroupCustomization);
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java
new file mode 100644
index 0000000000..abc59352b0
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.Test;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.jsonpath.JsonPathUtil;
+import java.util.ArrayList;
+import java.util.List;
+
+public class QueryVnfcsTest {
+
+ @Test
+ public void convertToJson_successful() {
+ QueryVnfcs queryVnfcs = new QueryVnfcs(createList());
+ String jsonResult = queryVnfcs.JSON2(true, false);
+ System.out.println(jsonResult);
+ assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vnfcs[0].modelInfo.modelName"))
+ .contains("model1");
+ assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.vnfcs[1].modelInfo.modelName"))
+ .contains("model2");
+
+ }
+
+ private List<VnfcCustomization> createList() {
+ List<VnfcCustomization> customizations = new ArrayList();
+
+ VnfcCustomization c1 = new VnfcCustomization();
+ c1.setModelName("model1");
+ c1.setModelUUID("uuid1");
+ c1.setModelInvariantUUID("inv1");
+ c1.setModelVersion("v1");
+ c1.setModelCustomizationUUID("cust1");
+ c1.setResourceInput("resourceInput1");
+
+ VnfcCustomization c2 = new VnfcCustomization();
+ c2.setModelName("model2");
+ c2.setModelUUID("uuid2");
+ c2.setModelInvariantUUID("inv2");
+ c2.setModelVersion("v2");
+ c2.setModelCustomizationUUID("cust2");
+ c2.setResourceInput("resourceInput2");
+
+ customizations.add(c1);
+ customizations.add(c2);
+ return customizations;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
new file mode 100644
index 0000000000..d46fd9c7ba
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.junit.Test;
+import org.onap.so.adapters.catalogdb.rest.ServiceMapper;
+import org.onap.so.db.catalog.beans.HeatTemplate;
+import org.onap.so.db.catalog.beans.HeatTemplateParam;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.rest.catalog.beans.Service;
+import wiremock.com.fasterxml.jackson.core.JsonParseException;
+import wiremock.com.fasterxml.jackson.databind.JsonMappingException;
+import wiremock.com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ServiceMapperTest {
+
+ private ServiceMapper serviceMapper = new ServiceMapper();
+
+ @Test
+ public void service_map_test() throws JsonParseException, JsonMappingException, IOException {
+ Service actual = serviceMapper.mapService(getTestService(), 2);
+ assertThat(actual, sameBeanAs(getExpectedService()));
+ }
+
+ private Service getExpectedService() throws JsonParseException, JsonMappingException, IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ return mapper.readValue(getJson("ExpectedService.json"), Service.class);
+ }
+
+
+ private org.onap.so.db.catalog.beans.Service getTestService() {
+ org.onap.so.db.catalog.beans.Service testService = new org.onap.so.db.catalog.beans.Service();
+ testService.setCategory("category");
+ testService.setDescription("description");
+ testService.setDistrobutionStatus("distrobutionStatus");
+ testService.setEnvironmentContext("environmentContext");
+ testService.setModelInvariantUUID("modelInvariantUUID");
+ testService.setModelName("modelName");
+ testService.setModelUUID("modelUUID");
+ testService.setModelVersion("modelVersion");
+ testService.setServiceType("serviceType");
+ testService.setServiceRole("serviceRole");
+
+ testService.getVnfCustomizations().add(getTestVnfCustomization());
+ return testService;
+ }
+
+ private org.onap.so.db.catalog.beans.VnfResourceCustomization getTestVnfCustomization() {
+ org.onap.so.db.catalog.beans.VnfResourceCustomization test =
+ new org.onap.so.db.catalog.beans.VnfResourceCustomization();
+ test.setId(1);
+ test.setAvailabilityZoneMaxCount(11);
+ test.setMaxInstances(3);
+ test.setMinInstances(1);
+ test.setModelCustomizationUUID("modelCustomizationUUID");
+ test.setModelInstanceName("modelInstanceName");
+ test.setMultiStageDesign("multiStageDesign");
+ test.setNfFunction("nfFunction");
+ test.setNfNamingCode("nfNamingCode");
+ test.setNfRole("nfRole");
+ test.setNfType("nfType");
+ test.setService(new org.onap.so.db.catalog.beans.Service());
+ test.setVnfResources(getTestVnfResource());
+ test.setVfModuleCustomizations(getTestVfModuleCust());
+ return test;
+ }
+
+ private List<VfModuleCustomization> getTestVfModuleCust() {
+ List<VfModuleCustomization> test = new ArrayList<>();
+ VfModuleCustomization testVfMod = new VfModuleCustomization();
+ testVfMod.setAvailabilityZoneCount(10);
+ testVfMod.setInitialCount(1);
+ testVfMod.setLabel("label");
+ testVfMod.setMaxInstances(3);
+ testVfMod.setMinInstances(1);
+ testVfMod.setModelCustomizationUUID("modelCustomizationUUID");
+ org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule.setDescription("description");
+ vfModule.setIsBase(false);
+ vfModule.setModelInvariantUUID("modelInvariantUUID");
+ vfModule.setModelName("modelName");
+ vfModule.setModelUUID("modelUUID");
+ vfModule.setModelVersion("modelVersion");
+ HeatTemplate moduleHeatTemplate = new HeatTemplate();
+ moduleHeatTemplate.setArtifactChecksum("artifactChecksum");
+ moduleHeatTemplate.setArtifactUuid("artifactUuid");
+ List<HeatTemplate> childTemplates;
+ // moduleHeatTemplate.setChildTemplates(childTemplates);
+ moduleHeatTemplate.setDescription("description");
+ Set<HeatTemplateParam> parameters = new HashSet<>();
+ HeatTemplateParam heatParam = new HeatTemplateParam();
+ heatParam.setHeatTemplateArtifactUuid("heatTemplateArtifactUuid");
+ heatParam.setParamAlias("paramAlias");
+ heatParam.setParamName("paramName");
+ heatParam.setParamType("paramType");
+ heatParam.setRequired(false);
+ parameters.add(heatParam);
+ moduleHeatTemplate.setParameters(parameters);
+ moduleHeatTemplate.setTemplateBody("templateBody");
+ moduleHeatTemplate.setTemplateName("templateName");
+ moduleHeatTemplate.setTimeoutMinutes(1000);
+ moduleHeatTemplate.setVersion("version");
+ vfModule.setModuleHeatTemplate(moduleHeatTemplate);
+ testVfMod.setVfModule(vfModule);
+ test.add(testVfMod);
+ return test;
+ }
+
+ private org.onap.so.db.catalog.beans.VnfResource getTestVnfResource() {
+ org.onap.so.db.catalog.beans.VnfResource test = new org.onap.so.db.catalog.beans.VnfResource();
+ test.setCategory("category");
+ test.setDescription("description");
+ test.setModelInvariantUUID("modelInvariantUUID");
+ test.setModelName("modelName");
+ test.setModelUUID("modelUUID");
+ test.setModelVersion("modelVersion");
+ test.setAicVersionMax("cloudVersionMax");
+ test.setAicVersionMin("cloudVersionMin");
+ test.setOrchestrationMode("orchestrationMode");
+ test.setSubCategory("subCategory");
+ test.setToscaNodeType("toscaNodeType");
+ return test;
+ }
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename)));
+ }
+}
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 d8d9ee191a..f82c7acd38 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -22,15 +22,14 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.UUID;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.so.adapters.catalogdb.CatalogDBApplication;
import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.AuthenticationType;
import org.onap.so.db.catalog.beans.CloudIdentity;
@@ -56,10 +55,7 @@ import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@@ -74,123 +70,130 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Autowired
CatalogDbClientPortChanger client;
+
+
@Before
public void initialize() {
client.wiremockPort = String.valueOf(port);
+ client.setEndpoint(getEndpoint(port));
+ }
+
+ protected String getEndpoint(int port) {
+ return "http://localhost:" + port;
}
@Test
- public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep() {
- RainyDayHandlerStatus rainyDayHandlerStatus =
- client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "*", "*", "*", "*");
- Assert.assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
+ public void testGetRainyDayHandler_Regex() {
+ RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
+ "*", "*", "*", "The Flavor ID (nd.c6r16d20) could not be found.", "*");
+ assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
@Test
- public void testGetRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStepRecordNotFound() {
- RainyDayHandlerStatus rainyDayHandlerStatus =
- client.getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- UUID.randomUUID().toString(), "*", "*", "*", "*");
- Assert.assertNull(rainyDayHandlerStatus);
+ public void testGetRainyDayHandler__Encoding_Regex() {
+ RainyDayHandlerStatus rainyDayHandlerStatus = client.getRainyDayHandlerStatus("AssignServiceInstanceBB", "*",
+ "*", "*", "*",
+ "resources.lba_0_dmz_vmi_0: Unknown id: Error: oper 1 url /fqname-to-id body {\"fq_name\": [\"zrdm6bvota05-dmz_sec_group\"], \"type\": \"security-group\"} response Name ['zrdm6bvota05-dmz_sec_group'] not found",
+ "*");
+ assertEquals("Rollback", rainyDayHandlerStatus.getPolicy());
}
@Test
public void testGetCloudSiteHappyPath() throws Exception {
CloudSite cloudSite = client.getCloudSite(MTN13);
- Assert.assertNotNull(cloudSite);
- Assert.assertNotNull(cloudSite.getIdentityService());
- Assert.assertEquals("MDT13", cloudSite.getClli());
- Assert.assertEquals("mtn13", cloudSite.getRegionId());
- Assert.assertEquals("MTN13", cloudSite.getIdentityServiceId());
+ assertNotNull(cloudSite);
+ assertNotNull(cloudSite.getIdentityService());
+ assertEquals("MDT13", cloudSite.getClli());
+ assertEquals("mtn13", cloudSite.getRegionId());
+ assertEquals("MTN13", cloudSite.getIdentityServiceId());
}
@Test
public void testGetCloudSiteNotFound() throws Exception {
CloudSite cloudSite = client.getCloudSite(UUID.randomUUID().toString());
- Assert.assertNull(cloudSite);
+ assertNull(cloudSite);
}
@Test
public void testGetCloudifyManagerHappyPath() throws Exception {
CloudifyManager cloudifyManager = client.getCloudifyManager("mtn13");
- Assert.assertNotNull(cloudifyManager);
- Assert.assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
+ assertNotNull(cloudifyManager);
+ assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
}
@Test
public void testGetCloudifyManagerNotFound() throws Exception {
CloudifyManager cloudifyManager = client.getCloudifyManager(UUID.randomUUID().toString());
- Assert.assertNull(cloudifyManager);
+ assertNull(cloudifyManager);
}
@Test
public void testGetCloudSiteByClliAndAicVersionHappyPath() throws Exception {
CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "2.5");
- Assert.assertNotNull(cloudSite);
+ assertNotNull(cloudSite);
}
@Test
public void testGetCloudSiteByClliAndAicVersionNotFound() throws Exception {
CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "232496239746328");
- Assert.assertNull(cloudSite);
+ assertNull(cloudSite);
}
@Test
public void testGetServiceByID() throws Exception {
Service serviceByID = client.getServiceByID("5df8b6de-2083-11e7-93ae-92361f002671");
- Assert.assertNotNull(serviceByID);
- Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
- Assert.assertEquals("NA", serviceByID.getServiceType());
- Assert.assertEquals("NA", serviceByID.getServiceRole());
+ assertNotNull(serviceByID);
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
+ assertEquals("NA", serviceByID.getServiceType());
+ assertEquals("NA", serviceByID.getServiceRole());
}
@Test
public void testGetServiceByIDNotFound() throws Exception {
Service serviceByID = client.getServiceByID(UUID.randomUUID().toString());
- Assert.assertNull(serviceByID);
+ assertNull(serviceByID);
}
@Test
public void testGetVfModuleByModelUUID() throws Exception {
VfModule vfModule = client.getVfModuleByModelUUID("20c4431c-246d-11e7-93ae-92361f002671");
- Assert.assertNotNull(vfModule);
- Assert.assertNotNull(vfModule.getVfModuleCustomization());
- Assert.assertEquals("78ca26d0-246d-11e7-93ae-92361f002671", vfModule.getModelInvariantUUID());
- Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
+ assertNotNull(vfModule);
+ assertNotNull(vfModule.getVfModuleCustomization());
+ assertEquals("78ca26d0-246d-11e7-93ae-92361f002671", vfModule.getModelInvariantUUID());
+ assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
}
@Test
public void testGetVfModuleByModelUUIDNotFound() throws Exception {
VfModule vfModule = client.getVfModuleByModelUUID(UUID.randomUUID().toString());
- Assert.assertNull(vfModule);
+ assertNull(vfModule);
}
@Test
public void testGetVnfResourceByModelUUID() throws Exception {
VnfResource vnfResource = client.getVnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
- Assert.assertNotNull(vnfResource);
- Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
+ assertNotNull(vnfResource);
+ assertEquals("vSAMP10a", vnfResource.getModelName());
}
@Test
public void testGetVnfResourceByModelUUIDNotFound() throws Exception {
VnfResource vnfResource = client.getVnfResourceByModelUUID(UUID.randomUUID().toString());
- Assert.assertNull(vnfResource);
+ assertNull(vnfResource);
}
@Test
public void testGetVnfResourceCustomizationByModelCustomizationUUID() {
VnfResourceCustomization vnfResourceCustomization =
client.getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
- Assert.assertNotNull(vnfResourceCustomization);
- Assert.assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
- Assert.assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
- Assert.assertNotNull(vnfResourceCustomization.getVnfResources());
- Assert.assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
- Assert.assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
+ assertNotNull(vnfResourceCustomization);
+ assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
+ assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
+ assertNotNull(vnfResourceCustomization.getVnfResources());
+ assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
+ assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
assertTrue("skip post instantiation configuration", vnfResourceCustomization.isSkipPostInstConf());
}
@@ -198,15 +201,15 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void testGetVnfResourceCustomizationByModelCustomizationUUINotFound() {
VnfResourceCustomization vnfResourceCustomization =
client.getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(vnfResourceCustomization);
+ assertNull(vnfResourceCustomization);
}
@Test
public void testGetInstanceGroupByModelUUID() {
InstanceGroup instanceGroup = client.getInstanceGroupByModelUUID("0c8692ef-b9c0-435d-a738-edf31e71f38b");
- Assert.assertNotNull(instanceGroup);
- Assert.assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
- Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806",
+ assertNotNull(instanceGroup);
+ assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
+ assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806",
instanceGroup.getToscaNodeType().toString());
}
@@ -214,33 +217,33 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void testGetVfModuleCustomizationByModelCuztomizationUUID() {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
- Assert.assertNotNull(vfModuleCustomization);
- Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
- Assert.assertEquals("base", vfModuleCustomization.getLabel());
+ assertNotNull(vfModuleCustomization);
+ assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
+ assertEquals("base", vfModuleCustomization.getLabel());
}
@Test
public void testGetVfModuleCustomizationByModelCuztomizationUUIDNotFound() {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(vfModuleCustomization);
+ assertNull(vfModuleCustomization);
}
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUID() {
NetworkResourceCustomization networkResourceCustomization =
client.getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac");
- Assert.assertNotNull(networkResourceCustomization);
- Assert.assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
- Assert.assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
- Assert.assertNotNull(networkResourceCustomization.getNetworkResource());
+ assertNotNull(networkResourceCustomization);
+ assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
+ assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
+ assertNotNull(networkResourceCustomization.getNetworkResource());
}
@Test
public void testGetNetworkResourceCustomizationByModelCustomizationUUIDNotFound() {
NetworkResourceCustomization networkResourceCustomization =
client.getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(networkResourceCustomization);
+ assertNull(networkResourceCustomization);
}
@Test
@@ -248,10 +251,10 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
"cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672");
- Assert.assertNotNull(vfModuleCustomization);
- Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
- Assert.assertNotNull(vfModuleCustomization.getVfModule());
- Assert.assertEquals("base", vfModuleCustomization.getLabel());
+ assertNotNull(vfModuleCustomization);
+ assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
+ assertNotNull(vfModuleCustomization.getVfModule());
+ assertEquals("base", vfModuleCustomization.getLabel());
}
@Test
@@ -259,45 +262,43 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VfModuleCustomization vfModuleCustomization =
client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
"cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString());
- Assert.assertNull(vfModuleCustomization);
+ assertNull(vfModuleCustomization);
}
@Test
public void testGetFirstByServiceModelUUIDAndAction() {
ServiceRecipe serviceRecipe =
client.getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance");
- Assert.assertNotNull(serviceRecipe);
- Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
- Assert.assertNotNull(serviceRecipe.getAction());
- Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
- serviceRecipe.getOrchestrationUri());
- Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
+ assertNotNull(serviceRecipe);
+ assertNotNull(serviceRecipe.getServiceModelUUID());
+ assertNotNull(serviceRecipe.getAction());
+ assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testGetFirstByServiceModelUUIDAndActionNotFound() {
ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671",
UUID.randomUUID().toString());
- Assert.assertNull(serviceRecipe);
+ assertNull(serviceRecipe);
}
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersion() {
VnfResource vnfResource = client
.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0");
- Assert.assertNotNull(vnfResource);
- Assert.assertNotNull(vnfResource.getModelInvariantId());
- Assert.assertNotNull(vnfResource.getModelVersion());
- Assert.assertNotNull(vnfResource.getHeatTemplates());
- Assert.assertNotNull(vnfResource.getVnfResourceCustomizations());
- Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
+ assertNotNull(vnfResource);
+ assertNotNull(vnfResource.getModelInvariantId());
+ assertNotNull(vnfResource.getModelVersion());
+ assertNotNull(vnfResource.getHeatTemplates());
+ assertEquals("vSAMP10a", vnfResource.getModelName());
}
@Test
public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersionNotFound() {
VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(
"2fff5b20-214b-11e7-93ae-92361f002671", UUID.randomUUID().toString());
- Assert.assertNull(vnfResource);
+ assertNull(vnfResource);
}
@Test
@@ -306,29 +307,28 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
vnfr.setModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources =
client.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr);
- Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
- Assert.assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
- Assert.assertEquals("vSAMP10a 1",
+ assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
+ assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
+ assertEquals("vSAMP10a 1",
firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName());
- Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
- Assert.assertNotNull(
- firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
+ assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
+ assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
}
@Test
public void testGetFirstVnfRecipeByNfRoleAndAction() {
VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction("GR-API-DEFAULT", "createInstance");
- Assert.assertNotNull(vnfRecipe);
- Assert.assertNotNull(vnfRecipe.getNfRole());
- Assert.assertNotNull(vnfRecipe.getAction());
- Assert.assertEquals("Gr api recipe to create vnf", vnfRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfRecipe.getOrchestrationUri());
+ assertNotNull(vnfRecipe);
+ assertNotNull(vnfRecipe.getNfRole());
+ assertNotNull(vnfRecipe.getAction());
+ assertEquals("Gr api recipe to create vnf", vnfRecipe.getDescription());
+ assertEquals("/mso/async/services/WorkflowActionBB", vnfRecipe.getOrchestrationUri());
}
@Test
public void testGetFirstVnfRecipeByNfRoleAndActionNotFound() {
VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction(UUID.randomUUID().toString(), "createInstance");
- Assert.assertNull(vnfRecipe);
+ assertNull(vnfRecipe);
}
@Test
@@ -336,12 +336,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VnfComponentsRecipe vnfComponentsRecipe =
client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
"20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance");
- Assert.assertNotNull(vnfComponentsRecipe);
- Assert.assertNotNull(vnfComponentsRecipe.getAction());
- Assert.assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
- Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
- Assert.assertEquals("Gr api recipe to create volume-group", vnfComponentsRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfComponentsRecipe.getOrchestrationUri());
+ assertNotNull(vnfComponentsRecipe);
+ assertNotNull(vnfComponentsRecipe.getAction());
+ assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
+ assertNotNull(vnfComponentsRecipe.getVnfComponentType());
+ assertEquals("Gr api recipe to create volume-group", vnfComponentsRecipe.getDescription());
+ assertEquals("/mso/async/services/WorkflowActionBB", vnfComponentsRecipe.getOrchestrationUri());
}
@@ -351,80 +351,79 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
VnfComponentsRecipe vnfComponentsRecipe =
client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
UUID.randomUUID().toString(), "volumeGroup", "createInstance");
- Assert.assertNull(vnfComponentsRecipe);
+ assertNull(vnfComponentsRecipe);
}
@Test
public void testGetFirstVnfComponentsRecipeByVnfComponentTypeAndAction() {
VnfComponentsRecipe vnfComponentsRecipe =
client.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance");
- Assert.assertNotNull(vnfComponentsRecipe);
- Assert.assertNotNull(vnfComponentsRecipe.getAction());
- Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
- Assert.assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
- Assert.assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1",
- vnfComponentsRecipe.getOrchestrationUri());
+ assertNotNull(vnfComponentsRecipe);
+ assertNotNull(vnfComponentsRecipe.getAction());
+ assertNotNull(vnfComponentsRecipe.getVnfComponentType());
+ assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
+ assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri());
}
@Test
public void testGetServiceByModelVersionAndModelInvariantUUID() {
Service service =
client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
- Assert.assertNotNull(service);
- Assert.assertNotNull(service.getModelVersion());
- Assert.assertNotNull(service.getModelInvariantUUID());
- Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
- Assert.assertEquals("NA", service.getServiceRole());
+ assertNotNull(service);
+ assertNotNull(service.getModelVersion());
+ assertNotNull(service.getModelInvariantUUID());
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
+ assertEquals("NA", service.getServiceRole());
}
@Test
public void testGetServiceByModelVersionAndModelInvariantUUIDNotFound() {
Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", UUID.randomUUID().toString());
- Assert.assertNull(service);
+ assertNull(service);
}
@Test
public void testGetVfModuleByModelInvariantUUIDAndModelVersion() {
VfModule vfModule =
client.getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2");
- Assert.assertNotNull(vfModule);
- Assert.assertNotNull(vfModule.getModelVersion());
- Assert.assertNotNull(vfModule.getModelInvariantUUID());
- Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
- Assert.assertEquals("vSAMP10a DEV Base", vfModule.getDescription());
+ assertNotNull(vfModule);
+ assertNotNull(vfModule.getModelVersion());
+ assertNotNull(vfModule.getModelInvariantUUID());
+ assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
+ assertEquals("vSAMP10a DEV Base", vfModule.getDescription());
}
@Test
public void testGetVfModuleByModelInvariantUUIDAndModelVersionNotFound() {
VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion(UUID.randomUUID().toString(), "2");
- Assert.assertNull(vfModule);
+ assertNull(vfModule);
}
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDesc() {
List<Service> serviceList =
client.getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
- Assert.assertFalse(serviceList.isEmpty());
- Assert.assertEquals(2, serviceList.size());
+ assertFalse(serviceList.isEmpty());
+ assertEquals(2, serviceList.size());
Service service = serviceList.get(0);
- Assert.assertEquals("2.0", service.getModelVersion());
+ assertEquals("2.0", service.getModelVersion());
}
@Test
public void testGetServiceByModelInvariantUUIDOrderByModelVersionDescNotFound() {
List<Service> serviceList =
client.getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString());
- Assert.assertTrue(serviceList.isEmpty());
+ assertTrue(serviceList.isEmpty());
}
@Test
public void testGetVfModuleByModelInvariantUUIDOrderByModelVersionDesc() {
List<VfModule> moduleList =
client.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671");
- Assert.assertFalse(moduleList.isEmpty());
- Assert.assertEquals(2, moduleList.size());
+ assertFalse(moduleList.isEmpty());
+ assertEquals(2, moduleList.size());
VfModule module = moduleList.get(0);
- Assert.assertEquals("vSAMP10a DEV Base", module.getDescription());
+ assertEquals("vSAMP10a DEV Base", module.getDescription());
}
@Test
@@ -450,20 +449,20 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
cloudSite.setIdentityService(cloudIdentity);
localClient.postCloudSite(cloudSite);
CloudSite getCloudSite = this.client.getCloudSite("MTN6");
- Assert.assertNotNull(getCloudSite);
- Assert.assertNotNull(getCloudSite.getIdentityService());
- Assert.assertEquals("TESTCLLI", getCloudSite.getClli());
- Assert.assertEquals("regionId", getCloudSite.getRegionId());
- Assert.assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
+ assertNotNull(getCloudSite);
+ assertNotNull(getCloudSite.getIdentityService());
+ assertEquals("TESTCLLI", getCloudSite.getClli());
+ assertEquals("regionId", getCloudSite.getRegionId());
+ assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
}
@Test
public void testGetHomingInstance() {
HomingInstance homingInstance = client.getHomingInstance("5df8b6de-2083-11e7-93ae-92361f232671");
- Assert.assertNotNull(homingInstance);
- Assert.assertNotNull(homingInstance.getCloudOwner());
- Assert.assertNotNull(homingInstance.getCloudRegionId());
- Assert.assertNotNull(homingInstance.getOofDirectives());
+ assertNotNull(homingInstance);
+ assertNotNull(homingInstance.getCloudOwner());
+ assertNotNull(homingInstance.getCloudRegionId());
+ assertNotNull(homingInstance.getOofDirectives());
}
@Test
@@ -487,43 +486,43 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
+ "\"id\": \"vsink\"\n" + "}\n" + "]\n" + "}");
localClient.postHomingInstance(homingInstance);
HomingInstance getHomingInstance = this.client.getHomingInstance("5df8d6be-2083-11e7-93ae-92361f232671");
- Assert.assertNotNull(getHomingInstance);
- Assert.assertNotNull(getHomingInstance.getCloudRegionId());
- Assert.assertNotNull(getHomingInstance.getCloudOwner());
- Assert.assertEquals("CloudOwner-1", getHomingInstance.getCloudOwner());
- Assert.assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId());
+ assertNotNull(getHomingInstance);
+ assertNotNull(getHomingInstance.getCloudRegionId());
+ assertNotNull(getHomingInstance.getCloudOwner());
+ assertEquals("CloudOwner-1", getHomingInstance.getCloudOwner());
+ assertEquals("CloudRegionOne", getHomingInstance.getCloudRegionId());
}
@Test
public void testGetServiceByModelName() {
Service service = client.getServiceByModelName("MSOTADevInfra_Test_Service");
- Assert.assertNotNull(service);
- Assert.assertNotNull(service.getModelVersion());
- Assert.assertNotNull(service.getModelInvariantUUID());
- Assert.assertEquals("MSOTADevInfra_Test_Service", service.getModelName());
- Assert.assertEquals("NA", service.getServiceRole());
+ assertNotNull(service);
+ assertNotNull(service.getModelVersion());
+ assertNotNull(service.getModelInvariantUUID());
+ assertEquals("MSOTADevInfra_Test_Service", service.getModelName());
+ assertEquals("NA", service.getServiceRole());
}
@Test
public void testGetServiceByModelNameNotFound() {
Service service = client.getServiceByModelName("Not_Found");
- Assert.assertNull(service);
+ assertNull(service);
}
@Test
public void testGetServiceByModelUUID() {
Service service = client.getServiceByModelUUID("5df8b6de-2083-11e7-93ae-92361f002679");
- Assert.assertNotNull(service);
- Assert.assertNotNull(service.getModelVersion());
- Assert.assertNotNull(service.getModelInvariantUUID());
- Assert.assertEquals("5df8b6de-2083-11e7-93ae-92361f002679", service.getModelUUID());
- Assert.assertEquals("NA", service.getServiceRole());
+ assertNotNull(service);
+ assertNotNull(service.getModelVersion());
+ assertNotNull(service.getModelInvariantUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002679", service.getModelUUID());
+ assertEquals("NA", service.getServiceRole());
}
@Test
public void testGetServiceByModelUUIDNotFound() {
Service service = client.getServiceByModelUUID("Not_Found");
- Assert.assertNull(service);
+ assertNull(service);
}
@Test
@@ -535,53 +534,52 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
northBoundRequest.setCloudOwner("my-custom-cloud-owner");
client.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner("createService", "service", true,
"my-custom-cloud-owner");
- Assert.assertNotNull(northBoundRequest);
- Assert.assertEquals("createService", northBoundRequest.getAction());
- Assert.assertEquals("service", northBoundRequest.getRequestScope());
- Assert.assertEquals(true, northBoundRequest.getIsAlacarte());
- Assert.assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner());
+ assertNotNull(northBoundRequest);
+ assertEquals("createService", northBoundRequest.getAction());
+ assertEquals("service", northBoundRequest.getRequestScope());
+ assertEquals(true, northBoundRequest.getIsAlacarte());
+ assertEquals("my-custom-cloud-owner", northBoundRequest.getCloudOwner());
}
@Test
public void testFindServiceRecipeByActionAndServiceModelUUID() {
ServiceRecipe serviceRecipe = client.findServiceRecipeByActionAndServiceModelUUID("createInstance",
"4694a55f-58b3-4f17-92a5-796d6f5ffd0d");
- Assert.assertNotNull(serviceRecipe);
- Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
- Assert.assertNotNull(serviceRecipe.getAction());
- Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance",
- serviceRecipe.getOrchestrationUri());
- Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
+ assertNotNull(serviceRecipe);
+ assertNotNull(serviceRecipe.getServiceModelUUID());
+ assertNotNull(serviceRecipe.getAction());
+ assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
}
@Test
public void testFindServiceRecipeByActionAndServiceModelUUIDNotFound() {
ServiceRecipe serviceRecipe =
client.findServiceRecipeByActionAndServiceModelUUID("not_found", "5df8b6de-2083-11e7-93ae-test");
- Assert.assertNull(serviceRecipe);
+ assertNull(serviceRecipe);
}
@Test
public void testFindExternalToInternalServiceByServiceName() {
ExternalServiceToInternalService externalServiceToInternalService =
client.findExternalToInternalServiceByServiceName("MySpecialServiceName");
- Assert.assertNotNull(externalServiceToInternalService);
- Assert.assertNotNull(externalServiceToInternalService.getServiceName());
- Assert.assertNotNull(externalServiceToInternalService.getServiceModelUUID());
- Assert.assertEquals("MySpecialServiceName", externalServiceToInternalService.getServiceName());
+ assertNotNull(externalServiceToInternalService);
+ assertNotNull(externalServiceToInternalService.getServiceName());
+ assertNotNull(externalServiceToInternalService.getServiceModelUUID());
+ assertEquals("MySpecialServiceName", externalServiceToInternalService.getServiceName());
}
@Test
public void testFindExternalToInternalServiceByServiceNameNotFound() {
ExternalServiceToInternalService externalServiceToInternalService =
client.findExternalToInternalServiceByServiceName("Not_Found");
- Assert.assertNull(externalServiceToInternalService);
+ assertNull(externalServiceToInternalService);
}
@Test
public void getPnfResourceByModelUUID_validUuid_expectedOutput() {
PnfResource pnfResource = client.getPnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002680");
- Assert.assertNotNull(pnfResource);
+ assertNotNull(pnfResource);
assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
pnfResource.getModelInvariantUUID());
@@ -592,7 +590,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getPnfResourceByModelUUID_invalidUuid_NullOutput() {
PnfResource pnfResource = client.getPnfResourceByModelUUID(UUID.randomUUID().toString());
- Assert.assertNull(pnfResource);
+ assertNull(pnfResource);
}
@Test
@@ -616,7 +614,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
public void getPnfResourceCustomizationByModelCustomizationUUID_invalidUuid_nullOutput() {
PnfResourceCustomization pnfResourceCustomization =
client.getPnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
- Assert.assertNull(pnfResourceCustomization);
+ assertNull(pnfResourceCustomization);
}
@Test
@@ -647,6 +645,53 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
@Test
+ public void testGetServiceTopologyById() throws Exception {
+ org.onap.so.rest.catalog.beans.Service serviceByID =
+ client.getServiceModelInformation("5df8b6de-2083-11e7-93ae-92361f002671", "2");
+ assertNotNull(serviceByID);
+ assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
+ assertEquals("NA", serviceByID.getServiceType());
+ assertEquals("NA", serviceByID.getServiceRole());
+ }
+
+ @Test
+ public void testGetServices() throws Exception {
+ List<org.onap.so.rest.catalog.beans.Service> services = client.getServices();
+ assertEquals(false, services.isEmpty());
+ }
+
+ @Test
+ public void testVnf() throws Exception {
+ org.onap.so.rest.catalog.beans.Vnf vnf = client.getVnfModelInformation("5df8b6de-2083-11e7-93ae-92361f002671",
+ "68dc9a92-214c-11e7-93ae-92361f002671", "0");
+ assertNotNull(vnf);
+ assertEquals("vSAMP10a", vnf.getModelName());
+ assertEquals(false, vnf.getNfDataValid());
+ assertEquals("vSAMP", vnf.getNfFunction());
+ assertEquals("vSAMP", vnf.getNfNamingCode());
+ assertEquals("vSAMP", vnf.getNfRole());
+ assertEquals("vSAMP", vnf.getNfType());
+
+ vnf.setNfDataValid(true);
+ vnf.setNfFunction("nfFunction");
+ vnf.setNfRole("nfRole");
+ vnf.setNfType("nfType");
+ vnf.setNfNamingCode("nfNamingCode");
+
+ client.updateVnf("5df8b6de-2083-11e7-93ae-92361f002671", vnf);
+ vnf = client.getVnfModelInformation("5df8b6de-2083-11e7-93ae-92361f002671",
+ "68dc9a92-214c-11e7-93ae-92361f002671", "0");
+ assertEquals("vSAMP10a", vnf.getModelName());
+ assertEquals(true, vnf.getNfDataValid());
+ assertEquals("nfFunction", vnf.getNfFunction());
+ assertEquals("nfNamingCode", vnf.getNfNamingCode());
+ assertEquals("nfRole", vnf.getNfRole());
+ assertEquals("nfType", vnf.getNfType());
+
+
+ }
+
+ @Test
public void getWorkflowByArtifactUUID_validUuid_expectedOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID("5b0c4322-643d-4c9f-b184-4516049e99b1");
assertEquals("artifactName", "testingWorkflow.bpmn", workflow.getArtifactName());
@@ -655,7 +700,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowByArtifactUUID_invalidUuid_nullOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID(UUID.randomUUID().toString());
- Assert.assertNull(workflow);
+ assertNull(workflow);
}
@Test
@@ -670,7 +715,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowByModelUUID_invalidUuid_nullOutput() {
Workflow workflow = client.findWorkflowByArtifactUUID(UUID.randomUUID().toString());
- Assert.assertNull(workflow);
+ assertNull(workflow);
}
@Test
@@ -685,7 +730,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
@Test
public void getWorkflowBySource_invalidSource_nullOutput() {
List<Workflow> workflow = client.findWorkflowBySource("abc");
- Assert.assertNull(workflow);
+ assertNull(workflow);
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json
new file mode 100644
index 0000000000..2dc83c8963
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json
@@ -0,0 +1,53 @@
+{
+ "modelName": "modelName",
+ "description": "description",
+ "modelVersionId": "modelUUID",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelVersion": "modelVersion",
+ "serviceType": "serviceType",
+ "serviceRole": "serviceRole",
+ "environmentContext": "environmentContext",
+ "category": "category",
+ "distrobutionStatus": "distrobutionStatus",
+ "vnf": [
+ {
+ "modelName": "modelName",
+ "modelVersionId": "modelUUID",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelVersion": "modelVersion",
+ "modelCustomizationId": "modelCustomizationUUID",
+ "modelInstanceName": "modelInstanceName",
+ "minInstances": 1,
+ "maxInstances": 3,
+ "availabilityZoneMaxCount": 11,
+ "toscaNodeType": "toscaNodeType",
+ "nfFunction": "nfFunction",
+ "nfRole": "nfRole",
+ "nfType": "nfType",
+ "nfNamingCode": "nfNamingCode",
+ "multiStageDesign": "multiStageDesign",
+ "orchestrationMode": "orchestrationMode",
+ "cloudVersionMin": "cloudVersionMin",
+ "cloudVersionMax": "cloudVersionMax",
+ "category": "category",
+ "subCategory": "subCategory",
+ "vfModule": [
+ {
+ "modelVersionId": "modelUUID",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelName": "modelName",
+ "modelVersion": "modelVersion",
+ "description": "description",
+ "isBase": false,
+ "modelCustomizationId": "modelCustomizationUUID",
+ "label": "label",
+ "minInstances": 1,
+ "maxInstances": 3,
+ "initialCount": "1",
+ "availabilityZoneCount": 10,
+ "isVolumeGroup": false
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 1ba1597c73..32c51293c2 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -183,7 +183,10 @@ VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459',
'toscaNodeType',
'testVnfcCustomizationDescription',
'2018-07-17 14:05:08');
-
+
+INSERT INTO `rainy_day_handler_macro` (`FLOW_NAME`,`SERVICE_TYPE`,`VNF_TYPE`,`ERROR_CODE`,`WORK_STEP`,`POLICY`,`SECONDARY_POLICY`,`REG_EX_ERROR_MESSAGE`, `SERVICE_ROLE`)
+VALUES ('AssignServiceInstanceBB','*','*','*','*','Rollback','Rollback','The Flavor ID.*could not be found.','*');
+
INSERT INTO `cvnfc_customization`
(`id`,
`model_customization_uuid`,
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml
index 463be2e527..97a4503190 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml
@@ -1,45 +1,46 @@
<configuration>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern>
</encoder>
- </appender>
-
- <appender name="test"
- class="org.onap.so.adapters.catalogdb.catalogrest.TestAppender" />
-
- <logger name="com.att.ecomp.audit" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.metrics" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.error" level="WARN" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="test" />
- </logger>
-
- <logger name="org.flywaydb" level="DEBUG" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
-
- <logger name="ch.vorburger" level="WARN" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
-
- <root level="WARN">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="test" />
- </root>
+ </appender>
+
+ <appender name="test" class="org.onap.so.adapters.catalogdb.catalogrest.TestAppender" />
+
+ <logger name="com.att.ecomp.audit" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </logger>
+
+ <logger name="org.flywaydb" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+ <logger name="org.hibernate" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="ch.vorburger" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </root>
</configuration> \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 088f9499ce..7ffcd8308c 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -82,7 +82,7 @@
<keep>true</keep>
</configuration>
</execution>
-
+
<execution>
<id>generate-vnf-async-stubs</id>
<phase>process-classes</phase>
@@ -123,7 +123,7 @@
</configuration>
</execution>
</executions>
- </plugin>
+ </plugin>
-->
<plugin>
<groupId>org.jacoco</groupId>
@@ -147,13 +147,22 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>original</id>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build
+ itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
@@ -164,14 +173,14 @@
<pluginExecution>
<pluginExecutionFilter>
<groupId>
- org.jvnet.jax-ws-commons
- </groupId>
+ org.jvnet.jax-ws-commons
+ </groupId>
<artifactId>
- jaxws-maven-plugin
- </artifactId>
+ jaxws-maven-plugin
+ </artifactId>
<versionRange>
- [2.3,)
- </versionRange>
+ [2.3,)
+ </versionRange>
<goals>
<goal>wsgen</goal>
</goals>
@@ -219,11 +228,6 @@
<version>${cxf.version}</version>
</dependency>
<dependency>
- <groupId>org.webjars</groupId>
- <artifactId>swagger-ui</artifactId>
- <version>3.5.0</version>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
@@ -250,7 +254,7 @@
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
+ <version>3.2.2</version>
</dependency>
<dependency>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java
deleted file mode 100644
index f3a2cfea9b..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.onap.so.adapters.audit;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-public class AAIObjectAuditList implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 6712662349909726930L;
- private List<AAIObjectAudit> auditList = new ArrayList<>();
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("auditList", auditList).toString();
- }
-
- public List<AAIObjectAudit> getAuditList() {
- return auditList;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
index 52f5478f2f..8edce124ec 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
@@ -1,8 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
package org.onap.so.adapters.audit;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -20,6 +43,8 @@ public abstract class AbstractAuditService {
protected static final String UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI =
"Unable to find all VServers and L-Interaces in A&AI";
+ protected static final String UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK = "Unable to find VServers in Openstack";
+
@Autowired
public Environment env;
@@ -45,12 +70,12 @@ public abstract class AbstractAuditService {
* @param auditList
* @return
*/
- protected boolean didDeleteAuditFail(Optional<AAIObjectAuditList> auditList) {
- if (auditList.get().getAuditList() != null && !auditList.get().getAuditList().isEmpty()) {
+ protected boolean didDeleteAuditFail(AAIObjectAuditList auditList) {
+ if (auditList.getAuditList() != null && !auditList.getAuditList().isEmpty()) {
if (logger.isInfoEnabled()) {
- logger.info("Audit Results: {}", auditList.get().toString());
+ logger.info("Audit Results: {}", auditList.toString());
}
- return auditList.get().getAuditList().stream().filter(AAIObjectAudit::isDoesObjectExist).findFirst()
+ return auditList.getAuditList().stream().filter(AAIObjectAudit::isDoesObjectExist).findFirst()
.map(v -> true).orElse(false);
} else {
return false;
@@ -62,9 +87,12 @@ public abstract class AbstractAuditService {
}
protected void setupMDC(ExternalTask externalTask) {
+ logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
String msoRequestId = externalTask.getVariable("mso-request-id");
- if (msoRequestId != null && !msoRequestId.isEmpty())
+ if (msoRequestId != null && !msoRequestId.isEmpty()) {
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+ }
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
}
protected long calculateRetryDelay(int currentRetries) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
index 947c6ddfeb..1e5b6de857 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,8 +27,10 @@ import java.util.Map;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,9 +49,9 @@ public class AuditCreateStackService extends AbstractAuditService {
public Environment environment;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
- setupMDC(externalTask);
boolean success = false;
try {
logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,
@@ -57,6 +59,8 @@ public class AuditCreateStackService extends AbstractAuditService {
Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(),
auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
if (auditListOpt.isPresent()) {
+ auditListOpt.get().setAuditType("create");
+ auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName());
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
success = !didCreateAuditFail(auditListOpt);
@@ -68,6 +72,7 @@ public class AuditCreateStackService extends AbstractAuditService {
if (success) {
externalTaskService.complete(externalTask, variables);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
if (externalTask.getRetries() == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
@@ -77,6 +82,7 @@ public class AuditCreateStackService extends AbstractAuditService {
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
externalTaskService.complete(externalTask, variables);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java
new file mode 100644
index 0000000000..1c707fe795
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDataService.java
@@ -0,0 +1,77 @@
+package org.onap.so.adapters.audit;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+@Component
+public class AuditDataService {
+
+ @Autowired
+ private RequestsDbClient requestsDbClient;
+
+ /**
+ * Checks to see if an entry already exist for the given heat stack and writes audit stack data to the request
+ * database if it doesn't.
+ *
+ * @throws JsonProcessingException
+ */
+ public void writeStackDataToRequestDb(AuditInventory auditInventory, AAIObjectAuditList auditList)
+ throws JsonProcessingException {
+ List<RequestProcessingData> requestProcessingDataList =
+ requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
+ auditInventory.getHeatStackName(), "AuditStackData");
+ if (requestProcessingDataList.isEmpty()) {
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ String auditListString = objectMapper.getMapper().writeValueAsString(auditList);;
+
+ RequestProcessingData requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
+ requestProcessingData.setGroupingId(auditInventory.getVfModuleId());
+ requestProcessingData.setName(auditInventory.getHeatStackName());
+ requestProcessingData.setTag("AuditStackData");
+ requestProcessingData.setValue(auditListString);
+
+ requestsDbClient.saveRequestProcessingData(requestProcessingData);
+ }
+ }
+
+ /**
+ * Retrieves audit stack data from the request database.
+ *
+ * @throws IOException
+ * @throws JsonMappingException
+ * @throws JsonParseException
+ */
+ public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory)
+ throws JsonParseException, JsonMappingException, IOException {
+
+ List<RequestProcessingData> requestProcessingDataList =
+ requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
+ auditInventory.getHeatStackName(), "AuditStackData");
+ if (!requestProcessingDataList.isEmpty()) {
+ RequestProcessingData requestProcessingData = requestProcessingDataList.get(0);
+ String auditListString = requestProcessingData.getValue();
+
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ AAIObjectAuditList auditList =
+ objectMapper.getMapper().readValue(auditListString, AAIObjectAuditList.class);
+
+ return Optional.of(auditList);
+ } else {
+ return Optional.empty();
+ }
+ }
+
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
index 048e6dbba2..0aa4f9bdc3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,8 +25,10 @@ import java.util.Map;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,26 +41,38 @@ public class AuditDeleteStackService extends AbstractAuditService {
private static final Logger logger = LoggerFactory.getLogger(AuditDeleteStackService.class);
@Autowired
- public HeatStackAudit heatStackAudit;
+ protected HeatStackAudit heatStackAudit;
@Autowired
- public Environment environment;
+ protected AuditVServer auditVservers;
+
+ @Autowired
+ protected AuditDataService auditDataService;
+
+ @Autowired
+ protected Environment env;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
- setupMDC(externalTask);
boolean success = false;
try {
- logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,
- externalTask.getRetries());
- Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(),
- auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
+ logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", externalTask.getRetries());
+ Optional<AAIObjectAuditList> auditListOpt = auditDataService.getStackDataFromRequestDb(auditInventory);
if (auditListOpt.isPresent()) {
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
- success = didDeleteAuditFail(auditListOpt);
+ auditVservers.auditVservers(auditListOpt.get());
+ } else {
+ logger.debug("Auditing Vservers based on vf module relationships");
+ auditListOpt = auditVservers.auditVserversThroughRelationships(auditInventory.getGenericVnfId(),
+ auditInventory.getHeatStackName());
}
+ auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName());
+ auditListOpt.get().setAuditType("delete");
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
+ success = !didDeleteAuditFail(auditListOpt.get());
+
} catch (Exception e) {
logger.error("Error during audit of stack", e);
}
@@ -66,6 +80,7 @@ public class AuditDeleteStackService extends AbstractAuditService {
if (success) {
externalTaskService.complete(externalTask, variables);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
if (externalTask.getRetries() == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
@@ -74,7 +89,8 @@ public class AuditDeleteStackService extends AbstractAuditService {
UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000);
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
- externalTaskService.complete(externalTask);
+ externalTaskService.complete(externalTask, variables);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
new file mode 100644
index 0000000000..2ef7d5b325
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
@@ -0,0 +1,71 @@
+package org.onap.so.adapters.audit;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuditQueryStackService extends AbstractAuditService {
+
+ private static final Logger logger = LoggerFactory.getLogger(AuditQueryStackService.class);
+
+ @Autowired
+ protected HeatStackAudit heatStackAudit;
+
+ @Autowired
+ protected AuditDataService auditDataService;
+
+ protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ setupMDC(externalTask);
+ AuditInventory auditInventory = externalTask.getVariable("auditInventory");
+ boolean success = false;
+ Map<String, Object> variables = new HashMap<>();
+ try {
+ logger.info("Executing External Task Query Audit Inventory. Audit Inventory: {} \n Retry Number: {}",
+ auditInventory.toString(), externalTask.getRetries());
+
+ Optional<AAIObjectAuditList> auditList = heatStackAudit.queryHeatStack(auditInventory.getCloudOwner(),
+ auditInventory.getCloudRegion(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
+
+ if (auditList.isPresent()) {
+ success = true;
+ auditDataService.writeStackDataToRequestDb(auditInventory, auditList.get());
+ }
+ if (success) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task {} was Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ } else {
+ if (externalTask.getRetries() == null) {
+ logger.debug("The External Task {} Failed. Setting Retries to Default Start Value: {}",
+ externalTask.getId(), getRetrySequence().length);
+ externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
+ UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, getRetrySequence().length, 10000);
+ } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
+ logger.debug("The External Task {} Failed. All Retries Exhausted", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ } else {
+ logger.debug("The External Task {} Failed. Decrementing Retries to {} , Retry Delay: ",
+ externalTask.getId(), externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
+ UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ }
+ logger.debug("The External Task {} Failed", externalTask.getId());
+ }
+ } catch (Exception e) {
+ logger.error("Error during audit query of stack", e);
+ }
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
index 3508810e04..6a42456715 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
@@ -40,6 +40,10 @@ public class AuditStackService {
private static final Logger logger = LoggerFactory.getLogger(AuditStackService.class);
+ private static final String DEFAULT_AUDIT_LOCK_TIME = "60000";
+
+ private static final String DEFAULT_MAX_CLIENTS_FOR_TOPIC = "10";
+
@Autowired
public Environment env;
@@ -49,37 +53,59 @@ public class AuditStackService {
@Autowired
private AuditDeleteStackService auditDeleteStack;
+ @Autowired
+ private AuditQueryStackService auditQueryStack;
+
@PostConstruct
public void auditAddAAIInventory() {
- String auth = "";
- try {
- auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
- } catch (IllegalStateException | GeneralSecurityException e) {
- logger.error("Error Decrypting Password", e);
+ for (int i = 0; i < getMaxClients(); i++) {
+ ExternalTaskClient client = createExternalTaskClient();
+ client.subscribe("InventoryAddAudit")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
+ .handler(auditCreateStack::executeExternalTask).open();
}
- ClientRequestInterceptor interceptor =
- new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- client.subscribe("InventoryAddAudit").lockDuration(60000).handler(auditCreateStack::executeExternalTask).open();
}
@PostConstruct
public void auditDeleteAAIInventory() {
+ for (int i = 0; i < getMaxClients(); i++) {
+ ExternalTaskClient client = createExternalTaskClient();
+ client.subscribe("InventoryDeleteAudit")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
+ .handler(auditDeleteStack::executeExternalTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void auditQueryInventory() {
+ for (int i = 0; i < getMaxClients(); i++) {
+ ExternalTaskClient client = createExternalTaskClient();
+ client.subscribe("InventoryQueryAudit")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
+ .handler(auditQueryStack::executeExternalTask).open();
+ }
+ }
+
+ protected ExternalTaskClient createExternalTaskClient() {
+ ClientRequestInterceptor interceptor = createClientRequestInterceptor();
+ return ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1)
+ .addInterceptor(interceptor).asyncResponseTimeout(120000)
+ .backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
+ }
+
+ protected ClientRequestInterceptor createClientRequestInterceptor() {
String auth = "";
try {
auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
} catch (IllegalStateException | GeneralSecurityException e) {
logger.error("Error Decrypting Password", e);
}
- ClientRequestInterceptor interceptor =
- new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- client.subscribe("InventoryDeleteAudit").lockDuration(60000).handler(auditDeleteStack::executeExternalTask)
- .open();
+ return new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
}
+ protected int getMaxClients() {
+ return Integer.parseInt(env.getProperty("workflow.topics.maxClients", DEFAULT_MAX_CLIENTS_FOR_TOPIC));
+ }
+
+
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
index 5ca045d988..14d83b3b06 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
@@ -20,14 +20,18 @@
package org.onap.so.adapters.audit;
+import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.Vserver;
+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.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@@ -38,6 +42,38 @@ import com.fasterxml.jackson.core.JsonProcessingException;
public class AuditVServer extends AbstractAudit {
private static final Logger logger = LoggerFactory.getLogger(AuditVServer.class);
+ public void auditVservers(AAIObjectAuditList aaiObjectAuditList) {
+
+ aaiObjectAuditList.getAuditList().forEach(aaiObjectAudit -> {
+ boolean vserverExist = getAaiClient().exists(AAIUriFactory
+ .createResourceFromExistingURI(AAIObjectType.VSERVER, aaiObjectAudit.getResourceURI()));
+ aaiObjectAudit.setDoesObjectExist(vserverExist);
+ });
+ }
+
+ public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) {
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
+ .queryParam("vf-module-name", vfModuleName);
+ if (getAaiClient().get(uri).getRelationships().isPresent()) {
+ List<AAIResourceUri> relatedVservers =
+ getAaiClient().get(uri).getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
+ if (!relatedVservers.isEmpty()) {
+ relatedVservers.forEach(vserverUri -> {
+ Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class);
+ Vserver vServerShallow = new Vserver();
+ BeanUtils.copyProperties(vserver, vServerShallow);
+ AAIObjectAudit vServerAudit = new AAIObjectAudit();
+ vServerAudit.setAaiObject(vServerShallow);
+ vServerAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+ vServerAudit.setDoesObjectExist(true);
+ auditList.getAuditList().add(vServerAudit);
+ });
+ }
+ }
+ return Optional.of(auditList);
+ }
+
public Optional<AAIObjectAuditList> auditVservers(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner,
String cloudRegion) {
if (vServersToAudit == null || vServersToAudit.isEmpty()) {
@@ -48,8 +84,9 @@ public class AuditVServer extends AbstractAudit {
try {
logger.debug("Vserver to Audit: {}", objectMapper.getMapper().writeValueAsString(vserver));
} catch (JsonProcessingException e) {
-
+ logger.error("Json parse exception: {}", e.getMessage());
}
+
});
AAIObjectAuditList auditList = new AAIObjectAuditList();
vServersToAudit.stream().forEach(vServer -> auditList.getAuditList()
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 627f6a276c..ffa76cf8ee 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
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,10 +37,15 @@ import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vlan;
import org.onap.aai.domain.yang.Vlans;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.woorea.openstack.heat.model.Link;
@@ -54,7 +61,7 @@ public class HeatStackAudit {
protected static final Logger logger = LoggerFactory.getLogger(HeatStackAudit.class);
- private static final String exceptionMsg = "Error finding Path from Self Link";
+ private static final String EXCEPTION_MSG = "Error finding Path from Self Link";
@Autowired
protected MsoHeatUtils heat;
@@ -65,6 +72,28 @@ public class HeatStackAudit {
@Autowired
protected AuditVServer auditVservers;
+ public Optional<AAIObjectAuditList> queryHeatStack(String cloudOwner, String cloudRegion, String tenantId,
+ String heatStackName) {
+ try {
+ logger.debug("Fetching Top Level Stack Information");
+ Resources resources = heat.queryStackResources(cloudRegion, tenantId, heatStackName, 3);
+ List<Resource> novaResources = resources.getList().stream()
+ .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList());
+ if (novaResources.isEmpty())
+ return Optional.of(new AAIObjectAuditList());
+ else {
+ Set<Vserver> vserversToAudit = createVserverSet(novaResources);
+ AAIObjectAuditList aaiObjectAuditList = new AAIObjectAuditList();
+ vserversToAudit.stream().forEach(vServer -> aaiObjectAuditList.getAuditList()
+ .add(createAAIObjectAudit(cloudOwner, cloudRegion, tenantId, vServer)));
+ return Optional.of(aaiObjectAuditList);
+ }
+ } catch (Exception e) {
+ logger.error("Error during query stack resources", e);
+ return Optional.of(new AAIObjectAuditList());
+ }
+ }
+
public Optional<AAIObjectAuditList> auditHeatStack(String cloudRegion, String cloudOwner, String tenantId,
String heatStackName) {
try {
@@ -112,10 +141,10 @@ public class HeatStackAudit {
processNestedResourceGroup(cloudRegion, tenantId, vServersWithLInterface,
nestedResourceGroupResources);
} else
- throw new Exception(exceptionMsg);
+ throw new Exception(EXCEPTION_MSG);
} catch (Exception e) {
logger.error("Error Parsing Link to obtain Path", e);
- throw new Exception(exceptionMsg);
+ throw new Exception(EXCEPTION_MSG);
}
}
}
@@ -145,7 +174,7 @@ public class HeatStackAudit {
addSubInterfaceToVserver(vServersWithLInterface, subinterfaceStack, subinterfaceResources);
}
} else
- throw new Exception(exceptionMsg);
+ throw new Exception(EXCEPTION_MSG);
}
@@ -214,6 +243,31 @@ public class HeatStackAudit {
return vserversToAudit;
}
+ protected Set<Vserver> createVserverSet(List<Resource> novaResources) {
+ Set<Vserver> vserversToAudit = new HashSet<>();
+ for (Resource novaResource : novaResources) {
+ Vserver auditVserver = new Vserver();
+ auditVserver.setLInterfaces(new LInterfaces());
+ auditVserver.setVserverId(novaResource.getPhysicalResourceId());
+ vserversToAudit.add(auditVserver);
+ }
+ return vserversToAudit;
+ }
+
+ protected AAIObjectAudit createAAIObjectAudit(String cloudOwner, String cloudRegion, String tenantId,
+ Vserver vServer) {
+ AAIObjectAudit aaiObjectAudit = new AAIObjectAudit();
+ Vserver vServerShallow = new Vserver();
+ BeanUtils.copyProperties(vServer, vServerShallow);
+ aaiObjectAudit.setAaiObject(vServerShallow);
+ aaiObjectAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+ aaiObjectAudit.setResourceURI(AAIUriFactory
+ .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, vServer.getVserverId())
+ .build());
+
+ return aaiObjectAudit;
+ }
+
/**
* @param novaResource Single openstack resource that is of type Nova
* @param neutronPorts List of Neutron ports created within the stack
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
index 4453071e06..69e16986da 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
@@ -22,12 +22,11 @@ package org.onap.so.adapters.inventory.create;
import java.util.Optional;
import java.util.stream.Stream;
-import org.onap.aai.domain.yang.LInterface;
-import org.onap.so.adapters.audit.AAIObjectAudit;
-import org.onap.so.adapters.audit.AAIObjectAuditList;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.stereotype.Component;
@Component
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
index 8bd813026f..49a9e7e171 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
@@ -59,7 +59,9 @@ public class CreateInventoryService {
ExternalTaskClient client = ExternalTaskClient.create()
.baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
.asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- client.subscribe("InventoryCreate").lockDuration(60000).handler(createInventory::executeExternalTask).open();
+ client.subscribe("InventoryCreate")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .handler(createInventory::executeExternalTask).open();
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
index 4958bbc7f2..a6c61704ad 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ *
+ * Copyright (C) 2019 IBM
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,8 +25,8 @@ package org.onap.so.adapters.inventory.create;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.audit.AAIObjectAuditList;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -39,6 +41,8 @@ public class CreateInventoryTask {
private static final Logger logger = LoggerFactory.getLogger(CreateInventoryTask.class);
+ private static final String AAI_INVENTORY_FAILURE = "AAIInventoryFailure";
+
@Autowired
CreateAAIInventory createInventory;
@@ -73,9 +77,10 @@ public class CreateInventoryTask {
if (success) {
externalTaskService.complete(externalTask);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else if (inventoryException) {
logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId());
- externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure");
+ externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
} else {
if (externalTask.getRetries() == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
@@ -84,7 +89,8 @@ public class CreateInventoryTask {
UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000);
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
- externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure");
+ externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
@@ -97,13 +103,15 @@ public class CreateInventoryTask {
}
} else {
logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTask.getId());
- externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure");
+ externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
}
}
private void setupMDC(ExternalTask externalTask) {
try {
- String msoRequestId = (String) externalTask.getVariable("mso-request-id");
+ logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
+ String msoRequestId = externalTask.getVariable("mso-request-id");
if (msoRequestId != null && !msoRequestId.isEmpty())
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
} catch (Exception e) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
index 24fa9af7f9..ed31c1c67e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.inventory.create;
public class InventoryException extends Exception {
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 0c55bd6945..25667efc71 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
@@ -66,7 +66,7 @@ public class ContrailSubnet {
private List<ContrailSubnetPool> allocationPools = new ArrayList<>();
@JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes")
- private final ContrailSubnetHostRoutes host_routes = new ContrailSubnetHostRoutes();
+ private final ContrailSubnetHostRoutes hostRoutes = new ContrailSubnetHostRoutes();
public ContrailSubnet() {
super();
@@ -173,7 +173,7 @@ public class ContrailSubnet {
}
}
if (inputSubnet.getHostRoutes() != null) {
- List<ContrailSubnetHostRoute> hrList = host_routes.getHost_routes();
+ List<ContrailSubnetHostRoute> hrList = hostRoutes.getHostRoutes();
for (HostRoute hr : inputSubnet.getHostRoutes()) {
if (!msoCommonUtils.isNullOrEmpty(hr.getPrefix())
|| !msoCommonUtils.isNullOrEmpty(hr.getNextHop())) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java
index b1908d9541..0802194b4a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java
@@ -33,12 +33,12 @@ public class ContrailSubnetHostRoutes {
public ContrailSubnetHostRoutes() {}
- public List<ContrailSubnetHostRoute> getHost_routes() {
+ public List<ContrailSubnetHostRoute> getHostRoutes() {
return hostRoutes;
}
- public void setHost_routes(List<ContrailSubnetHostRoute> host_routes) {
- this.hostRoutes = host_routes;
+ public void setHostRoutes(List<ContrailSubnetHostRoute> hostRoutes) {
+ this.hostRoutes = hostRoutes;
}
@Override
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 4753b1c18d..e95e9a3a83 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -11,9 +11,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,6 +47,7 @@ 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.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.NetworkStatus;
@@ -71,6 +72,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
private static final String NETWORK_EXCEPTION_MSG = "Got a NetworkException on createNetwork: ";
private static final String CREATE_NETWORK_ERROR_LOGMSG = "{} {} Error sending createNetwork notification {} ";
private static final String FAULT_INFO_ERROR_LOGMSG = "{} {} Exception - fault info ";
+ private static final String SHARED = "shared";
+ private static final String EXTERNAL = "external";
@Autowired
private Environment environment;
@@ -127,13 +130,13 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
HashMap<String, String> params = (HashMap<String, String>) networkParams;
if (params == null)
- params = new HashMap<String, String>();
+ params = new HashMap<>();
String shared = null;
String external = null;
- if (params.containsKey("shared"))
- shared = params.get("shared");
- if (params.containsKey("external"))
- external = params.get("external");
+ if (params.containsKey(SHARED))
+ shared = params.get(SHARED);
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
try {
networkAdapter.createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName,
@@ -211,13 +214,13 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
HashMap<String, String> params = (HashMap<String, String>) networkParams;
if (params == null)
- params = new HashMap<String, String>();
+ params = new HashMap<>();
String shared = null;
String external = null;
- if (params.containsKey("shared"))
- shared = params.get("shared");
- if (params.containsKey("external"))
- external = params.get("external");
+ if (params.containsKey(SHARED))
+ shared = params.get(SHARED);
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
try {
networkAdapter.updateNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId,
@@ -268,7 +271,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoRequest msoRequest, String notificationUrl) {
logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
- String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} ";
+ String errorCreateNetworkMessage = CREATE_NETWORK_ERROR_LOGMSG;
// Use the synchronous method to perform the actual Create
@@ -367,8 +370,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
notifyPort.deleteNetworkNotification(messageId, false, exCat, eMsg, null);
} catch (Exception e1) {
- logger.error("{} {} Error sending createNetwork notification {} ",
- MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1);
+ logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
@@ -402,7 +405,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
return;
}
- logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId());
+ logger.info(LoggingAnchor.TWO, MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId());
// Use the synchronous method to perform the actual Create
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 a79a6191cf..afc227faf0 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
@@ -33,6 +33,7 @@ import java.util.Map;
import java.util.Optional;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.network.beans.ContrailPolicyRef;
import org.onap.so.adapters.network.beans.ContrailPolicyRefSeq;
import org.onap.so.adapters.network.beans.ContrailSubnet;
@@ -88,8 +89,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NETWORK_ID = "network_id";
private static final String NETWORK_FQDN = "network_fqdn";
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 String CLOUD_OWNER = "CloudOwner";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@@ -115,6 +116,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
@Autowired
private NetworkResourceRepository networkResourceRepo;
+ public MsoNetworkAdapterImpl() {}
+
/**
* Health Check web method. Does nothing but return to show the adapter is deployed.
*/
@@ -128,7 +131,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
*
* @see MsoNetworkAdapterImpl#MsoNetworkAdapterImpl(MsoPropertiesFactory)
*/
- public MsoNetworkAdapterImpl() {}
@Override
public void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
@@ -205,7 +207,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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -240,8 +242,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (failIfExists != null && failIfExists) {
String error = String.format("Create Nework: Network %s already exists in %s/%s with ID %s",
networkName, cloudSiteId, tenantId, netInfo.getId());
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST,
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing network.
@@ -285,7 +287,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
HeatTemplate heatTemplate = networkResource.getHeatTemplate();
if (heatTemplate == null) {
String error = String.format("Network error - undefined Heat Template. Network Type = %s", networkType);
- logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(),
+ error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -308,7 +311,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryNetworkStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
logger.error("{} {} Create Network (heat): query network {} in {}/{}: ",
@@ -322,20 +325,21 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (failIfExists != null && failIfExists) {
String error = String.format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName,
cloudSiteId, tenantId, heatStack.getCanonicalName());
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST,
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing stack.
networkId.value = heatStack.getCanonicalName();
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- rollback.value = networkRollback; // Default rollback - no updates performed
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
- }
- Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();
- if (outputs != null) {
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ rollback.value = networkRollback; // Default rollback - no updates performed
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ }
+ Map<String, Object> outputs = heatStack.getOutputs();
+
for (Map.Entry<String, Object> entry : outputs.entrySet()) {
String key = entry.getKey();
if (key != null && key.startsWith("subnet")) {
@@ -371,7 +375,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams = heat.validateStackParams(stackParams, heatTemplate);
} catch (IllegalArgumentException e) {
String error = "Create Network: Configuration Error: " + e.getMessage();
- logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e);
// Input parameters were not valid
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -421,7 +425,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
if (backout == null)
backout = true;
- heatStack = heat.createStack(cloudSiteId, "CloudOwner", tenantId, networkName, null, template,
+ heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template,
stackParams, true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue());
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
@@ -435,9 +439,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// For Heat-based orchestration, the MSO-tracked network ID is the heat stack,
// and the neutronNetworkId is the network UUID returned in stack outputs.
networkId.value = heatStack.getCanonicalName();
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ }
}
Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();
@@ -456,13 +462,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
}
+ networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
}
subnetIdMap.value = sMap;
rollback.value = networkRollback;
// Populate remaining rollback info and response parameters.
networkRollback.setNetworkStackId(heatStack.getCanonicalName());
- networkRollback.setNeutronNetworkId((String) heatStack.getOutputs().get(NETWORK_ID));
networkRollback.setNetworkCreated(true);
networkRollback.setNetworkType(networkType);
@@ -537,7 +543,7 @@ 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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -569,8 +575,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (netInfo == null) {
String error = String.format("Update Nework: Network %s does not exist in %s/%s", networkId,
cloudSiteId, tenantId);
- logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.BusinessProcesssError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_NOT_FOUND,
+ ErrorCode.BusinessProcesssError.getValue(), error);
// Does not exist. Throw an exception (can't update a non-existent network)
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -602,7 +608,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -613,7 +619,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_NOT_FOUND, ErrorCode.DataError.getValue(),
+ error);
// Network stack does not exist. Return an error
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -644,7 +651,8 @@ 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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(),
+ error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -672,7 +680,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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e);
}
@@ -720,7 +728,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Ignore MsoStackNotFound exception because we already checked.
long updateStackStarttime = System.currentTimeMillis();
try {
- heatStack = heatWithUpdate.updateStack(cloudSiteId, "CloudOwner", tenantId, networkId, template,
+ heatStack = heatWithUpdate.updateStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId, template,
stackParams, true, heatTemplate.getTimeoutMinutes());
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
@@ -802,7 +810,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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_UNKOWN_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -814,8 +822,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// All Networks are orchestrated via HEAT or Neutron
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, ErrorCode.DataError.getValue(),
- error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
+ ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
@@ -834,9 +842,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} else {
String error = String.format(
"Network Type:%s Version_Min:%s Version_Max:%s not supported on Cloud:%s with AIC_Version:%s",
- networkType, networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(),
- cloudSiteId, cloudSite.getCloudVersion());
- logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
+ networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(), cloudSiteId,
+ cloudSite.getCloudVersion());
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -845,7 +853,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
validateNetworkParams(neutronNetworkType, networkName, physicalNetworkName, vlans, routeTargets);
if (!missing.isEmpty()) {
String error = "Create Network: Missing parameters: " + missing;
- logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -890,7 +898,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
|| commonUtils.isNullOrEmpty(networkNameOrId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -899,7 +907,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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -907,12 +915,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Use MsoNeutronUtils for all NEUTRON commands
String mode;
- String neutronId;
+ String neutronId = null;
// Try Heat first, since networks may be named the same as the Heat stack
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkNameOrId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkNameOrId);
} catch (MsoException me) {
me.addContext("QueryNetwork");
logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
@@ -923,12 +931,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Populate the outputs based on the returned Stack information
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
// Found it. Get the neutronNetworkId for further query
+ Map<String, String> sMap = new HashMap<>();
Map<String, Object> outputs = heatStack.getOutputs();
- neutronId = (String) outputs.get(NETWORK_ID);
mode = "HEAT";
-
- Map<String, String> sMap = new HashMap<>();
if (outputs != null) {
+ neutronId = (String) outputs.get(NETWORK_ID);
+
for (String key : outputs.keySet()) {
if (key != null && key.startsWith("subnet_id_")) // multiples subnet_%aaid% outputs
{
@@ -958,7 +966,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (netInfo != null) {
// Found. Populate the output elements
networkExists.value = Boolean.TRUE;
- if ("HEAT".equals(mode)) {
+ if ("HEAT".equals(mode) && heatStack != null) {
networkId.value = heatStack.getCanonicalName();
} else {
networkId.value = netInfo.getId();
@@ -1017,7 +1025,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -1065,9 +1073,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// was deleted.
// So query first to report back if stack WAS deleted or just NOTOFUND
StackInfo heatStack = null;
- heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkId);
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId);
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
networkDeleted.value = true;
} else {
networkDeleted.value = false;
@@ -1150,7 +1158,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
// The deleteStack function in MsoHeatUtils returns success if the stack
// was not found. So don't bother to query first.
- heat.deleteStack(tenantId, "CloudOwner", cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
} catch (MsoException me) {
me.addContext("RollbackNetwork");
logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
@@ -1290,15 +1298,23 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Resource Property
List<ContrailPolicyRef> prlist = new ArrayList<>();
int index = 1;
- for (String pf : pFqdns) {
- if (!commonUtils.isNullOrEmpty(pf)) {
- ContrailPolicyRef pr = new ContrailPolicyRef();
- ContrailPolicyRefSeq refSeq = new ContrailPolicyRefSeq(String.valueOf(index), "0");
- pr.setSeq(refSeq);
- index++;
- logger.debug("Contrail PolicyRefs Data:{}", pr);
- prlist.add(pr);
+
+ if (pFqdns != null) {
+ for (String pf : pFqdns) {
+ if (!commonUtils.isNullOrEmpty(pf)) {
+ ContrailPolicyRef pr = new ContrailPolicyRef();
+ ContrailPolicyRefSeq refSeq = new ContrailPolicyRefSeq(String.valueOf(index), "0");
+ pr.setSeq(refSeq);
+ index++;
+ logger.debug("Contrail PolicyRefs Data:{}", pr);
+ prlist.add(pr);
+ }
}
+ } else {
+ String error = "Null pFqdns at start of mergePolicyRefs";
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(),
+ error);
+ throw new MsoAdapterException(error);
}
JsonNode node = null;
@@ -1309,8 +1325,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Json PolicyRefs Data:{}", jsonString);
} catch (Exception e) {
String error = "Error creating JsonNode for policyRefs Data";
- logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(), error,
- e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(),
+ error, e);
throw new MsoAdapterException(error);
}
// update parameters
@@ -1386,7 +1402,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Json Subnet List:{}", jsonString);
} catch (Exception e) {
String error = "Error creating JsonNode from input subnets";
- logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.DataError.getValue(), error, e);
throw new MsoAdapterException(error);
}
// update parameters
@@ -1432,7 +1448,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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException(error);
}
@@ -1446,7 +1462,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, ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_MISSING_PARAM, ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException(error);
}
@@ -1461,13 +1477,19 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
if (subnet.getAllocationPools() != null) {
- curR = curR + " allocation_pools:\n";
+ StringBuilder tempBuf = new StringBuilder();
+ tempBuf.append(curR);
+ tempBuf.append(" allocation_pools:\n");
for (Pool pool : subnet.getAllocationPools()) {
if (!commonUtils.isNullOrEmpty(pool.getStart()) && !commonUtils.isNullOrEmpty(pool.getEnd())) {
- curR = curR + " - start: " + pool.getStart() + "\n";
- curR = curR + " end: " + pool.getEnd() + "\n";
+ tempBuf.append(" - start: ");
+ tempBuf.append(pool.getStart());
+ tempBuf.append("\n end: ");
+ tempBuf.append(pool.getEnd());
+ tempBuf.append("\n");
}
}
+ curR = tempBuf.toString();
}
resourcesBuf.append(curR);
@@ -1476,7 +1498,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curO = curO.replace("%subnetId%", subnet.getSubnetId());
outputsBuf.append(curO);
-
}
// append resources and outputs in heatTemplate
logger.debug("Tempate initial:{}", heatTemplate);
@@ -1500,23 +1521,28 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.debug("Subnet_Ipam Output JSON String:{} {}", obj.getClass(), jStr);
JsonNode rootNode = mapper.readTree(jStr);
- for (JsonNode sNode : rootNode.path("ipam_subnets")) {
- logger.debug("Output Subnet Node {}", sNode.toString());
- String name = sNode.path("subnet_name").textValue();
- String uuid = sNode.path("subnet_uuid").textValue();
- String aaiId = name; // default
- // try to find aaiId for name in input subnetList
- if (subnets != null) {
- for (Subnet subnet : subnets) {
- if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) {
- if (subnet.getSubnetName().equals(name)) {
- aaiId = subnet.getSubnetId();
- break;
+ if (rootNode != null) {
+ for (JsonNode sNode : rootNode.path("ipam_subnets")) {
+ logger.debug("Output Subnet Node {}", sNode.toString());
+ String name = sNode.path("subnet_name").textValue();
+ String uuid = sNode.path("subnet_uuid").textValue();
+ String aaiId = name; // default
+ // try to find aaiId for name in input subnetList
+ if (subnets != null) {
+ for (Subnet subnet : subnets) {
+ if (subnet != null && !commonUtils.isNullOrEmpty(subnet.getSubnetName())) {
+ if (subnet.getSubnetName().equals(name)) {
+ aaiId = subnet.getSubnetId();
+ break;
+ }
}
}
}
+ sMap.put(aaiId, uuid); // bpmn needs aaid to uuid map
}
- sMap.put(aaiId, uuid); // bpmn needs aaid to uuid map
+ } else {
+ logger.error("{} {} null rootNode - cannot get subnet-uuids", MessageEnum.RA_MARSHING_ERROR,
+ ErrorCode.DataError.getValue());
}
} catch (Exception e) {
logger.error("{} {} Exception getting subnet-uuids ", MessageEnum.RA_MARSHING_ERROR,
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 b44704d1cf..4eb5d5637f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -24,11 +24,6 @@
package org.onap.so.adapters.network;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -47,6 +42,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.adapters.nwrest.ContrailNetwork;
import org.onap.so.adapters.nwrest.CreateNetworkError;
@@ -74,9 +70,15 @@ import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
@Path("/v1/networks")
@Api(value = "/v1/networks", description = "root of network adapters restful web service")
@@ -86,7 +88,9 @@ public class NetworkAdapterRest {
private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRest.class);
private static final String TESTING_KEYWORD = "___TESTING___";
- private String EXCEPTION = "Exception:";
+ private String exceptionMsg = "Exception:";
+ private static final String SHARED = "shared";
+ private static final String EXTERNAL = "external";
@Autowired
private MsoNetworkAdapterImpl adapter;
@@ -159,6 +163,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("CreateNetworkTask start");
try {
// Synchronous Web Service Outputs
@@ -170,7 +179,7 @@ public class NetworkAdapterRest {
HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams();
if (params == null) {
- params = new HashMap<String, String>();
+ params = new HashMap<>();
}
String shared = null;
String external = null;
@@ -192,15 +201,15 @@ public class NetworkAdapterRest {
ctn = new ContrailNetwork();
req.setContrailNetwork(ctn);
}
- if (params.containsKey("shared")) {
- shared = params.get("shared");
+ if (params.containsKey(SHARED)) {
+ shared = params.get(SHARED);
} else {
if (ctn.getShared() != null) {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -218,10 +227,10 @@ public class NetworkAdapterRest {
pvn = new ProviderVlanNetwork();
req.setProviderVlanNetwork(pvn);
}
- if (params.containsKey("shared"))
- shared = params.get("shared");
- if (params.containsKey("external"))
- external = params.get("external");
+ if (params.containsKey(SHARED))
+ shared = params.get(SHARED);
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkName(),
req.getProviderVlanNetwork().getPhysicalNetworkName(),
@@ -233,7 +242,7 @@ public class NetworkAdapterRest {
rollback.value.getNetworkStackId(), networkFqdn.value, rollback.value.getNetworkCreated(),
subnetIdMap.value, rollback.value, req.getMessageId());
} catch (NetworkException e) {
- logger.debug(EXCEPTION, e);
+ logger.debug(exceptionMsg, e);
eresp = new CreateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -316,6 +325,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteNetworkTask start");
try {
Holder<Boolean> networkDeleted = new Holder<>();
@@ -328,7 +342,7 @@ public class NetworkAdapterRest {
}
response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId());
} catch (NetworkException e) {
- logger.debug(EXCEPTION, e);
+ logger.debug(exceptionMsg, e);
eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -461,13 +475,18 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getNetworkRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("RollbackNetworkTask start");
try {
NetworkRollback nwr = req.getNetworkRollback();
adapter.rollbackNetwork(nwr);
response = new RollbackNetworkResponse(true, req.getMessageId());
} catch (NetworkException e) {
- logger.debug(EXCEPTION, e);
+ logger.debug(exceptionMsg, e);
eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
req.getMessageId());
}
@@ -549,6 +568,11 @@ public class NetworkAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("UpdateNetworkTask start");
try {
Holder<Map<String, String>> subnetIdMap = new Holder<>();
@@ -573,15 +597,15 @@ public class NetworkAdapterRest {
ctn = new ContrailNetwork();
req.setContrailNetwork(ctn);
}
- if (params.containsKey("shared")) {
- shared = params.get("shared");
+ if (params.containsKey(SHARED)) {
+ shared = params.get(SHARED);
} else {
if (ctn.getShared() != null) {
shared = ctn.getShared();
}
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
} else {
if (ctn.getExternal() != null) {
external = ctn.getExternal();
@@ -598,11 +622,11 @@ public class NetworkAdapterRest {
pvn = new ProviderVlanNetwork();
req.setProviderVlanNetwork(pvn);
}
- if (params.containsKey("shared")) {
- shared = params.get("shared");
+ if (params.containsKey(SHARED)) {
+ shared = params.get(SHARED);
}
- if (params.containsKey("external")) {
- external = params.get("external");
+ if (params.containsKey(EXTERNAL)) {
+ external = params.get(EXTERNAL);
}
adapter.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(),
@@ -614,7 +638,7 @@ public class NetworkAdapterRest {
// an update
subnetIdMap.value, req.getMessageId());
} catch (NetworkException e) {
- logger.debug(EXCEPTION, e);
+ logger.debug(exceptionMsg, e);
eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java
index c275073c46..68142e6cc9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java
@@ -57,11 +57,11 @@ public class NetworkAdapterNotify_Service extends Service {
}
public NetworkAdapterNotify_Service() {
- super(__getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME);
+ super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME);
}
public NetworkAdapterNotify_Service(WebServiceFeature... features) {
- super(__getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME, features);
+ super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME, features);
}
public NetworkAdapterNotify_Service(URL wsdlLocation) {
@@ -100,7 +100,7 @@ public class NetworkAdapterNotify_Service extends Service {
return super.getPort(new QName(URL, "MsoNetworkAdapterAsyncImplPort"), NetworkAdapterNotify.class, features);
}
- private static URL __getWsdlLocation() {
+ private static URL getWsdlLocation() {
if (NETWORKADAPTERNOTIFY_EXCEPTION != null) {
throw NETWORKADAPTERNOTIFY_EXCEPTION;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
index 81ccd8aa04..a7a2974660 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
@@ -39,22 +39,22 @@ import javax.xml.namespace.QName;
@XmlRegistry
public class ObjectFactory {
- private static final String Url = "http://org.onap.so/networkNotify";
- private static final QName _RollbackNetworkNotification_QNAME = new QName(Url, "rollbackNetworkNotification");
- private static final QName _UpdateNetworkNotification_QNAME = new QName(Url, "updateNetworkNotification");
+ private static final String URL = "http://org.onap.so/networkNotify";
+ private static final QName _RollbackNetworkNotification_QNAME = new QName(URL, "rollbackNetworkNotification");
+ private static final QName _UpdateNetworkNotification_QNAME = new QName(URL, "updateNetworkNotification");
private static final QName _QueryNetworkNotificationResponse_QNAME =
- new QName(Url, "queryNetworkNotificationResponse");
+ new QName(URL, "queryNetworkNotificationResponse");
private static final QName _UpdateNetworkNotificationResponse_QNAME =
- new QName(Url, "updateNetworkNotificationResponse");
+ new QName(URL, "updateNetworkNotificationResponse");
private static final QName _CreateNetworkNotificationResponse_QNAME =
- new QName(Url, "createNetworkNotificationResponse");
- private static final QName _DeleteNetworkNotification_QNAME = new QName(Url, "deleteNetworkNotification");
+ new QName(URL, "createNetworkNotificationResponse");
+ private static final QName _DeleteNetworkNotification_QNAME = new QName(URL, "deleteNetworkNotification");
private static final QName _DeleteNetworkNotificationResponse_QNAME =
- new QName(Url, "deleteNetworkNotificationResponse");
- private static final QName _CreateNetworkNotification_QNAME = new QName(Url, "createNetworkNotification");
- private static final QName _QueryNetworkNotification_QNAME = new QName(Url, "queryNetworkNotification");
+ new QName(URL, "deleteNetworkNotificationResponse");
+ private static final QName _CreateNetworkNotification_QNAME = new QName(URL, "createNetworkNotification");
+ private static final QName _QueryNetworkNotification_QNAME = new QName(URL, "queryNetworkNotification");
private static final QName _RollbackNetworkNotificationResponse_QNAME =
- new QName(Url, "rollbackNetworkNotificationResponse");
+ new QName(URL, "rollbackNetworkNotificationResponse");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
@@ -211,7 +211,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "rollbackNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotification")
public JAXBElement<RollbackNetworkNotification> createRollbackNetworkNotification(
RollbackNetworkNotification value) {
return new JAXBElement<>(_RollbackNetworkNotification_QNAME, RollbackNetworkNotification.class, null, value);
@@ -221,7 +221,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "updateNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "updateNetworkNotification")
public JAXBElement<UpdateNetworkNotification> createUpdateNetworkNotification(UpdateNetworkNotification value) {
return new JAXBElement<>(_UpdateNetworkNotification_QNAME, UpdateNetworkNotification.class, null, value);
}
@@ -230,7 +230,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "queryNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "queryNetworkNotificationResponse")
public JAXBElement<QueryNetworkNotificationResponse> createQueryNetworkNotificationResponse(
QueryNetworkNotificationResponse value) {
return new JAXBElement<>(_QueryNetworkNotificationResponse_QNAME, QueryNetworkNotificationResponse.class, null,
@@ -241,7 +241,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "updateNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "updateNetworkNotificationResponse")
public JAXBElement<UpdateNetworkNotificationResponse> createUpdateNetworkNotificationResponse(
UpdateNetworkNotificationResponse value) {
return new JAXBElement<>(_UpdateNetworkNotificationResponse_QNAME, UpdateNetworkNotificationResponse.class,
@@ -252,7 +252,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "createNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "createNetworkNotificationResponse")
public JAXBElement<CreateNetworkNotificationResponse> createCreateNetworkNotificationResponse(
CreateNetworkNotificationResponse value) {
return new JAXBElement<>(_CreateNetworkNotificationResponse_QNAME, CreateNetworkNotificationResponse.class,
@@ -263,7 +263,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "deleteNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "deleteNetworkNotification")
public JAXBElement<DeleteNetworkNotification> createDeleteNetworkNotification(DeleteNetworkNotification value) {
return new JAXBElement<>(_DeleteNetworkNotification_QNAME, DeleteNetworkNotification.class, null, value);
}
@@ -272,7 +272,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "deleteNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "deleteNetworkNotificationResponse")
public JAXBElement<DeleteNetworkNotificationResponse> createDeleteNetworkNotificationResponse(
DeleteNetworkNotificationResponse value) {
return new JAXBElement<>(_DeleteNetworkNotificationResponse_QNAME, DeleteNetworkNotificationResponse.class,
@@ -283,7 +283,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "createNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "createNetworkNotification")
public JAXBElement<CreateNetworkNotification> createCreateNetworkNotification(CreateNetworkNotification value) {
return new JAXBElement<>(_CreateNetworkNotification_QNAME, CreateNetworkNotification.class, null, value);
}
@@ -292,7 +292,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotification }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "queryNetworkNotification")
+ @XmlElementDecl(namespace = URL, name = "queryNetworkNotification")
public JAXBElement<QueryNetworkNotification> createQueryNetworkNotification(QueryNetworkNotification value) {
return new JAXBElement<>(_QueryNetworkNotification_QNAME, QueryNetworkNotification.class, null, value);
}
@@ -301,7 +301,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotificationResponse }{@code >}}
*
*/
- @XmlElementDecl(namespace = Url, name = "rollbackNetworkNotificationResponse")
+ @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotificationResponse")
public JAXBElement<RollbackNetworkNotificationResponse> createRollbackNetworkNotificationResponse(
RollbackNetworkNotificationResponse value) {
return new JAXBElement<>(_RollbackNetworkNotificationResponse_QNAME, RollbackNetworkNotificationResponse.class,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
index 4396fc035d..9fc5c979d8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
@@ -89,7 +89,7 @@ public class CXFConfiguration {
}
@Bean
- public ServletRegistrationBean SoapDispatcherServlet() {
+ public ServletRegistrationBean soapDispatcherServlet() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new CXFServlet(), "/services/*");
servletRegistrationBean.setName("services");
return servletRegistrationBean;
@@ -149,7 +149,7 @@ public class CXFConfiguration {
}
@Bean
- public Endpoint VnfAsyncAdapterEndpoint() {
+ public Endpoint vnfAsyncAdapterEndpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterAsyncImpl);
endpoint.publish("/VnfAsyncAdapter");
endpoint.setWsdlLocation("VnfAsyncAdapter.wsdl");
@@ -160,7 +160,7 @@ public class CXFConfiguration {
}
@Bean
- public Endpoint VnfCloudAdapterEndpoint() {
+ public Endpoint vnfCloudAdapterEndpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), vnfCloudifyAdapterImpl);
endpoint.publish("/VnfCloudifyAdapterImpl");
endpoint.setWsdlLocation("VnfCloudifyAdapterImpl.wsdl");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CatalogDBConfig.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CatalogDBConfig.java
new file mode 100644
index 0000000000..299e695275
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CatalogDBConfig.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.openstack;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.db.catalog.data.repository"})
+@EnableScheduling
+@Profile({"!test"})
+public class CatalogDBConfig {
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari")
+ public HikariConfig catalogDbConfig() {
+ return new HikariConfig();
+ }
+
+ @Primary
+ @Bean(name = "dataSource")
+ public DataSource dataSource() {
+ HikariConfig hikariConfig = this.catalogDbConfig();
+ return new HikariDataSource(hikariConfig);
+ }
+
+ @Primary
+ @Bean(name = "entityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ @Qualifier("dataSource") DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.catalog.beans").persistenceUnit("catalogDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "transactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
index 97a2500c59..436836491d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
@@ -22,7 +22,6 @@ package org.onap.so.adapters.openstack;
import java.util.concurrent.Executor;
import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
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 34177ff5a3..d75824357f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
@@ -48,10 +48,9 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
+import javax.inject.Provider;
@Component
public class ValetClient {
@@ -75,6 +74,9 @@ public class ValetClient {
private static final String BODY = ", body=";
@Autowired
private ObjectMapper mapper;
+ @Autowired
+ private Provider<RestTemplate> templateProvider;
+
protected String baseUrl;
protected String basePath;
@@ -123,10 +125,7 @@ public class ValetClient {
}
private RestTemplate getRestTemplate() {
- RestTemplate restTemplate = new RestTemplate();
- restTemplate
- .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- return restTemplate;
+ return templateProvider.get();
}
/*
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 906c285c28..62e9d562a6 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
@@ -204,7 +204,6 @@ public class BpelRestClient {
* @return true if the post succeeded, false if all retries failed
*/
public boolean bpelPost(final String toBpelStr, final String bpelUrl, final boolean isxml) {
- debug("Sending response to BPEL: " + toBpelStr);
int totalretries = 0;
int retryint = retryInterval;
while (true) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java
deleted file mode 100644
index 7786b872ef..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.vnf;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-import org.onap.so.adapters.vdu.VduArtifact;
-import org.onap.so.adapters.vdu.VduArtifact.ArtifactType;
-import org.onap.so.adapters.vdu.VduModelInfo;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import com.google.common.io.Files;
-
-/**
- * The purpose of this class is to create a CSAR byte array from Vdu inputs for the purpose of forwarding to a TOSCA
- * orchestrator.
- *
- * @author DeWayne
- *
- */
-public class CSAR {
- private static final String MANIFEST_FILENAME = "MANIFEST.MF";
- private VduModelInfo vduModel;
-
- public CSAR(VduModelInfo model) {
- this.vduModel = model;
- }
-
- /**
- * Creates a byte array representation of a CSAR corresponding to the VduBlueprint arg in the constructor.
- *
- * @return
- * @throws VnfException
- */
- public byte[] create() {
- File dir = Files.createTempDir();
-
- /**
- * Create subdir
- */
- File metadir = new File(dir.getAbsolutePath() + "/TOSCA-Metadata");
- if (!metadir.mkdir()) {
- throw new RuntimeException("CSAR TOSCA-Metadata directory create failed");
- }
-
- /**
- * Organize model info for consumption
- */
- VduArtifact mainTemplate = null;
- List<VduArtifact> extraFiles = new ArrayList<>();
- for (VduArtifact artifact : vduModel.getArtifacts()) {
- if (artifact.getType() == ArtifactType.MAIN_TEMPLATE) {
- mainTemplate = artifact;
- } else {
- extraFiles.add(artifact);
- }
- }
-
- if (mainTemplate == null) { // make a dummy to avoid null pointers
- mainTemplate = new VduArtifact("", new byte[0], null);
- }
-
- /**
- * Write template files
- */
- try (OutputStream ofs = new FileOutputStream(new File(dir, mainTemplate.getName()));
- PrintStream mfstream =
- new PrintStream(new File(metadir.getAbsolutePath() + '/' + MANIFEST_FILENAME));) {
- ofs.write(mainTemplate.getContent());
-
- /**
- * Write other files
- */
- if (!extraFiles.isEmpty()) {
- for (VduArtifact artifact : extraFiles) {
- try (OutputStream out = new FileOutputStream(new File(dir, artifact.getName()));) {
- out.write(artifact.getContent());
- }
- }
- }
-
-
- /**
- * Create manifest
- */
- mfstream.println("TOSCA-Meta-File-Version: 1.0");
- mfstream.println("CSAR-Version: 1.1");
- mfstream.println("Created-by: ONAP");
- mfstream.println("Entry-Definitions: " + mainTemplate.getName());
-
- /**
- * ZIP it up
- */
- ByteArrayOutputStream zipbytes = new ByteArrayOutputStream();
- ZipOutputStream zos = new ZipOutputStream(zipbytes);
- compressTree(zos, "", dir, dir);
- zos.close();
- return zipbytes.toByteArray();
-
- } catch (Exception e) {
- throw new RuntimeException("Failed to create CSAR: " + e.getMessage());
- } finally {
- /**
- * Clean up tmpdir
- */
- deleteDirectory(dir);
- }
- }
-
- /**
- * Private methods
- */
-
- /**
- * Compresses (ZIPs) a directory tree
- *
- * @param dir
- * @throws IOException
- */
- private void compressTree(ZipOutputStream zos, String path, File basedir, File dir) throws IOException {
- if (!dir.isDirectory())
- return;
-
- for (File f : dir.listFiles()) {
- if (f.isDirectory()) {
- String newpath = path + f.getName() + '/';
- ZipEntry entry = new ZipEntry(newpath);
- zos.putNextEntry(entry);
- zos.closeEntry();
- compressTree(zos, newpath, basedir, f);
- } else {
- ZipEntry ze = new ZipEntry(
- f.getAbsolutePath().substring(basedir.getAbsolutePath().length() + 1).replaceAll("\\\\", "/"));
- zos.putNextEntry(ze);
- // read the file and write to ZipOutputStream
- try (FileInputStream fis = new FileInputStream(f);) {
- byte[] buffer = new byte[1024];
- int len;
- while ((len = fis.read(buffer)) > 0) {
- zos.write(buffer, 0, len);
- }
- }
- zos.closeEntry();
- }
- }
- }
-
- private boolean deleteDirectory(File directory) {
- if (directory.exists()) {
- File[] files = directory.listFiles();
- if (null != files) {
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- deleteDirectory(files[i]);
- } else {
- files[i].delete();
- }
- }
- }
- }
- return (directory.delete());
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
index fe11fa07b4..6713c2d069 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
@@ -45,6 +45,7 @@ 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.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
@@ -64,6 +65,8 @@ 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";
+ private static final String UPDATE_VNFA = "{} UpdateVnfA";
+ private static final String EXCEPTION_UPDATEVNF_NOTIFICATION = "{} {} Exception sending updateVnf notification ";
@Autowired
private Environment environment;
@@ -151,7 +154,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
ErrorCode.BusinessProcesssError.getValue(), e1);
}
- logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
+ logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
return;
}
logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value);
@@ -173,7 +176,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
String messageId, MsoRequest msoRequest, String notificationUrl) {
- logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF);
+ logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF);
// Use the synchronous method to perform the actual Create
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -187,7 +190,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
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,
+ logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_UPDATE_VNF_ERR,
ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
@@ -204,10 +207,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
notifyPort.updateVnfNotification(messageId, false, exCat, eMsg, null, null);
} catch (Exception e1) {
- logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR,
ErrorCode.BusinessProcesssError.getValue(), e1);
}
- logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
+ logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
return;
}
logger.debug("Async Update VNF: {} VnfId:{}", vnfName, vnfId.value);
@@ -217,10 +220,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
notifyPort.updateVnfNotification(messageId, true, null, null, copyUpdateOutputs(outputs),
copyVrb(vnfRollback));
} catch (Exception e) {
- logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR,
ErrorCode.BusinessProcesssError.getValue(), e);
}
- logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
+ logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
return;
}
@@ -242,8 +245,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
public void queryVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId,
MsoRequest msoRequest, String notificationUrl) {
- String serviceName = "QueryVnfA";
- logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF);
+ logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_QUERY_VNF);
// Use the synchronous method to perform the actual query
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -320,8 +322,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
public void deleteVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId,
MsoRequest msoRequest, String notificationUrl) {
- String serviceName = "DeleteVnfA";
- logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF);
+ logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_DELETE_VNF);
// Use the synchronous method to perform the actual delete
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -457,7 +458,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs();
if (hMap != null && hMap.value != null) {
- Map<String, String> sMap = new HashMap<>();
+ Map<String, String> sMap;
sMap = hMap.value;
CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry();
@@ -475,7 +476,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs();
if (hMap != null && hMap.value != null) {
- Map<String, String> sMap = new HashMap<>();
+ Map<String, String> sMap;
sMap = hMap.value;
UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry();
@@ -495,7 +496,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs();
if (hMap != null && hMap.value != null) {
- Map<String, String> sMap = new HashMap<>();
+ Map<String, String> sMap;
sMap = hMap.value;
QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry();
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 5c7e70673b..af2fa24ff9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 2019 IBM
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +36,7 @@ import java.util.Optional;
import java.util.concurrent.TimeUnit;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.collections.CollectionUtils;
import org.onap.so.adapters.valet.GenericValetResponse;
import org.onap.so.adapters.valet.ValetClient;
@@ -63,10 +65,9 @@ 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.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
@@ -79,10 +80,6 @@ import org.onap.so.openstack.exceptions.MsoHeatNotFoundException;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoHeatUtilsWithUpdate;
-import org.openstack4j.model.compute.Flavor;
-import org.openstack4j.model.compute.Image;
-import org.openstack4j.model.compute.Server;
-import org.openstack4j.model.heat.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -92,6 +89,10 @@ import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openstack4j.model.compute.Flavor;
+import org.openstack4j.model.compute.Image;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
@WebService(serviceName = "VnfAdapter", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapter",
targetNamespace = "http://org.onap.so/vnf")
@@ -107,7 +108,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterImpl.class);
- private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
+
private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq";
@@ -115,15 +116,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final String VALET_ENABLED = "org.onap.so.adapters.vnf.valet_enabled";
private static final String FAIL_REQUESTS_ON_VALET_FAILURE =
"org.onap.so.adapters.vnf.fail_requests_on_valet_failure";
- private static final String SUCCESS_MSG = "Successfully received response from Open Stack";
+ private static final String OPENSTACK = "OpenStack";
+ private static final String DELETE_VNF = "DeleteVNF";
+ private static final String QUERY_STACK = "QueryStack";
+ private static final String CREATE_VFM_MODULE = "CreateVFModule";
+ private static final String CREATE_VF_STACK = "Create VF: Stack";
+ private static final String STACK = "Stack";
+ private static final String USER_ERROR = "USER ERROR";
+ private static final String VERSION_MIN = "VersionMin";
+ private static final String VERSION_MAX = "VersionMax";
@Autowired
private VFModuleCustomizationRepository vfModuleCustomRepo;
-
-
@Autowired
private VnfResourceRepository vnfResourceRepo;
-
@Autowired
private MsoHeatUtilsWithUpdate heatU;
@Autowired
@@ -133,7 +139,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
/**
* DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
- *
+ *
* @see MsoVnfAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
*/
public MsoVnfAdapterImpl() {
@@ -190,7 +196,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String vfModuleId = "";
// Create a hook here to catch shortcut createVf requests:
if (requestType != null && requestType.startsWith("VFMOD")) {
- logger.debug("Calling createVfModule from createVnf -- requestType=" + requestType);
+ logger.debug("Calling createVfModule from createVnf -- requestType={}", requestType);
String newRequestType = requestType.substring(5);
String vfVolGroupHeatStackId = "";
String vfBaseHeatStackId = "";
@@ -252,13 +258,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Holder<Boolean> vnfExists, Holder<String> vnfId, Holder<VnfStatus> status,
Holder<Map<String, String>> outputs) throws VnfException {
- logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
+ logger.debug("Querying VNF {} in {}/{}", vnfName, cloudSiteId, tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- StackInfo heatStack = null;
- long subStartTime = System.currentTimeMillis();
+ StackInfo heatStack;
try {
heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
@@ -267,8 +271,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Convert to a generic VnfException
String error =
"Query VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
- tenantId, "OpenStack", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me);
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId,
+ OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -311,25 +315,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
throws VnfException {
logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- // 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.
- long subStartTime = System.currentTimeMillis();
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
- me.addContext("DeleteVNF");
+ me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
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.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -345,10 +341,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void rollbackVnf(VnfRollback rollback) throws VnfException {
- long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
+ logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
return;
}
@@ -372,9 +367,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("RollbackVNF");
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.error(LoggingAnchor.NINE, 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);
}
@@ -438,13 +432,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug(" HeatBridgeMain.py returned {} with code {}", wait, p.exitValue());
return wait && p.exitValue() == 0;
} catch (IOException e) {
- logger.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
+ logger.debug(" HeatBridgeMain.py failed with IO Exception! {}", e);
return false;
} catch (RuntimeException e) {
- logger.debug(" HeatBridgeMain.py failed during runtime!" + e);
+ logger.debug(" HeatBridgeMain.py failed during runtime! {}", e);
return false;
} catch (Exception e) {
- logger.debug(" HeatBridgeMain.py failed for unknown reasons! " + e);
+ logger.debug(" HeatBridgeMain.py failed for unknown reasons! {}", e);
return false;
}
}
@@ -462,7 +456,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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);
@@ -591,7 +584,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
useMCUuid = false;
mcu = "";
} else {
- logger.debug("Found modelCustomizationUuid! Will use that: " + mcu);
+ logger.debug("Found modelCustomizationUuid! Will use that: {}", mcu);
useMCUuid = true;
}
}
@@ -618,7 +611,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
requestTypeString = requestTypeString.substring(1);
}
- // 1607 - let's parse out the request type we're being sent
+ // let's parse out the request type we're being sent
boolean isBaseRequest = false;
boolean isVolumeRequest = false;
if (requestTypeString.startsWith("VOLUME")) {
@@ -627,8 +620,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId
+ ", nestedBaseStackId = " + nestedBaseStackId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
@@ -648,57 +639,60 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
StackInfo heatStack = null;
- long subStartTime1 = System.currentTimeMillis();
try {
- heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
+ if (heat != null) {
+ heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
+ } else {
+ throw new MsoHeatNotFoundException();
+ }
} catch (MsoException me) {
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
- "Exception - queryStack", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ "Exception - " + QUERY_STACK, me);
logger.debug(error);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext("CreateVFModule");
+ me.addContext(CREATE_VFM_MODULE);
throw new VnfException(me);
}
- // New with 1607 - more precise handling/messaging if the stack already exists
+ // more precise handling/messaging if the stack already exists
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
// INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED
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 "
+ 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.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists");
logger.debug(error);
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 "
+ 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.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists and is " + "in FAILED state");
logger.debug(error);
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 "
+ String error = CREATE_VF_STACK + " " + 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, "OpenStack", "queryStack", ErrorCode.DataError.getValue(),
- "Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
@@ -706,11 +700,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (status == HeatStatus.CREATED) {
// fail - it exists
if (failIfExists != null && failIfExists) {
- String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudOwner + "/"
+ String error = 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.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ STACK + " " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
heatStack.getCanonicalName());
@@ -728,7 +722,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// handle a nestedStackId if sent- this one would be for the volume - so applies to both Vf and Vnf
StackInfo nestedHeatStack = null;
- long subStartTime2 = System.currentTimeMillis();
+
Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
try {
@@ -737,20 +731,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext("CreateVFModule");
+ me.addContext(CREATE_VFM_MODULE);
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.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, 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 "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "queryStack",
+ + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK,
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached heatStack ID " + "DOES NOT EXIST");
logger.debug(error);
@@ -763,7 +757,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// handle a nestedBaseStackId if sent- this is the stack ID of the base. Should be null for VNF requests
StackInfo nestedBaseHeatStack = null;
- long subStartTime3 = System.currentTimeMillis();
Map<String, Object> baseStackOutputs = null;
if (nestedBaseStackId != null) {
try {
@@ -772,21 +765,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext("CreateVFModule");
+ me.addContext(CREATE_VFM_MODULE);
String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " 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 base stack",
- me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, 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 " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack",
+ + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK,
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached base heatStack ID DOES NOT EXIST");
logger.debug("Exception occurred", error);
@@ -797,31 +789,25 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
}
- // Ready to deploy the new VNF
-
-
-
try {
// Retrieve the VF
VfModule vf = null;
VnfResource vnfResource = null;
VfModuleCustomization vfmc = null;
- logger.debug("version: {}", vfVersion);
if (useMCUuid) {
- // 1707 - db refactoring
vfmc = vfModuleCustomRepo.findFirstByModelCustomizationUUIDOrderByCreatedDesc(mcu);
if (vfmc != null)
vf = vfmc.getVfModule();
else
vf = null;
- // 1702 - this will be the new way going forward. We find the vf by mcu - otherwise, code is the same.
+ // this will be the new way going forward. We find the vf by mcu - otherwise, code is the same.
if (vf == null) {
logger.debug("Unable to find vfModuleCust with modelCustomizationUuid={}", mcu);
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",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ "VF Module ModelCustomizationUuid", modelCustomizationUuid, OPENSTACK,
ErrorCode.DataError.getValue(),
"Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu);
logger.debug(error);
@@ -849,8 +835,8 @@ 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", ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type");
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType,
+ OPENSTACK, ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
@@ -858,11 +844,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
// By here - we have either a vf or vnfResource
- // 1607 - Add version check
+ // Add version check
// First - see if it's in the VnfResource record
// if we have a vf Module - then we have to query to get the VnfResource record.
- if (!oldWay && vf.getVnfResources() != null) {
- vnfResource = vf.getVnfResources();
+ if (!oldWay) {
+ if (vf != null) {
+ vnfResource = vf.getVnfResources();
+ }
if (vnfResource == null) {
logger.debug("Unable to find vnfResource will not error for now...");
}
@@ -906,7 +894,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
equalToMax = aicV.isTheSameVersion(maxVersionVnf);
} catch (Exception e) {
logger.debug(
- "An exception occurred while trying to test AIC Version {} - will default to not check",
+ "An exception occurred while trying to test Cloud Version {} - will default to not check",
e.getMessage(), e);
doNotTest = true;
}
@@ -914,35 +902,28 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if ((moreThanMin || equalToMin) // aic >= min
&& (equalToMax || !(moreThanMax))) { // aic <= max
logger.debug("VNF Resource " + vnfResource.getModelName() + ", ModelUuid="
- + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:"
- + maxVersionVnf + " supported on Cloud: " + cloudSiteId + " with AIC_Version:"
- + cloudSiteOpt.get().getCloudVersion());
+ + vnfResource.getModelUUID() + " " + VERSION_MIN + " =" + minVersionVnf + " "
+ + VERSION_MAX + " :" + maxVersionVnf + " supported on Cloud: " + cloudSiteId
+ + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion());
} else {
// ERROR
String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid="
- + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:"
- + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId
+ + vnfResource.getModelUUID() + " " + VERSION_MIN + " =" + minVersionVnf + " "
+ + VERSION_MAX + " :" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId
+ " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
} else {
- logger.debug("bypassing testing AIC version...");
+ logger.debug("bypassing testing Cloud version...");
}
} // let this error out downstream to avoid introducing uncertainty at this stage
} else {
logger.debug("cloudConfig is NULL - cannot check cloud site version");
}
- } else {
- logger.debug(
- "AIC Version not set in VNF_Resource - this is expected thru 1607 - do not error here - not checked"
- + ".");
}
- // End Version check 1607
-
-
// By the time we get here - heatTemplateId and heatEnvtId should be populated (or null)
HeatTemplate heatTemplate = null;
@@ -964,9 +945,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
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", ErrorCode.DataError.getValue(), error);
+ + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid="
+ + (vf != null ? vf.getModelUUID() : "null") + ", vnfResourceModelUuid="
+ + vnfResource.getModelUUID() + ", reqType=" + requestTypeString;
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template " + "ID",
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -978,9 +961,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("No environment parameter found for this Type " + vfModuleType);
} else {
if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", ErrorCode.DataError.getValue(), error);
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType
+ + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid="
+ + (vf != null ? vf.getModelUUID() : "null") + ", vnfResourceModelUuid="
+ + vnfResource.getModelUUID() + ", reqType=" + requestTypeString;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ "Heat " + "Environment ID", OPENSTACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -1006,7 +992,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
nestedTemplatesChecked = null;
}
- // 1510 - Also add the files: for any get_files associated with this vnf_resource_id
+ // Also add the files: for any get_files associated with this vnf_resource_id
// *if* there are any
List<HeatFiles> heatFiles = null;
@@ -1027,11 +1013,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (!isVolumeRequest || addGetFilesOnVolumeReq) {
if (oldWay) {
- logger.debug(
- "In MsoVnfAdapterImpl createVfModule, this should not happen - old way is gamma only - no heat "
- + "files!");
+ logger.debug("In MsoVnfAdapterImpl createVfModule, this should not happen, no heat files!");
} else {
- // 1607 - now use VF_MODULE_TO_HEAT_FILES table
+ // now use VF_MODULE_TO_HEAT_FILES table
logger.debug(
"In MsoVnfAdapterImpl createVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
+ vf.getModelUUID());
@@ -1058,9 +1042,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String missingParams = null;
List<String> paramList = new ArrayList<>();
- // New for 1510 - consult the PARAM_ALIAS field to see if we've been
+ // consult the PARAM_ALIAS field to see if we've been
// supplied an alias. Only check if we don't find it initially.
- // Also new in 1510 - don't flag missing parameters if there's an environment - because they might be there.
+ // don't flag missing parameters if there's an environment - because they might be there.
// And also new - add parameter to turn off checking all together if we find we're blocking orders we
// shouldn't
boolean checkRequiredParameters = true;
@@ -1075,7 +1059,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// No problem - default is true
logger.debug("An exception occured trying to get property {}", MsoVnfAdapterImpl.CHECK_REQD_PARAMS, e);
}
- // 1604 - Add enhanced environment & parameter checking
// Part 1: parse envt entries to see if reqd parameter is there (before used a simple grep
// Part 2: only submit to openstack the parameters in the envt that are in the heat template
// Note this also removes any comments
@@ -1083,7 +1066,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatEnvironment != null && heatEnvironment.getEnvironment() != null
&& heatEnvironment.getEnvironment().contains("parameters:")) {
- logger.debug("Enhanced environment checking enabled - 1604");
StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment());
mhee = new MsoHeatEnvironmentEntry(sb);
@@ -1101,10 +1083,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} else {
logger.debug("NO ENVIRONMENT for this entry");
}
- // New with 1707 - all variables converted to their native object types
+ // all variables converted to their native object types
Map<String, Object> goldenInputs = null;
- logger.debug("Now handle the inputs....first convert");
ArrayList<String> parameterNames = new ArrayList<>();
HashMap<String, String> aliasToParam = new HashMap<>();
StringBuilder sb = new StringBuilder("\nTemplate Parameters:\n");
@@ -1161,7 +1142,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1205,31 +1186,21 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Have the tenant. Now deploy the stack itself
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
- long createStackStarttime = System.currentTimeMillis();
try {
- // heatStack = heat.createStack(cloudSiteId, tenantId, vnfName, template, inputs, true,
- // heatTemplate.getTimeoutMinutes());
if (backout == null) {
backout = true;
}
if (heat != null) {
- logger.debug("heat is not null!!");
heatStack = heat.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null, template,
goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
nestedTemplatesChecked, heatFilesObjects, backout.booleanValue());
} else {
- logger.debug("heat is null!");
throw new MsoHeatNotFoundException();
}
} catch (MsoException me) {
- me.addContext("CreateVFModule");
- String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(),
- "MsoException - createStack", me);
- logger.debug(error);
+ me.addContext(CREATE_VFM_MODULE);
+ logger.error("Error creating Stack", me);
if (isValetEnabled && sendResponseToValet) {
logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
try {
@@ -1243,17 +1214,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
throw new VnfException(me);
} catch (NullPointerException npe) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + npe;
- logger.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");
- // npe.addContext ("CreateVNF");
+ logger.error("Error creating Stack", npe);
throw new VnfException("NullPointerException during heat.createStack");
} catch (Exception e) {
- logger.debug("unhandled exception at heat.createStack", e);
+ logger.error("Error creating Stack", e);
throw new VnfException("Exception during heat.createStack! " + e.getMessage());
}
// Reach this point if createStack is successful.
@@ -1278,7 +1242,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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);
throw new VnfException("Exception during create VF " + e.getMessage());
@@ -1291,11 +1254,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("Deleting VF {} in ", vnfName, cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// 1702 capture the output parameters on a delete
// so we'll need to query first
- Map<String, Object> stackOutputs = null;
+ Map<String, Object> stackOutputs;
try {
stackOutputs = heat.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
@@ -1304,9 +1266,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("DeleteVFModule");
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.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1324,22 +1285,16 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
msoRequest, failRequestOnValetFailure);
}
- // 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.
- long subStartTime = System.currentTimeMillis();
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
- me.addContext("DeleteVNF");
+ me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
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.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me);
logger.debug(error);
if (isValetEnabled && valetDeleteRequestSucceeded) {
logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
@@ -1446,9 +1401,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("requestTypeString = " + requestTypeString + ", nestedVolumeStackId = " + nestedStackId
+ ", nestedBaseStackId = " + nestedBaseStackId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
-
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
vfRollback.setCloudSiteId(cloudSiteId);
@@ -1462,8 +1414,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
vfRollback.setVfModuleStackId(vfModuleStackId);
vfRollback.setModelCustomizationUuid(mcu);
- StackInfo heatStack = null;
- long queryStackStarttime = System.currentTimeMillis();
+ StackInfo heatStack;
logger.debug("UpdateVfModule - querying for {}", vfModuleName);
try {
heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
@@ -1473,9 +1424,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVFModule");
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.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
+ "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1485,9 +1436,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Not Found
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);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), error);
throw new VnfNotFound(cloudSiteId, cloudOwner, tenantId, vfModuleName);
} else {
logger.debug("Found Existing stack, status={}", heatStack.getStatus());
@@ -1498,7 +1448,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// 1604 Cinder Volume support - handle a nestedStackId if sent (volumeGroupHeatStackId):
StackInfo nestedHeatStack = null;
- long queryStackStarttime2 = System.currentTimeMillis();
Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
try {
@@ -1510,18 +1459,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVFModule");
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(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, 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 "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName,
- cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack",
- ErrorCode.DataError.getValue(), error);
+ + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1534,7 +1482,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
StackInfo nestedBaseHeatStack = null;
Map<String, Object> baseStackOutputs = null;
if (nestedBaseStackId != null) {
- long queryStackStarttime3 = System.currentTimeMillis();
try {
logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
nestedBaseHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId);
@@ -1544,18 +1491,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVfModule");
String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, 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 " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack",
- ErrorCode.DataError.getValue(), error);
+ + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR;
+ logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -1584,8 +1530,8 @@ 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", ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type", vfModuleType,
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
logger.debug("Got VF module definition from Catalog: {}", vf.toString());
@@ -1657,15 +1603,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (!doNotTest) {
if ((moreThanMin || equalToMin) // aic >= min
&& ((equalToMax) || !(moreThanMax))) { // aic <= max
- logger.debug("VNF Resource " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf
- + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteId
- + " with AIC_Version:" + aicV);
+ logger.debug("VNF Resource " + vnfResource.getModelName() + " " + VERSION_MIN + " ="
+ + minVersionVnf + " " + VERSION_MAX + " :" + maxVersionVnf + " supported on Cloud: "
+ + cloudSiteId + " with AIC_Version:" + aicV);
} else {
// ERROR
- String error = "VNF Resource type: " + vnfResource.getModelName() + " VersionMin="
- + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: "
- + cloudSiteId + " with AIC_Version:" + aicV;
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ String error = "VNF Resource type: " + vnfResource.getModelName() + " " + VERSION_MIN + " ="
+ + minVersionVnf + " " + VERSION_MAX + " :" + maxVersionVnf
+ + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + aicV;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1695,18 +1641,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
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", ErrorCode.DataError.getValue(), error);
+ + ", modelCustomizationUuid=" + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType="
+ + requestTypeString;
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
}
if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", ErrorCode.DataError.getValue(), error);
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + mcu + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestTypeString;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment());
@@ -1913,14 +1861,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Problem - missing one or more required parameters
if (checkRequiredParameters) {
String error = "Update VNF: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, OPENSTACK,
ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
logger.debug("found missing parameters - but checkRequiredParameters is false - will not block");
}
- } else {
- logger.debug("No missing parameters found - ok to proceed");
}
// Just submit the envt entry as received from the database
@@ -1935,8 +1881,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// This is not a valid parameter for this template
extraParams.removeAll(paramList);
if (!extraParams.isEmpty()) {
- logger.warn("{} {} {} {} {} {}", MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType,
- extraParams.toString(), "OpenStack", ErrorCode.DataError.getValue(), "Extra params");
+ logger.warn(LoggingAnchor.SIX, MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType,
+ extraParams.toString(), OPENSTACK, ErrorCode.DataError.getValue(), "Extra params");
inputs.keySet().removeAll(extraParams);
}
}
@@ -1989,7 +1935,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Have the tenant. Now deploy the stack itself
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
- long updateStackStarttime = System.currentTimeMillis();
try {
heatStack = heatU.updateStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, template, goldenInputs, true,
heatTemplate.getTimeoutMinutes(), newEnvironmentString,
@@ -1999,8 +1944,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
me.addContext("UpdateVFModule");
String error = "Update VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
- cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(), "Exception - " + error, me);
+ logger.error(LoggingAnchor.EIGHT, 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 {
@@ -2035,7 +1980,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
- return;
}
private String getVfModuleNameFromModuleStackId(String vfModuleStackId) {
@@ -2083,7 +2027,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> nestedTemplates) {
boolean haveGetFiles = true;
boolean haveNestedTemplates = true;
- Map<String, Object> files = new HashMap<String, Object>();
+ Map<String, Object> files = new HashMap<>();
if (getFiles == null || getFiles.isEmpty()) {
haveGetFiles = false;
}
@@ -2139,7 +2083,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (newInputs != null) {
Map<String, Object> oldGold = goldenInputs;
logger.debug("parameters before being modified by valet:{}", oldGold.toString());
- goldenInputs = new HashMap<String, Object>();
+ goldenInputs = new HashMap<>();
for (String key : newInputs.keySet()) {
goldenInputs.put(key, newInputs.get(key));
}
@@ -2201,13 +2145,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> newInputs = vur.getParameters();
if (newInputs != null) {
Map<String, Object> oldGold = goldenInputs;
- logger.debug("parameters before being modified by valet:{}", oldGold.toString());
- goldenInputs = new HashMap<String, Object>();
+ logger.debug("parameters before being modified by valet:{}", oldGold);
+ goldenInputs = new HashMap<>();
for (String key : newInputs.keySet()) {
goldenInputs.put(key, newInputs.get(key));
}
valetModifiedParamsHolder.value = goldenInputs;
- logger.debug("parameters after being modified by valet:{}", goldenInputs.toString());
+ logger.debug("parameters after being modified by valet:{}", goldenInputs);
valetSucceeded = true;
}
} else {
@@ -2275,7 +2219,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
valetDeleteRequestSucceeded = false;
valetErrorMessage = e.getMessage();
}
- if (valetDeleteRequestSucceeded == false && failRequestOnValetFailure == true) {
+ if (!valetDeleteRequestSucceeded && failRequestOnValetFailure) {
logger.error("ValetDeleteRequestFailed - del req still will be sent to openstack",
new VnfException("ValetDeleteRequestFailedError"));
}
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 2ea7ff417c..f09fa34cb9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -32,6 +32,8 @@ import java.util.Optional;
import java.util.Set;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
+import com.woorea.openstack.heat.Heat;
import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.cloud.CloudConfig;
@@ -79,15 +81,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
private static Logger logger = LoggerFactory.getLogger(MsoVnfCloudifyAdapterImpl.class);
- private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
- private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
- private static final String LOG_REPLY_NAME = "MSO-VnfAdapter:MSO-BPMN.";
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
- private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq";
- private static final String CLOUDIFY_RESPONSE_SUCCESS = "Successfully received response from Cloudify";
private static final String CLOUDIFY = "Cloudify";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+ private static final String BRACKETS = LoggingAnchor.NINE;
+ private static final String OPENSTACK = "OpenStack";
@Autowired
protected CloudConfig cloudConfig;
@@ -105,16 +104,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
protected MsoCloudifyUtils cloudifyUtils;
/**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheck() {
- logger.debug("Health check call in VNF Cloudify Adapter");
- }
-
- /**
* DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
- *
+ *
* @see MsoVnfCloudifyAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
*/
public MsoVnfCloudifyAdapterImpl() {
@@ -122,6 +113,14 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
/**
+ * Health Check web method. Does nothing but return to show the adapter is deployed.
+ */
+ @Override
+ public void healthCheck() {
+ logger.debug("Health check call in VNF Cloudify Adapter");
+ }
+
+ /**
* This is the "Create VNF" web service implementation. This function is now unsupported and will return an error.
*
*/
@@ -177,10 +176,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
Holder<Map<String, String>> outputs) throws VnfException {
logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- long subStartTime = System.currentTimeMillis();
-
DeploymentInfo deployment = null;
try {
@@ -191,13 +186,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
deployment = null;
} catch (MsoException me) {
// Failed to query the Deployment due to a cloudify exception.
+ logger.debug("Failed to query the Deployment due to a cloudify exception");
// Convert to a generic VnfException
me.addContext("QueryVNF");
String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(),
- "Exception - queryDeployment", me);
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
+ CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -217,7 +212,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
logger.debug("VNF {} not found", vnfName);
}
- return;
}
@@ -243,10 +237,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void rollbackVnf(VnfRollback rollback) throws VnfException {
- long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
return;
}
@@ -269,7 +262,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
// KLUDGE - Cloudify requires Tenant Name for Openstack. We have the ID.
// Go directly to Keystone until APIs could be updated to supply the name.
@@ -286,13 +278,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
me.addContext("RollbackVNF");
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(),
+ logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId,
+ tenantId, CLOUDIFY, "DeleteDeployment", ErrorCode.DataError.getValue(),
"Exception - DeleteDeployment", me);
logger.debug(error);
throw new VnfException(me);
}
- return;
}
@@ -320,37 +311,38 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
- Map<String, String> stringOutputs = new HashMap<String, String>();
- for (String key : stackOutputs.keySet()) {
- if (stackOutputs.get(key) instanceof String) {
- stringOutputs.put(key, (String) stackOutputs.get(key));
- } else if (stackOutputs.get(key) instanceof Integer) {
+ Map<String, String> stringOutputs = new HashMap<>();
+ for (Map.Entry<String, Object> entry : stackOutputs.entrySet()) {
+ if (entry.getValue() instanceof String) {
+ stringOutputs.put(entry.getKey(), (String) entry.getValue());
+ } else if (entry.getValue() instanceof Integer) {
try {
- String str = "" + stackOutputs.get(key);
- stringOutputs.put(key, str);
+ String str = "" + entry.getValue();
+ stringOutputs.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs");
+ logger.error("Unable to add " + entry.getKey() + " to outputs", e);
}
- } else if (stackOutputs.get(key) instanceof JsonNode) {
+ } else if (entry.getValue() instanceof JsonNode) {
try {
- String str = this.convertNode((JsonNode) stackOutputs.get(key));
- stringOutputs.put(key, str);
+ String str = this.convertNode((JsonNode) entry.getValue());
+ stringOutputs.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting JsonNode");
+ logger.error("Unable to add " + entry.getKey() + " to outputs - exception converting JsonNode", e);
}
- } else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
+ } else if (entry.getValue() instanceof java.util.LinkedHashMap) {
try {
- String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
- stringOutputs.put(key, str);
+ String str = JSON_MAPPER.writeValueAsString(entry.getValue());
+ stringOutputs.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap");
+ logger.error("Unable to add " + entry.getKey() + " to outputs - exception converting LinkedHashMap",
+ e);
}
} else {
try {
- String str = stackOutputs.get(key).toString();
- stringOutputs.put(key, str);
+ String str = entry.getValue().toString();
+ stringOutputs.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage());
+ logger.error("Unable to add " + entry.getKey() + " to outputs - unable to call .toString() ", e);
}
}
}
@@ -366,18 +358,17 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
} else if (inputs.size() < 1) {
sb.append("\tEMPTY");
} else {
- for (String str : inputs.keySet()) {
+ for (Map.Entry<String, Object> entry : inputs.entrySet()) {
String outputString;
try {
- outputString = inputs.get(str).toString();
+ outputString = entry.getValue().toString();
} catch (Exception e) {
- outputString = "Unable to call toString() on the value for " + str;
+ outputString = "Unable to call toString() on the value for " + entry.getKey();
}
- sb.append("\t\nitem " + i++ + ": '" + str + "'='" + outputString + "'");
+ sb.append("\t\nitem " + i++ + ": '" + entry.getKey() + "'='" + outputString + "'");
}
}
logger.debug(sb.toString());
- return;
}
private void sendMapToDebug(Map<String, Object> inputs) {
@@ -388,12 +379,11 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
} else if (inputs.size() < 1) {
sb.append("\tEMPTY");
} else {
- for (String str : inputs.keySet()) {
- sb.append("\titem " + i++ + ": " + str + "=" + inputs.get(str));
+ for (Map.Entry<String, Object> entry : inputs.entrySet()) {
+ sb.append("\titem " + i++ + ": " + entry.getKey() + "=" + entry.getValue());
}
}
logger.debug(sb.toString());
- return;
}
private String convertNode(final JsonNode node) {
@@ -402,9 +392,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
final String json = JSON_MAPPER.writeValueAsString(obj);
return json;
} catch (JsonParseException jpe) {
- logger.debug("Error converting json to string " + jpe.getMessage());
+ logger.error("Error converting json to string ", jpe);
} catch (Exception e) {
- logger.debug("Error converting json to string " + e.getMessage());
+ logger.error("Error converting json to string ", e);
}
return "[Error converting json to string]";
}
@@ -413,44 +403,44 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (objectMap == null) {
return null;
}
- Map<String, String> stringMap = new HashMap<String, String>();
- for (String key : objectMap.keySet()) {
- if (!stringMap.containsKey(key)) {
- Object obj = objectMap.get(key);
+ Map<String, String> stringMap = new HashMap<>();
+ for (Map.Entry<String, Object> entry : objectMap.entrySet()) {
+ if (!stringMap.containsKey(entry.getKey())) {
+ Object obj = entry.getValue();
if (obj instanceof String) {
- stringMap.put(key, (String) objectMap.get(key));
+ stringMap.put(entry.getKey(), (String) entry.getValue());
} else if (obj instanceof JsonNode) {
// This is a bit of mess - but I think it's the least impacting
// let's convert it BACK to a string - then it will get converted back later
try {
String str = this.convertNode((JsonNode) obj);
- stringMap.put(key, str);
+ stringMap.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode " + key);
+ logger.error("DANGER WILL ROBINSON: unable to convert value for JsonNode " + entry.getKey(), e);
// okay in this instance - only string values (fqdn) are expected to be needed
}
} else if (obj instanceof java.util.LinkedHashMap) {
logger.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
try {
String str = JSON_MAPPER.writeValueAsString(obj);
- stringMap.put(key, str);
+ stringMap.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap " + key);
+ logger.error(
+ "DANGER WILL ROBINSON: unable to convert value for LinkedHashMap " + entry.getKey(), e);
}
} else if (obj instanceof Integer) {
try {
String str = "" + obj;
- stringMap.put(key, str);
+ stringMap.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug("DANGER WILL ROBINSON: unable to convert value for Integer " + key);
+ logger.error("DANGER WILL ROBINSON: unable to convert value for Integer " + entry.getKey(), e);
}
} else {
try {
String str = obj.toString();
- stringMap.put(key, str);
+ stringMap.put(entry.getKey(), str);
} catch (Exception e) {
- logger.debug(
- "DANGER WILL ROBINSON: unable to convert value " + key + " (" + e.getMessage() + ")");
+ logger.error("DANGER WILL ROBINSON: unable to convert value " + entry.getKey(), e);
}
}
}
@@ -506,14 +496,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs,
Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// Require a model customization ID. Every VF Module definition must have one.
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", CLOUDIFY, ErrorCode.DataError.getValue(),
"Create VF Module: Missing required input: modelCustomizationUuid");
logger.debug(error);
@@ -576,7 +564,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
+ modelCustomizationUuid;
logger.debug(error);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module " + "ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb",
ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -589,7 +577,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
vnfResource = vfmc.getVfModule().getVnfResources();
} catch (Exception e) {
- logger.debug("unhandled exception in create VF - [Query]" + e.getMessage());
+ logger.error("unhandled exception in create VF - [Query]", e);
throw new VnfException("Exception during create VF " + e.getMessage());
}
@@ -612,7 +600,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid="
+ vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax
+ " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -624,14 +612,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// First, look up to see if the VF already exists.
- long subStartTime1 = System.currentTimeMillis();
try {
cloudifyDeployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, vfModuleName);
} catch (MsoException me) {
// Failed to query the Deployment due to a cloudify exception.
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Exception - queryDeployment", me);
logger.debug(error);
@@ -652,9 +639,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (failIfExists != null && failIfExists) {
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.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
+ "Deployment " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
cloudifyDeployment.getId());
@@ -673,8 +660,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
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(),
+ logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
@@ -682,8 +669,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// fail - it exists and is in a FAILED state
String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
+ logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already " + "exists and is in FAILED state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
@@ -692,8 +679,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
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(),
+ logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already " + "exists and is in " + status.toString()
+ " state");
logger.debug(error);
@@ -703,8 +690,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected 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(),
+ logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
"Deployment " + vfModuleName + " already " + "exists and is in an unknown state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
@@ -718,7 +705,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// If a Volume Group was provided, query its outputs for inclusion in Module input parameters
if (volumeGroupId != null) {
- long subStartTime2 = System.currentTimeMillis();
DeploymentInfo volumeDeployment = null;
try {
volumeDeployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, volumeGroupId);
@@ -726,9 +712,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Failed to query the Volume GroupDeployment due to a cloudify exception.
String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)",
- ErrorCode.DataError.getValue(), "Exception - queryDeployment(volume)", me);
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner, cloudSiteId,
+ tenantId, CLOUDIFY, "queryDeployment(volume)", ErrorCode.DataError.getValue(),
+ "Exception - queryDeployment(volume)", me);
logger.debug(error);
// Convert to a generic VnfException
me.addContext("CreateVFModule(QueryVolume)");
@@ -738,9 +724,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (volumeDeployment == null || volumeDeployment.getStatus() == DeploymentStatus.NOTFOUND) {
String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in "
+ cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(volume)",
- ErrorCode.BusinessProcesssError.getValue(),
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudSiteId, tenantId,
+ error, CLOUDIFY, "queryDeployment(volume)", ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Attached Volume Group DOES NOT EXIST");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -768,7 +753,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
if (baseVfModuleId != null) {
- long subStartTime2 = System.currentTimeMillis();
DeploymentInfo baseDeployment = null;
try {
baseDeployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, baseVfModuleId);
@@ -776,9 +760,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Failed to query the Volume GroupDeployment due to a cloudify exception.
String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)",
- ErrorCode.DataError.getValue(), "Exception - queryDeployment(Base)", me);
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", ErrorCode.DataError.getValue(),
+ "Exception - queryDeployment(Base)", me);
logger.debug(error);
// Convert to a generic VnfException
me.addContext("CreateVFModule(QueryBase)");
@@ -788,8 +772,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (baseDeployment == null || baseDeployment.getStatus() == DeploymentStatus.NOTFOUND) {
String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in "
+ cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
- cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)",
+ logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudSiteId,
+ tenantId, error, CLOUDIFY, "queryDeployment(Base)",
ErrorCode.BusinessProcesssError.getValue(),
"Create VFModule: Base " + "Module DOES NOT EXIST");
logger.debug(error);
@@ -823,18 +807,20 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
+ + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID()
+ ", reqType=" + requestType;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
- vfModuleType, "OpenStack", ErrorCode.DataError.getValue(), error);
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
}
if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", ErrorCode.DataError.getValue(), error);
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestType;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+ OPENSTACK, ErrorCode.DataError.getValue(), error);
// Alarm on this error, configuration must be fixed
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -844,21 +830,21 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
try {
// All variables converted to their native object types
- HashMap<String, Object> goldenInputs = new HashMap<String, Object>();
- List<String> extraInputs = new ArrayList<String>();
+ HashMap<String, Object> goldenInputs = new HashMap<>();
+ List<String> extraInputs = new ArrayList<>();
// NOTE: SKIP THIS FOR CLOUDIFY for now. Just use what was passed in.
// This whole section needs to be rewritten.
Boolean skipInputChecks = false;
if (skipInputChecks) {
- goldenInputs = new HashMap<String, Object>();
- for (String key : inputs.keySet()) {
- goldenInputs.put(key, inputs.get(key));
+ goldenInputs = new HashMap<>();
+ for (Map.Entry<String, Object> entry : inputs.entrySet()) {
+ goldenInputs.put(entry.getKey(), entry.getValue());
}
} else {
// Build maps for the parameters (including aliases) to simplify checks
- HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>();
+ HashMap<String, HeatTemplateParam> params = new HashMap<>();
Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
logger.debug("paramSet has {} entries", paramSet.size());
@@ -868,7 +854,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Include aliases.
String alias = htp.getParamAlias();
- if (alias != null && !alias.equals("") && !params.containsKey(alias)) {
+ if (alias != null && !"".equals(alias) && !params.containsKey(alias)) {
params.put(alias, htp);
}
}
@@ -894,18 +880,18 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Next add in Volume Group Outputs if there are any. Copy directly without conversions.
if (volumeGroupOutputs != null && !volumeGroupOutputs.isEmpty()) {
- for (String key : volumeGroupOutputs.keySet()) {
- if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
- goldenInputs.put(key, volumeGroupOutputs.get(key));
+ for (Map.Entry<String, Object> entry : volumeGroupOutputs.entrySet()) {
+ if (params.containsKey(entry.getKey()) && !goldenInputs.containsKey(entry.getKey())) {
+ goldenInputs.put(entry.getKey(), entry.getValue());
}
}
}
// Next add in Base Module Outputs if there are any. Copy directly without conversions.
if (baseModuleOutputs != null && !baseModuleOutputs.isEmpty()) {
- for (String key : baseModuleOutputs.keySet()) {
- if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
- goldenInputs.put(key, baseModuleOutputs.get(key));
+ for (Map.Entry<String, Object> entry : baseModuleOutputs.entrySet()) {
+ if (params.containsKey(entry.getKey()) && !goldenInputs.containsKey(entry.getKey())) {
+ goldenInputs.put(entry.getKey(), entry.getValue());
}
}
}
@@ -949,7 +935,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
} catch (Exception e) {
// No problem - default is true
- logger.debug("An exception occured trying to get property {}",
+ logger.error("An exception occured trying to get property {}",
MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS, e);
}
@@ -969,8 +955,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, CLOUDIFY,
- ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams,
+ CLOUDIFY, ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
@@ -997,7 +983,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
if (!cloudifyUtils.isBlueprintLoaded(cloudSiteId, blueprintId)) {
logger.debug("Blueprint " + blueprintId + " is not loaded. Will upload it now.");
- Map<String, byte[]> blueprintFiles = new HashMap<String, byte[]>();
+ Map<String, byte[]> blueprintFiles = new HashMap<>();
blueprintFiles.put(blueprintName, blueprint.getBytes());
@@ -1032,16 +1018,14 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
catch (MsoException me) {
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, ErrorCode.DataError.getValue(),
- "MsoException - uploadBlueprint", me);
+ logger.error(LoggingAnchor.SEVEN, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+ tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me);
logger.debug(error);
throw new VnfException(me);
}
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
- long createDeploymentStarttime = System.currentTimeMillis();
try {
// KLUDGE - Cloudify requires Tenant Name for Openstack. We have the ID.
// Go directly to Keystone until APIs could be updated to supply the name.
@@ -1059,27 +1043,27 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
me.addContext("CreateVFModule");
String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
"MsoException - createDeployment", me);
logger.debug(error);
throw new VnfException(me);
} catch (NullPointerException npe) {
String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + npe;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType,
- cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
"NullPointerException - createDeployment", npe);
logger.debug(error);
logger.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment");
// npe.addContext ("CreateVNF");
throw new VnfException("NullPointerException during cloudify.createAndInstallDeployment");
} catch (Exception e) {
- logger.debug("unhandled exception at cloudify.createAndInstallDeployment");
+ logger.error("unhandled exception at cloudify.createAndInstallDeployment", e);
throw new VnfException("Exception during cloudify.createAndInstallDeployment! " + e.getMessage());
}
} catch (Exception e) {
- logger.debug("unhandled exception in create VF");
+ logger.error("unhandled exception in create VF", e);
throw new VnfException("Exception during create VF " + e.getMessage());
}
@@ -1093,15 +1077,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
rollback.value = vfRollback;
- logger.debug("VF Module successfully created", vfModuleName);
- return;
+ logger.debug("VF Module successfully created {}", vfModuleName);
+
}
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 " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// 1702 capture the output parameters on a delete
// so we'll need to query first
@@ -1113,9 +1095,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
me.addContext("DeleteVFModule");
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.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
+ CLOUDIFY, "QueryDeployment", ErrorCode.DataError.getValue(), "Exception - QueryDeployment", me);
logger.debug(error);
throw new VnfException(me);
}
@@ -1127,7 +1108,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
cloudifyUtils.uninstallAndDeleteDeployment(cloudSiteId, tenantId, vnfName, 5);
} catch (MsoException me) {
@@ -1135,8 +1115,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
// Convert to a generic VnfException
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(),
+ logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
+ "DeleteDeployment", "DeleteDeployment", ErrorCode.DataError.getValue(),
"Exception - DeleteDeployment: " + me.getMessage());
logger.debug(error);
throw new VnfException(me);
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 7b48d0b07f..41bcc8c481 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -42,6 +42,7 @@ import java.util.Optional;
import java.util.Set;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.VduException;
import org.onap.so.adapters.vdu.VduInstance;
@@ -68,7 +69,6 @@ import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
@@ -91,7 +91,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Transactional
public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
- private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
private static Logger logger = LoggerFactory.getLogger(MsoVnfPluginAdapterImpl.class);
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
@@ -122,16 +121,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
protected VfModuleCustomizationToVduMapper vduMapper;
/**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheck() {
- logger.debug("Health check call in VNF Plugin Adapter");
- }
-
- /**
* DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
- *
+ *
* @see MsoVnfPluginAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
*/
public MsoVnfPluginAdapterImpl() {
@@ -139,6 +130,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
/**
+ * Health Check web method. Does nothing but return to show the adapter is deployed.
+ */
+ @Override
+ public void healthCheck() {
+ logger.debug("Health check call in VNF Plugin Adapter");
+ }
+
+ /**
* This is the "Create VNF" web service implementation. This function is now unsupported and will return an error.
*
*/
@@ -188,11 +187,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
Holder<Map<String, String>> outputs) throws VnfException {
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;
+ VduInstance vduInstance;
CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
@@ -205,7 +200,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
e.addContext("QueryVNF");
String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + e;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner,
cloudSiteId, tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU",
e);
logger.debug(error);
@@ -253,10 +248,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void rollbackVnf(VnfRollback rollback) throws VnfException {
- long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
return;
}
@@ -280,7 +274,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Use the VduPlugin to delete the VF Module.
VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
- long subStartTime = System.currentTimeMillis();
try {
// TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object
// and use that.
@@ -293,7 +286,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
ve.addContext("RollbackVFModule");
String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + ve;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu",
ve);
logger.debug(error);
@@ -330,14 +323,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String type = templateParam.getParamType();
logger.debug("Parameter: {} is of type ", templateParam.getParamName(), type);
- if (type.equalsIgnoreCase("number")) {
+ if ("number".equalsIgnoreCase(type)) {
try {
return Integer.valueOf(inputValue.toString());
} catch (Exception e) {
logger.debug("Unable to convert " + inputValue + " to an integer!", e);
return null;
}
- } else if (type.equalsIgnoreCase("json")) {
+ } else if ("json".equalsIgnoreCase(type)) {
try {
JsonNode jsonNode = JSON_MAPPER.readTree(JSON_MAPPER.writeValueAsString(inputValue));
return jsonNode;
@@ -345,8 +338,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
logger.debug("Unable to convert " + inputValue + " to a JsonNode!", e);
return null;
}
- } else if (type.equalsIgnoreCase("boolean")) {
- return new Boolean(inputValue.toString());
+ } else if ("boolean".equalsIgnoreCase(type)) {
+ return Boolean.valueOf(inputValue.toString());
}
// Nothing else matched. Return the original string
@@ -354,7 +347,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
- Map<String, String> stringOutputs = new HashMap<String, String>();
+ Map<String, String> stringOutputs = new HashMap<>();
for (String key : stackOutputs.keySet()) {
if (stackOutputs.get(key) instanceof String) {
stringOutputs.put(key, (String) stackOutputs.get(key));
@@ -448,7 +441,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (objectMap == null) {
return null;
}
- Map<String, String> stringMap = new HashMap<String, String>();
+ Map<String, String> stringMap = new HashMap<>();
for (String key : objectMap.keySet()) {
if (!stringMap.containsKey(key)) {
Object obj = objectMap.get(key);
@@ -541,14 +534,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs,
Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// Require a model customization ID. Every VF Module definition must have one.
if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
logger.debug("Missing required input: modelCustomizationUuid");
String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
- logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", "VDU", ErrorCode.DataError,
"Create VF Module: " + "Missing required input: modelCustomizationUuid");
logger.debug(error);
@@ -612,7 +603,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
+ modelCustomizationUuid;
logger.debug(error);
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
"VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", ErrorCode.DataError,
error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -625,7 +616,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
vnfResource = vfModuleCust.getVfModule().getVnfResources();
} catch (Exception e) {
- logger.debug("unhandled exception in create VF - [Query]" + e.getMessage());
+ logger.debug("unhandled exception in create VF - [Query] {}", e.getMessage());
throw new VnfException("Exception during create VF " + e.getMessage());
}
@@ -651,7 +642,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
"VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID()
+ " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: "
+ cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -666,16 +657,15 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Use the VduPlugin.
VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
- long subStartTime1 = System.currentTimeMillis();
try {
vduInstance = vduPlugin.queryVdu(cloudInfo, vfModuleName);
} catch (VduException me) {
// Failed to query the VDU due to a plugin exception.
String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
- "Exception - queryVdu", me);
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "Exception - queryVdu",
+ me);
logger.debug(error);
// Convert to a generic VnfException
me.addContext("CreateVFModule");
@@ -692,9 +682,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// fail - it exists
String error = "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.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ "VF Module " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
vduInstance.getVduInstanceId());
@@ -714,8 +704,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
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, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -724,8 +714,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// fail - it exists and is in a FAILED state
String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in FAILED state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -735,8 +725,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
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, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -746,8 +736,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status "
+ status.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(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
"VF Module " + vfModuleName + " already exists and is in an unknown state");
logger.debug(error);
throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
@@ -762,16 +752,15 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// If a Volume Group was provided, query its outputs for inclusion in Module input parameters
if (volumeGroupId != null) {
- long subStartTime2 = System.currentTimeMillis();
- VduInstance volumeVdu = null;
+ VduInstance volumeVdu;
try {
volumeVdu = vduPlugin.queryVdu(cloudInfo, volumeGroupId);
} catch (VduException me) {
// Failed to query the Volume Group VDU due to a plugin exception.
String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(),
"Exception - queryVdu(volume)", me);
logger.debug(error);
// Convert to a generic VnfException
@@ -782,8 +771,8 @@ 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 "
+ cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
- cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
+ logger.error(LoggingAnchor.TEN, 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);
@@ -812,15 +801,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
if (baseVfModuleId != null) {
- long subStartTime2 = System.currentTimeMillis();
- VduInstance baseVdu = null;
+ VduInstance baseVdu;
try {
baseVdu = vduPlugin.queryVdu(cloudInfo, baseVfModuleId);
} catch (MsoException me) {
// Failed to query the Base VF Module due to a Vdu Plugin exception.
String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/"
+ cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(),
"Exception - queryVdu(Base)", me);
logger.debug(error);
@@ -832,8 +820,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) {
String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudOwner
+ "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(),
- baseVfModuleId, cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
+ logger.error(LoggingAnchor.TEN, 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);
@@ -864,8 +852,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
+ + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID()
+ ", reqType=" + requestType;
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
vfModuleType, "VNF", ErrorCode.DataError.getValue(), error);
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
@@ -874,8 +863,9 @@ 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",
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID() + ", reqType=" + requestType;
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
"OpenStack", ErrorCode.DataError.getValue(), error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
@@ -886,19 +876,19 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Create the combined set of parameters from the incoming request, base-module outputs,
// volume-module outputs. Also, convert all variables to their native object types.
- HashMap<String, Object> goldenInputs = new HashMap<String, Object>();
- List<String> extraInputs = new ArrayList<String>();
+ HashMap<String, Object> goldenInputs = new HashMap<>();
+ List<String> extraInputs = new ArrayList<>();
Boolean skipInputChecks = false;
if (skipInputChecks) {
- goldenInputs = new HashMap<String, Object>();
+ goldenInputs = new HashMap<>();
for (String key : inputs.keySet()) {
goldenInputs.put(key, inputs.get(key));
}
} else {
// Build maps for the parameters (including aliases) to simplify checks
- HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>();
+ HashMap<String, HeatTemplateParam> params = new HashMap<>();
Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
logger.debug("paramSet has " + paramSet.size() + " entries");
@@ -908,7 +898,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Include aliases.
String alias = htp.getParamAlias();
- if (alias != null && !alias.equals("") && !params.containsKey(alias)) {
+ if (alias != null && !"".equals(alias) && !params.containsKey(alias)) {
params.put(alias, htp);
}
}
@@ -1009,7 +999,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
logger.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1025,7 +1015,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Here we go... ready to deploy the VF Module.
- long instantiateVduStartTime = System.currentTimeMillis();
if (backout == null)
backout = true;
@@ -1046,7 +1035,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
me.addContext("CreateVFModule");
String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + me;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me);
logger.debug(error);
// Convert to a generic VnfException
@@ -1054,7 +1043,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
} catch (NullPointerException npe) {
String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ ": " + npe;
- logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(),
"NullPointerException - instantiateVdu", npe);
logger.debug(error);
@@ -1087,11 +1076,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException {
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;
+ VduInstance vduInstance;
CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
// Use the VduPlugin.
@@ -1105,7 +1092,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
e.addContext("QueryVFModule");
String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ tenantId + ": " + e;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner,
cloudSiteId, tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(),
"Exception - queryVDU", e);
logger.debug(error);
@@ -1122,7 +1109,6 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// - a vnfInstance object with status of NOTFOUND (VDU did not exist, treat as success)
// - a vnfInstance object with status of FAILED (error)
// Also, VduException could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
// TODO: Get an appropriate timeout value - require access to the model
vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
@@ -1131,7 +1117,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Convert to a generic VnfException
String error =
"Delete VF: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(),
"Exception - DeleteVdu: " + me.getMessage());
logger.debug(error);
@@ -1165,11 +1151,11 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
CloudSite cloudSite = cloudSiteOp.get();
String orchestrator = cloudSite.getOrchestrator();
- if (orchestrator.equalsIgnoreCase("CLOUDIFY")) {
+ if ("CLOUDIFY".equalsIgnoreCase(orchestrator)) {
return cloudifyUtils;
- } else if (orchestrator.equalsIgnoreCase("HEAT")) {
+ } else if ("HEAT".equalsIgnoreCase(orchestrator)) {
return heatUtils;
- } else if (orchestrator.equalsIgnoreCase("MULTICLOUD")) {
+ } else if ("MULTICLOUD".equalsIgnoreCase(orchestrator)) {
return multicloudUtils;
} else {
// Default if cloudSite record exists - return HEAT plugin - will fail later
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 e81b211b27..8c871c742e 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
@@ -40,7 +40,9 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
@@ -61,6 +63,7 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -86,19 +89,10 @@ public class VnfAdapterRest {
@Autowired
private MsoVnfAdapterImpl vnfAdapter;
- // TODO Logging, SkipAAI, CREATED flags, Integrate with BPEL, Auth,
@Autowired
private Provider<BpelRestClient> bpelRestClientProvider;
-
- /*
- * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules/<aaimodid> REQUEST: {"deleteVfModuleRequest":
- * {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId": "somevnfid", "vfModuleId":
- * "somemodid", "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73", "messageId": "ra.1", "notificationUrl":
- * "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": { "requestId": "ra1", "serviceInstanceId": "sa1"
- * }} }
- */
@DELETE
@Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -176,18 +170,21 @@ public class VnfAdapterRest {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
String cloudsite = req.getCloudSiteId();
Holder<Map<String, String>> outputs = new Holder<>();
if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
- // vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(),
- // req.getMsoRequest());
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(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(),
ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
req.getMessageId());
@@ -200,13 +197,7 @@ public class VnfAdapterRest {
}
}
- /*
- * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaiVnfId>/vf-modules/<aaiVfModuleId>?cloudSiteId=DAN&tenantId=
- * vfModule?&skipAAI=TRUE&msoRequest.requestId=ra1&msoRequest.serviceInstanceId=si1&vfModuleName=T2N2S1 RESP:
- * {"queryVfModuleResponse": { "vfModuleId": "AvfmodId", "vfModuleOutputs": {"entry": { "key":
- * "server_private_ip_1", "value": "10.100.1.25" }}, "vfModuleStackId":
- * "RaaVnf1/abfa8a6d-feb1-40af-aea3-109403b1cf6b", "vnfId": "AvnfID", "vnfStatus": "ACTIVE" }}
- */
+
@GET
@Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -251,7 +242,7 @@ public class VnfAdapterRest {
logger.debug("Query vfModule exit");
return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build();
} catch (VnfException e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
VfModuleExceptionResponse excResp =
new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
@@ -298,7 +289,7 @@ public class VnfAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR, "createVfModule",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CREATE_VNF_ERR, "createVfModule",
ErrorCode.BusinessProcesssError, "Exception - createVfModule", e);
return Response.serverError().build();
}
@@ -340,6 +331,11 @@ public class VnfAdapterRest {
public void run() {
logger.debug("CreateVfModuleTask start");
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
// Synchronous Web Service Outputs
Holder<String> vfModuleStackId = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
@@ -379,7 +375,7 @@ public class VnfAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- logger.debug("CreateVfModuleTask exit: code=" + getStatusCode() + RESP + getResponse());
+ logger.debug("CreateVfModuleTask exit: code=" + getStatusCode());
}
}
@@ -408,7 +404,7 @@ public class VnfAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
return Response.serverError().build();
}
@@ -449,9 +445,11 @@ public class VnfAdapterRest {
@Override
public void run() {
try {
- // MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
-
- // Synchronous Web Service Outputs
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
Holder<String> vfModuleStackId = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
Holder<VnfRollback> vnfRollback = new Holder<>();
@@ -481,13 +479,7 @@ public class VnfAdapterRest {
}
}
- /*
- * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules/<aaimodid>/rollback REQUEST:
- * {"deleteVfModuleRequest": {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId":
- * "somevnfid", "vfModuleId": "somemodid", "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73", "messageId":
- * "ra.1", "notificationUrl": "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": { "requestId": "ra1",
- * "serviceInstanceId": "sa1" }} }
- */
+
@DELETE
@Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}/rollback")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
@@ -516,7 +508,7 @@ public class VnfAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
return Response.serverError().build();
}
@@ -557,13 +549,18 @@ public class VnfAdapterRest {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVfModuleRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
VfModuleRollback vmr = req.getVfModuleRollback();
VnfRollback vrb = new VnfRollback(vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(),
vmr.getCloudSiteId(), true, true, vmr.getMsoRequest(), null, null, null, null);
vnfAdapter.rollbackVnf(vrb);
response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError,
+ logger.error(LoggingAnchor.THREE, 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 440b0dae0a..9a7354c40c 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
@@ -39,7 +39,9 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
@@ -60,6 +62,7 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import io.swagger.annotations.Api;
@@ -82,6 +85,7 @@ public class VnfAdapterRestV2 {
private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestV2.class);
private static final String TESTING_KEYWORD = "___TESTING___";
private static final String RESP = ", resp=";
+ private static final String BRACKETS = LoggingAnchor.FOUR;
@Autowired
private VnfAdapterRestUtils vnfAdapterRestUtils;
@@ -131,10 +135,11 @@ public class VnfAdapterRestV2 {
// This is an asynchronous request
try {
Thread t1 = new Thread(task);
+ MDC.getCopyOfContextMap();
t1.start();
} catch (Exception e) {
// problem handling delete, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
+ logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e);
return Response.serverError().build();
}
@@ -177,8 +182,13 @@ public class VnfAdapterRestV2 {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
String cloudsite = req.getCloudSiteId();
- Holder<Map<String, String>> outputs = new Holder<Map<String, String>>();
+ Holder<Map<String, String>> outputs = new Holder<>();
if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
// vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(),
// req.getMsoRequest());
@@ -190,7 +200,7 @@ public class VnfAdapterRestV2 {
response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
req.getMessageId(), outputs.value);
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(),
ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e);
eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
req.getMessageId());
@@ -200,6 +210,7 @@ public class VnfAdapterRestV2 {
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
logger.debug("Delete vfModule exit: code=" + getStatusCode() + RESP + getResponse());
+ MDC.clear();
}
}
@@ -237,10 +248,10 @@ public class VnfAdapterRestV2 {
try {
int respStatus = HttpStatus.SC_OK;
QueryVfModuleResponse qryResp = new QueryVfModuleResponse(aaiVnfId, aaiVfModuleId, null, null, null);
- Holder<Boolean> vnfExists = new Holder<Boolean>();
- Holder<String> vfModuleId = new Holder<String>();
- Holder<VnfStatus> status = new Holder<VnfStatus>();
- Holder<Map<String, String>> outputs = new Holder<Map<String, String>>();
+ Holder<Boolean> vnfExists = new Holder<>();
+ Holder<String> vfModuleId = new Holder<>();
+ Holder<VnfStatus> status = new Holder<>();
+ Holder<Map<String, String>> outputs = new Holder<>();
// Support different Adapter Implementations
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId);
@@ -259,7 +270,7 @@ public class VnfAdapterRestV2 {
logger.debug("Query vfModule exit");
return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build();
} catch (VnfException e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
VfModuleExceptionResponse excResp =
new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
@@ -308,7 +319,7 @@ public class VnfAdapterRestV2 {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule",
+ logger.error(BRACKETS, MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - createVfModule", e);
return Response.serverError().build();
}
@@ -352,10 +363,15 @@ public class VnfAdapterRestV2 {
public void run() {
logger.debug("CreateVfModuleTask start");
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
// Synchronous Web Service Outputs
- Holder<String> vfModuleStackId = new Holder<String>();
- Holder<Map<String, String>> outputs = new Holder<Map<String, String>>();
- Holder<VnfRollback> vnfRollback = new Holder<VnfRollback>();
+ Holder<String> vfModuleStackId = new Holder<>();
+ Holder<Map<String, String>> outputs = new Holder<>();
+ Holder<VnfRollback> vnfRollback = new Holder<>();
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
@@ -423,7 +439,7 @@ public class VnfAdapterRestV2 {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
+ logger.error(BRACKETS, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
return Response.serverError().build();
}
@@ -466,12 +482,15 @@ public class VnfAdapterRestV2 {
@Override
public void run() {
try {
- // MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
-
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
// Synchronous Web Service Outputs
- Holder<String> vfModuleStackId = new Holder<String>();
- Holder<Map<String, String>> outputs = new Holder<Map<String, String>>();
- Holder<VnfRollback> vnfRollback = new Holder<VnfRollback>();
+ Holder<String> vfModuleStackId = new Holder<>();
+ Holder<Map<String, String>> outputs = new Holder<>();
+ Holder<VnfRollback> vnfRollback = new Holder<>();
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
logger.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
@@ -535,7 +554,7 @@ public class VnfAdapterRestV2 {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
+ logger.error(BRACKETS, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
return Response.serverError().build();
}
@@ -576,6 +595,11 @@ public class VnfAdapterRestV2 {
@Override
public void run() {
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVfModuleRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
VfModuleRollback vmr = req.getVfModuleRollback();
VnfRollback vrb = new VnfRollback(vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(),
vmr.getCloudSiteId(), true, vmr.isVfModuleCreated(), vmr.getMsoRequest(), null, null, null,
@@ -587,7 +611,7 @@ public class VnfAdapterRestV2 {
response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
} catch (VnfException e) {
- logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(),
ErrorCode.BusinessProcesssError.getValue(), "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/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
index c02a872a85..87df7fdc37 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
@@ -25,11 +25,6 @@
package org.onap.so.adapters.vnf;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Provider;
@@ -47,6 +42,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -67,8 +63,14 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
/**
* This class services calls to the REST interface for VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) Both
@@ -155,6 +157,11 @@ public class VolumeAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("CreateVFModule VolumesTask start");
try {
// Synchronous Web Service Outputs
@@ -302,6 +309,11 @@ public class VolumeAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteVNFVolumesTask start");
try {
if (!req.getCloudSiteId().equals(TESTING_KEYWORD)) {
@@ -394,6 +406,11 @@ public class VolumeAdapterRest {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVolumeGroupRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteVNFVolumesTask start");
try {
VolumeGroupRollback vgr = req.getVolumeGroupRollback();
@@ -487,6 +504,11 @@ public class VolumeAdapterRest {
public void run() {
logger.debug("UpdateVNFVolumesTask start");
try {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
Holder<Map<String, String>> outputs = new Holder<>();
Holder<VnfRollback> vnfRollback = new Holder<>();
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
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 0ceba20051..77c9b1e2f5 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
@@ -24,11 +24,6 @@
package org.onap.so.adapters.vnf;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Provider;
@@ -46,6 +41,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -66,8 +62,14 @@ import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
/**
* This class services calls to the REST interface for VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) Both
@@ -158,6 +160,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("CreateVFModule VolumesTask start");
try {
// Synchronous Web Service Outputs
@@ -288,6 +295,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("DeleteVNFVolumesTask start");
String cloudSiteId = req.getCloudSiteId();
try {
@@ -383,6 +395,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVolumeGroupRollback().getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("RollbackVNFVolumesTask start");
try {
VolumeGroupRollback vgr = req.getVolumeGroupRollback();
@@ -480,6 +497,11 @@ public class VolumeAdapterRestV2 {
@Override
public void run() {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
+ } catch (Exception e) {
+ logger.error("Error adding RequestId to MDC", e);
+ }
logger.debug("UpdateVNFVolumesTask start");
try {
Holder<Map<String, String>> outputs = new Holder<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java
index ced49e2313..bb2a9059b9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,28 +36,28 @@ import javax.xml.namespace.QName;
* The Java representation of XML content can consist of schema derived interfaces and classes representing the binding
* of schema type definitions, element declarations and model groups. Factory methods for each of these are provided in
* this class.
- *
+ *
*/
@XmlRegistry
public class ObjectFactory {
private static final String URL = "http://org.onap.so/vnfNotify";
- private final static QName _QueryVnfNotification_QNAME = new QName(URL, "queryVnfNotification");
- private final static QName _RollbackVnfNotification_QNAME = new QName(URL, "rollbackVnfNotification");
- private final static QName _CreateVnfNotification_QNAME = new QName(URL, "createVnfNotification");
- private final static QName _DeleteVnfNotification_QNAME = new QName(URL, "deleteVnfNotification");
- private final static QName _UpdateVnfNotification_QNAME = new QName(URL, "updateVnfNotification");
+ private static final QName _QueryVnfNotification_QNAME = new QName(URL, "queryVnfNotification");
+ private static final QName _RollbackVnfNotification_QNAME = new QName(URL, "rollbackVnfNotification");
+ private static final QName _CreateVnfNotification_QNAME = new QName(URL, "createVnfNotification");
+ private static final QName _DeleteVnfNotification_QNAME = new QName(URL, "deleteVnfNotification");
+ private static final QName _UpdateVnfNotification_QNAME = new QName(URL, "updateVnfNotification");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
* org.onap.so.adapters.vnf.async.client
- *
+ *
*/
public ObjectFactory() {}
/**
* Create an instance of {@link UpdateVnfNotification }
- *
+ *
*/
public UpdateVnfNotification createUpdateVnfNotification() {
return new UpdateVnfNotification();
@@ -65,7 +65,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link UpdateVnfNotification.Outputs }
- *
+ *
*/
public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() {
return new UpdateVnfNotification.Outputs();
@@ -73,7 +73,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link CreateVnfNotification }
- *
+ *
*/
public CreateVnfNotification createCreateVnfNotification() {
return new CreateVnfNotification();
@@ -81,7 +81,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link CreateVnfNotification.Outputs }
- *
+ *
*/
public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() {
return new CreateVnfNotification.Outputs();
@@ -89,7 +89,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link QueryVnfNotification }
- *
+ *
*/
public QueryVnfNotification createQueryVnfNotification() {
return new QueryVnfNotification();
@@ -97,7 +97,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link QueryVnfNotification.Outputs }
- *
+ *
*/
public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() {
return new QueryVnfNotification.Outputs();
@@ -105,7 +105,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link RollbackVnfNotification }
- *
+ *
*/
public RollbackVnfNotification createRollbackVnfNotification() {
return new RollbackVnfNotification();
@@ -113,7 +113,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link DeleteVnfNotification }
- *
+ *
*/
public DeleteVnfNotification createDeleteVnfNotification() {
return new DeleteVnfNotification();
@@ -121,7 +121,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link MsoRequest }
- *
+ *
*/
public MsoRequest createMsoRequest() {
return new MsoRequest();
@@ -129,7 +129,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link VnfRollback }
- *
+ *
*/
public VnfRollback createVnfRollback() {
return new VnfRollback();
@@ -137,7 +137,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link UpdateVnfNotification.Outputs.Entry }
- *
+ *
*/
public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() {
return new UpdateVnfNotification.Outputs.Entry();
@@ -145,7 +145,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link CreateVnfNotification.Outputs.Entry }
- *
+ *
*/
public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() {
return new CreateVnfNotification.Outputs.Entry();
@@ -153,7 +153,7 @@ public class ObjectFactory {
/**
* Create an instance of {@link QueryVnfNotification.Outputs.Entry }
- *
+ *
*/
public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() {
return new QueryVnfNotification.Outputs.Entry();
@@ -161,52 +161,47 @@ public class ObjectFactory {
/**
* Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "queryVnfNotification")
public JAXBElement<QueryVnfNotification> createQueryVnfNotification(QueryVnfNotification value) {
- return new JAXBElement<QueryVnfNotification>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null,
- value);
+ return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "rollbackVnfNotification")
public JAXBElement<RollbackVnfNotification> createRollbackVnfNotification(RollbackVnfNotification value) {
- return new JAXBElement<RollbackVnfNotification>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class,
- null, value);
+ return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "createVnfNotification")
public JAXBElement<CreateVnfNotification> createCreateVnfNotification(CreateVnfNotification value) {
- return new JAXBElement<CreateVnfNotification>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null,
- value);
+ return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "deleteVnfNotification")
public JAXBElement<DeleteVnfNotification> createDeleteVnfNotification(DeleteVnfNotification value) {
- return new JAXBElement<DeleteVnfNotification>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null,
- value);
+ return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}}
- *
+ *
*/
@XmlElementDecl(namespace = URL, name = "updateVnfNotification")
public JAXBElement<UpdateVnfNotification> createUpdateVnfNotification(UpdateVnfNotification value) {
- return new JAXBElement<UpdateVnfNotification>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null,
- value);
+ return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java
index 8968851fe1..8681070972 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java
@@ -310,7 +310,7 @@ public class QueryVnfNotification {
*/
public List<QueryVnfNotification.Outputs.Entry> getEntry() {
if (entry == null) {
- entry = new ArrayList<QueryVnfNotification.Outputs.Entry>();
+ entry = new ArrayList<>();
}
return this.entry;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java
index b738d6dc64..968b3767c3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java
@@ -266,7 +266,7 @@ public class UpdateVnfNotification {
*/
public List<UpdateVnfNotification.Outputs.Entry> getEntry() {
if (entry == null) {
- entry = new ArrayList<UpdateVnfNotification.Outputs.Entry>();
+ entry = new ArrayList<>();
}
return this.entry;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java
index e1a42706a9..402d0af8e4 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.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,15 +31,16 @@ import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b14002 Generated source version: 2.2
- *
+ *
*/
@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify",
wsdlLocation = "/VnfAdapterNotify.wsdl")
public class VnfAdapterNotify_Service extends Service {
- private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION;
- private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION;
- private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify");
+ private static final URL VNFADAPTERNOTIFY_WSDL_LOCATION;
+ private static final WebServiceException VNFADAPTERNOTIFY_EXCEPTION;
+ private static final String VNF_NOTIFY_URL = "http://org.onap.so/vnfNotify";
+ private static final QName VNFADAPTERNOTIFY_QNAME = new QName(VNF_NOTIFY_URL, "vnfAdapterNotify");
static {
VNFADAPTERNOTIFY_WSDL_LOCATION = org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service.class
@@ -53,11 +54,11 @@ public class VnfAdapterNotify_Service extends Service {
}
public VnfAdapterNotify_Service() {
- super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME);
+ super(getWsdlLocation(), VNFADAPTERNOTIFY_QNAME);
}
public VnfAdapterNotify_Service(WebServiceFeature... features) {
- super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features);
+ super(getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features);
}
public VnfAdapterNotify_Service(URL wsdlLocation) {
@@ -77,28 +78,26 @@ public class VnfAdapterNotify_Service extends Service {
}
/**
- *
+ *
* @return returns VnfAdapterNotify
*/
@WebEndpoint(name = "MsoVnfAdapterAsyncImplPort")
public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() {
- return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"),
- VnfAdapterNotify.class);
+ return super.getPort(new QName(VNF_NOTIFY_URL, "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class);
}
/**
- *
+ *
* @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features
* not in the <code>features</code> parameter will have their default values.
* @return returns VnfAdapterNotify
*/
@WebEndpoint(name = "MsoVnfAdapterAsyncImplPort")
public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) {
- return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"),
- VnfAdapterNotify.class, features);
+ return super.getPort(new QName(VNF_NOTIFY_URL, "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features);
}
- private static URL __getWsdlLocation() {
+ private static URL getWsdlLocation() {
if (VNFADAPTERNOTIFY_EXCEPTION != null) {
throw VNFADAPTERNOTIFY_EXCEPTION;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
index c6fd73d9cb..aebd04f32c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
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
index 9bf2ec73f4..60dfded1f8 100644
--- 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
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index a5e6a4558f..ae15b70b00 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
@@ -50,16 +70,17 @@ 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.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
@@ -323,9 +344,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
} 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);
+ logger.error(LoggingAnchor.NINE, MessageEnum.GENERAL_EXCEPTION, pserverHostName, matchingPifName.get(),
+ cloudOwner, tenantId, "OpenStack", "Heatbridge", ErrorCode.DataError.getValue(),
+ "Exception - Failed to add sriov-pf object to pserver", e);
}
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
index dd64d53732..f2d61d2587 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
@@ -14,10 +34,6 @@ package org.onap.so.heatbridge.constants;
public class HeatBridgeConstants {
- private HeatBridgeConstants() {
- throw new IllegalStateException("Trying to instantiate a constants class.");
- }
-
/**
* Openstack related constants
*/
@@ -70,4 +86,9 @@ public class HeatBridgeConstants {
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";
+
+ private HeatBridgeConstants() {
+ throw new IllegalStateException("Trying to instantiate a constants class.");
+ }
+
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
index edf5e2d339..018a4eac8d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
index bd74bf6aa0..f0c5a0b434 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index 515f2dc0e5..137aaa9f41 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada.
*
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
index fd5dabc784..69c76fad84 100644
--- 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
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
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
index 1fa41ee2a0..7184ec1e93 100644
--- 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
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
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
index a062ca826d..26d92ebb80 100644
--- 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
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
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
index 2843eb226e..5a2b0732dc 100644
--- 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
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
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
index 760be72b3f..95b4cd7cfd 100644
--- 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
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
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
index dddd82ce6a..a0c05b4dba 100644
--- 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
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
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
index 5019eec09b..b00f926e52 100644
--- 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
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
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
index 25b3f1dbeb..bbcd54e6f8 100644
--- 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
@@ -1,4 +1,24 @@
/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*-
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
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
index 9726197172..be086677db 100644
--- 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
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
@@ -20,10 +40,6 @@ 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
*/
@@ -32,6 +48,10 @@ public class HeatBridgeUtils {
private static final String COMPUTE_SIDE_SHARED_SRIOV_PREFIX = "sriov-s-";
private static final String COMPUTE_SIDE_DEDICATED_SRIOV_PREFIX = "sriov-d-";
+ private HeatBridgeUtils() {
+ throw new IllegalStateException("Trying to instantiate a utility class.");
+ }
+
public static Optional<String> getMatchingPserverPifName(@Nonnull final String physicalNetworkName) {
Preconditions.checkState(!Strings.isNullOrEmpty(physicalNetworkName),
"Physical network name is null or " + "empty!");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java
index 0c4b9e01b9..66b2e52570 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java
@@ -25,8 +25,14 @@ package org.onap.so.vdu.utils;
* Enum status values to capture the state of a generic (cloud-agnostic) VDU.
*/
public enum VduStatus {
- NOTFOUND, INSTANTIATING, INSTANTIATED, DELETING, DELETED, // Note - only returned in success response to deleteVdu
- // call.
- UPDATING, FAILED, UNKNOWN
+ NOTFOUND,
+ INSTANTIATING,
+ INSTANTIATED,
+ DELETING,
+ DELETED, // Note - only returned in success response to deleteVdu
+ // call.
+ UPDATING,
+ FAILED,
+ UNKNOWN
}
diff --git a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
deleted file mode 100644
index 2ec5be7448..0000000000
--- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,103 +0,0 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-# MSO Properties go here
-org:
- onap:
- so:
- adapters:
- default_keystone_url_version: /v2.0
- default_keystone_reg_ex: "/[vV][0-9]"
- vnf:
- bpelauth: 1DDAD7A55A230BB446AA2125053EFB46455F43E48B60155E1C53236E175DFC722A6BE120F6DB390C60034C7564AEB653EA
- checkRequiredParameters: true
- addGetFilesOnVolumeReq: false
- sockettimeout: 30
- connecttimeout: 30
- retrycount: 5
- retryinterval: -15
- retrylist: 408,429,500,502,503,504,900
- network:
- bpelauth: 1DDAD7A55A230BB446AA2125053EFB46455F43E48B60155E1C53236E175DFC722A6BE120F6DB390C60034C7564AEB653EA
- sockettimeout: 5
- connecttimeout: 5
- retrycount: 5
- retryinterval: -15
- retrylist: 408,429,500,502,503,504,900
- encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
- tenant:
- default_x_aic_orm_client_string: ECOMP-MSO
- default_keystone_url_version: /v2.0
- default_keystone_reg_ex: "/[vV][0-9]"
- default_tenant_description: ECOMP Tenant
- default_region_type: single
- default_user_role: admin
- default_success_status_string: Success
- default_no_regions_status_string: no regions
- default_orm_request_path: /v1/orm/customers/
- default_orm_url_replace_this: 8080
- default_orm_url_replace_with_this: 7080
- default_quota_value: 10
- set_default_quota: false
- po:
- retryCodes: 504
- retryDelay: 5
- retryCount: 3
- pollTimeout: 7500
- pollInterval: 15
-
-server-port: 8080
-ssl-enable: false
-tomcat:
- max-threads: 50
-mso:
- msoKey: 07a7159d3bf51a0e53be7a8f89699be7
- auth: 6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436
- logPath: logs
- msb-ip: localhost
- msb-port: ${wiremock.server.port}
- workflow:
- endpoint: http://bpmn-infra:8081/sobpmnengine
- topics:
- retryMultiplier: 1000
- config:
- cadi:
- aafId: test
- catalog:
- db:
- spring:
- endpoint: "http://localhost:8080"
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- site-name: localDevEnv
- async:
- core-pool-size: 50
- max-pool-size: 50
- queue-capacity: 500
-
-spring:
- security:
- usercredentials:
- -
- username: sdnc
- password: '$2a$12$mukkC6IvLikKGBdwqGnev.H0ccvV6K13TFeLvyNhJoCuNkRjWhqi6'
- role: SDNC-Client
- -
- username: sitecontrol
- password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu'
- role: SiteControl-Client
- -
- username: bpel
- password: '$2a$12$/GW0/AVAUooTag.7GDc9a.jW7XH3nq/.QsJJJFZJ0N24iXB2W9ksO'
- role: BPEL-Client
- -
- username: sniro
- password: '$2a$12$lbOQWS1iDmdQPxW2Mb6OiuTzGaPUrkrvoKVn2zwpFWb6n5Y86Lf1y'
- role: SNIRO-Client
- -
- username: apih
- password: '$2a$12$e1BGJ7qknMN/b7bqsQvU2OT9iGunt9IlfQclKlCs6n240oHBfcO5y'
- role: MSO-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-
diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
index f66d77db48..ba31daaeaf 100644
--- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml
+++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
@@ -4,7 +4,7 @@
server:
port: 8080
tomcat:
- max-threads: 50
+ max-threads: 75
mso:
logPath: ./logs/openstack
@@ -19,18 +19,22 @@ mso:
retrySequence: 1, 1, 2, 3, 5, 8, 13, 20
spring:
datasource:
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
- initialization-mode: never
+ hikari:
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: catdb-pool
+ registerMbeans: true
jpa:
- show-sql: true
+ show-sql: false
hibernate:
dialect: org.hibernate.dialect.MySQL5Dialect
- ddl-auto: validate
+ ddl-auto: none
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
enable-lazy-load-no-trans: true
+ main:
+ allow-bean-definition-overriding: true
org:
onap:
so:
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/AllTestsTestSuite.java
index a7bddd3ada..a9365a3946 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/AllTestsTestSuite.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnf;
+package org.onap.so;
import org.junit.runner.RunWith;
import com.googlecode.junittoolbox.SuiteClasses;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java
new file mode 100644
index 0000000000..d3380a6a33
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditDataServiceTest.java
@@ -0,0 +1,101 @@
+package org.onap.so.adapters.audit;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class AuditDataServiceTest {
+
+ @InjectMocks
+ AuditDataService auditDataService = new AuditDataService();
+
+ @Mock
+ protected RequestsDbClient requestsDbClient;
+
+ AuditInventory auditInventory = new AuditInventory();
+
+ @Before
+ public void before() throws JsonProcessingException {
+ auditInventory.setCloudOwner("testCloudOwner");
+ auditInventory.setCloudRegion("testLcpCloudRegionId");
+ auditInventory.setHeatStackName("testVfModuleName1");
+ auditInventory.setVfModuleId("testVnfModuleId");
+ auditInventory.setTenantId("testTenantId");
+ auditInventory.setGenericVnfId("testVnfId1");
+ }
+
+ @Test
+ public void testWriteStackDataToRequestDb() throws Exception {
+ Mockito.doReturn(new ArrayList<RequestProcessingData>()).when(requestsDbClient)
+ .getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(), Mockito.any(), Mockito.any());
+ Mockito.doNothing().when(requestsDbClient).saveRequestProcessingData(Mockito.any());
+
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ auditList.setHeatStackName("testHeatStackName");
+ AAIObjectAudit audit = new AAIObjectAudit();
+ Vserver vserver = new Vserver();
+ vserver.setVserverId("testVserverId");
+ audit.setAaiObject(vserver);
+ auditList.getAuditList().add(audit);
+
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ String auditListString = objectMapper.getMapper().writeValueAsString(auditList);;
+
+ RequestProcessingData requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
+ requestProcessingData.setGroupingId(auditInventory.getVfModuleId());
+ requestProcessingData.setName(auditInventory.getHeatStackName());
+ requestProcessingData.setTag("AuditStackData");
+ requestProcessingData.setValue(auditListString);
+
+ auditDataService.writeStackDataToRequestDb(auditInventory, auditList);
+ Mockito.verify(requestsDbClient, Mockito.times(1)).saveRequestProcessingData(requestProcessingData);
+ }
+
+ @Test
+ public void testGetStackDataToRequestDb() throws Exception {
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ auditList.setHeatStackName("testHeatStackName");
+ AAIObjectAudit audit = new AAIObjectAudit();
+ Vserver vserver = new Vserver();
+ vserver.setVserverId("testVserverId");
+ audit.setAaiObject(vserver);
+ auditList.getAuditList().add(audit);
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ String auditListString = objectMapper.getMapper().writeValueAsString(audit);
+
+ List<RequestProcessingData> list = new ArrayList();
+ RequestProcessingData requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setId(234321432);
+ requestProcessingData.setGroupingId("testVfModuleId");
+ requestProcessingData.setName("heatStackName");
+ requestProcessingData.setTag("AuditStackData");
+ requestProcessingData.setValue(auditListString);
+ list.add(requestProcessingData);
+
+ Mockito.doReturn(list).when(requestsDbClient).getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(),
+ Mockito.any(), Mockito.any());
+ auditDataService.getStackDataFromRequestDb(auditInventory);
+ Mockito.verify(requestsDbClient, Mockito.times(1)).getRequestProcessingDataByGroupingIdAndNameAndTag(
+ "testVnfModuleId", "testVfModuleName1", "AuditStackData");
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
index 80b2a21419..3432e4a8b6 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
@@ -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.
@@ -37,8 +37,10 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.core.env.Environment;
import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -47,6 +49,9 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
@InjectMocks
private AuditCreateStackService auditStackService = new AuditCreateStackService();
+ @InjectMocks
+ private AuditQueryStackService auditQueryStackService = new AuditQueryStackService();
+
@Mock
private HeatStackAudit heatStackAuditMock;
@@ -59,6 +64,9 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
@Mock
private ExternalTaskService mockExternalTaskService;
+ @Mock
+ private AuditDataService auditDataService;
+
private ObjectMapper objectMapper = new ObjectMapper();
private AuditInventory auditInventory = new AuditInventory();
@@ -111,6 +119,20 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
}
@Test
+ public void executeExternalTaskQueryAuditTest() throws JsonProcessingException {
+ doReturn(auditListOptSuccess).when(heatStackAuditMock).queryHeatStack("cloudOwner", "cloudRegion", "tenantId",
+ "stackName");
+ Mockito.doNothing().when(auditDataService).writeStackDataToRequestDb(Mockito.any(AuditInventory.class),
+ Mockito.any(AAIObjectAuditList.class));
+ auditQueryStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
+ ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
+ ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class);
+ Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(), captor.capture());
+ Mockito.verify(auditDataService).writeStackDataToRequestDb(Mockito.any(AuditInventory.class),
+ Mockito.any(AAIObjectAuditList.class));
+ }
+
+ @Test
public void execute_external_task_audit_first_failure_Test() {
doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId",
"stackName");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
new file mode 100644
index 0000000000..c9aef950f7
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.audit;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
+import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.core.env.Environment;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AuditStackServiceTest {
+
+ @Spy
+ @InjectMocks
+ AuditStackService auditStackService;
+
+ @Mock
+ Environment mockEnvironment;
+
+
+ @Before
+ public void before() {
+ Mockito.doReturn("5").when(mockEnvironment).getProperty("workflow.topics.maxClients", "10");
+ Mockito.doReturn("6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436")
+ .when(mockEnvironment).getRequiredProperty("mso.auth");
+ Mockito.doReturn("07a7159d3bf51a0e53be7a8f89699be7").when(mockEnvironment).getRequiredProperty("mso.msoKey");
+ Mockito.doReturn("something").when(mockEnvironment).getRequiredProperty("mso.config.cadi.aafId");
+ Mockito.doReturn("host.com").when(mockEnvironment).getRequiredProperty("mso.workflow.endpoint");
+ }
+
+ @Test
+ public void testGetMaxClients() throws Exception {
+ int actual = auditStackService.getMaxClients();
+ assertEquals(5, actual);
+ }
+
+ @Test
+ public void testCreateClientRequestInterceptor() throws Exception {
+ String auth = CryptoUtils.decrypt(
+ "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436",
+ "07a7159d3bf51a0e53be7a8f89699be7");
+ ClientRequestInterceptor expected = new BasicAuthProvider("something", auth);
+ ClientRequestInterceptor actual = auditStackService.createClientRequestInterceptor();
+ assertThat(actual, sameBeanAs(expected));
+
+ }
+
+ @Test
+ public void testCreateExternalTaskClient() throws Exception {
+ String auth = CryptoUtils.decrypt(
+ "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436",
+ "07a7159d3bf51a0e53be7a8f89699be7");
+ ClientRequestInterceptor inter = new BasicAuthProvider("something", auth);
+ Mockito.doReturn(inter).when(auditStackService).createClientRequestInterceptor();
+ ExternalTaskClient actual = auditStackService.createExternalTaskClient();
+ assertNotNull(actual);
+ Mockito.verify(auditStackService, Mockito.times(1)).createClientRequestInterceptor();
+
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
index d43dbd99f9..3d9a128318 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
@@ -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,14 +33,19 @@ import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipList;
+import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
@@ -48,6 +53,8 @@ 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.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParseException;
@@ -361,6 +368,69 @@ public class AuditVServerTest extends AuditVServer {
JSONAssert.assertEquals(expected, actualString, false);
}
+ @Test
+ public void testAuditVserversWithList() {
+
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ AAIObjectAudit obj1 = new AAIObjectAudit();
+ Vserver vserver = new Vserver();
+ vserver.setVserverId("testVserverId");
+ obj1.setAaiObject(vserver);
+ obj1.setResourceURI(AAIUriFactory
+ .createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenantId, "testVserverId").build());
+ auditList.getAuditList().add(obj1);
+
+ doReturn(false).when(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
+ cloudRegion, tenantId, "testVserverId"));
+
+ auditNova.auditVservers(auditList);
+
+ Mockito.verify(aaiResourcesMock).exists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
+ cloudRegion, tenantId, "testVserverId"));
+
+ Assert.assertEquals(false, auditList.getAuditList().get(0).isDoesObjectExist());
+ }
+
+ @Test
+ public void testAuditVserversThroughRelationships() {
+
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("id");
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
+
+ doReturn(wrapper).when(aaiResourcesMock)
+ .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
+ .queryParam("vf-module-name", "vfModuleName"));
+
+ Optional<AAIObjectAuditList> auditList =
+ auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
+
+ Assert.assertTrue(auditList.get().getAuditList().isEmpty());
+ }
+
+ @Test
+ public void testAuditVserversThroughRelationships_exists() throws IOException {
+
+ String vfModule = getJson("vfModule.json");
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
+ AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver());
+
+ doReturn(wrapper).when(aaiResourcesMock)
+ .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
+ .queryParam("vf-module-name", "vfModuleName"));
+
+ doReturn(vserverWrapper).when(aaiResourcesMock).get(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
+ "cloud-owner", "cloud-region-id", "tenant-id", "VUSCHGA1"));
+
+ Optional<AAIObjectAuditList> auditList =
+ auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
+
+ Assert.assertFalse(auditList.get().getAuditList().isEmpty());
+ }
+
+
private String getJson(String filename) throws IOException {
return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename)));
}
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 bc7ce53b8d..c995064ab2 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
@@ -43,6 +43,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.skyscreamer.jsonassert.JSONAssert;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
index 0fd2bd4b7f..8226f4fed8 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
@@ -38,12 +38,12 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.onap.so.adapters.audit.AAIObjectAuditList;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
index c358d3f34c..8dc9d7fe5c 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.inventory.create;
import static org.mockito.Mockito.doReturn;
@@ -10,9 +30,9 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.onap.so.adapters.audit.AAIObjectAudit;
-import org.onap.so.adapters.audit.AAIObjectAuditList;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonProcessingException;
public class CreateInventoryTaskTest {
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java
index eb8912f56d..830d94cf85 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java
@@ -27,8 +27,8 @@ public class ContrailSubnetHostRoutesTest {
@Test
public void testContrailSubnetHostRoutes() {
- cshr.setHost_routes(host_routes);
- assertEquals(cshr.getHost_routes(), host_routes);
+ cshr.setHostRoutes(host_routes);
+ assertEquals(cshr.getHostRoutes(), host_routes);
assert (cshr.toString() != null);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
index 4dcb7c8710..add1918748 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
@@ -20,18 +20,6 @@
package org.onap.so.adapters.network;
-import org.apache.http.HttpStatus;
-import org.junit.Test;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.util.UriComponentsBuilder;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteNeutronNetwork;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStack_200;
@@ -52,6 +40,18 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGet;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackPost;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import org.onap.so.adapters.vnf.BaseRestTestUtils;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@@ -142,12 +142,12 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
+ mockOpenStackGetStack_404(wireMockServer, "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc/stackId");
+ "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
@@ -163,7 +163,7 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc");
+ "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
String uri = "/services/NetworkAdapter";
headers.set("X-ECOMP-RequestID", "123456789456127");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
index e481f0d03f..1a44934187 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
@@ -67,7 +67,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
public void testCreateTenantCreated() throws JsonParseException, JsonMappingException, IOException {
CreateTenantRequest request = new CreateTenantRequest();
- String cloudSiteId = "MTN13";
+ String cloudSiteId = "mtn13";
String requestId = "62265093-277d-4388-9ba6-449838ade586";
String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
String tenantName = "testingTenantName";
@@ -117,7 +117,7 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
public void testCreateTenantExists() throws JsonParseException, JsonMappingException, IOException {
CreateTenantRequest request = new CreateTenantRequest();
- String cloudSiteId = "MTN13";
+ String cloudSiteId = "mtn13";
String requestId = "62265093-277d-4388-9ba6-449838ade586";
String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
String tenantName = "testingTenantName";
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
index 102d748d56..92bac7a14b 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
@@ -30,7 +30,6 @@ import java.io.IOException;
import javax.ws.rs.core.MediaType;
import org.apache.http.HttpStatus;
import org.junit.Before;
-import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication;
import org.onap.so.cloud.CloudConfig;
@@ -39,7 +38,6 @@ 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.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -70,7 +68,6 @@ public abstract class BaseRestTestUtils {
CloudConfig cloudConfig;
@Autowired
- @Qualifier("JettisonStyle")
protected TestRestTemplate restTemplate;
protected HttpHeaders headers = new HttpHeaders();
@@ -118,9 +115,10 @@ public abstract class BaseRestTestUtils {
wireMockServer.resetAll();
mapper = new ObjectMapper();
CloudIdentity identity = new CloudIdentity();
- identity.setId("MTN13");
+ identity.setId("DEFAULT");
identity.setMsoId("m93945");
- identity.setMsoPass("93937EA01B94A10A49279D4572B48369");
+ identity.setMsoPass(
+ "89C9F27833AC49FE4164F3608CADE7BCF40357977607A7E4B899F9A046C0071C75F7347A47308EF9FB6620214264B1");
identity.setAdminTenant("admin");
identity.setMemberRole("admin");
identity.setTenantMetadata(new Boolean(true));
@@ -137,29 +135,14 @@ public abstract class BaseRestTestUtils {
identity.setIdentityServerType(ServerType.KEYSTONE);
cloudSite.setIdentityService(identity);
- wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/MTN13"))
- .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, ""))
- .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT"))
.willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, ""))
.withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13"))
- .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(identity), wireMockPort, ""))
- .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .withStatus(HttpStatus.SC_OK)));
- cloudConfig.getCloudSite("MTN13").get().getIdentityService()
- .setIdentityUrl("http://localhost:" + wireMockPort + cloudEndpoint);
}
protected static String getBody(String body, int port, String urlPath) throws IOException {
return body.replaceAll("port", "http://localhost:" + port + urlPath);
}
- @Test
- public void testNothing() {
-
- }
-
}
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 0c56222558..651e2c9a73 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
@@ -36,12 +36,10 @@ import java.util.Map;
import java.util.Set;
import javax.xml.ws.Holder;
import org.apache.http.HttpStatus;
-import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.mockito.MockitoAnnotations;
import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
@@ -58,7 +56,6 @@ import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import com.github.tomakehurst.wiremock.client.WireMock;
public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@@ -92,7 +89,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- instance.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
+ 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>());
@@ -514,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", "CloudOwner", "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>());
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 3e5d4ad29a..16cc2c34de 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
@@ -62,40 +62,37 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369");
}
- @Test
- public void queryVnfExceptionTest() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- Holder<Map<String, String>> outputs = new Holder<>();
- instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(),
- new Holder<>(), outputs);
-
- assertTrue(outputs.value.isEmpty());
- }
-
- @Test
- public void queryVnfTest() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
- .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
- .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
- .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens"))
- .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK)));
-
- instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(),
- new Holder<>(), new Holder<>());
- }
+ /*
+ * @Test public void queryVnfExceptionTest() throws Exception { MsoRequest msoRequest = new MsoRequest();
+ * msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); Holder<Map<String, String>> outputs =
+ * new Holder<>(); instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new
+ * Holder<>(), new Holder<>(), outputs);
+ *
+ * assertTrue(outputs.value.isEmpty()); }
+ */
+
+ /*
+ * @Test public void queryVnfTest() throws Exception {
+ *
+ *
+ * MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345");
+ * msoRequest.setServiceInstanceId("12345");
+ * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
+ * .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
+ *
+ * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
+ * .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
+ * .withStatus(HttpStatus.SC_OK)));
+ *
+ * wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
+ * .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
+ * .withStatus(HttpStatus.SC_OK)));
+ *
+ * instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), new
+ * Holder<>(), new Holder<>());
+ *
+ * }
+ */
@Test
public void deleteVfModuleTest_ExceptionWhileQueryDeployment() throws Exception {
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 be565deb9e..7ec8e51892 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
@@ -93,7 +93,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
+ 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>());
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 0787cef75d..d611322c02 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
/*
* Copyright (C) 2018 Bell Canada. All rights reserved.
*
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
index b9fc419a65..5ee33ab3dc 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml
@@ -4,7 +4,7 @@
<cloudSiteId>mtn13</cloudSiteId>
<tenantId>bef254252c5d44e6bcec65c180180ab5</tenantId>
<networkType>CONTRAIL30_GNDIRECT</networkType>
- <networkName>dvspg-VCE_VPE-mtjnj40avbc</networkName>
+ <networkName>DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001</networkName>
<physicalNetworkName>dvs-mtjnj-01</physicalNetworkName>
<vlans>3014</vlans>
<failIfExists>false</failIfExists>
diff --git a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
index 0d403a62b5..d4e84fb3c9 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
@@ -90,7 +90,7 @@
"resource_status_reason": "state changed",
"resource_type": "OS::Heat::ResourceGroup",
"updated_time": "2019-01-23T19:34:15Z"
- },
+ },
{
"links": [
{
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
index b78f700fd9..934e075220 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json
@@ -1,11 +1,11 @@
{
"createTenantResponse": {
- "cloudSiteId": "MTN13",
+ "cloudSiteId": "mtn13",
"tenantId": "tenantId",
"tenantCreated": true,
"tenantRollback": {
"tenantId": "tenantId",
- "cloudId": "MTN13",
+ "cloudId": "mtn13",
"tenantCreated": true,
"msoRequest": {
"requestId": "62265093-277d-4388-9ba6-449838ade586",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
index 977aa542b3..6f81ebcd36 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json
@@ -1,10 +1,10 @@
{
"createTenantResponse": {
- "cloudSiteId": "MTN13",
+ "cloudSiteId": "mtn13",
"tenantId": "tenantId",
"tenantCreated": false,
"tenantRollback": {
- "cloudId": "MTN13",
+ "cloudId": "mtn13",
"tenantCreated": false,
"msoRequest": {
"requestId": "62265093-277d-4388-9ba6-449838ade586",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
index af63ca7de4..be50d09ef6 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json
@@ -1,17 +1,15 @@
{
- "stack": {
- "description": null,
- "links": null,
- "stackStatusReason": null,
- "stackName": null,
- "updatedTime": null,
- "creationTime": null,
- "stackStatus": "NOT_FOUND",
- "id": "stackId",
- "files": null,
- "outputs": null,
- "parameters": {
-
- }
- }
-} \ No newline at end of file
+ "stack": {
+ "creationTime": null,
+ "description": null,
+ "files": null,
+ "id": "stackId",
+ "links": null,
+ "outputs": null,
+ "parameters": {},
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "stack_status": "CREATE_IN_PROGRESS",
+ "stack_status_reason": null,
+ "updatedTime": null
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
index 29893ccb7b..e49d407766 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json
@@ -1,17 +1,15 @@
{
- "stack": {
- "description": null,
- "links": null,
- "stack_status_reason": null,
- "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
- "updated_time": null,
- "creation_time": null,
- "stack_status": "CREATE_COMPLETE",
- "id": "stackId",
- "files": null,
- "outputs": null,
- "parameters": {
-
- }
- }
-} \ No newline at end of file
+ "stack": {
+ "creationTime": null,
+ "description": null,
+ "files": null,
+ "id": "stackId",
+ "links": null,
+ "outputs": null,
+ "parameters": {},
+ "stack_name": "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001",
+ "stack_status": "CREATE_COMPLETE",
+ "stack_status_reason": "Create Completed",
+ "updatedTime": null
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
index 8612258eee..bad85f37c8 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
@@ -3,7 +3,7 @@
"description": null,
"links": null,
"stackStatusReason": null,
- "stackName": null,
+ "stackName": "stackName",
"updatedTime": null,
"creationTime": null,
"stack_status": "DELETE_COMPLETE",
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
index f4a3c520ba..70c78a6047 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json
@@ -7,6 +7,7 @@
"rel" : "self"
}
],
- "stack_name": "vnfBaseStack"
+ "stack_name": "vnfBaseStack",
+ "stack_status": "CREATE_COMPLETE"
}
} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml
index d1a5bd9fa3..20384465a1 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml
@@ -113,3 +113,20 @@ management:
endpoint:
info:
enabled: true
+
+appc:
+ client:
+ key: iaEMAfjsVsZnraBP
+ response:
+ timeout: '120000'
+ secret: wcivUjsjXzmGFBfxMmyJu9dz
+ poolMembers: localhost
+ service: ueb
+ topic:
+ read:
+ name: APPC-TEST-AMDOCS2
+ timeout: '120000'
+ write: APPC-TEST-AMDOCS1-DEV3
+ sdnc:
+ read: SDNC-LCM-READ
+ write: SDNC-LCM-WRITE \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
index 694aedae10..7cc7697129 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -63,6 +63,8 @@ ssl-enable: false
tomcat:
max-threads: 50
mso:
+ audit:
+ lock-time: 240000
logPath: logs
msb-ip: localhost
msb-port: ${wiremock.server.port}
@@ -106,7 +108,6 @@ mariaDB4j:
port: 3308
databaseName: catalogdb
-
#Actuator
management:
endpoints:
@@ -121,3 +122,20 @@ management:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
step: 1m # Step size (i.e. reporting frequency) to use.
+
+appc:
+ client:
+ key: iaEMAfjsVsZnraBP
+ response:
+ timeout: '120000'
+ secret: wcivUjsjXzmGFBfxMmyJu9dz
+ poolMembers: localhost
+ service: ueb
+ topic:
+ read:
+ name: APPC-TEST-AMDOCS2
+ timeout: '120000'
+ write: APPC-TEST-AMDOCS1-DEV3
+ sdnc:
+ read: SDNC-LCM-READ
+ write: SDNC-LCM-WRITE
diff --git a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
index 5d6eee746f..8bfa6d83c3 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
+++ b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
@@ -29,25 +29,15 @@
</appender>
- <logger name="com.att.eelf.audit" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.metrics" level="INFO" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
- <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <logger name="com.woorea.openstack" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
<logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
-
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
+
<root level="WARN">
<appender-ref ref="STDOUT" />
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index dbb3469e77..9406bc445d 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -803,6 +803,9 @@ CREATE TABLE `service` (
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_ORDER` varchar(200) default NULL,
+ `OVERALL_DISTRIBUTION_STATUS` varchar(45),
+ `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL,
+ `NAMING_POLICY` varchar(200) DEFAULT NULL,
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -1106,6 +1109,8 @@ CREATE TABLE `vnf_resource_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
+ `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
@@ -1132,6 +1137,8 @@ CREATE TABLE `vnfc_customization` (
`MODEL_NAME` varchar(200) NOT NULL,
`TOSCA_NODE_TYPE` varchar(200) NOT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
+ `VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID` integer DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -1196,6 +1203,14 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` (
PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`)
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE IF NOT EXISTS `homing_instances` (
+`SERVICE_INSTANCE_ID` varchar(50) NOT NULL,
+`CLOUD_OWNER` VARCHAR(200) NOT NULL,
+`CLOUD_REGION_ID` VARCHAR(200) NOT NULL,
+`OOF_DIRECTIVES` longtext NULL DEFAULT NULL,
+PRIMARY KEY (`SERVICE_INSTANCE_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
CREATE TABLE IF NOT EXISTS `workflow` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ARTIFACT_UUID` varchar(200) NOT NULL,
@@ -1226,4 +1241,134 @@ CREATE TABLE IF NOT EXISTS `vnf_resource_to_workflow` (
CONSTRAINT `fk_vnf_resource_to_workflow__workflow1` FOREIGN KEY (`WORKFLOW_ID`) REFERENCES `workflow` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE IF NOT EXISTS `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 `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 `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 `activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_workflow_activity_spec_sequence__workflow1`
+ FOREIGN KEY (`WORKFLOW_ID`)
+ REFERENCES `workflow` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `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 `activity_spec_categories` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `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 `activity_spec_to_activity_spec_categories` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `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 `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 `activity_spec_categories` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `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 `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 `activity_spec_parameters` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS `activity_spec_to_user_parameters` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `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 `activity_spec` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `fk_activity_spec_to_user_parameters__user_parameters1`
+ FOREIGN KEY (`USER_PARAMETERS_ID`)
+ REFERENCES `user_parameters` (`ID`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = latin1;
diff --git a/adapters/mso-openstack-adapters/src/test/resources/vfModule.json b/adapters/mso-openstack-adapters/src/test/resources/vfModule.json
new file mode 100644
index 0000000000..bfdca2c144
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/vfModule.json
@@ -0,0 +1,38 @@
+{
+ "vf-module-id": "a62d14f0-421e-4e64-980a-a368722819db",
+ "vf-module-name": "vig30001vm001vig001_migrated.base.module-0",
+ "is-base-vf-module": false,
+ "resource-version": "1494001780539",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner/cloud-region-id/tenants/tenant/tenant-id/vservers/vserver/VUSCHGA1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloud-owner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "cloud-region-id"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenant-id"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "VUSCHGA1"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "VUSCHGA1"
+ }
+ ]
+ }
+ ]
+ }
+ }
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 02b44efe1c..8c4150cd50 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
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
+import org.onap.so.logger.LoggingAnchor;
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;
@@ -145,8 +146,8 @@ public class ArchiveInfraRequestsScheduler {
newArchivedReqs.add(archivedInfra);
oldInfraReqs.add(iar);
} catch (Exception e) {
- logger.error("{} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode.UnknownError.getValue(),
- e);
+ logger.error(LoggingAnchor.TWO, 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/RequestDbRepositoryConfiguration.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/RequestDbRepositoryConfiguration.java
new file mode 100644
index 0000000000..c32525a62b
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/RequestDbRepositoryConfiguration.java
@@ -0,0 +1,23 @@
+package org.onap.so.adapters.requestsdb;
+
+import java.util.stream.Collectors;
+import javax.persistence.EntityManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
+import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter;
+
+@Configuration
+public class RequestDbRepositoryConfiguration extends RepositoryRestConfigurerAdapter {
+
+ @Autowired
+ private EntityManager entityManager;
+
+ @Override
+ public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
+ config.exposeIdsFor(entityManager.getMetamodel().getEntities().stream().map(e -> e.getJavaType())
+ .collect(Collectors.toList()).toArray(new Class[0]));
+ }
+
+
+}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java
index a2c1f135c2..b8bada298e 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 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
@@ -34,8 +36,8 @@ public class WebSecurityConfigImpl extends WebSecurityConfig {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
- .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString())
- .and().httpBasic();
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+ .httpBasic();
}
@Override
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
index 6dab6c188c..85c05decb1 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
@@ -27,6 +27,9 @@ import javax.sql.DataSource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.EnableMBeanExport;
+import org.springframework.jmx.support.RegistrationPolicy;
+import org.springframework.scheduling.annotation.EnableScheduling;
import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider;
import net.javacrumbs.shedlock.spring.ScheduledLockConfiguration;
@@ -38,6 +41,8 @@ import net.javacrumbs.shedlock.spring.ScheduledLockConfigurationBuilder;
*/
@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+@EnableScheduling
+@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
public class MSORequestDBApplication {
private static final String LOGS_DIR = "logs_dir";
@@ -50,6 +55,7 @@ public class MSORequestDBApplication {
public static void main(String... args) {
SpringApplication.run(MSORequestDBApplication.class, args);
+ java.security.Security.setProperty("networkaddress.cache.ttl", "10");
setLogsDir();
}
@@ -64,5 +70,4 @@ public class MSORequestDBApplication {
.withDefaultLockAtMostFor(Duration.ofMinutes(10)).build();
}
-
}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.java
index 651cce8543..d27c891304 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.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
@@ -23,8 +25,8 @@ package org.onap.so.adapters.requestsdb.application;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
@@ -32,10 +34,13 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jmx.export.MBeanExporter;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
@Profile({"!test"})
@Configuration
@@ -44,13 +49,25 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"})
public class RequestDBConfig {
- @Primary
+ @Autowired(required = false)
+ private MBeanExporter mBeanExporter;
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari")
+ public HikariConfig requestDbConfig() {
+ return new HikariConfig();
+ }
+
@Bean(name = "requestDataSource")
- @ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
- return DataSourceBuilder.create().build();
+ if (mBeanExporter != null) {
+ mBeanExporter.addExcludedBean("requestDataSource");
+ }
+ HikariConfig hikariConfig = this.requestDbConfig();
+ return new HikariDataSource(hikariConfig);
}
+
@Primary
@Bean(name = "requestEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml
deleted file mode 100644
index 5d3a837180..0000000000
--- a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,51 +0,0 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-
-server:
- port: 8090
- tomcat:
- max-threads: 50
-ssl-enable: false
-mso:
- adapters:
- requestDb:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- endpoint: http://localhost:8081
- logPath: logs
- site-name: localSite
- infra-requests:
- archived:
- period: 180
-spring:
- datasource:
- url: jdbc:mariadb://localhost:3306/requestdb
- username: catalog
- password: catalog123
- driver-class-name: org.mariadb.jdbc.Driver
- initialize: true
- initialization-mode: never
- jpa:
- generate-ddl: false
- show-sql: false
- hibernate:
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable-lazy-load-no-trans: true
- database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
- security:
- usercredentials:
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-
-
-flyway:
- baseline-on-migrate: false
- url: jdbc:mariadb://localhost:3306/requestdb
- user: catalog
- password: catalog123
- \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml
index 645a6e9e38..17b014b993 100644
--- a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml
@@ -18,10 +18,13 @@ mso:
# H2
spring:
datasource:
- jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
+ hikari:
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: reqdb-pool
+ registerMbeans: true
flyway:
baseline-on-migrate: false
url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
@@ -44,6 +47,8 @@ spring:
username: mso_admin
password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
role: ACTUATOR
+ main:
+ allow-bean-definition-overriding: true
#Actuator
management:
@@ -57,4 +62,4 @@ management:
export:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
- step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file
+ step: 1m # Step size (i.e. reporting frequency) to use.
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.10__Add_Column_IS_DATA_INTERNAL.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.10__Add_Column_IS_DATA_INTERNAL.sql
new file mode 100644
index 0000000000..2196d11e07
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.10__Add_Column_IS_DATA_INTERNAL.sql
@@ -0,0 +1,3 @@
+use requestdb;
+
+ALTER TABLE request_processing_data ADD COLUMN IF NOT EXISTS IS_DATA_INTERNAL TINYINT NOT NULL DEFAULT '0'; \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.7__Add_OpenStack_Request_Information.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.7__Add_OpenStack_Request_Information.sql
new file mode 100644
index 0000000000..5635a1eb80
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.7__Add_OpenStack_Request_Information.sql
@@ -0,0 +1,13 @@
+use requestdb;
+
+CREATE TABLE IF NOT EXISTS cloud_api_requests(
+`ID` INT(13) NOT NULL AUTO_INCREMENT,
+`REQUEST_BODY` LONGTEXT NOT NULL,
+`CLOUD_IDENTIFIER` VARCHAR(200) NULL,
+`SO_REQUEST_ID` VARCHAR(45) NOT NULL,
+`CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`ID`),
+CONSTRAINT fk_cloud_api_req_infra_requests
+ FOREIGN KEY (SO_REQUEST_ID)
+ REFERENCES infra_active_requests (REQUEST_ID))
+ENGINE = InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.8__Add_Column_Original_Request_Id.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.8__Add_Column_Original_Request_Id.sql
new file mode 100644
index 0000000000..54c3c8af60
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.8__Add_Column_Original_Request_Id.sql
@@ -0,0 +1,4 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS ORIGINAL_REQUEST_ID varchar(45);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS ORIGINAL_REQUEST_ID varchar(45); \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.9__Add_Column_Ext_System_Error_Source.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.9__Add_Column_Ext_System_Error_Source.sql
new file mode 100644
index 0000000000..e76dbbe883
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V5.9__Add_Column_Ext_System_Error_Source.sql
@@ -0,0 +1,4 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS EXT_SYSTEM_ERROR_SOURCE varchar(80);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS EXT_SYSTEM_ERROR_SOURCE varchar(80); \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.1__Add_Column_Rollback_Ext_System_Error_Source.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.1__Add_Column_Rollback_Ext_System_Error_Source.sql
new file mode 100644
index 0000000000..a4009be326
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.1__Add_Column_Rollback_Ext_System_Error_Source.sql
@@ -0,0 +1,4 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS ROLLBACK_EXT_SYSTEM_ERROR_SOURCE varchar(80);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS ROLLBACK_EXT_SYSTEM_ERROR_SOURCE varchar(80); \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.2__Expand_Column_Size_Infra_Active_Requests_Request_Status.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.2__Expand_Column_Size_Infra_Active_Requests_Request_Status.sql
new file mode 100644
index 0000000000..427eb0bf07
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.2__Expand_Column_Size_Infra_Active_Requests_Request_Status.sql
@@ -0,0 +1,3 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests MODIFY COLUMN REQUEST_STATUS varchar(25) NULL; \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.3__Expand_Column_Size_Archived_Infra_Active_Requests_Request_Status.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.3__Expand_Column_Size_Archived_Infra_Active_Requests_Request_Status.sql
new file mode 100644
index 0000000000..0780a611db
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.3__Expand_Column_Size_Archived_Infra_Active_Requests_Request_Status.sql
@@ -0,0 +1,3 @@
+use requestdb;
+
+ALTER TABLE archived_infra_requests MODIFY COLUMN REQUEST_STATUS varchar(25) NULL; \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java
index cb6feacfb2..6ef228ef79 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/RequestsAdapterBase.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.adapters.requestsdb;
import org.junit.runner.RunWith;
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 514e5ad923..9faba0df67 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
@@ -50,35 +50,10 @@ public class HealthCheckHandlerTest extends RequestsAdapterBase {
@Test
public void testHealthcheck() throws JSONException {
- TestAppender.events.clear();
HttpEntity<String> entity = new HttpEntity<String>(null, headers);
-
ResponseEntity<String> response =
restTemplate.exchange(createURLWithPort("/manage/health"), HttpMethod.GET, entity, String.class);
-
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("/manage/health", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor")
- && logEvent.getMarker() != null && logEvent.getMarker() != null
- && logEvent.getMarker().getName().equals("EXIT")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("200", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
- assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("/manage/health", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("COMPLETED", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- }
- TestAppender.events.clear();
}
private String createURLWithPort(String uri) {
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
index 3b737c6768..49291b6863 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java
@@ -20,11 +20,22 @@
package org.onap.so.adapters.requestsdb.client;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.onap.so.adapters.requestsdb.RequestsAdapterBase;
-import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
+import org.onap.so.db.request.beans.CloudApiRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
@@ -32,20 +43,6 @@ import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
-import java.util.List;
-import java.util.UUID;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertFalse;
public class RequestsDbClientTest extends RequestsAdapterBase {
@@ -85,9 +82,46 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
infraActiveRequests.setRequestStatus("IN_PROGRESS");
infraActiveRequests.setAction("create");
infraActiveRequests.setRequestAction("someaction");
+ infraActiveRequests.setStartTime(new Timestamp(System.currentTimeMillis()));
infraActiveRequests
.setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances");
+ List<CloudApiRequests> cloudApiRequests = new ArrayList<>();
+ CloudApiRequests cloudRequest = new CloudApiRequests();
+ cloudRequest.setCloudIdentifier("heatstackanme/id");
+ cloudRequest.setId(1);
+ cloudRequest.setRequestBody("requestBody");
+ cloudRequest.setRequestId(infraActiveRequests.getRequestId());
+ cloudApiRequests.add(cloudRequest);
+ infraActiveRequests.setCloudApiRequests(cloudApiRequests);
requestsDbClient.save(infraActiveRequests);
+
+ InfraActiveRequests infraActiveRequests2 = new InfraActiveRequests();
+ infraActiveRequests2.setRequestId(UUID.randomUUID().toString());
+ infraActiveRequests2.setOperationalEnvId(UUID.randomUUID().toString());
+ infraActiveRequests2.setServiceInstanceId(UUID.randomUUID().toString());
+ infraActiveRequests2.setServiceInstanceName("serviceInstanceNameTest");
+ infraActiveRequests2.setVnfId(UUID.randomUUID().toString());
+ infraActiveRequests2.setVnfName("vnfInstanceNameTest");
+ infraActiveRequests2.setVfModuleId(UUID.randomUUID().toString());
+ infraActiveRequests2.setVfModuleName("vfModuleInstanceNameTest");
+ infraActiveRequests2.setVolumeGroupId(UUID.randomUUID().toString());
+ infraActiveRequests2.setVolumeGroupName("volumeGroupInstanceNameTest");
+ infraActiveRequests2.setNetworkId(UUID.randomUUID().toString());
+ infraActiveRequests2.setNetworkName("networkInstanceNameTest");
+ infraActiveRequests2.setConfigurationId(UUID.randomUUID().toString());
+ infraActiveRequests2.setConfigurationName("configurationInstanceNameTest");
+ infraActiveRequests2.setAicCloudRegion("1");
+ infraActiveRequests2.setTenantId(UUID.randomUUID().toString());
+ infraActiveRequests2.setRequestScope("operationalEnvironment");
+ infraActiveRequests2.setRequestorId(UUID.randomUUID().toString());
+ infraActiveRequests2.setSource("sourceTest");
+ infraActiveRequests2.setOperationalEnvName(UUID.randomUUID().toString());
+ infraActiveRequests2.setRequestStatus("IN_PROGRESS");
+ infraActiveRequests2.setAction("create");
+ infraActiveRequests2.setRequestAction("someaction");
+ infraActiveRequests2.setStartTime(new Timestamp(System.currentTimeMillis()));
+ infraActiveRequests
+ .setRequestUrl("http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances");
}
private void verifyOperationStatus(OperationStatus request, OperationStatus response) {
@@ -96,7 +130,8 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
private void verifyInfraActiveRequests(InfraActiveRequests infraActiveRequestsResponse) {
- assertThat(infraActiveRequestsResponse, sameBeanAs(infraActiveRequests).ignoring("modifyTime").ignoring("log"));
+ assertThat(infraActiveRequestsResponse, sameBeanAs(infraActiveRequests).ignoring("modifyTime").ignoring("log")
+ .ignoring("cloudApiRequests.created").ignoring("cloudApiRequests.id"));
}
@Test
@@ -113,7 +148,6 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
verifyInfraActiveRequests(infraActiveRequestsResponse);
}
-
@Test
public void checkVnfIdStatusTest() {
InfraActiveRequests infraActiveRequestsResponse =
@@ -182,7 +216,7 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
public void getInfraActiveRequestbyRequestIdWhereRequestUrlNullTest() {
// requestUrl setup to null and save
infraActiveRequests.setRequestUrl(null);
- requestsDbClient.save(infraActiveRequests);
+ requestsDbClient.updateInfraActiveRequests(infraActiveRequests);
InfraActiveRequests infraActiveRequestsResponse =
requestsDbClient.getInfraActiveRequestbyRequestId(infraActiveRequests.getRequestId());
verifyInfraActiveRequests(infraActiveRequestsResponse);
@@ -223,6 +257,7 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
assertEquals(2, requestProcessingDataList.size());
}
+
@Test
public void findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdTest() {
OperationalEnvServiceModelStatus operationalEnvServiceModelStatus =
@@ -259,4 +294,24 @@ public class RequestsDbClientTest extends RequestsAdapterBase {
assertEquals("ERROR", operationalEnvDistributionStatus.getDistributionIdErrorReason());
assertEquals("00032ab7-3fb3-42e5-965d-8ea592502017", operationalEnvDistributionStatus.getRequestId());
}
+
+ @Test
+ public void getRequestProcessingDataBySoRequestIdAndName() {
+ RequestProcessingData requestProcessingData = requestsDbClient
+ .getRequestProcessingDataBySoRequestIdAndNameAndGrouping("00032ab7-na18-42e5-965d-8ea592502018",
+ "requestAction", "7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ assertNotNull(requestProcessingData);
+
+ }
+
+ @Test
+ public void getInfraActiveRequestbyRequestId_Filters_Test() {
+ Map<String, String[]> filters = new HashMap<>();
+ filters.put("requestStatus", new String[] {"EQ", "IN_PROGRESS"});
+ filters.put("action", new String[] {"EQ", "create"});
+ filters.put("serviceInstanceId", new String[] {"EQ", infraActiveRequests.getServiceInstanceId()});
+ List<InfraActiveRequests> infraActiveRequestsResponse = requestsDbClient.getRequest(filters);
+
+ verifyInfraActiveRequests(infraActiveRequestsResponse.get(0));
+ }
}
diff --git a/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml b/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml
index d1596cd374..a63bd27378 100644
--- a/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml
+++ b/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml
@@ -1,18 +1,7 @@
<configuration>
- <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
- <property name="p_lvl" value="%level"/>
- <property name="p_log" value="%logger"/>
- <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>
- <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>
- <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>
- <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
- <property name="p_thr" value="%thread"/>
- <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/>
-
-
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
- <pattern>${pattern}</pattern>
+ <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
</encoder>
</appender>
@@ -44,6 +33,10 @@
<logger name="ch.vorburger" level="WARN" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
+
+ <logger name="org.hibernate" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
<root level="WARN">
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
index a38d057e49..55023088bc 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Copyright (C) 2019 IBM
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,11 +24,9 @@ package org.onap.so.adapters.sdnc;
import java.util.concurrent.Executor;
import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
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 d48013b80d..b96a564b1a 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
@@ -30,6 +30,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -59,18 +60,18 @@ public class SDNCAdapterService extends Service {
try {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl");
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if (wsdlUrl == null) {
- logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
ErrorCode.DataError.getValue(), "WSDL not found");
} else {
try {
- logger.info("{} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL,
+ logger.info(LoggingAnchor.THREE, 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,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL,
ErrorCode.DataError.getValue(), "Exception - print URL", e);
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java
index e1eb9ecef9..232381385f 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 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
@@ -34,8 +36,8 @@ public class WebSecurityConfigImpl extends WebSecurityConfig {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info", "/services").permitAll()
- .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString())
- .and().httpBasic();
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+ .httpBasic();
}
@Override
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 97a6860dfe..577b550be6 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
@@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -122,7 +123,7 @@ public class SDNCAdapterCallbackRequest {
m.marshal(this, w);
return w.toString();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), ErrorCode.DataError.getValue(),
+ logger.error(LoggingAnchor.THREE, 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 72d18bd1ce..87620743d7 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
@@ -29,6 +29,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -57,18 +58,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",
- ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ "SDNC", ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if (wsdlUrl == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
- ErrorCode.DataError.getValue(), "WSDL not found");
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ "SDNC", ErrorCode.DataError.getValue(), "WSDL not found");
} else {
try {
- logger.info("{} {} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ logger.info(LoggingAnchor.FOUR, 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(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(),
SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", ErrorCode.DataError.getValue(),
"Exception - URL convention problem", e);
}
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 2d43385700..880ef0a7b0 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,6 +23,7 @@
package org.onap.so.adapters.sdnc.impl;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -69,7 +70,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",
+ logger.warn(LoggingAnchor.SIX, MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC",
ErrorCode.DataError.getValue(), "Invalid config");
}
@@ -105,7 +106,7 @@ public class MapRequestTunables {
error = "Missing configuration for:" + key;
}
if (error != null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC",
ErrorCode.DataError.getValue(), "Missing config param");
}
logger.debug("RequestTunables Key:{} Value:{} Tunables:{}", key, value, this.toString());
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 3e3ec6f9bb..2b023f4c15 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
@@ -25,6 +25,7 @@ package org.onap.so.adapters.sdnc.impl;
import javax.annotation.PostConstruct;
import javax.jws.WebService;
import javax.servlet.http.HttpServletResponse;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.sdnc.SDNCAdapterPortType;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
@@ -51,7 +52,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
@PostConstruct
public void init() {
- logger.info("{} {} {}", MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", "SDNCAdapterPortType");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", "SDNCAdapterPortType");
}
/**
@@ -71,7 +72,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
sdncClient.executeRequest(bpelRequest);
} 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC",
ErrorCode.DataError.getValue(), respMsg, e);
SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
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 21ce06eaf1..012a19f1a9 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
@@ -5,7 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
- * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,6 +45,7 @@ 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.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
@@ -77,27 +78,24 @@ public class SDNCRestClient {
private static Logger logger = LoggerFactory.getLogger(SDNCRestClient.class);
private static final String EXCEPTION_MSG = "Exception while evaluate xpath";
- private static final String MSO_INTERNAL_ERROR = "MsoInternalError";
private static final String CAMUNDA = "Camunda";
@Async
public void executeRequest(SDNCAdapterRequest bpelRequest) {
- logger.debug("BPEL Request:" + bpelRequest.toString());
+ logger.debug("BPEL Request: {}", bpelRequest);
// Added delay to allow completion of create request to SDNC
// before executing activate of create request.
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC",
ErrorCode.UnknownError.getValue(), "Exception processing request to SDNC", e);
Thread.currentThread().interrupt();
}
- String action = bpelRequest.getRequestHeader().getSvcAction();
- String operation = bpelRequest.getRequestHeader().getSvcOperation();
String bpelReqId = bpelRequest.getRequestHeader().getRequestId();
String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl();
@@ -118,12 +116,9 @@ public class SDNCRestClient {
Document reqDoc = node.getOwnerDocument();
sdncReqBody = Utils.genSdncPutReq(reqDoc, rt);
}
- long sdncStartTime = System.currentTimeMillis();
SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt);
logger.debug("Got the SDNC Response: {}", sdncResp.getSdncRespXml());
- long bpelStartTime = System.currentTimeMillis();
sendRespToBpel(callbackUrl, sdncResp);
- return;
}
public SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt) {
@@ -182,7 +177,7 @@ public class SDNCRestClient {
logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC");
return (sdncResp);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e);
// default
sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
@@ -219,7 +214,7 @@ public class SDNCRestClient {
eType = xpath.evaluate("error-type", error);
sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType);
} catch (Exception e3) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
"error-type", error.toString(), "SDNC", ErrorCode.DataError.getValue(),
EXCEPTION_MSG, e3);
}
@@ -229,7 +224,7 @@ public class SDNCRestClient {
eTag = xpath.evaluate("error-tag", error);
sdncErrMsg.append(", error-tag:").append(eTag);
} catch (Exception e3) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
"error-tag", error.toString(), "SDNC", ErrorCode.DataError.getValue(),
EXCEPTION_MSG, e3);
}
@@ -239,18 +234,18 @@ public class SDNCRestClient {
eMsg = xpath.evaluate("error-message", error);
sdncErrMsg.append(", error-message:").append(eMsg).append("]");
} catch (Exception e3) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
"error-message", error.toString(), "SDNC", ErrorCode.DataError.getValue(),
EXCEPTION_MSG, e3);
}
}
} catch (Exception e2) {
- logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception while analyse error", e2);
}
} // is != null
} catch (Exception e1) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1);
}
} // con != null
@@ -262,7 +257,7 @@ public class SDNCRestClient {
sdncResp.setRespMsg(respMsg);
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e);
return sdncResp;
@@ -288,8 +283,7 @@ public class SDNCRestClient {
try {
wsdlUrl = new URL(bpelUrl);
} catch (MalformedURLException e1) {
- error = "Caught exception initializing Callback wsdl " + e1.getMessage();
- logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
}
@@ -317,8 +311,7 @@ public class SDNCRestClient {
reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
headers.put("Authorization", Collections.singletonList(basicAuth));
} catch (Exception e2) {
- error = "Unable to set authorization in callback request " + e2.getMessage();
- logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(),
"Exception - Unable to set authorization in callback request", e2);
@@ -333,6 +326,5 @@ public class SDNCRestClient {
MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), error, e);
}
logger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA);
- return;
}
}
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 52164bdac7..1c47a2d6b0 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
@@ -31,6 +31,7 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -97,7 +98,7 @@ public class Utils {
return s;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
}
return null;
@@ -131,7 +132,7 @@ public class Utils {
return s;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e);
}
return null;
@@ -166,7 +167,7 @@ public class Utils {
return s;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e);
}
return null;
@@ -191,7 +192,7 @@ public class Utils {
s = s.replaceAll("xmlns=\"\"", "");
return s;
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(),
+ logger.error(LoggingAnchor.THREE, 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 6808230474..b50662a832 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
@@ -25,6 +25,7 @@
package org.onap.so.adapters.sdnc.sdncrest;
import javax.xml.bind.DatatypeConverter;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -92,8 +93,8 @@ public class BPRestCallback {
public boolean send(String url, String message) {
logger.debug(getClass().getSimpleName() + ".send(" + "url=" + url + " message=" + message + ")");
- logger.info("{} {} {}", MessageEnum.RA_CALLBACK_BPEL.toString(), message == null ? "[no content]" : message,
- CAMUNDA);
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_CALLBACK_BPEL.toString(),
+ message == null ? "[no content]" : message, CAMUNDA);
HttpPost method = null;
HttpResponse httpResponse = null;
@@ -123,7 +124,7 @@ public class BPRestCallback {
method.setHeader(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
method.setHeader(ONAPLogConstants.Headers.PARTNER_NAME, "SO-SDNCAdapter");
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request",
e);
error = true;
@@ -141,14 +142,14 @@ 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,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(), msg);
}
}
return true;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e);
return false;
} finally {
@@ -168,7 +169,7 @@ public class BPRestCallback {
logger.debug("Exception:", e);
}
}
- logger.info("{} {}", MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA);
+ logger.info(LoggingAnchor.TWO, MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA);
}
}
}
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 70943c206f..979238fe2f 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
@@ -23,6 +23,7 @@
package org.onap.so.adapters.sdnc.sdncrest;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.ErrorCode;
@@ -40,7 +41,6 @@ public class MapTypedRequestTunablesData {
private static final String MISSING_CONFIGURATION_ERROR_MSG = "Missing configuration for: ";
private static final String MISSING_CONFIG_PARAM_ERROR_MSG = "Missing config param";
- private static final String MSO_INTERNAL_ERROR = "MsoInternalError";
@Autowired
private Environment env;
@@ -54,7 +54,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(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(),
"SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
@@ -64,7 +64,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,
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value,
"SDNC", ErrorCode.DataError.getValue(), "Invalid config");
throw new SDNCAdapterException(error);
}
@@ -80,7 +80,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",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC",
ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
@@ -98,7 +98,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,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP,
"SDNC", 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 a7c65d87a4..e184bbd110 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
@@ -34,6 +34,7 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -159,7 +160,7 @@ public abstract class SDNCConnector {
method = null;
- logger.info("{} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, "SDNC");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, "SDNC");
return createResponseFromContent(statusCode, statusMessage, responseContent, rt);
} catch (SocketTimeoutException | ConnectTimeoutException e) {
@@ -192,12 +193,12 @@ public abstract class SDNCConnector {
}
protected void logError(String errMsg) {
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), errMsg);
}
protected void logError(String errMsg, Throwable t) {
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
@@ -283,7 +284,7 @@ public abstract class SDNCConnector {
String errorType = xpath.evaluate("error-type", error);
info += "error-type:" + errorType;
} catch (XPathExpressionException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
@@ -294,7 +295,7 @@ public abstract class SDNCConnector {
}
info += "error-tag:" + errorTag;
} catch (XPathExpressionException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
@@ -305,7 +306,7 @@ public abstract class SDNCConnector {
}
info += "error-message:" + errorMessage;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
@@ -318,7 +319,7 @@ public abstract class SDNCConnector {
}
}
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
}
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 7e82adf064..5697ed56a5 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
@@ -31,6 +31,7 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdncrest.RequestInformation;
@@ -87,11 +88,9 @@ public class SDNCServiceRequestTask {
String xml = genSdncReq(request, mappedTunables);
- long sdncStartTime = System.currentTimeMillis();
SDNCResponseCommon response = connector.send(xml, mappedTunables);
- long bpStartTime = System.currentTimeMillis();
- boolean callbackSuccess = bpRestCallback.send(request.getBPNotificationUrl(), response.toJson());
+ bpRestCallback.send(request.getBPNotificationUrl(), response.toJson());
}
private Element addChild(Element parent, String tag) {
@@ -185,7 +184,7 @@ public class SDNCServiceRequestTask {
addTextChild(agnosticServiceInformation, "content-type", contentType);
addTextChild(agnosticServiceInformation, "anydata", anydata);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
return null;
}
@@ -204,8 +203,8 @@ 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(), ErrorCode.DataError.getValue(),
- "Exception - domToStr", e);
+ logger.error(LoggingAnchor.THREE, 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 3921891ced..5f80c20b97 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
@@ -31,6 +31,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
@@ -61,14 +62,14 @@ public class SNIROResponse {
@Consumes("*/*")
@Produces({MediaType.TEXT_PLAIN})
public Response serviceNotification(@PathParam("correlator") String correlator, String content) {
- logger.info("{} {} {} {}", MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC",
+ logger.info(LoggingAnchor.FOUR, MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC",
"SDNCNotify/SNIROResponse");
String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, "");
if (bpUrl == null || ("").equals(bpUrl)) {
String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(),
Constants.BPEL_REST_URL_PROP, "SDNC", ErrorCode.DataError.getValue(), "Missing config param");
return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();
diff --git a/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml b/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml
deleted file mode 100644
index 4141548c29..0000000000
--- a/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,133 +0,0 @@
-management:
- context-path: /manage
-mso:
- async:
- core-pool-size: 50
- max-pool-size: 50
- queue-capacity: 500
- logPath: /app/logs/sdnc
- catalog:
- db:
- spring:
- endpoint: "http://localhost:8080"
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- site-name: local
-org:
- onap:
- so:
- adapters:
- sdnc:
- '.':
- put: PUT|60000|sdncurl5|
- query: GET|60000|sdncurl2|
- restdelete: DELETE|60000|sdncurl5|
- '':
- contrail-route-topology-operation:
- activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- create: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- network-topology-operation:
- activate: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- assign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- changeassign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- changedelete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- delete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- reserve: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- rollback: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- security-zone-topology-operation:
- activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- create: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- service-topology-operation:
- assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- rollback: POST|270000|sdncur10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- vnf-topology-operation:
- activate: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- assign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- changeassign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- changedelete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- delete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- rollback: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf
- bpelauth: BBD450258299BD2FEF7E3EBA3CD2B58AD417355332319856D761654AA876830A9839820D33DE8426A81E5D48649A4BE6FE7021F5
- bpelurl: http://localhost:8080/mso/SDNCAdapterCallbackService
- generic-resource:
- network-topology-operation:
- activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- vf-module-topology-operation:
- activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- changeassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- changedelete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- rollback: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- vnf-topology-operation:
- activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- changeassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- changedelete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- rollback: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource
- infra:
- '':
- query: GET|60000|sdncurl5|
- mobility:
- '':
- query: GET|60000|sdncurl5|
- myurl: http://localhost:8080/adapters/rest/SDNCNotify
- rest:
- bpelurl: http://localhost:8080/mso/WorkflowMessage
- sdncauth: 1C2DC9B30545C5F673B3C33904608E942476F0C969B3CF7A2509459AB83C9062EFAAE89E91D6DB
- sdncconnecttime: 5000
- sdncurl10: 'https://localhost:8443/restconf/operations/GENERIC-RESOURCE-API:'
- sdncurl12: https://localhost:8443/
- sdncurl5: https://localhost:8443/restconf/config
- sdncurl6: 'https://localhost:8443/restconf/operations/VNF-API:'
- vfmodule:
- '':
- query: GET|60000|sdncurl12|
- network:
- encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
-spring:
- security:
- usercredentials:
- -
- username: sdnc
- password: '$2a$12$mukkC6IvLikKGBdwqGnev.H0ccvV6K13TFeLvyNhJoCuNkRjWhqi6'
- role: SDNC-Client
- -
- username: sitecontrol
- password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu'
- role: SiteControl-Client
- -
- username: bpel
- password: '$2a$12$/GW0/AVAUooTag.7GDc9a.jW7XH3nq/.QsJJJFZJ0N24iXB2W9ksO'
- role: BPEL-Client
- -
- username: sniro
- password: '$2a$12$lbOQWS1iDmdQPxW2Mb6OiuTzGaPUrkrvoKVn2zwpFWb6n5Y86Lf1y'
- role: SNIRO-Client
- -
- username: apih
- password: '$2a$12$e1BGJ7qknMN/b7bqsQvU2OT9iGunt9IlfQclKlCs6n240oHBfcO5y'
- role: MSO-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-ssl-enable: false
diff --git a/adapters/mso-sdnc-adapter/src/main/resources/application.yaml b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml
index 9be0a257c9..2ef721fca5 100644
--- a/adapters/mso-sdnc-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml
@@ -11,6 +11,10 @@ mso:
max-pool-size: 50
queue-capacity: 500
+spring:
+ main:
+ allow-bean-definition-overriding: true
+
#Actuator
management:
endpoints:
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/WebSecurityConfigImpl.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/WebSecurityConfigImpl.java
index 4270be4897..e94e34d87c 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/WebSecurityConfigImpl.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/WebSecurityConfigImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 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
@@ -34,8 +36,8 @@ public class WebSecurityConfigImpl extends WebSecurityConfig {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info", "/services").permitAll()
- .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString())
- .and().httpBasic();
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+ .httpBasic();
}
@Override
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java
index cff36061b1..2dcdf11316 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/HealthCheckHandler.java
@@ -28,8 +28,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
@@ -44,8 +42,6 @@ import org.springframework.stereotype.Component;
@Component
public class HealthCheckHandler {
- private static Logger logger = LoggerFactory.getLogger(HealthCheckHandler.class);
-
private static final String CHECK_HTML =
"<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
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 cefaadbb63..e8b4cfd997 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
@@ -24,6 +24,7 @@
package org.onap.so.adapters.vfc.util;
import java.io.IOException;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.vfc.constant.HttpCode;
import org.onap.so.adapters.vfc.exceptions.ApplicationException;
import org.onap.so.logger.ErrorCode;
@@ -83,8 +84,8 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
- UNMARSHAL_FAIL_MSG, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
}
@@ -101,8 +102,8 @@ public class JsonUtil {
try {
return MAPPER.readValue(jsonstr, type);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
- UNMARSHAL_FAIL_MSG, e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), UNMARSHAL_FAIL_MSG, e);
throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG);
}
}
@@ -118,8 +119,8 @@ public class JsonUtil {
try {
return MAPPER.writeValueAsString(srcObj);
} catch (IOException e) {
- logger.error("{} {} {}", MessageEnum.RA_NS_EXC.toString(), ErrorCode.BusinessProcesssError.getValue(),
- "fail to marshal json", e);
+ logger.error(LoggingAnchor.THREE, 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 3419e6d20c..647fcafa66 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
@@ -27,6 +27,7 @@ package org.onap.so.adapters.vfc.util;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import javax.ws.rs.core.UriBuilder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -79,6 +80,9 @@ public class RestfulUtil {
@Autowired
private Environment env;
+ @Autowired
+ private HttpClient client;
+
public String getMsbHost() {
// MSB_IP will be set as ONAP_IP environment parameter in install flow.
String msbIp = System.getenv().get(ONAP_IP);
@@ -111,8 +115,6 @@ public class RestfulUtil {
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout).build();
- HttpClient client = HttpClientBuilder.create().build();
-
if ("POST".equalsIgnoreCase(methodType)) {
HttpPost httpPost = new HttpPost(msbUrl);
httpPost.setConfig(requestConfig);
@@ -193,12 +195,12 @@ public class RestfulUtil {
}
private static void logError(String errMsg, Throwable t) {
- logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
private static void logError(String errMsg) {
- logger.error("{} {} {} {}", MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
ErrorCode.AvailabilityError.toString(), errMsg);
}
diff --git a/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml b/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml
deleted file mode 100644
index 414dabb0a1..0000000000
--- a/adapters/mso-vfc-adapter/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,34 +0,0 @@
-server:
- port: 8091
- tomcat:
- max-threads: 50
-ssl-enable: false
-mso:
- logPath: logs
- site-name: localSite
-spring:
- datasource:
- jdbc-url: jdbc:mariadb://localhost:3306/requestdb
- username: mso
- password: mso123
- driver-class-name: org.mariadb.jdbc.Driver
- initialize: true
- initialization-mode: never
- jpa:
- generate-ddl: false
- show-sql: false
- hibernate:
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable-lazy-load-no-trans: true
- database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
- security:
- usercredentials:
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java
new file mode 100644
index 0000000000..c388016ab4
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019 Samsung. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vfc.util;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.StatusLine;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.vfc.model.RestfulResponse;
+import org.springframework.http.HttpStatus;
+import javax.ws.rs.HttpMethod;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RestfulUtilTest {
+
+ @InjectMocks
+ @Spy
+ private RestfulUtil restfulUtil;
+
+ @Mock
+ private HttpClient client;
+
+ private HttpEntity httpEntity;
+ private HttpResponse httpResponse;
+ private StatusLine statusLine;
+
+ @Before
+ public void setUp() {
+ httpEntity = mock(HttpEntity.class);
+ httpResponse = mock(HttpResponse.class);
+ statusLine = mock(StatusLine.class);
+ }
+
+ private void sendInit() throws IOException {
+
+ doReturn("https://testHost/").when(restfulUtil).getMsbHost();
+
+ when(statusLine.getStatusCode()).thenReturn(HttpStatus.OK.value());
+ when(httpResponse.getStatusLine()).thenReturn(statusLine);
+ when(httpResponse.getEntity()).thenReturn(httpEntity);
+ }
+
+ @Test
+ public void sendGet() throws Exception {
+
+ sendInit();
+
+ ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("GET").getBytes());
+ when(client.execute(any(HttpGet.class))).thenReturn(httpResponse);
+ when(httpEntity.getContent()).thenReturn(responseStream);
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.GET, "some request content");
+
+ assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus());
+ assertEquals("GET", restfulResponse.getResponseContent());
+
+ }
+
+ @Test
+ public void sendPost() throws Exception {
+
+ sendInit();
+
+
+ ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("POST").getBytes());
+ when(client.execute(any(HttpPost.class))).thenReturn(httpResponse);
+ when(httpEntity.getContent()).thenReturn(responseStream);
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.POST, "some request content");
+
+ assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus());
+ assertEquals("POST", restfulResponse.getResponseContent());
+
+ }
+
+ @Test
+ public void sendPut() throws Exception {
+
+ sendInit();
+
+ ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("PUT").getBytes());
+ when(client.execute(any(HttpPut.class))).thenReturn(httpResponse);
+ when(httpEntity.getContent()).thenReturn(responseStream);
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.PUT, "some request content");
+
+ assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus());
+ assertEquals("PUT", restfulResponse.getResponseContent());
+
+ }
+
+ @Test
+ public void sendDelete() throws Exception {
+
+ sendInit();
+
+ ByteArrayInputStream responseStream = new ByteArrayInputStream(new String("DELETE").getBytes());
+ when(client.execute(any(HttpDelete.class))).thenReturn(httpResponse);
+ when(httpEntity.getContent()).thenReturn(responseStream);
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.DELETE, "some request content");
+
+ assertEquals(HttpStatus.OK.value(), restfulResponse.getStatus());
+ assertEquals("DELETE", restfulResponse.getResponseContent());
+
+ }
+
+ @Test
+ public void sendOptions() throws Exception {
+
+ doReturn("https://testHost/").when(restfulUtil).getMsbHost();
+
+ RestfulResponse restfulResponse = restfulUtil.send("test", HttpMethod.OPTIONS, "some request content");
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR.value(), restfulResponse.getStatus());
+ assertEquals("Error processing request to VFC", restfulResponse.getResponseContent());
+
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
new file mode 100644
index 0000000000..66876311db
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
@@ -0,0 +1,128 @@
+The following describes how to configure authentication for the VNFM adapter.
+
+
+==========================================
+To confgure TLS
+==========================================
+
+---------------
+VNFM Adapter
+---------------
+The following parameters can be set to configure the certificate for the VNFM adapter
+server:
+ ssl:
+ key-alias: so@so.onap.org
+ key--store-password: 'I,re7WWEJR$e]x370wRgx?qE'
+ key-store: classpath:org.onap.so.p12
+ key-store-type: PKCS12
+The values shown above relate to the certificate included in the VNFM adapter jar which has been generated from AAF. If a different certificate is to be used then these values should be changed accordingly.
+
+The following paramters can be set to configure the trust store for the VNFM adapter:
+http:
+ client:
+ ssl:
+ trust-store: org.onap.so.trust.jks
+ trust-store-password: NyRD](z:EJJNIt?},QgM3o7H
+The values shown above relate to the trust store included in the VNFM adapter jar which has been generated from AAI. If a different trust store is to be used then these values should be changed accordingly.
+
+Ensure the value for the below parameter uses https instead of http
+vnfmadapter:
+ endpoint: http://so-vnfm-adapter.onap:9092
+
+---------------
+bpmn-infra
+---------------
+For bpmn-infra, ensure the value for the below parameter uses https instead of http
+so:
+ vnfm:
+ adapter:
+ url: https://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/
+
+
+==========================================
+To use two way TLS
+==========================================
+
+Ensure the value for username and password are empty in the AAI entry for the VNFM (The VNFM adapter will use oauth instead of two way TLS if the username/password is set).
+Ensure TLS has been configuered as detailed above.
+
+---------------
+VNFM adapter
+---------------
+Set the following parameter for the VNFM adapter:
+server:
+ ssl:
+ client-auth: need
+
+---------------
+bpmn-infra:
+---------------
+Set the following paramters for bpmn-infra:
+rest:
+ http:
+ client:
+ configuration:
+ ssl:
+ keyStore: classpath:org.onap.so.p12
+ keyStorePassword: 'RLe5ExMWW;Kd6GTSt0WQz;.Y'
+ trustStore: classpath:org.onap.so.trust.jks
+ trustStorePassword: '6V%8oSU$,%WbYp3IUe;^mWt4'
+Ensure the value for the below parameter uses https instead of http
+so:
+ vnfm:
+ adapter:
+ url: https://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/
+
+---------------
+VNFM simulator:
+---------------
+Set the following parameters for the VNFM simulator (if used):
+server:
+ ssl:
+ client-auth: need
+ request:
+ grant:
+ auth: twowaytls
+
+==========================================
+To use oauth token base authentication
+==========================================
+
+---------------
+VNFM adapter:
+---------------
+Ensure the value for username and password set set in the AAI entry for the VNFM. The VNFM adapter will use this username/password as the client credentials in the request for a token for the VNFM. The token endpoint
+for the VNFM will by default will be derived from the service url for the VNFM in AAI as follows: <base of service url>/oauth/token, e.g. if the service url is https://so-vnfm-simulator.onap/vnflcm/v1 then the token url will
+be taken to be https://so-vnfm-simulator.onap/oauth/token. This can be overriden using the following parameter for the VNFM adapter:
+vnfmadapter:
+ temp:
+ vnfm:
+ oauth:
+ endpoint:
+
+The VNFM adapter exposes a token point at url: https://<hostname>:<port>/oauth/token e.g. https://so-vnfm-adapter.onap:9092/oauth/token. The VNFM can request a token from this endpoint for use in grant requests and notifications
+to the VNFM adapter. The username/password to be used in the token request are passed to the VNFM in a subscription request. The username/password sent by the VNFM adpater in the subscription request can be configuered using the
+following parameter:
+vnfmadapter:
+ auth: <encoded value>
+where <encoded value> is '<username>:<password>' encoded using org.onap.so.utils.CryptoUtils with the key set by the paramter:
+mso:
+ key: <key>
+The default username:password is vnfm-adapter:123456 when vnfm-adapter.auth is not set.
+
+---------------
+VNFM simulator:
+---------------
+Set the following parameters for the simulator:
+spring:
+ profiles:
+ active: oauth-authentication
+server:
+ request:
+ grant:
+ auth: oauth
+
+==========================================
+To use basic auth for notifications
+==========================================
+The same username/password is used as for oauth token requests as describe above and passed to the VNFM in the subscription request. \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
index 09c28f93f1..bc491a6fc5 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -58,6 +58,24 @@
</configuration>
</plugin>
</plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <excludes>
+ <exclude>**/*.p12</exclude>
+ <exclude>**/*.jks</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*.p12</include>
+ <include>**/*.jks</include>
+ </includes>
+ </resource>
+ </resources>
</build>
<dependencies>
<dependency>
@@ -90,6 +108,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.springframework.security.oauth</groupId>
+ <artifactId>spring-security-oauth2</artifactId>
+ <version>2.3.6.RELEASE</version>
+ </dependency>
+ <dependency>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-adapters-rest-interface</artifactId>
<version>${project.version}</version>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
index d99b68846e..32c22356b3 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
@@ -20,14 +20,16 @@
package org.onap.so.adapters.vnfmadapter;
import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import java.util.ArrayList;
import java.util.Collection;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
+import org.onap.so.adapters.vnfmadapter.oauth.OAuth2AccessTokenAdapter;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
/**
* Configures message converter
@@ -38,7 +40,8 @@ public class MessageConverterConfiguration {
@Bean
public HttpMessageConverters customConverters() {
final Collection<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
- final Gson gson = new JSON().getGson();
+ final Gson gson = new GsonBuilder()
+ .registerTypeHierarchyAdapter(OAuth2AccessToken.class, new OAuth2AccessTokenAdapter()).create();
final GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter(gson);
messageConverters.add(gsonHttpMessageConverter);
return new HttpMessageConverters(true, messageConverters);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
index f0830139b7..792002354b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
@@ -22,6 +22,7 @@ package org.onap.so.adapters.vnfmadapter;
import org.onap.so.security.MSOSpringFirewall;
import org.onap.so.security.WebSecurityConfig;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -34,13 +35,18 @@ import org.springframework.util.StringUtils;
@EnableWebSecurity
public class WebSecurityConfigImpl extends WebSecurityConfig {
+ @Value("${server.ssl.client-auth:none}")
+ private String clientAuth;
+
@Override
protected void configure(final HttpSecurity http) throws Exception {
- http.csrf().disable().authorizeRequests()
- .antMatchers("/manage/health", "/manage/info", Constants.BASE_URL + "/lcn/**",
- Constants.BASE_URL + "/grants/**")
- .permitAll().antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ","))
- .and().httpBasic();
+ if (("need").equalsIgnoreCase(clientAuth)) {
+ http.csrf().disable().authorizeRequests().anyRequest().permitAll();
+ } else {
+ http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+ .httpBasic();
+ }
}
@Override
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
index 57d6615d66..735e1f9d42 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
@@ -49,6 +49,7 @@ import java.util.NoSuchElementException;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import javax.net.ssl.SSLContext;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -133,7 +134,7 @@ public class SdcPackageProvider {
private byte[] getPackage(final String csarId) {
final String SERVICE_NAME = "vnfm-adapter";
- try (CloseableHttpClient client = HttpClients.createDefault()) {
+ try (CloseableHttpClient client = HttpClients.custom().setSSLContext(SSLContext.getDefault()).build()) {
final HttpGet httpget = new HttpGet(format(GET_PACKAGE_URL, baseUrl, csarId));
httpget.setHeader(ACCEPT, APPLICATION_OCTET_STREAM_VALUE);
httpget.setHeader("X-ECOMP-InstanceID", SERVICE_NAME);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
index 1fa62efa25..019a08af78 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
@@ -28,6 +28,7 @@ import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.vnfmadapter.v1.model.Tenant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,8 +59,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public GenericVnfs invokeQueryGenericVnf(final String selfLink) {
return aaiClientProvider.getAaiClient()
- .get(GenericVnfs.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS)
- .queryParam("selflink", selfLink.replaceAll("https", "http")))
+ .get(GenericVnfs.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam("selflink", selfLink))
.orElseGet(() -> {
logger.debug("No vnf found in AAI with selflink: {}", selfLink);
return null;
@@ -78,7 +79,8 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
@Override
public EsrVnfm invokeGetVnfm(final String vnfmId) {
return aaiClientProvider.getAaiClient()
- .get(EsrVnfm.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId)).orElseGet(() -> {
+ .get(EsrVnfm.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE))
+ .orElseGet(() -> {
logger.debug("VNFM not found in AAI");
return null;
});
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
index 249cf74cb2..7c22020287 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
@@ -41,6 +41,7 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRe
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthentication;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthentication.AuthTypeEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsOauth2ClientCredentials;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilter;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilter.NotificationTypesEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilterVnfInstanceSubscriptionFilter;
@@ -194,14 +195,25 @@ public class VnfmHelper {
}
private SubscriptionsAuthentication getSubscriptionsAuthentication() throws GeneralSecurityException {
- final SubscriptionsAuthenticationParamsBasic basicAuthParams = new SubscriptionsAuthenticationParamsBasic();
+ final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
+
final String[] decrypedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoEncryptionKey).split(":");
+
+ SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthParams =
+ new SubscriptionsAuthenticationParamsOauth2ClientCredentials();
+ oauthParams.setTokenEndpoint(vnfmAdapterEndoint + "/oauth/token");
+ oauthParams.clientId(decrypedAuth[0]);
+ oauthParams.setClientPassword(decrypedAuth[1]);
+ authentication.addAuthTypeItem(AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS);
+ authentication.paramsOauth2ClientCredentials(oauthParams);
+
+ final SubscriptionsAuthenticationParamsBasic basicAuthParams = new SubscriptionsAuthenticationParamsBasic();
basicAuthParams.setUserName(decrypedAuth[0]);
basicAuthParams.setPassword(decrypedAuth[1]);
-
- final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
authentication.addAuthTypeItem(AuthTypeEnum.BASIC);
authentication.paramsBasic(basicAuthParams);
+
+ authentication.addAuthTypeItem(AuthTypeEnum.TLS_CERT);
return authentication;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
index 7a0df0fdba..cb8c7c4e56 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
@@ -21,6 +21,7 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
import com.google.common.base.Optional;
+import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
@@ -37,63 +38,67 @@ public interface VnfmServiceProvider {
/**
* Invoke a get request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to the VNF in the VNFM
* @return the VNF from the VNFM
*/
- Optional<InlineResponse201> getVnf(final String vnfSelfLink);
+ Optional<InlineResponse201> getVnf(final EsrVnfm vnfm, final String vnfSelfLink);
/**
* Invoke an instantiate request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to he VNF on the VNFM
* @param instantiateVnfRequest the instantiate request
* @return the operation ID of the instantiation operation
*/
- String instantiateVnf(final String vnfSelfLink, final InstantiateVnfRequest instantiateVnfRequest);
+ String instantiateVnf(final EsrVnfm vnfm, final String vnfSelfLink,
+ final InstantiateVnfRequest instantiateVnfRequest);
/**
* Invoke a notification subscription request to a VNFM.
*
- * @param vnfmId the ID of the VNFM
+ * @param vnfm the VNFM in AAI
* @param subscriptionRequest
* @return the response to the subscription request
*/
- InlineResponse2001 subscribeForNotifications(final String vnfmId,
- final LccnSubscriptionRequest subscriptionRequest);
+ InlineResponse2001 subscribeForNotifications(final EsrVnfm vnfm, final LccnSubscriptionRequest subscriptionRequest);
/**
* Invoke a terminate request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to he VNF on the VNFM
* @param terminateVnfRequest the terminate request
* @return the operation ID of the termination operation
*/
- String terminateVnf(final String vnfSelfLink, final TerminateVnfRequest terminateVnfRequest);
+ String terminateVnf(final EsrVnfm vnfm, final String vnfSelfLink, final TerminateVnfRequest terminateVnfRequest);
/**
* Invoke a delete request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to he VNF on the VNFM
* @return the operation ID of the instantiation operation
*/
- void deleteVnf(final String vnfSelfLink);
+ void deleteVnf(final EsrVnfm vnfm, final String vnfSelfLink);
/**
* Invoke a get request for a VNFM operation.
*
- * @param vnfmId the id of the VNFM in AAI
+ * @param vnfm the VNFM in AAI
* @param operationId the id of the operation on the VNFM
* @return the operation from the VNFM
*/
- Optional<InlineResponse200> getOperation(final String vnfmId, final String operationId);
+ Optional<InlineResponse200> getOperation(final EsrVnfm vnfm, final String operationId);
/**
* Invoke a create request to a VNFM
*
- * @param vnfmId the id of the VNFM in AAI
+ * @param vnfm the VNFM in AAI
* @param createVnfRequest the parameters for creating a VNF
* @return the newly created VNF
*/
- Optional<InlineResponse201> createVnf(final String vnfmId, final CreateVnfRequest createVnfRequest);
+ Optional<InlineResponse201> createVnf(final EsrVnfm vnfm, final CreateVnfRequest createVnfRequest);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index 2aee1c06e3..93312cfa64 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -22,19 +22,43 @@ package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import com.google.gson.Gson;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.net.ssl.SSLContext;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.context.annotation.Bean;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.security.oauth2.client.OAuth2RestTemplate;
+import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
import org.springframework.web.client.RestTemplate;
/**
@@ -43,16 +67,68 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class VnfmServiceProviderConfiguration {
- @Bean(name = "vnfmServiceProvider")
- public HttpRestServiceProvider httpRestServiceProvider(
- @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate) {
- return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider());
+ private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderConfiguration.class);
+ private Map<String, HttpRestServiceProvider> mapOfVnfmIdToHttpRestServiceProvider = new ConcurrentHashMap<>();
+
+ @Value("${http.client.ssl.trust-store:#{null}}")
+ private Resource trustStore;
+ @Value("${http.client.ssl.trust-store-password:#{null}}")
+ private String trustStorePassword;
+
+ @Value("${server.ssl.key-store:#{null}}")
+ private Resource keyStoreResource;
+ @Value("${server.ssl.key--store-password:#{null}}")
+ private String keyStorePassword;
+
+ /**
+ * This property is only intended to be temporary until the AAI schema is updated to support setting the endpoint
+ */
+ @Value("${vnfmadapter.temp.vnfm.oauth.endpoint:#{null}}")
+ private String oauthEndpoint;
+
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ @Autowired()
+ private RestTemplate defaultRestTemplate;
+
+ public HttpRestServiceProvider getHttpRestServiceProvider(final EsrVnfm vnfm) {
+ if (!mapOfVnfmIdToHttpRestServiceProvider.containsKey(vnfm.getVnfmId())) {
+ mapOfVnfmIdToHttpRestServiceProvider.put(vnfm.getVnfmId(), createHttpRestServiceProvider(vnfm));
+ }
+ return mapOfVnfmIdToHttpRestServiceProvider.get(vnfm.getVnfmId());
}
- private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
- final HttpHeadersProvider httpHeadersProvider) {
+ private HttpRestServiceProvider createHttpRestServiceProvider(final EsrVnfm vnfm) {
+ final RestTemplate restTemplate = createRestTemplate(vnfm);
setGsonMessageConverter(restTemplate);
- return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
+ if (trustStore != null) {
+ setTrustStore(restTemplate);
+ }
+ return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider());
+ }
+
+ private RestTemplate createRestTemplate(final EsrVnfm vnfm) {
+ if (vnfm != null) {
+ for (final EsrSystemInfo esrSystemInfo : vnfm.getEsrSystemInfoList().getEsrSystemInfo()) {
+ if (!StringUtils.isEmpty(esrSystemInfo.getUserName())
+ && !StringUtils.isEmpty(esrSystemInfo.getPassword())) {
+ return createOAuth2RestTemplate(esrSystemInfo);
+ }
+ }
+ }
+ return defaultRestTemplate;
+ }
+
+ private OAuth2RestTemplate createOAuth2RestTemplate(final EsrSystemInfo esrSystemInfo) {
+ logger.debug("Getting OAuth2RestTemplate ...");
+ final ClientCredentialsResourceDetails resourceDetails = new ClientCredentialsResourceDetails();
+ resourceDetails.setId(UUID.randomUUID().toString());
+ resourceDetails.setClientId(esrSystemInfo.getUserName());
+ resourceDetails.setClientSecret(esrSystemInfo.getPassword());
+ resourceDetails.setAccessTokenUri(
+ oauthEndpoint == null ? esrSystemInfo.getServiceUrl().replace("vnflcm/v1", "oauth/token")
+ : oauthEndpoint);
+ resourceDetails.setGrantType("client_credentials");
+ return new OAuth2RestTemplate(resourceDetails);
}
private void setGsonMessageConverter(final RestTemplate restTemplate) {
@@ -66,4 +142,29 @@ public class VnfmServiceProviderConfiguration {
restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
}
+ private void setTrustStore(final RestTemplate restTemplate) {
+ SSLContext sslContext;
+ try {
+ if (keyStoreResource != null) {
+ KeyStore keystore = KeyStore.getInstance("pkcs12");
+ keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
+ sslContext =
+ new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray())
+ .loadKeyMaterial(keystore, keyStorePassword.toCharArray()).build();
+ } else {
+ sslContext = new SSLContextBuilder()
+ .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build();
+ }
+ logger.info("Setting truststore: {}", trustStore.getURL());
+ final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
+ final HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
+ final HttpComponentsClientHttpRequestFactory factory =
+ new HttpComponentsClientHttpRequestFactory(httpClient);
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
+ } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
+ | IOException | UnrecoverableKeyException exception) {
+ logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception);
+ }
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
index 0b5b09ae39..948f5fc269 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
@@ -21,6 +21,7 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
import com.google.common.base.Optional;
+import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
@@ -33,7 +34,6 @@ import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@@ -42,28 +42,29 @@ import org.springframework.stereotype.Service;
public class VnfmServiceProviderImpl implements VnfmServiceProvider {
private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderImpl.class);
- private final HttpRestServiceProvider httpServiceProvider;
+ private final VnfmServiceProviderConfiguration vnfmServiceProviderConfiguration;
private final VnfmUrlProvider urlProvider;
@Autowired
public VnfmServiceProviderImpl(final VnfmUrlProvider urlProvider,
- @Qualifier("vnfmServiceProvider") final HttpRestServiceProvider httpServiceProvider) {
- this.httpServiceProvider = httpServiceProvider;
+ VnfmServiceProviderConfiguration vnfmServiceProviderConfiguration) {
+ this.vnfmServiceProviderConfiguration = vnfmServiceProviderConfiguration;
this.urlProvider = urlProvider;
}
@Override
- public Optional<InlineResponse201> getVnf(final String vnfSelfLink) {
- return httpServiceProvider.get(vnfSelfLink.replaceAll("https", "http"), InlineResponse201.class);
+ public Optional<InlineResponse201> getVnf(final EsrVnfm vnfm, final String vnfSelfLink) {
+ return getHttpServiceProvider(vnfm).get(vnfSelfLink, InlineResponse201.class);
}
@Override
- public String instantiateVnf(final String vnfSelfLink, final InstantiateVnfRequest instantiateVnfRequest) {
+ public String instantiateVnf(final EsrVnfm vnfm, final String vnfSelfLink,
+ final InstantiateVnfRequest instantiateVnfRequest) {
logger.debug("Sending instantiate request " + instantiateVnfRequest + " to : " + vnfSelfLink);
ResponseEntity<Void> response = null;
try {
- response = httpServiceProvider.postHttpRequest(instantiateVnfRequest, vnfSelfLink + "/instantiate",
+ response = getHttpServiceProvider(vnfm).postHttpRequest(instantiateVnfRequest, vnfSelfLink + "/instantiate",
Void.class);
} catch (final Exception exception) {
final String errorMessage =
@@ -82,22 +83,22 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public InlineResponse2001 subscribeForNotifications(final String vnfmId,
+ public InlineResponse2001 subscribeForNotifications(final EsrVnfm vnfm,
final LccnSubscriptionRequest subscriptionRequest) {
logger.info("Subscribing for notifications {}", subscriptionRequest);
- final String url = urlProvider.getSubscriptionsUrl(vnfmId);
+ final String url = urlProvider.getSubscriptionsUrl(vnfm.getVnfmId());
ResponseEntity<InlineResponse2001> response = null;
try {
- response = httpServiceProvider.postHttpRequest(subscriptionRequest, url, InlineResponse2001.class);
+ response = getHttpServiceProvider(vnfm).postHttpRequest(subscriptionRequest, url, InlineResponse2001.class);
logger.info("Subscribing for notifications response {}", response);
} catch (final Exception exception) {
final String errorMessage =
- "Subscription to VNFM " + vnfmId + " resulted in exception" + subscriptionRequest;
+ "Subscription to VNFM " + vnfm.getVnfmId() + " resulted in exception" + subscriptionRequest;
logger.error(errorMessage, exception);
throw new VnfmRequestFailureException(errorMessage, exception);
}
if (response.getStatusCode() != HttpStatus.CREATED) {
- final String errorMessage = "Subscription to VNFM " + vnfmId + " returned status code: "
+ final String errorMessage = "Subscription to VNFM " + vnfm.getVnfmId() + " returned status code: "
+ response.getStatusCode() + ", request: " + subscriptionRequest;
logger.error(errorMessage);
throw new VnfmRequestFailureException(errorMessage);
@@ -106,12 +107,14 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public String terminateVnf(final String vnfSelfLink, final TerminateVnfRequest terminateVnfRequest) {
+ public String terminateVnf(final EsrVnfm vnfm, final String vnfSelfLink,
+ final TerminateVnfRequest terminateVnfRequest) {
logger.debug("Sending terminate request " + terminateVnfRequest + " to : " + vnfSelfLink);
ResponseEntity<Void> response = null;
try {
- response = httpServiceProvider.postHttpRequest(terminateVnfRequest, vnfSelfLink + "/terminate", Void.class);
+ response = getHttpServiceProvider(vnfm).postHttpRequest(terminateVnfRequest, vnfSelfLink + "/terminate",
+ Void.class);
} catch (final Exception exception) {
final String errorMessage =
"Terminate request to " + vnfSelfLink + " resulted in exception" + terminateVnfRequest;
@@ -130,9 +133,9 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public void deleteVnf(final String vnfSelfLink) {
+ public void deleteVnf(final EsrVnfm vnfm, final String vnfSelfLink) {
logger.debug("Sending delete request to : " + vnfSelfLink);
- final ResponseEntity<Void> response = httpServiceProvider.deleteHttpRequest(vnfSelfLink, Void.class);
+ final ResponseEntity<Void> response = getHttpServiceProvider(vnfm).deleteHttpRequest(vnfSelfLink, Void.class);
if (response.getStatusCode() != HttpStatus.NO_CONTENT) {
throw new VnfmRequestFailureException(
"Delete request to " + vnfSelfLink + " return status code: " + response.getStatusCode());
@@ -140,23 +143,27 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public Optional<InlineResponse200> getOperation(final String vnfmId, final String operationId) {
- final String url = urlProvider.getOperationUrl(vnfmId, operationId);
- return httpServiceProvider.get(url, InlineResponse200.class);
+ public Optional<InlineResponse200> getOperation(final EsrVnfm vnfm, final String operationId) {
+ final String url = urlProvider.getOperationUrl(vnfm.getVnfmId(), operationId);
+ return getHttpServiceProvider(vnfm).get(url, InlineResponse200.class);
}
@Override
- public Optional<InlineResponse201> createVnf(final String vnfmId, final CreateVnfRequest createVnfRequest) {
- final String url = urlProvider.getCreationUrl(vnfmId);
+ public Optional<InlineResponse201> createVnf(final EsrVnfm vnfm, final CreateVnfRequest createVnfRequest) {
+ final String url = urlProvider.getCreationUrl(vnfm.getVnfmId());
logger.debug("Sending create request {} to : {}", createVnfRequest, url);
try {
- return httpServiceProvider.post(createVnfRequest, url, InlineResponse201.class);
+ return getHttpServiceProvider(vnfm).post(createVnfRequest, url, InlineResponse201.class);
} catch (final Exception exception) {
final String errorMessage =
- "Create request to vnfm:" + vnfmId + " resulted in exception" + createVnfRequest;
+ "Create request to vnfm:" + vnfm.getVnfmId() + " resulted in exception" + createVnfRequest;
logger.error(errorMessage, exception);
throw new VnfmRequestFailureException(errorMessage, exception);
}
}
+ private HttpRestServiceProvider getHttpServiceProvider(final EsrVnfm vnfm) {
+ return vnfmServiceProviderConfiguration.getHttpRestServiceProvider(vnfm);
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
index 537bb77b32..68fdb79444 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
@@ -25,6 +25,7 @@ import com.google.common.base.Optional;
import com.google.common.collect.Maps;
import java.util.Map;
import java.util.UUID;
+import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.JobNotFoundException;
@@ -45,10 +46,12 @@ public class JobManager {
private static Logger logger = getLogger(JobManager.class);
private final Map<String, VnfmOperation> mapOfJobIdToVnfmOperation = Maps.newConcurrentMap();
private final VnfmServiceProvider vnfmServiceProvider;
+ private final AaiServiceProvider aaiServiceProvider;
@Autowired
- JobManager(final VnfmServiceProvider vnfmServiceProvider) {
+ JobManager(final VnfmServiceProvider vnfmServiceProvider, final AaiServiceProvider aaiServiceProvider) {
this.vnfmServiceProvider = vnfmServiceProvider;
+ this.aaiServiceProvider = aaiServiceProvider;
}
/**
@@ -90,16 +93,15 @@ public class JobManager {
}
try {
- final Optional<InlineResponse200> operationOptional =
- vnfmServiceProvider.getOperation(vnfmOperation.getVnfmId(), vnfmOperation.getOperationId());
+ final Optional<InlineResponse200> operationOptional = vnfmServiceProvider.getOperation(
+ aaiServiceProvider.invokeGetVnfm(vnfmOperation.getVnfmId()), vnfmOperation.getOperationId());
if (!operationOptional.isPresent()) {
return response.operationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.OPERATION_NOT_FOUND);
}
final InlineResponse200 operation = operationOptional.get();
- logger.debug(
- "Job Id: " + jobId + ", operationId: " + operation.getId() + ", operation details: " + operation);
+ logger.debug("Job Id: {} operationId: {} operation details: {} ", jobId, operation.getId(), operation);
if (operation.getOperationState() == null) {
return response.operationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
@@ -124,15 +126,16 @@ public class JobManager {
private OperationStateEnum getOperationState(final VnfmOperation vnfmOperation,
final InlineResponse200 operationResponse) {
switch (vnfmOperation.getNotificationStatus()) {
- case NOTIFICATION_PROCESSING_NOT_REQUIRED:
- default:
- return OperationStateEnum.fromValue(operationResponse.getOperationState().getValue());
case NOTIFICATION_PROCESSING_PENDING:
return org.onap.vnfmadapter.v1.model.OperationStateEnum.PROCESSING;
case NOTIFICATION_PROCEESING_SUCCESSFUL:
return org.onap.vnfmadapter.v1.model.OperationStateEnum.COMPLETED;
case NOTIFICATION_PROCESSING_FAILED:
return org.onap.vnfmadapter.v1.model.OperationStateEnum.FAILED;
+ default:
+ if (operationResponse == null || operationResponse.getOperationState() == null)
+ return null;
+ return OperationStateEnum.fromValue(operationResponse.getOperationState().getValue());
}
}
@@ -145,7 +148,8 @@ public class JobManager {
if (relatedOperation.isPresent()) {
relatedOperation.get().setNotificationProcessed(notificationProcessingWasSuccessful);
} else {
- logger.debug("No operation found for operation ID " + operationId);
+ logger.debug("No operation found for operation ID {} ", operationId);
+
}
}
@@ -154,9 +158,9 @@ public class JobManager {
final java.util.Optional<VnfmOperation> relatedOperation = mapOfJobIdToVnfmOperation.values().stream()
.filter(operation -> operation.getOperationId().equals(operationId)).findFirst();
if (relatedOperation.isPresent()) {
- relatedOperation.get().setVnfDeleted();;
+ relatedOperation.get().setVnfDeleted();
} else {
- logger.debug("No operation found for operation ID " + operationId);
+ logger.debug("No operation found for operation ID {} ", operationId);
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
index a4f7d3206d..0aad91e5be 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
@@ -82,16 +82,15 @@ public class LifecycleManager {
*/
public CreateVnfResponse createVnf(final String vnfIdInAai, final CreateVnfRequest request) {
final GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
- checkIfVnfAlreadyExistsInVnfm(genericVnf);
-
EsrVnfm vnfm = aaiHelper.getAssignedVnfm(genericVnf);
+ checkIfVnfAlreadyExistsInVnfm(vnfm, genericVnf);
+
if (vnfm == null) {
vnfm = aaiHelper.selectVnfm(genericVnf);
aaiHelper.addRelationshipFromGenericVnfToVnfm(genericVnf, vnfm.getVnfmId());
}
aaiHelper.addRelationshipFromGenericVnfToTenant(genericVnf, request.getTenant());
- final InlineResponse201 vnfmResponse =
- sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm.getVnfmId());
+ final InlineResponse201 vnfmResponse = sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm);
logger.info("Create response: {}", vnfmResponse);
@@ -102,8 +101,8 @@ public class LifecycleManager {
final OamIpAddressSource oamIpAddressSource = extractOamIpAddressSource(request);
aaiHelper.setOamIpAddressSource(vnfIdInVnfm, oamIpAddressSource);
- createNotificationSubscription(vnfm.getVnfmId(), vnfIdInVnfm);
- final String operationId = sendInstantiateRequestToVnfm(vnfm, genericVnf, request, vnfIdInAai, vnfIdInVnfm);
+ createNotificationSubscription(vnfm, vnfIdInVnfm);
+ final String operationId = sendInstantiateRequestToVnfm(vnfm, genericVnf, request);
final String jobId = jobManager.createJob(vnfm.getVnfmId(), operationId, false);
final CreateVnfResponse response = new CreateVnfResponse();
@@ -114,7 +113,7 @@ public class LifecycleManager {
private String getSelfLink(final InlineResponse201 vnfmResponse, final EsrVnfm vnfm) {
if (vnfmResponse.getLinks() != null && vnfmResponse.getLinks().getSelf() != null
&& vnfmResponse.getLinks().getSelf().getHref() != null) {
- return vnfmResponse.getLinks().getSelf().getHref().replaceAll("https", "http");
+ return vnfmResponse.getLinks().getSelf().getHref();
}
return vnfm.getEsrSystemInfoList().getEsrSystemInfo().iterator().next().getServiceUrl() + "/vnf_instances/"
+ vnfmResponse.getId();
@@ -133,11 +132,11 @@ public class LifecycleManager {
}
}
- private void checkIfVnfAlreadyExistsInVnfm(final GenericVnf genericVnf) {
- if (genericVnf.getSelflink() != null && !genericVnf.getSelflink().isEmpty()) {
+ private void checkIfVnfAlreadyExistsInVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf) {
+ if (genericVnf.getSelflink() != null && !genericVnf.getSelflink().isEmpty() && vnfm != null) {
Optional<InlineResponse201> response = Optional.absent();
try {
- response = vnfmServiceProvider.getVnf(genericVnf.getSelflink());
+ response = vnfmServiceProvider.getVnf(vnfm, genericVnf.getSelflink());
} catch (final Exception exception) {
logger.debug("Ignoring invalid self link in generic vnf", exception);
}
@@ -149,7 +148,7 @@ public class LifecycleManager {
}
private InlineResponse201 sendCreateRequestToVnfm(final CreateVnfRequest aaiRequest, final GenericVnf genericVnf,
- final String vnfIdInAai, final String vnfmId) {
+ final String vnfIdInAai, final EsrVnfm vnfm) {
logger.debug("Sending a create request to SVNFM " + aaiRequest);
final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest vnfmRequest =
new org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest();
@@ -159,7 +158,7 @@ public class LifecycleManager {
vnfmRequest.setVnfInstanceName(aaiRequest.getName().replaceAll(" ", "_"));
vnfmRequest.setVnfInstanceDescription(vnfIdInAai);
- final Optional<InlineResponse201> optionalResponse = vnfmServiceProvider.createVnf(vnfmId, vnfmRequest);
+ final Optional<InlineResponse201> optionalResponse = vnfmServiceProvider.createVnf(vnfm, vnfmRequest);
try {
return optionalResponse.get();
@@ -170,24 +169,24 @@ public class LifecycleManager {
}
}
- private void createNotificationSubscription(final String vnfmId, final String vnfId) {
+ private void createNotificationSubscription(final EsrVnfm vnfm, final String vnfId) {
try {
final LccnSubscriptionRequest subscriptionRequest = vnfmHelper.createNotificationSubscriptionRequest(vnfId);
- vnfmServiceProvider.subscribeForNotifications(vnfmId, subscriptionRequest);
+ vnfmServiceProvider.subscribeForNotifications(vnfm, subscriptionRequest);
} catch (final Exception exception) {
- logger.warn("Subscription for notifications to VNFM: " + vnfmId + " for VNF " + vnfId
+ logger.warn("Subscription for notifications to VNFM: " + vnfm.getVnfmId() + " for VNF " + vnfId
+ " failed. AAI will not be updated unless the VNFM is configured by other means to send notifications relating to this VNF",
exception);
}
}
private String sendInstantiateRequestToVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf,
- final CreateVnfRequest createVnfRequest, final String vnfIdInAai, final String vnfIdInVnfm) {
+ final CreateVnfRequest createVnfRequest) {
final InstantiateVnfRequest instantiateVnfRequest =
vnfmHelper.createInstantiateRequest(createVnfRequest.getTenant(), createVnfRequest,
packageProvider.getFlavourId(genericVnf.getModelVersionId()));
- final String jobId = vnfmServiceProvider.instantiateVnf(genericVnf.getSelflink(), instantiateVnfRequest);
+ final String jobId = vnfmServiceProvider.instantiateVnf(vnfm, genericVnf.getSelflink(), instantiateVnfRequest);
logger.info("Instantiate VNF request successfully sent to " + genericVnf.getSelflink());
return jobId;
@@ -201,18 +200,18 @@ public class LifecycleManager {
*/
public DeleteVnfResponse deleteVnf(final String vnfIdInAai) {
final GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
- final String vnfmId = getIdOfAssignedVnfm(genericVnf);
+ final EsrVnfm vnfm = getAssignedVnfm(genericVnf);
- final String operationId = sendTerminateRequestToVnfm(genericVnf);
- final String jobId = jobManager.createJob(vnfmId, operationId, true);
+ final String operationId = sendTerminateRequestToVnfm(vnfm, genericVnf);
+ final String jobId = jobManager.createJob(vnfm.getVnfmId(), operationId, true);
return new DeleteVnfResponse().jobId(jobId);
}
- private String sendTerminateRequestToVnfm(final GenericVnf genericVnf) {
+ private String sendTerminateRequestToVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf) {
final TerminateVnfRequest terminateVnfRequest = new TerminateVnfRequest();
terminateVnfRequest.setTerminationType(TerminationTypeEnum.FORCEFUL);
- return vnfmServiceProvider.terminateVnf(genericVnf.getSelflink(), terminateVnfRequest);
+ return vnfmServiceProvider.terminateVnf(vnfm, genericVnf.getSelflink(), terminateVnfRequest);
}
private GenericVnf getGenericVnfFromAai(final String vnfIdInAai) {
@@ -224,11 +223,11 @@ public class LifecycleManager {
return genericVnf;
}
- private String getIdOfAssignedVnfm(final GenericVnf genericVnf) {
- final String vnfmId = aaiHelper.getIdOfAssignedVnfm(genericVnf);
- if (vnfmId == null) {
+ private EsrVnfm getAssignedVnfm(final GenericVnf genericVnf) {
+ final EsrVnfm vnfm = aaiHelper.getAssignedVnfm(genericVnf);
+ if (vnfm == null) {
throw new VnfmNotFoundException("No VNFM found in AAI for VNF " + genericVnf.getVnfId());
}
- return vnfmId;
+ return vnfm;
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
index 93c7ea91ff..eb912c8775 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
@@ -156,7 +156,7 @@ public class NotificationHandler implements Runnable {
boolean deleteSuccessful = false;
try {
- vnfmServiceProvider.deleteVnf(genericVnf.getSelflink());
+ vnfmServiceProvider.deleteVnf(aaiHelper.getAssignedVnfm(genericVnf), genericVnf.getSelflink());
deleteSuccessful = true;
} finally {
jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId(),
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java
new file mode 100644
index 0000000000..7f71b2e9d6
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.oauth;
+
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
+
+@Configuration
+@EnableAuthorizationServer
+/**
+ * Configures the authorization server for oauth token based authentication.
+ */
+public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
+
+ private static final int ONE_DAY = 60 * 60 * 24;
+
+ @Value("${vnfmadapter.auth:E39823AAB2739CC654C4E92B52C05BC34149342D0A46451B00CA508C8EDC62242CE4E9DA9445D3C01A3F13}")
+ private String vnfmAdapterAuth;
+
+ @Value("${mso.key}")
+ private String msoEncryptionKey;
+
+ @Override
+ public void configure(final ClientDetailsServiceConfigurer clients) throws Exception {
+ final String[] decrypedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoEncryptionKey).split(":");
+ BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
+ clients.inMemory().withClient(decrypedAuth[0]).secret(passwordEncoder.encode(decrypedAuth[1]))
+ .authorizedGrantTypes("client_credentials").scopes("write").accessTokenValiditySeconds(ONE_DAY)
+ .refreshTokenValiditySeconds(ONE_DAY);
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java
new file mode 100644
index 0000000000..2f51406e23
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.oauth;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import java.lang.reflect.Type;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+public class OAuth2AccessTokenAdapter implements JsonSerializer<OAuth2AccessToken> {
+
+ @Override
+ public JsonElement serialize(final OAuth2AccessToken src, final Type typeOfSrc,
+ final JsonSerializationContext context) {
+ final JsonObject obj = new JsonObject();
+ obj.addProperty(OAuth2AccessToken.ACCESS_TOKEN, src.getValue());
+ obj.addProperty(OAuth2AccessToken.TOKEN_TYPE, src.getTokenType());
+ if (src.getRefreshToken() != null) {
+ obj.addProperty(OAuth2AccessToken.REFRESH_TOKEN, src.getRefreshToken().getValue());
+ }
+ obj.addProperty(OAuth2AccessToken.EXPIRES_IN, src.getExpiresIn());
+ final JsonArray scopeObj = new JsonArray();
+ for (final String scope : src.getScope()) {
+ scopeObj.add(scope);
+ }
+ obj.add(OAuth2AccessToken.SCOPE, scopeObj);
+
+ return obj;
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java
new file mode 100644
index 0000000000..1f0594e811
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.oauth;
+
+import javax.servlet.http.HttpServletRequest;
+import org.onap.so.adapters.vnfmadapter.Constants;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+import org.springframework.security.web.util.matcher.RequestMatcher;
+
+@Configuration
+@EnableResourceServer
+/**
+ * Enforces oauth token based authentication when a token is provided in the request.
+ */
+public class OAuth2ResourceServer extends ResourceServerConfigurerAdapter {
+
+ @Override
+ public void configure(final HttpSecurity http) throws Exception {
+ http.requestMatcher(new OAuth2ResourceServerRequestMatcher()).authorizeRequests()
+ .antMatchers(Constants.BASE_URL + "/grants/**", Constants.BASE_URL + "/lcn/**").authenticated();
+ }
+
+ private static class OAuth2ResourceServerRequestMatcher implements RequestMatcher {
+ @Override
+ public boolean matches(HttpServletRequest request) {
+ String auth = request.getHeader("Authorization");
+ String uri = request.getRequestURI();
+ return (auth != null && auth.startsWith("Bearer") && (uri.contains("/grants") || uri.contains("/lcn/")));
+ }
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
index 9cb09e6261..f97822a0cd 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
@@ -20,6 +20,14 @@
package org.onap.so.adapters.vnfmadapter.rest;
+import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
+import static org.slf4j.LoggerFactory.getLogger;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import javax.ws.rs.core.MediaType;
+import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
@@ -39,12 +47,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-import javax.ws.rs.core.MediaType;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
-import static org.slf4j.LoggerFactory.getLogger;
/**
* Controller for handling notifications from the VNFM (Virtual Network Function Manager).
@@ -118,8 +120,12 @@ public class Sol003LcnContoller {
private InlineResponse201 getVnfInstance(
final VnfLcmOperationOccurrenceNotification vnfLcmOperationOccurrenceNotification) {
- return vnfmServiceProvider.getVnf(vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref())
- .get();
+ GenericVnf vnfInAai = aaiServiceProvider
+ .invokeQueryGenericVnf(vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref())
+ .getGenericVnf().get(0);
+ EsrVnfm vnfm = aaiHelper.getAssignedVnfm(vnfInAai);
+ return vnfmServiceProvider
+ .getVnf(vnfm, vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref()).get();
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
index 951d4a3bb9..4434d2edd9 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
@@ -23,11 +23,22 @@ spring:
http:
converters:
preferred-json-mapper: gson
+
+http:
+ client:
+ ssl:
+ trust-store: classpath:org.onap.so.trust.jks
+ trust-store-password: ',sx#.C*W)]wVgJC6ccFHI#:H'
server:
port: 9092
tomcat:
max-threads: 50
+ ssl:
+ key-alias: so@so.onap.org
+ key--store-password: 'ywsqCy:EEo#j}HJHM7z^Rk[L'
+ key-store: classpath:so-vnfm-adapter.p12
+ key-store-type: PKCS12
mso:
key: 07a7159d3bf51a0e53be7a8f89699be7
@@ -44,7 +55,7 @@ sdc:
endpoint: http://sdc.onap/1234A
vnfmadapter:
- endpoint: http://so-vnfm-adapter.onap:9092
+ endpoint: https://so-vnfm-adapter.onap:9092
#Actuator
management:
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jks b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jks
new file mode 100644
index 0000000000..1f0d8a550a
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jks
Binary files differ
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12 b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12
new file mode 100644
index 0000000000..ae4fddc684
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12
Binary files differ
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
index aeb7cd3540..89a2c102f4 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
@@ -46,6 +46,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.hamcrest.MockitoHamcrest;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Relationship;
@@ -169,6 +171,7 @@ public class Sol003LcnControllerTest {
.andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON));
final GenericVnf genericVnf = createGenericVnf("vnfmType1");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
final List<GenericVnf> listOfGenericVnfs = new ArrayList<>();
listOfGenericVnfs.add(genericVnf);
final GenericVnfs genericVnfs = new GenericVnfs();
@@ -176,6 +179,12 @@ public class Sol003LcnControllerTest {
doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher(
"/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
+ EsrVnfm vnfm = new EsrVnfm();
+ vnfm.setVnfmId("vnfm1");
+ final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
+ vnfm.setEsrSystemInfoList(esrSystemInfoList);
+ doReturn(Optional.of(vnfm)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1?depth=1")));
final ResponseEntity<Void> response =
controller.lcnVnfLcmOperationOccurrenceNotificationPost(vnfLcmOperationOccurrenceNotification);
@@ -226,6 +235,7 @@ public class Sol003LcnControllerTest {
.andRespond(withStatus(HttpStatus.NO_CONTENT).contentType(MediaType.APPLICATION_JSON));
final GenericVnf genericVnf = createGenericVnf("vnfmType1");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
genericVnf.setSelflink("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm");
final List<GenericVnf> listOfGenericVnfs = new ArrayList<>();
listOfGenericVnfs.add(genericVnf);
@@ -236,6 +246,12 @@ public class Sol003LcnControllerTest {
doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher(
"/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
+ EsrVnfm vnfm = new EsrVnfm();
+ vnfm.setVnfmId("vnfm1");
+ final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
+ vnfm.setEsrSystemInfoList(esrSystemInfoList);
+ doReturn(Optional.of(vnfm)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1?depth=1")));
final ResponseEntity<Void> response =
controller.lcnVnfLcmOperationOccurrenceNotificationPost(vnfLcmOperationOccurrenceNotification);
@@ -323,6 +339,22 @@ public class Sol003LcnControllerTest {
return genericVnf;
}
+ private void addRelationshipFromGenericVnfToVnfm(final GenericVnf genericVnf, final String vnfmId) {
+ final Relationship relationshipToVnfm = new Relationship();
+ relationshipToVnfm.setRelatedLink("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/" + vnfmId);
+ relationshipToVnfm.setRelatedTo("esr-vnfm");
+ final RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipKey("esr-vnfm.vnfm-id");
+ relationshipData.setRelationshipValue(vnfmId);
+ relationshipToVnfm.getRelationshipData().add(relationshipData);
+
+ if (genericVnf.getRelationshipList() == null) {
+ final RelationshipList relationshipList = new RelationshipList();
+ genericVnf.setRelationshipList(relationshipList);
+ }
+ genericVnf.getRelationshipList().getRelationship().add(relationshipToVnfm);
+ }
+
private void addRelationshipFromGenericVnfToVserver(final GenericVnf genericVnf, final String vserverId) {
final Relationship relationshipToVserver = new Relationship();
relationshipToVserver.setRelatedTo("vserver");
@@ -343,9 +375,11 @@ public class Sol003LcnControllerTest {
relationshipData4.setRelationshipValue(TENANT_ID);
relationshipToVserver.getRelationshipData().add(relationshipData4);
- final RelationshipList relationshipList = new RelationshipList();
- relationshipList.getRelationship().add(relationshipToVserver);
- genericVnf.setRelationshipList(relationshipList);
+ if (genericVnf.getRelationshipList() == null) {
+ final RelationshipList relationshipList = new RelationshipList();
+ genericVnf.setRelationshipList(relationshipList);
+ }
+ genericVnf.getRelationshipList().getRelationship().add(relationshipToVserver);
}
private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
index b48de30f88..fe55907420 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -133,7 +133,7 @@ public class VnfmAdapterControllerTest {
setUpVimInMockAai();
final String expectedsubscriptionRequest =
- "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"BASIC\"],\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"password1$\"}}}";
+ "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"OAUTH2_CLIENT_CREDENTIALS\", \"BASIC\", \"TLS_CERT\"],\"paramsOauth2ClientCredentials\":{\"clientId\":\"vnfm\",\"clientPassword\":\"password1$\",\"tokenEndpoint\":\"https://so-vnfm-adapter.onap:30406/oauth/token\"},\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"password1$\"}}}";
final InlineResponse2001 subscriptionResponse = new InlineResponse2001();
final InlineResponse201 createResponse = createCreateResponse();
@@ -214,6 +214,8 @@ public class VnfmAdapterControllerTest {
final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType1");
addSelfLinkToGenericVnf(genericVnf);
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ setUpVnfmsInMockAai();
final InlineResponse201 reponse = new InlineResponse201();
mockRestServer.expect(requestTo(new URI("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm")))
@@ -239,7 +241,7 @@ public class VnfmAdapterControllerTest {
final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType2");
- addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm2");
setUpVnfmsInMockAai();
setUpVimInMockAai();
@@ -279,24 +281,25 @@ public class VnfmAdapterControllerTest {
public void deleteVnf_ValidRequest_Returns202AndJobId() throws Exception {
final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
- final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType");
+ final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType1");
addSelfLinkToGenericVnf(genericVnf);
- addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ setUpVnfmsInMockAai();
mockRestServer.expect(requestTo("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm/terminate"))
.andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON)
- .location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/1234567")));
+ .location(new URI("http://vnfm1:8080/vnf_lcm_op_occs/1234567")));
final InlineResponse200 firstOperationQueryResponse = createOperationQueryResponse(
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
- mockRestServer.expect(requestTo("http://vnfm:8080/vnf_lcm_op_occs/1234567"))
+ mockRestServer.expect(requestTo("http://vnfm1:8080/vnf_lcm_op_occs/1234567"))
.andRespond(withSuccess(gson.toJson(firstOperationQueryResponse), MediaType.APPLICATION_JSON));
final InlineResponse200 secondOperationQueryReponse = createOperationQueryResponse(
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
- mockRestServer.expect(requestTo("http://vnfm:8080/vnf_lcm_op_occs/1234567"))
+ mockRestServer.expect(requestTo("http://vnfm1:8080/vnf_lcm_op_occs/1234567"))
.andRespond(withSuccess(gson.toJson(secondOperationQueryReponse), MediaType.APPLICATION_JSON));
final RequestEntity<Void> request = RequestEntity
@@ -308,16 +311,6 @@ public class VnfmAdapterControllerTest {
assertEquals(202, deleteVnfResponse.getStatusCode().value());
assertNotNull(deleteVnfResponse.getBody().getJobId());
- final EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
- esrSystemInfo.setServiceUrl("http://vnfm:8080");
- esrSystemInfo.setType("vnfmType");
- esrSystemInfo.setSystemType("VNFM");
- final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- esrSystemInfoList.getEsrSystemInfo().add(esrSystemInfo);
-
- doReturn(Optional.of(esrSystemInfoList)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/...")));
-
final ResponseEntity<QueryJobResponse> firstJobQueryResponse =
controller.jobQuery(deleteVnfResponse.getBody().getJobId(), "", "so", "1213");
assertEquals(OperationEnum.TERMINATE, firstJobQueryResponse.getBody().getOperation());
@@ -367,9 +360,10 @@ public class VnfmAdapterControllerTest {
public void deleteVnf_ErrorStatusCodeFromVnfm_Returns500() throws Exception {
final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
- final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType");
+ final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType1");
addSelfLinkToGenericVnf(genericVnf);
- addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ setUpVnfmsInMockAai();
mockRestServer.expect(requestTo("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm/terminate"))
.andRespond(withStatus(HttpStatus.BAD_REQUEST).contentType(MediaType.APPLICATION_JSON));
@@ -419,12 +413,7 @@ public class VnfmAdapterControllerTest {
private void addRelationshipFromGenericVnfToVnfm(final GenericVnf genericVnf, final String vnfmId) {
final Relationship relationshipToVnfm = new Relationship();
- relationshipToVnfm.setRelatedLink(
- "/aai/v15/external-system/esr-vnfm-li// final InlineResponse201 vnfInstance = new InlineResponse201();\n"
- + "// vnfInstance.setInstantiationState(InstantiationStateEnum.NOT_INSTANTIATED);\n"
- + "// mockRestServer.expect(requestTo(\"http://dummy.value/until/create/implememted/vnfId\"))\n"
- + "// .andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON));st/esr-vnfm/"
- + vnfmId);
+ relationshipToVnfm.setRelatedLink("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/" + vnfmId);
relationshipToVnfm.setRelatedTo("esr-vnfm");
final RelationshipData relationshipData = new RelationshipData();
relationshipData.setRelationshipKey("esr-vnfm.vnfm-id");
@@ -465,6 +454,12 @@ public class VnfmAdapterControllerTest {
esrVnfmList.getEsrVnfm().add(esrVnfm1);
esrVnfmList.getEsrVnfm().add(esrVnfm2);
+ doReturn(Optional.of(esrVnfm1)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1?depth=1")));
+
+ doReturn(Optional.of(esrVnfm2)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm2?depth=1")));
+
doReturn(Optional.of(esrVnfmList)).when(aaiResourcesClient).get(eq(EsrVnfmList.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list")));
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml
index 3afc542a1b..8cf8b51b9f 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml
@@ -38,3 +38,17 @@ sdc:
vnfmadapter:
endpoint: https://so-vnfm-adapter.onap:30406
+
+#Actuator
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
index a5e3340c76..e00bb1eb36 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
@@ -38,21 +38,26 @@ import java.security.SecureRandom;
@Profile("!test")
public class ASDCControllerSingleton {
+ private static final Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class);
+ private final ASDCController asdcController;
@Autowired
- private ASDCController asdcController;
- private static Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class);
-
-
+ public ASDCControllerSingleton(final ASDCController asdcController) {
+ this.asdcController = asdcController;
+ }
@Scheduled(fixedRate = 50000)
public void periodicControllerTask() {
try {
- int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
+ final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
asdcController.setControllerName("mso-controller" + randomNumber);
- asdcController.initASDC();
- } catch (ASDCControllerException e) {
- logger.error("Exception occurred", e);
+ if (asdcController.isStopped()) {
+ logger.info("{} not running will try to initialize it, currrent status: {}",
+ asdcController.getClass().getName(), asdcController.getControllerStatus());
+ asdcController.initASDC();
+ }
+ } catch (final ASDCControllerException controllerException) {
+ logger.error("Exception occurred", controllerException);
}
}
@@ -60,8 +65,8 @@ public class ASDCControllerSingleton {
private void terminate() {
try {
asdcController.closeASDC();
- } catch (ASDCControllerException e) {
- logger.error("Exception occurred", e);
+ } catch (final ASDCControllerException controllerException) {
+ logger.error("Exception occurred", controllerException);
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
index eb2957c6f8..2c8347260f 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/Application.java
@@ -35,7 +35,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
public class Application {
private static final Logger logger = LoggerFactory.getLogger(Application.class);
- private static final String MSO_CONFIG_PATH = "mso.config.path";
private static final String LOGS_DIR = "logs_dir";
@Autowired
@@ -47,11 +46,6 @@ public class Application {
}
}
- private static void setConfigPath() {
- if (System.getProperty(MSO_CONFIG_PATH) == null)
- System.getProperties().setProperty(MSO_CONFIG_PATH, ".");
- }
-
@PostConstruct
private void deployActivities() {
try {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java b/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
index 3494945020..39bb836ff8 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
@@ -20,11 +20,9 @@
package org.onap.so.asdc;
-
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
@@ -36,6 +34,8 @@ import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
@Configuration
@EnableTransactionManagement
@@ -44,11 +44,17 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Profile({"!test"})
public class CatalogDBConfig {
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari")
+ public HikariConfig catalogDbConfig() {
+ return new HikariConfig();
+ }
+
@Primary
@Bean(name = "dataSource")
- @ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
- return DataSourceBuilder.create().build();
+ HikariConfig hikariConfig = this.catalogDbConfig();
+ return new HikariDataSource(hikariConfig);
}
@Primary
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
index 902506974a..22265a0cc6 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/JerseyConfiguration.java
@@ -24,7 +24,9 @@ import javax.annotation.PostConstruct;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.onap.so.asdc.client.test.rest.ASDCRestInterface;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
import io.swagger.jaxrs.config.BeanConfig;
import io.swagger.jaxrs.listing.ApiListingResource;
import io.swagger.jaxrs.listing.SwaggerSerializers;
@@ -33,6 +35,12 @@ import io.swagger.jaxrs.listing.SwaggerSerializers;
@ApplicationPath("/test")
public class JerseyConfiguration extends ResourceConfig {
+ private Environment environment;
+
+ @Autowired
+ public JerseyConfiguration(final Environment environment) {
+ this.environment = environment;
+ }
@PostConstruct
public void setUp() {
@@ -40,10 +48,10 @@ public class JerseyConfiguration extends ResourceConfig {
register(ApiListingResource.class);
register(SwaggerSerializers.class);
- BeanConfig beanConfig = new BeanConfig();
+ final BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.2");
beanConfig.setSchemes(new String[] {"http"});
- beanConfig.setHost("localhost:8080");
+ beanConfig.setHost("localhost:" + environment.getProperty("server.port"));
beanConfig.setBasePath("/mso");
beanConfig.setResourcePackage("org.onap.so.apihandlerinfra");
beanConfig.setPrettyPrint(true);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java b/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
index 8320da01cf..821b2dacff 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
@@ -20,11 +20,9 @@
package org.onap.so.asdc;
-
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
@@ -35,6 +33,8 @@ import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
@Configuration
@EnableTransactionManagement
@@ -43,13 +43,18 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Profile({"!test"})
public class RequestDBConfig {
+ @Bean
+ @ConfigurationProperties(prefix = "request.datasource.hikari")
+ public HikariConfig requestDbConfig() {
+ return new HikariConfig();
+ }
+
@Bean(name = "requestDataSource")
- @ConfigurationProperties(prefix = "request.datasource")
public DataSource dataSource() {
- return DataSourceBuilder.create().build();
+ HikariConfig hikariConfig = this.requestDbConfig();
+ return new HikariDataSource(hikariConfig);
}
-
@Bean(name = "requestEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
@Qualifier("requestDataSource") DataSource dataSource) {
@@ -57,7 +62,6 @@ public class RequestDBConfig {
.build();
}
-
@Bean(name = "requestTransactionManager")
public PlatformTransactionManager transactionManager(
@Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
index 619d89438e..c37eccf594 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
@@ -22,6 +22,7 @@ package org.onap.so.asdc.activity;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.apache.http.entity.ContentType;
import org.onap.so.asdc.activity.beans.ActivitySpec;
@@ -68,9 +69,9 @@ public class ActivitySpecsActions {
int statusCode = response.getStatus();
if (statusCode == HttpStatus.SC_UNPROCESSABLE_ENTITY) {
- logger.warn("{} {} {}", "ActivitySpec", activitySpec.getName(), "already exists in SDC");
+ logger.warn(LoggingAnchor.THREE, "ActivitySpec", activitySpec.getName(), "already exists in SDC");
} else if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_CREATED) {
- logger.warn("{} {} {}", "Error creating activity spec", activitySpec.getName(), statusCode);
+ logger.warn(LoggingAnchor.THREE, "Error creating activity spec", activitySpec.getName(), statusCode);
} else {
if (response.getEntity() != null) {
ActivitySpecCreateResponse activitySpecCreateResponse =
@@ -78,14 +79,14 @@ public class ActivitySpecsActions {
if (activitySpecCreateResponse != null) {
activitySpecId = activitySpecCreateResponse.getId();
} else {
- logger.warn("{} {}", "Unable to read activity spec", activitySpec.getName());
+ logger.warn(LoggingAnchor.TWO, "Unable to read activity spec", activitySpec.getName());
}
} else {
- logger.warn("{} {}", "No activity spec response returned", activitySpec.getName());
+ logger.warn(LoggingAnchor.TWO, "No activity spec response returned", activitySpec.getName());
}
}
} catch (Exception e) {
- logger.warn("{} {}", "Exception creating activitySpec", e.getMessage());
+ logger.warn(LoggingAnchor.TWO, "Exception creating activitySpec", e);
}
return activitySpecId;
@@ -111,15 +112,15 @@ public class ActivitySpecsActions {
int statusCode = response.getStatus();
if (statusCode == HttpStatus.SC_UNPROCESSABLE_ENTITY) {
- logger.warn("{} {} {}", "ActivitySpec with id", activitySpecId, "is already certified in SDC");
+ logger.warn(LoggingAnchor.THREE, "ActivitySpec with id", activitySpecId, "is already certified in SDC");
} else if (statusCode != HttpStatus.SC_OK) {
- logger.warn("{} {} {}", "Error certifying activity", activitySpecId, statusCode);
+ logger.warn(LoggingAnchor.THREE, "Error certifying activity", activitySpecId, statusCode);
} else {
certificationResult = true;
}
} catch (Exception e) {
- logger.warn("{} {}", "Exception certifying activitySpec", e.getMessage());
+ logger.warn(LoggingAnchor.TWO, "Exception certifying activitySpec", e);
}
return certificationResult;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 54da1b9247..0fc94c8bd6 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -22,6 +22,7 @@ package org.onap.so.asdc.activity;
import java.util.ArrayList;
import java.util.List;
+import org.onap.so.logger.LoggingAnchor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -66,15 +67,15 @@ public class DeployActivitySpecs {
ActivitySpec activitySpec = mapActivitySpecFromCatalogToSdc(activitySpecFromCatalog);
String activitySpecId = activitySpecsActions.createActivitySpec(hostname, activitySpec);
if (activitySpecId != null) {
- logger.info("{} {}", "Successfully created activitySpec", activitySpec.getName());
+ logger.info(LoggingAnchor.TWO, "Successfully created activitySpec", activitySpec.getName());
boolean certificationResult = activitySpecsActions.certifyActivitySpec(hostname, activitySpecId);
if (certificationResult) {
- logger.info("{} {}", "Successfully certified activitySpec", activitySpec.getName());
+ logger.info(LoggingAnchor.TWO, "Successfully certified activitySpec", activitySpec.getName());
} else {
- logger.info("{} {}", "Failed to certify activitySpec", activitySpec.getName());
+ logger.info(LoggingAnchor.TWO, "Failed to certify activitySpec", activitySpec.getName());
}
} else {
- logger.info("{} {}", "Failed to create activitySpec", activitySpec.getName());
+ logger.info(LoggingAnchor.TWO, "Failed to create activitySpec", activitySpec.getName());
}
}
}
@@ -91,15 +92,13 @@ public class DeployActivitySpecs {
private void mapCategoryList(List<ActivitySpecActivitySpecCategories> activitySpecActivitySpecCategories,
ActivitySpec activitySpec) {
- if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.size() == 0) {
+ if (activitySpecActivitySpecCategories == null || activitySpecActivitySpecCategories.isEmpty()) {
return;
}
- List<String> categoryList = new ArrayList<String>();
+ List<String> categoryList = new ArrayList<>();
for (ActivitySpecActivitySpecCategories activitySpecCat : activitySpecActivitySpecCategories) {
- if (activitySpecCat != null) {
- if (activitySpecCat.getActivitySpecCategories() != null) {
- categoryList.add(activitySpecCat.getActivitySpecCategories().getName());
- }
+ if (activitySpecCat != null && activitySpecCat.getActivitySpecCategories() != null) {
+ categoryList.add(activitySpecCat.getActivitySpecCategories().getName());
}
}
activitySpec.setCategoryList(categoryList);
@@ -107,11 +106,11 @@ public class DeployActivitySpecs {
private void mapInputsAndOutputs(List<ActivitySpecActivitySpecParameters> activitySpecActivitySpecParameters,
ActivitySpec activitySpec) {
- if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.size() == 0) {
+ if (activitySpecActivitySpecParameters == null || activitySpecActivitySpecParameters.isEmpty()) {
return;
}
- List<Input> inputs = new ArrayList<Input>();
- List<Output> outputs = new ArrayList<Output>();
+ List<Input> inputs = new ArrayList<>();
+ List<Output> outputs = new ArrayList<>();
for (ActivitySpecActivitySpecParameters activitySpecParam : activitySpecActivitySpecParameters) {
if (activitySpecParam != null) {
if (activitySpecParam.getActivitySpecParameters() != null) {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
index 60abdc33ef..639a96eab6 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
@@ -22,7 +22,6 @@
package org.onap.so.asdc.client;
-
import java.security.GeneralSecurityException;
import java.util.Arrays;
import java.util.Collections;
@@ -40,11 +39,11 @@ import org.springframework.stereotype.Component;
public class ASDCConfiguration implements IConfiguration {
// SHell command to obtain the same encryption, 128 bits key, key must be HEX
- // echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973 -nosalt | xxd
+ // echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973
+ // -nosalt | xxd
private static Logger logger = LoggerFactory.getLogger(ASDCConfiguration.class);
-
private String asdcControllerName;
public static final String HEAT = "HEAT";
@@ -74,7 +73,6 @@ public class ASDCConfiguration implements IConfiguration {
@Value("${mso.asdc-connections.asdc-controller1.messageBusAddress}")
private String[] messageBusAddress;
-
public void setAsdcControllerName(String asdcControllerName) {
this.asdcControllerName = asdcControllerName;
}
@@ -96,15 +94,12 @@ public class ASDCConfiguration implements IConfiguration {
} else {
return Collections.emptyList();
}
-
-
}
public String getAsdcControllerName() {
return asdcControllerName;
}
-
@Override
public String getConsumerGroup() {
return getPropertyOrNull("mso.asdc-connections.asdc-controller1.consumerGroup");
@@ -172,6 +167,7 @@ public class ASDCConfiguration implements IConfiguration {
try {
return Boolean.valueOf(config);
} catch (Exception e) {
+ logger.warn("Exception while getting boolean property with default property", e);
return defaultValue;
}
}
@@ -194,7 +190,8 @@ public class ASDCConfiguration implements IConfiguration {
@Override
public List<String> getRelevantArtifactTypes() {
- // DO not return the Static List SUPPORTED_ARTIFACT_TYPES_LIST because the ASDC Client will try to modify it !!!
+ // DO not return the Static List SUPPORTED_ARTIFACT_TYPES_LIST because the ASDC Client will
+ // try to modify it !!!
return Arrays.asList(SUPPORTED_ARTIFACT_TYPES);
}
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 c0f403f388..90116ad4f5 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -36,6 +36,8 @@ import java.io.UnsupportedEncodingException;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
@@ -70,6 +72,7 @@ import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
@@ -79,6 +82,8 @@ public class ASDCController {
protected static final Logger logger = LoggerFactory.getLogger(ASDCController.class);
+ private static final String UNKNOWN = "Unknown";
+
protected boolean isAsdcClientAutoManaged = false;
protected String controllerName;
@@ -117,6 +122,25 @@ public class ASDCController {
@Autowired
DeployActivitySpecs deployActivitySpecs;
+ public ASDCController() {
+ this("");
+ }
+
+ 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) {
+ distributionClient = asdcClient;
+ this.controllerName = controllerConfigName;
+ }
+
public int getNbOfNotificationsOngoing() {
return nbOfNotificationsOngoing;
}
@@ -157,25 +181,6 @@ public class ASDCController {
return this.controllerStatus;
}
- public ASDCController() {
- this("");
- }
-
- 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) {
- distributionClient = asdcClient;
- this.controllerName = controllerConfigName;
- }
-
public String getControllerName() {
return controllerName;
}
@@ -193,11 +198,9 @@ public class ASDCController {
* @throws IOException In case of issues when trying to load the key file
*/
public void initASDC() throws ASDCControllerException {
- String event = "Initialize the ASDC Controller";
- logger.debug(event);
- if (this.getControllerStatus() != ASDCControllerStatus.STOPPED) {
- String endEvent = "The controller is already initialized, call the closeASDC method first";
- throw new ASDCControllerException(endEvent);
+ logger.debug("Initialize the ASDC Controller");
+ if (!isStopped()) {
+ throw new ASDCControllerException("The controller is already initialized, call the closeASDC method first");
}
if (asdcConfig != null) {
@@ -230,7 +233,15 @@ public class ASDCController {
}
this.changeControllerStatus(ASDCControllerStatus.IDLE);
- logger.info("{} {} {}", MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC.toString(), "ASDC", "changeControllerStatus");
+ logger.info(LoggingAnchor.THREE, MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC.toString(), "ASDC",
+ "changeControllerStatus");
+ }
+
+ /**
+ * @return true if controller is stopped
+ */
+ public boolean isStopped() {
+ return this.getControllerStatus() == ASDCControllerStatus.STOPPED;
}
/**
@@ -241,7 +252,7 @@ public class ASDCController {
*/
public void closeASDC() throws ASDCControllerException {
- if (this.getControllerStatus() == ASDCControllerStatus.BUSY) {
+ if (isBusy()) {
throw new ASDCControllerException("Cannot close the ASDC controller as it's currently in BUSY state");
}
if (this.distributionClient != null) {
@@ -257,12 +268,19 @@ public class ASDCController {
this.changeControllerStatus(ASDCControllerStatus.STOPPED);
}
+ /**
+ * @return true if controller is currently processing notification
+ */
+ public boolean isBusy() {
+ return this.getControllerStatus() == ASDCControllerStatus.BUSY;
+ }
+
protected boolean checkResourceAlreadyDeployed(ResourceStructure resource, boolean serviceDeployed)
throws ArtifactInstallerException {
if (toscaInstaller.isResourceAlreadyDeployed(resource, serviceDeployed)) {
- logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST.toString(),
+ logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST.toString(),
resource.getResourceInstance().getResourceInstanceName(),
resource.getResourceInstance().getResourceUUID(), resource.getResourceInstance().getResourceName());
@@ -332,7 +350,7 @@ public class ASDCController {
try {
downloadResult = distributionClient.download(artifact);
if (null == downloadResult) {
- logger.info("{} {}", MessageEnum.ASDC_ARTIFACT_NULL.toString(), artifact.getArtifactUUID());
+ logger.info(LoggingAnchor.TWO, MessageEnum.ASDC_ARTIFACT_NULL.toString(), artifact.getArtifactUUID());
return downloadResult;
}
} catch (RuntimeException e) {
@@ -344,11 +362,12 @@ public class ASDCController {
}
if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult())) {
- logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC.toString(), artifact.getArtifactURL(),
- artifact.getArtifactUUID(), String.valueOf(downloadResult.getArtifactPayload().length));
+ logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC.toString(),
+ artifact.getArtifactURL(), artifact.getArtifactUUID(),
+ String.valueOf(downloadResult.getArtifactPayload().length));
} else {
- logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ logger.error(LoggingAnchor.SEVEN, MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
downloadResult.getDistributionMessageResult(), ErrorCode.DataError.getValue(),
"ASDC artifact download fail");
@@ -389,12 +408,12 @@ public class ASDCController {
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());
+ logger.info(LoggingAnchor.FOUR, 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(),
+ logger.error(LoggingAnchor.SEVEN, MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
resultArtifact.getDistributionMessageResult(), ErrorCode.DataError.getValue(),
"ASDC write to file failed");
@@ -409,7 +428,7 @@ public class ASDCController {
for (IArtifactInfo artifactInfo : resourceStructure.getResourceInstance().getArtifacts()) {
if ((DistributionStatusEnum.DEPLOY_OK.equals(distribStatus)
- && !artifactInfo.getArtifactType().equalsIgnoreCase("OTHER")
+ && !("OTHER").equalsIgnoreCase(artifactInfo.getArtifactType())
&& !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
@@ -442,7 +461,7 @@ public class ASDCController {
protected void deployResourceStructure(ResourceStructure resourceStructure,
ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
- logger.info("{} {} {} {}", MessageEnum.ASDC_START_DEPLOY_ARTIFACT.toString(),
+ logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_START_DEPLOY_ARTIFACT.toString(),
resourceStructure.getResourceInstance().getResourceInstanceName(),
resourceStructure.getResourceInstance().getResourceUUID(), "ASDC");
try {
@@ -450,7 +469,7 @@ public class ASDCController {
toscaInstaller.installTheResource(toscaResourceStructure, resourceStructure);
} catch (ArtifactInstallerException e) {
- logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ logger.info(LoggingAnchor.SIX, MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
resourceStructure.getResourceInstance().getResourceName(),
resourceStructure.getResourceInstance().getResourceUUID(),
String.valueOf(resourceStructure.getNumberOfResources()), "ASDC", "deployResourceStructure");
@@ -459,7 +478,7 @@ public class ASDCController {
}
if (resourceStructure.isDeployedSuccessfully() || toscaResourceStructure.isDeployedSuccessfully()) {
- logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
+ logger.info(LoggingAnchor.SIX, MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
resourceStructure.getResourceInstance().getResourceName(),
resourceStructure.getResourceInstance().getResourceUUID(),
String.valueOf(resourceStructure.getNumberOfResources()), "ASDC", "deployResourceStructure");
@@ -482,11 +501,11 @@ public class ASDCController {
if (errorReason != null) {
event = event + "(" + errorReason + ")";
}
- logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC.toString(), notificationType.name(),
+ logger.info(LoggingAnchor.SIX, MessageEnum.ASDC_SEND_NOTIF_ASDC.toString(), notificationType.name(),
status.name(), artifactURL, "ASDC", "sendASDCNotification");
logger.debug(event);
- String action = "";
+
try {
IDistributionStatusMessage message =
new DistributionStatusMessage(artifactURL, consumerID, distributionID, status, timestamp);
@@ -498,7 +517,7 @@ public class ASDCController {
} else {
this.distributionClient.sendDownloadStatus(message);
}
- action = "sendDownloadStatus";
+
break;
case DEPLOY:
if (errorReason != null) {
@@ -506,13 +525,13 @@ public class ASDCController {
} else {
this.distributionClient.sendDeploymentStatus(message);
}
- action = "sendDeploymentdStatus";
+
break;
default:
break;
}
} catch (RuntimeException e) {
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
+ logger.warn(LoggingAnchor.FIVE, MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
"sendASDCNotification", ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification",
e);
}
@@ -539,7 +558,7 @@ public class ASDCController {
} catch (RuntimeException e) {
logger.debug("Exception caught in sendFinalDistributionStatus {}", e.getMessage());
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
+ logger.warn(LoggingAnchor.FIVE, MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
"sendASDCNotification", ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification",
e);
}
@@ -568,11 +587,15 @@ public class ASDCController {
for (IResourceInstance resource : iNotif.getResources()) {
noOfArtifacts += resource.getArtifacts().size();
}
- logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(), String.valueOf(noOfArtifacts),
- iNotif.getServiceUUID(), "ASDC");
+ logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(),
+ String.valueOf(noOfArtifacts), iNotif.getServiceUUID(), "ASDC");
try {
+
+ if (iNotif.getDistributionID() != null && !iNotif.getDistributionID().isEmpty()) {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, iNotif.getDistributionID());
+ }
logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
- logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(),
+ logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(),
"ASDC", "treatNotification");
this.changeControllerStatus(ASDCControllerStatus.BUSY);
@@ -641,6 +664,8 @@ public class ASDCController {
}
}
+ wd.updateCatalogDBStatus(iNotif.getServiceInvariantUUID(), overallStatus);
+
if (isDeploySuccess && watchdogError == null) {
sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK,
null);
@@ -655,14 +680,13 @@ public class ASDCController {
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(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Database concurrency exception: ", "ASDC", "treatNotification",
ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e);
@@ -707,12 +731,6 @@ public class ASDCController {
try {
this.processCsarServiceArtifacts(iNotif, toscaResourceStructure);
- IArtifactInfo iArtifact = toscaResourceStructure.getToscaArtifact();
- String filePath =
- msoConfigPath + "/ASDC/" + iArtifact.getArtifactVersion() + "/" + iArtifact.getArtifactName();
- File csarFile = new File(filePath);
-
-
if (isCsarAlreadyDeployed(iNotif, toscaResourceStructure)) {
return;
}
@@ -724,8 +742,7 @@ public class ASDCController {
logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID());
- if ("VF".equals(resourceType) && resource.getArtifacts() != null
- && !resource.getArtifacts().isEmpty()) {
+ if ("VF".equals(resourceType)) {
resourceStructure = new VfResourceStructure(iNotif, resource);
} else if ("PNF".equals(resourceType)) {
resourceStructure = new PnfResourceStructure(iNotif, resource);
@@ -743,8 +760,8 @@ public class ASDCController {
logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: "
+ resourceStructure.getResourceInstance().getResourceUUID());
- if ("VF".equals(resourceType) && resource.getArtifacts() != null
- && !resource.getArtifacts().isEmpty()) {
+
+ if ("VF".equals(resourceType)) {
hasVFResource = true;
for (IArtifactInfo artifact : resource.getArtifacts()) {
IDistributionClientDownloadResult resultArtifact =
@@ -804,7 +821,7 @@ public class ASDCController {
errorMessage);
} catch (ASDCDownloadException | UnsupportedEncodingException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during Installation of artifact", "ASDC", "processResourceNotification",
ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e);
}
@@ -850,7 +867,7 @@ public class ASDCController {
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during processCsarServiceArtifacts", "ASDC",
"processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(),
"Exception in processCsarServiceArtifacts", e);
@@ -871,7 +888,7 @@ public class ASDCController {
} catch (Exception e) {
logger.info("Whats the error {}", e.getMessage());
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during processCsarServiceArtifacts", "ASDC",
"processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(),
"Exception in processCsarServiceArtifacts", e);
@@ -882,7 +899,7 @@ public class ASDCController {
}
}
- private static final String UNKNOWN = "Unknown";
+
/**
* @return the address of the ASDC we are connected to.
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 f4cfb1361f..93e4aee3d7 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
@@ -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
@@ -59,7 +61,7 @@ public class ArtifactInfoImpl implements IArtifactInfo {
}
public static List<ArtifactInfoImpl> convertToArtifactInfoImpl(List<IArtifactInfo> list) {
- List<ArtifactInfoImpl> ret = new ArrayList<ArtifactInfoImpl>();
+ List<ArtifactInfoImpl> ret = new ArrayList<>();
if (list != null) {
for (IArtifactInfo artifactInfo : list) {
ret.add(new ArtifactInfoImpl(artifactInfo));
@@ -159,7 +161,7 @@ public class ArtifactInfoImpl implements IArtifactInfo {
@Override
public List<IArtifactInfo> getRelatedArtifacts() {
- List<IArtifactInfo> temp = new ArrayList<IArtifactInfo>();
+ List<IArtifactInfo> temp = new ArrayList<>();
if (relatedArtifactsInfo != null) {
temp.addAll(relatedArtifactsImpl);
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java
index f4d3e5ce48..20cd9801e9 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonVfModuleMetaData.java
@@ -33,16 +33,16 @@ public class JsonVfModuleMetaData implements IVfModuleData {
@JsonProperty("artifacts")
private List<String> artifacts;
@JsonProperty("properties")
- // private List<Map<String, Object>> properties = new ArrayList<>();
+
private Map<String, String> properties = new HashMap<>();
+ @JsonIgnore
+ private Map<String, Object> attributesMap = new HashMap<>();
+
public Map<String, String> getProperties() {
return properties;
}
- @JsonIgnore
- private Map<String, Object> attributesMap = new HashMap<>();
-
@Override
public List<String> getArtifacts() {
return artifacts;
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 c61306fb77..9fd5c2adeb 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
@@ -124,7 +124,7 @@ public class NotificationDataImpl implements INotificationData {
@Override
public List<IResourceInstance> getResources() {
- List<IResourceInstance> ret = new ArrayList<IResourceInstance>();
+ List<IResourceInstance> ret = new ArrayList<>();
if (resources != null) {
ret.addAll(resources);
}
@@ -145,7 +145,7 @@ public class NotificationDataImpl implements INotificationData {
@Override
public List<IArtifactInfo> getServiceArtifacts() {
- List<IArtifactInfo> temp = new ArrayList<IArtifactInfo>();
+ List<IArtifactInfo> temp = new ArrayList<>();
if (serviceArtifacts != null) {
temp.addAll(serviceArtifacts);
}
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 62d11ffec9..2f109cd9d3 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,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ResourceInfoImpl implements IResourceInstance {
- public ResourceInfoImpl() {}
private String resourceInstanceName;
private String resourceCustomizationUUID;
@@ -44,6 +43,8 @@ public class ResourceInfoImpl implements IResourceInstance {
private String subcategory;
private List<ArtifactInfoImpl> artifacts;
+ public ResourceInfoImpl() {}
+
private ResourceInfoImpl(IResourceInstance resourceInstance) {
resourceInstanceName = resourceInstance.getResourceInstanceName();
resourceCustomizationUUID = resourceInstance.getResourceCustomizationUUID();
@@ -58,7 +59,7 @@ public class ResourceInfoImpl implements IResourceInstance {
}
public static List<ResourceInfoImpl> convertToJsonContainer(List<IResourceInstance> resources) {
- List<ResourceInfoImpl> buildResources = new ArrayList<ResourceInfoImpl>();
+ List<ResourceInfoImpl> buildResources = new ArrayList<>();
if (resources != null) {
for (IResourceInstance resourceInstance : resources) {
buildResources.add(new ResourceInfoImpl(resourceInstance));
@@ -114,7 +115,7 @@ public class ResourceInfoImpl implements IResourceInstance {
@Override
public List<IArtifactInfo> getArtifacts() {
- List<IArtifactInfo> temp = new ArrayList<IArtifactInfo>();
+ List<IArtifactInfo> temp = new ArrayList<>();
if (artifacts != null) {
temp.addAll(artifacts);
}
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 14ea0cde4b..24e1887847 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
@@ -23,7 +23,6 @@
package org.onap.so.asdc.client.test.rest;
-import java.io.IOException;
import javax.transaction.Transactional;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
@@ -31,14 +30,14 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
import org.onap.so.asdc.client.ASDCController;
-import org.onap.so.asdc.client.exceptions.ASDCControllerException;
-import org.onap.so.asdc.client.exceptions.ASDCParametersException;
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.client.test.emulators.NotificationDataImpl;
import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,16 +46,17 @@ import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
/**
- * This is a TEST only rest interface. It is not used in production, it is used to aid in testing the ASDC service on
- * jboss without the need to be connected to the ASDC service broker. It starts the test at the treatNotification step
- * and simulates both the notification step as well as the artifact download step.
- *
- * i.e. http://localhost:8080/asdc/treatNotification/v1
+ * This is a TEST only rest interface. It is not used in production, it is used to aid in testing the ASDC service
+ * without the need to be connected to the ASDC service broker. It starts the test at the treatNotification step and
+ * simulates both the notification step as well as the artifact download step.
+ * <p>
+ * i.e. http://localhost:8085/test/treatNotification/v1
+ * <p>
+ * i.e. http://localhost:8085/test/statusData/v1
*
- * i.e. http://localhost:8080/asdc/statusData/v1
- *
- * @author jm5423
+ * This interface is also used in CSIT to simulate a distribution of a service, without using SDC
*
+ * @author jm5423
*/
@Path("/")
@@ -64,58 +64,83 @@ import org.springframework.stereotype.Component;
@Profile("test")
public class ASDCRestInterface {
- private static DistributionClientEmulator distributionClientEmulator;
-
- private static JsonStatusData statusData;
-
private static final Logger logger = LoggerFactory.getLogger(ASDCRestInterface.class);
- @Autowired
- private ASDCController asdcController;
+ private final ASDCController asdcController;
+
+ private final ToscaResourceInstaller toscaInstaller;
@Autowired
- private ToscaResourceInstaller toscaInstaller;
+ public ASDCRestInterface(final ASDCController asdcController, final ToscaResourceInstaller toscaInstaller) {
+ this.asdcController = asdcController;
+ this.toscaInstaller = toscaInstaller;
+ }
@POST
@Path("/treatNotification/v1")
@Produces(MediaType.APPLICATION_JSON)
@Transactional
- public Response invokeASDCService(NotificationDataImpl request,
- @HeaderParam("resource-location") String resourceLocation)
- throws ASDCControllerException, ASDCParametersException, IOException {
- distributionClientEmulator = new DistributionClientEmulator(resourceLocation);
-
- asdcController.setControllerName("asdc-controller1");
- asdcController.setDistributionClient(distributionClientEmulator);
- asdcController.initASDC();
- asdcController.treatNotification(request);
- asdcController.closeASDC();
- return Response.status(200).build();
+ public Response invokeASDCService(final NotificationDataImpl request,
+ @HeaderParam("resource-location") final String resourceLocation) {
+
+ try {
+ logger.info("Received message : {}", request);
+ logger.info("resource-location : {}", resourceLocation);
+ final DistributionClientEmulator distributionClientEmulator =
+ getDistributionClientEmulator(resourceLocation);
+
+ asdcController.setControllerName("asdc-controller1");
+ asdcController.setDistributionClient(distributionClientEmulator);
+
+ if (asdcController.isStopped()) {
+ logger.info("{} not running will try to initialize it, currrent status: {}",
+ asdcController.getClass().getName(), asdcController.getControllerStatus());
+ asdcController.initASDC();
+ }
+
+ asdcController.treatNotification(request);
+
+ if (!asdcController.isBusy()) {
+ asdcController.closeASDC();
+ }
+
+ return Response.status(Status.OK).build();
+ } catch (final Exception exception) {
+ logger.error("Unable to process notification request", exception);
+ return Response.status(Status.INTERNAL_SERVER_ERROR).build();
+ }
+
+ }
+
+ private DistributionClientEmulator getDistributionClientEmulator(final String resourceLocation) {
+ return new DistributionClientEmulator(resourceLocation);
}
@POST
@Path("/statusData/v1")
@Produces(MediaType.APPLICATION_JSON)
@Transactional
- public Response invokeASDCStatusData(String request) {
+ public Response invokeASDCStatusData(final String request) {
try {
- distributionClientEmulator = new DistributionClientEmulator("resource-examples/");
- statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/");
+ final DistributionClientEmulator distributionClientEmulator =
+ getDistributionClientEmulator("resource-examples/");
+ final JsonStatusData statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/");
- ASDCController asdcController = new ASDCController("asdc-controller1", distributionClientEmulator);
+ asdcController.setDistributionClient(distributionClientEmulator);
asdcController.initASDC();
toscaInstaller.installTheComponentStatus(statusData);
asdcController.closeASDC();
- } catch (Exception e) {
+
+ logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
+ statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete");
+ } catch (final Exception e) {
logger.info("Error caught " + e.getMessage());
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
"Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService",
ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e);
}
- logger.info("ASDC Updates are complete");
- logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(),
- "ASDC", "ASDC Updates Are Complete");
+
return null;
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ASDCElementInfo.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ASDCElementInfo.java
index 043055e23c..81b0843671 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ASDCElementInfo.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ASDCElementInfo.java
@@ -47,7 +47,7 @@ public class ASDCElementInfo {
* <li>{@link ASDCElementTypeEnum#VNF_RESOURCE}</li>
* <ul>
*/
- public static enum ASDCElementTypeEnum {
+ public enum ASDCElementTypeEnum {
/**
* The type VNF_RESOURCE. Represents a VNF_RESOURCE element.
*/
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java
index 8be3d6ba06..f2c6b2f16a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java
@@ -61,7 +61,7 @@ public abstract class ResourceStructure {
/**
* Number of resources provided by the resource structure.
*/
- protected int NumberOfResources;
+ protected int numberOfResources;
/**
* The list of artifacts existing in this resource hashed by UUID.
@@ -142,11 +142,11 @@ public abstract class ResourceStructure {
}
public int getNumberOfResources() {
- return NumberOfResources;
+ return numberOfResources;
}
public void setNumberOfResources(int numberOfResources) {
- NumberOfResources = numberOfResources;
+ this.numberOfResources = numberOfResources;
}
public Map<String, VfModuleArtifact> getArtifactsMapByUUID() {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index 749a397ee0..c49cb3e50f 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
@@ -25,6 +25,7 @@ package org.onap.so.asdc.installer;
import java.io.File;
import java.nio.file.Paths;
import java.util.List;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
@@ -142,14 +143,14 @@ public class ToscaResourceStructure {
File spoolFile = new File(filePath);
logger.debug("ASDC File path is: {}", spoolFile.getAbsolutePath());
- logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***PATH", "ASDC",
+ logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***PATH", "ASDC",
spoolFile.getAbsolutePath());
sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath(), false);
} catch (Exception e) {
logger.debug(e.getMessage(), e);
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
"Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC",
"processResourceNotification", ErrorCode.BusinessProcesssError.getValue(),
"Exception in " + "processResourceNotification", e);
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 0f58a21747..f954fe0c5a 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
@@ -25,10 +25,11 @@ package org.onap.so.asdc.installer;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.util.ASDCNotificationLogging;
@@ -80,6 +81,7 @@ public class VfResourceStructure extends ResourceStructure {
super(notificationdata, resourceinstance);
this.resourceType = ResourceType.VF_RESOURCE;
vfModulesStructureList = new LinkedList<>();
+ vfModulesMetadataList = new ArrayList<>();
}
public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
@@ -105,7 +107,7 @@ public class VfResourceStructure extends ResourceStructure {
}
protected void addArtifactByType(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult,
- VfModuleArtifact vfModuleArtifact) throws UnsupportedEncodingException {
+ VfModuleArtifact vfModuleArtifact) {
switch (artifactinfo.getArtifactType()) {
case ASDCConfiguration.HEAT:
@@ -133,9 +135,9 @@ public class VfResourceStructure extends ResourceStructure {
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");
+ if (vfModulesMetadataList.isEmpty()) {
+ logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_GENERAL_INFO.toString(),
+ "There is no VF mudules in the VF.", "ASDC", "createVfModuleStructures");
return;
}
for (IVfModuleData vfModuleMeta : vfModulesMetadataList) {
@@ -148,6 +150,7 @@ public class VfResourceStructure extends ResourceStructure {
return vfModulesStructureList;
}
+ @Override
public Map<String, VfModuleArtifact> getArtifactsMapByUUID() {
return artifactsMapByUUID;
}
@@ -204,6 +207,6 @@ public class VfResourceStructure extends ResourceStructure {
} catch (IOException e) {
logger.debug("IOException : ", e);
}
- return null;
+ return new ArrayList<>();
}
}
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 0379e2a423..195aa7e302 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -48,6 +48,7 @@ import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.HttpClientBuilder;
import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,9 +71,8 @@ public class BpmnInstaller {
public void installBpmn(String csarFilePath) {
logger.info("Deploying BPMN files from {}", csarFilePath);
- try {
- ZipInputStream csarFile =
- new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()));
+ try (ZipInputStream csarFile =
+ new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()))) {
ZipEntry entry = csarFile.getNextEntry();
while (entry != null) {
@@ -88,7 +88,7 @@ public class BpmnInstaller {
logger.debug("Response entity: {}", response.getEntity().toString());
if (response.getStatusLine().getStatusCode() != 200) {
logger.debug("Failed deploying BPMN {}", name);
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(),
name, fileName, Integer.toString(response.getStatusLine().getStatusCode()),
ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
} else {
@@ -96,16 +96,15 @@ public class BpmnInstaller {
}
} catch (Exception e) {
logger.debug("Exception :", e);
- logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name,
e.getMessage(), ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
}
}
entry = csarFile.getNextEntry();
}
- csarFile.close();
} catch (IOException ex) {
logger.debug("Exception :", ex);
- logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,
ex.getMessage(), ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed");
}
return;
@@ -124,8 +123,8 @@ public class BpmnInstaller {
}
} catch (Exception e) {
logger.debug("Exception :", e);
- logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath, e.getMessage(),
- ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
+ logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath,
+ e.getMessage(), ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
}
return workflowsInCsar;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
index b3c7776c9a..ef4dfa24aa 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.so.asdc.installer.VfResourceStructure;
@@ -51,7 +52,7 @@ import org.springframework.stereotype.Component;
public class WorkflowResource {
protected static final Logger logger = LoggerFactory.getLogger(WorkflowResource.class);
- private static final String pattern = ".*\\\"activity:(.*)\\\" .*";
+ private static final String PATTERN = ".*\\\"activity:(.*)\\\" .*";
private static final String TARGET_RESOURCE_VNF = "vnf";
private static final String SOURCE_SDC = "sdc";
private static final String BPMN_SUFFIX = ".bpmn";
@@ -104,7 +105,7 @@ public class WorkflowResource {
logger.debug("Response entity: {}", response.getEntity().toString());
if (response.getStatusLine().getStatusCode() != 200) {
logger.debug("Failed deploying BPMN {}", bpmnName);
- logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), bpmnName,
+ logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), bpmnName,
bpmnName, Integer.toString(response.getStatusLine().getStatusCode()),
ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
throw (new Exception("Error from Camunda on deploying the BPMN: " + bpmnName));
@@ -113,7 +114,7 @@ public class WorkflowResource {
}
} catch (Exception e) {
logger.debug("Exception :", e);
- logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), bpmnName,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), bpmnName,
e.getMessage(), ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
throw e;
}
@@ -139,7 +140,7 @@ public class WorkflowResource {
VnfResourceWorkflow vnfResourceWorkflow = new VnfResourceWorkflow();
vnfResourceWorkflow.setVnfResourceModelUUID(vfResourceModelUuid);
vnfResourceWorkflow.setWorkflow(workflow);
- List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<VnfResourceWorkflow>();
+ List<VnfResourceWorkflow> vnfResourceWorkflows = new ArrayList<>();
vnfResourceWorkflows.add(vnfResourceWorkflow);
workflow.setVnfResourceWorkflow(vnfResourceWorkflows);
@@ -173,9 +174,9 @@ public class WorkflowResource {
}
protected List<String> getActivityNameList(String bpmnContent) {
- List<String> activityNameList = new ArrayList<String>();
+ List<String> activityNameList = new ArrayList<>();
- Pattern p = Pattern.compile(pattern);
+ Pattern p = Pattern.compile(PATTERN);
Matcher m = p.matcher(bpmnContent);
while (m.find()) {
activityNameList.add(m.group(1));
@@ -185,10 +186,10 @@ public class WorkflowResource {
protected List<WorkflowActivitySpecSequence> getWorkflowActivitySpecSequence(List<String> activityNames,
Workflow workflow) throws Exception {
- if (activityNames == null || activityNames.size() == 0) {
+ if (activityNames == null || activityNames.isEmpty()) {
return null;
}
- List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<WorkflowActivitySpecSequence>();
+ List<WorkflowActivitySpecSequence> workflowActivitySpecs = new ArrayList<>();
int seqNo = 1;
for (String activityName : activityNames) {
ActivitySpec activitySpec = activityRepo.findByName(activityName);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index ca5cdf4fde..da989b0155 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -26,6 +26,7 @@ package org.onap.so.asdc.installer.heat;
import java.sql.Timestamp;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -34,8 +35,10 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import org.hibernate.StaleObjectStateException;
+import org.onap.so.logger.LoggingAnchor;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.LockAcquisitionException;
import org.onap.sdc.api.notification.IArtifactInfo;
@@ -44,17 +47,12 @@ import org.onap.sdc.api.notification.IStatusData;
import org.onap.sdc.tosca.parser.api.IEntityDetails;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.elements.queries.EntityQuery;
+import org.onap.sdc.tosca.parser.elements.queries.EntityQuery.EntityQueryBuilder;
import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery;
+import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery.TopologyTemplateQueryBuilder;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.onap.sdc.toscaparser.api.CapabilityAssignment;
-import org.onap.sdc.toscaparser.api.CapabilityAssignments;
-import org.onap.sdc.toscaparser.api.Group;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
-import org.onap.sdc.toscaparser.api.Policy;
-import org.onap.sdc.toscaparser.api.Property;
-import org.onap.sdc.toscaparser.api.RequirementAssignment;
-import org.onap.sdc.toscaparser.api.RequirementAssignments;
+import org.onap.sdc.toscaparser.api.*;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.toscaparser.api.functions.GetInput;
import org.onap.sdc.toscaparser.api.parameters.Input;
@@ -111,6 +109,7 @@ import org.onap.so.db.catalog.data.repository.CollectionResourceCustomizationRep
import org.onap.so.db.catalog.data.repository.CollectionResourceRepository;
import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository;
+import org.onap.so.db.catalog.data.repository.CvnfcConfigurationCustomizationRepository;
import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository;
import org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository;
import org.onap.so.db.catalog.data.repository.HeatEnvironmentRepository;
@@ -146,6 +145,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.util.CollectionUtils;
@Component
public class ToscaResourceInstaller {
@@ -298,6 +298,7 @@ public class ToscaResourceInstaller {
status = vfResourceStructure.isDeployedSuccessfully();
} catch (RuntimeException e) {
status = false;
+ logger.debug("Exception :", e);
}
try {
Service existingService =
@@ -327,8 +328,8 @@ public class ToscaResourceInstaller {
}
return status;
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), ErrorCode.SchemaError.getValue(),
- "Exception - isResourceAlreadyDeployed");
+ logger.error(LoggingAnchor.THREE, MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(),
+ ErrorCode.SchemaError.getValue(), "Exception - isResourceAlreadyDeployed");
throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e);
}
}
@@ -398,7 +399,7 @@ public class ToscaResourceInstaller {
if (dbExceptionToCapture instanceof ConstraintViolationException
|| dbExceptionToCapture instanceof LockAcquisitionException) {
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
+ logger.warn(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
resourceStruct.getResourceInstance().getResourceName(),
resourceStruct.getNotification().getServiceVersion(), ErrorCode.DataError.getValue(),
"Exception - ASCDC Artifact already deployed", e);
@@ -406,7 +407,7 @@ public class ToscaResourceInstaller {
String elementToLog = (!artifactListForLogging.isEmpty()
? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
: "No element listed");
- logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
ErrorCode.DataError.getValue(), "Exception caught during installation of "
+ resourceStruct.getResourceInstance().getResourceName() + ". Transaction rollback",
e);
@@ -433,13 +434,20 @@ public class ToscaResourceInstaller {
Service service = toscaResourceStruct.getCatalogService();
List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
- for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
- Metadata metadata = nodeTemplate.getMetaData();
- String serviceType = toscaResourceStruct.getCatalogService().getServiceType();
- String vfCustomizationCategory = toscaResourceStruct.getSdcCsarHelper()
- .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY);
- processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata,
- vfCustomizationCategory);
+ List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct,
+ EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+ for (IEntityDetails vfEntityDetails : vfEntityList) {
+
+ Metadata metadata = vfEntityDetails.getMetadata();
+ String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+
+ if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) {
+ continue;
+ }
+
+ processVfModules(vfEntityDetails, vfNodeTemplatesList.get(0), toscaResourceStruct, vfResourceStructure,
+ service, metadata);
}
processResourceSequence(toscaResourceStruct, service);
@@ -479,7 +487,7 @@ public class ToscaResourceInstaller {
if (dbExceptionToCapture instanceof ConstraintViolationException
|| dbExceptionToCapture instanceof LockAcquisitionException) {
- logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
+ logger.warn(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
vfResourceStructure.getResourceInstance().getResourceName(),
vfResourceStructure.getNotification().getServiceVersion(), ErrorCode.DataError.getValue(),
"Exception - ASCDC Artifact already deployed", e);
@@ -487,7 +495,7 @@ public class ToscaResourceInstaller {
String elementToLog = (!artifactListForLogging.isEmpty()
? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
: "No element listed");
- logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
ErrorCode.DataError.getValue(),
"Exception caught during installation of "
+ vfResourceStructure.getResourceInstance().getResourceName()
@@ -503,7 +511,7 @@ public class ToscaResourceInstaller {
List<NodeTemplate> getRequirementList(List<NodeTemplate> resultList, List<NodeTemplate> nodeTemplates,
ISdcCsarHelper iSdcCsarHelper) {
- List<NodeTemplate> nodes = new ArrayList<NodeTemplate>();
+ List<NodeTemplate> nodes = new ArrayList<>();
nodes.addAll(nodeTemplates);
for (NodeTemplate nodeTemplate : nodeTemplates) {
@@ -534,12 +542,12 @@ public class ToscaResourceInstaller {
// 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>();
+ List<String> resouceSequence = new ArrayList<>();
+ List<NodeTemplate> resultList = new ArrayList<>();
ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper();
List<NodeTemplate> nodeTemplates = iSdcCsarHelper.getServiceNodeTemplates();
- List<NodeTemplate> nodes = new ArrayList<NodeTemplate>();
+ List<NodeTemplate> nodes = new ArrayList<>();
nodes.addAll(nodeTemplates);
for (NodeTemplate nodeTemplate : nodeTemplates) {
@@ -565,27 +573,31 @@ public class ToscaResourceInstaller {
logger.debug(" resourceSeq for service uuid(" + service.getModelUUID() + ") : " + resourceSeqStr);
}
- private static String getValue(Object value, List<Input> servInputs) {
- String output = null;
+
+ // this of temporary solution
+ private static String getValue(Object value, List<Input> inputs) {
+ String outInput;
+ String defaultValue = null;
if (value instanceof Map) {
- // currently this logic handles only one level of nesting.
- return ((LinkedHashMap) value).values().toArray()[0].toString();
+ outInput = ((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
- }
+ Optional<Input> inputOptional =
+ inputs.stream().filter(input -> input.getName().equals(inputName)).findFirst();
+ if (inputOptional.isPresent()) {
+ Input input = inputOptional.get();
+ defaultValue = input.getDefault() != null ? input.getDefault().toString() : "";
}
-
+ // Gets a value between [ and ]
+ String regex = "\\[.*?\\]";
+ Pattern pattern = Pattern.compile(regex);
+ Matcher matcher = pattern.matcher(value.toString());
+ String valueStr = matcher.find() ? matcher.group() : inputName;
+ outInput = valueStr + "|" + defaultValue;
} else {
- output = value != null ? value.toString() : "";
+ outInput = value != null ? value.toString() : "";
}
- return output; // return property value
+ return outInput;
}
String getResourceInput(ToscaResourceStructure toscaResourceStructure, String resourceCustomizationUuid)
@@ -626,11 +638,13 @@ public class ToscaResourceInstaller {
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);
+ List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.VL),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+ if (vlEntityList != null) {
+ for (IEntityDetails vlEntity : vlEntityList) {
+ String networkResourceModelName = vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
TempNetworkHeatTemplateLookup tempNetworkLookUp =
tempNetworkLookupRepo.findFirstBynetworkResourceModelName(networkResourceModelName);
@@ -639,7 +653,7 @@ public class ToscaResourceInstaller {
HeatTemplate heatTemplate =
heatRepo.findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid());
if (heatTemplate != null) {
- NetworkResourceCustomization networkCustomization = createNetwork(vlNode, toscaResourceStruct,
+ NetworkResourceCustomization networkCustomization = createNetwork(vlEntity, toscaResourceStruct,
heatTemplate, tempNetworkLookUp.getAicVersionMax(),
tempNetworkLookUp.getAicVersionMin(), service);
service.getNetworkCustomizations().add(networkCustomization);
@@ -649,7 +663,9 @@ public class ToscaResourceInstaller {
}
} else {
NetworkResourceCustomization networkCustomization =
- createNetwork(vlNode, toscaResourceStruct, null, null, null, service);
+ createNetwork(vlEntity, toscaResourceStruct, null, null, null, service);
+ networkCustomization.setResourceInput(
+ getResourceInput(toscaResourceStruct, networkCustomization.getModelCustomizationUUID()));
service.getNetworkCustomizations().add(networkCustomization);
logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for "
+ networkResourceModelName);
@@ -660,11 +676,14 @@ public class ToscaResourceInstaller {
}
protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service,
- List<NodeTemplate> allottedResourceList) {
+ List<NodeTemplate> allottedResourceList) throws ArtifactInstallerException {
if (allottedResourceList != null) {
for (NodeTemplate allottedNode : allottedResourceList) {
- service.getAllottedCustomizations()
- .add(createAllottedResource(allottedNode, toscaResourceStruct, service));
+ AllottedResourceCustomization allottedResource =
+ createAllottedResource(allottedNode, toscaResourceStruct, service);
+ allottedResource.setResourceInput(
+ getResourceInput(toscaResourceStruct, allottedResource.getModelCustomizationUUID()));
+ service.getAllottedCustomizations().add(allottedResource);
}
}
}
@@ -697,14 +716,13 @@ public class ToscaResourceInstaller {
.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.setFunction(
+ toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "function"));
+ configCustomizationResource.setRole(
+ toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "role"));
+ configCustomizationResource.setType(
+ toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "type"));
+ configCustomizationResource.setServiceProxyResourceCustomization(spResourceCustomization);
configCustomizationResource.setConfigurationResource(configResource);
configCustomizationResource.setService(service);
@@ -724,9 +742,8 @@ public class ToscaResourceInstaller {
List<NodeTemplate> configurationNodeTemplatesList =
toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION);
- List<ServiceProxyResourceCustomization> serviceProxyList = new ArrayList<ServiceProxyResourceCustomization>();
- List<ConfigurationResourceCustomization> configurationResourceList =
- new ArrayList<ConfigurationResourceCustomization>();
+ List<ServiceProxyResourceCustomization> serviceProxyList = new ArrayList<>();
+ List<ConfigurationResourceCustomization> configurationResourceList = new ArrayList<>();
ServiceProxyResourceCustomization serviceProxy = null;
@@ -741,8 +758,8 @@ public class ToscaResourceInstaller {
toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll();
for (RequirementAssignment requirement : requirementsList) {
if (requirement.getNodeTemplateName().equals(spNode.getName())) {
- ConfigurationResourceCustomization configurationResource =
- createConfiguration(configNode, toscaResourceStruct, serviceProxy, service);
+ ConfigurationResourceCustomization configurationResource = createConfiguration(configNode,
+ toscaResourceStruct, serviceProxy, service, configurationResourceList);
Optional<ConfigurationResourceCustomization> matchingObject =
configurationResourceList.stream()
@@ -951,48 +968,57 @@ public class ToscaResourceInstaller {
return String.valueOf(value);
}
- protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure,
- Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory)
- throws Exception {
+ protected void processVfModules(IEntityDetails vfEntityDetails, NodeTemplate nodeTemplate,
+ ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure, Service service,
+ Metadata metadata) throws Exception {
+
+ String vfCustomizationCategory =
+ vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
logger.debug("VF Category is : " + vfCustomizationCategory);
- if (vfResourceStructure.getVfModuleStructure() != null
- && !vfResourceStructure.getVfModuleStructure().isEmpty()) {
+ String vfCustomizationUUID =
+ vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper().getMetadataPropertyValue(metadata,
- SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
+ logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
- IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance();
+ IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance();
- // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before
- // comparing their VF Modules UUID's
- logger.debug("Checking if Notification VF ResourceCustomizationUUID: "
- + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: "
- + vfCustomizationUUID);
+ // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before
+ // comparing their VF Modules UUID's
+ logger.debug("Checking if Notification VF ResourceCustomizationUUID: "
+ + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: "
+ + vfCustomizationUUID);
- if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
+ if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) {
- logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
- + " matches vfNotificationResource CustomizationUUID");
+ logger.debug("vfCustomizationUUID: " + vfCustomizationUUID
+ + " matches vfNotificationResource CustomizationUUID");
- VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
+ VnfResourceCustomization vnfResource = createVnfResource(vfEntityDetails, toscaResourceStruct, service);
- Set<CvnfcCustomization> existingCvnfcSet = new HashSet<CvnfcCustomization>();
- Set<VnfcCustomization> existingVnfcSet = new HashSet<VnfcCustomization>();
+ if (vfResourceStructure.getVfModuleStructure() != null
+ && !vfResourceStructure.getVfModuleStructure().isEmpty()) {
+ Set<CvnfcCustomization> existingCvnfcSet = new HashSet<>();
+ Set<VnfcCustomization> existingVnfcSet = new HashSet<>();
+ List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom = new ArrayList<>();
for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
- List<org.onap.sdc.toscaparser.api.Group> vfGroups =
- toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
+
+ List<IEntityDetails> vfModuleEntityList =
+ getEntityDetails(toscaResourceStruct,
+ EntityQuery.newBuilder("org.openecomp.groups.VfModule"), TopologyTemplateQuery
+ .newBuilder(SdcTypes.SERVICE).customizationUUID(vfCustomizationUUID),
+ false);
+
IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : "
+ vfMetadata.getVfModuleModelCustomizationUUID());
- Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream()
+ Optional<IEntityDetails> matchingObject = vfModuleEntityList.stream()
.peek(group -> logger.debug("To Csar Group VFModuleModelCustomizationUUID "
+ group.getMetadata().getValue("vfModuleModelCustomizationUUID")))
.filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID")
@@ -1000,8 +1026,8 @@ public class ToscaResourceInstaller {
.findFirst();
if (matchingObject.isPresent()) {
VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(),
- nodeTemplate, toscaResourceStruct, vfResourceStructure, vfMetadata, vnfResource,
- service, existingCvnfcSet, existingVnfcSet);
+ toscaResourceStruct, vfResourceStructure, vfMetadata, vnfResource, service,
+ existingCvnfcSet, existingVnfcSet, existingCvnfcConfigurationCustom);
vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources());
} else
throw new Exception(
@@ -1009,25 +1035,120 @@ public class ToscaResourceInstaller {
+ vfMetadata.getVfModuleModelCustomizationUUID());
}
+ }
+
+
+ // Check for VNFC Instance Group info and add it if there is
+ List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStruct,
+ EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF).customizationUUID(vfCustomizationUUID), false);
+
+
+ for (IEntityDetails groupEntity : vfcEntityList) {
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization =
+ createVNFCInstanceGroup(groupEntity, nodeTemplate, vnfResource, toscaResourceStruct);
+ vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization);
+ }
+
+ List<String> seqResult = processVNFCGroupSequence(toscaResourceStruct, vfcEntityList);
+ if (!CollectionUtils.isEmpty(seqResult)) {
+ String resultStr = seqResult.stream().collect(Collectors.joining(","));
+ vnfResource.setVnfcInstanceGroupOrder(resultStr);
+ logger.debug("vnfcGroupOrder result for service uuid(" + service.getModelUUID() + ") : " + resultStr);
+ }
+ // add this vnfResource with existing vnfResource for this service
+ addVnfCustomization(service, vnfResource);
+ } else {
+ logger.debug("Notification VF ResourceCustomizationUUID: "
+ + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match "
+ + "Tosca VF Customization UUID: " + vfCustomizationUUID);
+ }
+ }
+
+ private List<String> processVNFCGroupSequence(ToscaResourceStructure toscaResourceStructure,
+ List<IEntityDetails> groupEntityDetails) {
+ if (CollectionUtils.isEmpty(groupEntityDetails)) {
+ return Collections.emptyList();
+ }
+
+ ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper();
+ List<String> strSequence = new ArrayList<>(groupEntityDetails.size());
+ List<IEntityDetails> tempEntityList = new ArrayList<>(groupEntityDetails.size());
+ List<IEntityDetails> entities = new ArrayList<>();
+ tempEntityList.addAll(groupEntityDetails);
+ for (IEntityDetails vnfcEntityDetails : groupEntityDetails) {
- // Check for VNFC Instance Group info and add it if there is
- List<Group> groupList =
- toscaResourceStruct.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(
- nodeTemplate, "org.openecomp.groups.VfcInstanceGroup");
+ List<IEntityDetails> vnfcMemberNodes = vnfcEntityDetails.getMemberNodes();
- for (Group group : groupList) {
- VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization =
- createVNFCInstanceGroup(nodeTemplate, group, vnfResource, toscaResourceStruct);
- vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization);
+ boolean hasRequirements = false;
+ for (IEntityDetails vnfcDetails : vnfcMemberNodes) {
+
+ Map<String, RequirementAssignment> requirements = vnfcDetails.getRequirements();
+
+ if (requirements != null && !requirements.isEmpty()) {
+ hasRequirements = true;
+ break;
}
+ }
+
+ if (!hasRequirements) {
+ strSequence.add(vnfcEntityDetails.getName());
+ tempEntityList.remove(vnfcEntityDetails);
+ entities.addAll(vnfcMemberNodes);
+ }
+ }
+ getVNFCGroupSequenceList(strSequence, tempEntityList, entities, iSdcCsarHelper);
- service.getVnfCustomizations().add(vnfResource);
- } else {
- logger.debug("Notification VF ResourceCustomizationUUID: "
- + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match "
- + "Tosca VF Customization UUID: " + vfCustomizationUUID);
+ return strSequence;
+
+ }
+
+ private void getVNFCGroupSequenceList(List<String> strSequence, List<IEntityDetails> vnfcGroupDetails,
+ List<IEntityDetails> vnfcMemberNodes, ISdcCsarHelper iSdcCsarHelper) {
+ if (CollectionUtils.isEmpty(vnfcGroupDetails)) {
+ return;
+ }
+
+ List<IEntityDetails> tempGroupList = new ArrayList<>();
+ tempGroupList.addAll(vnfcGroupDetails);
+
+ for (IEntityDetails vnfcGroup : vnfcGroupDetails) {
+ List<IEntityDetails> members = vnfcGroup.getMemberNodes();
+ for (IEntityDetails memberNode : members) {
+ boolean isAllExists = true;
+
+
+ Map<String, RequirementAssignment> requirements = memberNode.getRequirements();
+
+ if (requirements == null || requirements.isEmpty()) {
+ continue;
+ }
+
+
+ for (Map.Entry<String, RequirementAssignment> entry : requirements.entrySet()) {
+ RequirementAssignment rqa = entry.getValue();
+ String name = rqa.getNodeTemplateName();
+ for (IEntityDetails node : vnfcMemberNodes) {
+ if (name.equals(node.getName())) {
+ break;
+ }
+ }
+
+ isAllExists = false;
+ break;
+ }
+
+ if (isAllExists) {
+ strSequence.add(vnfcGroup.getName());
+ tempGroupList.remove(vnfcGroupDetails);
+ vnfcMemberNodes.addAll(vnfcGroupDetails);
+ }
+ }
+
+ if (!tempGroupList.isEmpty() && tempGroupList.size() < vnfcGroupDetails.size()) {
+ getVNFCGroupSequenceList(strSequence, tempGroupList, vnfcMemberNodes, iSdcCsarHelper);
}
}
}
@@ -1073,7 +1194,7 @@ public class ToscaResourceInstaller {
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT:
- logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
+ logger.warn(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:"
+ vfModuleArtifact.getArtifactInfo().getArtifactName() + ")",
ErrorCode.DataError.getValue(), "Artifact type not supported");
@@ -1249,7 +1370,14 @@ public class ToscaResourceInstaller {
Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
- Service service = new Service();
+ List<Service> services =
+ serviceRepo.findByModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ Service service;
+ if (!services.isEmpty() && services.size() > 0) {
+ service = services.get(0);
+ } else {
+ service = new Service();
+ }
if (serviceMetadata != null) {
@@ -1271,6 +1399,13 @@ public class ToscaResourceInstaller {
service.setModelInvariantUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
service.setCsar(toscaResourceStructure.getCatalogToscaCsar());
+ service.setNamingPolicy(serviceMetadata.getValue("namingPolicy"));
+ String generateNaming = serviceMetadata.getValue("ecompGeneratedNaming");
+ Boolean generateNamingValue = null;
+ if (generateNaming != null) {
+ generateNamingValue = "true".equalsIgnoreCase(generateNaming);
+ }
+ service.setOnapGeneratedNaming(generateNamingValue);
}
@@ -1315,32 +1450,31 @@ public class ToscaResourceInstaller {
protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate,
ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization,
- Service service) {
+ Service service, List<ConfigurationResourceCustomization> configurationResourceList) {
ConfigurationResourceCustomization configCustomizationResource = getConfigurationResourceCustomization(
nodeTemplate, toscaResourceStructure, spResourceCustomization, service);
- ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
-
- Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
-
- configCustomizationResource.setConfigurationResource(configResource);
+ ConfigurationResource configResource = null;
- configResourceCustomizationSet.add(configCustomizationResource);
+ ConfigurationResource existingConfigResource = findExistingConfiguration(service,
+ nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID), configurationResourceList);
- configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
-
- toscaResourceStructure.setCatalogConfigurationResource(configResource);
+ if (existingConfigResource == null) {
+ configResource = getConfigurationResource(nodeTemplate);
+ } else {
+ configResource = existingConfigResource;
+ }
- toscaResourceStructure.setCatalogConfigurationResourceCustomization(configCustomizationResource);
+ configCustomizationResource.setConfigurationResource(configResource);
return configCustomizationResource;
}
- protected ConfigurationResource createFabricConfiguration(NodeTemplate nodeTemplate,
+ protected ConfigurationResource createFabricConfiguration(IEntityDetails fabricEntity,
ToscaResourceStructure toscaResourceStructure) {
- Metadata fabricMetadata = nodeTemplate.getMetaData();
+ Metadata fabricMetadata = fabricEntity.getMetadata();
ConfigurationResource configResource = new ConfigurationResource();
@@ -1349,19 +1483,26 @@ public class ToscaResourceInstaller {
configResource.setModelUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
configResource.setModelVersion(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
configResource.setDescription(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- configResource.setToscaNodeType(nodeTemplate.getType());
+ configResource.setToscaNodeType(fabricEntity.getToscaType());
return configResource;
}
protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) {
- ToscaCsar toscaCsar = new ToscaCsar();
+ Optional<ToscaCsar> toscaCsarOpt =
+ toscaCsarRepo.findById(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
+ ToscaCsar toscaCsar;
+ if (!toscaCsarOpt.isPresent()) {
+ toscaCsar = new ToscaCsar();
+ toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
+ } else {
+ toscaCsar = toscaCsarOpt.get();
+ }
if (toscaResourceStructure.getToscaArtifact().getArtifactChecksum() != null) {
toscaCsar.setArtifactChecksum(toscaResourceStructure.getToscaArtifact().getArtifactChecksum());
} else {
toscaCsar.setArtifactChecksum(MANUAL_RECORD);
}
- toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID());
toscaCsar.setName(toscaResourceStructure.getToscaArtifact().getArtifactName());
toscaCsar.setVersion(toscaResourceStructure.getToscaArtifact().getArtifactVersion());
toscaCsar.setDescription(toscaResourceStructure.getToscaArtifact().getArtifactDescription());
@@ -1380,7 +1521,6 @@ public class ToscaResourceInstaller {
if (vnfcCustomization == null)
vnfcCustomization = vnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID);
- // vnfcCustomization = new VnfcCustomization();
return vnfcCustomization;
}
@@ -1400,13 +1540,13 @@ public class ToscaResourceInstaller {
return cvnfcCustomization;
}
- protected NetworkResourceCustomization createNetwork(NodeTemplate networkNodeTemplate,
+ protected NetworkResourceCustomization createNetwork(IEntityDetails networkEntity,
ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin,
Service service) {
NetworkResourceCustomization networkResourceCustomization =
networkCustomizationRepo.findOneByModelCustomizationUUID(
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
boolean networkUUIDsMatch = true;
// Check to make sure the NetworkResourceUUID on the Customization record matches the NetworkResourceUUID from
@@ -1414,8 +1554,7 @@ public class ToscaResourceInstaller {
// 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);
+ String latestNetworkModelUUID = networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
if (!existingNetworkModelUUID.equals(latestNetworkModelUUID)) {
networkUUIDsMatch = false;
@@ -1426,7 +1565,7 @@ public class ToscaResourceInstaller {
if (networkResourceCustomization != null && !networkUUIDsMatch) {
NetworkResource networkResource =
- createNetworkResource(networkNodeTemplate, toscaResourceStructure, heatTemplate, aicMax, aicMin);
+ createNetworkResource(networkEntity, toscaResourceStructure, heatTemplate, aicMax, aicMin);
networkResourceCustomization.setNetworkResource(networkResource);
@@ -1434,14 +1573,13 @@ public class ToscaResourceInstaller {
} else if (networkResourceCustomization == null) {
- networkResourceCustomization =
- createNetworkResourceCustomization(networkNodeTemplate, toscaResourceStructure);
+ networkResourceCustomization = createNetworkResourceCustomization(networkEntity, toscaResourceStructure);
NetworkResource networkResource = findExistingNetworkResource(service,
- networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
if (networkResource == null)
- networkResource = createNetworkResource(networkNodeTemplate, toscaResourceStructure, heatTemplate,
- aicMax, aicMin);
+ networkResource =
+ createNetworkResource(networkEntity, toscaResourceStructure, heatTemplate, aicMax, aicMin);
networkResource.addNetworkResourceCustomization(networkResourceCustomization);
networkResourceCustomization.setNetworkResource(networkResource);
@@ -1464,31 +1602,34 @@ public class ToscaResourceInstaller {
return networkResource;
}
- protected NetworkResourceCustomization createNetworkResourceCustomization(NodeTemplate networkNodeTemplate,
+ protected NetworkResourceCustomization createNetworkResourceCustomization(IEntityDetails networkEntity,
ToscaResourceStructure toscaResourceStructure) {
NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
networkResourceCustomization.setModelInstanceName(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ testNull(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
networkResourceCustomization.setModelCustomizationUUID(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ testNull(networkEntity.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)));
+ getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
+
+ networkResourceCustomization
+ .setNetworkType(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
+
+ networkResourceCustomization
+ .setNetworkRole(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
+
+ networkResourceCustomization
+ .setNetworkScope(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
+
return networkResourceCustomization;
}
- protected NetworkResource createNetworkResource(NodeTemplate networkNodeTemplate,
+ protected NetworkResource createNetworkResource(IEntityDetails vlEntity,
ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin) {
NetworkResource networkResource = new NetworkResource();
- String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- networkNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
+ String providerNetwork =
+ getLeafPropertyValue(vlEntity, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
if ("true".equalsIgnoreCase(providerNetwork)) {
networkResource.setNeutronNetworkType(PROVIDER);
@@ -1496,21 +1637,19 @@ public class ToscaResourceInstaller {
networkResource.setNeutronNetworkType(BASIC);
}
- networkResource.setModelName(
- testNull(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ networkResource.setModelName(testNull(vlEntity.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)));
+ testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ networkResource.setModelUUID(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ networkResource
+ .setModelVersion(testNull(vlEntity.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.setToscaNodeType(vlEntity.getToscaType());
+ networkResource
+ .setDescription(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
networkResource.setOrchestrationMode(HEAT);
networkResource.setHeatTemplate(heatTemplate);
return networkResource;
@@ -1569,7 +1708,7 @@ public class ToscaResourceInstaller {
List<NetworkInstanceGroup> networkInstanceGroupList = new ArrayList<>();
List<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationList =
- new ArrayList<CollectionResourceInstanceGroupCustomization>();
+ new ArrayList<>();
for (Group group : groupList) {
@@ -1728,24 +1867,26 @@ public class ToscaResourceInstaller {
return collectionNetworkResourceCustomization;
}
- protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(NodeTemplate vnfcNodeTemplate, Group group,
- VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure) {
+ protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(IEntityDetails vfcInstanceEntity,
+ NodeTemplate vnfcNodeTemplate, VnfResourceCustomization vnfResourceCustomization,
+ ToscaResourceStructure toscaResourceStructure) {
- Metadata instanceMetadata = group.getMetadata();
+ Metadata instanceMetadata = vfcInstanceEntity.getMetadata();
InstanceGroup existingInstanceGroup =
instanceGroupRepo.findByModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup();
+ VFCInstanceGroup vfcInstanceGroup;
if (existingInstanceGroup == null) {
// Populate InstanceGroup
+ vfcInstanceGroup = new VFCInstanceGroup();
vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
vfcInstanceGroup
.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- vfcInstanceGroup.setToscaNodeType(group.getType());
+ vfcInstanceGroup.setToscaNodeType(vfcInstanceEntity.getToscaType());
vfcInstanceGroup.setRole("SUB-INTERFACE"); // Set Role
vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type
} else {
@@ -1764,38 +1905,124 @@ public class ToscaResourceInstaller {
vfcInstanceGroupCustom.setDescription(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
String getInputName = null;
- String groupProperty = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- "vfc_instance_group_function");
- if (groupProperty != null) {
- int getInputIndex = groupProperty.indexOf("{get_input=");
- if (getInputIndex > -1) {
- getInputName = groupProperty.substring(getInputIndex + 11, groupProperty.length() - 1);
+
+ Map<String, Property> groupProperties = vfcInstanceEntity.getProperties();
+
+ for (String key : groupProperties.keySet()) {
+ Property property = groupProperties.get(key);
+
+ String vfcName = property.getName();
+
+ if (vfcName != null) {
+ if (vfcName.equals("vfc_instance_group_function")) {
+
+ String vfcValue = property.getValue().toString();
+ int getInputIndex = vfcValue.indexOf("{get_input=");
+ if (getInputIndex > -1) {
+ getInputName = vfcValue.substring(getInputIndex + 11, vfcValue.length() - 1);
+ }
+
+ }
}
+
}
- vfcInstanceGroupCustom.setFunction(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vnfcNodeTemplate, getInputName));
+
+ List<IEntityDetails> serviceEntityList = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VF)
+ .customizationUUID(vnfResourceCustomization.getModelCustomizationUUID()),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+ if (serviceEntityList != null && !serviceEntityList.isEmpty()) {
+ vfcInstanceGroupCustom.setFunction(getLeafPropertyValue(serviceEntityList.get(0), getInputName));
+ }
+
vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
+ ArrayList<Input> inputs = vnfcNodeTemplate.getSubMappingToscaTemplate().getInputs();
+ createVFCInstanceGroupMembers(vfcInstanceGroupCustom, vfcInstanceEntity, inputs);
return vfcInstanceGroupCustom;
+ }
+
+ private void createVFCInstanceGroupMembers(VnfcInstanceGroupCustomization vfcInstanceGroupCustom,
+ IEntityDetails vfcModuleEntity, List<Input> inputList) {
+ List<IEntityDetails> members = vfcModuleEntity.getMemberNodes();
+ if (!CollectionUtils.isEmpty(members)) {
+ for (IEntityDetails vfcEntity : members) {
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+
+ Metadata metadata = vfcEntity.getMetadata();
+ vnfcCustomization
+ .setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vnfcCustomization.setModelInstanceName(vfcEntity.getName());
+ vnfcCustomization.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ vnfcCustomization
+ .setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ vnfcCustomization.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ vnfcCustomization.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ vnfcCustomization.setToscaNodeType(testNull(vfcEntity.getToscaType()));
+ vnfcCustomization
+ .setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcEntity, inputList));
+ vnfcCustomization.setVnfcInstanceGroupCustomization(vfcInstanceGroupCustom);
+ List<VnfcCustomization> vnfcCustomizations = vfcInstanceGroupCustom.getVnfcCustomizations();
+
+ if (vnfcCustomizations == null) {
+ vnfcCustomizations = new ArrayList<>();
+ vfcInstanceGroupCustom.setVnfcCustomizations(vnfcCustomizations);
+ }
+ vnfcCustomizations.add(vnfcCustomization);
+ }
+ }
+ }
+
+ public String getVnfcResourceInput(IEntityDetails vfcEntity, List<Input> inputList) {
+ Map<String, String> resouceRequest = new HashMap<>();
+ Map<String, Property> vfcTemplateProperties = vfcEntity.getProperties();
+ for (String key : vfcTemplateProperties.keySet()) {
+ Property property = vfcTemplateProperties.get(key);
+ String resourceValue = getValue(property.getValue(), inputList);
+ resouceRequest.put(key, resourceValue);
+ }
+ String resourceCustomizationUuid =
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+
+ String jsonStr = null;
+ try {
+ ObjectMapper objectMapper = new ObjectMapper();
+ jsonStr = objectMapper.writeValueAsString(resouceRequest);
+ jsonStr = jsonStr.replace("\"", "\\\"");
+ logger.debug("vfcResource request for resource customization id (" + resourceCustomizationUuid + ") : "
+ + jsonStr);
+ } catch (JsonProcessingException e) {
+ logger.debug("Json Exception: {}", e.getMessage());
+ logger.error("Exception occurred", e);
+ }
+
+ return jsonStr;
}
- protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate,
+ protected VfModuleCustomization createVFModuleResource(IEntityDetails vfModuleEntityDetails,
ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure,
IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service,
- Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet) {
+ Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet,
+ List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom) {
VfModuleCustomization vfModuleCustomization =
findExistingVfModuleCustomization(vnfResource, vfModuleData.getVfModuleModelCustomizationUUID());
+
if (vfModuleCustomization == null) {
+
VfModule vfModule = findExistingVfModule(vnfResource,
- vfTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
- Metadata vfMetadata = group.getMetadata();
+ vfModuleEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+
+ Metadata vfMetadata = vfModuleEntityDetails.getMetadata();
if (vfModule == null)
- vfModule = createVfModule(group, toscaResourceStructure, vfModuleData, vfMetadata);
+ vfModule = createVfModule(vfModuleEntityDetails, toscaResourceStructure, vfModuleData, vfMetadata);
- vfModuleCustomization = createVfModuleCustomization(group, toscaResourceStructure, vfModule, vfModuleData);
+ vfModuleCustomization =
+ createVfModuleCustomization(vfModuleEntityDetails, toscaResourceStructure, vfModule, vfModuleData);
vfModuleCustomization.setVnfCustomization(vnfResource);
setHeatInformationForVfModule(toscaResourceStructure, vfResourceStructure, vfModule, vfModuleCustomization,
vfMetadata);
@@ -1810,49 +2037,60 @@ public class ToscaResourceInstaller {
// * Extract VFC's and CVFC's then add them to VFModule
// ******************************************************************************************************************
- Set<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations =
- new HashSet<CvnfcConfigurationCustomization>();
- Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<CvnfcCustomization>();
- Set<VnfcCustomization> vnfcCustomizations = new HashSet<VnfcCustomization>();
+ List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations = new ArrayList<>();
+ Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<>();
+ Set<VnfcCustomization> vnfcCustomizations = new HashSet<>();
// Only set the CVNFC if this vfModule group is a member of it.
- List<NodeTemplate> groupMembers =
- toscaResourceStructure.getSdcCsarHelper().getMembersOfVfModule(vfTemplate, group);
- String vfModuleMemberName = null;
- for (NodeTemplate node : groupMembers) {
- vfModuleMemberName = node.getName();
- }
+ List<IEntityDetails> groupMembers = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.VfModule")
+ .uUID(vfModuleCustomization.getVfModule().getModelUUID()),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
+
+ String vfModuleMemberName = null;
// Extract CVFC lists
- List<NodeTemplate> cvfcList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC);
+ List<IEntityDetails> cvnfcEntityList = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CVFC), TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
+
- for (NodeTemplate cvfcTemplate : cvfcList) {
+ for (IEntityDetails cvfcEntity : cvnfcEntityList) {
boolean cvnfcVfModuleNameMatch = false;
- for (NodeTemplate node : groupMembers) {
- vfModuleMemberName = node.getName();
+ for (IEntityDetails entity : groupMembers) {
+
+ List<IEntityDetails> groupMembersNodes = entity.getMemberNodes();
+ for (IEntityDetails groupMember : groupMembersNodes) {
+
+ vfModuleMemberName = groupMember.getName();
+
+ if (vfModuleMemberName.equalsIgnoreCase(cvfcEntity.getName())) {
+ cvnfcVfModuleNameMatch = true;
+ break;
+ }
- if (vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName())) {
- cvnfcVfModuleNameMatch = true;
- break;
}
}
+
if (vfModuleMemberName != null && cvnfcVfModuleNameMatch) {
// Extract associated VFC - Should always be just one
- List<NodeTemplate> vfcList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
+ List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VFC),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(
+ cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
+
- for (NodeTemplate vfcTemplate : vfcList) {
+ for (IEntityDetails vfcEntity : vfcEntityList) {
VnfcCustomization vnfcCustomization = new VnfcCustomization();
VnfcCustomization existingVnfcCustomization = null;
existingVnfcCustomization = findExistingVfc(existingVnfcSet,
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
if (existingVnfcCustomization == null) {
vnfcCustomization = new VnfcCustomization();
@@ -1861,23 +2099,24 @@ public class ToscaResourceInstaller {
}
// Only Add Abstract VNFC's to our DB, ignore all others
- if (existingVnfcCustomization == null && vfcTemplate.getMetaData()
+ if (existingVnfcCustomization == null && vfcEntity.getMetadata()
.getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY).equalsIgnoreCase("Abstract")) {
+
vnfcCustomization.setModelCustomizationUUID(
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- vnfcCustomization.setModelInstanceName(vfcTemplate.getName());
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vnfcCustomization.setModelInstanceName(vfcEntity.getName());
vnfcCustomization.setModelInvariantUUID(
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
vnfcCustomization
- .setModelName(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ .setModelName(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
vnfcCustomization
- .setModelUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ .setModelUUID(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
vnfcCustomization.setModelVersion(
- testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- vnfcCustomization.setDescription(testNull(
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType()));
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ vnfcCustomization.setDescription(
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ vnfcCustomization.setToscaNodeType(testNull(vfcEntity.getToscaType()));
vnfcCustomizations.add(vnfcCustomization);
existingVnfcSet.add(vnfcCustomization);
@@ -1889,20 +2128,20 @@ public class ToscaResourceInstaller {
if (vnfcCustomization.getModelCustomizationUUID() != null) {
CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
cvnfcCustomization.setModelCustomizationUUID(
- cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName());
+ cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ cvnfcCustomization.setModelInstanceName(cvfcEntity.getName());
cvnfcCustomization.setModelInvariantUUID(
- cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
cvnfcCustomization
- .setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ .setModelName(cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
cvnfcCustomization
- .setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ .setModelUUID(cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
cvnfcCustomization.setModelVersion(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ testNull(cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
cvnfcCustomization.setDescription(testNull(
- cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType()));
+ cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ cvnfcCustomization.setToscaNodeType(testNull(cvfcEntity.getToscaType()));
if (existingVnfcCustomization != null) {
cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization);
@@ -1910,46 +2149,58 @@ public class ToscaResourceInstaller {
cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
}
- cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_function"));
- cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code"));
- cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+ cvnfcCustomization.setNfcFunction(getLeafPropertyValue(cvfcEntity, "nfc_function"));
+ cvnfcCustomization.setNfcNamingCode(getLeafPropertyValue(cvfcEntity, "nfc_naming_code"));
- cvnfcCustomizations.add(cvnfcCustomization);
- existingCvnfcSet.add(cvnfcCustomization);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
// *****************************************************************************************************************************************
// * Extract Fabric Configuration
// *****************************************************************************************************************************************
- List<NodeTemplate> fabricConfigList = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplateBySdcType(vfTemplate, SdcTypes.CONFIGURATION);
+ List<IEntityDetails> fabricEntityList =
+ getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.CONFIGURATION),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
- for (NodeTemplate fabricTemplate : fabricConfigList) {
+ for (IEntityDetails fabricEntity : fabricEntityList) {
- ConfigurationResource fabricConfig = null;
+ Map<String, RequirementAssignment> requirements = fabricEntity.getRequirements();
- ConfigurationResource existingConfig = findExistingConfiguration(service,
- fabricTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ for (RequirementAssignment requirement : requirements.values()) {
- if (existingConfig == null) {
+ if (requirement.getNodeTemplateName().equals(cvfcEntity.getName())) {
- fabricConfig = createFabricConfiguration(fabricTemplate, toscaResourceStructure);
+ ConfigurationResource fabricConfig = null;
- } else {
- fabricConfig = existingConfig;
- }
+ ConfigurationResource existingConfig = findExistingConfiguration(
+ existingCvnfcConfigurationCustom,
+ fabricEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ if (existingConfig == null) {
+
+ fabricConfig = createFabricConfiguration(fabricEntity, toscaResourceStructure);
+
+ } else {
+ fabricConfig = existingConfig;
+ }
+
+ CvnfcConfigurationCustomization cvnfcConfigurationCustomization =
+ createCvnfcConfigurationCustomization(fabricEntity, toscaResourceStructure,
+ vnfResource, vfModuleCustomization, cvnfcCustomization,
+ fabricConfig, vfModuleMemberName);
+
+ cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization);
+
+ existingCvnfcConfigurationCustom.add(cvnfcConfigurationCustomization);
- CvnfcConfigurationCustomization cvnfcConfigurationCustomization =
- createCvnfcConfigurationCustomization(fabricTemplate, toscaResourceStructure,
- vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig,
- vfTemplate, vfModuleMemberName);
- cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization);
+ }
+ }
- fabricConfig.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations);
}
cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations);
+ cvnfcCustomizations.add(cvnfcCustomization);
+ existingCvnfcSet.add(cvnfcCustomization);
+
}
}
@@ -1961,12 +2212,12 @@ public class ToscaResourceInstaller {
return vfModuleCustomization;
}
- protected CvnfcConfigurationCustomization createCvnfcConfigurationCustomization(NodeTemplate fabricTemplate,
+ protected CvnfcConfigurationCustomization createCvnfcConfigurationCustomization(IEntityDetails fabricEntity,
ToscaResourceStructure toscaResourceStruct, VnfResourceCustomization vnfResource,
VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization,
- ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) {
+ ConfigurationResource configResource, String vfModuleMemberName) {
- Metadata fabricMetadata = fabricTemplate.getMetaData();
+ Metadata fabricMetadata = fabricEntity.getMetadata();
CvnfcConfigurationCustomization cvnfcConfigurationCustomization = new CvnfcConfigurationCustomization();
@@ -1976,42 +2227,55 @@ public class ToscaResourceInstaller {
cvnfcConfigurationCustomization
.setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- cvnfcConfigurationCustomization.setModelInstanceName(fabricTemplate.getName());
+ cvnfcConfigurationCustomization.setModelInstanceName(fabricEntity.getName());
+
+ List<IEntityDetails> policyList =
+ getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder("org.openecomp.policies.External"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF), true);
- List<Policy> policyList = toscaResourceStruct.getSdcCsarHelper()
- .getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(vfTemplate, "org.openecomp.policies.External");
if (policyList != null) {
- for (Policy policy : policyList) {
+ for (IEntityDetails policyEntity : policyList) {
- for (String policyCvfcTarget : policy.getTargets()) {
+ for (String policyCvfcTarget : policyEntity.getTargets()) {
if (policyCvfcTarget.equalsIgnoreCase(vfModuleMemberName)) {
- Map<String, Object> propMap = policy.getPolicyProperties();
+ String policyType = getLeafPropertyValue(policyEntity, "type");
- if (propMap.get("type").toString().equalsIgnoreCase("Fabric Policy")) {
- cvnfcConfigurationCustomization.setPolicyName(propMap.get("name").toString());
+ if (policyType != null && policyType.equalsIgnoreCase("Fabric Policy")) {
+ cvnfcConfigurationCustomization.setPolicyName(getLeafPropertyValue(policyEntity, "name"));
}
}
}
}
}
- cvnfcConfigurationCustomization.setConfigurationFunction(
- toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "function"));
- cvnfcConfigurationCustomization.setConfigurationRole(
- toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "role"));
- cvnfcConfigurationCustomization.setConfigurationType(
- toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "type"));
+ cvnfcConfigurationCustomization.setConfigurationFunction(getLeafPropertyValue(fabricEntity, "function"));
+ cvnfcConfigurationCustomization.setConfigurationRole(getLeafPropertyValue(fabricEntity, "role"));
+ cvnfcConfigurationCustomization.setConfigurationType(getLeafPropertyValue(fabricEntity, "type"));
return cvnfcConfigurationCustomization;
}
- protected ConfigurationResource findExistingConfiguration(Service service, String modelUUID) {
+ protected ConfigurationResource findExistingConfiguration(
+ List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom, String modelUUID) {
+ ConfigurationResource configResource = null;
+ for (CvnfcConfigurationCustomization cvnfcConfigCustom : existingCvnfcConfigurationCustom) {
+ if (cvnfcConfigCustom != null) {
+ if (cvnfcConfigCustom.getConfigurationResource().getModelUUID().equals(modelUUID)) {
+ configResource = cvnfcConfigCustom.getConfigurationResource();
+ }
+ }
+ }
+
+ return configResource;
+ }
+
+ protected ConfigurationResource findExistingConfiguration(Service service, String modelUUID,
+ List<ConfigurationResourceCustomization> configurationResourceList) {
ConfigurationResource configResource = null;
- for (ConfigurationResourceCustomization configurationResourceCustom : service
- .getConfigurationCustomizations()) {
+ for (ConfigurationResourceCustomization configurationResourceCustom : configurationResourceList) {
if (configurationResourceCustom.getConfigurationResource() != null
&& configurationResourceCustom.getConfigurationResource().getModelUUID().equals(modelUUID)) {
configResource = configurationResourceCustom.getConfigurationResource();
@@ -2045,7 +2309,7 @@ public class ToscaResourceInstaller {
return vfModule;
}
- protected VfModuleCustomization createVfModuleCustomization(Group group,
+ protected VfModuleCustomization createVfModuleCustomization(IEntityDetails vfModuleEntityDetails,
ToscaResourceStructure toscaResourceStructure, VfModule vfModule, IVfModuleData vfModuleData) {
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
@@ -2053,62 +2317,64 @@ public class ToscaResourceInstaller {
vfModuleCustomization.setVfModule(vfModule);
- String initialCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT);
+ String initialCount = getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT);
+
+
if (initialCount != null && initialCount.length() > 0) {
vfModuleCustomization.setInitialCount(Integer.valueOf(initialCount));
}
- vfModuleCustomization.setInitialCount(Integer.valueOf(toscaResourceStructure.getSdcCsarHelper()
- .getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT)));
+ String availabilityZoneCount =
+ getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT);
- String availabilityZoneCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT);
if (availabilityZoneCount != null && availabilityZoneCount.length() > 0) {
vfModuleCustomization.setAvailabilityZoneCount(Integer.valueOf(availabilityZoneCount));
}
- vfModuleCustomization.setLabel(toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL));
+ vfModuleCustomization
+ .setLabel(getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL));
+
+ String maxInstances =
+ getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES);
- String maxInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES);
if (maxInstances != null && maxInstances.length() > 0) {
vfModuleCustomization.setMaxInstances(Integer.valueOf(maxInstances));
}
- String minInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES);
+ String minInstances =
+ getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES);
+
if (minInstances != null && minInstances.length() > 0) {
vfModuleCustomization.setMinInstances(Integer.valueOf(minInstances));
}
return vfModuleCustomization;
}
- protected VfModule createVfModule(Group group, ToscaResourceStructure toscaResourceStructure,
+ protected VfModule createVfModule(IEntityDetails groupEntityDetails, ToscaResourceStructure toscaResourceStructure,
IVfModuleData vfModuleData, Metadata vfMetadata) {
VfModule vfModule = new VfModule();
String vfModuleModelUUID = vfModuleData.getVfModuleModelUUID();
if (vfModuleModelUUID == null) {
- vfModuleModelUUID = testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+
+ vfModuleModelUUID = testNull(
+ groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+
} else if (vfModuleModelUUID.indexOf('.') > -1) {
vfModuleModelUUID = vfModuleModelUUID.substring(0, vfModuleModelUUID.indexOf('.'));
}
- vfModule.setModelInvariantUUID(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
- vfModule.setModelName(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
+ vfModule.setModelInvariantUUID(
+ groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID));
+ vfModule.setModelName(
+ groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME));
vfModule.setModelUUID(vfModuleModelUUID);
- vfModule.setModelVersion(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
- vfModule.setDescription(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ vfModule.setModelVersion(
+ groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION));
+ vfModule.setDescription(groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+
+ String vfModuleType = getLeafPropertyValue(groupEntityDetails, SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE);
- String vfModuleType = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group,
- SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE);
if (vfModuleType != null && "Base".equalsIgnoreCase(vfModuleType)) {
vfModule.setIsBase(true);
} else {
@@ -2129,14 +2395,14 @@ public class ToscaResourceInstaller {
if (matchingObject.isPresent()) {
List<HeatFiles> heatFilesList = new ArrayList<>();
- List<HeatTemplate> volumeHeatChildTemplates = new ArrayList<HeatTemplate>();
- List<HeatTemplate> heatChildTemplates = new ArrayList<HeatTemplate>();
+ List<HeatTemplate> volumeHeatChildTemplates = new ArrayList<>();
+ List<HeatTemplate> heatChildTemplates = new ArrayList<>();
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>();
+ List<HeatTemplate> childNestedHeatTemplates = new ArrayList<>();
if (artifacts.contains(vfModuleArtifact.getArtifactInfo().getArtifactUUID())) {
checkVfModuleArtifactType(vfModule, vfModuleCustomization, heatFilesList, vfModuleArtifact,
@@ -2213,21 +2479,27 @@ public class ToscaResourceInstaller {
}
}
- protected VnfResourceCustomization createVnfResource(NodeTemplate vfNodeTemplate,
- ToscaResourceStructure toscaResourceStructure, Service service) {
+ protected VnfResourceCustomization createVnfResource(IEntityDetails entityDetails,
+ ToscaResourceStructure toscaResourceStructure, Service service) throws ArtifactInstallerException {
VnfResourceCustomization vnfResourceCustomization = null;
if (vnfResourceCustomization == null) {
+
VnfResource vnfResource = findExistingVnfResource(service,
- vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- if (vnfResource == null)
- vnfResource = createVnfResource(vfNodeTemplate);
+ if (vnfResource == null) {
+ vnfResource = createVnfResource(entityDetails);
+ }
vnfResourceCustomization =
- createVnfResourceCustomization(vfNodeTemplate, toscaResourceStructure, vnfResource);
+ createVnfResourceCustomization(entityDetails, toscaResourceStructure, vnfResource);
vnfResourceCustomization.setVnfResources(vnfResource);
vnfResourceCustomization.setService(service);
- vnfResource.getVnfResourceCustomizations().add(vnfResourceCustomization);
+
+ // setting resource input for vnf customization
+ vnfResourceCustomization.setResourceInput(
+ getResourceInput(toscaResourceStructure, vnfResourceCustomization.getModelCustomizationUUID()));
+ service.getVnfCustomizations().add(vnfResourceCustomization);
}
return vnfResourceCustomization;
@@ -2247,80 +2519,82 @@ public class ToscaResourceInstaller {
return vnfResource;
}
- protected VnfResourceCustomization createVnfResourceCustomization(NodeTemplate vfNodeTemplate,
+ protected VnfResourceCustomization createVnfResourceCustomization(IEntityDetails entityDetails,
ToscaResourceStructure toscaResourceStructure, VnfResource vnfResource) {
VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
vnfResourceCustomization.setModelCustomizationUUID(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- vnfResourceCustomization.setModelInstanceName(vfNodeTemplate.getName());
-
- 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)));
+ entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- vnfResourceCustomization.setMultiStageDesign(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, MULTI_STAGE_DESIGN));
+ vnfResourceCustomization.setModelInstanceName(entityDetails.getName());
+ vnfResourceCustomization
+ .setNfFunction(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ vnfResourceCustomization.setNfNamingCode(getLeafPropertyValue(entityDetails, "nf_naming_code"));
+ vnfResourceCustomization.setNfRole(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ vnfResourceCustomization.setNfType(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
- vnfResourceCustomization.setBlueprintName(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_NAME)));
+ vnfResourceCustomization.setMultiStageDesign(getLeafPropertyValue(entityDetails, MULTI_STAGE_DESIGN));
+ vnfResourceCustomization.setBlueprintName(getLeafPropertyValue(entityDetails, SDNC_MODEL_NAME));
+ vnfResourceCustomization.setBlueprintVersion(getLeafPropertyValue(entityDetails, SDNC_MODEL_VERSION));
- vnfResourceCustomization.setBlueprintVersion(testNull(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_VERSION)));
+ String skipPostInstConfText = getLeafPropertyValue(entityDetails, SKIP_POST_INST_CONF);
- String skipPostInstConfText = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SKIP_POST_INST_CONF);
if (skipPostInstConfText != null) {
- vnfResourceCustomization.setSkipPostInstConf(Boolean.parseBoolean(skipPostInstConfText));
+ vnfResourceCustomization.setSkipPostInstConf(
+ Boolean.parseBoolean(getLeafPropertyValue(entityDetails, SKIP_POST_INST_CONF)));
}
+
vnfResourceCustomization.setVnfResources(vnfResource);
vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger(
- vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
+ entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
- CapabilityAssignments vnfCustomizationCapability =
- toscaResourceStructure.getSdcCsarHelper().getCapabilitiesOf(vfNodeTemplate);
+ entityDetails.getCapabilities().get(SCALABLE);
- if (vnfCustomizationCapability != null) {
- CapabilityAssignment capAssign = vnfCustomizationCapability.getCapabilityByName(SCALABLE);
+
+ if (entityDetails.getCapabilities() != null) {
+
+ CapabilityAssignment capAssign = entityDetails.getCapabilities().get(SCALABLE);
if (capAssign != null) {
- vnfResourceCustomization.setMinInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper()
- .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
- vnfResourceCustomization.setMaxInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper()
- .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ vnfResourceCustomization.setMinInstances(Integer
+ .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ vnfResourceCustomization.setMaxInstances(Integer
+ .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
}
}
+ if (vnfResourceCustomization.getMinInstances() == null && vnfResourceCustomization.getMaxInstances() == null) {
+ vnfResourceCustomization.setMinInstances(Integer
+ .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ vnfResourceCustomization.setMaxInstances(Integer
+ .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ }
+
toscaResourceStructure.setCatalogVnfResourceCustomization(vnfResourceCustomization);
return vnfResourceCustomization;
}
- protected VnfResource createVnfResource(NodeTemplate vfNodeTemplate) {
+ protected VnfResource createVnfResource(IEntityDetails entityDetails) {
VnfResource vnfResource = new VnfResource();
vnfResource.setModelInvariantUUID(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
- vnfResource.setModelName(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- vnfResource.setModelUUID(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ vnfResource.setModelName(testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ vnfResource.setModelUUID(testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
vnfResource.setModelVersion(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
vnfResource.setDescription(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
vnfResource.setOrchestrationMode(HEAT);
- vnfResource.setToscaNodeType(testNull(vfNodeTemplate.getType()));
+ vnfResource.setToscaNodeType(testNull(entityDetails.getToscaType()));
vnfResource.setAicVersionMax(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
vnfResource.setAicVersionMin(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
- vnfResource.setCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
- vnfResource.setSubCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
+ testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ vnfResource.setCategory(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ vnfResource.setSubCategory(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
return vnfResource;
}
@@ -2441,7 +2715,7 @@ public class ToscaResourceInstaller {
if (object == null) {
return null;
- } else if (object.equals("NULL")) {
+ } else if ("NULL".equals(object)) {
return null;
} else if (object instanceof Integer) {
return object.toString();
@@ -2495,6 +2769,29 @@ public class ToscaResourceInstaller {
+ vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
}
+ protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct,
+ EntityQueryBuilder entityType, TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) {
+
+ EntityQuery entityQuery = entityType.build();
+ TopologyTemplateQuery topologyTemplateQuery = topologyTemplateBuilder.build();
+ List<IEntityDetails> entityDetails =
+ toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch);
+
+ return entityDetails;
+
+ }
+
+ protected String getLeafPropertyValue(IEntityDetails entityDetails, String propName) {
+
+ Property leafProperty = entityDetails.getProperties().get(propName);
+
+ if (leafProperty != null && leafProperty.getValue() != null) {
+ return leafProperty.getValue().toString();
+ }
+
+ return null;
+ }
+
protected String getPropertyInput(String propertyName) {
String inputName = new String();
@@ -2509,6 +2806,21 @@ public class ToscaResourceInstaller {
return inputName;
}
+ // this method add provided vnfCustomization to service with
+ // existing customization available in db.
+ private void addVnfCustomization(Service service, VnfResourceCustomization vnfResourceCustomization) {
+ List<Service> services = serviceRepo.findByModelUUID(service.getModelUUID());
+ if (!services.isEmpty()) {
+ // service exist in db
+ Service existingService = services.get(0);
+ List<VnfResourceCustomization> existingVnfCustomizations = existingService.getVnfCustomizations();
+ if (existingService != null) {
+ service.getVnfCustomizations().addAll(existingVnfCustomizations);
+ }
+ }
+ service.getVnfCustomizations().add(vnfResourceCustomization);
+ }
+
protected static Timestamp getCurrentTimeStamp() {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
index 3659ceed12..0128078a59 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
@@ -30,6 +30,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
@@ -140,7 +141,6 @@ public class WatchdogDistribution {
logger.debug("Updating overall DistributionStatus to: {} for distributionId: ", status,
distributionId);
- watchdogDistributionStatus.setDistributionIdStatus(status);
watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
} else {
logger.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results.");
@@ -181,6 +181,8 @@ public class WatchdogDistribution {
throw new Exception(error);
}
+
+
AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, serviceModelInvariantUUID,
serviceModelVersionId);
aaiUri.depth(Depth.ZERO); // Do not return relationships if any
@@ -198,6 +200,16 @@ public class WatchdogDistribution {
}
}
+ public void updateCatalogDBStatus(String serviceModelVersionId, String status) {
+ try {
+ Service foundService = serviceRepo.findOneByModelUUID(serviceModelVersionId);
+ foundService.setDistrobutionStatus(status);
+ serviceRepo.save(foundService);
+ } catch (Exception e) {
+ logger.error("Error updating CatalogDBStatus", e);
+ }
+ }
+
public AAIResourcesClient getAaiClient() {
if (aaiClient == null) {
aaiClient = new AAIResourcesClient();
diff --git a/asdc-controller/src/main/resources/application-local.yaml b/asdc-controller/src/main/resources/application-local.yaml
deleted file mode 100644
index 1b21d8b571..0000000000
--- a/asdc-controller/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,95 +0,0 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-
-server-port: 8080
-ssl-enable: false
-
-
-
-# H2
-spring:
- datasource:
- jdbc-url: jdbc:mariadb://localhost:3306/catalogdb
- username: root
- password: password
- driver-class-name: org.mariadb.jdbc.Driver
- initialize: true
-
- jpa:
- show-sql: true
- hibernate:
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable-lazy-load-no-trans: true
- database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
- security:
- usercredentials:
- -
- username: asdc
- password: '$2a$12$4R2QhxH7elzoZYoC.HJKTOHYDoaC9LbJD44Q9/tm4t/UzPF9Cgifi'
- role: Asdc-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-request:
- datasource:
- jdbc-url: jdbc:mariadb://localhost:3306/requestdb
- username: root
- password: password
- driver-class-name: org.mariadb.jdbc.Driver
- initialize: true
- initialization-mode: never
-
-#Actuator
-management:
- endpoints:
- web:
- base-path: /manage
- server:
- servlet:
- context-path: /manage
- metrics:
- se-global-registry: false
- export:
- prometheus:
- enabled: true # Whether exporting of metrics to Prometheus is enabled.
- step: 1m # Step size (i.e. reporting frequency) to use.
-
-
-mso:
- logPath: logs
- catalog:
- db:
- spring:
- endpoint: "http://localhost:8090"
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- site-name: siteName
- aai:
- endpoint: https://localhost:8443
- asdc-connections:
- asdc-controller1:
- user: msopreist
- consumerGroup: msoasdc-id-local
- consumerId: msoasdc-id-local
- environmentName: Pre-IST
- asdcAddress: localhost:8443
- password: CB655C3C236F1F0370A347E3A0E0E133BE10ADCF4D16377E7378D3FE46A4BF60C27DF1FFB4
- pollingInterval: 30
- pollingTimeout: 30
- relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
- useHttpsWithDmaap: true
- activateServerTLSAuth: false
- keyStorePassword:
- keyStorePath:
- watchDogTimeout: 1
- isFitlerInEmptyResources: true
- messageBusAddress: localhost,localhost,localhost
- asdc:
- config:
- key: 566B754875657232314F5548556D3665
- components:
- count: 3,
- componentNames: SO,AAI,SDNC
- scheduling:
- enabled: false
diff --git a/asdc-controller/src/main/resources/application.yaml b/asdc-controller/src/main/resources/application.yaml
index 2d0a2acf94..2de5b6914f 100644
--- a/asdc-controller/src/main/resources/application.yaml
+++ b/asdc-controller/src/main/resources/application.yaml
@@ -4,15 +4,13 @@ server:
spring:
datasource:
- jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
- dbcp2:
- initial-size: 5
- max-total: 20
- validation-query: select 1
- test-on-borrow: true
+ hikari:
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: catdb-pool
+ registerMbeans: true
jpa:
show-sql: true
hibernate:
@@ -20,13 +18,19 @@ spring:
ddl-auto: validate
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
enable-lazy-load-no-trans: true
+ main:
+ allow-bean-definition-overriding: true
request:
datasource:
- jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
+ hikari:
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: reqdb-pool
+ registerMbeans: true
+
#Actuator
management:
endpoints:
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
index 0681cd8aed..055968cc95 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java
@@ -33,6 +33,7 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
@@ -55,6 +56,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@@ -277,6 +279,35 @@ public class ASDCControllerITTest extends BaseTest {
}
}
+ /**
+ * Test to check RequestId is being set using the DistributionID.
+ */
+ @Test
+ public void treatNotification_verifyRequestID() {
+
+ String serviceUuid = "efaea486-561f-4159-9191-a8d3cb346728";
+ String serviceInvariantUuid = "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23";
+ distributionId = "bb15de12-166d-4e45-9e5f-4b3f25200d7b";
+
+ initMockAaiServer(serviceUuid, serviceInvariantUuid);
+
+ NotificationDataImpl notificationData = new NotificationDataImpl();
+ notificationData.setServiceUUID(serviceUuid);
+ notificationData.setDistributionID(distributionId);
+ notificationData.setServiceInvariantUUID(serviceInvariantUuid);
+ notificationData.setServiceVersion("1.0");
+
+ try {
+ asdcController.treatNotification(notificationData);
+ logger.info("Verify RequestId : {}", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertEquals("bb15de12-166d-4e45-9e5f-4b3f25200d7b", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+
+ } catch (Exception e) {
+ logger.info(e.getMessage(), e);
+ fail(e.getMessage());
+ }
+ }
+
private ArtifactInfoImpl constructPnfServiceArtifact() {
ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl();
artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR);
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
index 2c520a3bba..2a4b3aa6fb 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
@@ -43,6 +43,8 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Mockito;
import org.mockito.Spy;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
@@ -67,6 +69,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.test.util.ReflectionTestUtils;
public class ASDCRestInterfaceTest extends BaseTest {
@@ -107,6 +110,7 @@ public class ASDCRestInterfaceTest extends BaseTest {
public void setUp() {
// ASDC Controller writes to this path
System.setProperty("mso.config.path", folder.getRoot().toString());
+ ReflectionTestUtils.setField(toscaInstaller, "toscaCsarRepo", toscaCsarRepo);
}
@Test
@@ -144,6 +148,7 @@ public class ASDCRestInterfaceTest extends BaseTest {
AllottedResourceCustomization arCustomization = new AllottedResourceCustomization();
arCustomization.setModelCustomizationUUID("f62bb612-c5d4-4406-865c-0abec30631ba");
arCustomization.setModelInstanceName("rege1802pnf 0");
+ arCustomization.setResourceInput("{}");
arCustomizationSet.add(arCustomization);
arCustomization.setAllottedResource(expectedService);
@@ -164,7 +169,7 @@ public class ASDCRestInterfaceTest extends BaseTest {
@Test
@Transactional
- public void test_VFW_Distrobution() throws Exception {
+ public void test_VFW_Distribution() throws Exception {
wireMockServer.stubFor(post(urlPathMatching("/aai/.*"))
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")));
@@ -290,6 +295,30 @@ public class ASDCRestInterfaceTest extends BaseTest {
assertEquals("Generic NeutronNet", networkResource.get().getModelName());
}
+ @Test
+ public void test_CCVPN_Distribution() throws Exception {
+ wireMockServer.stubFor(post(urlPathMatching("/aai/.*"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")));
+
+ wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value())));
+
+ String resourceLocation = "src/test/resources/resource-examples/ccvpn/";
+ ObjectMapper mapper = new ObjectMapper();
+ NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demo-ccvpn-notification.json"),
+ NotificationDataImpl.class);
+ headers.add("resource-location", resourceLocation);
+ HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers);
+ ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"),
+ HttpMethod.POST, entity, String.class);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ Optional<Service> service = serviceRepo.findById("317887d3-a4e4-45cb-8971-2a78426fefac");
+ assertTrue(service.isPresent());
+ assertEquals("CCVPNService", service.get().getModelName());
+ }
+
protected String createURLWithPort(String uri) {
return "http://localhost:" + port + uri;
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
index 844adeede2..da99efadea 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
@@ -24,6 +24,7 @@ import org.junit.Test;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
+import org.onap.sdc.tosca.parser.api.IEntityDetails;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.Property;
@@ -33,10 +34,7 @@ import org.onap.sdc.toscaparser.api.parameters.Input;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.installer.ToscaResourceStructure;
import org.onap.so.db.catalog.beans.Service;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
+import java.util.*;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
@@ -52,6 +50,9 @@ public class ToscaResourceInputTest {
NodeTemplate nodeTemplate;
@Mock
+ IEntityDetails entityDetails;
+
+ @Mock
Property property;
@Mock
@@ -61,6 +62,27 @@ public class ToscaResourceInputTest {
Input input;
@Test
+ public void getListResourceInput() {
+ ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller();
+ LinkedHashMap<String, Property> hashMap = new LinkedHashMap<>();
+ hashMap.put("key1", property);
+ Map<String, Object> map = new HashMap<>();
+ map.put("customizationUUID", "69df3303-d2b3-47a1-9d04-41604d3a95fd");
+ Metadata metadata = new Metadata(map);
+ when(entityDetails.getProperties()).thenReturn(hashMap);
+ when(property.getValue()).thenReturn(getInput);
+ when(getInput.getInputName()).thenReturn("nameKey");
+ when(input.getName()).thenReturn("nameKey");
+ when(input.getDefault()).thenReturn("defaultValue");
+ when(getInput.toString()).thenReturn("getinput:[sites,INDEX,role]");
+ when(entityDetails.getMetadata()).thenReturn(metadata);
+ List<Input> inputs = new ArrayList<>();
+ inputs.add(input);
+ String resourceInput = toscaResourceInstaller.getVnfcResourceInput(entityDetails, inputs);
+ assertEquals("{\\\"key1\\\":\\\"[sites,INDEX,role]|defaultValue\\\"}", resourceInput);
+ }
+
+ @Test
public void processResourceSequenceTest() {
ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller();
ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure();
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index dd107f7775..ffad137ad7 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -25,15 +25,20 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Optional;
import org.hibernate.exception.LockAcquisitionException;
import org.junit.Before;
import org.junit.Rule;
@@ -42,36 +47,54 @@ import org.junit.rules.ExpectedException;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
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.tosca.parser.api.IEntityDetails;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
import org.onap.sdc.toscaparser.api.Group;
import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.RequirementAssignment;
+import org.onap.sdc.toscaparser.api.RequirementAssignments;
+import org.onap.sdc.toscaparser.api.SubstitutionMappings;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.toscaparser.api.elements.StatefulEntityType;
+import org.onap.sdc.toscaparser.api.parameters.Input;
import org.onap.sdc.utils.DistributionStatusEnum;
import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.client.ResourceInstance;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl;
import org.onap.so.asdc.client.test.emulators.JsonStatusData;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
+import org.onap.so.asdc.installer.IVfModuleData;
+import org.onap.so.asdc.installer.ResourceStructure;
import org.onap.so.asdc.installer.ToscaResourceStructure;
+import org.onap.so.asdc.installer.VfModuleStructure;
+import org.onap.so.asdc.installer.VfResourceStructure;
+import org.onap.so.asdc.installer.bpmn.WorkflowResource;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.ToscaCsar;
+import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
+import org.onap.so.db.catalog.data.repository.VFModuleRepository;
+import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
+import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.util.ReflectionTestUtils;
import java.util.Optional;
+import java.util.stream.Collectors;
public class ToscaResourceInstallerTest extends BaseTest {
@Autowired
@@ -99,8 +122,12 @@ public class ToscaResourceInstallerTest extends BaseTest {
@Mock
private NodeTemplate nodeTemplate;
@Mock
+ private IEntityDetails entityDetails;
+ @Mock
private ToscaResourceStructure toscaResourceStructure;
@Mock
+ private VfResourceStructure vfResourceStruct;
+ @Mock
private ServiceProxyResourceCustomization spResourceCustomization;
@Mock
private ISdcCsarHelper csarHelper;
@@ -248,6 +275,206 @@ public class ToscaResourceInstallerTest extends BaseTest {
}
@Test
+ public void installTheResourceWithGroupAndVFModulesTest() throws Exception {
+ ToscaResourceInstaller toscaInstaller = new ToscaResourceInstaller();
+ ToscaResourceStructure toscaResourceStructObj = prepareToscaResourceStructure(true, toscaInstaller);
+
+ toscaInstaller.installTheResource(toscaResourceStructObj, vfResourceStruct);
+ assertEquals(true, toscaResourceStructObj.isDeployedSuccessfully());
+ }
+
+ @Test
+ public void installTheResourceGroupWithoutVFModulesTest() throws Exception {
+ ToscaResourceInstaller toscaInstaller = new ToscaResourceInstaller();
+ ToscaResourceStructure toscaResourceStructObj = prepareToscaResourceStructure(false, toscaInstaller);
+
+ toscaInstaller.installTheResource(toscaResourceStructObj, vfResourceStruct);
+ assertEquals(true, toscaResourceStructObj.isDeployedSuccessfully());
+ }
+
+ private ToscaResourceStructure prepareToscaResourceStructure(boolean prepareVFModuleStructures,
+ ToscaResourceInstaller toscaInstaller) throws ArtifactInstallerException {
+
+ Metadata metadata = mock(Metadata.class);
+ IResourceInstance resourceInstance = mock(ResourceInstance.class);
+ NodeTemplate nodeTemplate = mock(NodeTemplate.class);
+ ISdcCsarHelper csarHelper = mock(SdcCsarHelperImpl.class);
+
+ IArtifactInfo inputCsar = mock(IArtifactInfo.class);
+ String artifactUuid = "0122c05e-e13a-4c63-b5d2-475ccf23aa74";
+ String checkSum = "MGUzNjJjMzk3OTBkYzExYzQ0MDg2ZDc2M2E3ZjZiZmY=";
+
+ doReturn(checkSum).when(inputCsar).getArtifactChecksum();
+ doReturn(artifactUuid).when(inputCsar).getArtifactUUID();
+ doReturn("1.0").when(inputCsar).getArtifactVersion();
+ doReturn("TestCsarWithGroupAndVFModule").when(inputCsar).getArtifactName();
+ doReturn("Test Csar data with Group and VF module inputs").when(inputCsar).getArtifactDescription();
+ doReturn("http://localhost/dummy/url/test.csar").when(inputCsar).getArtifactURL();
+
+ ToscaResourceStructure toscaResourceStructObj = new ToscaResourceStructure();
+ toscaResourceStructObj.setToscaArtifact(inputCsar);
+
+ ToscaCsarRepository toscaCsarRepo = spy(ToscaCsarRepository.class);
+
+
+ ToscaCsar toscaCsar = mock(ToscaCsar.class);
+ Optional<ToscaCsar> returnValue = Optional.of(toscaCsar);
+ doReturn(artifactUuid).when(toscaCsar).getArtifactUUID();
+ doReturn(checkSum).when(toscaCsar).getArtifactChecksum();
+ doReturn(returnValue).when(toscaCsarRepo).findById(artifactUuid);
+
+ ReflectionTestUtils.setField(toscaInstaller, "toscaCsarRepo", toscaCsarRepo);
+
+ NotificationDataImpl notificationData = new NotificationDataImpl();
+ notificationData.setDistributionID("testStatusSuccessfulTosca");
+ notificationData.setServiceVersion("1234567");
+ notificationData.setServiceUUID("serviceUUID1");
+ notificationData.setWorkloadContext("workloadContext1");
+
+
+
+ String serviceType = "test-type1";
+ String serviceRole = "test-role1";
+ String category = "Network L3+";
+ String description = "Customer Orderable service description";
+ String name = "Customer_Orderable_Service";
+ String uuid = "72db5868-4575-4804-b546-0b0d3c3b5ac6";
+ String invariantUUID = "6f30bbe3-4590-4185-a7e0-4f9610926c6f";
+ String namingPolicy = "naming Policy1";
+ String ecompGeneratedNaming = "true";
+ String environmentContext = "General_Revenue-Bearing1";
+ String resourceCustomizationUUID = "0177ba22-5547-4e4e-bcf8-178f7f71de3a";
+
+ doReturn(serviceType).when(metadata).getValue("serviceType");
+ doReturn(serviceRole).when(metadata).getValue("serviceRole");
+
+ doReturn(category).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ doReturn(description).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION);
+ doReturn("1.0").when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VERSION);
+ doReturn(name).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
+
+ doReturn(uuid).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
+
+ doReturn(environmentContext).when(metadata).getValue(metadata.getValue("environmentContext"));
+ doReturn(invariantUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID);
+ doReturn(namingPolicy).when(metadata).getValue("namingPolicy");
+ doReturn(ecompGeneratedNaming).when(metadata).getValue("ecompGeneratedNaming");
+ doReturn(resourceCustomizationUUID).when(metadata).getValue("vfModuleModelCustomizationUUID");
+
+ ServiceRepository serviceRepo = spy(ServiceRepository.class);
+
+ VnfResourceRepository vnfRepo = spy(VnfResourceRepository.class);
+ doReturn(null).when(vnfRepo).findResourceByModelUUID(uuid);
+
+ VFModuleRepository vfModuleRepo = spy(VFModuleRepository.class);
+ InstanceGroupRepository instanceGroupRepo = spy(InstanceGroupRepository.class);
+
+ WorkflowResource workflowResource = spy(WorkflowResource.class);
+
+ ReflectionTestUtils.setField(toscaInstaller, "serviceRepo", serviceRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "vnfRepo", vnfRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "vfModuleRepo", vfModuleRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "instanceGroupRepo", instanceGroupRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "workflowResource", workflowResource);
+
+ // doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper();
+ toscaResourceStructObj.setSdcCsarHelper(csarHelper);
+ doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION);
+ doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE);
+ doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE);
+ doReturn(resourceCustomizationUUID).when(csarHelper).getMetadataPropertyValue(metadata,
+ SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ doReturn(uuid).when(csarHelper).getMetadataPropertyValue(metadata,
+ SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID);
+
+
+ // vnfc instance group list
+ List<Group> vnfcInstanceGroupList = new ArrayList<>();
+ Group vnfcG1 = mock(Group.class);
+ Map<String, Object> metaProperties = new HashMap<>();
+ metaProperties.put(SdcPropertyNames.PROPERTY_NAME_UUID, "vnfc_group1_uuid");
+ metaProperties.put(SdcPropertyNames.PROPERTY_NAME_NAME, "vnfc_group1_uuid");
+ metaProperties.put(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID, "vnfc_group1_invariantid");
+ metaProperties.put(SdcPropertyNames.PROPERTY_NAME_VERSION, "1.0");
+ Metadata vnfcmetadata = new Metadata(metaProperties);
+
+ doReturn(vnfcmetadata).when(vnfcG1).getMetadata();
+ ArrayList<NodeTemplate> memberList = new ArrayList();
+ doReturn(memberList).when(vnfcG1).getMemberNodes();
+ vnfcInstanceGroupList.add(vnfcG1);
+ SubstitutionMappings submappings = mock(SubstitutionMappings.class);
+ doReturn(new ArrayList<Input>()).when(submappings).getInputs();
+ doReturn(submappings).when(nodeTemplate).getSubMappingToscaTemplate();
+
+ doReturn(vnfcInstanceGroupList).when(csarHelper).getGroupsOfOriginOfNodeTemplateByToscaGroupType(nodeTemplate,
+ "org.openecomp.groups.VfcInstanceGroup");
+
+
+ doReturn(notificationData).when(vfResourceStruct).getNotification();
+ doReturn(resourceInstance).when(vfResourceStruct).getResourceInstance();
+
+ if (prepareVFModuleStructures) {
+
+ // VfModule list
+ List<Group> vfModuleGroups = new ArrayList<>();
+ Group g1 = mock(Group.class);
+ doReturn(metadata).when(g1).getMetadata();
+ vfModuleGroups.add(g1);
+
+ doReturn(vfModuleGroups).when(csarHelper).getVfModulesByVf(resourceCustomizationUUID);
+ doReturn("1").when(csarHelper).getGroupPropertyLeafValue(g1, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT);
+
+ doReturn(metadata).when(nodeTemplate).getMetaData();
+ List<NodeTemplate> nodeList = new ArrayList<>();
+ nodeList.add(nodeTemplate);
+ doReturn(nodeList).when(csarHelper).getServiceVfList();
+
+ IVfModuleData moduleMetadata = mock(IVfModuleData.class);
+ doReturn(name).when(moduleMetadata).getVfModuleModelName();
+ doReturn(invariantUUID).when(moduleMetadata).getVfModuleModelInvariantUUID();
+ doReturn(Collections.<String>emptyList()).when(moduleMetadata).getArtifacts();
+ doReturn(resourceCustomizationUUID).when(moduleMetadata).getVfModuleModelCustomizationUUID();
+ doReturn(uuid).when(moduleMetadata).getVfModuleModelUUID();
+ doReturn("1.0").when(moduleMetadata).getVfModuleModelVersion();
+
+ VfModuleStructure moduleStructure = new VfModuleStructure(vfResourceStruct, moduleMetadata);
+
+ List<VfModuleStructure> moduleStructures = new ArrayList<>();
+ moduleStructures.add(moduleStructure);
+ doReturn(moduleStructures).when(vfResourceStruct).getVfModuleStructure();
+ }
+
+ toscaResourceStructObj.setServiceMetadata(metadata);
+ doReturn("resourceInstanceName1").when(resourceInstance).getResourceInstanceName();
+ doReturn(resourceCustomizationUUID).when(resourceInstance).getResourceCustomizationUUID();
+ doReturn("resourceName1").when(resourceInstance).getResourceName();
+
+ Service service = toscaInstaller.createService(toscaResourceStructObj, vfResourceStruct);
+
+ assertNotNull(service);
+ service.setModelVersion("1.0");
+
+ doReturn(service).when(serviceRepo).save(service);
+
+ WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository =
+ spy(WatchdogComponentDistributionStatusRepository.class);
+ ReflectionTestUtils.setField(toscaInstaller, "watchdogCDStatusRepository", watchdogCDStatusRepository);
+ doReturn(null).when(watchdogCDStatusRepository).save(any(WatchdogComponentDistributionStatus.class));
+
+ VnfcInstanceGroupCustomizationRepository vnfcInstanceGroupCustomizationRepo =
+ spy(VnfcInstanceGroupCustomizationRepository.class);
+ ReflectionTestUtils.setField(toscaInstaller, "vnfcInstanceGroupCustomizationRepo",
+ vnfcInstanceGroupCustomizationRepo);
+ doReturn(null).when(vnfcInstanceGroupCustomizationRepo).save(any(VnfcInstanceGroupCustomization.class));
+ return toscaResourceStructObj;
+ }
+
+
+
+ @Test
public void installTheResourceExceptionTest() throws Exception {
expectedException.expect(ArtifactInstallerException.class);
@@ -340,7 +567,59 @@ public class ToscaResourceInstallerTest extends BaseTest {
return actualWatchdogComponentDistributionStatus;
}
-
+ @Test
+ public void createServiceTest() {
+ ToscaResourceStructure toscaResourceStructure = mock(ToscaResourceStructure.class);
+ ResourceStructure resourceStructure = mock(ResourceStructure.class);
+ Metadata metadata = mock(Metadata.class);
+ INotificationData notification = mock(INotificationData.class);
+
+ doReturn("e2899e5c-ae35-434c-bada-0fabb7c1b44d").when(toscaResourceStructure).getServiceVersion();
+ doReturn(metadata).when(toscaResourceStructure).getServiceMetadata();
+ doReturn("production").when(notification).getWorkloadContext();
+ doReturn(notification).when(resourceStructure).getNotification();
+
+ String serviceType = "test-type";
+ String serviceRole = "test-role";
+ String category = "Network L4+";
+ String description = "Customer Orderable service description";
+ String name = "Customer Orderable Service";
+ String uuid = "72db5868-4575-4804-b546-0b0d3c3b5ac6";
+ String invariantUUID = "6f30bbe3-4590-4185-a7e0-4f9610926c6f";
+ String namingPolicy = "naming Policy";
+ String ecompGeneratedNaming = "true";
+ String environmentContext = "General_Revenue-Bearing";
+
+ doReturn(serviceType).when(metadata).getValue("serviceType");
+ doReturn(serviceRole).when(metadata).getValue("serviceRole");
+
+ doReturn(category).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ doReturn(description).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION);
+
+ doReturn(name).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
+
+ doReturn(uuid).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
+
+ doReturn(environmentContext).when(metadata).getValue(metadata.getValue("environmentContext"));
+ doReturn(invariantUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID);
+ doReturn(namingPolicy).when(metadata).getValue("namingPolicy");
+ doReturn(ecompGeneratedNaming).when(metadata).getValue("ecompGeneratedNaming");
+
+ Service service = toscaInstaller.createService(toscaResourceStructure, resourceStructure);
+
+ assertNotNull(service);
+
+ verify(toscaResourceStructure, times(2)).getServiceVersion();
+ assertNotNull(service.getNamingPolicy());
+ assertEquals(serviceType, service.getServiceType());
+ assertEquals(serviceRole, service.getServiceRole());
+ assertEquals(category, service.getCategory());
+ assertEquals(description, service.getDescription());
+ assertEquals(uuid, service.getModelUUID());
+ assertEquals(invariantUUID, service.getModelInvariantUUID());
+ assertEquals(namingPolicy, service.getNamingPolicy());
+ assertTrue(service.getOnapGeneratedNaming());
+ }
private void prepareConfigurationResource() {
doReturn(metadata).when(nodeTemplate).getMetaData();
@@ -396,7 +675,7 @@ public class ToscaResourceInstallerTest extends BaseTest {
assertNotNull(configurationResourceCustomization);
assertNotNull(configurationResourceCustomization.getConfigurationResource());
assertEquals(MockConstants.MODEL_CUSTOMIZATIONUUID,
- configurationResourceCustomization.getServiceProxyResourceCustomizationUUID());
+ configurationResourceCustomization.getServiceProxyResourceCustomization().getModelCustomizationUUID());
}
@Test
@@ -430,6 +709,81 @@ public class ToscaResourceInstallerTest extends BaseTest {
verify(vnrConfigCustom, times(1)).setConfigResourceCustomization(vrfConfigCustom);
}
+ @Test
+ public void testProcessVNFCGroupSequence() {
+ List<Group> groupList = new ArrayList<>();
+
+ Group group1 = mock(Group.class);
+ NodeTemplate node1 = mock(NodeTemplate.class);
+ List<NodeTemplate> nodeList1 = new ArrayList<>();
+ nodeList1.add(node1);
+ doReturn("VfcInstanceGroup..0").when(group1).getName();
+ doReturn(nodeList1).when(group1).getMemberNodes();
+ doReturn("deviceV3").when(node1).getName();
+
+ Group group2 = mock(Group.class);
+ NodeTemplate node2 = mock(NodeTemplate.class);
+ List<NodeTemplate> nodeList2 = new ArrayList<>();
+ nodeList2.add(node2);
+ doReturn("VfcInstanceGroup..1").when(group2).getName();
+ doReturn(nodeList2).when(group2).getMemberNodes();
+ RequirementAssignments requirements2 = mock(RequirementAssignments.class);
+ RequirementAssignment requirement2 = mock(RequirementAssignment.class);
+ List<RequirementAssignment> requirementCollection2 = new ArrayList<>();
+ requirementCollection2.add(requirement2);
+ doReturn(requirementCollection2).when(requirements2).getAll();
+ doReturn("deviceV3").when(requirement2).getNodeTemplateName();
+ doReturn("SiteV2").when(node2).getName();
+
+ Group group3 = mock(Group.class);
+ NodeTemplate node3 = mock(NodeTemplate.class);
+ List<NodeTemplate> nodeList3 = new ArrayList<>();
+ nodeList3.add(node3);
+ doReturn("VfcInstanceGroup..2").when(group3).getName();
+ doReturn(nodeList3).when(group3).getMemberNodes();
+ RequirementAssignments requirements3 = mock(RequirementAssignments.class);
+ RequirementAssignment requirement3 = mock(RequirementAssignment.class);
+ List<RequirementAssignment> requirementCollection3 = new ArrayList<>();
+ requirementCollection3.add(requirement3);
+ doReturn(requirementCollection3).when(requirements3).getAll();
+ doReturn("SiteV2").when(requirement3).getNodeTemplateName();
+ doReturn("siteWanV2").when(node3).getName();
+
+ groupList.add(group1);
+ groupList.add(group2);
+ groupList.add(group3);
+
+ doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper();
+ doReturn(null).when(csarHelper).getRequirementsOf(node1);
+ doReturn(requirements2).when(csarHelper).getRequirementsOf(node2);
+ doReturn(requirements3).when(csarHelper).getRequirementsOf(node3);
+
+ ToscaResourceInstaller installer = new ToscaResourceInstaller();
+ Method[] methods = installer.getClass().getDeclaredMethods();
+ Method testMethod = null;
+ for (Method method : methods) {
+ String name = method.getName();
+ if (name.equals("processVNFCGroupSequence")) {
+ method.setAccessible(true);
+ testMethod = method;
+ }
+ }
+
+ if (null != testMethod) {
+ try {
+ Object seqResult = testMethod.invoke(installer, toscaResourceStructure, groupList);
+ if (seqResult instanceof List) {
+ String resultStr = ((List<String>) seqResult).stream().collect(Collectors.joining(","));
+ assertEquals(((List<String>) seqResult).size(), 3);
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ }
+
+
class MockConstants {
public final static String MODEL_NAME = "VLAN Network Receptor Configuration";
public final static String MODEL_INVARIANT_UUID = "1608eef4-de53-4334-a8d2-ba79cab4bde0";
diff --git a/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json b/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json
new file mode 100644
index 0000000000..1ca96f7dc9
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json
@@ -0,0 +1,47 @@
+{
+ "distributionID": "8a01603d-606d-4e40-8bc4-37107ad97897",
+ "serviceName": "CCVPNService",
+ "serviceVersion": "1.0",
+ "serviceUUID": "317887d3-a4e4-45cb-8971-2a78426fefac",
+ "serviceDescription": "CCVPN",
+ "serviceInvariantUUID": "e43f9b81-3035-44df-b618-a787e1c49427",
+ "resources": [
+ {
+ "resourceInstanceName": "siteResource",
+ "resourceCustomizationUUID": "e9e01777-bb2f-42f0-b825-aef0f4c37ccf",
+ "resourceName": "siteResource",
+ "resourceVersion": "1.0",
+ "resoucreType": "VF",
+ "resourceUUID": "5a641276-443b-45ca-ac9c-a0ee84f5007b",
+ "resourceInvariantUUID": "5338673f-df81-483a-afa4-b9766442ebf1",
+ "category": "Configuration",
+ "subcategory": "Configuration",
+ "artifacts": []
+ },
+ {
+ "resourceInstanceName": "SDWANVPNResource",
+ "resourceCustomizationUUID": "7815f32c-bdbf-41f7-9a18-6f0e6d5a0d0e",
+ "resourceName": "SDWANVPNResource",
+ "resourceVersion": "1.0",
+ "resoucreType": "VF",
+ "resourceUUID": "5f9f2164-f7e4-461d-b8de-3470297ce2b3",
+ "resourceInvariantUUID": "5ca15886-9990-419c-a4bb-f0229eac0926",
+ "category": "Configuration",
+ "subcategory": "Configuration",
+ "artifacts": []
+ }
+ ],
+ "serviceArtifacts": [
+ {
+ "artifactName": "service-Ccvpnservice-csar.csar",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "/service-Ccvpnservice-csar.csar",
+ "artifactChecksum": "NTZlNGU4YTQwNzVkZWMwYWZkODE5M2MwYzcyNzM3M2U\u003d",
+ "artifactDescription": "TOSCA definition package of the asset",
+ "artifactTimeout": 0,
+ "artifactVersion": "2",
+ "artifactUUID": "59f34dcf-ec33-4a88-8dbe-aa7f4571ef59"
+ }
+ ],
+ "workloadContext": "Production"
+} \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar b/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar
new file mode 100644
index 0000000000..ce2ac5e0c9
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar
index 841c681088..40b8b7b45a 100644
--- a/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar
+++ b/asdc-controller/src/test/resources/resource-examples/vcpe-infra/service-Demovcpeinfra-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 8cc5ee9d49..ad6b156956 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -806,6 +806,9 @@ CREATE TABLE `service` (
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_ORDER` varchar(200) default NULL,
+ `OVERALL_DISTRIBUTION_STATUS` varchar(45),
+ `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL,
+ `NAMING_POLICY` varchar(200) DEFAULT NULL,
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -1109,6 +1112,8 @@ CREATE TABLE `vnf_resource_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
@@ -1135,6 +1140,8 @@ CREATE TABLE `vnfc_customization` (
`MODEL_NAME` varchar(200) NOT NULL,
`TOSCA_NODE_TYPE` varchar(200) NOT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
+ `VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID` integer DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -1455,7 +1462,10 @@ CREATE TABLE `infra_active_requests` (
`CONFIGURATION_NAME` varchar(200) DEFAULT NULL,
`OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL,
`OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL,
- `REQUEST_URL` varchar(500) DEFAULT NULL,
+ `REQUEST_URL` varchar(500) DEFAULT NULL,
+ `ORIGINAL_REQUEST_ID` varchar(45) DEFAULT NULL,
+ `EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
+ `ROLLBACK_EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
PRIMARY KEY (`REQUEST_ID`),
UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d5ak` (`CLIENT_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 b98e395228..f14e3dcc42 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.HttpClientFactory
import org.onap.so.logger.ErrorCode
@@ -134,13 +135,13 @@ class AaiUtil {
}
logger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId)
}else{
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Call AAI Cloud Region is NOT Successful.", "BPMN",
ErrorCode.UnknownError.getValue());
throw new BpmnError("MSOWorkflowException")
}
}catch(Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception occured while getting the Cloud Reqion.", "BPMN",
ErrorCode.UnknownError.getValue(), e.getMessage());
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
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 4670b11b71..976ad1466d 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
@@ -45,6 +45,20 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
public MsoUtils utils = new MsoUtils()
/**
+ * 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) {
+ logger.error(message);
+ } else {
+ logger.error('{}: {}', message, workflowException)
+ }
+ }
+
+ /**
* Saves the WorkflowException in the execution to the specified variable,
* clearing the WorkflowException variable so the workflow can continue
* processing (perhaps catching another WorkflowException).
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 e0e85e9629..4df38edcc3 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.logger.ErrorCode
@@ -195,7 +196,7 @@ class AllottedResourceUtils {
AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build())
getAAIClient().update(uri,allottedResource)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in updateAR.", "BPMN", ErrorCode.UnknownError.getValue(), e.getMessage());
exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage())
}
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 4a59b9789a..c843cc35fe 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.json.JsonUtils
@@ -120,7 +121,7 @@ public class AppCClient extends AbstractServiceTaskProcessor{
appcMessage = client.getErrorMessage()
}
catch (BpmnError e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
appcMessage = e.getMessage()
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 d5b0b31a39..2bf7298584 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONArray
@@ -80,7 +81,7 @@ class CatalogDbUtils {
}
catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in Querying Catalog DB", "BPMN",
ErrorCode.UnknownError.getValue(), e.message);
throw e
@@ -118,7 +119,7 @@ class CatalogDbUtils {
return getResponseFromCatalogDb(execution, endPoint)
}
catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in Querying Catalog DB", "BPMN",
ErrorCode.UnknownError.getValue(), e.message);
throw e
@@ -142,7 +143,7 @@ class CatalogDbUtils {
}
catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in Querying Catalog DB", "BPMN",
ErrorCode.UnknownError.getValue(), e.message);
throw e
@@ -168,7 +169,7 @@ class CatalogDbUtils {
}
catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in Querying Catalog DB", "BPMN",
ErrorCode.UnknownError.getValue(), e.message);
throw e
@@ -218,7 +219,7 @@ class CatalogDbUtils {
logger.debug("Returning networks JSON: " + modelInfosString)
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in parsing Catalog DB Response", "BPMN",
ErrorCode.UnknownError.getValue(), e.message);
}
@@ -297,7 +298,7 @@ class CatalogDbUtils {
logger.debug("Returning vnfs JSON: " + modelInfosString)
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in parsing Catalog DB Response", "BPMN",
ErrorCode.UnknownError.getValue(), e.message);
}
@@ -351,7 +352,7 @@ class CatalogDbUtils {
logger.debug("Returning allottedResources JSON: " + modelInfosString)
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in parsing Catalog DB Response", "BPMN",
ErrorCode.UnknownError.getValue(), e.message);
}
@@ -380,7 +381,7 @@ class CatalogDbUtils {
logger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString())
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception in parsing Catalog DB Response", "BPMN",
ErrorCode.UnknownError.getValue(), e.message);
}
@@ -428,7 +429,7 @@ class CatalogDbUtils {
modelJson.put("modelInfo", modelInfo)
}
catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception while parsing model information", "BPMN",
ErrorCode.UnknownError.getValue(), e.message);
}
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 a9e01c7191..7e1280729c 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.logger.ErrorCode
@@ -74,7 +75,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
@@ -236,7 +237,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
@@ -269,7 +270,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
logger.debug("Rethrowing MSOWorkflowException")
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
@@ -307,7 +308,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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 6a82512d88..b666c8d19d 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
@@ -24,70 +24,67 @@
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
-
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.VolumeGroup
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
+import org.onap.so.logger.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import org.springframework.http.HttpStatus
+import joptsimple.internal.Strings
public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
private static final Logger logger = LoggerFactory.getLogger( ConfirmVolumeGroupName.class);
- def static final Prefix = "CVGN_"
- private final ExceptionUtil exceptionUtil
-
- ConfirmVolumeGroupName(ExceptionUtil exceptionUtil) {
- this.exceptionUtil = exceptionUtil
- }
-
- public void initProcessVariables(DelegateExecution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("CVGN_volumeGroupId",null)
- execution.setVariable("CVGN_volumeGroupName",null)
- execution.setVariable("CVGN_aicCloudRegion", null)
- execution.setVariable("CVGN_volumeGroupGetEndpoint",null)
-
- // ConfirmVolumeGroupName workflow response variable placeholders
- execution.setVariable("CVGN_volumeGroupNameMatches", false)
- execution.setVariable("CVGN_queryVolumeGroupResponseCode",null)
- execution.setVariable("CVGN_queryVolumeGroupResponse","")
- execution.setVariable("CVGN_ResponseCode",null)
- execution.setVariable("RollbackData", null)
- }
-
- // store the incoming data in the flow DelegateExecution
- public void preProcessRequest(DelegateExecution execution) {
- def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId")
- def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName")
- def aicCloudRegion = execution.getVariable("ConfirmVolumeGroupName_aicCloudRegion")
-
- initProcessVariables(execution)
- execution.setVariable("CVGN_volumeGroupId", volumeGroupId)
- execution.setVariable("CVGN_volumeGroupName", volumeGroupName)
- execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion)
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
- execution.setVariable("CVGN_volumeGroupGetEndpoint", uri)
- }
-
- // send a GET request to AA&I to retrieve the Volume information based on volume-group-id
- // expect a 200 response with the information in the response body or a 404 if the volume group id does not exist
- public void queryAAIForVolumeGroupId(DelegateExecution execution) {
- AAIResourceUri resourceUri = execution.getVariable("CVGN_volumeGroupGetEndpoint")
-
- try {
- Optional<VolumeGroup> volumeGroupOp = getAAIClient().get(VolumeGroup.class, resourceUri)
+ def static final Prefix = "CVGN_"
+ private final ExceptionUtil exceptionUtil
+
+ ConfirmVolumeGroupName(ExceptionUtil exceptionUtil) {
+ this.exceptionUtil = exceptionUtil
+ }
+
+ public void initProcessVariables(DelegateExecution execution) {
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("CVGN_volumeGroupId",null)
+ execution.setVariable("CVGN_volumeGroupName",null)
+ execution.setVariable("CVGN_aicCloudRegion", null)
+ execution.setVariable("CVGN_volumeGroupGetEndpoint",null)
+
+ // ConfirmVolumeGroupName workflow response variable placeholders
+ execution.setVariable("CVGN_volumeGroupNameMatches", false)
+ execution.setVariable("CVGN_queryVolumeGroupResponseCode",null)
+ execution.setVariable("CVGN_queryVolumeGroupResponse","")
+ execution.setVariable("CVGN_ResponseCode",null)
+ execution.setVariable("RollbackData", null)
+ }
+
+ // store the incoming data in the flow DelegateExecution
+ public void preProcessRequest(DelegateExecution execution) {
+ def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId")
+ def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName")
+ def aicCloudRegion = execution.getVariable("ConfirmVolumeGroupName_aicCloudRegion")
+
+ initProcessVariables(execution)
+ execution.setVariable("CVGN_volumeGroupId", volumeGroupId)
+ execution.setVariable("CVGN_volumeGroupName", volumeGroupName)
+ execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+ execution.setVariable("CVGN_volumeGroupGetEndpoint", uri)
+ }
+
+ // send a GET request to AA&I to retrieve the Volume information based on volume-group-id
+ // expect a 200 response with the information in the response body or a 404 if the volume group id does not exist
+ public void queryAAIForVolumeGroupId(DelegateExecution execution) {
+ AAIResourceUri resourceUri = execution.getVariable("CVGN_volumeGroupGetEndpoint")
+
+ try {
+ Optional<VolumeGroup> volumeGroupOp = getAAIClient().get(VolumeGroup.class, resourceUri)
if(volumeGroupOp.isPresent()){
execution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.OK.value())
execution.setVariable("CVGN_queryVolumeGroupResponse", volumeGroupOp.get())
@@ -95,60 +92,60 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
execution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.NOT_FOUND.value())
execution.setVariable("CVGN_queryVolumeGroupResponse", "Volume Group not Found!")
}
- } catch (Exception ex) {
- logger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
- execution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.INTERNAL_SERVER_ERROR.value())
- execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage())
- exceptionUtil.buildAndThrowWorkflowException(execution, HttpStatus.INTERNAL_SERVER_ERROR.value(), "AAI GET Failed")
- }
- }
+ } catch (Exception ex) {
+ logger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
+ execution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.INTERNAL_SERVER_ERROR.value())
+ execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage())
+ exceptionUtil.buildAndThrowWorkflowException(execution, HttpStatus.INTERNAL_SERVER_ERROR.value(), "AAI GET Failed")
+ }
+ }
- // process the result from queryAAIVolumeGroupId()
+ // process the result from queryAAIVolumeGroupId()
- public void checkAAIQueryResult(DelegateExecution execution) {
+ public void checkAAIQueryResult(DelegateExecution execution) {
def actualVolumeGroupName = ""
if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == HttpStatus.NOT_FOUND.value()) {
- logger.debug('volumeGroupId does not exist in AAI')
- }
- else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == HttpStatus.OK.value()) {
+ logger.debug('volumeGroupId does not exist in AAI')
+ }
+ else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == HttpStatus.OK.value()) {
VolumeGroup volumeGroup = execution.getVariable("CVGN_queryVolumeGroupResponse")
if (!Strings.isNullOrEmpty(volumeGroup.getVolumeGroupName())) {
actualVolumeGroupName = volumeGroup.getVolumeGroupName()
- logger.debug("volumeGroupId exists in AAI")
- }
- }
- execution.setVariable("CVGN_volumeGroupNameMatches", false)
- def volumeGroupName = execution.getVariable("CVGN_volumeGroupName")
-
- if (!actualVolumeGroupName.isEmpty() && volumeGroupName.equals(actualVolumeGroupName)) {
- logger.debug('Volume Group Name Matches AAI records')
- execution.setVariable("CVGN_volumeGroupNameMatches", true)
- }
- }
-
-
- // generates a WorkflowException if the A&AI query returns a response code other than 200/404
- 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", ErrorCode.UnknownError.getValue(),
- "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse"));
- }
-
- // generates a WorkflowException if the volume group name does not match AAI record for this volume group
- public void handleVolumeGroupNameNoMatch(DelegateExecution execution) {
- 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",
- ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated)
- }
-
- // sends a successful WorkflowResponse
- public void reportSuccess(DelegateExecution execution) {
- logger.debug("Sending 200 back to the caller")
- def responseXML = ""
- execution.setVariable("WorkflowResponse", responseXML)
- }
+ logger.debug("volumeGroupId exists in AAI")
+ }
+ }
+ execution.setVariable("CVGN_volumeGroupNameMatches", false)
+ def volumeGroupName = execution.getVariable("CVGN_volumeGroupName")
+
+ if (!actualVolumeGroupName.isEmpty() && volumeGroupName.equals(actualVolumeGroupName)) {
+ logger.debug('Volume Group Name Matches AAI records')
+ execution.setVariable("CVGN_volumeGroupNameMatches", true)
+ }
+ }
+
+
+ // generates a WorkflowException if the A&AI query returns a response code other than 200/404
+ public void handleAAIQueryFailure(DelegateExecution execution) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"),
+ "BPMN", ErrorCode.UnknownError.getValue(),
+ "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse"));
+ }
+
+ // generates a WorkflowException if the volume group name does not match AAI record for this volume group
+ public void handleVolumeGroupNameNoMatch(DelegateExecution execution) {
+ def errorNotAssociated = "Error occurred - volume group id ${execution.getVariable('CVGN_volumeGroupId')} " +
+ "is not associated with ${execution.getVariable('CVGN_volumeGroupName')}"
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN",
+ ErrorCode.UnknownError.getValue());
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated)
+ }
+
+ // sends a successful WorkflowResponse
+ public void reportSuccess(DelegateExecution execution) {
+ logger.debug("Sending 200 back to the caller")
+ def responseXML = ""
+ execution.setVariable("WorkflowResponse", responseXML)
+ }
}
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 7c1c0a0490..569d4b75b9 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.VolumeGroup
@@ -105,7 +106,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
}catch(BpmnError b){
throw b
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing queryAAIForVolumeGroup.", "BPMN",
ErrorCode.UnknownError.getValue(), e.getMessage());
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.")
@@ -127,7 +128,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
logger.debug("Volume Heat Stack Id is: " + heatStackId)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing assignVolumeHeatId.", "BPMN",
ErrorCode.UnknownError.getValue(), e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.")
@@ -147,7 +148,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing assignWorkflowException.", "BPMN",
ErrorCode.UnknownError.getValue(), e);
}
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 e9e7d1ed7c..163e914238 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.apache.commons.lang.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
@@ -423,7 +424,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// generates a WorkflowException when the A&AI query returns a response code other than 200 or 404
public void handleAAIQueryFailure(DelegateExecution execution) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, 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", ErrorCode.UnknownError.getValue());
int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode")
@@ -475,7 +476,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
errorCode = 2000
}
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error occurred during CreateAAIVfModule flow", "BPMN",
ErrorCode.UnknownError.getValue(), errorResponse);
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
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 4bce23eff7..4d57b1b26f 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
@@ -21,6 +21,8 @@
*/
package org.onap.so.bpmn.common.scripts
+
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
import org.onap.so.client.aai.AAIObjectType
@@ -204,7 +206,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// generates a WorkflowException if the A&AI query returns a response code other than 200
public void handleAAIQueryFailure(DelegateExecution execution) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, 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", ErrorCode.UnknownError.getValue());
def errorCode = 5000
@@ -251,7 +253,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
}
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error occurred during DeleteAAIVfModule flow", "BPMN",
ErrorCode.UnknownError.getValue(), errorResponse);
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
@@ -261,7 +263,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// generates a WorkflowException if
// - the A&AI Generic Vnf DELETE returns a response code other than 200
public void handleDeleteGenericVnfFailure(DelegateExecution execution) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI error occurred deleting the Generic Vnf", "BPMN",
ErrorCode.UnknownError.getValue(),
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 30dbeb09d5..c23150384e 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,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
@@ -33,6 +34,7 @@ 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.utils.TargetEntities
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -91,7 +93,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
buildWorkflowException(execution, 5000, modifiedErrorMessage)
wfex = execution.getVariable("WorkflowException")
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
ErrorCode.UnknownError.getValue(), wfex.errorMessage);
return wfex
} else {
@@ -104,7 +106,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
logger.debug("mappedErrorMessage " + mappedErrorMessage)
wfex = execution.getVariable("WorkflowException")
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
ErrorCode.UnknownError.getValue(), wfex.errorMessage);
return wfex
} catch(Exception ex) {
@@ -282,6 +284,16 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
execution.setVariable("WorkflowException", exception);
logger.debug("Outgoing WorkflowException is " + exception)
}
+
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, TargetEntities extSystemErrorSource) {
+ MsoUtils utils = new MsoUtils()
+ String processKey = getProcessKey(execution);
+ logger.debug("Building a WorkflowException for " + processKey)
+
+ WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage, extSystemErrorSource);
+ execution.setVariable("WorkflowException", exception);
+ logger.debug("Outgoing WorkflowException is " + exception)
+ }
/**
* This error handling method builds a WorkflowException Object and throws a
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
index 64567a349e..5525c2642b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -40,11 +40,11 @@ class ExternalAPIUtil {
String Prefix="EXTAPI_"
- private static final Logger logger = LoggerFactory.getLogger( ExternalAPIUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger( ExternalAPIUtil.class)
- private final HttpClientFactory httpClientFactory;
- private final MsoUtils utils;
- private final ExceptionUtil exceptionUtil;
+ private final HttpClientFactory httpClientFactory
+ private final MsoUtils utils
+ private final ExceptionUtil exceptionUtil
public static final String PostServiceOrderRequestsTemplate =
"{\n" +
@@ -107,22 +107,22 @@ class ExternalAPIUtil {
// }
public String setTemplate(String template, Map<String, String> valueMap) {
- logger.debug("ExternalAPIUtil setTemplate", true);
- StringBuffer result = new StringBuffer();
+ logger.debug("ExternalAPIUtil setTemplate", true)
+ StringBuffer result = new StringBuffer()
- String pattern = "<.*>";
- Pattern r = Pattern.compile(pattern);
- Matcher m = r.matcher(template);
+ String pattern = "<.*>"
+ Pattern r = Pattern.compile(pattern)
+ Matcher m = r.matcher(template)
- logger.debug("ExternalAPIUtil template:" + template, true);
+ logger.debug("ExternalAPIUtil template:" + template, true)
while (m.find()) {
- String key = template.substring(m.start() + 1, m.end() - 1);
- logger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true);
- m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\""));
+ String key = template.substring(m.start() + 1, m.end() - 1)
+ logger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true)
+ m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\""))
}
- m.appendTail(result);
- logger.debug("ExternalAPIUtil return:" + result.toString(), true);
- return result.toString();
+ m.appendTail(result)
+ logger.debug("ExternalAPIUtil return:" + result.toString(), true)
+ return result.toString()
}
/**
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy
index e7f46464ee..549267eec1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilFactory.groovy
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Nokia.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
index 2ceec3cb44..ed849755b7 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.ErrorCode
@@ -97,7 +98,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
execution.setVariable("FH_ResponseCode", "")
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
@@ -210,7 +211,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
execution.setVariable("FH_content_type", "text/xml")
}
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
@@ -244,7 +245,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
execution.setVariable("FH_updateRequestPayload", payload)
return execution.getVariable("FH_updateRequestPayload")
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
@@ -275,7 +276,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
logger.debug("updateRequestInfraPayload: " + payload)
return execution.getVariable("FH_updateRequestInfraPayload")
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
@@ -306,7 +307,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
logger.debug("updateRequestGammaPayload: " + payload)
return execution.getVariable("FH_updateRequestGammaPayload")
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
@@ -335,7 +336,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
logger.debug("updateResponseStatusPayload: " + payload)
return execution.getVariable("FH_updateResponseStatusPayload")
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
@@ -355,7 +356,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
def errorCode = responseCode == null ? 7000 : 7020
// exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
// exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
@@ -390,7 +391,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse)
} catch (Exception e) {
// Do NOT throw WorkflowException!
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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 f008130c32..3008f77b62 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.client.HttpClientFactory
import org.onap.so.logger.ErrorCode
@@ -158,7 +159,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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 27fe33f5ea..ef4291d18f 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode;
import static org.apache.commons.lang3.StringUtils.*;
@@ -289,7 +290,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
} catch (Exception ex){
msg = "Exception in createAOTSTicket " + ex.getMessage()
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
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 f371ccef4d..a2f5dfbffe 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,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode
import java.text.SimpleDateFormat
@@ -294,10 +295,10 @@ class MsoUtils {
if ("INFO"==logmode) {
logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN");
} else if ("WARN"==logmode) {
- logger.warn ("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN",
+ logger.warn (LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN",
ErrorCode.UnknownError.getValue(), logtxt);
} else if ("ERROR"==logmode) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN",
ErrorCode.UnknownError.getValue(), logtxt);
} else {
logger.debug(logtxt);
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 a0da6870ae..39e6db4d3f 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
@@ -20,8 +20,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.scripts;
+package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor;
import groovy.json.*
import org.apache.commons.lang3.*
@@ -66,7 +67,7 @@ public void preProcessRequest (DelegateExecution execution) {
if ((timeout == null) || (timeout.isEmpty())) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\''
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -77,7 +78,7 @@ public void preProcessRequest (DelegateExecution execution) {
if ((messageType == null) || (messageType.isEmpty())) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\''
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -88,7 +89,7 @@ public void preProcessRequest (DelegateExecution execution) {
if ((correlator == null) || (correlator.isEmpty())) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\''
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -100,7 +101,7 @@ public void preProcessRequest (DelegateExecution execution) {
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
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 a7bb707dff..db39358ccd 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -20,9 +20,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.scripts;
+package org.onap.so.bpmn.common.scripts
+
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.ErrorCode
import java.text.SimpleDateFormat
@@ -37,7 +39,7 @@ import static org.apache.commons.lang3.StringUtils.*
// SDNC Adapter Request/Response processing
public class SDNCAdapter extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( SDNCAdapter.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapter.class)
def Prefix="SDNCA_"
@@ -73,9 +75,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable("BasicAuthHeaderValue",encodedString)
} catch (IOException ex) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Unable to encode username password string", "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
}
// TODO Use variables instead of passing xml request - Huh?
@@ -236,9 +238,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest")
logger.debug("sdncAdapterCallbackRequest :" + sdnccallbackreq)
if (sdnccallbackreq==null){
- execution.setVariable("callbackResponseReceived",false);
+ execution.setVariable("callbackResponseReceived",false)
}else{
- execution.setVariable("callbackResponseReceived",true);
+ execution.setVariable("callbackResponseReceived",true)
}
}
@@ -301,10 +303,10 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
}
public String generateCurrentTimeInUtc(){
- final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
- final String utcTime = sdf.format(new Date());
- return utcTime;
+ final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"))
+ final String utcTime = sdf.format(new Date())
+ return utcTime
}
public void toggleSuccessIndicator(DelegateExecution execution){
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index fdd53b2f05..c30d807bf3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.HttpClientFactory
import org.onap.so.logger.ErrorCode
@@ -52,7 +53,7 @@ import org.onap.so.utils.TargetEntity
class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV1.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -86,8 +87,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
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",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -107,8 +108,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (sdncRequestId == null || sdncRequestId.isEmpty()) {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -122,8 +123,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -139,8 +140,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -154,18 +155,18 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
} catch (IOException ex) {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", ErrorCode.UnknownError.getValue(), ex);
+ "BPMN", ErrorCode.UnknownError.getValue(), ex)
}
}
@@ -175,7 +176,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout")
// in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
- String timerRegex = "PT[0-9]+[HMS]";
+ String timerRegex = "PT[0-9]+[HMS]"
if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
@@ -195,8 +196,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -220,7 +221,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest')
logger.debug("SDNC Rest Request is: " + sdncAdapterRequest)
- URL url = new URL(sdncAdapterUrl);
+ URL url = new URL(sdncAdapterUrl)
HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER)
httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
@@ -243,8 +244,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} else {
String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -257,8 +258,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg, e)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -329,7 +330,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
}
// Note: the mapping function handles a null or empty responseCode
- int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode));
+ int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode))
exceptionUtil.buildWorkflowException(execution, mappedResponseCode, "Received " + responseType +
" from SDNCAdapter:" + info)
} catch (Exception e) {
@@ -368,8 +369,8 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -394,13 +395,13 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
public Logger getLogger() {
- return logger;
+ return logger
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
index e56091ad65..ba5145d19b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode
import java.text.SimpleDateFormat
@@ -50,7 +51,7 @@ import org.slf4j.LoggerFactory
* any non-final response received from SDNC.
*/
class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
- private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV2.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV2.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -85,8 +86,8 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
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",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -106,8 +107,8 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (sdncRequestId == null || sdncRequestId.isEmpty()) {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -121,8 +122,8 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -132,8 +133,8 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -150,18 +151,18 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
- ErrorCode.UnknownError.getValue());
+ ErrorCode.UnknownError.getValue())
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
} catch (IOException ex) {
logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
- "BPMN", ErrorCode.UnknownError.getValue(), ex);
+ "BPMN", ErrorCode.UnknownError.getValue(), ex)
}
}
@@ -171,7 +172,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout")
// in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
- String timerRegex = "PT[0-9]+[HMS]";
+ String timerRegex = "PT[0-9]+[HMS]"
if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
@@ -191,8 +192,8 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
logger.debug(msg)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
- ErrorCode.UnknownError.getValue());
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue())
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -296,6 +297,6 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
}
public Logger getLogger() {
- return logger;
+ return logger
}
}
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 eb832224db..f24eda813d 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
@@ -20,8 +20,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.scripts;
+package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.L3Network
@@ -257,7 +258,7 @@ class SDNCAdapterUtils {
def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
if (callbackUrl == null || callbackUrl.trim() == "") {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'mso:workflow:sdncadapter:callback URN is not set', "BPMN",
ErrorCode.UnknownError.getValue());
workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
@@ -395,7 +396,7 @@ class SDNCAdapterUtils {
def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
if (callbackUrl == null || callbackUrl.trim() == "") {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'mso:workflow:sdncadapter:callback URN is not set', "BPMN",
ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
@@ -468,7 +469,7 @@ class SDNCAdapterUtils {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error")
@@ -973,7 +974,7 @@ class SDNCAdapterUtils {
}
}else {
- logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING,
+ logger.warn(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_WARNING,
'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ',
"BPMN", ErrorCode.UnknownError,
'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ')
@@ -983,7 +984,7 @@ class SDNCAdapterUtils {
}
if (response == null || response.trim().equals("")) {
- logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING,
+ logger.warn(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_WARNING,
'sdncAdapter workflow response is empty', "BPMN",
ErrorCode.UnknownError, 'sdncAdapter workflow response is empty')
execution.setVariable("L3HLAB_rollback", true)
@@ -996,7 +997,7 @@ class SDNCAdapterUtils {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught ' +
'exception in ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable(prefix+"ResponseCode",400)
execution.setVariable("L3HLAB_rollback", true)
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 615c977a1e..30964aa4ec 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
import org.onap.so.logger.ErrorCode
@@ -215,7 +216,7 @@ class TrinityExceptionUtil {
if(message != null) {
execution.setVariable(prefix+"ErrorResponse",message)
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
ErrorCode.UnknownError.getValue(),
execution.getVariable(prefix+"ErrorResponse"));
return message
@@ -311,7 +312,7 @@ class TrinityExceptionUtil {
execution.setVariable(prefix+"err", myErr)
execution.setVariable(prefix+"errTxt", messageTxt)
execution.setVariable(prefix+"errVariables", msgVars)
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
ErrorCode.UnknownError.getValue(),
execution.getVariable(prefix+"ErrorResponse"));
return message
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 ebab6ad0ac..8f409fa13e 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
@@ -182,7 +183,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
if (newPersonaModelId != null || newPersonaModelVersion != null) {
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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue())
throw new Exception(msg)
}
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 e261fb9fdd..20aeb11c5f 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode;
import javax.xml.parsers.DocumentBuilder
@@ -110,7 +111,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
}
}
} catch (Exception e) {
- logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ logger.warn(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_WARNING.toString(),
'Exception transforming network params to vnfNetworks', "BPMN",
ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e);
}
@@ -149,7 +150,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
entries = entries + entry
}
} catch (Exception e) {
- logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ logger.warn(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_WARNING.toString(),
'Exception transforming params to entries', "BPMN",
ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
}
@@ -195,7 +196,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
}
}
} catch (Exception e) {
- logger.warn("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ logger.warn(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_WARNING.toString(),
'Exception transforming params to entries', "BPMN",
ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
}
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 9215eabc57..866229f6b8 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.HttpClientFactory
import org.onap.so.logger.ErrorCode
@@ -39,7 +40,6 @@ import java.util.UUID
-
class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger( VnfAdapterRestV1.class);
@@ -78,9 +78,9 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
execution.setVariable('VNFAResponse_CORRELATOR', messageId)
@@ -92,9 +92,9 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
execution.setVariable(prefix + 'notificationUrl', notificationUrl)
@@ -106,9 +106,9 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
while (vnfAdapterEndpoint.endsWith('/')) {
@@ -124,9 +124,9 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'POST'
@@ -137,18 +137,18 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'PUT'
@@ -160,18 +160,18 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -183,27 +183,27 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -222,9 +222,9 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'PUT'
@@ -238,9 +238,9 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -254,9 +254,9 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -267,9 +267,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
@@ -284,7 +284,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
ErrorCode.UnknownError.getValue());
} else {
@@ -292,7 +292,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
} catch (IOException ex) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
"BPMN", ErrorCode.UnknownError.getValue(), ex);
}
@@ -303,10 +303,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
}
@@ -355,9 +355,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
response = httpClient.delete(vnfAdapterRequest)
} else {
String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
@@ -368,9 +368,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
}
}
@@ -399,7 +399,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
}
} catch (Exception e) {
logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", TargetEntity.SO)
}
}
@@ -418,10 +418,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String rolledBack = getChildText(root, "rolledBack")
rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
- " from VnfAdapter:" + category + message + rolledBack);
+ " from VnfAdapter:" + category + message + rolledBack, TargetEntity.OPENSTACK);
} catch (Exception e) {
response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
- exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response)
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, TargetEntity.OPENSTACK)
}
}
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 c947bf2e65..6cfa2a1a64 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.WorkflowException
@@ -86,7 +87,7 @@ class VnfAdapterUtils {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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/BBConstants.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BBConstants.java
new file mode 100644
index 0000000000..49ccc7b4a8
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BBConstants.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+public class BBConstants {
+ public static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow";
+ public static final String G_ACTION = "requestAction";
+ public static final String G_CURRENT_SEQUENCE = "gCurrentSequence";
+ public static final String G_REQUEST_ID = "mso-request-id";
+ public static final String G_BPMN_REQUEST = "bpmnRequest";
+ public static final String G_ALACARTE = "aLaCarte";
+ public static final String G_APIVERSION = "apiVersion";
+ public static final String G_URI = "requestUri";
+ public static final String G_ISTOPLEVELFLOW = "isTopLevelFlow";
+ public static final String G_SERVICE_TYPE = "serviceType";
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java
index c087d586e7..248f3b5f1a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/BuildingBlockExecution.java
@@ -9,7 +9,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in 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,4 +39,6 @@ public interface BuildingBlockExecution {
public Map<ResourceKey, String> getLookupMap();
public String getFlowToBeCalled();
+
+ public int getCurrentSequence();
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java
index 31fef7c6f7..9aed5e9408 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/DelegateExecutionImpl.java
@@ -113,8 +113,9 @@ public class DelegateExecutionImpl implements BuildingBlockExecution, Serializab
}
@JsonIgnore
- public DelegateExecution getDelegateExecution() {
- return this.execution;
+ @Override
+ public int getCurrentSequence() {
+ return this.get("gCurrentSequence");
}
public void setDelegateExecution(final DelegateExecution execution) {
@@ -126,6 +127,11 @@ public class DelegateExecutionImpl implements BuildingBlockExecution, Serializab
});
}
+ @JsonIgnore
+ public DelegateExecution getDelegateExecution() {
+ return this.execution;
+ }
+
@SuppressWarnings("unchecked")
protected <T> T get(final String key) {
final Object value = this.execution.getVariable(key);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/PostCompletionRequestsDbListener.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/PostCompletionRequestsDbListener.java
new file mode 100644
index 0000000000..f888e5333a
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/PostCompletionRequestsDbListener.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.listener.db;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+
+public interface PostCompletionRequestsDbListener {
+
+ public boolean shouldRunFor(BuildingBlockExecution execution);
+
+ public void run(InfraActiveRequests request, BuildingBlockExecution execution);
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java
new file mode 100644
index 0000000000..69151ff74f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/db/RequestsDbListenerRunner.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.listener.db;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import javax.annotation.PostConstruct;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.listener.ListenerRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RequestsDbListenerRunner extends ListenerRunner {
+
+
+ private static Logger logger = LoggerFactory.getLogger(FlowManipulatorListenerRunner.class);
+
+ protected List<PostCompletionRequestsDbListener> postListeners;
+
+ @PostConstruct
+ protected void init() {
+
+ postListeners =
+ new ArrayList<>(Optional.ofNullable(context.getBeansOfType(PostCompletionRequestsDbListener.class))
+ .orElse(new HashMap<>()).values());
+
+ }
+
+ public void post(InfraActiveRequests request, BuildingBlockExecution execution) {
+
+ List<PostCompletionRequestsDbListener> filtered =
+ filterListeners(postListeners, (item -> item.shouldRunFor(execution)));
+
+ logger.info("Running post request db listeners:\n{}",
+ filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n")));
+ filtered.forEach(item -> item.run(request, execution));
+
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulator.java
new file mode 100644
index 0000000000..5e2882cb5b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulator.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.listener.flowmanipulator;
+
+import java.util.List;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+
+public interface FlowManipulator {
+
+ public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution);
+
+ public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
+ BuildingBlockExecution execution);
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
new file mode 100644
index 0000000000..ea7de687ee
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.listener.flowmanipulator;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import javax.annotation.PostConstruct;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.listener.ListenerRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class FlowManipulatorListenerRunner extends ListenerRunner {
+
+ private static Logger logger = LoggerFactory.getLogger(FlowManipulatorListenerRunner.class);
+
+ protected List<FlowManipulator> flowManipulators;
+
+ @PostConstruct
+ protected void init() {
+
+ flowManipulators = new ArrayList<>(
+ Optional.ofNullable(context.getBeansOfType(FlowManipulator.class)).orElse(new HashMap<>()).values());
+
+ }
+
+ public void modifyFlows(List<ExecuteBuildingBlock> flowsToExecute, BuildingBlockExecution execution) {
+
+ ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
+ List<FlowManipulator> filtered = filterListeners(flowManipulators,
+ (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
+ execution.getCurrentSequence() == 0, execution)));
+
+ logger.info("Running flow manipulators:\n{}",
+ filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n")));
+ filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution));
+
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/BuildingBlockValidatorRunner.java
index a8e43c51e5..78d897fd87 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/BuildingBlockValidatorRunner.java
@@ -18,26 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
-import java.lang.annotation.Annotation;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
-import javax.annotation.Priority;
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.javatuples.Pair;
-import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.client.exception.ExceptionBuilder;
-import org.reflections.Reflections;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@@ -45,9 +32,9 @@ import org.springframework.stereotype.Component;
* Controls running all pre and post validation for building blocks.
*
* To define a validation you must make it a spring bean and implement either
- * {@link org.onap.so.bpmn.common.validation.PreBuildingBlockValidator} or
- * {@link org.onap.so.bpmn.common.validation.PostBuildingBlockValidator} your validation will automatically be run by
- * this class.
+ * {@link org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator} or
+ * {@link org.onap.so.bpmn.common.listener.validation.PostBuildingBlockValidator} your validation will automatically be
+ * run by this class.
*
*/
@Component
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidator.java
index 66a8de9f8b..657e1d9539 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/FlowValidator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/FlowValidator.java
@@ -18,10 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
import java.util.Optional;
-import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
public interface FlowValidator {
@@ -30,6 +29,7 @@ public interface FlowValidator {
* Should this validator run for given bb
*
* @return
+ *
*/
public boolean shouldRunFor(String bbName);
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/listener/validation/FlowValidatorRunner.java
index 0bdf4e35a2..02cddf3655 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/listener/validation/FlowValidatorRunner.java
@@ -18,25 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
-import java.lang.annotation.Annotation;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
-import javax.annotation.Priority;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.client.exception.ExceptionBuilder;
-import org.reflections.Reflections;
+import org.onap.so.listener.ListenerRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@@ -49,11 +45,9 @@ import org.springframework.stereotype.Component;
*
*/
@Component
-public abstract class FlowValidatorRunner<S extends FlowValidator, E extends FlowValidator> {
+public abstract class FlowValidatorRunner<S extends FlowValidator, E extends FlowValidator> extends ListenerRunner {
private static Logger logger = LoggerFactory.getLogger(FlowValidatorRunner.class);
- @Autowired
- protected ApplicationContext context;
@Autowired
protected ExceptionBuilder exceptionBuilder;
@@ -114,7 +108,7 @@ public abstract class FlowValidatorRunner<S extends FlowValidator, E extends Flo
protected List<Pair<String, Optional<String>>> runValidations(List<? extends FlowValidator> validators,
String bbName, BuildingBlockExecution execution) {
- List<FlowValidator> filtered = filterValidators(validators, bbName);
+ List<? extends FlowValidator> filtered = filterListeners(validators, (item -> item.shouldRunFor(bbName)));
List<Pair<String, Optional<String>>> results = new ArrayList<>();
filtered.forEach(item -> results.add(new Pair<>(item.getClass().getName(), item.validate(execution))));
@@ -122,38 +116,6 @@ public abstract class FlowValidatorRunner<S extends FlowValidator, E extends Flo
return results.stream().filter(item -> item.getValue1().isPresent()).collect(Collectors.toList());
}
- protected List<FlowValidator> filterValidators(List<? extends FlowValidator> validators, String bbName) {
- return validators.stream().filter(item -> {
- return !item.getClass().isAnnotationPresent(Skip.class) && item.shouldRunFor(bbName);
- }).sorted(Comparator.comparing(item -> {
- Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() {
- public int value() {
- return 1000;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return Priority.class;
- }
- });
- return p.value();
- })).collect(Collectors.toList());
- }
-
- protected <T> List<T> buildalidatorList(Reflections reflections, Class<T> clazz) {
- List<T> result = new ArrayList<>();
- try {
- for (Class<? extends T> klass : reflections.getSubTypesOf(clazz)) {
- result.add(klass.newInstance());
- }
- } catch (InstantiationException | IllegalAccessException e) {
- logger.error("failed to build validator list for {}", clazz.getName(), e);
- throw new RuntimeException(e);
- }
-
- return result;
- }
-
protected abstract List<S> getPreFlowValidators();
protected abstract List<E> getPostFlowValidators();
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PostBuildingBlockValidator.java
index f26a2ee479..75dc75de43 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PostBuildingBlockValidator.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
public interface PostBuildingBlockValidator extends FlowValidator {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostWorkflowValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PostWorkflowValidator.java
index 9070615a7a..7d5f68a482 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostWorkflowValidator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PostWorkflowValidator.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
public interface PostWorkflowValidator extends FlowValidator {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PreBuildingBlockValidator.java
index fda687e072..fda2d264d8 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PreBuildingBlockValidator.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
public interface PreBuildingBlockValidator extends FlowValidator {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreWorkflowValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PreWorkflowValidator.java
index 0bfbf5602f..a8e8642058 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreWorkflowValidator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/PreWorkflowValidator.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
public interface PreWorkflowValidator extends FlowValidator {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowValidatorRunner.java
index 6950618953..c6afa16ec2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowValidatorRunner.java
@@ -18,25 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
-import java.lang.annotation.Annotation;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
-import javax.annotation.Priority;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.javatuples.Pair;
-import org.onap.so.client.exception.ExceptionBuilder;
-import org.reflections.Reflections;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@@ -44,9 +32,9 @@ import org.springframework.stereotype.Component;
* Controls running all pre and post validation for workflows.
*
* To define a validation you must make it a spring bean and implement either
- * {@link org.onap.so.bpmn.common.validation.PreWorkflowValidator} or
- * {@link org.onap.so.bpmn.common.validation.PostWorkflowValidator} your validation will automatically be run by this
- * class.
+ * {@link org.onap.so.bpmn.common.listener.validation.PreWorkflowValidator} or
+ * {@link org.onap.so.bpmn.common.listener.validation.PostWorkflowValidator} your validation will automatically be run
+ * by this class.
*
*/
@Component
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 b9200e0640..c98c9ad5da 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
@@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.recipe;
import java.io.IOException;
import java.security.GeneralSecurityException;
import javax.xml.bind.DatatypeConverter;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
@@ -62,16 +63,12 @@ public class BpmnRestClient {
public static final String CAMUNDA_AUTH = "mso.camundaAuth";
- private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@Autowired
private UrnPropertiesReader urnPropertiesReader;
private static boolean noProperties = true;
- // because for NS it will take a long time the time out of the resouce will be 2 hours.
- private static final String DEFAULT_TIME_OUT = "7200";
-
- public synchronized final boolean getNoPropertiesState() {
+ public final synchronized boolean getNoPropertiesState() {
return noProperties;
}
@@ -93,7 +90,7 @@ public class BpmnRestClient {
*/
public HttpResponse post(String recipeUri, String requestId, int recipeTimeout, String requestAction,
String serviceInstanceId, String serviceType, String requestDetails, String recipeParamXsd)
- throws ClientProtocolException, IOException {
+ throws IOException {
HttpClient client = HttpClientBuilder.create().build();
@@ -163,7 +160,7 @@ public class BpmnRestClient {
BpmnParam recipeParamsInput = new BpmnParam();
BpmnIntegerParam recipeTimeoutInput = new BpmnIntegerParam();
recipeTimeoutInput.setValue(recipeTimeout);
- // host.setValue(parseURL());
+
requestIdInput.setValue(requestId);
requestActionInput.setValue(requestAction);
serviceInstanceIdInput.setValue(serviceInstanceId);
@@ -181,7 +178,7 @@ public class BpmnRestClient {
jsonReq = recipeRequest.toString();
logger.trace("request body is {}", jsonReq);
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java
index 340addcabf..91049a8d0c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java
@@ -85,6 +85,30 @@ public class ResourceInput implements Serializable {
@JsonProperty("operationType")
private String operationType;
+ @JsonProperty("vfModelInfo")
+ private ModelInfo vfModelInfo;
+
+
+ @JsonProperty("vnf-Id")
+ private String vnfId;
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public ModelInfo getVfModelInfo() {
+ return vfModelInfo;
+ }
+
+ public void setVfModelInfo(ModelInfo vfModelInfo) {
+ this.vfModelInfo = vfModelInfo;
+ }
+
+
/**
* @return Returns the requestsInputs.
*/
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
new file mode 100644
index 0000000000..3a4df68f02
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.common.resource;
+
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.so.bpmn.core.domain.GroupResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.VnfResource;
+
+public class InstanceResourceList {
+
+ private InstanceResourceList() {
+ throw new IllegalStateException("Utility class");
+ }
+
+ // this method returns key from resource input
+ // e.g. {\"sdwansite_emails\" : \"[sdwansiteresource_list(PK), INDEX, sdwansite_emails]|default\",
+ // ....}
+ // it will return sdwansiteresource_list
+ private static String getPrimaryKey(Resource resource) {
+ String resourceInput = "";
+ if (resource instanceof VnfResource) {
+ resourceInput = ((VnfResource) resource).getResourceInput();
+ } else if (resource instanceof GroupResource) {
+ resourceInput = ((GroupResource) resource).getVnfcs().get(0).getResourceInput();
+ }
+
+ Gson gson = new Gson();
+ Type type = new TypeToken<Map<String, String>>() {}.getType();
+ Map<String, String> map = gson.fromJson(resourceInput, type);
+
+ if (map != null) {
+ Optional<String> pkOpt = map.values().stream().filter(e -> e.contains("[")).map(e -> e.replace("[", ""))
+ .map(e -> e.split(",")[0]).findFirst();
+
+ return pkOpt.isPresent() ? pkOpt.get() : "";
+ } else {
+ return "";
+ }
+ }
+
+
+ public static List<Resource> getInstanceResourceList(final VnfResource vnfResource, final String uuiRequest) {
+ List<Resource> sequencedResourceList = new ArrayList<>();
+ Gson gson = new Gson();
+ JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class);
+ JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters")
+ .getAsJsonObject("requestInputs");
+
+ String pk = getPrimaryKey(vnfResource);
+ // if pk is not empty that means it can contain list of VNF
+ if (!pk.isEmpty()) {
+ JsonElement vfNode = reqInputJsonObj.get(pk);
+ if (vfNode.isJsonArray()) {
+ // multiple instance of VNF
+ JsonArray vfNodeList = vfNode.getAsJsonArray();
+ for (JsonElement vf : vfNodeList) {
+ JsonObject vfObj = vf.getAsJsonObject();
+
+ // Add VF first before adding groups
+ sequencedResourceList.add(vnfResource);
+ List<Resource> sequencedGroupResourceList = getGroupResourceInstanceList(vnfResource, vfObj);
+ if (!sequencedGroupResourceList.isEmpty()) {
+ sequencedResourceList.addAll(sequencedGroupResourceList);
+ }
+ }
+ }
+ } else {
+ // if pk is empty that means it has only one VNF Node
+ // Add VF first before adding groups
+ sequencedResourceList.add(vnfResource);
+ // check the groups for this VNF and add into resource list
+ List<Resource> sequencedGroupResourceList = getGroupResourceInstanceList(vnfResource, reqInputJsonObj);
+ if (!sequencedGroupResourceList.isEmpty()) {
+ sequencedResourceList.addAll(sequencedGroupResourceList);
+ }
+ }
+
+ // In negative case consider only VNF resource only
+ if (sequencedResourceList.isEmpty()) {
+ sequencedResourceList.add(vnfResource);
+ }
+
+ // check if the resource contains vf-module
+ if (vnfResource != null && vnfResource.getVfModules() != null) {
+ sequencedResourceList.addAll(vnfResource.getVfModules());
+ }
+
+ return sequencedResourceList;
+ }
+
+ private static List<Resource> getGroupResourceInstanceList(VnfResource vnfResource, JsonObject vfObj) {
+ List<Resource> sequencedResourceList = new ArrayList<>();
+ if (vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder())) {
+ String[] grpSequence = vnfResource.getGroupOrder().split(",");
+ for (String grpType : grpSequence) {
+ for (GroupResource gResource : vnfResource.getGroups()) {
+ if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) {
+ // check the number of group instances from UUI to be added
+ String sk = getPrimaryKey(gResource);
+
+ // if sk is empty that means it is not list type
+ // only one group / vnfc to be considered
+ if (sk.isEmpty()) {
+ sequencedResourceList.add(gResource);
+ } else {
+ // check the number of list size of VNFC of a group
+ JsonElement vfcNode = vfObj.get(sk);
+ if (vfcNode.isJsonArray()) {
+ JsonArray vfcList = vfcNode.getAsJsonArray();
+ for (JsonElement vfc : vfcList) {
+ sequencedResourceList.add(gResource);
+ }
+ } else {
+ // consider only one vnfc/group if not an array
+ sequencedResourceList.add(gResource);
+ }
+ }
+
+ }
+ }
+ }
+ }
+ return sequencedResourceList;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java
new file mode 100644
index 0000000000..a3c75dbd41
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java
@@ -0,0 +1,5 @@
+package org.onap.so.bpmn.common.resource;
+
+public enum ResourceLevel {
+ FIRST, SECOND
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 0dbf2c2a75..2c1d36273d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,6 +22,9 @@
package org.onap.so.bpmn.common.resource;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -31,8 +34,13 @@ import java.util.List;
import java.util.Map;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
+import org.apache.commons.lang.StringUtils;
import org.camunda.bpm.engine.runtime.Execution;
import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.bpmn.core.domain.GroupResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ResourceType;
+import org.onap.so.bpmn.core.domain.VnfResource;
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
@@ -47,14 +55,16 @@ import org.slf4j.LoggerFactory;
public class ResourceRequestBuilder {
- private static String CUSTOMIZATION_UUID = "cuserviceResourcesstomizationUUID";
-
private static String SERVICE_URL_SERVICE_INSTANCE = "/v2/serviceResources";
private static Logger logger = LoggerFactory.getLogger(ResourceRequestBuilder.class);
static JsonUtils jsonUtil = new JsonUtils();
+ private ResourceRequestBuilder() {
+ throw new IllegalStateException("Utility class");
+ }
+
public static List<String> getResourceSequence(String serviceUuid) {
List<String> resourceSequence = new ArrayList();
@@ -82,133 +92,290 @@ public class ResourceRequestBuilder {
* "requestInputs":{K,V} } <br>
*
* @param execution Execution context
- *
- * @param serviceUuid The service template uuid
- *
- * @param resourceCustomizationUuid The resource customization uuid
- *
- * @param serviceParameters the service parameters passed from the API
- *
+ *
+ * @param resource The current Service Resource Object
+ *
+ * @param uuiServiceParameters the service parameters passed from the API
+ *
+ * @param currentVFData The object to hold the sequence of execution level for fetching data from UUI inputs
+ *
* @return the resource instantiate parameters
- *
+ *
* @since ONAP Beijing Release
*/
@SuppressWarnings("unchecked")
- public static String buildResourceRequestParameters(Execution execution, String serviceUuid,
- String resourceCustomizationUuid, String serviceParameters) {
- List<String> resourceList =
- jsonUtil.StringArrayToList(execution, (String) JsonUtils.getJsonValue(serviceParameters, "resources"));
+ public static String buildResourceRequestParameters(Execution execution, Resource resource,
+ String uuiServiceParameters, Map<String, Object> currentVFData) {
+ List<String> resourceList = jsonUtil.StringArrayToList(execution,
+ (String) JsonUtils.getJsonValue(uuiServiceParameters, "resources"));
// Get the right location str for resource. default is an empty array.
String locationConstraints = "[]";
- String resourceInputsFromUui = "";
- for (String resource : resourceList) {
- String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
- if (resourceCustomizationUuid.equals(resCusUuid)) {
- String resourceParameters = JsonUtils.getJsonValue(resource, "parameters");
- locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints");
- resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs");
+ if (resource.getResourceType() == ResourceType.VNF) {
+ for (String eachResource : resourceList) {
+ String resCusUuid = JsonUtils.getJsonValue(eachResource, "resourceCustomizationUuid");
+ // in case of external api invocation customizatoin id is coming null
+ if (resCusUuid == null || resCusUuid.contains("null") || resCusUuid.isEmpty()) {
+ logger.info("resource resolved using model uuid");
+ String uuid = (String) JsonUtils.getJsonValue(eachResource, "resourceUuid");
+ if ((null != uuid) && uuid.equals(resource.getModelInfo().getModelUuid())) {
+ logger.info("found resource uuid {}", uuid);
+ String resourceParameters = JsonUtils.getJsonValue(eachResource, "parameters");
+ locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints");
+ }
+ } else if (resCusUuid.equals(resource.getModelInfo().getModelCustomizationUuid())) {
+ logger.info("resource resolved using customization-id");
+ String resourceParameters = JsonUtils.getJsonValue(eachResource, "parameters");
+ locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints");
+ }
}
}
- Map<String, Object> serviceInput = null;
- if (JsonUtils.getJsonValue(serviceParameters, "requestInputs") != null) {
- serviceInput =
- getJsonObject((String) JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class);
- }
- Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class);
+ Map<String, Object> uuiRequestInputs = null;
+ if (JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs") != null) {
+ String uuiRequestInputStr = JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs");
+ logger.info("resource input from UUI:{} ", uuiRequestInputStr);
+ if (uuiRequestInputStr == null || uuiRequestInputStr.isEmpty()) {
+ uuiRequestInputStr = "{}";
+ }
- if (serviceInput == null) {
- serviceInput = new HashMap();
+ uuiRequestInputs = getJsonObject(uuiRequestInputStr, Map.class);
}
- if (resourceInputsFromUuiMap == null) {
- resourceInputsFromUuiMap = new HashMap();
+ if (uuiRequestInputs == null) {
+ uuiRequestInputs = new HashMap();
}
- Map<String, Object> resourceInputsFromServiceDeclaredLevel =
- buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput);
- resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel);
- String resourceInputsStr = getJsonString(resourceInputsFromUuiMap);
+ Map<String, Object> resourceInputsAfterMerge =
+ ResourceRequestBuilder.buildResouceRequest(resource, uuiRequestInputs, currentVFData);
+
+ String resourceInputsStr = getJsonString(resourceInputsAfterMerge);
String result = "{\n" + "\"locationConstraints\":" + locationConstraints + ",\n" + "\"requestInputs\":"
+ resourceInputsStr + "\n" + "}";
return result;
}
@SuppressWarnings("unchecked")
- public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid,
- Map<String, Object> serviceInputs) {
+ public static Map<String, Object> buildResouceRequest(Resource resource, Map<String, Object> uuiRequestInputs,
+ Map<String, Object> currentVFData) {
try {
- Map<String, Object> serviceInstnace = getServiceInstnace(serviceUuid);
- // find match of customization uuid in vnf
- Map<String, Map<String, Object>> serviceResources =
- (Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources");
-
- List<Map<String, Object>> serviceVnfCust = (List<Map<String, Object>>) serviceResources.get("serviceVnfs");
- String resourceInputStr = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid);
-
- // find match in network resource
- if (resourceInputStr == null) {
- List<Map<String, Object>> serviceNetworkCust =
- (List<Map<String, Object>>) serviceResources.get("serviceNetworks");
- resourceInputStr = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid);
-
- // find match in AR resource
- if (resourceInputStr == null) {
- List<Map<String, Object>> serviceArCust =
- (List<Map<String, Object>>) serviceResources.get("serviceAllottedResources");
- resourceInputStr = getResourceInputStr(serviceArCust, resourceCustomizationUuid);
- }
+ String resourceInputStr = null;
+ // Resource Level is considered as first level by default
+ ResourceLevel resourceLevel = ResourceLevel.FIRST;
+ switch (resource.getResourceType()) {
+ case VNF:
+ resourceInputStr = ((VnfResource) resource).getResourceInput();
+ resourceLevel = ResourceLevel.FIRST;
+ break;
+ case GROUP:
+ resourceInputStr = ((GroupResource) resource).getVnfcs().get(0).getResourceInput();
+ resourceLevel = ResourceLevel.SECOND;
+ break;
}
- if (resourceInputStr != null && !resourceInputStr.isEmpty()) {
- return getResourceInput(resourceInputStr, serviceInputs);
+ if (StringUtils.isNotEmpty(resourceInputStr)) {
+ return getResourceInput(resourceInputStr, uuiRequestInputs, resourceLevel, currentVFData);
}
} catch (Exception e) {
- logger.error("not able to retrieve service instance");
+ logger.error("not able to retrieve service resource input ", e);
}
return new HashMap();
}
- private static String getResourceInputStr(List<Map<String, Object>> resources, String resCustomizationUuid) {
+ // this method combines resource input with service input
+ private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> uuiRequestInputs,
+ ResourceLevel resourceLevel, Map<String, Object> currentVFData) {
+ try {
+ Gson gson = new Gson();
+ Type type = new TypeToken<Map<String, String>>() {}.getType();
+ Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type);
+ JsonParser parser = new JsonParser();
+
+ Map<String, Object> uuiServiceInput = uuiRequestInputs;
+
+ int firstLevelIndex = 0;
+ int secondLevelIndex = 0;
+ String firstLevelKey = null;
+ String secondLevelKey = null;
+ boolean levelKeyNameUpdated = false;
+ int indexToPick = 0;
+
+ if (null != currentVFData) {
+ firstLevelIndex = getIntValue(currentVFData.get("currentFirstLevelIndex"), 0);
+ secondLevelIndex = getIntValue(currentVFData.get("currentSecondLevelIndex"), 0);
+ final String lastFirstLevelKey = firstLevelKey = (String) currentVFData.get("currentFirstLevelKey");
+ final String lastSecondLevelKey = secondLevelKey = (String) currentVFData.get("currentSecondLevelKey");
+
+ if (null != currentVFData.get("lastNodeTypeProcessed")) {
+ ResourceLevel lastResourceLevel =
+ ResourceLevel.valueOf(currentVFData.get("lastNodeTypeProcessed").toString());
+ switch (resourceLevel) {
+ case FIRST:
+ // if it is next request for same group then increment first level index
+ boolean isSameLevelRequest = resourceInput.values().stream().anyMatch(item -> {
+ JsonElement tree = parser.parse(((String) item).split("\\|")[0]);
+ return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString()
+ .equalsIgnoreCase(lastFirstLevelKey);
+ });
+ if (isSameLevelRequest) {
+ firstLevelIndex++;
+ } else {
+ firstLevelIndex = 0;
+ }
+ if (lastResourceLevel == ResourceLevel.SECOND) {
+ secondLevelKey = null;
+ }
+ indexToPick = firstLevelIndex;
+ break;
+ case SECOND:
+ // if it is next request for same group then increment second level index
+ switch (lastResourceLevel) {
+ case FIRST:
+ secondLevelIndex = 0;
+ break;
+ case SECOND:
+ boolean isSameSecondLevelRequest =
+ resourceInput.values().stream().anyMatch(item -> {
+ JsonElement tree = parser.parse(((String) item).split("\\|")[0]);
+ return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString()
+ .equalsIgnoreCase(lastSecondLevelKey);
+ });
+ if (isSameSecondLevelRequest) {
+ secondLevelIndex++;
+ }
+ break;
+ }
+ // get actual parent object to search for second level objects
+ if (null != lastFirstLevelKey) {
+ Object currentObject = uuiRequestInputs.get(lastFirstLevelKey);
+ if ((null != currentObject) && (currentObject instanceof List)) {
+ List currentFirstLevelList = (List) currentObject;
+ if (currentFirstLevelList.size() > firstLevelIndex) {
+ uuiServiceInput =
+ (Map<String, Object>) currentFirstLevelList.get(firstLevelIndex);
+ }
+
+ }
+ }
+ indexToPick = secondLevelIndex;
+ break;
+
+ }
+ }
- for (Map<String, Object> resource : resources) {
- Map<String, String> modelInfo = (Map<String, String>) resource.get("modelInfo");
- if (modelInfo.get("modelCustomizationUuid").equalsIgnoreCase(resCustomizationUuid)) {
- return (String) resource.get("resourceInput");
}
- }
- return null;
- }
- // this method combines resource input with service input
- private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs) {
- Gson gson = new Gson();
- Type type = new TypeToken<Map<String, String>>() {}.getType();
- Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type);
-
- // replace value if key is available in service input
- for (String key : resourceInput.keySet()) {
- String value = (String) resourceInput.get(key);
-
- if (value.contains("|")) {
- // node it type of getinput
- String[] split = value.split("\\|");
- String tmpKey = split[0];
- if (serviceInputs.containsKey(tmpKey)) {
- value = (String) serviceInputs.get(tmpKey);
- } else {
- if (split.length == 1) { // means value is empty e.g. "a":"key1|"
- value = "";
+ // replace value if key is available in service input
+ for (String key : resourceInput.keySet()) {
+ String value = (String) resourceInput.get(key);
+
+ if (value.contains("|")) {
+
+ // check which level
+
+ // node it type of getinput
+ String[] split = value.split("\\|");
+ String tmpKey = split[0];
+
+ JsonElement jsonTree = parser.parse(tmpKey);
+
+ // check if it is a list type
+ if (jsonTree.isJsonArray()) {
+ JsonArray jsonArray = jsonTree.getAsJsonArray();
+ boolean matchFound = false;
+ if (jsonArray.size() == 3) {
+ String keyName = jsonArray.get(0).getAsString();
+ String keyType = jsonArray.get(2).getAsString();
+ if (!levelKeyNameUpdated) {
+ switch (resourceLevel) {
+ case FIRST:
+ firstLevelKey = keyName;
+ break;
+ case SECOND:
+ secondLevelKey = keyName;
+ break;
+ }
+ levelKeyNameUpdated = true;
+ }
+
+ if ((null != uuiServiceInput) && (uuiServiceInput.containsKey(keyName))) {
+ Object vfcLevelObject = uuiServiceInput.get(keyName);
+ // it will be always list
+ if (vfcLevelObject instanceof List) {
+ List vfcObject = (List) vfcLevelObject;
+ if (vfcObject.size() > indexToPick) {
+ Map<String, Object> vfMap = (Map<String, Object>) vfcObject.get(indexToPick);
+ if (vfMap.containsKey(keyType)) {
+ if (vfMap.get(keyType) instanceof String) {
+ value = (String) vfMap.get(keyType);
+ } else {
+ value = getJsonString(vfMap.get(keyType));
+ }
+ matchFound = true;
+ }
+ }
+ }
+ }
+ }
+
+ if (!matchFound) {
+ if (split.length == 1) { // means value is empty e.g. "a":"key1|"
+ value = "";
+ } else {
+ value = split[1];
+ }
+ }
+
} else {
- value = split[1];
+
+ // if not a list type
+ if ((null != uuiServiceInput) && (uuiServiceInput.containsKey(tmpKey))) {
+ value = (String) uuiServiceInput.get(tmpKey);
+ } else {
+ if (split.length == 1) { // means value is empty e.g. "a":"key1|"
+ value = "";
+ } else {
+ value = split[1];
+ }
+ }
}
+
+ }
+ resourceInput.put(key, value);
+ }
+ // store current processed details into map
+ if (null != currentVFData) {
+ currentVFData.put("currentFirstLevelKey", firstLevelKey);
+ currentVFData.put("currentFirstLevelIndex", firstLevelIndex);
+ currentVFData.put("currentSecondLevelKey", secondLevelKey);
+ currentVFData.put("currentSecondLevelIndex", secondLevelIndex);
+ currentVFData.put("lastNodeTypeProcessed", resourceLevel.toString());
+ }
+
+ return resourceInput;
+
+ } catch (Exception e) {
+ logger.error("not able to parse and modify service resource input value against UUI ", e);
+ }
+ return new HashMap();
+ }
+
+ private static int getIntValue(Object inputObj, int defaultValue) {
+ if (null != inputObj) {
+ if (inputObj instanceof Integer) {
+ return ((Integer) inputObj).intValue();
+ }
+ if (StringUtils.isNotEmpty(inputObj.toString())) {
+ try {
+ int val = Integer.parseInt(inputObj.toString());
+ return val;
+ } catch (NumberFormatException e) {
+ logger.warn("Unable to parse to int", e);
}
}
- resourceInput.put(key, value);
}
- return resourceInput;
+ return defaultValue;
}
public static Map<String, Object> getServiceInstnace(String uuid) throws Exception {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
deleted file mode 100644
index dc2b3be073..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CryptoHandler.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.common.util;
-
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.util.Properties;
-import org.onap.so.utils.CryptoUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CryptoHandler implements ICryptoHandler {
- private static final Logger logger = LoggerFactory.getLogger(CryptoHandler.class);
- private static final String GENERAL_SECURITY_EXCEPTION_PREFIX = "GeneralSecurityException :";
- private static final String MSO_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
- private static final String PROPERTY_KEY = "mso.AaiEncrypted.Pwd";
-
- @Override
- public String getMsoAaiPassword() {
- Properties keyProp = new Properties();
- try {
- keyProp.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("urn.properties"));
- return CryptoUtils.decrypt((String) keyProp.get(PROPERTY_KEY), MSO_KEY);
- } catch (GeneralSecurityException | IOException e) {
- logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
- return null;
- }
- }
-
-
- @Override
- public String encryptMsoPassword(String plainMsoPwd) {
- try {
- return CryptoUtils.encrypt(plainMsoPwd, MSO_KEY);
- } catch (GeneralSecurityException e) {
- logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
- return null;
- }
- }
-
- @Override
- public String decryptMsoPassword(String encryptedPwd) {
- try {
- return CryptoUtils.decrypt(encryptedPwd, MSO_KEY);
- } catch (GeneralSecurityException e) {
- logger.error(GENERAL_SECURITY_EXCEPTION_PREFIX + e.getMessage(), e);
- return null;
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
index 33fb78b306..047b1f3930 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
@@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.workflow.context;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.TimeUnit;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -130,7 +131,7 @@ public class WorkflowContextHolder {
Thread.currentThread().interrupt();
} catch (Exception e) {
logger.debug("WorkflowContextHolder timeout thread caught exception: ", e);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), "Error in WorkflowContextHolder timeout thread");
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java
index f56fad3bcf..84b162e1a2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/Metadata.java
@@ -31,7 +31,7 @@ public class Metadata implements Serializable {
private static final long serialVersionUID = 4981393122007858950L;
@JsonProperty("metadatum")
- private List<Metadatum> metadatum = new ArrayList<Metadatum>();
+ private List<Metadatum> metadatum = new ArrayList<>();
public List<Metadatum> getMetadatum() {
return metadatum;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java
index a5eb9d86a7..96a6ab7bd2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java
@@ -36,8 +36,6 @@ public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute>
@Id
@JsonProperty("route-id")
private String routeId;
- @JsonProperty("route-name")
- private String routeName;
@JsonProperty("network-start-address")
private String networkStartAddress;
@JsonProperty("cidr-mask")
@@ -54,14 +52,6 @@ public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute>
this.routeId = routeId;
}
- public String getRouteName() {
- return routeName;
- }
-
- public void setRouteName(String routeName) {
- this.routeName = routeName;
- }
-
public String getNetworkStartAddress() {
return networkStartAddress;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java
index dff5a57040..36262ec800 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Configuration.java
@@ -78,6 +78,9 @@ public class Configuration implements Serializable, ShallowCopy<Configuration> {
@JsonProperty("l-interface")
private LInterface lInterface;
+ @JsonProperty("vpn-binding")
+ private VpnBinding vpnBinding;
+
public ModelInfoConfiguration getModelInfoConfiguration() {
return modelInfoConfiguration;
}
@@ -222,6 +225,14 @@ public class Configuration implements Serializable, ShallowCopy<Configuration> {
this.lInterface = lInterface;
}
+ public VpnBinding getVpnBinding() {
+ return vpnBinding;
+ }
+
+ public void setVpnBinding(VpnBinding vpnBinding) {
+ this.vpnBinding = vpnBinding;
+ }
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof Configuration)) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
index 841546b3b1..ebf722ef74 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
@@ -133,7 +133,7 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
@JsonProperty("model-info-generic-vnf")
private ModelInfoGenericVnf modelInfoGenericVnf;
@JsonProperty("instance-groups")
- private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>();
+ private List<InstanceGroup> instanceGroups = new ArrayList<>();
@JsonProperty("call-homing")
private Boolean callHoming;
@JsonProperty("nf-function")
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java
index 387d191409..db2785902a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java
@@ -65,15 +65,15 @@ public class LInterface implements Serializable, ShallowCopy<LInterface> {
@JsonProperty("allowed-address-pairs")
private String allowedAddressPairs;
@JsonProperty("vlans")
- private List<Vlan> vlans = new ArrayList<Vlan>();
+ private List<Vlan> vlans = new ArrayList<>();
@JsonProperty("sriov-vfs")
- private List<SriovVf> sriovVfs = new ArrayList<SriovVf>();
+ private List<SriovVf> sriovVfs = new ArrayList<>();
@JsonProperty("l-interfaces")
- private List<LInterface> lInterfaces = new ArrayList<LInterface>();
+ private List<LInterface> lInterfaces = new ArrayList<>();
@JsonProperty("l3-interface-ipv4-address-list")
- private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>();
+ private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<>();
@JsonProperty("l3-interface-ipv6-address-list")
- private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>();
+ private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<>();
public String getInterfaceName() {
return interfaceName;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java
index d0bf1f588b..f3e28faf44 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PServer.java
@@ -41,9 +41,9 @@ public class PServer implements Serializable, ShallowCopy<PServer> {
@JsonProperty("hostname")
private String hostname;
@JsonProperty("physical-links")
- private List<PhysicalLink> physicalLinks = new ArrayList<PhysicalLink>(); // TODO techincally there is a pInterface
- // between (pserver <--> physical-link)
- // but dont really need that pojo
+ private List<PhysicalLink> physicalLinks = new ArrayList<>(); // TODO techincally there is a pInterface
+ // between (pserver <--> physical-link)
+ // but dont really need that pojo
public String getPserverId() {
return pserverId;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
index 6c3a0c43ed..6cc8aa368c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
@@ -78,6 +78,12 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
private ModelInfoServiceInstance modelInfoServiceInstance;
@JsonProperty("instance-groups")
private List<InstanceGroup> instanceGroups = new ArrayList<>();
+ @JsonProperty("service-proxies")
+ private List<ServiceProxy> serviceProxies = new ArrayList<>();
+
+ public void setServiceProxies(List<ServiceProxy> serviceProxies) {
+ this.serviceProxies = serviceProxies;
+ }
public List<GenericVnf> getVnfs() {
return vnfs;
@@ -211,6 +217,10 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
this.instanceGroups = instanceGroups;
}
+ public List<ServiceProxy> getServiceProxies() {
+ return serviceProxies;
+ }
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof ServiceInstance)) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java
index 05199b7f37..b677b1efd0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceSubscription.java
@@ -41,7 +41,7 @@ public class ServiceSubscription implements Serializable, ShallowCopy<ServiceSub
@JsonProperty("temp-ub-sub-account-id")
private String tempUbSubAccountId;
@JsonProperty("service-instances")
- private List<ServiceInstance> serviceInstances = new ArrayList<ServiceInstance>();
+ private List<ServiceInstance> serviceInstances = new ArrayList<>();
public String getServiceType() {
return serviceType;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java
index 6951a23630..8c0db18d80 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java
@@ -62,9 +62,9 @@ public class Vlan implements Serializable, ShallowCopy<Vlan> {
@JsonProperty("is-ip-unnumbered")
private Boolean isIpUnnumbered;
@JsonProperty("l3-interface-ipv4-address-list")
- private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>();
+ private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<>();
@JsonProperty("l3-interface-ipv6-address-list")
- private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<L3InterfaceIpv6AddressList>();
+ private List<L3InterfaceIpv6AddressList> l3InterfaceIpv6AddressList = new ArrayList<>();
public String getVlanInterface() {
return vlanInterface;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vnfc.java
index 087edff7c0..08b1124726 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
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.servicedecomposition.bbobjects;
import java.io.Serializable;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java
index 4ee8213e59..4e5b3557d8 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VpnBondingLink.java
@@ -41,10 +41,10 @@ public class VpnBondingLink implements Serializable, ShallowCopy<VpnBondingLink>
private String vpnBondingLinkId;
@JsonProperty("configurations")
- private List<Configuration> configurations = new ArrayList<Configuration>();
+ private List<Configuration> configurations = new ArrayList<>();
@JsonProperty("service-proxies")
- private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>();
+ private List<ServiceProxy> serviceProxies = new ArrayList<>();
public String getVpnBondingLinkId() {
return vpnBondingLinkId;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapper.java
new file mode 100644
index 0000000000..1f7f970058
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapper.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers.exceptions.ServiceProxyNotFoundException;
+
+public class ServiceInstanceWrapper {
+
+ private final ServiceInstance serviceInstance;
+ private static final String SERVICE_PROXY_TRANSPORT = "TRANSPORT";
+
+ public ServiceInstanceWrapper(ServiceInstance serviceInstance) {
+ this.serviceInstance = serviceInstance;
+ }
+
+ public ServiceProxy getTransportServiceProxy() throws ServiceProxyNotFoundException {
+ ServiceProxy serviceProxy = null;
+ for (ServiceProxy sp : serviceInstance.getServiceProxies()) {
+ if (SERVICE_PROXY_TRANSPORT.equalsIgnoreCase(sp.getType())) {
+ serviceProxy = sp;
+ break;
+ }
+ }
+ if (serviceProxy == null) {
+ throw new ServiceProxyNotFoundException("Transport Service Proxy not found for service instance: "
+ + serviceInstance.getServiceInstanceId());
+ }
+ return serviceProxy;
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/exceptions/ServiceProxyNotFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/exceptions/ServiceProxyNotFoundException.java
new file mode 100644
index 0000000000..046299bb13
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/exceptions/ServiceProxyNotFoundException.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers.exceptions;
+
+public class ServiceProxyNotFoundException extends Exception {
+
+ private static final long serialVersionUID = 717577158109655720L;
+
+ public ServiceProxyNotFoundException() {
+ super();
+ }
+
+ public ServiceProxyNotFoundException(String message) {
+ super(message);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
index af9eb525aa..f1de0cc6f6 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
@@ -35,7 +35,7 @@ public class ExecuteBuildingBlock implements Serializable {
private String requestAction;
private String vnfType;
private Boolean aLaCarte;
- private Boolean homing;
+ private Boolean homing = false;
private WorkflowResourceIds workflowResourceIds;
private RequestDetails requestDetails;
private ConfigurationResourceKeys configurationResourceKeys;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
index 9e95e79b70..8608fee244 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
@@ -21,5 +21,15 @@
package org.onap.so.bpmn.servicedecomposition.entities;
public enum ResourceKey {
- SERVICE_INSTANCE_ID, GENERIC_VNF_ID, NETWORK_ID, VOLUME_GROUP_ID, VF_MODULE_ID, ALLOTTED_RESOURCE_ID, CONFIGURATION_ID, NETWORK_COLLECTION_ID, VPN_ID, VPN_BONDING_LINK_ID, INSTANCE_GROUP_ID;
+ SERVICE_INSTANCE_ID,
+ GENERIC_VNF_ID,
+ NETWORK_ID,
+ VOLUME_GROUP_ID,
+ VF_MODULE_ID,
+ ALLOTTED_RESOURCE_ID,
+ CONFIGURATION_ID,
+ NETWORK_COLLECTION_ID,
+ VPN_ID,
+ VPN_BONDING_LINK_ID,
+ INSTANCE_GROUP_ID;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java
index c9f7e5e948..93d85daad1 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java
@@ -34,9 +34,9 @@ public class License implements Serializable {
private static final long serialVersionUID = 2345786874755685318L;
@JsonProperty("entitlement-pool-uuids")
- private List<String> entitlementPoolUuids = new ArrayList<String>();
+ private List<String> entitlementPoolUuids = new ArrayList<>();
@JsonProperty("license-key-group-uuids")
- private List<String> licenseKeyGroupUuids = new ArrayList<String>();
+ private List<String> licenseKeyGroupUuids = new ArrayList<>();
public List<String> getEntitlementPoolUuids() {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java
index db5c11a954..068fa876ce 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.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,9 +34,10 @@ public class SolutionCandidates implements Serializable {
private List<Candidate> requiredCandidates = new ArrayList<Candidate>();
@JsonProperty("excludedCandidates")
private List<Candidate> excludedCandidates = new ArrayList<Candidate>();
- // TODO figure out best way to do this
@JsonProperty("existingCandidates")
private List<Candidate> existingCandidates = new ArrayList<Candidate>();
+ @JsonProperty("filteringAttributes")
+ private List<Candidate> filteringAttributes = new ArrayList<Candidate>();
public List<Candidate> getRequiredCandidates() {
@@ -59,6 +60,8 @@ public class SolutionCandidates implements Serializable {
return existingCandidates;
}
-
+ public List<Candidate> getFilteringAttributes() {
+ return filteringAttributes;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
index 05cad456d0..bc330eeafd 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java
@@ -39,6 +39,10 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
private String environmentContext;
@JsonProperty("workload-context")
private String workloadContext;
+ @JsonProperty("naming-policy")
+ private String namingPolicy;
+ @JsonProperty("onap-generated-naming")
+ private Boolean onapGeneratedNaming;
public String getDescription() {
@@ -88,4 +92,21 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
public void setWorkloadContext(String workloadContext) {
this.workloadContext = workloadContext;
}
+
+
+ public String getNamingPolicy() {
+ return namingPolicy;
+ }
+
+ public void setNamingPolicy(String namingPolicy) {
+ this.namingPolicy = namingPolicy;
+ }
+
+ public Boolean getOnapGeneratedNaming() {
+ return onapGeneratedNaming;
+ }
+
+ public void setOnapGeneratedNaming(Boolean onapGeneratedNaming) {
+ this.onapGeneratedNaming = onapGeneratedNaming;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java
index b2494384f4..91ff3d623d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceProxy.java
@@ -22,11 +22,31 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo;
import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonProperty;
public class ModelInfoServiceProxy extends ModelInfoMetadata implements Serializable {
private static final long serialVersionUID = -6256897576261215926L;
+ @JsonProperty("tosca-node-type")
+ private String toscaNodeType;
+ @JsonProperty("description")
+ private String description;
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java
index 7ca6076b21..f23f62d763 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java
@@ -22,10 +22,15 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
public enum AssignFlows {
- SERVICE_INSTANCE("AssignServiceInstanceBB"), VNF("AssignVnfBB"), VF_MODULE("AssignVfModuleBB"), NETWORK_A_LA_CARTE(
- "AssignNetwork1802BB"), NETWORK_MACRO("AssignNetworkBB"), VOLUME_GROUP(
- "AssignVolumeGroupBB"), NETWORK_COLLECTION(
- "CreateNetworkCollectionBB"), FABRIC_CONFIGURATION("AssignFabricConfigurationBB");
+ SERVICE_INSTANCE("AssignServiceInstanceBB"),
+ VNF("AssignVnfBB"),
+ VF_MODULE("AssignVfModuleBB"),
+ NETWORK_A_LA_CARTE("AssignNetwork1802BB"),
+ NETWORK_MACRO("AssignNetworkBB"),
+ VOLUME_GROUP("AssignVolumeGroupBB"),
+ NETWORK_COLLECTION("CreateNetworkCollectionBB"),
+ FABRIC_CONFIGURATION("AssignFabricConfigurationBB"),
+ VRF_CONFIGURATION("AssignVrfConfigurationBBV2");
private final String flowName;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 2d066285a4..3cf5a60de7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -47,11 +47,13 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -76,6 +78,7 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
@@ -147,6 +150,17 @@ public class BBInputSetup implements JavaDelegate {
this.mapperLayer = mapperLayer;
}
+ /**
+ * This method is used for executing the building block.
+ *
+ * It will get the BB from the execution object by checking if the aLaCarte and homing is true.
+ *
+ * Then it will get the GBB and execute it.
+ *
+ * @param execution
+ * @throws Exception
+ * @return
+ */
@Override
public void execute(DelegateExecution execution) throws Exception {
try {
@@ -342,7 +356,7 @@ public class BBInputSetup implements JavaDelegate {
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(configurationKey);
populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
- configurationId, instanceName, configurationResourceKeys);
+ configurationId, instanceName, configurationResourceKeys, requestDetails);
} else {
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
@@ -372,11 +386,14 @@ public class BBInputSetup implements JavaDelegate {
protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
- String instanceName, ConfigurationResourceKeys configurationResourceKeys) {
+ String instanceName, ConfigurationResourceKeys configurationResourceKeys, RequestDetails requestDetails) {
Configuration configuration = null;
for (Configuration configurationTemp : serviceInstance.getConfigurations()) {
- if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId()
- .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
+ if ((bbName.contains("Fabric") && configurationTemp.getConfigurationSubType() != null
+ && configurationTemp.getConfigurationSubType().equalsIgnoreCase("Fabric Config"))
+ || (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId()
+ .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID)))) {
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configurationTemp.getConfigurationId());
configuration = configurationTemp;
org.onap.aai.domain.yang.Configuration aaiConfiguration =
bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
@@ -385,14 +402,20 @@ public class BBInputSetup implements JavaDelegate {
}
}
}
- if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) {
+ if (configuration == null && (bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())
+ || bbName.equalsIgnoreCase(AssignFlows.VRF_CONFIGURATION.toString()))) {
configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId);
serviceInstance.getConfigurations().add(configuration);
}
- if (configuration != null) {
+ if (configuration != null && bbName.contains("Fabric")) {
Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName());
configuration.setVnfc(vnfc);
this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
+ } else if (configuration != null && bbName.contains("Vrf")) {
+ configuration.setModelInfoConfiguration(mapperLayer.mapCatalogConfigurationToConfiguration(
+ findConfigurationResourceCustomization(modelInfo, service), null));
+ configuration.setConfigurationType(configuration.getModelInfoConfiguration().getConfigurationType());
+ configuration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole());
}
}
@@ -1115,15 +1138,67 @@ public class BBInputSetup implements JavaDelegate {
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(key);
this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
- configurationId, null, executeBB.getConfigurationResourceKeys());
+ configurationId, null, executeBB.getConfigurationResourceKeys(), executeBB.getRequestDetails());
}
if (executeBB.getWorkflowResourceIds() != null) {
this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance,
executeBB.getWorkflowResourceIds().getNetworkCollectionId(), key);
}
+ RelatedInstance relatedVpnBinding =
+ bbInputSetupUtils.getRelatedInstanceByType(executeBB.getRequestDetails(), ModelType.vpnBinding);
+ RelatedInstance relatedLocalNetwork =
+ bbInputSetupUtils.getRelatedInstanceByType(executeBB.getRequestDetails(), ModelType.network);
+ if (relatedVpnBinding != null && relatedLocalNetwork != null) {
+ org.onap.aai.domain.yang.VpnBinding aaiVpnBinding =
+ bbInputSetupUtils.getAAIVpnBinding(relatedVpnBinding.getInstanceId());
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork =
+ bbInputSetupUtils.getAAIL3Network(relatedLocalNetwork.getInstanceId());
+ VpnBinding vpnBinding = mapperLayer.mapAAIVpnBinding(aaiVpnBinding);
+ L3Network localNetwork = mapperLayer.mapAAIL3Network(aaiLocalNetwork);
+ Optional<org.onap.aai.domain.yang.VpnBinding> aaiAICVpnBindingOp =
+ bbInputSetupUtils.getAICVpnBindingFromNetwork(aaiLocalNetwork);
+ if (aaiAICVpnBindingOp.isPresent()) {
+ localNetwork.getVpnBindings().add(mapperLayer.mapAAIVpnBinding(aaiAICVpnBindingOp.get()));
+ }
+ ServiceProxy serviceProxy = getServiceProxy(service);
+ gBB.getServiceInstance().getServiceProxies().add(serviceProxy);
+ gBB.getCustomer().getVpnBindings().add(vpnBinding);
+ lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
+ gBB.getServiceInstance().getNetworks().add(localNetwork);
+ lookupKeyMap.put(ResourceKey.NETWORK_ID, localNetwork.getNetworkId());
+ }
return gBB;
}
+ protected ServiceProxy getServiceProxy(Service service) {
+ if (!service.getServiceProxyCustomizations().isEmpty()) {
+ ServiceProxyResourceCustomization serviceProxyCatalog = getServiceProxyResourceCustomization(service);
+ ServiceProxy serviceProxy = new ServiceProxy();
+ serviceProxy.setModelInfoServiceProxy(
+ mapperLayer.mapServiceProxyCustomizationToServiceProxy(serviceProxyCatalog));
+ Service sourceService = serviceProxyCatalog.getSourceService();
+ ServiceInstance sourceServiceShell = new ServiceInstance();
+ sourceServiceShell
+ .setModelInfoServiceInstance(mapperLayer.mapCatalogServiceIntoServiceInstance(sourceService));
+ serviceProxy.setServiceInstance(sourceServiceShell);
+ serviceProxy.setType(sourceService.getServiceType());
+ return serviceProxy;
+ } else {
+ return null;
+ }
+ }
+
+ protected ServiceProxyResourceCustomization getServiceProxyResourceCustomization(Service service) {
+ ServiceProxyResourceCustomization serviceProxyCatalog = null;
+ for (ServiceProxyResourceCustomization serviceProxyTemp : service.getServiceProxyCustomizations()) {
+ if (serviceProxyTemp.getSourceService() != null
+ && serviceProxyTemp.getSourceService().getServiceType().equalsIgnoreCase("TRANSPORT")) {
+ serviceProxyCatalog = serviceProxyTemp;
+ }
+ }
+ return serviceProxyCatalog;
+ }
+
protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key,
String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust,
ServiceInstance serviceInstance) {
@@ -1316,8 +1391,10 @@ public class BBInputSetup implements JavaDelegate {
vnfs.getInstanceParams(), productFamilyId);
} else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) {
Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources);
- vfModules = vnfsAndVfModules.getValue1();
- vnfs = vnfsAndVfModules.getValue0();
+ if (vnfsAndVfModules != null) {
+ vfModules = vnfsAndVfModules.getValue1();
+ vnfs = vnfsAndVfModules.getValue0();
+ }
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap));
if (vnfs == null) {
throw new Exception("Could not find Vnf to orchestrate VfModule");
@@ -1338,8 +1415,10 @@ public class BBInputSetup implements JavaDelegate {
} else if (bbName.contains(NETWORK)) {
networks = findNetworksByKey(key, resources);
String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
- this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName,
- serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams());
+ if (networks != null) {
+ this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName,
+ serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams());
+ }
} else if (bbName.contains("Configuration")) {
String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
ModelInfo configurationModelInfo = new ModelInfo();
@@ -1348,7 +1427,7 @@ public class BBInputSetup implements JavaDelegate {
findConfigurationResourceCustomization(configurationModelInfo, service);
if (configurationCust != null) {
this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
- configurationId, null, executeBB.getConfigurationResourceKeys());
+ configurationId, null, executeBB.getConfigurationResourceKeys(), executeBB.getRequestDetails());
} else {
logger.debug("Could not find a configuration customization with key: {}", key);
}
@@ -1477,6 +1556,14 @@ public class BBInputSetup implements JavaDelegate {
return serviceInstance;
}
+ /**
+ * This method is used for getting the existing service instance.
+ *
+ * This will map the serviceInstanceAAI to serviceInstance and return the serviceInstance.
+ *
+ * @throws Exception
+ * @return serviceInstance
+ */
public ServiceInstance getExistingServiceInstance(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI)
throws Exception {
ServiceInstance serviceInstance = mapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI);
@@ -1528,8 +1615,10 @@ public class BBInputSetup implements JavaDelegate {
protected void mapCatalogNetworkCollectionInstanceGroup(Service service, InstanceGroup instanceGroup, String key) {
CollectionResourceCustomization collectionCust = this.findCatalogNetworkCollection(service, key);
- org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup =
- collectionCust.getCollectionResource().getInstanceGroup();
+ org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = null;
+ if (collectionCust != null) {
+ catalogInstanceGroup = collectionCust.getCollectionResource().getInstanceGroup();
+ }
instanceGroup.setModelInfoInstanceGroup(
mapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup));
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 6f3710835c..ea48c78dc0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Optional;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.AggregateRoute;
import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
@@ -40,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Entitlement;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Evc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ForwarderEvc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LagInterface;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
@@ -48,6 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget;
import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
@@ -56,6 +59,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
@@ -67,6 +71,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
@@ -79,6 +84,7 @@ import org.onap.so.db.catalog.beans.InstanceGroupType;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
@@ -126,12 +132,30 @@ public class BBInputSetupMapperLayer {
return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class);
}
+ protected AggregateRoute mapAAIAggregateRoute(org.onap.aai.domain.yang.AggregateRoute aaiAggregateRoute) {
+ return modelMapper.map(aaiAggregateRoute, AggregateRoute.class);
+ }
+
protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) {
return modelMapper.map(aaiCtagAssignment, CtagAssignment.class);
}
protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) {
- return modelMapper.map(aaiSubnet, Subnet.class);
+ Subnet subnet = modelMapper.map(aaiSubnet, Subnet.class);
+ mapAllHostRoutesIntoSubnet(aaiSubnet, subnet);
+ return subnet;
+ }
+
+ protected void mapAllHostRoutesIntoSubnet(org.onap.aai.domain.yang.Subnet aaiSubnet, Subnet subnet) {
+ if (aaiSubnet.getHostRoutes() != null) {
+ for (org.onap.aai.domain.yang.HostRoute aaiHostRoute : aaiSubnet.getHostRoutes().getHostRoute()) {
+ subnet.getHostRoutes().add(mapAAIHostRoute(aaiHostRoute));
+ }
+ }
+ }
+
+ protected HostRoute mapAAIHostRoute(org.onap.aai.domain.yang.HostRoute aaiHostRoute) {
+ return modelMapper.map(aaiHostRoute, HostRoute.class);
}
protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) {
@@ -243,10 +267,21 @@ public class BBInputSetupMapperLayer {
mapAllSubnetsIntoL3Network(aaiL3Network, network);
mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network);
mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network);
+ mapAllAggregateRoutesIntoL3Network(aaiL3Network, network);
network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus()));
return network;
}
+ protected void mapAllAggregateRoutesIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
+ L3Network network) {
+ if (aaiL3Network.getAggregateRoutes() != null) {
+ for (org.onap.aai.domain.yang.AggregateRoute aaiAggregateRoute : aaiL3Network.getAggregateRoutes()
+ .getAggregateRoute()) {
+ network.getAggregateRoutes().add(mapAAIAggregateRoute(aaiAggregateRoute));
+ }
+ }
+ }
+
protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
L3Network network) {
if (aaiL3Network.getSegmentationAssignments() != null) {
@@ -502,13 +537,18 @@ public class BBInputSetupMapperLayer {
protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
ConfigurationResourceCustomization configurationResourceCustomization,
CvnfcConfigurationCustomization cvnfcConfigurationCustomization) {
+
ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
modelInfoConfiguration
.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
modelInfoConfiguration.setModelInvariantId(
configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
- modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
+ modelInfoConfiguration.setConfigurationRole(configurationResourceCustomization.getRole());
+ modelInfoConfiguration.setConfigurationType(configurationResourceCustomization.getType());
+ if (cvnfcConfigurationCustomization != null) {
+ modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
+ }
return modelInfoConfiguration;
}
@@ -534,4 +574,32 @@ public class BBInputSetupMapperLayer {
public Vnfc mapAAIVnfc(org.onap.aai.domain.yang.Vnfc vnfcAAI) {
return modelMapper.map(vnfcAAI, Vnfc.class);
}
+
+ public VpnBinding mapAAIVpnBinding(org.onap.aai.domain.yang.VpnBinding aaiVpnBinding) {
+ VpnBinding vpnBinding = modelMapper.map(aaiVpnBinding, VpnBinding.class);
+ mapAllRouteTargetsToAAIVpnBinding(aaiVpnBinding, vpnBinding);
+ return vpnBinding;
+ }
+
+ protected void mapAllRouteTargetsToAAIVpnBinding(org.onap.aai.domain.yang.VpnBinding aaiVpnBinding,
+ VpnBinding vpnBinding) {
+ if (aaiVpnBinding.getRouteTargets() != null) {
+ for (org.onap.aai.domain.yang.RouteTarget aaiRouteTarget : aaiVpnBinding.getRouteTargets()
+ .getRouteTarget()) {
+ vpnBinding.getRouteTargets().add(mapAAIRouteTarget(aaiRouteTarget));
+ }
+ }
+ }
+
+ public RouteTarget mapAAIRouteTarget(org.onap.aai.domain.yang.RouteTarget aaiRouteTarget) {
+ return modelMapper.map(aaiRouteTarget, RouteTarget.class);
+ }
+
+ protected ModelInfoServiceProxy mapServiceProxyCustomizationToServiceProxy(
+ ServiceProxyResourceCustomization serviceProxyCustomization) {
+ ModelInfoServiceProxy modelInfoServiceProxy =
+ modelMapper.map(serviceProxyCustomization.getSourceService(), ModelInfoServiceProxy.class);
+ modelInfoServiceProxy.setModelInstanceName(serviceProxyCustomization.getModelInstanceName());
+ return modelInfoServiceProxy;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index 5cf2bd7b39..dcb9e08d0b 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
@@ -23,11 +23,15 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.Configuration;
+import org.onap.aai.domain.yang.Configurations;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.InstanceGroup;
@@ -39,12 +43,15 @@ import org.onap.aai.domain.yang.ServiceSubscription;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aai.domain.yang.VolumeGroups;
+import org.onap.aai.domain.yang.VpnBinding;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@@ -58,14 +65,21 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
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.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -75,6 +89,9 @@ public class BBInputSetupUtils {
private static final Logger logger = LoggerFactory.getLogger(BBInputSetupUtils.class);
private ObjectMapper objectMapper = new ObjectMapper();
private static final String REQUEST_ERROR = "Could not find request.";
+ private static final String DATA_LOAD_ERROR = "Could not process loading data from database";
+ private static final String DATA_PARSE_ERROR = "Could not parse data";
+ private static final String PROCESSING_DATA_NAME_EXECUTION_FLOWS = "flowExecutionPath";
@Autowired
protected CatalogDbClient catalogDbClient;
@@ -85,6 +102,20 @@ public class BBInputSetupUtils {
@Autowired
protected InjectionHelper injectionHelper;
+ public RelatedInstance getRelatedInstanceByType(RequestDetails requestDetails, ModelType modelType) {
+ if (requestDetails.getRelatedInstanceList() != null) {
+ for (RelatedInstanceList relatedInstanceList : requestDetails.getRelatedInstanceList()) {
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ if (relatedInstance != null && relatedInstance.getModelInfo() != null
+ && relatedInstance.getModelInfo().getModelType() != null
+ && relatedInstance.getModelInfo().getModelType().equals(modelType)) {
+ return relatedInstance;
+ }
+ }
+ }
+ return null;
+ }
+
public void updateInfraActiveRequestVnfId(InfraActiveRequests request, String vnfId) {
if (request != null) {
request.setVnfId(vnfId);
@@ -121,6 +152,66 @@ public class BBInputSetupUtils {
}
}
+ public void persistFlowExecutionPath(String requestId, List<ExecuteBuildingBlock> flowsToExecute) {
+
+ if (requestId != null) {
+ List<String> flows = new ArrayList<>();
+ ObjectMapper om = new ObjectMapper();
+ try {
+ for (ExecuteBuildingBlock ebb : flowsToExecute) {
+ flows.add(om.writeValueAsString(ebb));
+ }
+ } catch (JsonProcessingException e) {
+ logger.error(DATA_PARSE_ERROR, e);
+ }
+
+ this.requestsDbClient.persistProcessingData(flows.toString(), requestId);
+ } else {
+ logger.debug(REQUEST_ERROR);
+ }
+ }
+
+ public InfraActiveRequests loadInfraActiveRequestById(String requestId) {
+
+ return this.requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
+ }
+
+ public InfraActiveRequests loadOriginalInfraActiveRequestById(String requestId) {
+
+ return this.requestsDbClient.getInfraActiveRequestbyRequestId(
+ this.requestsDbClient.getInfraActiveRequestbyRequestId(requestId).getOriginalRequestId());
+ }
+
+ public List<ExecuteBuildingBlock> loadOriginalFlowExecutionPath(String requestId) {
+
+ List<ExecuteBuildingBlock> asList = null;
+ if (requestId != null) {
+
+ InfraActiveRequests request = loadInfraActiveRequestById(requestId);
+
+ if (request.getOriginalRequestId() != null) {
+
+ RequestProcessingData requestProcessingData =
+ this.requestsDbClient.getRequestProcessingDataBySoRequestIdAndName(
+ request.getOriginalRequestId(), PROCESSING_DATA_NAME_EXECUTION_FLOWS);
+
+ ObjectMapper om = new ObjectMapper();
+ try {
+ ExecuteBuildingBlock[] asArray =
+ om.readValue(requestProcessingData.getValue(), ExecuteBuildingBlock[].class);
+ asList = Arrays.asList(asArray);
+ } catch (Exception e) {
+ logger.error(DATA_LOAD_ERROR, e);
+ }
+ }
+
+ } else {
+ logger.debug(REQUEST_ERROR);
+ }
+
+ return asList;
+ }
+
public Service getCatalogServiceByModelUUID(String modelUUID) {
return catalogDbClient.getServiceByID(modelUUID);
}
@@ -334,6 +425,17 @@ public class BBInputSetupUtils {
});
}
+ public VpnBinding getAAIVpnBinding(String vpnBindingId) {
+
+ return this.injectionHelper.getAaiClient()
+ .get(VpnBinding.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBindingId).depth(Depth.ONE))
+ .orElseGet(() -> {
+ logger.debug("No VpnBinding matched by id");
+ return null;
+ });
+ }
+
public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) {
return this.injectionHelper.getAaiClient()
.get(VolumeGroup.class, AAIUriFactory
@@ -463,4 +565,65 @@ public class BBInputSetupUtils {
return Optional.of(volumeGroup);
}
}
+
+ public Optional<org.onap.aai.domain.yang.VpnBinding> getAICVpnBindingFromNetwork(
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork) {
+ AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork);
+ if (networkWrapper.getRelationships().isPresent()
+ && !networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).isEmpty()) {
+ return getAAIResourceDepthOne(
+ networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING).get(0))
+ .asBean(org.onap.aai.domain.yang.VpnBinding.class);
+ }
+ return Optional.empty();
+ }
+
+ public ServiceInstances getAAIServiceInstancesGloballyByName(String serviceInstanceName) {
+
+ return injectionHelper.getAaiClient()
+ .get(ServiceInstances.class, AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ .queryParam("service-instance-name", serviceInstanceName))
+ .orElseGet(() -> {
+ logger.debug("No Service Instance matched by name");
+ return null;
+ });
+ }
+
+ public boolean existsAAINetworksGloballyByName(String networkName) {
+
+ AAIResourceUri l3networkUri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
+ AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
+ return aaiRC.exists(l3networkUri);
+ }
+
+ public GenericVnfs getAAIVnfsGloballyByName(String vnfName) {
+
+ return injectionHelper.getAaiClient()
+ .get(GenericVnfs.class,
+ AAIUriFactory.createNodesUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName))
+ .orElseGet(() -> {
+ logger.debug("No GenericVnfs matched by name");
+ return null;
+ });
+ }
+
+ public Optional<Configuration> getRelatedConfigurationByNameFromServiceInstance(String serviceInstanceId,
+ String configurationName) throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
+ uri.relatedTo(AAIObjectPlurals.CONFIGURATION).queryParam("configuration-name", configurationName);
+ Optional<Configurations> configurations = injectionHelper.getAaiClient().get(Configurations.class, uri);
+ Configuration configuration = null;
+ if (!configurations.isPresent()) {
+ logger.debug("No Configurations matched by name");
+ return Optional.empty();
+ } else {
+ if (configurations.get().getConfiguration().size() > 1) {
+ throw new Exception("Multiple Configurations Returned");
+ } else {
+ configuration = configurations.get().getConfiguration().get(0);
+ }
+ return Optional.of(configuration);
+ }
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index c8e296d5ac..be53e505ac 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,10 +30,13 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
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.utils.TargetEntities;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +48,7 @@ public class ExecuteBuildingBlockRainyDay {
private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class);
public static final String HANDLING_CODE = "handlingCode";
+ public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState";
@Autowired
private CatalogDbClient catalogDbClient;
@@ -81,15 +85,13 @@ public class ExecuteBuildingBlockRainyDay {
String serviceType = ASTERISK;
boolean aLaCarte = (boolean) execution.getVariable("aLaCarte");
boolean suppressRollback = (boolean) execution.getVariable("suppressRollback");
- String handlingCode = "";
-
WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
- try {
- // Extract error data to be returned to WorkflowAction
+ if (workflowException != null) {
execution.setVariable("WorkflowExceptionErrorMessage", workflowException.getErrorMessage());
- } catch (Exception e) {
- logger.error("No WorkflowException Found", e);
+ } else {
+ logger.debug("WorkflowException is null, unable to set WorkflowExceptionErrorMessage");
}
+ String handlingCode = "";
if (suppressRollback) {
handlingCode = "Abort";
@@ -97,8 +99,12 @@ public class ExecuteBuildingBlockRainyDay {
try {
serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
.getModelInfoServiceInstance().getServiceType();
+ if (serviceType == null || serviceType.isEmpty()) {
+ serviceType = ASTERISK;
+ }
} catch (Exception ex) {
// keep default serviceType value
+ logger.error("Exception in serviceType retrivel", ex);
}
String vnfType = ASTERISK;
try {
@@ -110,6 +116,7 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default vnfType value
+ logger.error("Exception in vnfType retrivel", ex);
}
String errorCode = ASTERISK;
@@ -117,11 +124,14 @@ public class ExecuteBuildingBlockRainyDay {
errorCode = "" + workflowException.getErrorCode();
} catch (Exception ex) {
// keep default errorCode value
+ logger.error("Exception in errorCode retrivel", ex);
}
+
try {
errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
} catch (Exception ex) {
// keep default errorCode value
+ logger.error("Exception in errorCode retrivel", ex);
}
String workStep = ASTERISK;
@@ -129,31 +139,34 @@ public class ExecuteBuildingBlockRainyDay {
workStep = workflowException.getWorkStep();
} catch (Exception ex) {
// keep default workStep value
+ logger.error("Exception in workStep retrivel", ex);
}
- RainyDayHandlerStatus rainyDayHandlerStatus;
- rainyDayHandlerStatus = catalogDbClient
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
- serviceType, vnfType, errorCode, workStep);
- if (rainyDayHandlerStatus == null) {
- rainyDayHandlerStatus = catalogDbClient
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
- ASTERISK, ASTERISK, errorCode, ASTERISK);
+ String errorMessage = ASTERISK;
+ try {
+ errorMessage = workflowException.getErrorMessage();
+ } catch (Exception ex) {
+ // keep default workStep value
+ logger.error("Exception in errorMessage retrivel", ex);
}
- if (rainyDayHandlerStatus == null) {
- rainyDayHandlerStatus = catalogDbClient
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(bbName,
- ASTERISK, ASTERISK, ASTERISK, ASTERISK);
- if (rainyDayHandlerStatus == null) {
- handlingCode = "Abort";
- } else {
- if (primaryPolicy) {
- handlingCode = rainyDayHandlerStatus.getPolicy();
- } else {
- handlingCode = rainyDayHandlerStatus.getSecondaryPolicy();
- }
+ String serviceRole = ASTERISK;
+ try {
+ serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
+ .getModelInfoServiceInstance().getServiceRole();
+ if (serviceRole == null || serviceRole.isEmpty()) {
+ serviceRole = ASTERISK;
}
+ } catch (Exception ex) {
+ // keep default serviceRole value
+ }
+
+ RainyDayHandlerStatus rainyDayHandlerStatus;
+ rainyDayHandlerStatus = catalogDbClient.getRainyDayHandlerStatus(bbName, serviceType, vnfType,
+ errorCode, workStep, errorMessage, serviceRole);
+
+ if (rainyDayHandlerStatus == null) {
+ handlingCode = "Abort";
} else {
if (primaryPolicy) {
handlingCode = rainyDayHandlerStatus.getPolicy();
@@ -170,9 +183,21 @@ public class ExecuteBuildingBlockRainyDay {
logger.error("Failed to update Request Db Infra Active Requests with Retry Status", ex);
}
}
- if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) {
+ if ("RollbackToAssigned".equals(handlingCode) && !aLaCarte) {
handlingCode = "Rollback";
}
+ if (handlingCode.startsWith("Rollback")) {
+ String targetState = "";
+ if ("RollbackToAssigned".equalsIgnoreCase(handlingCode)) {
+ targetState = Status.ROLLED_BACK_TO_ASSIGNED.toString();
+ } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)) {
+ targetState = Status.ROLLED_BACK_TO_CREATED.toString();
+ } else {
+ targetState = Status.ROLLED_BACK.toString();
+ }
+ execution.setVariable(ROLLBACK_TARGET_STATE, targetState);
+ logger.debug("Rollback target state is: {}", targetState);
+ }
}
logger.debug("RainyDayHandler Status Code is: {}", handlingCode);
execution.setVariable(HANDLING_CODE, handlingCode);
@@ -185,7 +210,7 @@ public class ExecuteBuildingBlockRainyDay {
int envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
execution.setVariable("maxRetries", envMaxRetries);
} catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries", ex);
execution.setVariable("maxRetries", 5);
}
}
@@ -193,4 +218,43 @@ public class ExecuteBuildingBlockRainyDay {
public void setHandlingStatusSuccess(DelegateExecution execution) {
execution.setVariable(HANDLING_CODE, "Success");
}
+
+ public void updateExtSystemErrorSource(DelegateExecution execution) {
+ try {
+ String requestId = (String) execution.getVariable("mso-request-id");
+ WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+ TargetEntities extSystemErrorSource = exception.getExtSystemErrorSource();
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
+ if (isRollbackFailure == null) {
+ isRollbackFailure = false;
+ }
+
+ if (extSystemErrorSource != null) {
+ String extSystemErrorSourceString = extSystemErrorSource.toString();
+ if (isRollbackFailure) {
+ logger.debug("Updating extSystemErrorSource for isRollbackFailure to {} for request: {}",
+ extSystemErrorSourceString, requestId);
+ request.setRollbackExtSystemErrorSource(extSystemErrorSourceString);
+ } else {
+ logger.debug("Updating extSystemErrorSource to {} for request: {}", extSystemErrorSourceString,
+ requestId);
+ request.setExtSystemErrorSource(extSystemErrorSourceString);
+ }
+ } else if (isRollbackFailure) {
+ logger.debug(
+ "rollbackExtSystemErrorSource is null for isRollbackFailure. Setting rollbackExtSystemErrorSource to UNKNOWN");
+ request.setRollbackExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ } else {
+ logger.debug("extSystemErrorSource is null. Setting extSystemErrorSource to UNKNOWN");
+ request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ }
+
+ request.setLastModifiedBy("CamundaBPMN");
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Failed to update Request db with extSystemErrorSource or rollbackExtSystemErrorSource: ", e);
+ }
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
index b76316bf0e..aa71ee540f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 2019 Nokia
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,26 +45,15 @@ public class ExtractPojosForBB {
private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class);
public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key) throws BBObjectNotFoundException {
- return extractByKey(execution, key, execution.getLookupMap().get(key));
- }
-
- protected <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value)
- throws BBObjectNotFoundException {
-
Optional<T> result = Optional.empty();
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ String value = execution.getLookupMap().get(key);
try {
ServiceInstance serviceInstance;
GenericVnf vnf;
switch (key) {
case SERVICE_INSTANCE_ID:
- if (gBBInput.getCustomer().getServiceSubscription() == null
- && gBBInput.getServiceInstance() != null) {
- result = Optional.of((T) gBBInput.getServiceInstance());
- } else {
- result = lookupObjectInList(
- gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value);
- }
+ result = getServiceInstance(gBBInput, value);
break;
case GENERIC_VNF_ID:
serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
@@ -90,7 +80,6 @@ public class ExtractPojosForBB {
result = lookupObjectInList(serviceInstance.getConfigurations(), value);
break;
case VPN_ID:
- serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value);
break;
case VPN_BONDING_LINK_ID:
@@ -101,31 +90,27 @@ public class ExtractPojosForBB {
serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
result = lookupObjectInList(serviceInstance.getInstanceGroups(), value);
break;
- default:
- throw new BBObjectNotFoundException(key, value);
}
- } catch (BBObjectNotFoundException e) { // re-throw parent object not found
- throw e;
} catch (Exception e) { // convert all other exceptions to object not found
- logger.warn("BBObjectNotFoundException in ExtractPojosForBB",
- "BBObject " + key + " was not found in " + "gBBInput using reference value: " + value);
- throw new BBObjectNotFoundException(key, value);
- }
-
- if (result.isPresent()) {
- return result.get();
- } else {
+ logger.warn(
+ "BBObjectNotFoundException in ExtractPojosForBB, BBObject {} was not found in gBBInput using reference value: {} {}",
+ key, value, e);
throw new BBObjectNotFoundException(key, value);
}
+ return result.orElseThrow(() -> new BBObjectNotFoundException(key, value));
}
- protected <T> Optional<T> lookupObject(Object obj, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
- return findValue(obj, value);
+ private <T> Optional<T> getServiceInstance(GeneralBuildingBlock gBBInput, String value) throws Exception {
+ if (gBBInput.getCustomer().getServiceSubscription() == null && gBBInput.getServiceInstance() != null) {
+ return Optional.of((T) gBBInput.getServiceInstance());
+ } else if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ return lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value);
+ }
+ return Optional.empty();
}
- protected <T> Optional<T> lookupObjectInList(List<?> list, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ private <T> Optional<T> lookupObjectInList(List<?> list, String value)
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
Optional<T> result = Optional.empty();
for (Object obj : list) {
result = findValue(obj, value);
@@ -134,11 +119,10 @@ public class ExtractPojosForBB {
}
}
return result;
-
}
- protected <T> Optional<T> findValue(Object obj, String value) throws IllegalAccessException,
- IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+ private <T> Optional<T> findValue(Object obj, String value)
+ throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
for (Field field : obj.getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(Id.class)) {
String fieldName = field.getName();
@@ -149,7 +133,6 @@ public class ExtractPojosForBB {
}
}
}
-
return Optional.empty();
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/DuplicateNameException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/DuplicateNameException.java
new file mode 100644
index 0000000000..6e9eb809aa
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/DuplicateNameException.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.servicedecomposition.tasks.exceptions;
+
+public class DuplicateNameException extends Exception {
+
+ private static final long serialVersionUID = -2850043981787600326L;
+
+ public DuplicateNameException() {
+ super();
+ }
+
+ public DuplicateNameException(String message) {
+ super(message);
+ }
+
+ public DuplicateNameException(String objectType, String name) {
+ super(objectType + " with name " + name + " already exists. The name must be unique.");
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
index b97b9ac1ca..c05557a317 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
@@ -78,8 +78,24 @@ public class ApplicationControllerAction {
appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType);
break;
case Snapshot:
+ if (vmIdList.isEmpty()) {
+ logger.warn("vmIdList is Empty in AppCClient");
+ break;
+ }
String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds");
+ if (vmIds == null) {
+ logger.warn("vmIds null in AppCClient");
+ break;
+ }
+ if (vserverIdList.isEmpty()) {
+ logger.warn("vserverIdList is empty in AppCClient");
+ break;
+ }
String vserverIds = JsonUtils.getJsonValue(vserverIdList, "vserverIds");
+ if (vserverIds == null) {
+ logger.warn("vserverIds null in AppCClient");
+ break;
+ }
String vmId = "";
String vserverId = "";
ObjectMapper mapper = new ObjectMapper();
@@ -113,9 +129,9 @@ public class ApplicationControllerAction {
errorCode = Integer.toString(appCStatus.getCode());
errorMessage = appCStatus.getMessage();
- }
- if (ApplicationControllerSupport.getCategoryOf(appCStatus).equals(StatusCategory.NORMAL)) {
- errorCode = "0";
+ if (ApplicationControllerSupport.getCategoryOf(appCStatus).equals(StatusCategory.NORMAL)) {
+ errorCode = "0";
+ }
}
} catch (JsonProcessingException e) {
logger.error("Incorrect Payload format for action request: {}", action.toString(), e);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
index b2e6ead36b..ad94421e5a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForPnf.java
@@ -48,7 +48,7 @@ public class ConfigAssignPropertiesForPnf {
private String pnfCustomizationUuid;
@JsonIgnore
- private Map<String, Object> userParam = new HashMap<String, Object>();
+ private Map<String, Object> userParam = new HashMap<>();
public String getServiceInstanceId() {
return serviceInstanceId;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
index 592b349215..acd60a4004 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/beans/ConfigAssignPropertiesForVnf.java
@@ -48,7 +48,7 @@ public class ConfigAssignPropertiesForVnf {
private String vnfCustomizationUuid;
@JsonIgnore
- private Map<String, Object> userParam = new HashMap<String, Object>();
+ private Map<String, Object> userParam = new HashMap<>();
public String getServiceInstanceId() {
return serviceInstanceId;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java
index 333d99ed2e..7b1066d48c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java
@@ -22,10 +22,21 @@ package org.onap.so.client.exception;
public class BadResponseException extends Exception {
+ String responseCode;
+
public BadResponseException() {}
public BadResponseException(String message) {
super(message);
}
+ public BadResponseException(String message, String responseCode) {
+ super(message);
+ this.responseCode = responseCode;
+ }
+
+ public String getResponseCode() {
+ return responseCode;
+ }
+
}
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 ae5e41f7ce..729f5c95c4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -22,21 +22,43 @@
package org.onap.so.client.exception;
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.aai.domain.yang.LInterface;
+import org.onap.aai.domain.yang.Vserver;
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.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.logger.MessageEnum;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.onap.so.utils.TargetEntities;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
+
@Component
public class ExceptionBuilder {
private static final Logger logger = LoggerFactory.getLogger(ExceptionBuilder.class);
+
+ protected ExtractPojosForBB getExtractPojosForBB() {
+ return new ExtractPojosForBB();
+ }
+
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception) {
String msg = "Exception in %s.%s ";
try {
@@ -56,7 +78,7 @@ public class ExceptionBuilder {
}
}
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg.toString());
execution.setVariable(errorVariable, exception.getMessage());
} catch (Exception ex) {
@@ -69,7 +91,8 @@ public class ExceptionBuilder {
buildAndThrowWorkflowException(execution, errorCode, msg);
}
- public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) {
+ public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception,
+ TargetEntities extSystemErrorSource) {
String msg = "Exception in %s.%s ";
try {
logger.error("Exception occurred", exception);
@@ -87,6 +110,7 @@ public class ExceptionBuilder {
break;
}
}
+
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg.toString());
execution.setVariable(errorVariable, exception.getMessage());
@@ -97,9 +121,72 @@ public class ExceptionBuilder {
if (exception.getMessage() != null)
msg = msg.concat(exception.getMessage());
+ buildAndThrowWorkflowException(execution, errorCode, msg, extSystemErrorSource);
+ }
+
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception) {
+ String msg = "Exception in %s.%s ";
+ try {
+ logger.error("Exception occurred", exception);
+
+ String errorVariable = "Error%s%s";
+
+ StackTraceElement[] trace = Thread.currentThread().getStackTrace();
+ for (StackTraceElement traceElement : trace) {
+ if (!traceElement.getClassName().equals(this.getClass().getName())
+ && !traceElement.getClassName().equals(Thread.class.getName())) {
+ msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName());
+ String shortClassName =
+ traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1);
+ errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName());
+ break;
+ }
+ }
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), msg.toString());
+ execution.setVariable(errorVariable, exception.getMessage());
+ } catch (Exception ex) {
+ // log trace, allow process to complete gracefully
+ logger.error("Exception occurred", ex);
+ }
+
+ if (exception.getMessage() != null)
+ msg = msg.concat(exception.getMessage());
buildAndThrowWorkflowException(execution, errorCode, msg);
}
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception,
+ TargetEntities extSystemErrorSource) {
+ String msg = "Exception in %s.%s ";
+ try {
+ logger.error("Exception occurred", exception);
+
+ String errorVariable = "Error%s%s";
+
+ StackTraceElement[] trace = Thread.currentThread().getStackTrace();
+ for (StackTraceElement traceElement : trace) {
+ if (!traceElement.getClassName().equals(this.getClass().getName())
+ && !traceElement.getClassName().equals(Thread.class.getName())) {
+ msg = String.format(msg, traceElement.getClassName(), traceElement.getMethodName());
+ String shortClassName =
+ traceElement.getClassName().substring(traceElement.getClassName().lastIndexOf(".") + 1);
+ errorVariable = String.format(errorVariable, shortClassName, traceElement.getMethodName());
+ break;
+ }
+ }
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ ErrorCode.UnknownError.getValue(), msg.toString());
+ execution.setVariable(errorVariable, exception.getMessage());
+ } catch (Exception ex) {
+ // log trace, allow process to complete gracefully
+ logger.error("Exception occurred", ex);
+ }
+
+ if (exception.getMessage() != null)
+ msg = msg.concat(exception.getMessage());
+ buildAndThrowWorkflowException(execution, errorCode, msg, extSystemErrorSource);
+ }
+
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage) {
if (execution instanceof DelegateExecutionImpl) {
buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode,
@@ -107,6 +194,14 @@ public class ExceptionBuilder {
}
}
+ public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage,
+ TargetEntities extSystemErrorSource) {
+ if (execution instanceof DelegateExecutionImpl) {
+ buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode,
+ errorMessage, extSystemErrorSource);
+ }
+ }
+
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
String processKey = getProcessKey(execution);
logger.info("Building a WorkflowException for Subflow");
@@ -119,6 +214,19 @@ public class ExceptionBuilder {
throw new BpmnError("MSOWorkflowException");
}
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
+ TargetEntities extSystemErrorSource) {
+ String processKey = getProcessKey(execution);
+ logger.info("Building a WorkflowException for Subflow");
+
+ WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage, extSystemErrorSource);
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("MSOWorkflowException");
+ }
+
public void buildAndThrowWorkflowException(DelegateExecution execution, String errorCode, String errorMessage) {
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
throw new BpmnError(errorCode, errorMessage);
@@ -132,4 +240,76 @@ public class ExceptionBuilder {
return execution.getProcessEngineServices().getRepositoryService()
.getProcessDefinition(execution.getProcessDefinitionId()).getKey();
}
+
+ public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) {
+ logger.debug("Processing Audit Results");
+ String auditListString = (String) execution.getVariable("auditInventoryResult");
+ String processKey = getProcessKey(execution.getDelegateExecution());
+ if (auditListString != null) {
+ StringBuilder errorMessage = new StringBuilder();
+ try {
+ ExtractPojosForBB extractPojosForBB = getExtractPojosForBB();
+ VfModule module = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ String cloudRegionId = execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId();
+
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ AAIObjectAuditList auditList =
+ objectMapper.getMapper().readValue(auditListString, AAIObjectAuditList.class);
+
+ errorMessage = errorMessage.append(auditList.getAuditType() + " VF-Module " + module.getVfModuleId()
+ + " failed due to incomplete AAI vserver inventory population after stack "
+ + auditList.getHeatStackName() + " was successfully " + auditList.getAuditType()
+ + "d in cloud region " + cloudRegionId + ". MSO Audit indicates that the following was not "
+ + auditList.getAuditType() + "d in AAI: ");
+
+ Stream<AAIObjectAudit> vServerLInterfaceAuditStream = auditList.getAuditList().stream()
+ .filter(auditObject -> auditObject.getAaiObjectType().equals(AAIObjectType.VSERVER.typeName())
+ || auditObject.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName()));
+ List<AAIObjectAudit> filteredAuditStream =
+ vServerLInterfaceAuditStream.filter(a -> !a.isDoesObjectExist()).collect(Collectors.toList());
+
+ for (AAIObjectAudit object : filteredAuditStream) {
+ if (object.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())) {
+ LInterface li = objectMapper.getMapper().convertValue(object.getAaiObject(), LInterface.class);
+ errorMessage = errorMessage
+ .append(AAIObjectType.L_INTERFACE.typeName() + " " + li.getInterfaceId() + ", ");
+ } else {
+ Vserver vs = objectMapper.getMapper().convertValue(object.getAaiObject(), Vserver.class);
+ errorMessage =
+ errorMessage.append(AAIObjectType.VSERVER.typeName() + " " + vs.getVserverId() + ", ");
+ }
+ }
+
+ if (errorMessage.length() > 0) {
+ errorMessage.setLength(errorMessage.length() - 2);
+ errorMessage = errorMessage.append(".");
+ }
+
+ } catch (IOException | BBObjectNotFoundException e) {
+ errorMessage = errorMessage.append("process objects in AAI. ");
+ }
+
+ if (flowShouldContinue) {
+ execution.setVariable("StatusMessage", errorMessage.toString());
+ } else {
+ WorkflowException exception =
+ new WorkflowException(processKey, 400, errorMessage.toString(), TargetEntity.SO);
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString());
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("AAIInventoryFailure");
+ }
+
+ } else {
+ String errorMessage = "Unable to process audit results due to auditInventoryResult being null";
+ WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, TargetEntity.SO);
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("AAIInventoryFailure");
+ }
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExpectedDataException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExpectedDataException.java
new file mode 100644
index 0000000000..9ead1576cb
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExpectedDataException.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.exception;
+
+
+public class ExpectedDataException extends Exception {
+
+ public ExpectedDataException() {}
+
+ public ExpectedDataException(String message, String system) {
+ super("Expected data not found in " + system + ". " + message);
+ }
+
+ public ExpectedDataException(String message) {
+ super("Expected data not found. " + message);
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java
new file mode 100644
index 0000000000..9ae14a0162
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/UnexpectedDataException.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.exception;
+
+
+public class UnexpectedDataException extends Exception {
+
+ public UnexpectedDataException() {}
+
+ public UnexpectedDataException(String message, String system) {
+ super("Unexpected data found in " + system + ". " + message);
+ }
+
+ public UnexpectedDataException(String message) {
+ super("Unexpected data found. " + message);
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
index de44caa120..525307a5df 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
@@ -1,22 +1,22 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
package org.onap.so.bpmn.common.scripts
@@ -32,6 +32,7 @@ import org.junit.runner.RunWith
import org.mockito.junit.MockitoJUnitRunner
import org.onap.aai.domain.yang.GenericVnf
import org.onap.so.bpmn.mock.FileUtil
+import org.onap.so.client.HttpClient
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
@@ -47,54 +48,56 @@ abstract class MsoGroovyTest {
@Rule
public ExpectedException thrown = ExpectedException.none()
- protected ExecutionEntity mockExecution
- protected AAIResourcesClient client
+ protected ExecutionEntity mockExecution
+ protected AAIResourcesClient client
protected AllottedResourceUtils allottedResourceUtils_MOCK
- protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA =
- FileUtil.readResourceFile("__files/aai/searchResults.json")
- protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString();
-
- protected void init(String procName){
- mockExecution = setupMock(procName)
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
- client = mock(AAIResourcesClient.class)
- }
-
- protected ExecutionEntity setupMock(String procName) {
- ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
- when(mockProcessDefinition.getKey()).thenReturn(procName)
-
- RepositoryService mockRepositoryService = mock(RepositoryService.class)
- when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
- when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName)
- when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
-
- ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
- when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
-
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
- when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
-
- return mockExecution
- }
-
- protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) {
- ExecutionEntity mockExecution = mock(ExecutionEntity.class)
-
- when(mockExecution.getVariable("prefix")).thenReturn(prefix)
-
- ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class)
- RepositoryService repositoryService = mock(RepositoryService.class)
- ProcessDefinition processDefinition = mock(ProcessDefinition.class)
-
- when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices)
- when(processEngineServices.getRepositoryService()).thenReturn(repositoryService)
- when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition)
- when(processDefinition.getKey()).thenReturn(procName)
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
- return mockExecution
- }
-
+ protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA =
+ FileUtil.readResourceFile("__files/aai/searchResults.json")
+ protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString();
+
+ protected void init(String procName){
+ mockExecution = setupMock(procName)
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ client = mock(AAIResourcesClient.class)
+ }
+
+ protected ExecutionEntity setupMock(String procName) {
+ ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
+ when(mockProcessDefinition.getKey()).thenReturn(procName)
+
+ RepositoryService mockRepositoryService = mock(RepositoryService.class)
+ when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
+ when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName)
+ when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
+
+ ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
+ when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
+
+ HttpClient httpClient = mock(HttpClient.class)
+
+ return mockExecution
+ }
+
+ protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) {
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+
+ when(mockExecution.getVariable("prefix")).thenReturn(prefix)
+
+ ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class)
+ RepositoryService repositoryService = mock(RepositoryService.class)
+ ProcessDefinition processDefinition = mock(ProcessDefinition.class)
+
+ when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices)
+ when(processEngineServices.getRepositoryService()).thenReturn(repositoryService)
+ when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition)
+ when(processDefinition.getKey()).thenReturn(procName)
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ return mockExecution
+ }
+
protected <T> Optional<T> getAAIObjectFromJson(Class<T> clazz , String file){
String json = FileUtil.readResourceFile(file)
AAIResultWrapper resultWrapper = new AAIResultWrapper(json)
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index 79a94d5298..e9d8a5dee9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -247,6 +247,7 @@ public class BuildingBlockTestDataSetup {
modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter);
configuration.setModelInfoConfiguration(modelInfoConfiguration);
+ configuration.setVpnBinding(buildVpnBinding());
return configuration;
}
@@ -325,6 +326,7 @@ public class BuildingBlockTestDataSetup {
gBBInput.setCustomer(buildCustomer());
}
gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance);
+ gBBInput.setServiceInstance(serviceInstance);
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
return serviceInstance;
@@ -514,6 +516,11 @@ public class BuildingBlockTestDataSetup {
modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter);
modelInfoVfModule.setModelName("testModelName" + vfModuleCounter);
modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter);
+ if (vfModuleCounter == 1) {
+ modelInfoVfModule.setIsBaseBoolean(Boolean.TRUE);
+ } else {
+ modelInfoVfModule.setIsBaseBoolean(Boolean.FALSE);
+ }
vfModule.setModelInfoVfModule(modelInfoVfModule);
return vfModule;
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java
index f13bcb8a93..f4fe6d7158 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/BuildingBlockValidatorRunnerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -34,6 +34,12 @@ import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.common.listener.validation.BuildingBlockValidatorRunner;
+import org.onap.so.bpmn.common.listener.validation.FlowValidator;
+import org.onap.so.bpmn.common.listener.validation.MyPreValidatorOne;
+import org.onap.so.bpmn.common.listener.validation.MyPreValidatorThree;
+import org.onap.so.bpmn.common.listener.validation.MyPreValidatorTwo;
+import org.onap.so.bpmn.common.listener.validation.ValidationConfig;
import org.onap.so.bpmn.core.WorkflowException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
@@ -41,7 +47,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ValidationConfig.class})
-public class BuildingBlockValidatorRunnerTest {
+public class BuildingBlockValidatorRunnerTest extends BuildingBlockValidatorRunner {
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -57,7 +63,7 @@ public class BuildingBlockValidatorRunnerTest {
MyPreValidatorThree three = new MyPreValidatorThree();
List<FlowValidator> validators = Arrays.asList(one, two, three);
- List<FlowValidator> result = runner.filterValidators(validators, "test");
+ List<FlowValidator> result = runner.filterListeners(validators, (item -> item.shouldRunFor("test")));
List<FlowValidator> expected = Arrays.asList(two, one);
@@ -75,7 +81,7 @@ public class BuildingBlockValidatorRunnerTest {
} catch (BpmnError e) {
WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
assertEquals(
- "Failed Validations:\norg.onap.so.bpmn.common.validation.MyPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.MyPreValidatorOne: my-error-one",
+ "Failed Validations:\norg.onap.so.bpmn.common.listener.validation.MyPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.listener.validation.MyPreValidatorOne: my-error-one",
workflowException.getErrorMessage());
}
runner.preValidate("test2", mock(BuildingBlockExecution.class));
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java
index 07cd790ed1..596eced1d1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowValidatorRunnerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/WorkflowValidatorRunnerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -33,7 +33,11 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
-import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.validation.FlowValidator;
+import org.onap.so.bpmn.common.listener.validation.ValidationConfig;
+import org.onap.so.bpmn.common.listener.validation.WorkflowPreValidatorOne;
+import org.onap.so.bpmn.common.listener.validation.WorkflowPreValidatorTwo;
+import org.onap.so.bpmn.common.listener.validation.WorkflowValidatorRunner;
import org.onap.so.bpmn.core.WorkflowException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
@@ -41,7 +45,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ValidationConfig.class})
-public class WorkflowValidatorRunnerTest {
+public class WorkflowValidatorRunnerTest extends WorkflowValidatorRunner {
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -56,7 +60,7 @@ public class WorkflowValidatorRunnerTest {
WorkflowPreValidatorTwo two = new WorkflowPreValidatorTwo();
List<FlowValidator> validators = Arrays.asList(one, two);
- List<FlowValidator> result = runner.filterValidators(validators, "test");
+ List<FlowValidator> result = runner.filterListeners(validators, (item -> item.shouldRunFor("test")));
List<FlowValidator> expected = Arrays.asList(two, one);
@@ -74,7 +78,7 @@ public class WorkflowValidatorRunnerTest {
} catch (BpmnError e) {
WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
assertEquals(
- "Failed Validations:\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.validation.WorkflowPreValidatorOne: my-error-one",
+ "Failed Validations:\norg.onap.so.bpmn.common.listener.validation.WorkflowPreValidatorTwo: my-error-two\norg.onap.so.bpmn.common.listener.validation.WorkflowPreValidatorOne: my-error-one",
workflowException.getErrorMessage());
}
runner.preValidate("test2", mock(DelegateExecution.class));
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java
index 7572e930cd..544d370a3c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyDisabledValidator.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyDisabledValidator.java
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
import java.util.Collections;
import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
+import org.onap.so.listener.Skip;
import org.springframework.stereotype.Component;
@Component
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorFour.java
index 85531719d5..f0f27172a5 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorFour.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorFour.java
@@ -18,12 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
import org.springframework.stereotype.Component;
@Component
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorOne.java
index 989a65fe47..e705bafafe 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorOne.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorOne.java
@@ -18,12 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
import org.springframework.stereotype.Component;
@Component
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorThree.java
index a51d3836da..3c747dd20f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorThree.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorThree.java
@@ -18,12 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
import org.springframework.stereotype.Component;
@Component
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorTwo.java
index 1276d8f1d2..3fb3485c39 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/MyPreValidatorTwo.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/MyPreValidatorTwo.java
@@ -18,13 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Priority;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
import org.springframework.stereotype.Component;
@Priority(1)
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/ValidationConfig.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java
index 90d094ce41..a3692a50b7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/ValidationConfig.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/ValidationConfig.java
@@ -18,16 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.listener.ListenerRunner;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Profile;
@Configuration
-@ComponentScan(basePackages = {"org.onap.so.bpmn.common.validation"}, basePackageClasses = {ExceptionBuilder.class},
+@ComponentScan(basePackageClasses = {ExceptionBuilder.class, ListenerRunner.class, WorkflowValidatorRunner.class},
nameGenerator = DefaultToShortClassNameBeanNameGenerator.class)
public class ValidationConfig {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/WorkflowPreValidatorOne.java
index 485aae2fcc..f7aedcfd6f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorOne.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/WorkflowPreValidatorOne.java
@@ -18,12 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.validation.PreWorkflowValidator;
import org.springframework.stereotype.Component;
@Component
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/WorkflowPreValidatorTwo.java
index 9596524a56..99a7e161a9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/validation/WorkflowPreValidatorTwo.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/listener/validation/WorkflowPreValidatorTwo.java
@@ -18,13 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.bpmn.common.listener.validation;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Priority;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.validation.PreWorkflowValidator;
import org.springframework.stereotype.Component;
@Priority(1)
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
new file mode 100644
index 0000000000..f3233f2350
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
@@ -0,0 +1,112 @@
+package org.onap.so.bpmn.common.resource;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.bpmn.core.domain.GroupResource;
+import org.onap.so.bpmn.core.domain.ModelInfo;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ResourceType;
+import org.onap.so.bpmn.core.domain.VnfResource;
+import org.onap.so.bpmn.core.domain.VnfcResource;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class InstnaceResourceListTest {
+
+ public static String RESOURCE_PATH = "src/test/resources/__files/InstanceResourceList/";
+
+ @Test
+ public void testInstanceResourceList() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ List<Resource> instanceResourceList =
+ InstanceResourceList.getInstanceResourceList(createResourceSequence(), uuiRequest);
+ Assert.assertEquals(7, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
+ Assert.assertEquals("device", instanceResourceList.get(1).getModelInfo().getModelName());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(2).getResourceType());
+ Assert.assertEquals("sitewan", instanceResourceList.get(2).getModelInfo().getModelName());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(3).getResourceType());
+ Assert.assertEquals("sitewan", instanceResourceList.get(3).getModelInfo().getModelName());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(4).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(5).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(6).getResourceType());
+ }
+
+ // Test when PK is empty
+ @Test
+ public void testSimpleVFResource() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"ipaddress|127.0.0.1\"}");
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(1, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ }
+
+ // Test when PK is not empty and PK does not contain any groups
+ @Test
+ public void testVFWithEmptyGroupResource() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"[emptygroup_list,INDEX,name]\"}");
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(1, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ }
+
+ // Test when PK is not empty and contains a group which SK is empty
+ @Test
+ public void testVFWithEmptyGroupKeyResource() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"[emptygroup_list,INDEX,name]\"}");
+
+ VnfcResource vnfcResource = new VnfcResource();
+ vnfcResource.setResourceInput("{\"a\":\"test|default_value\"}");
+ GroupResource groupResource = new GroupResource();
+ groupResource.setVnfcs(Arrays.asList(vnfcResource));
+ ModelInfo wanModel = new ModelInfo();
+ wanModel.setModelName("wan");
+ groupResource.setModelInfo(wanModel);
+
+ vnfResource.setGroupOrder("wan");
+ vnfResource.setGroups(Arrays.asList(groupResource));
+
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(2, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
+ Assert.assertEquals("wan", instanceResourceList.get(1).getModelInfo().getModelName());
+ }
+
+ private VnfResource createResourceSequence() {
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"[sdwansiteresource_list,INDEX,sdwansiteresource_list]\"}");
+
+ VnfcResource vnfcResource = new VnfcResource();
+ vnfcResource.setResourceInput("{\"a\":\"[sdwansitewan_list,INDEX,test]\"}");
+
+ GroupResource groupResource = new GroupResource();
+ groupResource.setVnfcs(Arrays.asList(vnfcResource));
+ ModelInfo wanModel = new ModelInfo();
+ wanModel.setModelName("sitewan");
+ groupResource.setModelInfo(wanModel);
+
+ VnfcResource vnfcDeviceResource = new VnfcResource();
+ vnfcDeviceResource.setResourceInput("{\"a\":\"[sdwandevice_list,INDEX,test]\"}");
+ GroupResource groupResource2 = new GroupResource();
+ groupResource2.setVnfcs(Arrays.asList(vnfcDeviceResource));
+ ModelInfo deviceModel = new ModelInfo();
+ deviceModel.setModelName("device");
+ groupResource2.setModelInfo(deviceModel);
+
+ vnfResource.setGroupOrder("device,sitewan");
+ vnfResource.setGroups(Arrays.asList(groupResource, groupResource2));
+ return vnfResource;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
index c7c181744f..557ae6df51 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
@@ -19,232 +19,93 @@
*/
package org.onap.so.bpmn.common.resource;
+import java.util.ArrayList;
+import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.onap.so.BaseTest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.bpmn.core.domain.GroupResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ResourceType;
+import org.onap.so.bpmn.core.domain.VnfResource;
+import org.onap.so.bpmn.core.domain.VnfcResource;
+import org.onap.so.bpmn.mock.FileUtil;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.ok;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.junit.Assert.assertEquals;
-
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
public class ResourceRequestBuilderTest extends BaseTest {
- @Test
- public void getResourceInputTest() throws Exception {
+ private Map<String, Object> userInputMap = null;
+ private Map<String, Object> serviceInput = null;
+ @Before
+ public void initializeMockObjects() {
- wireMockServer.stubFor(get(urlEqualTo(
- "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
- + "\t\t\"modelName\" : \"demoVFWCL\",\n"
- + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
- + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
- + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
- + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
- + "\t\"environmentContext\" : null,\n" + "\t\"resourceOrder\" : \"res1,res2\",\n"
- + "\t\"workloadContext\" : \"Production\",\n" + "\t\"serviceVnfs\": [\n" + "\t\n"
- + "\t\t{ \"modelInfo\" : {\n"
- + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n"
- + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n"
- + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n"
- + "\t\t\t\"modelVersion\" : \"1.0\",\n"
- + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n"
- + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n"
- + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
- + "\t\t\"nfFunction\" \t: null,\n"
- + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\","
- + "\t\t\"nfType\" \t\t: null,\n"
- + "\t\t\"nfRole\" \t\t: null,\n"
- + "\t\t\"nfNamingCode\" \t: null,\n"
- + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
- + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
- + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n"
- + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n"
- + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n"
- + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
- + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n"
- + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
- + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n"
- + "\t\t\t\t\t\"initialCount\" : 1,\n"
- + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
- + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
- + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n"
- + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n"
- + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n"
- + "\t\t\t\"modelVersion\" : \"1.0\",\n"
- + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n"
- + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
- + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
- + "\t\t\"nfFunction\" \t: null,\n"
- + "\t\t\"nfType\" \t\t: null,\n"
- + "\t\t\"nfRole\" \t\t: null,\n"
- + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\","
- + "\t\t\"nfNamingCode\" \t: null,\n"
- + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
- + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
- + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n"
- + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n"
- + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n"
- + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
- + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n"
- + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
- + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n"
- + "\t\t\t\t\t\"initialCount\" : 1,\n"
- + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
- + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n"
- + "\t\"serviceAllottedResources\": []\n" + "\t}}")));
+ if (null == this.userInputMap) {
+ ObjectMapper mapper = new ObjectMapper();
- // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
+ try {
+ String serviceInputRequest = FileUtil.readResourceFile("__files/UUI-SO-REQ.json");
+ this.userInputMap = mapper.readValue(serviceInputRequest, new TypeReference<Map<String, Object>>() {});
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ if (null == this.serviceInput) {
+
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ String serviceInputRequest = FileUtil.readResourceFile("__files/SERVICE-SO-REQ-INPUT.json");
+ this.serviceInput = mapper.readValue(serviceInputRequest, new TypeReference<Map<String, Object>>() {});
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ }
+
+ @Test
+ public void getResourceInputTest() throws Exception {
+
+ VnfResource resource = new VnfResource();
+ resource.setResourceType(ResourceType.VNF);
+ resource.setResourceInput("{\"a\":\"key|default_value\"}");
HashMap serviceInput = new HashMap();
serviceInput.put("key", "value");
- Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null);
assertEquals(stringObjectMap.get("a"), "value");
}
@Test
public void getResourceInputDefaultValueTest() throws Exception {
-
- wireMockServer.stubFor(get(urlEqualTo(
- "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
- + "\t\t\"modelName\" : \"demoVFWCL\",\n"
- + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
- + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
- + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
- + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
- + "\t\"environmentContext\" : null,\n" + "\t\"workloadContext\" : \"Production\",\n"
- + "\t\"serviceVnfs\": [\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
- + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n"
- + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n"
- + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n"
- + "\t\t\t\"modelVersion\" : \"1.0\",\n"
- + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n"
- + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n"
- + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
- + "\t\t\"nfFunction\" \t: null,\n"
- + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\","
- + "\t\t\"nfType\" \t\t: null,\n"
- + "\t\t\"nfRole\" \t\t: null,\n"
- + "\t\t\"nfNamingCode\" \t: null,\n"
- + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
- + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
- + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n"
- + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n"
- + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n"
- + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
- + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n"
- + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
- + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n"
- + "\t\t\t\t\t\"initialCount\" : 1,\n"
- + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
- + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
- + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n"
- + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n"
- + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n"
- + "\t\t\t\"modelVersion\" : \"1.0\",\n"
- + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n"
- + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
- + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
- + "\t\t\"nfFunction\" \t: null,\n"
- + "\t\t\"nfType\" \t\t: null,\n"
- + "\t\t\"nfRole\" \t\t: null,\n"
- + "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\","
- + "\t\t\"nfNamingCode\" \t: null,\n"
- + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
- + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
- + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n"
- + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n"
- + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n"
- + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
- + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n"
- + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
- + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n"
- + "\t\t\t\t\t\"initialCount\" : 1,\n"
- + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
- + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n"
- + "\t\"serviceAllottedResources\": []\n" + "\t}}")));
-
- // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
+ VnfResource resource = new VnfResource();
+ resource.setResourceType(ResourceType.VNF);
+ resource.setResourceInput("{\"a\":\"key|default_value\"}");
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
- Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null);
assertEquals(stringObjectMap.get("a"), "default_value");
}
@Test
public void getResourceInputValueNoDefaultTest() throws Exception {
-
- wireMockServer.stubFor(get(urlEqualTo(
- "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
- + "\t\t\"modelName\" : \"demoVFWCL\",\n"
- + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
- + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
- + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
- + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
- + "\t\"environmentContext\" : null,\n" + "\t\"workloadContext\" : \"Production\",\n"
- + "\t\"serviceVnfs\": [\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
- + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n"
- + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n"
- + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n"
- + "\t\t\t\"modelVersion\" : \"1.0\",\n"
- + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n"
- + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n"
- + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
- + "\t\t\"nfFunction\" \t: null,\n"
- + "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\","
- + "\t\t\"nfType\" \t\t: null,\n"
- + "\t\t\"nfRole\" \t\t: null,\n"
- + "\t\t\"nfNamingCode\" \t: null,\n"
- + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
- + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
- + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n"
- + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n"
- + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n"
- + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
- + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n"
- + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
- + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n"
- + "\t\t\t\t\t\"initialCount\" : 1,\n"
- + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
- + "\t\t},\n" + "\t\n" + "\t\t{ \"modelInfo\" : {\n"
- + "\t\t\t\"modelName\" : \"f971106a-248f-4202-9d1f\",\n"
- + "\t\t\t\"modelUuid\" : \"4fbc08a4-35ed-4a59-9e47-79975e4add7e\",\n"
- + "\t\t\t\"modelInvariantUuid\" : \"c669799e-adf1-46ae-8c70-48b326fe89f3\",\n"
- + "\t\t\t\"modelVersion\" : \"1.0\",\n"
- + "\t\t\t\"modelCustomizationUuid\" : \"e776449e-2b10-45c5-9217-2775c88ca1a0\",\n"
- + "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
- + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
- + "\t\t\"nfFunction\" \t: null,\n"
- + "\t\t\"nfType\" \t\t: null,\n"
- + "\t\t\"nfRole\" \t\t: null,\n"
- + "\"resourceInput\":\"{\\\"a\\\":\\\"value\\\"}\","
- + "\t\t\"nfNamingCode\" \t: null,\n"
- + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
- + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
- + "\t\t\t\t\t\t\"modelName\" : \"F971106a248f42029d1f..base_vpkg..module-0\",\n"
- + "\t\t\t\t\t\t\"modelUuid\" : \"47d5273a-7456-4786-9035-b3911944cc35\",\n"
- + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"0ea3e57e-ac7a-425a-928b-b4aee8806c15\",\n"
- + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
- + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"9ed9fef6-d3f8-4433-9807-7e23393a16bc\"\n"
- + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
- + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vpkg\",\n"
- + "\t\t\t\t\t\"initialCount\" : 1,\n"
- + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
- + "\t\t}\n" + "\t],\n" + "\t\"serviceNetworks\": [],\n"
- + "\t\"serviceAllottedResources\": []\n" + "\t}}")));
-
- // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
+ VnfResource resource = new VnfResource();
+ resource.setResourceType(ResourceType.VNF);
+ resource.setResourceInput("{\"a\":\"value\"}");
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
- Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null);
assertEquals(stringObjectMap.get("a"), "value");
}
@@ -322,68 +183,138 @@ public class ResourceRequestBuilderTest extends BaseTest {
@Test
public void getResourceInputWithEmptyServiceResourcesTest() throws Exception {
- wireMockServer.stubFor(get(urlEqualTo(
- "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
- + "\t\t\"modelName\" : \"demoVFWCL\",\n"
- + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
- + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
- + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
- + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
- + "\t\"environmentContext\" : null,\n" + "\t\"workloadContext\" : \"Production\",\n"
- + "\t\"serviceVnfs\": [], \n" + "\t\"serviceNetworks\": [],\n"
- + "\t\"serviceAllottedResources\": []\n" + "\t}}")));
+ VnfResource resource = new VnfResource();
+ resource.setResourceType(ResourceType.VNF);
+ resource.setResourceInput(null);
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
- Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null);
assertEquals(0, stringObjectMap.size());
}
@Test
public void testGetResourceInputEmptyValue() {
- wireMockServer.stubFor(get(urlEqualTo(
- "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
- .willReturn(ok("{ \"serviceResources\" : {\n" + "\t\"modelInfo\" : {\n"
- + "\t\t\"modelName\" : \"demoVFWCL\",\n"
- + "\t\t\"modelUuid\" : \"c3954379-4efe-431c-8258-f84905b158e5\",\n"
- + "\t\t\"modelInvariantUuid\" : \"0cbff61e-3b0a-4eed-97ce-b1b4faa03493\",\n"
- + "\t\t\"modelVersion\" : \"1.0\"\n" + "\t},\n"
- + "\t\"serviceType\" : \"\",\n" + "\t\"serviceRole\" : \"\",\n"
- + "\t\"environmentContext\" : null,\n" + "\t\"resourceOrder\" : \"res1,res2\",\n"
- + "\t\"workloadContext\" : \"Production\",\n" + "\t\"serviceVnfs\": [\n" + "\t\n"
- + "\t\t{ \"modelInfo\" : {\n"
- + "\t\t\t\"modelName\" : \"15968a6e-2fe5-41bf-a481\",\n"
- + "\t\t\t\"modelUuid\" : \"808abda3-2023-4105-92d2-e62644b61d53\",\n"
- + "\t\t\t\"modelInvariantUuid\" : \"6e4ffc7c-497e-4a77-970d-af966e642d31\",\n"
- + "\t\t\t\"modelVersion\" : \"1.0\",\n"
- + "\t\t\t\"modelCustomizationUuid\" : \"a00404d5-d7eb-4c46-b6b6-9cf2d087e545\",\n"
- + "\t\t\t\"modelInstanceName\" : \"15968a6e-2fe5-41bf-a481 0\"\n" + "\t\t\t},\n"
- + "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
- + "\t\t\"nfFunction\" \t: null,\n"
- + "\"resourceInput\":\"{\\\"a\\\":\\\"key1|\\\"}\","
- + "\t\t\"nfType\" \t\t: null,\n"
- + "\t\t\"nfRole\" \t\t: null,\n"
- + "\t\t\"nfNamingCode\" \t: null,\n"
- + "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
- + "\t\t\t\t{\n" + "\t\t\t\t\t\"modelInfo\" : { \n"
- + "\t\t\t\t\t\t\"modelName\" : \"15968a6e2fe541bfA481..base_vfw..module-0\",\n"
- + "\t\t\t\t\t\t\"modelUuid\" : \"ec7fadde-1e5a-42f7-8255-cb19e475ff45\",\n"
- + "\t\t\t\t\t\t\"modelInvariantUuid\" : \"61ab8b64-a014-4cf3-8a5a-b5ef388f8819\",\n"
- + "\t\t\t\t\t\t\"modelVersion\" : \"1\",\n"
- + "\t\t\t\t\t\t\"modelCustomizationUuid\" : \"123aff6b-854f-4026-ae1e-cc74a3924576\"\n"
- + "\t\t\t\t\t},\t\t\"isBase\" : true,\n"
- + "\t\t\t\t\t\"vfModuleLabel\" : \"base_vfw\",\n"
- + "\t\t\t\t\t\"initialCount\" : 1,\n"
- + "\t\t\t\t\t\"hasVolumeGroup\" : true\n" + "\t\t\t\t}\n" + "\t\t\t]\n"
- + "\t\t}]}}")));
+
+ VnfResource resource = new VnfResource();
+ resource.setResourceType(ResourceType.VNF);
+ resource.setResourceInput("{\"a\":\"key1|\"}");
HashMap serviceInput = new HashMap();
serviceInput.put("key2", "value");
- Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", serviceInput);
+ Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null);
assertEquals(stringObjectMap.get("a"), "");
}
+ @Test
+ public void getListResourceInputTest() throws Exception {
+
+ List<Map> vnfdata = null;
+
+ List<Resource> resources = new ArrayList<>();
+ if (this.serviceInput.containsKey("serviceResources")) {
+ vnfdata = (List<Map>) ((Map) this.serviceInput.get("serviceResources")).get("serviceVnfs");
+ }
+ assertNotNull(vnfdata);
+ vnfdata.forEach(e -> {
+ if (e.get("resourceType").equals("VNF")) {
+ VnfResource r = new VnfResource();
+ r.setResourceInput(e.get("resourceInput").toString());
+ resources.add(r);
+ } else if (e.get("resourceType").equals("GROUP")) {
+ GroupResource r = new GroupResource();
+ VnfcResource vfc = new VnfcResource();
+ vfc.setResourceInput(e.get("resourceInput").toString());
+ List<VnfcResource> vfcList = new ArrayList();
+ vfcList.add(vfc);
+ r.setVnfcs(vfcList);
+ resources.add(r);
+ }
+ });
+
+ assertEquals(9, resources.size());
+
+ // VF level request
+ Map<String, Object> currentVFData = new HashMap<>();
+ Map<String, Object> stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest(resources.get(0), this.userInputMap, currentVFData);
+ assertEquals("b", stringObjectMap.get("a"));
+ assertEquals("hub_spoke", stringObjectMap.get("topology"));
+ assertEquals("defaultvpn", stringObjectMap.get("name"));
+ assertTrue(((String) stringObjectMap.get("sitelist")).contains("["));
+
+ // vfc level request
+ stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest(resources.get(1), this.userInputMap, currentVFData);
+ assertEquals("", stringObjectMap.get("a"));
+ assertEquals("layer3-port", stringObjectMap.get("portswitch"));
+ assertEquals("192.168.10.1", stringObjectMap.get("ipAddress"));
+ assertEquals("vCPE", stringObjectMap.get("deviceName"));
+
+ // vfc level request
+ stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest(resources.get(2), this.userInputMap, currentVFData);
+ assertEquals("", stringObjectMap.get("a"));
+ assertEquals("layer2-port", stringObjectMap.get("portswitch"));
+ assertEquals("192.168.11.1", stringObjectMap.get("ipAddress"));
+ assertEquals("CPE_Beijing", stringObjectMap.get("deviceName"));
+
+ // VF level request
+ stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest(resources.get(3), this.userInputMap, currentVFData);
+ assertEquals("Huawei Private Cloud", stringObjectMap.get("address"));
+ assertEquals("dsvpn_hub1", stringObjectMap.get("role"));
+ assertTrue(((String) stringObjectMap.get("wanlist")).contains("["));
+ assertTrue(((String) stringObjectMap.get("devlist")).contains("["));
+
+ // VFC request
+ stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest(resources.get(4), this.userInputMap, currentVFData);
+ assertEquals("Huawei Private Cloud", stringObjectMap.get("address"));
+ assertEquals("20000", stringObjectMap.get("postcode"));
+ assertEquals("single_gateway", stringObjectMap.get("type"));
+ assertEquals("vCPE", stringObjectMap.get("deviceName"));
+ assertEquals("DHCP", stringObjectMap.get("ipMode"));
+
+ // VFC request again
+ stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest(resources.get(5), this.userInputMap, currentVFData);
+ assertEquals("Huawei Private Cloud", stringObjectMap.get("address"));
+ assertEquals("20000", stringObjectMap.get("postcode"));
+ assertEquals("single_gateway", stringObjectMap.get("type"));
+ assertEquals("20.20.20.1", stringObjectMap.get("systemip"));
+ assertEquals("default_ipv6", stringObjectMap.get("systemipv6"));
+ assertEquals("VNF", stringObjectMap.get("devclass"));
+
+ // VF level request
+ stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest(resources.get(6), this.userInputMap, currentVFData);
+ assertEquals("Huawei Public Cloud", stringObjectMap.get("address"));
+ assertEquals("dsvpn_hub", stringObjectMap.get("role"));
+ assertTrue(((String) stringObjectMap.get("wanlist")).contains("["));
+ assertTrue(((String) stringObjectMap.get("devlist")).contains("["));
+
+ // VFC request
+ stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest(resources.get(7), this.userInputMap, currentVFData);
+ assertEquals("Huawei Public Cloud", stringObjectMap.get("address"));
+ assertEquals("20001", stringObjectMap.get("postcode"));
+ assertEquals("multiple_gateway", stringObjectMap.get("type"));
+ assertEquals("CPE_Beijing", stringObjectMap.get("deviceName"));
+ assertEquals("Static", stringObjectMap.get("ipMode"));
+
+ // VFC request again
+ stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest(resources.get(8), this.userInputMap, currentVFData);
+ assertEquals("Huawei Public Cloud", stringObjectMap.get("address"));
+ assertEquals("20001", stringObjectMap.get("postcode"));
+ assertEquals("multiple_gateway", stringObjectMap.get("type"));
+ assertEquals("20.20.20.2", stringObjectMap.get("systemip"));
+ assertEquals("default_ipv6", stringObjectMap.get("systemipv6"));
+ assertEquals("PNF", stringObjectMap.get("devclass"));
+
+
+ }
+
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java
deleted file mode 100644
index 273e9f0e3c..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/util/CryptoHandlerTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.common.util;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-public class CryptoHandlerTest {
- private static final String plainPswd = "mso0206";
- private CryptoHandler cryptoHandler;
- private static String encryptPwd;
-
-
- @Before
- public void setup() {
- cryptoHandler = new CryptoHandler();
- encryptPwd = cryptoHandler.encryptMsoPassword(plainPswd);
- }
-
- @Test
- @Ignore // ignored until we can mock the properties file.
- public void getMsoAaiPasswordTest() {
- assertEquals(plainPswd, cryptoHandler.getMsoAaiPassword());
- }
-
- @Test
- public void encryptMsoPasswordTest() {
- assertEquals(plainPswd, cryptoHandler.decryptMsoPassword(cryptoHandler.encryptMsoPassword(plainPswd)));
- }
-
- @Test
- public void decryptMsoPasswordTest() {
- assertEquals(plainPswd, cryptoHandler.decryptMsoPassword(encryptPwd));
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapperTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapperTest.java
new file mode 100644
index 0000000000..fa8de7ff23
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/bbobjects/wrappers/ServiceInstanceWrapperTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.wrappers.exceptions.ServiceProxyNotFoundException;
+
+public class ServiceInstanceWrapperTest {
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void getTransportServiceProxyTest() throws ServiceProxyNotFoundException {
+ ServiceInstance si = buildServiceInstance();
+ si.getServiceProxies().add(buildServiceProxy());
+ ServiceInstanceWrapper sw = new ServiceInstanceWrapper(si);
+ ServiceProxy sp = sw.getTransportServiceProxy();
+ assertEquals("sp-001", sp.getId());
+ assertEquals("transport", sp.getType());
+ }
+
+ @Test
+ public void getTransportServiceProxyExceptionTest() throws ServiceProxyNotFoundException {
+ expectedException.expect(ServiceProxyNotFoundException.class);
+ ServiceInstanceWrapper sw = new ServiceInstanceWrapper(buildServiceInstance());
+ sw.getTransportServiceProxy();
+ }
+
+ private ServiceInstance buildServiceInstance() {
+ ServiceInstance si = new ServiceInstance();
+ si.setServiceInstanceId("si-001");
+ si.setServiceInstanceName("Test SI");
+ return si;
+ }
+
+ private ServiceProxy buildServiceProxy() {
+ ServiceProxy sp = new ServiceProxy();
+ sp.setId("sp-001");
+ sp.setType("transport");
+ return sp;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
index 39650a2142..13d2b7d3d3 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
@@ -398,10 +398,12 @@ public class BBInputSetupMapperLayerTest {
@Test
public void testMapAAIL3NetworkIntoL3Network() throws IOException {
- L3Network expected = mapper.readValue(new File(RESOURCE_PATH + "l3NetworkExpected.json"), L3Network.class);
+ L3Network expected =
+ mapper.readValue(new File(RESOURCE_PATH + "l3NetworkExpectedWithSubnet.json"), L3Network.class);
- org.onap.aai.domain.yang.L3Network aaiL3Network = mapper.readValue(
- new File(RESOURCE_PATH + "aaiL3NetworkInput.json"), org.onap.aai.domain.yang.L3Network.class);
+ org.onap.aai.domain.yang.L3Network aaiL3Network =
+ mapper.readValue(new File(RESOURCE_PATH + "aaiL3NetworkInputWithSubnets.json"),
+ org.onap.aai.domain.yang.L3Network.class);
L3Network actual = bbInputSetupMapperLayer.mapAAIL3Network(aaiL3Network);
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 ad1918e6da..7c136cdee9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -65,6 +65,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
@@ -82,6 +83,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
@@ -94,14 +96,15 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.InstanceGroupType;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
@@ -1231,19 +1234,19 @@ public class BBInputSetupTest {
configResourceKeys.setVnfcName(vnfcName);
Vnfc vnfc = new Vnfc();
vnfc.setVnfcName(vnfcName);
-
+ RequestDetails requestDetails = new RequestDetails();
doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
@@ -1255,7 +1258,7 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service,
configResourceKeys);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service,
configResourceKeys);
}
@@ -1291,6 +1294,7 @@ public class BBInputSetupTest {
Configuration configuration = new Configuration();
configuration.setConfigurationId("configurationId");
configuration.setConfigurationName("configurationName");
+ configuration.setConfigurationSubType("Fabric Config");
serviceInstance.getConfigurations().add(configuration);
String resourceId = "configurationId";
String vnfcName = "vnfcName";
@@ -1307,6 +1311,7 @@ public class BBInputSetupTest {
configResourceKeys.setVnfcName(vnfcName);
Vnfc vnfc = new Vnfc();
vnfc.setVnfcName(vnfcName);
+ RequestDetails requestDetails = new RequestDetails();
CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
new CvnfcConfigurationCustomization();
@@ -1319,7 +1324,7 @@ public class BBInputSetupTest {
doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName, configResourceKeys);
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
}
@@ -1972,14 +1977,119 @@ public class BBInputSetupTest {
configurationCustList.add(configurationCust);
doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
- isA(ConfigurationResourceKeys.class));
+ isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
- isA(ConfigurationResourceKeys.class));
+ isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+
+
+ }
+
+ @Test
+ public void testGBBMacroNoUserParamsVrfConfiguration() throws Exception {
+ GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"),
+ GeneralBuildingBlock.class);
+ ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
+ ExecuteBuildingBlock.class);
+ RequestDetails requestDetails = mapper
+ .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacroVrf.json"), RequestDetails.class);
+ InfraActiveRequests request = Mockito.mock(InfraActiveRequests.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId");
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+ String resourceId = "123";
+ String vnfType = "vnfType";
+ Service service = Mockito.mock(Service.class);
+ String requestAction = "createInstance";
+
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
+
+ executeBB.setRequestDetails(requestDetails);
+ doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
+
+ RelatedInstance relatedVpnBinding = new RelatedInstance();
+ relatedVpnBinding.setInstanceId("vpnBindingInstanceId");
+ RelatedInstance relatedLocalNetwork = new RelatedInstance();
+ relatedLocalNetwork.setInstanceId("localNetworkInstanceId");
+ org.onap.aai.domain.yang.VpnBinding aaiVpnBinding = new org.onap.aai.domain.yang.VpnBinding();
+ aaiVpnBinding.setVpnId("vpnBindingId");
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork = new org.onap.aai.domain.yang.L3Network();
+ aaiLocalNetwork.setNetworkId("localNetworkId");
+ Optional<org.onap.aai.domain.yang.VpnBinding> aaiAICVpnBindingOp =
+ Optional.of(new org.onap.aai.domain.yang.VpnBinding());
+ aaiAICVpnBindingOp.get().setVpnId("AICVpnBindingId");
+ ServiceProxy proxy = new ServiceProxy();
+ proxy.setType("transport");
+ proxy.setServiceInstance(new ServiceInstance());
+ proxy.getServiceInstance().setModelInfoServiceInstance(new ModelInfoServiceInstance());
+ proxy.getServiceInstance().getModelInfoServiceInstance().setModelUuid("sourceServiceModelUUID");
+ doReturn(relatedVpnBinding).when(SPY_bbInputSetupUtils).getRelatedInstanceByType(requestDetails,
+ ModelType.vpnBinding);
+ doReturn(relatedLocalNetwork).when(SPY_bbInputSetupUtils).getRelatedInstanceByType(requestDetails,
+ ModelType.network);
+ doReturn(aaiVpnBinding).when(SPY_bbInputSetupUtils).getAAIVpnBinding(relatedVpnBinding.getInstanceId());
+ doReturn(aaiLocalNetwork).when(SPY_bbInputSetupUtils).getAAIL3Network(relatedLocalNetwork.getInstanceId());
+ doReturn(aaiAICVpnBindingOp).when(SPY_bbInputSetupUtils).getAICVpnBindingFromNetwork(aaiLocalNetwork);
+ doReturn(proxy).when(SPY_bbInputSetup).getServiceProxy(service);
+
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("configurationId");
+ gBB.getServiceInstance().getConfigurations().add(configuration);
+ List<ConfigurationResourceCustomization> configurationCustList = new ArrayList<>();
+ ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization();
+ configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+ configurationCustList.add(configurationCust);
+ doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
+ isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+
+ executeBB.getBuildingBlock().setBpmnFlowName("AssignVrfConfigurationBB");
+ executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+ gBB = SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
+ verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
+ isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+ assertEquals(gBB.getCustomer().getVpnBindings().get(0).getVpnId(), "vpnBindingId");
+ assertEquals(gBB.getServiceInstance().getNetworks().get(0).getNetworkId(), "localNetworkId");
+ assertEquals(gBB.getServiceInstance().getNetworks().get(0).getVpnBindings().get(0).getVpnId(),
+ "AICVpnBindingId");
+ assertEquals(gBB.getServiceInstance().getServiceProxies().get(0).getType(), "transport");
+ }
+
+ @Test
+ public void testGetServiceProxy() {
+ ServiceProxy expected = new ServiceProxy();
+ expected.setType("TRANSPORT");
+ expected.setModelInfoServiceProxy(new ModelInfoServiceProxy());
+ expected.getModelInfoServiceProxy().setModelUuid("modelUUID");
+ expected.getModelInfoServiceProxy().setModelInstanceName("modelInstanceName");
+ expected.setServiceInstance(new ServiceInstance());
+ expected.getServiceInstance().setModelInfoServiceInstance(new ModelInfoServiceInstance());
+ expected.getServiceInstance().getModelInfoServiceInstance().setModelUuid("modelUUID");
+ expected.getServiceInstance().getModelInfoServiceInstance().setServiceType("TRANSPORT");
+ Service service = new Service();
+ ServiceProxyResourceCustomization serviceProxyCatalog = new ServiceProxyResourceCustomization();
+ serviceProxyCatalog.setModelCustomizationUUID("modelCustomizationUUID");
+ serviceProxyCatalog.setModelInstanceName("modelInstanceName");
+ Service sourceService = new Service();
+ sourceService.setModelUUID("modelUUID");
+ sourceService.setServiceType("TRANSPORT");
+ serviceProxyCatalog.setSourceService(sourceService);
+ service.setServiceProxyCustomizations(new ArrayList<ServiceProxyResourceCustomization>());
+ service.getServiceProxyCustomizations().add(serviceProxyCatalog);
+ ServiceProxy actual = SPY_bbInputSetup.getServiceProxy(service);
+ assertThat(actual, sameBeanAs(expected));
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
index 25135a0254..7780837714 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
@@ -25,6 +25,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
@@ -46,6 +47,7 @@ import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.Configuration;
+import org.onap.aai.domain.yang.Configurations;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.L3Network;
@@ -57,6 +59,7 @@ import org.onap.aai.domain.yang.VolumeGroups;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
import org.onap.so.client.aai.AAIObjectPlurals;
@@ -70,6 +73,7 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
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.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
@@ -832,4 +836,46 @@ public class BBInputSetupUtilsTest {
assertEquals(actualVolumeGroup, Optional.empty());
}
+
+ @Test
+ public void loadOriginalFlowExecutionPathTest() throws Exception {
+
+ String requestId = "123";
+ String flowsToExecuteString =
+ "[{\"buildingBlock\":{\"mso-id\":\"2f9ddc4b-4dcf-4129-a35f-be1625ae0176\",\"bpmn-flow-name\":\"DeactivateFabricConfigurationBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":{\"vfModuleCustomizationUUID\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"vnfResourceCustomizationUUID\":\"a80f05b8-d651-44af-b999-8ed78fb4582f\",\"cvnfcCustomizationUUID\":\"69cce457-9ffd-4359-962b-0596a1e83ad1\",\"vnfcName\":\"zauk51bmcmr01mcm001\"}},{\"buildingBlock\":{\"mso-id\":\"1ca5584e-38a9-4c3f-a4b4-99b0d42089ba\",\"bpmn-flow-name\":\"UnassignFabricConfigurationBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":{\"vfModuleCustomizationUUID\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"vnfResourceCustomizationUUID\":\"a80f05b8-d651-44af-b999-8ed78fb4582f\",\"cvnfcCustomizationUUID\":\"69cce457-9ffd-4359-962b-0596a1e83ad1\",\"vnfcName\":\"zauk51bmcmr01mcm001\"}},{\"buildingBlock\":{\"mso-id\":\"68d16097-4810-477d-803b-8322106106ef\",\"bpmn-flow-name\":\"DeactivateVfModuleBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":null},{\"buildingBlock\":{\"mso-id\":\"0b02eb09-bc23-4329-b19e-716dcca4e4a6\",\"bpmn-flow-name\":\"DeleteVfModuleBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":null},{\"buildingBlock\":{\"mso-id\":\"bcf95d05-0782-44ff-920d-d5100525c275\",\"bpmn-flow-name\":\"UnassignVfModuleBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":null}]";
+ ObjectMapper om = new ObjectMapper();
+ List<ExecuteBuildingBlock> expectedFlowsToExecute = null;
+ try {
+ ExecuteBuildingBlock[] asArray = om.readValue(flowsToExecuteString, ExecuteBuildingBlock[].class);
+ expectedFlowsToExecute = Arrays.asList(asArray);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ request.setOriginalRequestId("originalRequestId");
+ doReturn(request).when(MOCK_requestsDbClient).getInfraActiveRequestbyRequestId(anyString());
+ RequestProcessingData rpd = new RequestProcessingData();
+ rpd.setValue(flowsToExecuteString);
+ doReturn(rpd).when(MOCK_requestsDbClient).getRequestProcessingDataBySoRequestIdAndName(anyString(),
+ anyString());
+
+ List<ExecuteBuildingBlock> flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
+ assertEquals(expectedFlowsToExecute.size(), flowsToExecute.size());
+ }
+
+ @Test
+ public void getRelatedConfigurationByNameFromServiceInstanceTest() throws Exception {
+ Optional<Configurations> expected = Optional.of(new Configurations());
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("id123");
+ expected.get().getConfiguration().add(configuration);
+ doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(Configurations.class), any(AAIResourceUri.class));
+ Optional<Configuration> actual =
+ this.bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("id123", "name123");
+ assertEquals(actual.get().getConfigurationId(), expected.get().getConfiguration().get(0).getConfigurationId());
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
new file mode 100644
index 0000000000..6a48558d11
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.servicedecomposition.tasks;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.utils.TargetEntity;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ExecuteBuildingBlockRainyDayUnitTest {
+
+ @Mock
+ private RequestsDbClient requestsDbClient;
+
+ @InjectMocks
+ @Spy
+ private ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay;
+
+ private DelegateExecution execution;
+ private DelegateExecution executionNullisRollback;
+ private String msoRequestId = "ef7c004b-829f-4773-a7d8-4de29feef5b1";
+ private InfraActiveRequests request = new InfraActiveRequests();
+ private WorkflowException exception;
+ private WorkflowException noExtSystemErrorSourceException;
+
+ @Before
+ public void setup() {
+ exception = new WorkflowException("Test exception", 7000, "", "", TargetEntity.SDNC);
+ noExtSystemErrorSourceException =
+ new WorkflowException("Test exception without extsystemErrorSource", 7000, "", "");
+
+ execution = new DelegateExecutionFake();
+ execution.setVariable("mso-request-id", "ef7c004b-829f-4773-a7d8-4de29feef5b1");
+
+ executionNullisRollback = new DelegateExecutionFake();
+ executionNullisRollback.setVariable("mso-request-id", "ef7c004b-829f-4773-a7d8-4de29feef5b1");
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("WorkflowException", exception);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
+ request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceisRollbackTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ execution.setVariable("isRollback", true);
+ execution.setVariable("WorkflowException", exception);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
+ request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceisRollbackTargetEntityNullTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ execution.setVariable("isRollback", true);
+ execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
+ request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceTargetEntityNullTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
+ request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+
+ @Test
+ public void updateExtSystemErrorSourceTargetEntityisRollbackNullTest() {
+ doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
+ executionNullisRollback.setVariable("WorkflowException", exception);
+ executeBuildingBlockRainyDay.updateExtSystemErrorSource(executionNullisRollback);
+ request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+
+ verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index e8d597a823..18e08917ed 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -38,6 +38,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.springframework.beans.factory.annotation.Autowired;
@@ -68,6 +69,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
delegateExecution.setVariable("WorkflowException", new WorkflowException("", 7000, ""));
delegateExecution.setVariable("buildingBlock", executeBuildingBlock);
delegateExecution.setVariable("lookupKeyMap", lookupKeyMap);
+
+ delegateExecution.setVariable("WorkflowException", new WorkflowException("processKey", 7000, "errorMessage"));
}
@Test
@@ -101,12 +104,10 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setPolicy("Rollback");
rainyDayHandlerStatus.setWorkStep(ASTERISK);
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
-
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
}
@@ -126,15 +127,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setPolicy("Rollback");
rainyDayHandlerStatus.setWorkStep(ASTERISK);
- doReturn(null).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", ASTERISK);
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", ASTERISK, ASTERISK, ASTERISK, ASTERISK);
-
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
-
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
assertEquals(5, delegateExecution.getVariable("maxRetries"));
}
@@ -145,9 +140,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
vnf.setVnfType("vnft1");
delegateExecution.setVariable("aLaCarte", true);
- doReturn(null).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class),
- isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ doReturn(null).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class), isA(String.class),
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class));
delegateExecution.setVariable("suppressRollback", false);
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
@@ -157,9 +151,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
@Test
public void queryRainyDayTableExceptionTest() {
- doThrow(RuntimeException.class).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(isA(String.class),
- isA(String.class), isA(String.class), isA(String.class), isA(String.class));
+ doThrow(RuntimeException.class).when(MOCK_catalogDbClient).getRainyDayHandlerStatus(isA(String.class),
+ isA(String.class), isA(String.class), isA(String.class), isA(String.class), isA(String.class),
+ isA(String.class));
delegateExecution.setVariable("aLaCarte", true);
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
delegateExecution.setVariable("suppressRollback", false);
@@ -184,9 +178,8 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, false);
@@ -210,13 +203,13 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ assertEquals(Status.ROLLED_BACK.toString(), delegateExecution.getVariable("rollbackTargetState"));
}
@Test
@@ -236,15 +229,42 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
rainyDayHandlerStatus.setWorkStep(ASTERISK);
rainyDayHandlerStatus.setSecondaryPolicy("Abort");
- doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient)
- .getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- "AssignServiceInstanceBB", "st1", "vnft1", "7000", "*");
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
assertEquals("RollbackToAssigned", delegateExecution.getVariable("handlingCode"));
+ assertEquals(Status.ROLLED_BACK_TO_ASSIGNED.toString(), delegateExecution.getVariable("rollbackTargetState"));
+ }
+
+ @Test
+ public void queryRainyDayTableRollbackToCreated() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("RollbackToCreated");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+ rainyDayHandlerStatus.setSecondaryPolicy("Abort");
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+
+ assertEquals("RollbackToCreated", delegateExecution.getVariable("handlingCode"));
+ assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState"));
}
+
@Test
public void suppressRollbackTest() throws Exception {
delegateExecution.setVariable("suppressRollback", true);
@@ -253,4 +273,52 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
}
+ @Test
+ public void queryRainyDayTableServiceRoleNotDefined() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ serviceInstance.getModelInfoServiceInstance().setServiceRole("sr1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("Rollback");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "sr1");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+ assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ }
+
+ @Test
+ public void queryRainyDayTableServiceRoleNC() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ serviceInstance.getModelInfoServiceInstance().setServiceRole("NETWORK-COLLECTION");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("ActivateServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("Abort");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "NETWORK-COLLECTION");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+ assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
index 32db3a7bf6..48c6995715 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java
@@ -481,4 +481,100 @@ public class ApplicationControllerActionTest extends BaseTest {
assertEquals(expectedErrorCode, appCAction.getErrorCode());
}
+ @Test
+ public void runAppCCommand_Snapshot_vmIdList_Empty_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", "identityUrl");
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vmId_null_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+
+ JSONObject vmIdListJson = new JSONObject();
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vserverIdList_Empty_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ ArrayList<String> vmIdList = new ArrayList<String>();
+ String vmId = "testlink:testVmId";
+ vmIdList.add(vmId);
+ JSONObject vmIdListJson = new JSONObject();
+ vmIdListJson.put("vmIds", vmIdList);
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
+
+ @Test
+ public void runAppCCommand_Snapshot_vserverId_null_Test()
+ throws ApplicationControllerOrchestratorException, JsonProcessingException {
+ Action action = Action.Snapshot;
+ String msoRequestId = "testMsoRequestId";
+ String vnfId = "testVnfId";
+ Optional<String> payload = Optional.empty();
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("identityUrl", "testIdentityUrl");
+ ArrayList<String> vmIdList = new ArrayList<String>();
+ String vmId = "testlink:testVmId1";
+ vmIdList.add(vmId);
+ JSONObject vmIdListJson = new JSONObject();
+ vmIdListJson.put("vmIds", vmIdList);
+ payloadInfo.put("vmIdList", vmIdListJson.toString());
+ JSONObject vserverIdListJson = new JSONObject();
+ payloadInfo.put("vserverIdList", vserverIdListJson.toString());
+ String controllerType = "testControllerType";
+
+ Status status = new Status();
+ Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl"));
+ doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+
+ appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java
index ef066853ca..aae62445de 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.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,17 +21,68 @@
package org.onap.so.client.exception;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
import org.junit.Test;
-import org.onap.so.bpmn.mock.FileUtil;
+import org.mockito.ArgumentMatchers;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.so.BaseTest;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.springframework.beans.BeanUtils;
+import com.fasterxml.jackson.core.JsonProcessingException;
public class ExceptionBuilderTest extends BaseTest {
private static final String RESOURCE_PATH = "__files/";
private static final String VALID_ERROR_MESSAGE = "{test error message}";
+ @Mock
+ protected ExtractPojosForBB extractPojosForBB;
+
+
+ @Spy
+ @InjectMocks
+ private ExceptionBuilder exceptionBuilder = new ExceptionBuilder();
+
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+
+ @Before
+ public void before() throws BBObjectNotFoundException, JsonProcessingException {
+ setCloudRegion();
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)))
+ .thenReturn(buildVfModule());
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ auditList.setAuditType("create");
+ auditList.setHeatStackName("testStackName");
+ AAIObjectAudit vserver = new AAIObjectAudit();
+ vserver.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+ vserver.setDoesObjectExist(false);
+ Vserver vs = new Vserver();
+ vs.setVserverId("testVServerId");
+ Vserver vServerShallow = new Vserver();
+ BeanUtils.copyProperties(vs, vServerShallow, "LInterfaces");
+ vserver.setAaiObject(vServerShallow);
+ auditList.getAuditList().add(vserver);
+
+ execution.setVariable("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditList));
+ }
+
@Test
public void buildAndThrowWorkflowExceptionTest() {
@@ -77,4 +128,35 @@ public class ExceptionBuilderTest extends BaseTest {
assertEquals("MSOWorkflowException", bpmnException.getErrorCode());
}
}
+
+ @Test
+ public void processAuditExceptionTest() {
+ try {
+ Mockito.doReturn(extractPojosForBB).when(exceptionBuilder).getExtractPojosForBB();
+ exceptionBuilder.processAuditException((DelegateExecutionImpl) execution, false);
+ } catch (BpmnError bpmnException) {
+ assertEquals("AAIInventoryFailure", bpmnException.getErrorCode());
+ WorkflowException we = execution.getVariable("WorkflowException");
+ assertNotNull(we);
+ assertEquals(
+ "create VF-Module testVfModuleId1 failed due to incomplete AAI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that the following was not created in AAI: vserver testVServerId.",
+ we.getErrorMessage());
+ }
+ }
+
+ @Test
+ public void processAuditExceptionContinueTest() {
+ try {
+ Mockito.doReturn(extractPojosForBB).when(exceptionBuilder).getExtractPojosForBB();
+ exceptionBuilder.processAuditException((DelegateExecutionImpl) execution, true);
+ String sm = execution.getVariable("StatusMessage");
+ assertNotNull(sm);
+ assertEquals(
+ "create VF-Module testVfModuleId1 failed due to incomplete AAI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that the following was not created in AAI: vserver testVServerId.",
+ sm);
+ } catch (BpmnError bpmnException) {
+ fail();
+ }
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
new file mode 100644
index 0000000000..b109ae258d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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.client.exception;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.utils.TargetEntity;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ExceptionBuilderUnitTest {
+ @Mock
+ private BuildingBlockExecution buildingBlockExecution;
+
+ @InjectMocks
+ @Spy
+ private ExceptionBuilder exceptionBuilder;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private Exception e = new Exception("failure message");
+ private DelegateExecution execution;
+
+ @Before
+ public void setup() {
+ execution = new DelegateExecutionFake();
+ }
+
+
+ @Test
+ public void buildAndThrowWorkflowExceptionTest() {
+ String expectedErrorMessage =
+ "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
+ doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
+ TargetEntity.SDNC);
+
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, TargetEntity.SDNC);
+
+ verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
+ TargetEntity.SDNC);
+ }
+
+ @Test
+ public void buildAndThrowWorkflowExceptionBuildingBlockExecutionTest() {
+ String expectedErrorMessage =
+ "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
+ doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
+ expectedErrorMessage, TargetEntity.SDNC);
+
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, TargetEntity.SDNC);
+
+ verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
+ expectedErrorMessage, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void buildAndThrowWorkflowExceptionWithErrorMessageTest() {
+ doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
+
+ thrown.expect(BpmnError.class);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json
index 1cc387aaa0..97a230a1db 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacro.json
@@ -3,7 +3,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10.0"
},
"owningEntity": {
@@ -31,7 +31,7 @@
"service": {
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacroVrf.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacroVrf.json
new file mode 100644
index 0000000000..32745e19f3
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceMacroVrf.json
@@ -0,0 +1,48 @@
+{
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "Sample Service Model",
+ "modelVersion": "10.0"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "subscriberId"
+ },
+ "requestInfo": {
+ "instanceName": "vPE_Service",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "xxxxxx"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "VMX",
+ "aLaCarte": false
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "vpnBindingId",
+ "modelInfo": {
+ "modelType": "vpnBinding"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "localNetworkId",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ }
+ ]
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json
index f458d732d2..8d03005a9e 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNetworks.json
@@ -1,7 +1,7 @@
{
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json
index 0c3d8e709e..3201ec1bc0 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroNoCloudConfig.json
@@ -1,7 +1,7 @@
{
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json
index de20a5a963..fd6f8fad6a 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json
@@ -1,7 +1,7 @@
{
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json
index c4ad0ac047..80ea6b34ec 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json
@@ -1,7 +1,7 @@
{
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceName": "vPE_Service",
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json
new file mode 100644
index 0000000000..9b32a4c446
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json
@@ -0,0 +1,83 @@
+{
+ "networkId": "networkId",
+ "networkName": "networkName",
+ "networkType": null,
+ "networkRole": null,
+ "networkTechnology": null,
+ "neutronNetworkId": null,
+ "isBoundToVpn": true,
+ "serviceId": "serviceId",
+ "networkRoleInstance": 1234,
+ "resourceVersion": null,
+ "orchestrationStatus": "Assigned",
+ "heatStackId": "heatStackId",
+ "msoCatalogKey": null,
+ "contrailNetworkFqdn": "contrailNetworkFqdn",
+ "modelInvariantId": null,
+ "modelVersionId": null,
+ "personaModelVersion": null,
+ "modelCustomizationId": null,
+ "widgetModelId": "widgetModelId",
+ "widgetModelVersion": "widgetModelVersion",
+ "physicalNetworkName": "physicalNetworkName",
+ "isProviderNetwork": true,
+ "isSharedNetwork": true,
+ "isExternalNetwork": true,
+ "selflink": "selflink",
+ "operationalStatus": "operationalStatus",
+ "subnets": {
+ "subnet": [
+ {
+ "subnetId": "subnetId",
+ "subnetName": "subnetName",
+ "neutronSubnetId": "neutronSubnetId",
+ "gatewayAddress": "10.80.12.1",
+ "networkStartAddress": "10.80.12.0",
+ "cidrMask": "23",
+ "ipVersion": "4",
+ "orchestrationStatus": "Active",
+ "dhcpEnabled": true,
+ "dhcpStart": "10.80.12.3",
+ "dhcpEnd": "10.80.13.254",
+ "subnetRole": "s1",
+ "ipAssignmentDirection": "true",
+ "resourceVersion": "1557499815393",
+ "hostRoutes": {
+ "hostRoute": [
+ {
+ "hostRouteId": "91324351-01bf-43f8-a302-8c873451b4f1",
+ "routePrefix": "10.0.0.0/16",
+ "nextHop": "10.80.12.1",
+ "resourceVersion": "1557499777501"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "ctagAssignments": {
+ "ctagAssignment": [
+ {
+ "vlanIdInner": 1234
+ }
+ ]
+ },
+ "segmentationAssignments": {
+ "segmentationAssignment": [
+ {
+ "segmentationId": "segmentationId"
+ }
+ ]
+ },
+ "aggregateRoutes": {
+ "aggregateRoute": [
+ {
+ "routeId": "routeId",
+ "networkStartAddress": "10.80.12.0",
+ "cidrMask": "23",
+ "ipVersion": "4"
+ }
+ ]
+ },
+ "relationshipList": null
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json
new file mode 100644
index 0000000000..f65fe17a2e
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json
@@ -0,0 +1,64 @@
+{
+ "network-id": "networkId",
+ "cascaded": null,
+ "cloud-params": {
+
+ },
+ "network-name": "networkName",
+ "is-bound-to-vpn": true,
+ "service-id": "serviceId",
+ "network-role-instance": 1234,
+ "orchestration-status": "ASSIGNED",
+ "heat-stack-id": "heatStackId",
+ "contrail-network-fqdn": "contrailNetworkFqdn",
+ "widget-model-id": "widgetModelId",
+ "widget-model-version": "widgetModelVersion",
+ "physical-network-name": "physicalNetworkName",
+ "is-provider-network": true,
+ "is-shared-network": true,
+ "is-external-network": true,
+ "self-link": "selflink",
+ "operational-status": "operationalStatus",
+ "subnets": [
+ {
+ "subnet-id": "subnetId",
+ "subnet-name": "subnetName",
+ "neutron-subnet-id": "neutronSubnetId",
+ "gateway-address": "10.80.12.1",
+ "network-start-address": "10.80.12.0",
+ "cidr-mask": "23",
+ "ip-version": "4",
+ "dhcp-enabled": true,
+ "dhcp-start": "10.80.12.3",
+ "dhcp-end": "10.80.13.254",
+ "subnet-role": "s1",
+ "ip-assignment-direction": "true",
+ "host-routes": [
+ {
+ "host-route-id": "91324351-01bf-43f8-a302-8c873451b4f1",
+ "route-prefix": "10.0.0.0/16",
+ "next-hop": "10.80.12.1"
+ }
+ ]
+ }
+ ],
+ "ctag-assignments": [
+ {
+ "vlan-id-inner": 1234
+ }
+ ],
+ "segmentation-assignments": [
+ {
+ "segmentation-id": "segmentationId"
+ }
+ ],
+ "aggregate-routes": [
+ {
+ "route-id": "routeId",
+ "network-start-address": "10.80.12.0",
+ "cidr-mask": "23",
+ "ip-version": "4"
+ }
+ ],
+ "model-info-network": null
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json
new file mode 100644
index 0000000000..a111ae2646
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json
@@ -0,0 +1,201 @@
+{
+ "service":{
+ "name":"SiteService",
+ "description":"SiteService",
+ "serviceInvariantUuid":"5c13f3fb-2744-4635-9f1f-c59c92dc8f70",
+ "serviceUuid":"3a76b1f5-fb0d-4b6b-82d5-0e8a4ebc3838",
+ "globalSubscriberId":"test_custormer",
+ "serviceType":"example-service-type",
+ "parameters":{
+ "locationConstraints":[
+
+ ],
+ "resources":[
+ {
+ "resourceIndex":"1",
+ "resourceName":"sdwanvpnresource",
+ "resourceInvariantUuid":"0c0e1cbe-6e01-4f9e-8c45-a9700ebc14df",
+ "resourceUuid":"4ad2d390-5c51-45f5-9710-b467a4ec7a73",
+ "resourceCustomizationUuid":"66590e07-0777-415c-af44-36347cf3ddd3",
+ "parameters":{
+ "locationConstraints":[
+
+ ],
+ "resources":[
+
+ ],
+ "requestInputs":{
+
+ }
+ }
+ },
+ {
+ "resourceIndex":"1",
+ "resourceName":"sdwansiteresource",
+ "resourceInvariantUuid":"97a3e552-08c4-4697-aeeb-d8d3e09ce58e",
+ "resourceUuid":"63d8e1af-32dc-4c71-891d-e3f7b6a976d2",
+ "resourceCustomizationUuid":"205456e7-3dc0-40c4-8cb0-28e6c1877042",
+ "parameters":{
+ "locationConstraints":[
+
+ ],
+ "resources":[
+
+ ],
+ "requestInputs":{
+
+ }
+ }
+ },
+ {
+ "resourceIndex":"2",
+ "resourceName":"sdwansiteresource",
+ "resourceInvariantUuid":"97a3e552-08c4-4697-aeeb-d8d3e09ce58e",
+ "resourceUuid":"63d8e1af-32dc-4c71-891d-e3f7b6a976d2",
+ "resourceCustomizationUuid":"205456e7-3dc0-40c4-8cb0-28e6c1877042",
+ "parameters":{
+ "locationConstraints":[
+
+ ],
+ "resources":[
+
+ ],
+ "requestInputs":{
+
+ }
+ }
+ }
+ ],
+ "requestInputs":{
+ "emptygroup_list": [
+ {
+ "topology": "hub_spoke",
+ "name": "defaultvpn",
+ "role":"Hub",
+ "portType":"GE",
+ "portSwitch":"layer3-port",
+ "vlanId":"",
+ "ipAddress":"192.168.10.1",
+ "deviceName":"vCPE",
+ "portNumer":"0/0/1"
+ }
+ ],
+ "sdwanvpnresource_list":[
+ {
+ "sdwanvpn_topology":"hub_spoke",
+ "sdwanvpn_name":"defaultvpn",
+ "sdwansitelan_list":[
+ {
+ "role":"Hub",
+ "portType":"GE",
+ "portSwitch":"layer3-port",
+ "vlanId":"",
+ "ipAddress":"192.168.10.1",
+ "deviceName":"vCPE",
+ "portNumer":"0/0/1"
+ },
+ {
+ "role":"Hub",
+ "portType":"GE",
+ "portSwitch":"layer2-port",
+ "vlanId":"55",
+ "ipAddress":"192.168.11.1",
+ "deviceName":"CPE_Beijing",
+ "portNumer":"0/0/1"
+ }
+ ]
+ }
+ ],
+ "sdwansiteresource_list":[
+ {
+ "sdwansite_emails":"chenchuanyu@huawei.com",
+ "sdwansite_address":"Huawei Public Cloud",
+ "sdwansite_description":"DC Site",
+ "sdwansite_role":"dsvpn_hub",
+ "sdwansite_postcode":"20000",
+ "sdwansite_type":"single_gateway",
+ "sdwansite_latitude":"",
+ "sdwansite_controlPoint":"",
+ "sdwansite_longitude":"",
+ "sdwansitewan_list":[
+ {
+ "providerIpAddress":"",
+ "portType":"GE",
+ "inputBandwidth":"1000",
+ "ipAddress":"",
+ "name":"10000",
+ "transportNetworkName":"internet",
+ "outputBandwidth":"10000",
+ "deviceName":"vCPE",
+ "portNumber":"0/0/0",
+ "ipMode":"DHCP",
+ "publicIP":"119.3.7.113"
+ },
+ {
+ "providerIpAddress":"",
+ "portType":"GE",
+ "inputBandwidth":"1200",
+ "ipAddress":"",
+ "name":"10001",
+ "transportNetworkName":"internet",
+ "outputBandwidth":"10001",
+ "deviceName":"vCPE",
+ "portNumber":"0/0/0",
+ "ipMode":"DHCP",
+ "publicIP":"119.3.7.114"
+ }
+ ],
+ "sdwandevice_list":[
+ {
+ "esn":"XXXXXXX",
+ "vendor":"Huawei",
+ "name":"vCPE",
+ "type":"AR1000V",
+ "version":"1.0",
+ "class":"VNF",
+ "systemIp":"20.20.20.1"
+ }
+ ]
+ },
+ {
+ "sdwansite_emails":"chenchuanyu@huawei.com",
+ "sdwansite_address":"Huawei Public Cloud",
+ "sdwansite_description":"DC Site",
+ "sdwansite_role":"dsvpn_hub",
+ "sdwansite_postcode":"20000",
+ "sdwansite_type":"single_gateway",
+ "sdwansite_latitude":"",
+ "sdwansite_controlPoint":"",
+ "sdwansite_longitude":"",
+ "sdwansitewan_list":[
+ {
+ "providerIpAddress":"",
+ "portType":"GE",
+ "inputBandwidth":"1000",
+ "ipAddress":"172.18.1.2/24",
+ "name":"10000",
+ "transportNetworkName":"internet",
+ "outputBandwidth":"10000",
+ "deviceName":"CPE_Beijing",
+ "portNumber":"0/0/0",
+ "ipMode":"Static",
+ "publicIP":""
+ }
+ ],
+ "sdwandevice_list":[
+ {
+ "esn":"XXXXXXX",
+ "vendor":"Huawei",
+ "name":"CPE_Beijing",
+ "type":"AR161",
+ "version":"1.0",
+ "class":"PNF",
+ "systemIp":"20.20.20.2"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json
new file mode 100644
index 0000000000..4803fca355
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json
@@ -0,0 +1,299 @@
+{
+ "serviceResources": {
+ "modelInfo": {
+ "modelName": "demoVFWCL",
+ "modelUuid": "c3954379-4efe-431c-8258-f84905b158e5",
+ "modelInvariantUuid": "0cbff61e-3b0a-4eed-97ce-b1b4faa03493",
+ "modelVersion": "1.0"
+ },
+ "serviceType": "",
+ "serviceRole": "",
+ "environmentContext": null,
+ "resourceOrder": "res1,res2",
+ "workloadContext": "Production",
+ "serviceVnfs": [
+
+ {
+ "modelInfo": {
+ "modelName": "15968a6e-2fe5-41bf-a481",
+ "modelUuid": "808abda3-2023-4105-92d2-e62644b61d53",
+ "modelInvariantUuid": "6e4ffc7c-497e-4a77-970d-af966e642d31",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "a00404d5-d7eb-4c46-b6b6-9cf2d087e545",
+ "modelInstanceName": "15968a6e-2fe5-41bf-a481 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vf.15968a6e2fe541bfA481",
+ "nfFunction": null,
+ "resourceInput": "{\"a\":\"b\",\"topology\":\"[sdwanvpnresource_list,INDEX,sdwanvpn_topology]|default_topo\",\"name\":\"[sdwanvpnresource_list,INDEX,sdwanvpn_name]|default_name\",\"sitelist\":\"[sdwanvpnresource_list,INDEX,sdwansitelan_list]|default_sitelist\"}",
+ "resourceType": "VNF",
+ "nfRole": null,
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "15968a6e2fe541bfA481..base_vfw..module-0",
+ "modelUuid": "ec7fadde-1e5a-42f7-8255-cb19e475ff45",
+ "modelInvariantUuid": "61ab8b64-a014-4cf3-8a5a-b5ef388f8819",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "123aff6b-854f-4026-ae1e-cc74a3924576"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vfw",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d1f",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add7e",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f3",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1a0",
+ "modelInstanceName": "f971106a-248f-4202-9d1f 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "resourceType": "GROUP",
+ "nfRole": null,
+ "resourceInput": "{\"a\":\"b|\",\"portswitch\":\"[sdwansitelan_list,INDEX,portSwitch]|default_portswitch\",\"ipAddress\":\"[sdwansitelan_list,INDEX,ipAddress]|default_ipAddress\",\"deviceName\":\"[sdwansitelan_list,INDEX,deviceName]|default_deviceName\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d1e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add7d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f2",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1a1",
+ "modelInstanceName": "f971106a-248f-4202-9d1e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "resourceType": "GROUP",
+ "nfRole": null,
+ "resourceInput": "{\"a\":\"b|\",\"portswitch\":\"[sdwansitelan_list,INDEX,portSwitch]|default_portswitch\",\"ipAddress\":\"[sdwansitelan_list,INDEX,ipAddress]|default_ipAddress\",\"deviceName\":\"[sdwansitelan_list,INDEX,deviceName]|default_deviceName\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d2e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add8d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89c2",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1c1",
+ "modelInstanceName": "f971106a-248f-4202-9d2e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vf.F971106a248f42029d1f",
+ "nfFunction": null,
+ "resourceType": "VNF",
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"[sdwansiteresource_list,INDEX,sdwansite_address]|default_address\",\"role\":\"[sdwansiteresource_list,INDEX,sdwansite_role]|default_role\",\"wanlist\":\"[sdwansiteresource_list,INDEX,sdwansitewan_list]|default_wanlist\",\"devlist\":\"[sdwansiteresource_list,INDEX,sdwandevice_list]|default_devlist\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d3e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add9d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f3",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1a1",
+ "modelInstanceName": "f971106a-248f-4202-9d3e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "resourceType": "GROUP",
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"deviceName\":\"[sdwansitewan_list,INDEX,deviceName]|default_deviceName\",\"ipMode\":\"[sdwansitewan_list,INDEX,ipMode]|default_ipMode\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d5e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add3d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe8393",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1f1",
+ "modelInstanceName": "f971106a-248f-4202-9d5e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d3f",
+ "nfFunction": null,
+ "resourceType": "GROUP",
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\", \"systemipv6\":\"[sdwandevice_list,INDEX,systemIpv6]|default_ipv6\", \"devclass\":\"[sdwandevice_list,INDEX,class]|default_class\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d23",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add83",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89c3",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1c3",
+ "modelInstanceName": "f971106a-248f-4202-9d23 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vf.F971106a248f42029d1f",
+ "nfFunction": null,
+ "resourceType": "VNF",
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"[sdwansiteresource_list,INDEX,sdwansite_address]|default_address\",\"role\":\"[sdwansiteresource_list,INDEX,sdwansite_role]|default_role\",\"wanlist\":\"[sdwansiteresource_list,INDEX,sdwansitewan_list]|default_wanlist\",\"devlist\":\"[sdwansiteresource_list,INDEX,sdwandevice_list]|default_devlist\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d34",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add94",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f4",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1a4",
+ "modelInstanceName": "f971106a-248f-4202-9d34 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "resourceType": "GROUP",
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"deviceName\":\"[sdwansitewan_list,INDEX,deviceName]|default_deviceName\",\"ipMode\":\"[sdwansitewan_list,INDEX,ipMode]|default_ipMode\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d55",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add35",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe8395",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1f5",
+ "modelInstanceName": "f971106a-248f-4202-9d55 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d3f",
+ "nfFunction": null,
+ "resourceType": "GROUP",
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\", \"systemipv6\":\"[sdwandevice_list,INDEX,systemIpv6]|default_ipv6\", \"devclass\":\"[sdwandevice_list,INDEX,class]|default_class\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ }
+
+ ],
+ "serviceNetworks": [],
+ "serviceAllottedResources": []
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json
new file mode 100644
index 0000000000..e6161862ae
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json
@@ -0,0 +1 @@
+{ "sdwanvpnresource_list":[ { "sdwanvpn_topology":"hub_spoke", "sdwanvpn_name":"defaultvpn", "sdwansitelan_list":[ { "role":"Hub", "portType":"GE", "portSwitch":"layer3-port", "vlanId":"", "ipAddress":"192.168.10.1", "deviceName":"vCPE", "portNumer":"0/0/1" }, { "role":"Hub", "portType":"GE", "portSwitch":"layer2-port", "vlanId":"55", "ipAddress":"192.168.11.1", "deviceName":"CPE_Beijing", "portNumer":"0/0/1" } ] } ], "sdwansiteresource_list":[ { "sdwansite_emails":"chenchuanyu@huawei.com", "sdwansite_address":"Huawei Private Cloud", "sdwansite_description":"DC Site", "sdwansite_role":"dsvpn_hub1", "sdwansite_postcode":"20000", "sdwansite_type":"single_gateway", "sdwansite_latitude":"", "sdwansite_controlPoint":"", "sdwansite_longitude":"", "sdwansitewan_list":[ { "providerIpAddress":"", "portType":"GE", "inputBandwidth":"1000", "ipAddress":"", "name":"10000", "transportNetworkName":"internet", "outputBandwidth":"10000", "deviceName":"vCPE", "portNumber":"0/0/0", "ipMode":"DHCP", "publicIP":"119.3.7.113" } ], "sdwandevice_list":[ { "esn":"XXXXXXX", "vendor":"Huawei", "name":"vCPE", "type":"AR1000V", "version":"1.0", "class":"VNF", "systemIp":"20.20.20.1" } ] }, { "sdwansite_emails":"chenchuanyu@huawei.com", "sdwansite_address":"Huawei Public Cloud", "sdwansite_description":"DC Site", "sdwansite_role":"dsvpn_hub", "sdwansite_postcode":"20001", "sdwansite_type":"multiple_gateway", "sdwansite_latitude":"", "sdwansite_controlPoint":"", "sdwansite_longitude":"", "sdwansitewan_list":[ { "providerIpAddress":"", "portType":"GE", "inputBandwidth":"1000", "ipAddress":"172.18.1.2/24", "name":"10000", "transportNetworkName":"internet", "outputBandwidth":"10000", "deviceName":"CPE_Beijing", "portNumber":"0/0/0", "ipMode":"Static", "publicIP":"" } ], "sdwandevice_list":[ { "esn":"XXXXXXX", "vendor":"Huawei", "name":"CPE_Beijing", "type":"AR161", "version":"1.0", "class":"PNF", "systemIp":"20.20.20.2" } ] } ] } \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json
deleted file mode 100644
index f5ffe38285..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai/bulkprocess/test-request.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "transactions" : [ {
- "put" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test1/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test2"
- }
- }, {
- "uri" : "/network/generic-vnfs/generic-vnf/test3/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test4"
- }
- } ]
- }, {
- "put" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test5/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test6"
- }
- } ]
- } ]
-} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml
index 12bc9980bf..fd239562e2 100644
--- a/bpmn/MSOCoreBPMN/pom.xml
+++ b/bpmn/MSOCoreBPMN/pom.xml
@@ -54,7 +54,7 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>1.3.3</version>
+ <version>1.4</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
deleted file mode 100644
index 2e66493a25..0000000000
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.core;
-
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.camunda.bpm.engine.delegate.Expression;
-import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.core.internal.VariableNameExtractor;
-
-/**
- * Base class for service tasks.
- */
-public class BaseTask implements JavaDelegate {
-
- /**
- * Get the value of a required field. This method throws MissingInjectedFieldException if the expression is null,
- * and BadInjectedFieldException if the expression evaluates to a null value.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value
- */
- protected Object getField(Expression expression, DelegateExecution execution, String fieldName) {
- return getFieldImpl(expression, execution, fieldName, false);
- }
-
- /**
- * Gets the value of an optional field. There are three conditions in which this method returns null:
- * <p>
- * <ol>
- * <li>The expression itself is null (i.e. the field is missing altogether.</li>
- * <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not been set.</li>
- * </ol>
- * <p>
- * Examples:<br>
- * Expression ${x} when x is null: return null<br>
- * Expression ${x} when x is unset: return null<br>
- * Expression ${x+y} when x and/or y are unset: exception<br>
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value, possibly null
- */
- protected Object getOptionalField(Expression expression, DelegateExecution execution, String fieldName) {
- return getFieldImpl(expression, execution, fieldName, true);
- }
-
- /**
- * Get the value of a required output variable field. This method throws MissingInjectedFieldException if the
- * expression is null, and BadInjectedFieldException if the expression produces a null or illegal variable name.
- * Legal variable names contain only letters, numbers, and the underscore character ('_').
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the output variable name
- */
- protected String getOutputField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, false);
- if (o instanceof String) {
- String variable = (String) o;
- if (!isLegalVariable(variable)) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "'" + variable + "' is not a legal variable name");
- }
- return variable;
- } else {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "expected a variable name string" + ", got object of type " + o.getClass().getName());
- }
- }
-
- /**
- * Get the value of an optional output variable field. This method throws BadInjectedFieldException if the
- * expression produces an illegal variable name. Legal variable names contain only letters, numbers, and the
- * underscore character ('_').
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the output variable name, possibly null
- */
- protected String getOptionalOutputField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, true);
- if (o instanceof String) {
- String variable = (String) o;
- if (!isLegalVariable(variable)) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "'" + variable + "' is not a legal variable name");
- }
- return variable;
- } else if (o == null) {
- return null;
- } else {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "expected a variable name string" + ", got object of type " + o.getClass().getName());
- }
- }
-
- /**
- * Get the value of a required string field. This method throws MissingInjectedFieldException if the expression is
- * null, and BadInjectedFieldException if the expression evaluates to a null value.
- * <p>
- * Note: the result is coerced to a string value, if necessary.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value
- */
- protected String getStringField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, false);
- if (o instanceof String) {
- return (String) o;
- } else {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Integer");
- }
- }
-
- /**
- * Gets the value of an optional string field. There are three conditions in which this method returns null:
- * <p>
- * <ol>
- * <li>The expression itself is null (i.e. the field is missing altogether.</li>
- * <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not been set.</li>
- * </ol>
- * <p>
- * Examples:<br>
- * Expression ${x} when x is null: return null<br>
- * Expression ${x} when x is unset: return null<br>
- * Expression ${x+y} when x and/or y are unset: exception<br>
- * <p>
- * Note: the result is coerced to a string value, if necessary.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value, possibly null
- */
- protected String getOptionalStringField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, true);
- if (o instanceof String) {
- return (String) o;
- } else if (o == null) {
- return null;
- } else {
- return o.toString();
- }
- }
-
- /**
- * Get the value of a required integer field. This method throws MissingInjectedFieldException if the expression is
- * null, and BadInjectedFieldException if the expression evaluates to a null value or a value that cannot be coerced
- * to an integer.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value
- */
- protected Integer getIntegerField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, false);
- if (o instanceof Integer) {
- return (Integer) o;
- } else {
- try {
- return Integer.parseInt(o.toString());
- } catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Integer");
- }
- }
- }
-
- /**
- * Gets the value of an optional integer field. There are three conditions in which this method returns null:
- * <p>
- * <ol>
- * <li>The expression itself is null (i.e. the field is missing altogether.</li>
- * <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not been set.</li>
- * </ol>
- * <p>
- * Examples:<br>
- * Expression ${x} when x is null: return null<br>
- * Expression ${x} when x is unset: return null<br>
- * Expression ${x+y} when x and/or y are unset: exception<br>
- * <p>
- * Note: the result is coerced to an integer value, if necessary. This method throws BadInjectedFieldException if
- * the result cannot be coerced to an integer.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value, possibly null
- */
- protected Integer getOptionalIntegerField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, true);
- if (o instanceof Integer) {
- return (Integer) o;
- } else if (o == null) {
- return null;
- } else {
- try {
- return Integer.parseInt(o.toString());
- } catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Integer");
- }
- }
- }
-
- /**
- * Gets the value of an optional long field. There are three conditions in which this method returns null:
- * <p>
- * <ol>
- * <li>The expression itself is null (i.e. the field is missing altogether.</li>
- * <li>The expression evaluates to a null value.</li>
- * <li>The expression references a single variable which has not been set.</li>
- * </ol>
- * <p>
- * Examples:<br>
- * Expression ${x} when x is null: return null<br>
- * Expression ${x} when x is unset: return null<br>
- * Expression ${x+y} when x and/or y are unset: exception<br>
- * <p>
- * Note: the result is coerced to a long value, if necessary. This method throws BadInjectedFieldException if the
- * result cannot be coerced to a long.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value, possibly null
- */
- protected Long getOptionalLongField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, true);
- if (o instanceof Long) {
- return (Long) o;
- } else if (o == null) {
- return null;
- } else {
- try {
- return Long.parseLong(o.toString());
- } catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Long");
- }
- }
- }
-
- /**
- * Get the value of a required long field. This method throws MissingInjectedFieldException if the expression is
- * null, and BadInjectedFieldException if the expression evaluates to a null value or a value that cannot be coerced
- * to a long.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @return the field value
- */
- protected Long getLongField(Expression expression, DelegateExecution execution, String fieldName) {
- Object o = getFieldImpl(expression, execution, fieldName, false);
- if (o instanceof Long) {
- return (Long) o;
- } else {
- try {
- return Long.parseLong(o.toString());
- } catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Long");
- }
- }
- }
-
- /**
- * Common implementation for field "getter" methods.
- *
- * @param expression the expression
- * @param execution the execution
- * @param fieldName the field name (for logging and exceptions)
- * @param optional true if the field is optional
- * @return the field value, possibly null
- */
- private Object getFieldImpl(Expression expression, DelegateExecution execution, String fieldName,
- boolean optional) {
- if (expression == null) {
- if (!optional) {
- throw new MissingInjectedFieldException(fieldName, getTaskName());
- }
- return null;
- }
-
- Object value = null;
-
- try {
- value = expression.getValue(execution);
- } catch (Exception e) {
- if (!optional) {
- throw new BadInjectedFieldException(fieldName, getTaskName(), e.getClass().getSimpleName(), e);
- }
-
- // At this point, we have an exception that occurred while
- // evaluating an expression for an optional field. A common
- // problem is that the expression is a simple reference to a
- // variable which has never been set, e.g. the expression is
- // ${x}. The normal activiti behavior is to throw an exception,
- // but we don't like that, so we have the following workaround,
- // which parses the expression text to see if it is a "simple"
- // variable reference, and if so, returns null. If the
- // expression is anything other than a single variable
- // reference, then an exception is thrown, as it would have
- // been without this workaround.
-
- // Get the expression text so we can parse it
- String s = expression.getExpressionText();
- new VariableNameExtractor(s).extract().ifPresent(name -> {
- if (execution.hasVariable(name)) {
- throw new BadInjectedFieldException(fieldName, getTaskName(), e.getClass().getSimpleName(), e);
- }
- });
- }
-
- if (value == null && !optional) {
- throw new BadInjectedFieldException(fieldName, getTaskName(), "required field has null value");
- }
-
- return value;
- }
-
- /**
- * Tests if a character is a "word" character.
- *
- * @param c the character
- * @return true if the character is a "word" character.
- */
- private static boolean isWordCharacter(char c) {
- return (Character.isLetterOrDigit(c) || c == '_');
- }
-
- /**
- * Tests if the specified string is a legal flow variable name.
- *
- * @param name the string
- * @return true if the string is a legal flow variable name
- */
- private boolean isLegalVariable(String name) {
- if (name == null) {
- return false;
- }
-
- int len = name.length();
-
- if (len == 0) {
- return false;
- }
-
- char c = name.charAt(0);
-
- if (!Character.isLetter(c) && c != '_') {
- return false;
- }
-
- for (int i = 1; i < len; i++) {
- c = name.charAt(i);
- if (!Character.isLetterOrDigit(c) && c != '_') {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Returns the name of the task (normally the java class name).
- *
- * @return the name of the task
- */
- public String getTaskName() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void execute(DelegateExecution execution) throws Exception {}
-}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java
index a3f5253765..6f8d34e760 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
@@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory;
*/
public class ResponseBuilder implements java.io.Serializable {
private static final long serialVersionUID = 1L;
+ private static final String WORKFLOWEXCEPTION = "WorkflowException";
private static final Logger logger = LoggerFactory.getLogger(ResponseBuilder.class);
/**
@@ -61,7 +62,7 @@ public class ResponseBuilder implements java.io.Serializable {
logger.debug("processKey=" + processKey);
// See if there"s already a WorkflowException object in the execution.
- WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException");
+ WorkflowException theException = (WorkflowException) execution.getVariable(WORKFLOWEXCEPTION);
if (theException != null) {
logger.debug("Exited " + method + " - propagated " + theException);
@@ -138,7 +139,7 @@ public class ResponseBuilder implements java.io.Serializable {
// Create a new WorkflowException object
theException = new WorkflowException(processKey, intResponseCode, errorResponse);
- execution.setVariable("WorkflowException", theException);
+ execution.setVariable(WORKFLOWEXCEPTION, theException);
logger.debug("Exited " + method + " - created " + theException);
return theException;
}
@@ -163,7 +164,7 @@ public class ResponseBuilder implements java.io.Serializable {
Object theResponse = null;
- WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException");
+ WorkflowException theException = (WorkflowException) execution.getVariable(WORKFLOWEXCEPTION);
String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null);
String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null);
@@ -222,7 +223,7 @@ public class ResponseBuilder implements java.io.Serializable {
}
String s = String.valueOf(object).trim();
- return s.equals("") ? emptyStringValue : s;
+ return "".equals(s) ? emptyStringValue : s;
}
/**
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
index 1692045d33..7d5bb0dcf1 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.core;
import java.io.Serializable;
+import org.onap.so.utils.TargetEntities;
/**
* An object that represents a workflow exception.
@@ -32,6 +33,7 @@ public class WorkflowException implements Serializable {
private final int errorCode;
private final String errorMessage;
private final String workStep;
+ private TargetEntities extSystemErrorSource;
/**
* Constructor
@@ -47,6 +49,15 @@ public class WorkflowException implements Serializable {
workStep = "*";
}
+ public WorkflowException(String processKey, int errorCode, String errorMessage,
+ TargetEntities extSystemErrorSource) {
+ this.processKey = processKey;
+ this.errorCode = errorCode;
+ this.errorMessage = errorMessage;
+ workStep = "*";
+ this.extSystemErrorSource = extSystemErrorSource;
+ }
+
public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep) {
this.processKey = processKey;
this.errorCode = errorCode;
@@ -54,6 +65,15 @@ public class WorkflowException implements Serializable {
this.workStep = workStep;
}
+ public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep,
+ TargetEntities extSystemErrorSource) {
+ this.processKey = processKey;
+ this.errorCode = errorCode;
+ this.errorMessage = errorMessage;
+ this.workStep = workStep;
+ this.extSystemErrorSource = extSystemErrorSource;
+ }
+
/**
* Returns the process key.
*/
@@ -82,12 +102,17 @@ public class WorkflowException implements Serializable {
return workStep;
}
+ public TargetEntities getExtSystemErrorSource() {
+ return extSystemErrorSource;
+ }
+
/**
* Returns a string representation of this object.
*/
@Override
public String toString() {
return getClass().getSimpleName() + "[processKey=" + getProcessKey() + ",errorCode=" + getErrorCode()
- + ",errorMessage=" + getErrorMessage() + ",workStep=" + getWorkStep() + "]";
+ + ",errorMessage=" + getErrorMessage() + ",workStep=" + getWorkStep() + ",extSystemErrorSource="
+ + extSystemErrorSource + "]";
}
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java
index 841eaee675..c37b77d332 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/AllottedResource.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.core.domain;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
@@ -35,14 +34,6 @@ public class AllottedResource extends Resource {
private static final long serialVersionUID = 1L;
/*
- * set resourceType for this object
- */
- public AllottedResource() {
- resourceType = ResourceType.ALLOTTED_RESOURCE;
- setResourceId(UUID.randomUUID().toString());
- }
-
- /*
* fields specific to Allotted Resource resource type
*/
private String allottedResourceType;
@@ -60,6 +51,14 @@ public class AllottedResource extends Resource {
private String resourceInput;
/*
+ * set resourceType for this object
+ */
+ public AllottedResource() {
+ resourceType = ResourceType.ALLOTTED_RESOURCE;
+ setResourceId(UUID.randomUUID().toString());
+ }
+
+ /*
* GET and SET
*/
public String getAllottedResourceType() {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java
new file mode 100644
index 0000000000..79714d0f0e
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.core.domain;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+import java.util.UUID;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class GroupResource extends Resource {
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("vnfcs")
+ private List<VnfcResource> vnfcs;
+
+ public GroupResource() {
+ resourceType = ResourceType.GROUP;
+ setResourceId(UUID.randomUUID().toString());
+ }
+
+ public List<VnfcResource> getVnfcs() {
+ return vnfcs;
+ }
+
+ public void setVnfcs(List<VnfcResource> vnfcs) {
+ this.vnfcs = vnfcs;
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
index 897cbe3573..309b053589 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
-import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonRootName;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java
index 602172f8a4..bf53c880e9 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/JsonWrapper.java
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
*/
@JsonInclude(Include.NON_NULL)
public abstract class JsonWrapper implements Serializable {
+ private static final String EXCEPTION = "Exception :";
private static final Logger logger = LoggerFactory.getLogger(JsonWrapper.class);
@@ -63,7 +64,7 @@ public abstract class JsonWrapper implements Serializable {
jsonString = ow.writeValueAsString(this);
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
}
return jsonString;
}
@@ -76,14 +77,10 @@ public abstract class JsonWrapper implements Serializable {
JSONObject json = new JSONObject();
try {
json = new JSONObject(mapper.writeValueAsString(this));
- } catch (JsonGenerationException e) {
- logger.debug("Exception :", e);
- } catch (JsonMappingException e) {
- logger.debug("Exception :", e);
- } catch (JSONException e) {
- logger.debug("Exception :", e);
+ } catch (JsonGenerationException | JsonMappingException | JSONException e) {
+ logger.debug(EXCEPTION, e);
} catch (IOException e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
}
return json;
}
@@ -95,12 +92,10 @@ public abstract class JsonWrapper implements Serializable {
String jsonString = "";
try {
jsonString = mapper.writeValueAsString(list);
- } catch (JsonGenerationException e) {
- logger.debug("Exception :", e);
- } catch (JsonMappingException e) {
- logger.debug("Exception :", e);
+ } catch (JsonGenerationException | JsonMappingException e) {
+ logger.debug(EXCEPTION, e);
} catch (IOException e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
}
return jsonString;
}
@@ -118,7 +113,7 @@ public abstract class JsonWrapper implements Serializable {
jsonString = ow.writeValueAsString(this);
} catch (Exception e) {
- logger.debug("Exception :", e);
+ logger.debug(EXCEPTION, e);
}
return jsonString;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.java
index 1db360f391..4d70d0f14b 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/License.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
@@ -22,7 +24,6 @@ package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.json.JSONArray;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -40,9 +41,9 @@ public class License extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
- private List<String> entitlementPoolList = new ArrayList<String>();
+ private List<String> entitlementPoolList = new ArrayList();
@JsonInclude(JsonInclude.Include.NON_EMPTY)
- private List<String> licenseKeyGroupList = new ArrayList<String>();
+ private List<String> licenseKeyGroupList = new ArrayList<>();
public List<String> getEntitlementPoolList() {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java
index 7523c378e9..d036ce5f2f 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/NetworkResource.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.core.domain;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.java
index 6c33d37cfe..eb24c96bca 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Request.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,7 +23,6 @@
package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonRootName;
/**
* This class is used to store instance data of services aka ServiceDecomposition
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.java
index b291765252..7dbf97d223 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceDecomposition.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
@@ -27,7 +29,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
* Abstract superclass for all individual decomposition resources
*
*/
-// @JsonIgnoreProperties
public abstract class ResourceDecomposition extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
@@ -74,9 +75,6 @@ public abstract class ResourceDecomposition extends JsonWrapper implements Seria
public String getResourceInstanceName() {
return this.getInstanceData().getInstanceName();
}
- // @JsonIgnore
- // public String getResourceHomingSolution() {
- // }
public void setResourceInstanceId(String newInstanceId) {
this.getInstanceData().setInstanceId(newInstanceId);
@@ -85,7 +83,4 @@ public abstract class ResourceDecomposition extends JsonWrapper implements Seria
public void setResourceInstanceName(String newInstanceName) {
this.getInstanceData().setInstanceName(newInstanceName);
}
- // @JsonIgnore
- // public String setResourceHomingSolution() {
- // }
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java
index a30d0df825..0e17d4c826 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ResourceType.java
@@ -22,5 +22,5 @@ package org.onap.so.bpmn.core.domain;
public enum ResourceType {
- VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION // etc.
+ VNF, NETWORK, MODULE, ALLOTTED_RESOURCE, CONFIGURATION, GROUP, VNFC // etc.
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java
index 633736a25a..11b717c0d2 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/RollbackData.java
@@ -29,7 +29,7 @@ public class RollbackData implements Serializable {
private static final long serialVersionUID = -4811571658272937718L;
private String requestId;
- private Map<String, String> additionalData = new HashMap<String, String>();
+ private Map<String, String> additionalData = new HashMap<>();
public String getRequestId() {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
index 419f545cdf..3632d187c9 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.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
@@ -24,7 +26,6 @@ package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -32,6 +33,8 @@ import com.fasterxml.jackson.annotation.JsonRootName;
import org.json.JSONObject;
import org.onap.so.bpmn.core.json.DecomposeJsonUtil;
import org.onap.so.bpmn.core.json.JsonDecomposingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@@ -41,10 +44,10 @@ import org.onap.so.bpmn.core.json.JsonDecomposingException;
* resource's decompositon
*/
@JsonRootName(value = "serviceResources")
-// @JsonTypeInfo(include=As.WRAPPER_OBJECT, use=Id.NAME)
public class ServiceDecomposition extends JsonWrapper implements Serializable {
private static final long serialVersionUID = 1L;
+ private static final Logger logger = LoggerFactory.getLogger(ServiceDecomposition.class);
@JsonProperty("modelInfo")
private ModelInfo modelInfo;
@@ -245,7 +248,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
*/
@JsonIgnore
public List<Resource> getServiceResources() {
- ArrayList serviceResources = new ArrayList();
+ ArrayList<Resource> serviceResources = new ArrayList();
if (this.getAllottedResources() != null) {
serviceResources.addAll(this.getAllottedResources());
}
@@ -315,8 +318,6 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public String getVnfResource(String resourceObjectId) {
for (Resource resource : getServiceResources()) {
- // resource.getModelInfo().getModelInvariantId();
-
if ("extracted information".equals(resourceObjectId)) {
return resource.toJsonString();
}
@@ -457,11 +458,11 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
boolean result = false;
for (Resource resource : (Iterable<Resource>) resources) {
- System.out.println("resource found");
+ logger.debug("resource found");
if (resource.resourceType == newResource.resourceType) {
- System.out.println("resource type matches");
+ logger.debug("resource type matches");
if (resource.getResourceId().equalsIgnoreCase(newResource.getResourceId())) {
- System.out.println("resource id matches");
+ logger.debug("resource id matches");
// returns TRUE if replacement is a success
result = Collections.replaceAll(resources, resource, newResource);
}
@@ -491,14 +492,12 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
public boolean deleteResource(Resource resource) {
List serviceResourceList = getResourceList(resource);
for (Resource item : (Iterable<Resource>) serviceResourceList) {
- if (item.resourceType == resource.resourceType) {
- if (item.getResourceId().equalsIgnoreCase(resource.getResourceId())) {
- // returns TRUE if replacement is a success
- return serviceResourceList.remove(resource);
- }
+ if (item.resourceType == resource.resourceType
+ && item.getResourceId().equalsIgnoreCase(resource.getResourceId())) {
+ // returns TRUE if replacement is a success
+ return serviceResourceList.remove(resource);
}
}
-
return false;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
index b0b837b3b9..fad6490df2 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInstance.java
@@ -22,9 +22,7 @@ package org.onap.so.bpmn.core.domain;
import java.io.Serializable;
import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonRootName;
/**
* This class is used to store instance data of services aka ServiceDecomposition
@@ -46,7 +44,7 @@ public class ServiceInstance extends JsonWrapper implements Serializable {
private ModelInfo modelInfo;
private String environmentContext;
private String workloadContext;
- private Map serviceParams;
+ private transient Map serviceParams;
private Customer customer = new Customer();
private String e2eVpnKey;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
index f66ad36058..9688a57630 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
@@ -32,6 +32,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
* Encapsulates VNF resource data set
*
*/
+@JsonIgnoreProperties(ignoreUnknown = true)
@JsonRootName("vnfResource")
public class VnfResource extends Resource {
@@ -50,6 +51,13 @@ public class VnfResource extends Resource {
*/
@JsonProperty("vfModules")
private List<ModuleResource> vfModules;
+
+ @JsonProperty("groups")
+ private List<GroupResource> groups;
+
+ @JsonProperty("vnfcInstGroupOrder")
+ private String groupOrder;
+
private String vnfHostname;
private String vnfType;
private String nfFunction;
@@ -59,7 +67,7 @@ public class VnfResource extends Resource {
private String multiStageDesign;
private String orchestrationStatus;
- @JsonIgnore
+ @JsonProperty("resourceInput")
private String resourceInput;
/*
@@ -150,6 +158,22 @@ public class VnfResource extends Resource {
this.resourceInput = resourceInput;
}
+ public List<GroupResource> getGroups() {
+ return groups;
+ }
+
+ public void setGroups(List<GroupResource> groups) {
+ this.groups = groups;
+ }
+
+ public String getGroupOrder() {
+ return groupOrder;
+ }
+
+ public void setGroupOrder(String groupOrder) {
+ this.groupOrder = groupOrder;
+ }
+
/**
* Returns a list of all VfModule objects. Base module is first entry in the list
*
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
new file mode 100644
index 0000000000..50bd3e2355
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.core.domain;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.UUID;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class VnfcResource extends Resource {
+ private static final long serialVersionUID = 1L;
+
+ @JsonProperty("resourceInput")
+ private String resourceInput;
+
+ public VnfcResource() {
+ resourceType = ResourceType.VNFC;
+ setResourceId(UUID.randomUUID().toString());
+ }
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
index d3d07f9014..3f10df36ab 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/json/JsonUtils.java
@@ -323,7 +323,7 @@ public class JsonUtils {
logger.debug("getJsonValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ logger.debug("getJsonValue(): the raw value is NOT a String Object={}", rawValue);
return rawValue.toString();
}
}
@@ -352,7 +352,7 @@ public class JsonUtils {
logger.debug("getJsonNodeValue(): the raw value is a String Object={}", rawValue);
return (String) rawValue;
} else {
- logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue.toString());
+ logger.debug("getJsonNodeValue(): the raw value is NOT a String Object={}", rawValue);
return rawValue.toString();
}
}
@@ -380,11 +380,10 @@ public class JsonUtils {
return 0;
} else {
if (rawValue instanceof Integer) {
- logger.debug("getJsonIntValue(): the raw value is an Integer Object={}",
- ((String) rawValue).toString());
+ logger.debug("getJsonIntValue(): the raw value is an Integer Object={}", rawValue);
return (Integer) rawValue;
} else {
- logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue.toString());
+ logger.debug("getJsonIntValue(): the raw value is NOT an Integer Object={}", rawValue);
return 0;
}
}
@@ -412,8 +411,7 @@ public class JsonUtils {
logger.debug("getJsonBooleanValue(): the raw value is a Boolean Object={}", rawValue);
return (Boolean) rawValue;
} else {
- logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}",
- rawValue.toString());
+ logger.debug("getJsonBooleanValue(): the raw value is NOT an Boolean Object={}", rawValue);
return false;
}
}
@@ -455,7 +453,7 @@ public class JsonUtils {
return null;
} else {
if (rawValue instanceof JSONArray) {
- logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue.toString());
+ logger.debug("getJsonParamValue(): keys={} points to JSONArray: {}", keys, rawValue);
int arrayLen = ((JSONArray) rawValue).length();
if (index < 0 || arrayLen < index + 1) {
logger.debug("getJsonParamValue(): index: {} is out of bounds for array size of {}", index,
@@ -464,8 +462,7 @@ public class JsonUtils {
}
int foundCnt = 0;
for (int i = 0; i < arrayLen; i++) {
- logger.debug("getJsonParamValue(): index: {}, value: {}", i,
- ((JSONArray) rawValue).get(i).toString());
+ logger.debug("getJsonParamValue(): index: {}, value: {}", i, ((JSONArray) rawValue).get(i));
if (((JSONArray) rawValue).get(i) instanceof JSONObject) {
JSONObject jsonObj = (JSONObject) ((JSONArray) rawValue).get(i);
String parmValue = jsonObj.get(name).toString();
@@ -482,16 +479,14 @@ public class JsonUtils {
continue;
}
} else {
- logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}",
- rawValue.toString());
+ logger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject={}", rawValue);
return null;
}
}
logger.debug("getJsonParamValue(): content value NOT found for name: {}", name);
return null;
} else {
- logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}",
- rawValue.toString());
+ logger.debug("getJsonParamValue(): the raw value is NOT a JSONArray Object={}", rawValue);
return null;
}
}
@@ -1057,13 +1052,13 @@ public class JsonUtils {
JsonValidator validator = factory.getValidator();
ProcessingReport report = validator.validate(schema, document);
- logger.debug("JSON schema validation report: {}", report.toString());
+ logger.debug("JSON schema validation report: {}", report);
return report.toString();
} catch (IOException e) {
- logger.debug("IOException performing JSON schema validation on document: {}", e.toString());
+ logger.debug("IOException performing JSON schema validation on document:", e);
throw new ValidationException(e.getMessage());
} catch (ProcessingException e) {
- logger.debug("ProcessingException performing JSON schema validation on document: {}", e.toString());
+ logger.debug("ProcessingException performing JSON schema validation on document:", e);
throw new ValidationException(e.getMessage());
}
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java
deleted file mode 100644
index 49f373c01e..0000000000
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * ============LICENSE_START======================================================= ONAP : SO
- * ================================================================================ Copyright (C) 2018 AT&T Intellectual
- * Property. All rights reserved. ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.core;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RepositoryService;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.camunda.bpm.engine.delegate.Expression;
-import org.camunda.bpm.engine.repository.ProcessDefinition;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-public class BaseTaskTest {
-
- private String prefix = "PRE_";
- private String processKey = "AnyProcessKey";
- private String definitionId = "100";
- private String anyVariable = "anyVariable";
- private String anyValueString = "anyValue";
- private String badValueString = "123abc";
- private int anyValueInt = 123;
- private Integer anyValueInteger = new Integer(anyValueInt);
- private long anyValuelong = 123L;
- private Long anyValueLong = new Long(anyValuelong);
-
- private DelegateExecution mockExecution;
- private Expression mockExpression;
- private BaseTask baseTask;
- private Object obj1;
- private Object obj2;
- private Object objectString;
- private Object objectInteger;
- private Object objectLong;
- private Object objectBoolean;
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Before
- public void before() throws Exception {
- baseTask = new BaseTask();
- ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class);
- when(mockProcessDefinition.getKey()).thenReturn(processKey);
- RepositoryService mockRepositoryService = mock(RepositoryService.class);
- when(mockRepositoryService.getProcessDefinition(definitionId)).thenReturn(mockProcessDefinition);
- ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class);
- when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService);
- mockExecution = mock(DelegateExecution.class);
- when(mockExecution.getId()).thenReturn(definitionId);
- when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices);
- when(mockExecution.getProcessEngineServices().getRepositoryService()
- .getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition);
- when(mockExecution.getVariable("prefix")).thenReturn(prefix);
- when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true");
- mockExpression = mock(Expression.class);
- }
-
- @Test
- public void testExecution() throws Exception {
- baseTask.execute(mockExecution);
- assertEquals("BaseTask", baseTask.getTaskName());
- }
-
- @Test
- public void testGetFieldAndMissingInjectedException() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
-
- expectedException.expect(MissingInjectedFieldException.class);
- obj2 = baseTask.getField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj1 = baseTask.getField(mockExpression, mockExecution, null);
- }
-
- @Test
- public void testGetOptionalField() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getOptionalField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
- }
-
- @Test
- public void testGetStringFieldAndMissingInjectedFieldException() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getStringField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
-
- expectedException.expect(MissingInjectedFieldException.class);
- Object objectBoolean = new Boolean(true); // bad data
- when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
- obj2 = baseTask.getStringField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetStringFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj1 = baseTask.getStringField(mockExpression, mockExecution, null);
- }
-
- @Test
- public void testGetOptionalStringField() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getOptionalStringField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
- }
-
- @Test
- public void testGetIntegerFieldAndMissingInjectedFieldException() throws Exception {
- objectInteger = new Integer(anyValueInt);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger);
- obj1 = baseTask.getIntegerField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueInteger, (Integer) obj1);
-
- expectedException.expect(MissingInjectedFieldException.class);
- objectString = new String(badValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj2 = baseTask.getIntegerField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetIntegerFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj1 = baseTask.getIntegerField(mockExpression, mockExecution, null);
- }
-
-
- @Test
- public void testGetOptionalIntegerField() throws Exception {
- objectInteger = new Integer(anyValueInt);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger);
- obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueInteger, (Integer) obj1);
- }
-
- @Test
- public void testGetOptionalIntegerFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- objectBoolean = new Boolean(true);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
- obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetLongFieldAndMissingInjectedFieldException() throws Exception {
- objectLong = new Long(anyValuelong);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectLong);
- obj1 = baseTask.getLongField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueLong, (Long) obj1);
-
- expectedException.expect(MissingInjectedFieldException.class);
- objectString = new String(badValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj2 = baseTask.getLongField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetLongFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj2 = baseTask.getLongField(mockExpression, mockExecution, null);
- }
-
- @Test
- public void testGetOptionalLongField() throws Exception {
- objectLong = new Long(anyValuelong);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectLong);
- obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueLong, (Long) obj1);
- }
-
- @Test
- public void testGetOptionalLongFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- objectBoolean = new Boolean(true);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
- obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetOutputAndMissingInjectedFieldException() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getOutputField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
-
- expectedException.expect(MissingInjectedFieldException.class);
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj2 = baseTask.getOutputField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetOutputAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- obj2 = baseTask.getOutputField(null, mockExecution, anyVariable);
- }
-
- @Test
- public void testGetOptionalOutputField() throws Exception {
- objectString = new String(anyValueString);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectString);
- obj1 = baseTask.getOptionalOutputField(mockExpression, mockExecution, anyVariable);
- assertEquals(anyValueString, obj1.toString());
- }
-
- @Test
- public void testGetOptionalOutputFieldAndBadInjectedFieldException() throws Exception {
- expectedException.expect(BadInjectedFieldException.class);
- objectBoolean = new Boolean(true);
- when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
- obj1 = baseTask.getOptionalOutputField(mockExpression, mockExecution, anyVariable);
- }
-
-}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
index 5db277628e..7ef7deea30 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
@@ -52,6 +52,22 @@ public class ServiceDecompositionTest {
configResource.setResourceId("configResourceId");
}
+
+ @Test
+ public void serviceDecompositionWithGroupandVnfc() throws IOException {
+ String sericeStr = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "ServiceWithGroupandVnfc.json")));
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition(sericeStr);
+
+ assertEquals(1, serviceDecomposition.getVnfResources().size());
+ assertEquals(1, serviceDecomposition.getVnfResources().get(0).getGroups().size());
+ assertEquals(1, serviceDecomposition.getVnfResources().get(0).getGroups().get(0).getVnfcs().size());
+
+ VnfcResource vnfcResource = serviceDecomposition.getVnfResources().get(0).getGroups().get(0).getVnfcs().get(0);
+
+ assertEquals("xfs", vnfcResource.getModelInfo().getModelName());
+ assertEquals("22", vnfcResource.getModelInfo().getModelUuid());
+ }
+
@Test
public void serviceDecompositionTest() throws JsonProcessingException, IOException {
// covering methods not covered by openpojo test
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 09bcfe8470..de7b21ed73 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
@@ -14,12 +14,13 @@
*/
package org.onap.so.bpmn.core.domain;
-import static org.junit.Assert.*;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class VnfResourceTest {
@@ -58,6 +59,19 @@ public class VnfResourceTest {
VnfResource vnfResource = objectMapper.readValue(jsonStr, VnfResource.class);
assertTrue(vnfResource != null);
+ assertEquals("sample", vnfResource.getResourceInput());
+ assertEquals("home", vnfResource.getVnfHostname());
+ }
+
+ @Test
+ public void vnfResourceMapperTestNoResourceInput() throws IOException {
+ String jsonStr = "{\"vnfHostname\": \"home\"}";
+ ObjectMapper objectMapper = new ObjectMapper();
+ VnfResource vnfResource = objectMapper.readValue(jsonStr, VnfResource.class);
+
+ assertTrue(vnfResource != null);
+ assertEquals(null, vnfResource.getResourceInput());
+ assertEquals("home", vnfResource.getVnfHostname());
}
@Test
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java
index d099cbebcc..b6bccdb5c9 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/xml/XmlToolTest.java
@@ -28,7 +28,7 @@ public class XmlToolTest {
private String encodeResponseNamespace =
"<Response xmlns:ns2=\"http://ecomp.att.com/mso/request/types/v1\">good</Response>";
private String attribute = "<Response>good&\"bad\"</Response>";
- private String updatedAttribute = "&lt;Response&gt;good&amp;&quot;bad&quot;&lt;/Response&gt;";
+ // private String updatedAttribute = "&lt;Response&gt;good&amp;&quot;bad&quot;&lt;/Response&gt;";
private String content = "<dummy><configuration-event>" + "<event-type>test</event-type>"
+ "<event-correlator-type>test</event-correlator-type>" + "<event-correlator>123</event-correlator>"
diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json
new file mode 100644
index 0000000000..9d0326e66a
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceWithGroupandVnfc.json
@@ -0,0 +1,58 @@
+{
+ "serviceResources": {
+ "modelInfo": {
+ "modelName": "NSService",
+ "modelUuid": "0bad8c92-7d22-49f0-b092-b64e6ca564a7",
+ "modelInvariantUuid": "69161960-515b-4bf3-91f1-313b813f5e1d",
+ "modelVersion": "1.0"
+ },
+ "serviceType": "",
+ "serviceRole": "",
+ "environmentContext": "General_Revenue-Bearing",
+ "resourceOrder": "NF",
+ "workloadContext": "Production",
+ "serviceVnfs": [
+ {
+ "modelInfo": {
+ "modelName": "",
+ "modelUuid": "123",
+ "modelInvariantUuid": "",
+ "modelVersion": "",
+ "modelCustomizationUuid": "1234",
+ "modelInstanceName": "test"
+ },
+ "toscaNodeType": "",
+ "nfFunction": "",
+ "nfType": "",
+ "nfRole": "",
+ "nfNamingCode": "",
+ "multiStageDesign": "",
+ "resourceInput": "",
+ "vfModules": [],
+ "groups": [
+ {
+ "modelInfo": {
+ "modelName": "test",
+ "modelUuid": "11",
+ "modelInvariantUuid": "11",
+ "modelVersion": "2"
+ },
+ "vnfcs": [
+ {
+ "modelInfo": {
+ "modelName": "xfs",
+ "modelUuid": "22",
+ "modelInvariantUuid": "2222",
+ "modelVersion": "22222",
+ "modelCustomizationUuid": "2222"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "serviceNetworks": [],
+ "serviceAllottedResources": []
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index e9ed15aa0f..25913eabba 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -134,6 +134,24 @@
</executions>
</plugin>
</plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <excludes>
+ <exclude>**/*.p12</exclude>
+ <exclude>**/*.jks</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*.p12</include>
+ <include>**/*.jks</include>
+ </includes>
+ </resource>
+ </resources>
</build>
<dependencyManagement>
<dependencies>
@@ -157,6 +175,10 @@
<groupId>org.camunda.bpmn</groupId>
<artifactId>camunda-engine-rest-core</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
index cd4257ec60..e0760b5d4a 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.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
@@ -160,12 +162,4 @@ public class DeleteVnfNotification {
return deleteVnfNotification;
}
- /*
- * public String toString() { StringWriter writer = new StringWriter(); try { JAXBContext context = JAXBContext
- * .newInstance(DeleteVnfNotification.class); Marshaller m = context.createMarshaller();
- * m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(this, writer);
- * //System.out.println("toString() - " + writer.getBuffer().toString()); return writer.getBuffer().toString(); }
- * catch (JAXBException e) { //System.out.println("JAXBException - " + e.getStackTrace()); return ""; } }
- */
-
}
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 7c0c2f20b3..13ba46a852 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
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
import org.camunda.bpm.engine.OptimisticLockingException;
import org.camunda.bpm.engine.RuntimeService;
@@ -207,7 +208,7 @@ public class CallbackHandlerService {
+ messageEventName + " with " + correlationVariable + " = '" + correlationValue
+ "'; last exception was:" + queryException;
logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), msg, queryException);
}
@@ -245,8 +246,8 @@ public class CallbackHandlerService {
String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName
+ " with " + correlationVariable + " = '" + correlationValue + "': " + ole;
logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- ErrorCode.UnknownError.getValue(), msg, ole);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ "BPMN CORRELATION ERROR -", ErrorCode.UnknownError.getValue(), msg, ole);
// Retry for OptimisticLocking Exceptions
int retryCount = 0;
@@ -279,7 +280,7 @@ 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), strMsg, olex);
} catch (Exception excep) {
retryCount = 0;
@@ -287,7 +288,7 @@ public class CallbackHandlerService {
String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:"
+ retryCount + " | exception returned: " + excep;
logger.debug(strMsg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), strMsg, excep);
}
@@ -300,7 +301,7 @@ public class CallbackHandlerService {
+ " after receiving " + messageEventName + " with " + correlationVariable + " = '"
+ correlationValue + "': " + e;
logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), msg, e);
}
} catch (Exception e) {
@@ -309,7 +310,7 @@ public class CallbackHandlerService {
String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName + " with "
+ correlationVariable + " = '" + correlationValue + "': " + e;
logger.debug(msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
ErrorCode.UnknownError.getValue(), msg, e);
}
@@ -345,10 +346,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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), msg);
} else {
- logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
ErrorCode.UnknownError.getValue(), msg, e);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
index e8e4b85cae..ace6e1937d 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
@@ -101,7 +101,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
try {
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, getRequestId(inputVariables));
processor.startProcess(processKey, variableMap);
- WorkflowResponse response = waitForResponse(getRequestId(inputVariables));
+ WorkflowResponse response = waitForResponse(inputVariables);
return Response.status(202).entity(response).build();
} catch (WorkflowProcessorException e) {
WorkflowResponse response = e.getWorkflowResponse();
@@ -112,9 +112,12 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
}
}
- private WorkflowResponse waitForResponse(String requestId) throws Exception {
+ private WorkflowResponse waitForResponse(Map<String, Object> inputVariables) throws Exception {
+ String requestId = getRequestId(inputVariables);
long currentWaitTime = 0;
- while (DEFAULT_WAIT_TIME > currentWaitTime) {
+ long waitTime = getWaitTime(inputVariables);
+ logger.debug("WorkflowAsyncResource.waitForResponse using timeout: " + waitTime);
+ while (waitTime > currentWaitTime) {
Thread.sleep(workflowPollInterval);
currentWaitTime = currentWaitTime + workflowPollInterval;
WorkflowContext foundContext = contextHolder.getWorkflowContext(requestId);
@@ -123,7 +126,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
return buildResponse(foundContext);
}
}
- throw new Exception("TimeOutOccured");
+ throw new Exception("TimeOutOccured in WorkflowAsyncResource.waitForResponse for time " + waitTime + "ms");
}
private WorkflowResponse buildUnkownError(String requestId, String error) {
@@ -171,4 +174,25 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
return inputVariables;
}
+ /**
+ * Returns the wait time, this is used by the resource on how long it should wait to send a response If none
+ * specified DEFAULT_WAIT_TIME is used
+ *
+ * @param inputVariables
+ * @return
+ */
+ private long getWaitTime(Map<String, Object> inputVariables) {
+ String timeout = inputVariables.get("mso-service-request-timeout") == null ? null
+ : inputVariables.get("mso-service-request-timeout").toString();
+
+ if (timeout != null) {
+ try {
+ return Long.parseLong(timeout) * 1000;
+ } catch (NumberFormatException nex) {
+ logger.debug("Invalid input for mso-service-request-timeout");
+ }
+ }
+ return DEFAULT_WAIT_TIME;
+ }
+
}
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 1e9ebdf0b2..f76fde9ef1 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
@@ -32,6 +32,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
import org.onap.so.logger.ErrorCode;
@@ -78,7 +79,7 @@ public class WorkflowMessageResource {
if (messageType == null || messageType.isEmpty()) {
String msg = "Missing message type";
logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
@@ -86,7 +87,7 @@ public class WorkflowMessageResource {
if (correlator == null || correlator.isEmpty()) {
String msg = "Missing correlator";
logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
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/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
index 4e9e9fdf0e..d33e7aed0c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -45,8 +45,7 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
@Async
public void startProcess(String processKey, VariableMapImpl variableMap) {
- long startTime = System.currentTimeMillis();
- Map<String, Object> inputVariables = null;
+ Map<String, Object> inputVariables;
String processInstanceId = null;
try {
inputVariables = getInputVariables(variableMap);
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 9d63e8eaf1..bcc3739c32 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
@@ -36,6 +36,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.HistoryService;
import org.camunda.bpm.engine.ProcessEngineException;
import org.camunda.bpm.engine.ProcessEngineServices;
@@ -115,7 +116,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000;
AtomicLong timeProcessEnded = new AtomicLong(0);
boolean endedWithNoResponse = false;
-
+ logger.debug(LOGMARKER + "WorkflowResource.startProcessInstanceByKey using timeout: " + waitTime);
while (now <= endTime) {
Thread.sleep(pollingInterval);
@@ -195,7 +196,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
if (processInstance != null)
workflowResponse.setProcessInstanceID(processInstance.getId());
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
MDC.get(processKey), ErrorCode.UnknownError.getValue(), LOGMARKER + workflowResponse.getMessage()
+ " for processKey: " + processKey + " with response: " + workflowResponse.getResponse());
@@ -581,7 +582,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
response.setResponse("Failed to retrieve the variables," + ex.getMessage());
response.setProcessInstanceID(processInstanceId);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN",
MDC.get(processKey), 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 296ab64df3..6de22825b7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -22,16 +22,8 @@
package org.onap.so.bpmn.core.plugins;
-import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
import org.camunda.bpm.engine.RepositoryService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.ExecutionListener;
@@ -39,26 +31,17 @@ import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener;
import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
-import org.camunda.bpm.engine.impl.context.Context;
-import org.camunda.bpm.engine.impl.interceptor.Command;
-import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
import org.camunda.bpm.engine.impl.util.xml.Element;
import org.camunda.bpm.engine.impl.variable.VariableDeclaration;
-import org.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.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.AbstractEnvironment;
-import org.springframework.core.env.Environment;
-import org.springframework.core.env.MapPropertySource;
-import org.springframework.core.env.PropertySource;
import org.springframework.stereotype.Component;
@@ -69,6 +52,9 @@ import org.springframework.stereotype.Component;
@Component
public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
+ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
+ public static final String SERVICE_NAME = "ServiceName";
+
@Autowired
private LoggingParseListener loggingParseListener;
@@ -313,6 +299,13 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
String requestId = (String) execution.getVariable("mso-request-id");
String svcid = (String) execution.getVariable("mso-service-instance-id");
+ try {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+ MDC.put(SERVICE_INSTANCE_ID, svcid);
+ MDC.put(SERVICE_NAME, processName);
+ } catch (Exception e) {
+ logger.error("Error trying to add variables to MDC", e);
+ }
}
} catch (Exception e) {
logger.error("Exception occurred", e);
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
index ab21c0807e..42c6ef059f 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
@@ -32,7 +32,6 @@ import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior;
import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener;
import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
-import org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration;
import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity;
@@ -58,6 +57,8 @@ import org.slf4j.LoggerFactory;
public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class);
+ private static final String WORKFLOW_EXCEPTION = "WorkflowException";
+
@Override
public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners();
@@ -131,7 +132,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
*/
public static class WorkflowExceptionResetListener implements ExecutionListener {
public void notify(DelegateExecution execution) throws Exception {
- Object workflowException = execution.getVariable("WorkflowException");
+ Object workflowException = execution.getVariable(WORKFLOW_EXCEPTION);
if (workflowException instanceof WorkflowException) {
int index = 1;
@@ -140,10 +141,10 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
saveName = "SavedWorkflowException" + (++index);
}
- logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
+ logger.debug("WorkflowExceptionResetTask is moving WorkflowException to {}", saveName);
execution.setVariable(saveName, workflowException);
- execution.setVariable("WorkflowException", null);
+ execution.setVariable(WORKFLOW_EXCEPTION, null);
}
}
}
@@ -153,7 +154,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) {
+ if (execution.getVariable(WORKFLOW_EXCEPTION) instanceof WorkflowException) {
logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
throw new BpmnError("MSOWorkflowException");
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
index 6572beaba9..a049f81906 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
@@ -52,8 +52,6 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@Configuration
public class CXFConfiguration {
- private static final Logger logger = LoggerFactory.getLogger(CXFConfiguration.class);
-
@Autowired
private Bus bus;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CamundaDBConfig.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CamundaDBConfig.java
new file mode 100644
index 0000000000..686b377727
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CamundaDBConfig.java
@@ -0,0 +1,84 @@
+/*-
+ * ============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;
+
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jmx.export.MBeanExporter;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory",
+ basePackages = {"org.onap.so.db.catalog.data.repository"})
+@Profile({"!test"})
+public class CamundaDBConfig {
+
+ @Autowired(required = false)
+ private MBeanExporter mBeanExporter;
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari")
+ public HikariConfig camundaDbConfig() {
+ return new HikariConfig();
+ }
+
+ @Primary
+ @Bean(name = "dataSource")
+ public DataSource dataSource() {
+ if (mBeanExporter != null) {
+ mBeanExporter.addExcludedBean("dataSource");
+ }
+ HikariConfig hikariConfig = this.camundaDbConfig();
+ return new HikariDataSource(hikariConfig);
+ }
+
+ @Primary
+ @Bean(name = "entityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ @Qualifier("dataSource") DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.catalog.beans").persistenceUnit("catalogDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "transactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 8168d2a4b8..a4fc6e54b0 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure;
import java.util.List;
import java.util.concurrent.Executor;
+import org.onap.so.logger.LoggingAnchor;
import javax.annotation.PostConstruct;
import org.camunda.bpm.application.PreUndeploy;
import org.camunda.bpm.application.ProcessApplicationInfo;
@@ -98,7 +99,7 @@ public class MSOInfrastructureApplication {
DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment();
deployCustomWorkflows(deploymentBuilder);
} catch (Exception e) {
- logger.warn("Unable to invoke deploymentBuilder: " + e.getMessage());
+ logger.warn("Unable to invoke deploymentBuilder ", e);
}
}
@@ -123,7 +124,7 @@ public class MSOInfrastructureApplication {
logger.debug("Attempting to deploy custom workflows");
try {
List<Workflow> workflows = catalogDbClient.findWorkflowBySource(SDC_SOURCE);
- if (workflows != null && workflows.size() != 0) {
+ if (workflows != null && !workflows.isEmpty()) {
for (Workflow workflow : workflows) {
String workflowName = workflow.getName();
String workflowBody = workflow.getBody();
@@ -131,15 +132,15 @@ public class MSOInfrastructureApplication {
workflowName += BPMN_SUFFIX;
}
if (workflowBody != null) {
- logger.info("{} {}", "Deploying custom workflow", workflowName);
+ logger.info(LoggingAnchor.TWO, "Deploying custom workflow", workflowName);
deploymentBuilder.addString(workflowName, workflowBody);
}
+ deploymentBuilder.enableDuplicateFiltering(true);
}
- deploymentBuilder.enableDuplicateFiltering(true);
deploymentBuilder.deploy();
}
} catch (Exception e) {
- logger.warn("Unable to deploy custom workflows, " + e.getMessage());
+ logger.warn("Unable to deploy custom workflows ", e);
}
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
index c2af155d51..1ed3214214 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 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
@@ -36,7 +38,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
.antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService",
"/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify")
- .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()).and().httpBasic();
+ .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and().httpBasic();
}
@Override
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
index e364981a66..1ad95b3ab9 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
@@ -7,15 +7,20 @@ mso:
auditInventory: false
spring:
datasource:
- driver-class-name: org.mariadb.jdbc.Driver
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
- username: ${DB_ADMIN_USERNAME}
- password: ${DB_ADMIN_PASSWORD}
+ hikari:
+ jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
+ username: ${DB_ADMIN_USERNAME}
+ password: ${DB_ADMIN_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: bpmn-pool
+ registerMbeans: true
http:
multipart:
enabled: false
jersey:
application-path: /sobpmnengine
+ main:
+ allow-bean-definition-overriding: true
camunda:
bpm:
application:
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12 b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12
new file mode 100644
index 0000000000..79631bf344
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.p12
Binary files differ
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks
new file mode 100644
index 0000000000..6f8168d896
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/org.onap.so.trust.jks
Binary files differ
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
index f417a550d1..a94713e9e0 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
@@ -317,7 +317,8 @@ public class BPMNUtil {
*/
static class ProcessThread extends Thread {
- public WorkflowResponse workflowResponse = null;
+ public WorkflowResponse workflowResponse;
+ // public WorkflowResponse workflowResponse = null;
public String processKey;
public boolean started;
public ProcessEngineServices processEngineServices;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
index 39a8995607..f3527fad7d 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
@@ -60,7 +60,6 @@ public class OofHomingTestIT extends BaseIntegrationTest {
Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
- String subscriber = "";
String subscriber2 = "";
private final CallbackSet callbacks = new CallbackSet();
@@ -208,8 +207,6 @@ public class OofHomingTestIT extends BaseIntegrationTest {
serviceDecomposition.setServiceInstance(si);
// Subscriber
- subscriber =
- "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
index 389f931901..93f98a34a6 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -350,10 +350,12 @@ public abstract class WorkflowTest {
*/
try {
- msoRequestId = (String) injectedVariables.get("requestId");
- variables.put("mso-request-id", msoRequestId);
- msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
- variables.put("mso-service-instance-id", msoServiceInstanceId);
+ if (injectedVariables != null) {
+ msoRequestId = (String) injectedVariables.get("requestId");
+ variables.put("mso-request-id", msoRequestId);
+ msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
+ variables.put("mso-service-instance-id", msoServiceInstanceId);
+ }
} catch (Exception e) {
}
if (msoRequestId == null || msoRequestId.trim().equals("")) {
@@ -1382,172 +1384,6 @@ public abstract class WorkflowTest {
}
/**
- * Runs a program to inject sniro workflow messages into the test environment. A program is essentially just a list
- * of keys that identify event data to be injected, in sequence. For more details, see injectSNIROCallbacks(String
- * contentType, String messageType, String content, long timeout)
- *
- * Errors are handled with junit assertions and will cause the test to fail. NOTE: Each callback must have a
- * workflow message type associated with it.
- *
- * @param callbacks an object containing event data for the program
- * @param program the program to execute
- */
- protected void injectSNIROCallbacks(CallbackSet callbacks, String program) {
-
- String[] cmds = program.replaceAll("\\s+", "").split(",");
-
- for (String cmd : cmds) {
- String action = cmd;
- String modifier = "STD";
-
- if (cmd.contains(":")) {
- String[] parts = cmd.split(":");
- action = parts[0];
- modifier = parts[1];
- }
-
- String messageType = null;
- String content = null;
- String contentType = null;
-
- if ("STD".equals(modifier)) {
- CallbackData callbackData = callbacks.get(action);
-
- if (callbackData == null) {
- String msg = "No '" + action + "' workflow message callback is defined";
- logger.debug(msg);
- fail(msg);
- }
-
- messageType = callbackData.getMessageType();
-
- if (messageType == null || messageType.trim().equals("")) {
- String msg = "No workflow message type is defined in the '" + action + "' callback";
- logger.debug(msg);
- fail(msg);
- }
-
- content = callbackData.getContent();
- contentType = callbackData.getContentType();
- } else {
- String msg = "Invalid workflow message program modifier: '" + modifier + "'";
- logger.debug(msg);
- fail(msg);
- }
-
- if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) {
- fail("Failed to inject '" + action + "' workflow message");
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- fail("Interrupted after injection of '" + action + "' workflow message");
- }
- }
- }
-
- /**
- * Injects a sniro workflow message. The specified callback response may contain the placeholder strings
- * ((CORRELATOR)) and ((SERVICE_RESOURCE_ID)) The ((CORRELATOR)) is replaced with the actual correlator value from
- * the request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId value from the sniro
- * request. Currently this only works with sniro request that contain only 1 resource.
- *
- * @param contentType the HTTP contentType for the message (possibly null)
- * @param messageType the message type
- * @param content the message content (possibly null)
- * @param timeout the timeout in milliseconds
- * @return true if the message could be injected, false otherwise
- */
- protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) {
- String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", messageType + "_CORRELATOR", timeout);
-
- if (correlator == null) {
- return false;
- }
- if (content != null) {
- content = content.replace("((CORRELATOR))", correlator);
- if (messageType.equalsIgnoreCase("SNIROResponse")) {
- ServiceDecomposition decomp =
- (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout);
- List<Resource> resourceList = decomp.getServiceResources();
- if (resourceList.size() == 1) {
- String resourceId = "";
- for (Resource resource : resourceList) {
- resourceId = resource.getResourceId();
- }
- String homingList = getJsonValue(content, "solutionInfo.placementInfo");
- JSONArray placementArr = null;
- try {
- placementArr = new JSONArray(homingList);
- } catch (Exception e) {
- return false;
- }
- if (placementArr.length() == 1) {
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
- JSONArray licenseArr = null;
- try {
- licenseArr = new JSONArray(licenseInfoList);
- } catch (Exception e) {
- return false;
- }
- if (licenseArr.length() == 1) {
- content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
- }
- } else {
- try {
- String homingList = getJsonValue(content, "solutionInfo.placementInfo");
- String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
- JSONArray placementArr = new JSONArray(homingList);
- JSONArray licenseArr = new JSONArray(licenseInfoList);
- for (Resource resource : resourceList) {
- String resourceModuleName = resource.getModelInfo().getModelInstanceName();
- String resourceId = resource.getResourceId();
-
- for (int i = 0; i < placementArr.length(); i++) {
- JSONObject placementObj = placementArr.getJSONObject(i);
- String placementModuleName = placementObj.getString("resourceModuleName");
- if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
- String placementString = placementObj.toString();
- placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newPlacementObj = new JSONObject(placementString);
- placementArr.put(i, newPlacementObj);
- }
- }
-
- for (int i = 0; i < licenseArr.length(); i++) {
- JSONObject licenseObj = licenseArr.getJSONObject(i);
- String licenseModuleName = licenseObj.getString("resourceModuleName");
- if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
- String licenseString = licenseObj.toString();
- licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
- JSONObject newLicenseObj = new JSONObject(licenseString);
- licenseArr.put(i, newLicenseObj);
- }
- }
- }
- String newPlacementInfos = placementArr.toString();
- String newLicenseInfos = licenseArr.toString();
- content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
- content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
- } catch (Exception e) {
- return false;
- }
-
- }
- }
- }
- logger.debug("Injecting " + messageType + " message");
-
- Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
- logger.debug("Workflow response to {} message: {}", messageType, response);
- return true;
- }
-
-
- /**
* Wait for the process to end.
*
* @param businessKey the process business key
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index 3734510eed..91cfa93a34 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -34,6 +34,8 @@ import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.common.recipe.ResourceInput;
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder;
import org.springframework.beans.factory.annotation.Autowired;
public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
@@ -61,6 +63,12 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
+ ResourceInput ri = getUpdateResInputObj("OLT");
+ if (ri != null) {
+ variables.put("resourceInput", ri.toString());
+ } else {
+ variables.put("resourceInput", null);
+ }
// when
ProcessInstance instance =
runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -79,6 +87,12 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
+ ResourceInput ri = getUpdateResInputObj("OLT");
+ if (ri != null) {
+ variables.put("resourceInput", ri.toString());
+ } else {
+ variables.put("resourceInput", null);
+ }
// when
ProcessInstance instance =
runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -93,4 +107,31 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap())
.containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
}
+
+ private ResourceInput getUpdateResInputObj(String modelName) {
+
+ String resourceInput = "{\n" + "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n"
+ + "\t\"resourceInstanceDes\": null,\n" + "\t\"globalSubscriberId\": \"sdwandemo\",\n"
+ + "\t\"serviceType\": \"CCVPN\",\n" + "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n"
+ + "\t\"serviceModelInfo\": {\n" + "\t\t\"modelName\": \"WanConnectionSvc03\",\n"
+ + "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n"
+ + "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n"
+ + "\t\t\"modelVersion\": \"1.0\",\n" + "\t\t\"modelCustomizationUuid\": \"\",\n"
+ + "\t\t\"modelCustomizationName\": \"\",\n" + "\t\t\"modelInstanceName\": \"\",\n"
+ + "\t\t\"modelType\": \"\"\n" + "\t},\n" + "\t\"resourceModelInfo\": {\n" + "\t\t\"modelName\": \""
+ + modelName + "\",\n" + "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n"
+ + "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n"
+ + "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n"
+ + "\t\t\"modelCustomizationName\": \"\",\n"
+ + "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" + "\t\t\"modelType\": \"\"\n" + "\t},\n"
+ + "\t\"resourceInstancenUuid\": null,\n"
+ + "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n"
+ + "\t\"operationType\": \"createInstance\",\n"
+ + "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n"
+ + "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n"
+ + "}";
+
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class);
+ return resourceInputObj;
+ }
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index e7ff69ab3b..dd993bca51 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -20,7 +20,9 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
+import java.util.HashMap;
import java.util.Objects;
+import java.util.Optional;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@@ -33,7 +35,8 @@ public class DmaapClientTestImpl implements DmaapClient {
private Runnable informConsumer;
@Override
- public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
+ Optional<HashMap<String, String>> updateInfo) {
this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
diff --git a/bpmn/pom.xml b/bpmn/pom.xml
index 85a45db6ba..65af2fd8d5 100644
--- a/bpmn/pom.xml
+++ b/bpmn/pom.xml
@@ -24,8 +24,8 @@
<xmlunit.version>2.4.0</xmlunit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <sdnc.northbound.version>1.5.1</sdnc.northbound.version>
- <appc.client.version>1.5.0</appc.client.version>
+ <sdnc.northbound.version>1.5.2</sdnc.northbound.version>
+ <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
</properties>
<modules>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
index e4f1998c40..12f30cfa58 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
+++ b/bpmn/so-bpmn-building-blocks/src/main/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecs.java
@@ -31,6 +31,8 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.stereotype.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Component
public class DeployActivitySpecs {
@@ -38,10 +40,12 @@ public class DeployActivitySpecs {
private static final String ACTIVITY_SPEC_URI = "/activityspec-api/v1.0/activity-spec";
private static final String CONTENT_TYPE_JSON = "application/json";
+ private static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class);
+
public static void main(String[] args) throws Exception {
if (args == null || args.length == 0) {
- System.out.println("Please specify hostname argument");
+ logger.info("Please specify hostname argument");
return;
}
@@ -49,20 +53,23 @@ public class DeployActivitySpecs {
File dir = new File(ACTIVITY_FILE_LOCATION);
if (!dir.isDirectory()) {
- System.out.println("ActivitySpec store is not a directory");
+ logger.debug("ActivitySpec store is not a directory");
return;
}
- for (File f : dir.listFiles()) {
- String activitySpecName = f.getName();
- String errorMessage = deployActivitySpec(hostname, activitySpecName);
- if (errorMessage == null) {
- System.out.println("Deployed Activity Spec: " + activitySpecName);
- } else {
- System.out.println("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage);
+ if (dir.listFiles() != null) {
+ for (File f : dir.listFiles()) {
+ String activitySpecName = f.getName();
+ String errorMessage = deployActivitySpec(hostname, activitySpecName);
+ if (errorMessage == null) {
+ logger.debug("Deployed Activity Spec: " + activitySpecName);
+ } else {
+ logger.error("Error deploying Activity Spec: " + activitySpecName + " : " + errorMessage);
+ }
}
+ } else {
+ logger.error("Null file list for Activity Specs.");
}
- return;
}
protected static String deployActivitySpec(String hostname, String activitySpecName) throws Exception {
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn
index fb9704d294..884ec209aa 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn
@@ -22,11 +22,11 @@
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_0b84ki5" sourceRef="UpdateDbStatusToPendingManualTask" targetRef="CreateExternalTicket" />
<bpmn2:sequenceFlow id="SequenceFlow_14cyk9v" sourceRef="UpdateDbStatusToInProgress" targetRef="PauseForManualTaskActivity_End" />
- <bpmn2:serviceTask id="UpdateDbStatusToPendingManualTask" name="Update Infra DB Status to PENDING_MANUAL_TASK" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(execution,&#34;PENDING_MANUAL_TASK&#34;)}">
+ <bpmn2:serviceTask id="UpdateDbStatusToPendingManualTask" name="Update Infra DB Status to PENDING_MANUAL_TASK" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),&#34;PENDING_MANUAL_TASK&#34;)}">
<bpmn2:incoming>SequenceFlow_0jav6cu</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0b84ki5</bpmn2:outgoing>
</bpmn2:serviceTask>
- <bpmn2:serviceTask id="UpdateDbStatusToInProgress" name="Update Infra DB Status to IN_PROGRESS" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(execution, &#34;IN_PROGRESS&#34;)}">
+ <bpmn2:serviceTask id="UpdateDbStatusToInProgress" name="Update Infra DB Status to IN_PROGRESS" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), &#34;IN_PROGRESS&#34;)}">
<bpmn2:incoming>SequenceFlow_192yimz</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_14cyk9v</bpmn2:outgoing>
</bpmn2:serviceTask>
@@ -37,12 +37,12 @@
<bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression"><![CDATA[${execution.getVariable("taskTimeout")}]]></bpmn2:timeDuration>
</bpmn2:timerEventDefinition>
</bpmn2:boundaryEvent>
- <bpmn2:serviceTask id="CreateExternalTicket" name="Create ExternalTicket" camunda:expression="${ManualHandlingTasks.createExternalTicket(execution)}">
+ <bpmn2:serviceTask id="CreateExternalTicket" name="Create ExternalTicket" camunda:expression="${ManualHandlingTasks.createExternalTicket(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn2:incoming>SequenceFlow_0b84ki5</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0igra4l</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_01k6zgt" sourceRef="ManualTaskTimer" targetRef="UpdateDBStatusToTimeout" />
- <bpmn2:serviceTask id="UpdateDBStatusToTimeout" name="Update Infra DB Status To TIMEOUT" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(execution, &#34;TIMEOUT&#34;)}">
+ <bpmn2:serviceTask id="UpdateDBStatusToTimeout" name="Update Infra DB Status To TIMEOUT" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), &#34;TIMEOUT&#34;)}">
<bpmn2:incoming>SequenceFlow_01k6zgt</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_16bjdgj</bpmn2:outgoing>
</bpmn2:serviceTask>
@@ -147,4 +147,4 @@
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn2:definitions>
+</bpmn2:definitions> \ No newline at end of file
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn
index 0dbe989cb2..d70e103009 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0">
- <bpmn:process id="VNFUnsetInClosedLoopDisabledFlagActivity" name="VNFUnsetInClosedLoopDisabledFlagActivity" isExecutable="true">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+ <bpmn:process id="VNFUnsetClosedLoopDisabledFlagActivity" name="VNFUnsetClosedLoopDisabledFlagActivity" isExecutable="true">
<bpmn:startEvent id="VNFUnsetClosedLoopDisabledFlagActivity_Start">
<bpmn:outgoing>SequenceFlow_19it9ao</bpmn:outgoing>
</bpmn:startEvent>
@@ -15,7 +15,7 @@
<bpmn:sequenceFlow id="SequenceFlow_1en9xbh" sourceRef="TaskVNFUnsetClosedLoopDisabledFlagActivity" targetRef="VNFUnsetClosedLoopDisabledFlagActivity_End" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUnsetInClosedLoopDisabledFlagActivity">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUnsetClosedLoopDisabledFlagActivity">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUnsetClosedLoopDisabledFlagActivity_Start">
<dc:Bounds x="173" y="102" width="36" height="36" />
</bpmndi:BPMNShape>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
index 289ab6e155..ff37874978 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.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.7.1">
+<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:process id="ActivateVfModuleBB" name="ActivateVfModuleBB" isExecutable="true">
<bpmn:startEvent id="ActivateVfModuleBB_Start">
<bpmn:outgoing>SequenceFlow_0ieafii</bpmn:outgoing>
@@ -9,9 +9,7 @@
<bpmn:incoming>SequenceFlow_0xsp0pv</bpmn:incoming>
</bpmn:endEvent>
<bpmn:serviceTask id="ActivateVfModule" name="&#10;SDNC&#10;Activate&#10;(vf module)&#10;" camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_109oxx2</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_0arwo1o</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1b63lv4</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1a495wm</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="UpdateVfModuleActiveStatus" name="&#10;AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
@@ -40,13 +38,8 @@
<bpmn:incoming>SequenceFlow_0xndboi</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ee42yq</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:exclusiveGateway id="ExclusiveGateway_1v8bmbu" default="SequenceFlow_07ybdik">
- <bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_0ghzwlo</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_07ybdik" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="ActivateVfModule" />
- <bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit">
+ <bpmn:sequenceFlow id="SequenceFlow_07ybdik" name="No" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="ExclusiveGateway_0sqvzll" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" name="Yes" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0ee42yq" sourceRef="Audit_AAI_Inventory" targetRef="ExclusiveGateway_1h8avxn" />
@@ -55,154 +48,252 @@
<bpmn:outgoing>SequenceFlow_1xqyur9</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1xqyur9" sourceRef="CheckAuditVariable" targetRef="ExclusiveGateway_1v8bmbu" />
- <bpmn:exclusiveGateway id="ExclusiveGateway_1h8avxn" default="SequenceFlow_1bo83qk">
- <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_109oxx2</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1bo83qk</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_109oxx2" sourceRef="ExclusiveGateway_1h8avxn" targetRef="ActivateVfModule">
+ <bpmn:sequenceFlow id="SequenceFlow_109oxx2" name="No" sourceRef="ExclusiveGateway_1h8avxn" targetRef="ExclusiveGateway_0y0ek7t">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful")== true }]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_1bo83qk" name="If Audit Fails" sourceRef="ExclusiveGateway_1h8avxn" targetRef="Create_AAI_Inventory" />
- <bpmn:sequenceFlow id="SequenceFlow_0arwo1o" sourceRef="Create_AAI_Inventory" targetRef="ActivateVfModule" />
+ <bpmn:sequenceFlow id="SequenceFlow_1bo83qk" name="Yes" sourceRef="ExclusiveGateway_1h8avxn" targetRef="Create_AAI_Inventory" />
+ <bpmn:sequenceFlow id="SequenceFlow_0arwo1o" sourceRef="Create_AAI_Inventory" targetRef="ExclusiveGateway_0y0ek7t" />
<bpmn:serviceTask id="Create_AAI_Inventory" name="Create A&#38;AI Inventory" camunda:type="external" camunda:topic="InventoryCreate">
<bpmn:incoming>SequenceFlow_1bo83qk</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0arwo1o</bpmn:outgoing>
</bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1b63lv4" sourceRef="ExclusiveGateway_0sqvzll" targetRef="ActivateVfModule" />
+ <bpmn:sequenceFlow id="SequenceFlow_18faffa" sourceRef="ExclusiveGateway_0y0ek7t" targetRef="ExclusiveGateway_0sqvzll" />
+ <bpmn:subProcess id="SubProcess_0bpsptg" name="Audit Exception Sub Process" triggeredByEvent="true">
+ <bpmn:startEvent id="catchInventoryException">
+ <bpmn:outgoing>SequenceFlow_19gbhlj</bpmn:outgoing>
+ <bpmn:errorEventDefinition errorRef="Error_1s3kxze" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_067jv1n">
+ <bpmn:incoming>SequenceFlow_0l4jzc5</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_19gbhlj" sourceRef="catchInventoryException" targetRef="processAuditException" />
+ <bpmn:sequenceFlow id="SequenceFlow_0l4jzc5" sourceRef="processAuditException" targetRef="EndEvent_067jv1n" />
+ <bpmn:serviceTask id="processAuditException" name="Proccess Error" camunda:expression="${ExceptionBuilder.processAuditException(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), false)}">
+ <bpmn:incoming>SequenceFlow_19gbhlj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0l4jzc5</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:subProcess>
+ <bpmn:inclusiveGateway id="ExclusiveGateway_1v8bmbu" name="Audit Enabled?" default="SequenceFlow_07ybdik">
+ <bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0ghzwlo</bpmn:outgoing>
+ </bpmn:inclusiveGateway>
+ <bpmn:inclusiveGateway id="ExclusiveGateway_0sqvzll">
+ <bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_18faffa</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1b63lv4</bpmn:outgoing>
+ </bpmn:inclusiveGateway>
+ <bpmn:inclusiveGateway id="ExclusiveGateway_1h8avxn" name="Audit Failed?" default="SequenceFlow_1bo83qk">
+ <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_109oxx2</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1bo83qk</bpmn:outgoing>
+ </bpmn:inclusiveGateway>
+ <bpmn:inclusiveGateway id="ExclusiveGateway_0y0ek7t">
+ <bpmn:incoming>SequenceFlow_109oxx2</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0arwo1o</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18faffa</bpmn:outgoing>
+ </bpmn:inclusiveGateway>
</bpmn:process>
<bpmn:error id="Error_0q258vt" errorCode="7000" />
+ <bpmn:error id="Error_0zgccif" name="org.onap.so.adapters.inventory.create.InventoryException" errorCode="org.onap.so.adapters.inventory.create.InventoryException" />
+ <bpmn:error id="Error_1s3kxze" name="Error_3q664s5" errorCode="AAIInventoryFailure" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateVfModuleBB">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="ActivateVfModuleBB_Start">
- <dc:Bounds x="73" y="102" width="36" height="36" />
+ <dc:Bounds x="85" y="234" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="46" y="138" width="90" height="12" />
+ <dc:Bounds x="58" y="270" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0ieafii_di" bpmnElement="SequenceFlow_0ieafii">
- <di:waypoint xsi:type="dc:Point" x="109" y="120" />
- <di:waypoint xsi:type="dc:Point" x="161" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="121" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="201" y="252" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="90" y="99" width="90" height="12" />
+ <dc:Bounds x="116" y="231" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1v967li_di" bpmnElement="ActivateVfModuleBB_End">
- <dc:Bounds x="1104" y="102" width="36" height="36" />
+ <dc:Bounds x="1404" y="235" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="935" y="142" width="90" height="12" />
+ <dc:Bounds x="1235" y="275" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule">
- <dc:Bounds x="647" y="80" width="100" height="80" />
+ <dc:Bounds x="958" y="212" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus">
- <dc:Bounds x="952" y="80" width="100" height="80" />
+ <dc:Bounds x="1214" y="212" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0xsp0pv_di" bpmnElement="SequenceFlow_0xsp0pv">
- <di:waypoint xsi:type="dc:Point" x="1052" y="120" />
- <di:waypoint xsi:type="dc:Point" x="1104" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="1314" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1404" y="253" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1033" y="99" width="90" height="12" />
+ <dc:Bounds x="1314" y="231.5" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_03jkesd_di" bpmnElement="CallActivity_sdncHandler">
- <dc:Bounds x="794" y="80" width="100" height="80" />
+ <dc:Bounds x="1086" y="212" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1a495wm_di" bpmnElement="SequenceFlow_1a495wm">
- <di:waypoint xsi:type="dc:Point" x="747" y="120" />
- <di:waypoint xsi:type="dc:Point" x="794" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="1058" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1086" y="252" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="725.5" y="99" width="90" height="12" />
+ <dc:Bounds x="1027" y="231" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej">
- <di:waypoint xsi:type="dc:Point" x="894" y="120" />
- <di:waypoint xsi:type="dc:Point" x="952" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="1186" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1214" y="252" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="878" y="99" width="90" height="12" />
+ <dc:Bounds x="1155" y="231" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0xndboi_di" bpmnElement="SequenceFlow_0xndboi">
- <di:waypoint xsi:type="dc:Point" x="365" y="256" />
- <di:waypoint xsi:type="dc:Point" x="408" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="491" y="175" />
+ <di:waypoint xsi:type="dc:Point" x="513" y="175" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="341.5" y="234.5" width="90" height="13" />
+ <dc:Bounds x="457" y="153.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0krf1ur_di" bpmnElement="Setup_AAI_Inventory_Audit">
- <dc:Bounds x="265" y="216" width="100" height="80" />
+ <dc:Bounds x="391" y="135" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_08rxjeb_di" bpmnElement="Audit_AAI_Inventory">
- <dc:Bounds x="408" y="216" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ExclusiveGateway_1v8bmbu_di" bpmnElement="ExclusiveGateway_1v8bmbu" isMarkerVisible="true">
- <dc:Bounds x="290" y="95" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="315" y="148" width="0" height="13" />
- </bpmndi:BPMNLabel>
+ <dc:Bounds x="513" y="135" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_07ybdik_di" bpmnElement="SequenceFlow_07ybdik">
- <di:waypoint xsi:type="dc:Point" x="340" y="120" />
- <di:waypoint xsi:type="dc:Point" x="647" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="355" y="277" />
+ <di:waypoint xsi:type="dc:Point" x="355" y="315" />
+ <di:waypoint xsi:type="dc:Point" x="881" y="315" />
+ <di:waypoint xsi:type="dc:Point" x="881" y="277" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="448.5" y="98.5" width="90" height="13" />
+ <dc:Bounds x="364" y="294" width="14" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ghzwlo_di" bpmnElement="SequenceFlow_0ghzwlo">
- <di:waypoint xsi:type="dc:Point" x="315" y="145" />
- <di:waypoint xsi:type="dc:Point" x="315" y="216" />
+ <di:waypoint xsi:type="dc:Point" x="355" y="227" />
+ <di:waypoint xsi:type="dc:Point" x="355" y="175" />
+ <di:waypoint xsi:type="dc:Point" x="391" y="175" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="330" y="174" width="0" height="13" />
+ <dc:Bounds x="362" y="185" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ee42yq_di" bpmnElement="SequenceFlow_0ee42yq">
- <di:waypoint xsi:type="dc:Point" x="508" y="256" />
- <di:waypoint xsi:type="dc:Point" x="566" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="613" y="175" />
+ <di:waypoint xsi:type="dc:Point" x="638" y="175" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="492" y="234.5" width="90" height="13" />
+ <dc:Bounds x="580.5" y="153.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1eg5ryx_di" bpmnElement="CheckAuditVariable">
- <dc:Bounds x="161" y="80" width="100" height="80" />
+ <dc:Bounds x="201" y="212" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1xqyur9_di" bpmnElement="SequenceFlow_1xqyur9">
- <di:waypoint xsi:type="dc:Point" x="261" y="120" />
- <di:waypoint xsi:type="dc:Point" x="290" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="301" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="330" y="252" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="275.5" y="98.5" width="0" height="13" />
+ <dc:Bounds x="270.5" y="230.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ExclusiveGateway_1h8avxn_di" bpmnElement="ExclusiveGateway_1h8avxn" isMarkerVisible="true">
- <dc:Bounds x="566" y="231" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="591" y="284" width="0" height="13" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_109oxx2_di" bpmnElement="SequenceFlow_109oxx2">
- <di:waypoint xsi:type="dc:Point" x="616" y="256" />
- <di:waypoint xsi:type="dc:Point" x="670" y="256" />
- <di:waypoint xsi:type="dc:Point" x="670" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="663" y="200" />
+ <di:waypoint xsi:type="dc:Point" x="663" y="230" />
+ <di:waypoint xsi:type="dc:Point" x="834" y="230" />
+ <di:waypoint xsi:type="dc:Point" x="834" y="200" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="643" y="234.5" width="0" height="13" />
+ <dc:Bounds x="670" y="207" width="14" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1bo83qk_di" bpmnElement="SequenceFlow_1bo83qk">
- <di:waypoint xsi:type="dc:Point" x="591" y="281" />
- <di:waypoint xsi:type="dc:Point" x="591" y="345" />
- <di:waypoint xsi:type="dc:Point" x="656" y="345" />
+ <di:waypoint xsi:type="dc:Point" x="663" y="150" />
+ <di:waypoint xsi:type="dc:Point" x="663" y="101" />
+ <di:waypoint xsi:type="dc:Point" x="691" y="101" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="560" y="358" width="61" height="12" />
+ <dc:Bounds x="667" y="111" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0arwo1o_di" bpmnElement="SequenceFlow_0arwo1o">
- <di:waypoint xsi:type="dc:Point" x="706" y="305" />
- <di:waypoint xsi:type="dc:Point" x="706" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="791" y="101" />
+ <di:waypoint xsi:type="dc:Point" x="834" y="101" />
+ <di:waypoint xsi:type="dc:Point" x="834" y="150" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="721" y="226" width="0" height="13" />
+ <dc:Bounds x="767.5" y="79.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1eb09gr_di" bpmnElement="Create_AAI_Inventory">
- <dc:Bounds x="656" y="305" width="100" height="80" />
+ <dc:Bounds x="691" y="61" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1b63lv4_di" bpmnElement="SequenceFlow_1b63lv4">
+ <di:waypoint xsi:type="dc:Point" x="906" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="958" y="252" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="887" y="231" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_18faffa_di" bpmnElement="SequenceFlow_18faffa">
+ <di:waypoint xsi:type="dc:Point" x="859" y="175" />
+ <di:waypoint xsi:type="dc:Point" x="881" y="175" />
+ <di:waypoint xsi:type="dc:Point" x="881" y="227" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="825" y="154" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_0mbkb7v_di" bpmnElement="SubProcess_0bpsptg" isExpanded="true">
+ <dc:Bounds x="293" y="449" width="350" height="200" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_12r96di_di" bpmnElement="catchInventoryException">
+ <dc:Bounds x="324" y="532" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="341.15269461077844" y="571.6127744510978" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_067jv1n_di" bpmnElement="EndEvent_067jv1n">
+ <dc:Bounds x="572.1526946107784" y="532" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="590.1526946107784" y="572" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_19gbhlj_di" bpmnElement="SequenceFlow_19gbhlj">
+ <di:waypoint xsi:type="dc:Point" x="360" y="550" />
+ <di:waypoint xsi:type="dc:Point" x="415" y="550" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="387.5" y="529" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0l4jzc5_di" bpmnElement="SequenceFlow_0l4jzc5">
+ <di:waypoint xsi:type="dc:Point" x="515" y="550" />
+ <di:waypoint xsi:type="dc:Point" x="572" y="550" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="543.5" y="529" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_08xffml_di" bpmnElement="processAuditException">
+ <dc:Bounds x="415" y="510" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="InclusiveGateway_03pi9y4_di" bpmnElement="ExclusiveGateway_1v8bmbu">
+ <dc:Bounds x="330" y="227" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="383" y="246" width="73" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="InclusiveGateway_16ap4e3_di" bpmnElement="ExclusiveGateway_0sqvzll">
+ <dc:Bounds x="856" y="227" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="836" y="281" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="InclusiveGateway_00n600s_di" bpmnElement="ExclusiveGateway_1h8avxn">
+ <dc:Bounds x="638" y="150" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="693" y="169" width="63" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="InclusiveGateway_0xx6c29_di" bpmnElement="ExclusiveGateway_0y0ek7t">
+ <dc:Bounds x="809" y="150" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="789" y="204" width="0" height="12" />
+ </bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn
index 52b9249468..1ea311549c 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn
@@ -60,6 +60,7 @@
<camunda:in source="networkAdapterRequest" target="networkAdapterRequest" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="createNetworkResponse" target="createNetworkResponse" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1fm99t6</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0qpu80i</bpmn2:outgoing>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn
index 74b78ef735..512cb7b45e 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteNetworkBB.bpmn
@@ -22,6 +22,7 @@
<camunda:in source="networkAdapterRequest" target="networkAdapterRequest" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="deleteNetworkResponse" target="deleteNetworkResponse" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_16ti327</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0gnafn2</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
index e1b36cfe65..ca0f8452cf 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
@@ -1,14 +1,13 @@
<?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.7.1">
+<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:process id="DeleteVfModuleBB" name="DeleteVfModuleBB" isExecutable="true">
<bpmn:startEvent id="DeleteVfModuleBB_Start">
- <bpmn:outgoing>SequenceFlow_1537yw5</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1oeootm</bpmn:outgoing>
</bpmn:startEvent>
- <bpmn:serviceTask id="DeleteVfModuleVnfAdapter" name="Delete Vf Module VnfAdapter" camunda:expression="${VnfAdapterDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_1n8gab5</bpmn:incoming>
+ <bpmn:serviceTask id="DeleteVfModuleVnfAdapter" name="Prepare Request" camunda:expression="${VnfAdapterDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_028rmiu</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_08tvhtf</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_1537yw5" sourceRef="DeleteVfModuleBB_Start" targetRef="ExclusiveGateway_0xrgzm7" />
<bpmn:serviceTask id="UpdateVfModuleDeleteStatus" name="&#10;AAI &#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeleteVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_01vfwtp</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_09l7pcg</bpmn:outgoing>
@@ -51,300 +50,484 @@
<bpmn:sequenceFlow id="SequenceFlow_01vfwtp" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleDeleteStatus" />
<bpmn:sequenceFlow id="SequenceFlow_09l7pcg" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" />
<bpmn:sequenceFlow id="SequenceFlow_0xyu3pk" sourceRef="DeleteNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" />
- <bpmn:serviceTask id="DeleteNetworkPolicies" name="AAI Delete (network policies)" camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_14bu4ys</bpmn:incoming>
+ <bpmn:serviceTask id="DeleteNetworkPolicies" name="&#10;AAI&#10;Delete&#10;(net policies)&#10;" camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_179btn2</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0xyu3pk</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="&#10;AAI &#10;Update&#10;(vnf)&#10;" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0jtem3b</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0khqfnc</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0jtem3b" sourceRef="UpdateVnfIpv4OamAddress" targetRef="UpdateVnfManagementV6Address" />
- <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="&#10;AAI &#10;Update &#10;(vnf)&#10;" camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0xyu3pk</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0jtem3b</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0khqfnc" sourceRef="UpdateVnfManagementV6Address" targetRef="UpdateVfModuleContrailServiceInstanceFqdn" />
<bpmn:sequenceFlow id="SequenceFlow_0yuz21z" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" />
- <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="&#10;AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0khqfnc</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0yuz21z</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_1n8gab5" sourceRef="ExclusiveGateway_0xrgzm7" targetRef="DeleteVfModuleVnfAdapter" />
- <bpmn:parallelGateway id="ExclusiveGateway_0xrgzm7">
- <bpmn:incoming>SequenceFlow_1537yw5</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1n8gab5</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1v3jgqe</bpmn:outgoing>
- </bpmn:parallelGateway>
- <bpmn:sequenceFlow id="SequenceFlow_032jv5j" name="Yes&#10;" sourceRef="ExclusiveGateway_1h2ystu" targetRef="Setup_Audit_Variable">
+ <bpmn:sequenceFlow id="SequenceFlow_032jv5j" name="Yes&#10;" sourceRef="auditEnabledCheck" targetRef="Setup_Audit_Variable">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_0qfmmgt" sourceRef="Audit_Inventory" targetRef="ExclusiveGateway_1pydilb" />
- <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="DeleteNetworkPolicies" />
- <bpmn:parallelGateway id="ExclusiveGateway_1yvh16a">
- <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_1ut7n32</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_14bu4ys</bpmn:outgoing>
- </bpmn:parallelGateway>
- <bpmn:sequenceFlow id="SequenceFlow_1mgunf3" name="No" sourceRef="ExclusiveGateway_1h2ystu" targetRef="ExclusiveGateway_1pydilb" />
- <bpmn:serviceTask id="Check_Audit" name="Check Audit Variable" camunda:expression="${AuditTasks.isAuditNeeded(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_1v3jgqe</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1odt2wt</bpmn:outgoing>
+ <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="aaiThrow" />
+ <bpmn:serviceTask id="Check_Audit" name="Check Audit Variable" camunda:expression="${AuditTasks.isDeleteAuditNeeded(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1oeootm</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_10af0fk</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_1v3jgqe" sourceRef="ExclusiveGateway_0xrgzm7" targetRef="Check_Audit" />
- <bpmn:sequenceFlow id="SequenceFlow_1odt2wt" sourceRef="Check_Audit" targetRef="ExclusiveGateway_1h2ystu" />
- <bpmn:sequenceFlow id="SequenceFlow_1swistn" sourceRef="Setup_Audit_Variable" targetRef="Audit_Inventory" />
- <bpmn:serviceTask id="Audit_Inventory" name="Audit Inventory For Delete in AAI" camunda:type="external" camunda:topic="InventoryDeleteAudit">
- <bpmn:incoming>SequenceFlow_1swistn</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0qfmmgt</bpmn:outgoing>
+ <bpmn:serviceTask id="Audit_Inventory" name="&#10;AAI&#10;Audit&#10;(vservers)&#10;" camunda:type="external" camunda:topic="InventoryDeleteAudit">
+ <bpmn:incoming>SequenceFlow_0f5ljoh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0hpj2mm</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="Setup_Audit_Variable" name="Setup Audit Variable" camunda:expression="${AuditTasks.setupAuditVariable(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_032jv5j</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1swistn</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1iulltd</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_1ut7n32" sourceRef="ExclusiveGateway_1pydilb" targetRef="ExclusiveGateway_1yvh16a" />
- <bpmn:exclusiveGateway id="ExclusiveGateway_1h2ystu" name="Audit&#10; Enabled?" default="SequenceFlow_1mgunf3">
- <bpmn:incoming>SequenceFlow_1odt2wt</bpmn:incoming>
+ <bpmn:subProcess id="SubProcess_0grvkj2" name="Audit Exception Sub Process" triggeredByEvent="true">
+ <bpmn:endEvent id="EndEvent_1gzq57j">
+ <bpmn:incoming>SequenceFlow_1fhst92</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="ServiceTask_1isbxvo" name="Proccess Error" camunda:expression="${ExceptionBuilder.processAuditException(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), true)}">
+ <bpmn:incoming>SequenceFlow_0xuodpy</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1fhst92</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0xuodpy" sourceRef="StartEvent_1euiddy" targetRef="ServiceTask_1isbxvo" />
+ <bpmn:sequenceFlow id="SequenceFlow_1fhst92" sourceRef="ServiceTask_1isbxvo" targetRef="EndEvent_1gzq57j" />
+ <bpmn:startEvent id="StartEvent_1euiddy" isInterrupting="false">
+ <bpmn:outgoing>SequenceFlow_0xuodpy</bpmn:outgoing>
+ <bpmn:escalationEventDefinition escalationRef="Escalation_130je8j" camunda:escalationCodeVariable="auditCode" />
+ </bpmn:startEvent>
+ </bpmn:subProcess>
+ <bpmn:sequenceFlow id="SequenceFlow_179btn2" sourceRef="aaiCatch" targetRef="DeleteNetworkPolicies" />
+ <bpmn:intermediateThrowEvent id="aaiThrow" name="Update AAI">
+ <bpmn:incoming>SequenceFlow_14bu4ys</bpmn:incoming>
+ <bpmn:linkEventDefinition name="AAI" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:intermediateCatchEvent id="aaiCatch" name="Update AAI">
+ <bpmn:outgoing>SequenceFlow_179btn2</bpmn:outgoing>
+ <bpmn:linkEventDefinition name="AAI" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_17cd9e2" name="Yes/No" sourceRef="auditSuccessfulCheck" targetRef="ExclusiveGateway_01wvywu">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful") == false || execution.getVariable("auditIsSuccessful") == true}]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1gdyk9j" name="No" sourceRef="auditSuccessfulCheck" targetRef="EndEvent_0b0ocu0">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful") == false}]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:inclusiveGateway id="auditSuccessfulCheck" name="Audit&#10; Successful?">
+ <bpmn:incoming>SequenceFlow_0hpj2mm</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_17cd9e2</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1gdyk9j</bpmn:outgoing>
+ </bpmn:inclusiveGateway>
+ <bpmn:endEvent id="EndEvent_0b0ocu0">
+ <bpmn:incoming>SequenceFlow_1gdyk9j</bpmn:incoming>
+ <bpmn:escalationEventDefinition escalationRef="Escalation_130je8j" />
+ </bpmn:endEvent>
+ <bpmn:exclusiveGateway id="auditEnabledCheck" name="Audit&#10; Enabled?" default="SequenceFlow_1bt1p2u">
+ <bpmn:incoming>SequenceFlow_10af0fk</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_032jv5j</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1mgunf3</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1bt1p2u</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:exclusiveGateway id="ExclusiveGateway_1pydilb">
- <bpmn:incoming>SequenceFlow_0qfmmgt</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_1mgunf3</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1ut7n32</bpmn:outgoing>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1t9q2jl">
+ <bpmn:incoming>SequenceFlow_1bt1p2u</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0dzf7hz</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1bq9g02</bpmn:outgoing>
</bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1bt1p2u" name="No" sourceRef="auditEnabledCheck" targetRef="ExclusiveGateway_1t9q2jl" />
+ <bpmn:sequenceFlow id="SequenceFlow_1oeootm" sourceRef="DeleteVfModuleBB_Start" targetRef="Check_Audit" />
+ <bpmn:sequenceFlow id="SequenceFlow_10af0fk" sourceRef="Check_Audit" targetRef="auditEnabledCheck" />
+ <bpmn:serviceTask id="aicQueryStack" name="&#10;AIC&#10;Query&#10;(stack)&#10;" camunda:type="external" camunda:topic="InventoryQueryAudit">
+ <bpmn:incoming>SequenceFlow_1iulltd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0dzf7hz</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1iulltd" sourceRef="Setup_Audit_Variable" targetRef="aicQueryStack" />
+ <bpmn:sequenceFlow id="SequenceFlow_0dzf7hz" sourceRef="aicQueryStack" targetRef="ExclusiveGateway_1t9q2jl" />
+ <bpmn:sequenceFlow id="SequenceFlow_1bq9g02" sourceRef="ExclusiveGateway_1t9q2jl" targetRef="ExclusiveGateway_1naduhl" />
+ <bpmn:sequenceFlow id="SequenceFlow_0mtzl4z" sourceRef="ExclusiveGateway_1naduhl" targetRef="ExclusiveGateway_13fhmpf" />
+ <bpmn:sequenceFlow id="SequenceFlow_028rmiu" sourceRef="ExclusiveGateway_1naduhl" targetRef="DeleteVfModuleVnfAdapter" />
+ <bpmn:parallelGateway id="ExclusiveGateway_1naduhl">
+ <bpmn:incoming>SequenceFlow_1bq9g02</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0mtzl4z</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_028rmiu</bpmn:outgoing>
+ </bpmn:parallelGateway>
+ <bpmn:inclusiveGateway id="ExclusiveGateway_1yvh16a">
+ <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_13mlz57</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_14bu4ys</bpmn:outgoing>
+ </bpmn:inclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0hpj2mm" sourceRef="Audit_Inventory" targetRef="auditSuccessfulCheck" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_13fhmpf" name="Audit&#10; Enabled?" default="SequenceFlow_1gjwivp">
+ <bpmn:incoming>SequenceFlow_0mtzl4z</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0f5ljoh</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1gjwivp</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0f5ljoh" name="Yes" sourceRef="ExclusiveGateway_13fhmpf" targetRef="Audit_Inventory">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_01wvywu">
+ <bpmn:incoming>SequenceFlow_17cd9e2</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1gjwivp</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_13mlz57</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1gjwivp" name="No" sourceRef="ExclusiveGateway_13fhmpf" targetRef="ExclusiveGateway_01wvywu" />
+ <bpmn:sequenceFlow id="SequenceFlow_13mlz57" sourceRef="ExclusiveGateway_01wvywu" targetRef="ExclusiveGateway_1yvh16a" />
</bpmn:process>
+ <bpmn:error id="Error_0jjnve8" name="Error_3k24na6" errorCode="AAIInventoryFailure" />
+ <bpmn:escalation id="Escalation_130je8j" name="audit" escalationCode="audit1" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteVfModuleBB_Start">
- <dc:Bounds x="159" y="241" width="36" height="36" />
+ <dc:Bounds x="159" y="266" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="132" y="277" width="90" height="12" />
+ <dc:Bounds x="132" y="302" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_16798zf_di" bpmnElement="DeleteVfModuleVnfAdapter">
- <dc:Bounds x="382" y="278" width="100" height="80" />
+ <dc:Bounds x="888" y="312" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1537yw5_di" bpmnElement="SequenceFlow_1537yw5">
- <di:waypoint xsi:type="dc:Point" x="195" y="259" />
- <di:waypoint xsi:type="dc:Point" x="282" y="259" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="193.5" y="238" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus">
- <dc:Bounds x="840" y="443" width="100" height="80" />
+ <dc:Bounds x="907" y="468" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf">
- <di:waypoint xsi:type="dc:Point" x="482" y="318" />
- <di:waypoint xsi:type="dc:Point" x="511" y="318" />
+ <di:waypoint xsi:type="dc:Point" x="988" y="352" />
+ <di:waypoint xsi:type="dc:Point" x="1020" y="352" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="451.5" y="297" width="90" height="12" />
+ <dc:Bounds x="959" y="331" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End">
- <dc:Bounds x="1087" y="465" width="36" height="36" />
+ <dc:Bounds x="1268" y="490" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1060" y="505" width="90" height="0" />
+ <dc:Bounds x="1241" y="530" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter">
- <dc:Bounds x="511" y="278" width="100" height="80" />
+ <dc:Bounds x="1020" y="312" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87">
- <di:waypoint xsi:type="dc:Point" x="611" y="318" />
- <di:waypoint xsi:type="dc:Point" x="836" y="318" />
- <di:waypoint xsi:type="dc:Point" x="836" y="284" />
+ <di:waypoint xsi:type="dc:Point" x="1120" y="352" />
+ <di:waypoint xsi:type="dc:Point" x="1203" y="352" />
+ <di:waypoint xsi:type="dc:Point" x="1203" y="309" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="678.5" y="303" width="90" height="0" />
+ <dc:Bounds x="1116.5" y="337" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true">
- <dc:Bounds x="294" y="618" width="231" height="135" />
+ <dc:Bounds x="290" y="878" width="231" height="135" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_1xp6ewt_di" bpmnElement="StartEvent_1xp6ewt">
- <dc:Bounds x="337" y="680" width="36" height="36" />
+ <dc:Bounds x="333" y="940" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="265" y="716" width="90" height="0" />
+ <dc:Bounds x="261" y="976" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0guhjau_di" bpmnElement="EndEvent_0guhjau">
- <dc:Bounds x="466" y="680" width="36" height="36" />
+ <dc:Bounds x="462" y="940" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="394" y="716" width="90" height="0" />
+ <dc:Bounds x="390" y="976" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0h607z0_di" bpmnElement="SequenceFlow_0h607z0">
- <di:waypoint xsi:type="dc:Point" x="373" y="698" />
- <di:waypoint xsi:type="dc:Point" x="466" y="698" />
+ <di:waypoint xsi:type="dc:Point" x="369" y="958" />
+ <di:waypoint xsi:type="dc:Point" x="462" y="958" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="375" y="677" width="90" height="0" />
+ <dc:Bounds x="371" y="937" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId">
- <dc:Bounds x="706" y="443" width="100" height="80" />
+ <dc:Bounds x="779" y="468" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp">
- <di:waypoint xsi:type="dc:Point" x="806" y="483" />
- <di:waypoint xsi:type="dc:Point" x="840" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="879" y="508" />
+ <di:waypoint xsi:type="dc:Point" x="907" y="508" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="778" y="468" width="90" height="0" />
+ <dc:Bounds x="848" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg">
- <di:waypoint xsi:type="dc:Point" x="940" y="483" />
- <di:waypoint xsi:type="dc:Point" x="1087" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="1007" y="508" />
+ <di:waypoint xsi:type="dc:Point" x="1268" y="508" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="968.5" y="468" width="90" height="0" />
+ <dc:Bounds x="1092.5" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk">
- <di:waypoint xsi:type="dc:Point" x="998" y="259" />
- <di:waypoint xsi:type="dc:Point" x="1072" y="259" />
- <di:waypoint xsi:type="dc:Point" x="1072" y="399" />
- <di:waypoint xsi:type="dc:Point" x="233" y="399" />
- <di:waypoint xsi:type="dc:Point" x="233" y="483" />
- <di:waypoint xsi:type="dc:Point" x="280" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="376" y="508" />
+ <di:waypoint xsi:type="dc:Point" x="404" y="508" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="607.5" y="384" width="90" height="0" />
+ <dc:Bounds x="345" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0tty0ac_di" bpmnElement="DeleteNetworkPolicies">
- <dc:Bounds x="898" y="219" width="100" height="80" />
+ <dc:Bounds x="276" y="468" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0lrrd16_di" bpmnElement="UpdateVnfManagementV6Address">
- <dc:Bounds x="421" y="443" width="100" height="80" />
+ <dc:Bounds x="531" y="468" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0jtem3b_di" bpmnElement="SequenceFlow_0jtem3b">
- <di:waypoint xsi:type="dc:Point" x="380" y="483" />
- <di:waypoint xsi:type="dc:Point" x="421" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="504" y="508" />
+ <di:waypoint xsi:type="dc:Point" x="531" y="508" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="355.5" y="468" width="90" height="0" />
+ <dc:Bounds x="473" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0w9805b_di" bpmnElement="UpdateVnfIpv4OamAddress">
- <dc:Bounds x="280" y="443" width="100" height="80" />
+ <dc:Bounds x="404" y="468" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0khqfnc_di" bpmnElement="SequenceFlow_0khqfnc">
- <di:waypoint xsi:type="dc:Point" x="521" y="483" />
- <di:waypoint xsi:type="dc:Point" x="561" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="631" y="508" />
+ <di:waypoint xsi:type="dc:Point" x="654" y="508" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="496" y="468" width="90" height="0" />
+ <dc:Bounds x="598" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0yuz21z_di" bpmnElement="SequenceFlow_0yuz21z">
- <di:waypoint xsi:type="dc:Point" x="661" y="483" />
- <di:waypoint xsi:type="dc:Point" x="706" y="483" />
+ <di:waypoint xsi:type="dc:Point" x="754" y="508" />
+ <di:waypoint xsi:type="dc:Point" x="779" y="508" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="638.5" y="468" width="90" height="0" />
+ <dc:Bounds x="722" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0v8naz9_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn">
- <dc:Bounds x="561" y="443" width="100" height="80" />
+ <dc:Bounds x="654" y="468" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1n8gab5_di" bpmnElement="SequenceFlow_1n8gab5">
- <di:waypoint xsi:type="dc:Point" x="307" y="284" />
- <di:waypoint xsi:type="dc:Point" x="307" y="318" />
- <di:waypoint xsi:type="dc:Point" x="382" y="318" />
+ <bpmndi:BPMNEdge id="SequenceFlow_032jv5j_di" bpmnElement="SequenceFlow_032jv5j">
+ <di:waypoint xsi:type="dc:Point" x="397" y="259" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="214" />
+ <di:waypoint xsi:type="dc:Point" x="444" y="214" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="277" y="294.5" width="90" height="13" />
+ <dc:Bounds x="405.5348837209302" y="217.95121951219514" width="19" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ParallelGateway_18x6mx2_di" bpmnElement="ExclusiveGateway_0xrgzm7">
- <dc:Bounds x="282" y="234" width="50" height="50" />
+ <bpmndi:BPMNEdge id="SequenceFlow_14bu4ys_di" bpmnElement="SequenceFlow_14bu4ys">
+ <di:waypoint xsi:type="dc:Point" x="1228" y="284" />
+ <di:waypoint xsi:type="dc:Point" x="1323" y="284" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="262" y="287" width="90" height="13" />
+ <dc:Bounds x="1230.5" y="262.5" width="90" height="13" />
</bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1vmz3zo_di" bpmnElement="Check_Audit">
+ <dc:Bounds x="244" y="244" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_032jv5j_di" bpmnElement="SequenceFlow_032jv5j">
- <di:waypoint xsi:type="dc:Point" x="492" y="149" />
- <di:waypoint xsi:type="dc:Point" x="492" y="108" />
- <di:waypoint xsi:type="dc:Point" x="531" y="108" />
+ <bpmndi:BPMNShape id="ServiceTask_1l8r2a6_di" bpmnElement="Audit_Inventory">
+ <dc:Bounds x="930" y="117" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1gttdjr_di" bpmnElement="Setup_Audit_Variable">
+ <dc:Bounds x="444" y="174" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_0grvkj2_di" bpmnElement="SubProcess_0grvkj2" isExpanded="true">
+ <dc:Bounds x="231" y="642" width="350" height="200" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1gzq57j_di" bpmnElement="EndEvent_1gzq57j">
+ <dc:Bounds x="510" y="725" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="438" y="765" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1isbxvo_di" bpmnElement="ServiceTask_1isbxvo">
+ <dc:Bounds x="353" y="703" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xuodpy_di" bpmnElement="SequenceFlow_0xuodpy">
+ <di:waypoint xsi:type="dc:Point" x="298" y="743" />
+ <di:waypoint xsi:type="dc:Point" x="353" y="743" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="499" y="114" width="18" height="25" />
+ <dc:Bounds x="280.5" y="722" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0qfmmgt_di" bpmnElement="SequenceFlow_0qfmmgt">
- <di:waypoint xsi:type="dc:Point" x="754" y="108" />
- <di:waypoint xsi:type="dc:Point" x="784" y="108" />
- <di:waypoint xsi:type="dc:Point" x="784" y="149" />
+ <bpmndi:BPMNEdge id="SequenceFlow_1fhst92_di" bpmnElement="SequenceFlow_1fhst92">
+ <di:waypoint xsi:type="dc:Point" x="453" y="743" />
+ <di:waypoint xsi:type="dc:Point" x="510" y="743" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="724" y="86.5" width="90" height="13" />
+ <dc:Bounds x="393" y="722" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_14bu4ys_di" bpmnElement="SequenceFlow_14bu4ys">
- <di:waypoint xsi:type="dc:Point" x="861" y="259" />
- <di:waypoint xsi:type="dc:Point" x="898" y="259" />
+ <bpmndi:BPMNEdge id="SequenceFlow_179btn2_di" bpmnElement="SequenceFlow_179btn2">
+ <di:waypoint xsi:type="dc:Point" x="195" y="508" />
+ <di:waypoint xsi:type="dc:Point" x="276" y="508" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="834.5" y="237.5" width="90" height="13" />
+ <dc:Bounds x="191" y="487" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ParallelGateway_02fjfb8_di" bpmnElement="ExclusiveGateway_1yvh16a">
- <dc:Bounds x="811" y="234" width="50" height="50" />
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_1sftyjz_di" bpmnElement="aaiThrow">
+ <dc:Bounds x="1323" y="266" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="790" y="287" width="90" height="13" />
+ <dc:Bounds x="1315" y="305" width="55" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1mgunf3_di" bpmnElement="SequenceFlow_1mgunf3">
- <di:waypoint xsi:type="dc:Point" x="492" y="199" />
- <di:waypoint xsi:type="dc:Point" x="492" y="232" />
- <di:waypoint xsi:type="dc:Point" x="784" y="232" />
- <di:waypoint xsi:type="dc:Point" x="784" y="199" />
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_13y483m_di" bpmnElement="aaiCatch">
+ <dc:Bounds x="159" y="490" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="499" y="212" width="15" height="13" />
+ <dc:Bounds x="150" y="530" width="55" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_17cd9e2_di" bpmnElement="SequenceFlow_17cd9e2">
+ <di:waypoint xsi:type="dc:Point" x="1108" y="157" />
+ <di:waypoint xsi:type="dc:Point" x="1156" y="157" />
+ <di:waypoint xsi:type="dc:Point" x="1156" y="189" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1111.0434782608695" y="137" width="36" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_1vmz3zo_di" bpmnElement="Check_Audit">
- <dc:Bounds x="339" y="134" width="100" height="80" />
+ <bpmndi:BPMNEdge id="SequenceFlow_1gdyk9j_di" bpmnElement="SequenceFlow_1gdyk9j">
+ <di:waypoint xsi:type="dc:Point" x="1083" y="132" />
+ <di:waypoint xsi:type="dc:Point" x="1083" y="109" />
+ <di:waypoint xsi:type="dc:Point" x="1083" y="109" />
+ <di:waypoint xsi:type="dc:Point" x="1083" y="84" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1083" y="110.74468085106383" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="InclusiveGateway_0i6rdd1_di" bpmnElement="auditSuccessfulCheck">
+ <dc:Bounds x="1058" y="132" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1053" y="186" width="60" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_04qhoba_di" bpmnElement="StartEvent_1euiddy">
+ <dc:Bounds x="262" y="725" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="189" y="765" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1onxfk1_di" bpmnElement="EndEvent_0b0ocu0">
+ <dc:Bounds x="1065" y="48" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1024" y="87" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_05scr6c_di" bpmnElement="auditEnabledCheck" isMarkerVisible="true">
+ <dc:Bounds x="371.6051332675222" y="259" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="421" y="272" width="45" height="24" />
+ </bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1v3jgqe_di" bpmnElement="SequenceFlow_1v3jgqe">
- <di:waypoint xsi:type="dc:Point" x="307" y="234" />
- <di:waypoint xsi:type="dc:Point" x="307" y="174" />
- <di:waypoint xsi:type="dc:Point" x="339" y="174" />
+ <bpmndi:BPMNShape id="ExclusiveGateway_1t9q2jl_di" bpmnElement="ExclusiveGateway_1t9q2jl" isMarkerVisible="true">
+ <dc:Bounds x="697" y="259" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="277" y="197.5" width="90" height="13" />
+ <dc:Bounds x="677" y="313" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1bt1p2u_di" bpmnElement="SequenceFlow_1bt1p2u">
+ <di:waypoint xsi:type="dc:Point" x="397" y="309" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="352" />
+ <di:waypoint xsi:type="dc:Point" x="722" y="352" />
+ <di:waypoint xsi:type="dc:Point" x="722" y="309" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="407" y="326" width="14" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1odt2wt_di" bpmnElement="SequenceFlow_1odt2wt">
- <di:waypoint xsi:type="dc:Point" x="439" y="174" />
- <di:waypoint xsi:type="dc:Point" x="467" y="174" />
+ <bpmndi:BPMNEdge id="SequenceFlow_1oeootm_di" bpmnElement="SequenceFlow_1oeootm">
+ <di:waypoint xsi:type="dc:Point" x="195" y="284" />
+ <di:waypoint xsi:type="dc:Point" x="244" y="284" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="408" y="152.5" width="90" height="13" />
+ <dc:Bounds x="219.5" y="263" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1swistn_di" bpmnElement="SequenceFlow_1swistn">
- <di:waypoint xsi:type="dc:Point" x="631" y="108" />
- <di:waypoint xsi:type="dc:Point" x="654" y="108" />
+ <bpmndi:BPMNEdge id="SequenceFlow_10af0fk_di" bpmnElement="SequenceFlow_10af0fk">
+ <di:waypoint xsi:type="dc:Point" x="344" y="284" />
+ <di:waypoint xsi:type="dc:Point" x="372" y="284" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="597.5" y="86.5" width="90" height="13" />
+ <dc:Bounds x="358" y="263" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_1l8r2a6_di" bpmnElement="Audit_Inventory">
- <dc:Bounds x="654" y="68" width="100" height="80" />
+ <bpmndi:BPMNShape id="ServiceTask_1l7z1c0_di" bpmnElement="aicQueryStack">
+ <dc:Bounds x="571" y="174" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_1gttdjr_di" bpmnElement="Setup_Audit_Variable">
- <dc:Bounds x="531" y="68" width="100" height="80" />
+ <bpmndi:BPMNEdge id="SequenceFlow_1iulltd_di" bpmnElement="SequenceFlow_1iulltd">
+ <di:waypoint xsi:type="dc:Point" x="544" y="214" />
+ <di:waypoint xsi:type="dc:Point" x="571" y="214" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="557.5" y="193" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0dzf7hz_di" bpmnElement="SequenceFlow_0dzf7hz">
+ <di:waypoint xsi:type="dc:Point" x="671" y="214" />
+ <di:waypoint xsi:type="dc:Point" x="722" y="214" />
+ <di:waypoint xsi:type="dc:Point" x="722" y="259" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="651.5" y="193" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1bq9g02_di" bpmnElement="SequenceFlow_1bq9g02">
+ <di:waypoint xsi:type="dc:Point" x="747" y="284" />
+ <di:waypoint xsi:type="dc:Point" x="796" y="284" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="726.5" y="263" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mtzl4z_di" bpmnElement="SequenceFlow_0mtzl4z">
+ <di:waypoint xsi:type="dc:Point" x="821" y="259" />
+ <di:waypoint xsi:type="dc:Point" x="821" y="214" />
+ <di:waypoint xsi:type="dc:Point" x="846" y="214" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="791" y="231" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_028rmiu_di" bpmnElement="SequenceFlow_028rmiu">
+ <di:waypoint xsi:type="dc:Point" x="821" y="309" />
+ <di:waypoint xsi:type="dc:Point" x="821" y="352" />
+ <di:waypoint xsi:type="dc:Point" x="888" y="352" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="791" y="324.5" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ParallelGateway_1we1ooj_di" bpmnElement="ExclusiveGateway_1naduhl">
+ <dc:Bounds x="796" y="259" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="775" y="313" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="InclusiveGateway_07wvmp4_di" bpmnElement="ExclusiveGateway_1yvh16a">
+ <dc:Bounds x="1178" y="259" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1067" y="312" width="90" height="12" />
+ </bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1ut7n32_di" bpmnElement="SequenceFlow_1ut7n32">
- <di:waypoint xsi:type="dc:Point" x="809" y="174" />
- <di:waypoint xsi:type="dc:Point" x="836" y="174" />
- <di:waypoint xsi:type="dc:Point" x="836" y="234" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0hpj2mm_di" bpmnElement="SequenceFlow_0hpj2mm">
+ <di:waypoint xsi:type="dc:Point" x="1030" y="157" />
+ <di:waypoint xsi:type="dc:Point" x="1058" y="157" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="777.5" y="152.5" width="90" height="13" />
+ <dc:Bounds x="999" y="136" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ExclusiveGateway_1olwkdn_di" bpmnElement="ExclusiveGateway_1h2ystu" isMarkerVisible="true">
- <dc:Bounds x="467" y="149" width="50" height="50" />
+ <bpmndi:BPMNShape id="ExclusiveGateway_13fhmpf_di" bpmnElement="ExclusiveGateway_13fhmpf" isMarkerVisible="true">
+ <dc:Bounds x="846" y="189" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="518" y="162" width="47" height="25" />
+ <dc:Bounds x="898" y="202" width="45" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ExclusiveGateway_1d1pmqz_di" bpmnElement="ExclusiveGateway_1pydilb" isMarkerVisible="true">
- <dc:Bounds x="759" y="149" width="50" height="50" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0f5ljoh_di" bpmnElement="SequenceFlow_0f5ljoh">
+ <di:waypoint xsi:type="dc:Point" x="871" y="189" />
+ <di:waypoint xsi:type="dc:Point" x="871" y="157" />
+ <di:waypoint xsi:type="dc:Point" x="930" y="157" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="877.601615925754" y="162.89580806038546" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_01wvywu_di" bpmnElement="ExclusiveGateway_01wvywu" isMarkerVisible="true">
+ <dc:Bounds x="1131" y="189" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="694" y="202" width="0" height="13" />
+ <dc:Bounds x="1111" y="243" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1gjwivp_di" bpmnElement="SequenceFlow_1gjwivp">
+ <di:waypoint xsi:type="dc:Point" x="871" y="239" />
+ <di:waypoint xsi:type="dc:Point" x="871" y="266" />
+ <di:waypoint xsi:type="dc:Point" x="1156" y="266" />
+ <di:waypoint xsi:type="dc:Point" x="1156" y="239" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="879" y="244" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_13mlz57_di" bpmnElement="SequenceFlow_13mlz57">
+ <di:waypoint xsi:type="dc:Point" x="1181" y="214" />
+ <di:waypoint xsi:type="dc:Point" x="1203" y="214" />
+ <di:waypoint xsi:type="dc:Point" x="1203" y="259" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1147" y="193" width="90" 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/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn
index 83363d48ba..e64c44eb94 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.7.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.10.0">
<bpmn:process id="ExecuteBuildingBlock" name="ExecuteBuildingBlock" isExecutable="true">
<bpmn:startEvent id="Start_ExecuteBuildingBlock" name="start">
<bpmn:outgoing>SequenceFlow_0rq4c5r</bpmn:outgoing>
@@ -10,6 +10,8 @@
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
+ <camunda:out source="StatusMessage" target="StatusMessage" />
+ <camunda:in source="isRollback" target="isRollback" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_19wuics</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_01h9qmz</bpmn:outgoing>
@@ -36,13 +38,8 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0je0y25" sourceRef="StatusPolicy" targetRef="CheckOrchestrationStatusValidationResults" />
<bpmn:subProcess id="SubProcess_0tv8zda" name="Error Handling&#10;&#10;" triggeredByEvent="true">
- <bpmn:startEvent id="StartEvent_0tmcs9g">
- <bpmn:outgoing>SequenceFlow_09synl9</bpmn:outgoing>
- <bpmn:errorEventDefinition camunda:errorCodeVariable="WorkflowExceptionCode" camunda:errorMessageVariable="WorkflowExceptionMessage" />
- </bpmn:startEvent>
- <bpmn:sequenceFlow id="SequenceFlow_09synl9" sourceRef="StartEvent_0tmcs9g" targetRef="Task_QueryRainyDayTable" />
<bpmn:serviceTask id="Task_QueryRainyDayTable" name="QueryRainyDayTable" camunda:expression="${ExecuteBuildingBlockRainyDay.queryRainyDayTable(execution,true)}">
- <bpmn:incoming>SequenceFlow_09synl9</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0vdeqxv</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0a62t4c</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:exclusiveGateway id="ExclusiveGateway_1aonzik" name="Check HandlingCode" default="SequenceFlow_0h8v45y">
@@ -92,6 +89,16 @@
<bpmn:incoming>SequenceFlow_0541bid</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_12ps9at</bpmn:outgoing>
</bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0vdeqxv" sourceRef="Task_UpdateExtErrorSource" targetRef="Task_QueryRainyDayTable" />
+ <bpmn:sequenceFlow id="SequenceFlow_09synl9" sourceRef="StartEvent_0tmcs9g" targetRef="Task_UpdateExtErrorSource" />
+ <bpmn:startEvent id="StartEvent_0tmcs9g">
+ <bpmn:outgoing>SequenceFlow_09synl9</bpmn:outgoing>
+ <bpmn:errorEventDefinition camunda:errorCodeVariable="WorkflowExceptionCode" camunda:errorMessageVariable="WorkflowExceptionMessage" />
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="Task_UpdateExtErrorSource" name="Update ExtErrorSource" camunda:expression="${ExecuteBuildingBlockRainyDay.updateExtSystemErrorSource(execution)}">
+ <bpmn:incoming>SequenceFlow_09synl9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0vdeqxv</bpmn:outgoing>
+ </bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_16lmcxp" sourceRef="Task_setHandlingCodeSuccess" targetRef="End_ExecuteBuildingBlock" />
<bpmn:sequenceFlow id="SequenceFlow_1j0vskt" name="Silent Success" sourceRef="CheckOrchestrationStatusValidationResults" targetRef="Task_setHandlingCodeSuccess">
@@ -162,63 +169,63 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0ey4zpt_di" bpmnElement="ExclusiveGateway_0ey4zpt" isMarkerVisible="true">
- <dc:Bounds x="721" y="385" width="50" height="50" />
+ <dc:Bounds x="692" y="389" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="716" y="360" width="63" height="13" />
+ <dc:Bounds x="686" y="364" width="65" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_0qjyidb_di" bpmnElement="IntermediateCatchEvent_RetryTimer">
- <dc:Bounds x="965" y="392" width="36" height="36" />
+ <dc:Bounds x="936" y="396" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="956" y="367" width="55" height="13" />
+ <dc:Bounds x="927" y="371" width="56" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1aonzik_di" bpmnElement="ExclusiveGateway_1aonzik" isMarkerVisible="true">
- <dc:Bounds x="568" y="385" width="50" height="50" />
+ <dc:Bounds x="539" y="389" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="558" y="347" width="70" height="25" />
+ <dc:Bounds x="528" y="351" width="72" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1wbevp0_di" bpmnElement="SequenceFlow_1wbevp0">
- <di:waypoint xsi:type="dc:Point" x="771" y="410" />
- <di:waypoint xsi:type="dc:Point" x="836" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="742" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="807" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="788" y="385" width="18" height="13" />
+ <dc:Bounds x="759" y="389" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0fwsjva_di" bpmnElement="SequenceFlow_0fwsjva">
- <di:waypoint xsi:type="dc:Point" x="618" y="410" />
- <di:waypoint xsi:type="dc:Point" x="721" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="589" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="692" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="656" y="418" width="27" height="13" />
+ <dc:Bounds x="627" y="422" width="28" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0h8v45y_di" bpmnElement="SequenceFlow_0h8v45y">
- <di:waypoint xsi:type="dc:Point" x="593" y="435" />
- <di:waypoint xsi:type="dc:Point" x="593" y="491" />
+ <di:waypoint xsi:type="dc:Point" x="564" y="439" />
+ <di:waypoint xsi:type="dc:Point" x="564" y="495" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="600" y="456" width="85" height="13" />
+ <dc:Bounds x="570" y="460" width="88" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1tifgqh_di" bpmnElement="Task_QueryRainyDayTable">
- <dc:Bounds x="425" y="370" width="100" height="80" />
+ <dc:Bounds x="396" y="374" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0ndt8ft_di" bpmnElement="SequenceFlow_0ndt8ft">
- <di:waypoint xsi:type="dc:Point" x="936" y="410" />
- <di:waypoint xsi:type="dc:Point" x="965" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="907" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="906" y="389" width="90" height="12" />
+ <dc:Bounds x="877" y="393" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_07a1ytc_di" bpmnElement="SequenceFlow_07a1ytc">
- <di:waypoint xsi:type="dc:Point" x="1001" y="410" />
- <di:waypoint xsi:type="dc:Point" x="1039" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="972" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="1010" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="975" y="389" width="90" height="12" />
+ <dc:Bounds x="946" y="393" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1obvxht_di" bpmnElement="Task_SetRetryTimer">
- <dc:Bounds x="836" y="370" width="100" height="80" />
+ <dc:Bounds x="807" y="374" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0kdjsnx_di" bpmnElement="Continue">
<di:waypoint xsi:type="dc:Point" x="508" y="180" />
@@ -244,38 +251,25 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0a62t4c_di" bpmnElement="SequenceFlow_0a62t4c">
- <di:waypoint xsi:type="dc:Point" x="525" y="410" />
- <di:waypoint xsi:type="dc:Point" x="568" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="496" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="539" y="414" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="502" y="389" width="90" height="13" />
+ <dc:Bounds x="473" y="393" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_0tv8zda_di" bpmnElement="SubProcess_0tv8zda" isExpanded="true">
- <dc:Bounds x="320" y="294" width="802" height="290" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="StartEvent_0tmcs9g_di" bpmnElement="StartEvent_0tmcs9g">
- <dc:Bounds x="340" y="392" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="223" y="428" width="90" height="12" />
- </bpmndi:BPMNLabel>
+ <dc:Bounds x="171" y="298" width="922" height="295" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_09synl9_di" bpmnElement="SequenceFlow_09synl9">
- <di:waypoint xsi:type="dc:Point" x="376" y="410" />
- <di:waypoint xsi:type="dc:Point" x="425" y="410" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="356" y="389" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0mvmk3i_di" bpmnElement="EndEvent_0mvmk3i">
- <dc:Bounds x="575" y="491" width="36" height="36" />
+ <dc:Bounds x="546" y="495" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="548" y="531" width="90" height="12" />
+ <dc:Bounds x="519" y="535" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1aww7yx_di" bpmnElement="EndEvent_1sez2lh">
- <dc:Bounds x="1039" y="392" width="36" height="36" />
+ <dc:Bounds x="1010" y="396" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1049" y="432" width="19" height="13" />
+ <dc:Bounds x="1020" y="436" width="20" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_16lmcxp_di" bpmnElement="SequenceFlow_16lmcxp">
@@ -318,27 +312,50 @@
<dc:Bounds x="906" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0541bid_di" bpmnElement="SequenceFlow_0541bid">
- <di:waypoint xsi:type="dc:Point" x="746" y="435" />
- <di:waypoint xsi:type="dc:Point" x="746" y="459" />
+ <di:waypoint xsi:type="dc:Point" x="717" y="439" />
+ <di:waypoint xsi:type="dc:Point" x="717" y="463" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="757" y="436" width="13" height="13" />
+ <dc:Bounds x="728" y="440" width="13" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_12ps9at_di" bpmnElement="SequenceFlow_12ps9at">
- <di:waypoint xsi:type="dc:Point" x="796" y="499" />
- <di:waypoint xsi:type="dc:Point" x="868" y="499" />
+ <di:waypoint xsi:type="dc:Point" x="767" y="503" />
+ <di:waypoint xsi:type="dc:Point" x="839" y="503" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="787" y="478" width="90" height="12" />
+ <dc:Bounds x="758" y="482" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_05vw85n_di" bpmnElement="EndEvent_0ex9298">
- <dc:Bounds x="868" y="481" width="36" height="36" />
+ <dc:Bounds x="839" y="485" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="877" y="521" width="19" height="13" />
+ <dc:Bounds x="848" y="525" width="20" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_11f2c91_di" bpmnElement="Task_QuerySecondaryPolicy">
- <dc:Bounds x="696" y="459" width="100" height="80" />
+ <dc:Bounds x="667" y="463" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0vdeqxv_di" bpmnElement="SequenceFlow_0vdeqxv">
+ <di:waypoint xsi:type="dc:Point" x="361" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="396" y="414" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="378.5" y="393" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_0tmcs9g_di" bpmnElement="StartEvent_0tmcs9g">
+ <dc:Bounds x="196" y="396" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="79" y="432" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_09synl9_di" bpmnElement="SequenceFlow_09synl9">
+ <di:waypoint xsi:type="dc:Point" x="232" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="261" y="414" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="201.5" y="393" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_10v49qn_di" bpmnElement="Task_UpdateExtErrorSource">
+ <dc:Bounds x="261" y="374" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn
index b66ecfa329..11227ede4d 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HomingBB.bpmn
@@ -50,6 +50,7 @@ ex.processJavaException(execution)]]></bpmn2:script>
<camunda:in source="asyncCorrelator" target="RCVWFMSG_correlator" />
<camunda:in source="asyncTimeout" target="RCVWFMSG_timeout" />
<camunda:out source="WorkflowResponse" target="asyncResponse" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0qrwjzu</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_03cy5y5</bpmn2: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 76ca2a89cc..efdee8601e 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.7.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: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="2.0.3">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -22,6 +22,10 @@
<camunda:out source="orchestrationStatusValidationResult" target="orchestrationStatusValidationResult" />
<camunda:out source="RetryDuration" target="RetryDuration" />
<camunda:in source="suppressRollback" target="suppressRollback" />
+ <camunda:out source="StatusMessage" target="StatusMessage" />
+ <camunda:in source="isRollback" target="isRollback" />
+ <camunda:in source="rollbackTargetState" target="rollbackTargetState" />
+ <camunda:out source="rollbackTargetState" target="rollbackTargetState" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1hsqed1</bpmn:outgoing>
@@ -42,7 +46,7 @@
<bpmn:outgoing>SequenceFlow_0l7kaba</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==false&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RetrieveBBExectuionList" name="Retrieve BB Execution List" camunda:expression="${WorkflowAction.selectExecutionList(execution)}">
<bpmn:incoming>SequenceFlow_15s0okp</bpmn:incoming>
@@ -79,7 +83,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_024g0d1" name="no" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_UpdateDb" />
<bpmn:sequenceFlow id="SequenceFlow_0vi883o" name="yes" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_SendSyncAckError">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==true&amp;&amp;execution.getVariable("sentSyncResponse")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0eana0l" sourceRef="Task_SendSyncAckError" targetRef="Task_UpdateDb" />
<bpmn:serviceTask id="Task_SendSyncAckError" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}">
@@ -88,10 +92,10 @@
</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"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${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>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RollbackExecutionPath" name="Rollback Execution Path" camunda:expression="${WorkflowActionBBTasks.rollbackExecutionPath(execution)}">
<bpmn:incoming>SequenceFlow_0v588sm</bpmn:incoming>
@@ -100,7 +104,7 @@
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0vc9go9" sourceRef="Task_RetrieveBBExectuionList" targetRef="ExclusiveGateway_isTopLevelFlow" />
<bpmn:sequenceFlow id="SequenceFlow_11530ei" name="Abort = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowAbort">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Abort"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Abort"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_AbortAndCallErrorHandling" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailed(execution)}">
<bpmn:incoming>SequenceFlow_02ksbt0</bpmn:incoming>
@@ -124,7 +128,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0sckerv" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_SendSync" />
<bpmn:sequenceFlow id="SequenceFlow_0unbew4" name="no" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_PreValidateWorkflow">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowAbort" name="Is Top-Level Flow?" default="SequenceFlow_02ksbt0">
<bpmn:incoming>SequenceFlow_11530ei</bpmn:incoming>
@@ -133,7 +137,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_02ksbt0" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="Task_AbortAndCallErrorHandling" />
<bpmn:sequenceFlow id="SequenceFlow_1r570x3" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="EndEvent_0lzz1ya">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowC" name="Is Top-Level Flow?" default="SequenceFlow_0kf5sen">
<bpmn:incoming>SequenceFlow_1m2eezj</bpmn:incoming>
@@ -141,13 +145,13 @@
<bpmn:outgoing>SequenceFlow_0kf5sen</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0x4urgp" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="End_WorkflowActionBB">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="End_RollbackFailed" name="end">
<bpmn:incoming>SequenceFlow_1ui67mc</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_11dlyzt" name="Rollback Not Needed" sourceRef="Task_RollbackExecutionPath" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_UpdateRequestToFailed" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailedWithRollback(execution)}">
<bpmn:incoming>SequenceFlow_11dlyzt</bpmn:incoming>
@@ -155,7 +159,7 @@
<bpmn:outgoing>SequenceFlow_1ui67mc</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0l7kaba" name="Rollback Completed" sourceRef="ExclusiveGateway_Finished" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==true&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1ui67mc" sourceRef="Task_UpdateRequestToFailed" targetRef="End_RollbackFailed" />
<bpmn:subProcess id="SubProcess_0fuugr9" name="Java Exception Handling Sub Process" triggeredByEvent="true">
@@ -209,8 +213,8 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp">
- <di:waypoint xsi:type="dc:Point" x="-398" y="120" />
- <di:waypoint xsi:type="dc:Point" x="-365" y="120" />
+ <di:waypoint x="-398" y="120" />
+ <di:waypoint x="-365" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-381" y="99" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -219,8 +223,8 @@
<dc:Bounds x="560" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv">
- <di:waypoint xsi:type="dc:Point" x="339" y="120" />
- <di:waypoint xsi:type="dc:Point" x="400" y="120" />
+ <di:waypoint x="339" y="120" />
+ <di:waypoint x="400" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="324.5" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -235,9 +239,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1m2eezj_di" bpmnElement="SequenceFlow_1m2eezj">
- <di:waypoint xsi:type="dc:Point" x="949" y="132" />
- <di:waypoint xsi:type="dc:Point" x="980" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1060" y="165" />
+ <di:waypoint x="949" y="132" />
+ <di:waypoint x="980" y="165" />
+ <di:waypoint x="1060" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="968" y="168" width="83" height="12" />
</bpmndi:BPMNLabel>
@@ -252,9 +256,9 @@
<dc:Bounds x="1161" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz">
- <di:waypoint xsi:type="dc:Point" x="1261" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1322" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1322" y="183" />
+ <di:waypoint x="1261" y="246" />
+ <di:waypoint x="1322" y="246" />
+ <di:waypoint x="1322" y="183" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1247" y="231" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -275,16 +279,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm">
- <di:waypoint xsi:type="dc:Point" x="936" y="145" />
- <di:waypoint xsi:type="dc:Point" x="936" y="262" />
- <di:waypoint xsi:type="dc:Point" x="339" y="262" />
+ <di:waypoint x="936" y="145" />
+ <di:waypoint x="936" y="262" />
+ <di:waypoint x="339" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="769.202380952381" y="272" width="73" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn">
- <di:waypoint xsi:type="dc:Point" x="289" y="222" />
- <di:waypoint xsi:type="dc:Point" x="289" y="160" />
+ <di:waypoint x="289" y="222" />
+ <di:waypoint x="289" y="160" />
<bpmndi:BPMNLabel>
<dc:Bounds x="259" y="191" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -293,16 +297,16 @@
<dc:Bounds x="239" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0vc9go9_di" bpmnElement="SequenceFlow_0vc9go9">
- <di:waypoint xsi:type="dc:Point" x="-265" y="120" />
- <di:waypoint xsi:type="dc:Point" x="-228" y="120" />
+ <di:waypoint x="-265" y="120" />
+ <di:waypoint x="-228" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-246" y="105" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei">
- <di:waypoint xsi:type="dc:Point" x="946" y="105" />
- <di:waypoint xsi:type="dc:Point" x="983" y="44" />
- <di:waypoint xsi:type="dc:Point" x="1060" y="45" />
+ <di:waypoint x="946" y="105" />
+ <di:waypoint x="983" y="44" />
+ <di:waypoint x="1060" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="975" y="17" width="58" height="12" />
</bpmndi:BPMNLabel>
@@ -317,28 +321,28 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1p8yxu6_di" bpmnElement="SequenceFlow_1p8yxu6">
- <di:waypoint xsi:type="dc:Point" x="1276" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="1359" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="1359" y="45" />
- <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
+ <di:waypoint x="1276" y="-36" />
+ <di:waypoint x="1359" y="-36" />
+ <di:waypoint x="1359" y="45" />
+ <di:waypoint x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1329" y="5" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic">
- <di:waypoint xsi:type="dc:Point" x="-32" y="34" />
- <di:waypoint xsi:type="dc:Point" x="32" y="34" />
- <di:waypoint xsi:type="dc:Point" x="32" y="120" />
- <di:waypoint xsi:type="dc:Point" x="80" y="120" />
+ <di:waypoint x="-32" y="34" />
+ <di:waypoint x="32" y="34" />
+ <di:waypoint x="32" y="120" />
+ <di:waypoint x="80" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="47" y="77" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u">
- <di:waypoint xsi:type="dc:Point" x="936" y="95" />
- <di:waypoint xsi:type="dc:Point" x="936" y="55" />
- <di:waypoint xsi:type="dc:Point" x="936" y="55" />
- <di:waypoint xsi:type="dc:Point" x="936" y="4" />
+ <di:waypoint x="936" y="95" />
+ <di:waypoint x="936" y="55" />
+ <di:waypoint x="936" y="55" />
+ <di:waypoint x="936" y="4" />
<bpmndi:BPMNLabel>
<dc:Bounds x="906" y="49" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -353,16 +357,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv">
- <di:waypoint xsi:type="dc:Point" x="-202" y="96" />
- <di:waypoint xsi:type="dc:Point" x="-202" y="34" />
- <di:waypoint xsi:type="dc:Point" x="-132" y="34" />
+ <di:waypoint x="-202" y="96" />
+ <di:waypoint x="-202" y="34" />
+ <di:waypoint x="-132" y="34" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-195" y="55.55555555555556" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4">
- <di:waypoint xsi:type="dc:Point" x="-178" y="120" />
- <di:waypoint xsi:type="dc:Point" x="80" y="120" />
+ <di:waypoint x="-178" y="120" />
+ <di:waypoint x="80" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-87" y="99.95468180757382" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -374,16 +378,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02ksbt0_di" bpmnElement="SequenceFlow_02ksbt0">
- <di:waypoint xsi:type="dc:Point" x="1085" y="20" />
- <di:waypoint xsi:type="dc:Point" x="1085" y="-37" />
- <di:waypoint xsi:type="dc:Point" x="1176" y="-37" />
+ <di:waypoint x="1085" y="20" />
+ <di:waypoint x="1085" y="-37" />
+ <di:waypoint x="1176" y="-37" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="-8" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1r570x3_di" bpmnElement="SequenceFlow_1r570x3">
- <di:waypoint xsi:type="dc:Point" x="1110" y="45" />
- <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
+ <di:waypoint x="1110" y="45" />
+ <di:waypoint x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1242" y="20" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -395,10 +399,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp">
- <di:waypoint xsi:type="dc:Point" x="1110" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1304" y="165" />
+ <di:waypoint x="1110" y="165" />
+ <di:waypoint x="1220" y="165" />
+ <di:waypoint x="1220" y="165" />
+ <di:waypoint x="1304" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1256" y="140" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -410,9 +414,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt">
- <di:waypoint xsi:type="dc:Point" x="289" y="302" />
- <di:waypoint xsi:type="dc:Point" x="289" y="368" />
- <di:waypoint xsi:type="dc:Point" x="960" y="368" />
+ <di:waypoint x="289" y="302" />
+ <di:waypoint x="289" y="368" />
+ <di:waypoint x="960" y="368" />
<bpmndi:BPMNLabel>
<dc:Bounds x="381.45685840707966" y="325" width="63" height="24" />
</bpmndi:BPMNLabel>
@@ -424,33 +428,33 @@
<dc:Bounds x="960" y="325" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0l7kaba_di" bpmnElement="SequenceFlow_0l7kaba">
- <di:waypoint xsi:type="dc:Point" x="942" y="139" />
- <di:waypoint xsi:type="dc:Point" x="976" y="252" />
- <di:waypoint xsi:type="dc:Point" x="1016" y="252" />
- <di:waypoint xsi:type="dc:Point" x="1016" y="325" />
+ <di:waypoint x="942" y="139" />
+ <di:waypoint x="976" y="252" />
+ <di:waypoint x="1016" y="252" />
+ <di:waypoint x="1016" y="325" />
<bpmndi:BPMNLabel>
<dc:Bounds x="959" y="255" width="52" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1edjl5x_di" bpmnElement="SequenceFlow_1edjl5x">
- <di:waypoint xsi:type="dc:Point" x="556" y="657" />
- <di:waypoint xsi:type="dc:Point" x="602" y="657" />
+ <di:waypoint x="556" y="657" />
+ <di:waypoint x="602" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="534" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0wvzfgf_di" bpmnElement="SequenceFlow_0wvzfgf">
- <di:waypoint xsi:type="dc:Point" x="813" y="657" />
- <di:waypoint xsi:type="dc:Point" x="880" y="657" />
+ <di:waypoint x="813" y="657" />
+ <di:waypoint x="880" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="801.5" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ui67mc_di" bpmnElement="SequenceFlow_1ui67mc">
- <di:waypoint xsi:type="dc:Point" x="1060" y="365" />
- <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
- <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
- <di:waypoint xsi:type="dc:Point" x="1159" y="365" />
+ <di:waypoint x="1060" y="365" />
+ <di:waypoint x="1134" y="365" />
+ <di:waypoint x="1134" y="365" />
+ <di:waypoint x="1159" y="365" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1104" y="359" width="90" height="13" />
</bpmndi:BPMNLabel>
@@ -462,25 +466,25 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_024g0d1_di" bpmnElement="SequenceFlow_024g0d1">
- <di:waypoint xsi:type="dc:Point" x="652" y="657" />
- <di:waypoint xsi:type="dc:Point" x="683" y="657" />
- <di:waypoint xsi:type="dc:Point" x="683" y="657" />
- <di:waypoint xsi:type="dc:Point" x="713" y="657" />
+ <di:waypoint x="652" y="657" />
+ <di:waypoint x="683" y="657" />
+ <di:waypoint x="683" y="657" />
+ <di:waypoint x="713" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="677" y="634" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0vi883o_di" bpmnElement="SequenceFlow_0vi883o">
- <di:waypoint xsi:type="dc:Point" x="627" y="632" />
- <di:waypoint xsi:type="dc:Point" x="627" y="548" />
- <di:waypoint xsi:type="dc:Point" x="713" y="548" />
+ <di:waypoint x="627" y="632" />
+ <di:waypoint x="627" y="548" />
+ <di:waypoint x="713" y="548" />
<bpmndi:BPMNLabel>
<dc:Bounds x="633" y="584" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0eana0l_di" bpmnElement="SequenceFlow_0eana0l">
- <di:waypoint xsi:type="dc:Point" x="763" y="588" />
- <di:waypoint xsi:type="dc:Point" x="763" y="617" />
+ <di:waypoint x="763" y="588" />
+ <di:waypoint x="763" y="617" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="596.5" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -507,15 +511,15 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11d126w_di" bpmnElement="SequenceFlow_11d126w">
- <di:waypoint xsi:type="dc:Point" x="606" y="875" />
- <di:waypoint xsi:type="dc:Point" x="690" y="875" />
+ <di:waypoint x="606" y="875" />
+ <di:waypoint x="690" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="603" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0w4sx88_di" bpmnElement="SequenceFlow_0w4sx88">
- <di:waypoint xsi:type="dc:Point" x="790" y="875" />
- <di:waypoint xsi:type="dc:Point" x="856" y="875" />
+ <di:waypoint x="790" y="875" />
+ <di:waypoint x="856" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -524,25 +528,25 @@
<dc:Bounds x="400" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im">
- <di:waypoint xsi:type="dc:Point" x="500" y="120" />
- <di:waypoint xsi:type="dc:Point" x="560" y="120" />
+ <di:waypoint x="500" y="120" />
+ <di:waypoint x="560" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="530" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen">
- <di:waypoint xsi:type="dc:Point" x="1085" y="190" />
- <di:waypoint xsi:type="dc:Point" x="1085" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1161" y="246" />
+ <di:waypoint x="1085" y="190" />
+ <di:waypoint x="1085" y="246" />
+ <di:waypoint x="1161" y="246" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="218" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf">
- <di:waypoint xsi:type="dc:Point" x="180" y="120" />
- <di:waypoint xsi:type="dc:Point" x="211" y="120" />
- <di:waypoint xsi:type="dc:Point" x="211" y="120" />
- <di:waypoint xsi:type="dc:Point" x="239" y="120" />
+ <di:waypoint x="180" y="120" />
+ <di:waypoint x="211" y="120" />
+ <di:waypoint x="211" y="120" />
+ <di:waypoint x="239" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="226" y="120" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -554,23 +558,23 @@
<dc:Bounds x="735" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1">
- <di:waypoint xsi:type="dc:Point" x="660" y="120" />
- <di:waypoint xsi:type="dc:Point" x="735" y="120" />
+ <di:waypoint x="660" y="120" />
+ <di:waypoint x="735" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="697.5" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk">
- <di:waypoint xsi:type="dc:Point" x="835" y="120" />
- <di:waypoint xsi:type="dc:Point" x="911" y="120" />
+ <di:waypoint x="835" y="120" />
+ <di:waypoint x="911" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="873" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1pnkpim_di" bpmnElement="SequenceFlow_1pnkpim">
- <di:waypoint xsi:type="dc:Point" x="886" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="289" y="80" />
+ <di:waypoint x="886" y="-36" />
+ <di:waypoint x="289" y="-36" />
+ <di:waypoint x="289" y="80" />
<bpmndi:BPMNLabel>
<dc:Bounds x="587.5" y="-57" width="0" height="12" />
</bpmndi:BPMNLabel>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
index 5ef4d7ea98..ff987b75d4 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
@@ -36,7 +36,7 @@ import org.junit.runner.RunWith;
import org.onap.so.TestApplication;
import org.onap.so.bpmn.buildingblock.HomingV2;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
-import org.onap.so.bpmn.common.validation.BuildingBlockValidatorRunner;
+import org.onap.so.bpmn.common.listener.validation.BuildingBlockValidatorRunner;
import org.onap.so.bpmn.infrastructure.aai.tasks.AAICommonTasks;
import org.onap.so.bpmn.infrastructure.aai.tasks.AAICreateTasks;
import org.onap.so.bpmn.infrastructure.aai.tasks.AAIDeleteTasks;
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java
index 051f373eaf..bd29e5570a 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 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
@@ -93,8 +95,7 @@ public class WorkflowActionBBTest extends BaseBPMNTest {
Map<String, String> map = new HashMap<>();
map.put("handlingCode", "Abort");
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBFailure)
- .abortCallErrorHandling(any(DelegateExecution.class));
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBFailure).abortCallErrorHandling();
mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map);
ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables);
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java
index e88df73f39..47d0ad9b7f 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java
@@ -37,6 +37,7 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest {
@Before
public void before() {
variables.put("auditInventoryNeeded", true);
+ variables.put("auditIsSuccessful", true);
}
@Test
@@ -45,18 +46,20 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest {
mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables);
List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
- .topic("InventoryDeleteAudit", 60L * 1000L).execute();
+ .topic("InventoryDeleteAudit", 60L * 1000L).topic("InventoryQueryAudit", 60L * 1000L).execute();
while (!tasks.isEmpty()) {
for (LockedExternalTask task : tasks) {
externalTaskService.complete(task.getId(), "externalWorkerId");
}
tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryDeleteAudit", 60L * 1000L)
- .execute();
+ .topic("InventoryQueryAudit", 60L * 1000L).execute();
}
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "ExclusiveGateway_0xrgzm7",
- "ExclusiveGateway_1yvh16a", "Check_Audit", "Setup_Audit_Variable", "Audit_Inventory",
- "DeleteVfModuleVnfAdapter", "VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress",
+ assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "Check_Audit", "auditEnabledCheck",
+ "Setup_Audit_Variable", "Setup_Audit_Variable", "aicQueryStack", "ExclusiveGateway_1t9q2jl",
+ "ExclusiveGateway_1naduhl", "ExclusiveGateway_13fhmpf", "DeleteVfModuleVnfAdapter", "VnfAdapter",
+ "Audit_Inventory", "ExclusiveGateway_1yvh16a", "auditSuccessfulCheck", "ExclusiveGateway_01wvywu",
+ "ExclusiveGateway_1yvh16a", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress",
"UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn",
"UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End");
assertThat(pi).isEnded();
@@ -67,19 +70,22 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest {
doThrow(BpmnError.class).when(vnfAdapterDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables);
List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
- .topic("InventoryDeleteAudit", 60L * 1000L).execute();
+ .topic("InventoryDeleteAudit", 60L * 1000L).topic("InventoryQueryAudit", 60L * 1000L).execute();
while (!tasks.isEmpty()) {
for (LockedExternalTask task : tasks) {
externalTaskService.complete(task.getId(), "externalWorkerId");
}
tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryDeleteAudit", 60L * 1000L)
- .execute();
+ .topic("InventoryQueryAudit", 60L * 1000L).execute();
}
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter").hasNotPassed(
- "VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
- "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus",
- "DeleteVfModuleBB_End");
+ assertThat(pi).isStarted()
+ .hasPassed("DeleteVfModuleBB_Start", "Check_Audit", "auditEnabledCheck", "Setup_Audit_Variable",
+ "Setup_Audit_Variable", "aicQueryStack", "ExclusiveGateway_1t9q2jl", "ExclusiveGateway_1naduhl",
+ "ExclusiveGateway_13fhmpf")
+ .hasNotPassed("VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress",
+ "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn",
+ "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End");
assertThat(pi).isEnded();
}
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java
index 484f9b8506..c0b0094f20 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java
@@ -35,6 +35,7 @@ import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
public class PauseForManualTaskActivityTest extends BaseBPMNTest {
@@ -85,7 +86,7 @@ public class PauseForManualTaskActivityTest extends BaseBPMNTest {
@Test
public void rainyDayPauseForManualTask_Test() throws Exception {
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(manualHandlingTasks)
- .createExternalTicket((any(DelegateExecution.class)));
+ .createExternalTicket((any(BuildingBlockExecution.class)));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables);
assertThat(pi).isNotNull().isStarted()
.hasPassedInOrder("PauseForManualTaskActivity_Start", "UpdateDbStatusToPendingManualTask",
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
index 035d124402..a7be9e69c1 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
@@ -33,7 +33,7 @@ public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest {
@Test
public void sunnyDayVNFUnsetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
ProcessInstance pi =
- runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ runtimeService.startProcessInstanceByKey("VNFUnsetClosedLoopDisabledFlagActivity", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
"TaskVNFUnsetClosedLoopDisabledFlagActivity", "VNFUnsetClosedLoopDisabledFlagActivity_End");
@@ -45,7 +45,7 @@ public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest {
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
.modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
ProcessInstance pi =
- runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ runtimeService.startProcessInstanceByKey("VNFUnsetClosedLoopDisabledFlagActivity", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
.hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
index f4bdde5e80..b855e936d0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -33,6 +33,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.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ResourceType
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.slf4j.Logger
@@ -43,7 +45,7 @@ import org.slf4j.LoggerFactory
* flow for SDNC Network Resource Activate
*/
public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( ActivateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( ActivateSDNCNetworkResource.class)
String Prefix = "ACTSDNCRES_"
@@ -52,10 +54,10 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
-
+
MsoUtils msoUtils = new MsoUtils()
- public void preProcessRequest(DelegateExecution execution) {
+ void preProcessRequest(DelegateExecution execution) {
logger.info(" ***** Started preProcessRequest *****")
try {
@@ -81,51 +83,22 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//the operationType from worflow(first node) is highest priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
+ String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type")
+ if (StringUtils.isNotEmpty(operationTypeFromConfig)) {
+ // highest priority if operation type configured
+ operationType = operationTypeFromConfig
+ }
String sdnc_svcAction = "activate"
- switch (resourceInputObj.getResourceModelInfo().getModelName()) {
- case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
- operationType = "SOTNConnectivity"
- break
-
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
- operationType = "SOTNAttachment"
- break
-
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
- operationType = "Site"
- break
-
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- operationType = "SDWANDevice"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- operationType = "SDWANPort"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
- operationType = "SDWANConnectivity"
- break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- operationType = "SDWANAttachment"
- break
-
- default:
- break
- }
+ String sdnc_requestAction = sdnc_svcAction.capitalize() + operationType + "Instance"
- String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
execution.setVariable(Prefix + "requestAction", sdnc_requestAction)
execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId())
execution.setVariable("mso-request-id", requestId)
execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
String msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug(msg)
@@ -133,7 +106,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
}
- public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) {
+ void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) {
logger.info("started prepareUpdateAfterActivateSDNCResource ")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
@@ -162,7 +135,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
}
@@ -174,23 +147,23 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
String customizeResourceParam(String networkInputParametersJson) {
- List<Map<String, Object>> paramList = new ArrayList();
- JSONObject jsonObject = new JSONObject(networkInputParametersJson);
- Iterator iterator = jsonObject.keys();
+ List<Map<String, Object>> paramList = new ArrayList()
+ JSONObject jsonObject = new JSONObject(networkInputParametersJson)
+ Iterator iterator = jsonObject.keys()
while (iterator.hasNext()) {
- String key = iterator.next();
- HashMap<String, String> hashMap = new HashMap();
- hashMap.put("name", key);
+ String key = iterator.next()
+ HashMap<String, String> hashMap = new HashMap()
+ hashMap.put("name", key)
hashMap.put("value", jsonObject.get(key))
paramList.add(hashMap)
}
- Map<String, List<Map<String, Object>>> paramMap = new HashMap();
- paramMap.put("param", paramList);
+ Map<String, List<Map<String, Object>>> paramMap = new HashMap()
+ paramMap.put("param", paramList)
- return new JSONObject(paramMap).toString();
+ return new JSONObject(paramMap).toString()
}
- public void prepareSDNCRequest (DelegateExecution execution) {
+ void prepareSDNCRequest (DelegateExecution execution) {
logger.info("Started prepareSDNCRequest ")
try {
@@ -206,14 +179,14 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String source = execution.getVariable("source")
String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
- String networkInstanceId = execution.getVariable("networkInstanceId")
+ String resourceInstanceId = execution.getVariable("resourceInstanceId")
String serviceType = resourceInputObj.getServiceType()
String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid()
String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion()
String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName()
String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
- String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid();
+ String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid()
String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
@@ -224,11 +197,10 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(networkInputParametersJson)))
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
String sdncTopologyActivateRequest = ""
+ String modelType = resourceInputObj.getResourceModelInfo().getModelType()
- switch (modelName) {
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/:
+ switch (modelType) {
+ case "VNF" :
sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -263,7 +235,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
</service-information>
<vnf-information>
- <vnf-id>${msoUtils.xmlEscape(networkInstanceId)}</vnf-id>
+ <vnf-id>${msoUtils.xmlEscape(resourceInstanceId)}</vnf-id>
<vnf-type></vnf-type>
<onap-model-information>
<model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
@@ -286,8 +258,81 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/:
+ case "GROUP" :
+ //When a new resource creation request reaches SO, the parent resources information needs to be provided
+ //while creating the child resource.
+ String vnfid = resourceInputObj.getVnfId()
+ ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo()
+ String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid()
+ String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid()
+ String vnfmodelUuid = vfModelInfo.getModelUuid()
+ String vnfmodelVersion = vfModelInfo.getModelVersion()
+ String vnfmodelName = vfModelInfo.getModelName()
+ sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEscape(source)}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
+ </onap-model-information>
+ <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
+ </service-information>
+ <vnf-information>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name>
+ </onap-model-information>
+ <vnf-id>${msoUtils.xmlEscape(vnfid)}</vnf-id>
+ </vnf-information>
+ <vf-module-information>
+ <from-preload>false</from-preload>
+ <vf-module-id>${msoUtils.xmlEscape(resourceInstanceId)}</vf-module-id>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
+ </onap-model-information>
+ </vf-module-information>
+ <vf-module-request-input>
+ <vf-module-input-parameters>
+ $netowrkInputParameters
+ </vf-module-input-parameters>
+ </vf-module-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+ break
+
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE" :
sdncTopologyActivateRequest =
"""<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
@@ -322,8 +367,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
</service-information>
<allotted-resource-information>
- <!-- TODO: to be filled as per the request input -->
- <allotted-resource-id>${msoUtils.xmlEscape(networkInstanceId)}</allotted-resource-id>
+ <allotted-resource-id>${msoUtils.xmlEscape(resourceInstanceId)}</allotted-resource-id>
<allotted-resource-type></allotted-resource-type>
<parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id>
<onap-model-information>
@@ -339,6 +383,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</connection-attachment-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
break
// for SDWANConnectivity and SOTN Connectivity
@@ -377,8 +422,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
</service-information>
<network-information>
- <!-- TODO: to be filled by response from create -->
- <network-id>${msoUtils.xmlEscape(networkInstanceId)}</network-id>
+ <network-id>${msoUtils.xmlEscape(resourceInstanceId)}</network-id>
<onap-model-information>
<model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
<model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
@@ -407,7 +451,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.info(" ***** Exit prepareSDNCRequest *****")
}
- public void postActivateSDNCCall(DelegateExecution execution) {
+ void postActivateSDNCCall(DelegateExecution execution) {
logger.info("started postCreateSDNCCall ")
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
@@ -416,7 +460,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
}
- public void sendSyncResponse(DelegateExecution execution) {
+ void sendSyncResponse(DelegateExecution execution) {
logger.info("started sendsyncResp")
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
index 608bf66da9..df11549ff4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -19,9 +19,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -55,7 +55,7 @@ import groovy.json.*
* @param - WorkflowException
*/
public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( CompareModelofE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( CompareModelofE2EServiceInstance.class)
String Prefix="CMPMDSI_"
private static final String DebugFlag = "isDebugEnabled"
@@ -64,7 +64,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- public void preProcessRequest (DelegateExecution execution) {
+ void preProcessRequest (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
String msg = ""
@@ -128,7 +128,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
execution.setVariable("operationType", "CompareModel")
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.info(msg)
@@ -137,7 +137,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
logger.trace("Exit preProcessRequest ")
}
- public void sendSyncResponse (DelegateExecution execution) {
+ void sendSyncResponse (DelegateExecution execution) {
logger.trace("sendSyncResponse ")
try {
@@ -155,7 +155,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
logger.trace("Exit sendSyncResopnse ")
}
- public void sendSyncError (DelegateExecution execution) {
+ void sendSyncError (DelegateExecution execution) {
logger.trace("sendSyncError ")
try {
@@ -182,7 +182,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
}
- public void prepareCompletionRequest (DelegateExecution execution) {
+ void prepareCompletionRequest (DelegateExecution execution) {
logger.trace("prepareCompletion ")
try {
@@ -214,7 +214,7 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
logger.trace("Exit prepareCompletionRequest ")
}
- public void prepareFalloutRequest(DelegateExecution execution){
+ void prepareFalloutRequest(DelegateExecution execution){
logger.trace("prepareFalloutRequest ")
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
index 1578f0f7c0..ced1b928fc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import com.google.gson.JsonObject
import org.json.JSONArray
import org.json.JSONObject
import org.json.XML
@@ -71,7 +72,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( Create3rdONAPE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( Create3rdONAPE2EServiceInstance.class)
public void checkSPPartnerInfo (DelegateExecution execution) {
logger.info(" ***** Started checkSPPartnerInfo *****")
@@ -93,11 +94,12 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
// set local resourceInput
execution.setVariable(Prefix + "ResourceInput", resourceInputObj)
+ String spPartnerModelName = UrnPropertiesReader.getVariable("sp-partner.modelName")
boolean is3rdONAPExist = false
- if(inputParameters.has("sppartner_url"))
+ if(inputParameters.has(spPartnerModelName + "_url"))
{
- String sppartnerUrl = inputParameters.get("sppartner_url")
+ String sppartnerUrl = inputParameters.get(spPartnerModelName + "_url")
if(!isBlank(sppartnerUrl)) {
execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl)
is3rdONAPExist = true
@@ -108,9 +110,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
logger.debug(msg)
}
}
- if(inputParameters.has("sppartner_providingServiceUuid"))
+ if(inputParameters.has(spPartnerModelName + "_providingServiceUuid"))
{
- String sppartnerUUID= inputParameters.get("sppartner_providingServiceUuid")
+ String sppartnerUUID= inputParameters.get(spPartnerModelName + "_providingServiceUuid")
execution.setVariable(Prefix + "SppartnerUUID", sppartnerUUID)
is3rdONAPExist = true
}
@@ -119,9 +121,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String msg = "sppartner providingServiceUuid is blank."
logger.debug(msg)
}
- if(inputParameters.has("sppartner_providingServiceInvariantUuid"))
+ if(inputParameters.has(spPartnerModelName + "_providingServiceInvariantUuid"))
{
- String sppartnerInvarianteUUID = inputParameters.get("sppartner_providingServiceInvariantUuid")
+ String sppartnerInvarianteUUID = inputParameters.get(spPartnerModelName + "_providingServiceInvariantUuid")
execution.setVariable(Prefix + "SppartnerInvarianteUUID", sppartnerInvarianteUUID)
is3rdONAPExist = true
}
@@ -131,9 +133,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
logger.debug(msg)
}
- if(inputParameters.has("sppartner_handoverMode"))
+ if(inputParameters.has(spPartnerModelName + "_handoverMode"))
{
- String handoverMode = inputParameters.get("sppartner_handoverMode")
+ String handoverMode = inputParameters.get(spPartnerModelName + "_handoverMode")
execution.setVariable(Prefix + "HandoverMode", handoverMode)
is3rdONAPExist = true
}
@@ -167,7 +169,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters")
String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
JSONObject inputParameters = new JSONObject(requestInputs)
- execution.setVariable(Prefix + "ServiceParameters", inputParameters)
+ execution.setVariable(Prefix + "ServiceParameters", inputParameters.toString())
// CallSource is added only when ONAP SO calling 3rdONAP(External API) SO(Remote call)
boolean isLocalCall = true
@@ -182,7 +184,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
}
execution.setVariable(Prefix + "CallSource", callSource)
- logger.debug("callSource is: " + callSource )
+ logger.info("callSource is: " + callSource )
execution.setVariable("IsLocalCall", isLocalCall)
@@ -308,39 +310,39 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String handoverMode = execution.getVariable(Prefix + "HandoverMode")
if("SOTN".equalsIgnoreCase(handoverMode)) {
// Put TP Link info into serviceParameters
- JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters")
+ JSONObject inputParameters = new JSONObject(execution.getVariable(Prefix + "ServiceParameters"))
if(inputParameters.has("remote-access-provider-id")) {
- Map<String, Object> crossTPs = new HashMap<String, Object>();
- crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id"));
- crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id"));
- crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id"));
- crossTPs.put("local-access-node-id", inputParameters.get("remote-access-node-id"));
- crossTPs.put("local-access-ltp-id", inputParameters.get("remote-access-ltp-id"));
- crossTPs.put("remote-access-provider-id", inputParameters.get("local-access-provider-id"));
- crossTPs.put("remote-access-client-id", inputParameters.get("local-access-client-id"));
- crossTPs.put("remote-access-topology-id", inputParameters.get("local-access-topology-id"));
- crossTPs.put("remote-access-node-id", inputParameters.get("local-access-node-id"));
- crossTPs.put("remote-access-ltp-id", inputParameters.get("local-access-ltp-id"));
-
- inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id"));
- inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id"));
- inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id"));
- inputParameters.put("local-access-node-id", crossTPs.get("local-access-node-id"));
- inputParameters.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"));
- inputParameters.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"));
- inputParameters.put("remote-access-client-id", crossTPs.get("remote-access-client-id"));
- inputParameters.put("remote-access-topology-id", crossTPs.get("remote-access-topology-id"));
- inputParameters.put("remote-access-node-id", crossTPs.get("remote-access-node-id"));
- inputParameters.put("remote-access-ltp-id", crossTPs.get("remote-access-ltp-id"));
-
- execution.setVariable(Prefix + "ServiceParameters", inputParameters)
+ Map<String, Object> crossTPs = new HashMap<String, Object>()
+ crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id"))
+ crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id"))
+ crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id"))
+ crossTPs.put("local-access-node-id", inputParameters.get("remote-access-node-id"))
+ crossTPs.put("local-access-ltp-id", inputParameters.get("remote-access-ltp-id"))
+ crossTPs.put("remote-access-provider-id", inputParameters.get("local-access-provider-id"))
+ crossTPs.put("remote-access-client-id", inputParameters.get("local-access-client-id"))
+ crossTPs.put("remote-access-topology-id", inputParameters.get("local-access-topology-id"))
+ crossTPs.put("remote-access-node-id", inputParameters.get("local-access-node-id"))
+ crossTPs.put("remote-access-ltp-id", inputParameters.get("local-access-ltp-id"))
+
+ inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id"))
+ inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id"))
+ inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id"))
+ inputParameters.put("local-access-node-id", crossTPs.get("local-access-node-id"))
+ inputParameters.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"))
+ inputParameters.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"))
+ inputParameters.put("remote-access-client-id", crossTPs.get("remote-access-client-id"))
+ inputParameters.put("remote-access-topology-id", crossTPs.get("remote-access-topology-id"))
+ inputParameters.put("remote-access-node-id", crossTPs.get("remote-access-node-id"))
+ inputParameters.put("remote-access-ltp-id", crossTPs.get("remote-access-ltp-id"))
+
+ execution.setVariable(Prefix + "ServiceParameters", inputParameters.toString())
}
else {
logger.error("No allocated CrossONAPResource found in ServiceParameters")
}
}
- logger.info("Exit " + allocateCrossONAPResource)
+ logger.info("Exit allocateCrossONAPResource")
}
public void prepare3rdONAPRequest(DelegateExecution execution) {
@@ -353,6 +355,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
// ExternalAPI message format
String externalId = execution.getVariable("resourceName")
+ String serviceType = execution.getVariable("serviceType")
String category = "E2E Service"
String description = "Service Order from SPPartner"
String requestedStartDate = utils.generateCurrentTimeInUtc()
@@ -360,7 +363,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String priority = "1" // 0-4 0:highest
String subscriberId = execution.getVariable("globalSubscriberId")
String customerRole = "ONAPcustomer"
- String subscriberName = subscriberId
+ // Below SO will pass serviceType as subscriberName and externalAPI will use
+ // the same serviceType in another domain instead of model name
+ String subscriberName = serviceType
String referredType = "Consumer"
String orderItemId = "1"
String action = "add" //for create
@@ -401,13 +406,12 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
_requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap)
requestInputsMap.clear()
- String serviceType = execution.getVariable("serviceType")
requestInputsMap.put("inputName", '"serviceType"')
requestInputsMap.put("inputValue", '"' + serviceType + '"')
_requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap)
// Transfer all uuiRequest incomeParameters to ExternalAPI format
- JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters")
+ JSONObject inputParameters = new JSONObject(execution.getVariable(Prefix + "ServiceParameters"))
for(String key : inputParameters.keySet()) {
String inputName = key
String inputValue = inputParameters.opt(key)
@@ -420,7 +424,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
execution.setVariable(Prefix + "Payload", payload)
- logger.info("Exit " + prepare3rdONAPRequest)
+ logger.info(" ***** Exit prepare3rdONAPRequest *****")
}
public void doCreateE2ESIin3rdONAP(DelegateExecution execution) {
@@ -464,7 +468,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
logger.error("doCreateE2ESIin3rdONAP exception:" + e.getMessage())
}
- logger.info("Exit " + doCreateE2ESIin3rdONAP)
+ logger.info(" ***** Exit doCreateE2ESIin3rdONAP *****")
}
@@ -504,7 +508,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
JSONArray items = responseObj.getJSONArray("orderItem")
- JSONObject item = items[0]
+ JSONObject item = items.get(0)
JSONObject service = item.get("service")
String sppartnerServiceId = service.get("id")
if(sppartnerServiceId == null || sppartnerServiceId.equals("null")) {
@@ -562,7 +566,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
execution.setVariable("statusDescription", "Get Create ServiceOrder Exception")
logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage())
}
- logger.info("Exit " + getE2ESIProgressin3rdONAP)
+ logger.info(" ***** Exit getE2ESIProgressin3rdONAP *****")
}
/**
@@ -570,7 +574,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
*/
public void timeDelay(DelegateExecution execution) {
try {
+ logger.debug("going to sleep for 5 sec")
Thread.sleep(5000)
+ logger.debug("wakeup after 5 sec")
} catch(InterruptedException e) {
logger.error("Time Delay exception" + e)
}
@@ -599,6 +605,8 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
AAIResourcesClient client = new AAIResourcesClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId)
+ logger.info("sending request to create sp-partner: " + uri.toString())
+ logger.info("requestbody: " + partner)
client.create(uri, partner)
AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
@@ -608,7 +616,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
logger.info(msg)
// throw new BpmnError("MSOWorkflowException")
}
- logger.info("Exit " + saveSPPartnerInAAI)
+ logger.info(" ***** Exit saveSPPartnerInAAI *****")
}
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
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 fa3bfdb0e3..cae629fdf0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
@@ -7,7 +7,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -23,30 +23,28 @@
package org.onap.so.bpmn.infrastructure.scripts
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.domain.VnfResource
-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 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.ServiceInstance
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.logger.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
-
import groovy.json.*
/**
@@ -58,7 +56,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String Prefix="CRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( CreateCustomE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateCustomE2EServiceInstance.class)
public void preProcessRequest (DelegateExecution execution) {
@@ -156,7 +154,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
//execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))
//execution.setVariable("failExists", true)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug(msg)
@@ -332,9 +330,9 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
logger.debug("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
}
logger.trace("finished prepareInitServiceOperationStatus")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index b70797c63b..4b3c1aa7b4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -22,6 +22,7 @@
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
@@ -31,14 +32,13 @@ import org.onap.aai.domain.yang.ServiceInstance
import org.onap.aai.domain.yang.ServiceInstances
import org.onap.aai.domain.yang.v13.Metadata
import org.onap.aai.domain.yang.v13.Metadatum
-import org.onap.aai.domain.yang.v13.Pnf
-import org.onap.aai.domain.yang.v13.Pnfs
import org.onap.so.bpmn.common.recipe.ResourceInput
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
-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.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ResourceType
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.client.aai.AAIObjectPlurals
@@ -49,15 +49,13 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import static org.apache.commons.lang3.StringUtils.*
-
/**
* This groovy class supports the <class>CreateSDNCCNetworkResource.bpmn</class> process.
* flow for SDNC Network Resource Create
*/
public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( CreateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateSDNCNetworkResource.class)
String Prefix="CRESDNCRES_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -85,7 +83,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//Deal with recipeParams
String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
- String resourceName = resourceInputObj.getResourceInstanceName()
+
//For sdnc requestAction default is "createNetworkInstance"
String operationType = "Network"
if(!StringUtils.isBlank(recipeParamsFromRequest)){
@@ -96,84 +94,24 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//the operationType from worflow(first node) is highest priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
+ String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type")
+ if (StringUtils.isNotEmpty(operationTypeFromConfig)) {
+ // highest priority if operation type configured
+ operationType = operationTypeFromConfig
+ }
-
- //For sdnc, generate svc_action and request_action
String sdnc_svcAction = "create"
- switch (resourceInputObj.getResourceInstanceName()) {
-
- case ~/[\w\s\W]*overlay[\w\s\W]*/ :
- //This will be resolved in R3.
- sdnc_svcAction ="activate"
- operationType = "NCINetwork"
- break
-
- case ~/[\w\s\W]*underlay[\w\s\W]*/ :
- //This will be resolved in R3.
- operationType ="Network"
- break
-
- case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
- operationType = "SOTNConnectivity"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
- operationType = "SOTNAttachment"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
- operationType = "Site"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- operationType = "SDWANDevice"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- operationType = "SDWANPort"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
- operationType = "SDWANConnectivity"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- operationType = "SDWANAttachment"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*wanconnection[\w\s\W]*/ :
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*AccessConnectivity[\w\s\W]*/ :
- operationType = "AccessConnectivity"
- execution.setVariable("isActivateRequired", "false")
- break
-
- case ~/[\w\s\W]*InternetProfile[\w\s\W]*/ :
- operationType = "InternetProfile"
- execution.setVariable("isActivateRequired", "false")
- break
-
- default:
- break
- }
+ String sdnc_requestAction = sdnc_svcAction.capitalize() + operationType + "Instance"
+ String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() +".activation-required")
+ execution.setVariable("isActivateRequired", isActivateRequired)
- String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
execution.setVariable(Prefix + "requestAction", sdnc_requestAction)
execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId())
execution.setVariable("mso-request-id", requestId)
execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug(msg)
@@ -182,20 +120,20 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
String customizeResourceParam(String networkInputParametersJson) {
- List<Map<String, Object>> paramList = new ArrayList();
- JSONObject jsonObject = new JSONObject(networkInputParametersJson);
- Iterator iterator = jsonObject.keys();
+ List<Map<String, Object>> paramList = new ArrayList()
+ JSONObject jsonObject = new JSONObject(networkInputParametersJson)
+ Iterator iterator = jsonObject.keys()
while (iterator.hasNext()) {
- String key = iterator.next();
- HashMap<String, String> hashMap = new HashMap();
- hashMap.put("name", key);
+ String key = iterator.next()
+ HashMap<String, String> hashMap = new HashMap()
+ hashMap.put("name", key)
hashMap.put("value", jsonObject.get(key))
paramList.add(hashMap)
}
- Map<String, List<Map<String, Object>>> paramMap = new HashMap();
- paramMap.put("param", paramList);
+ Map<String, List<Map<String, Object>>> paramMap = new HashMap()
+ paramMap.put("param", paramList)
- return new JSONObject(paramMap).toString();
+ return new JSONObject(paramMap).toString()
}
private List<Metadatum> getMetaDatum(String customerId,
@@ -216,7 +154,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
* This method updates the resource input by collecting required info from AAI
* @param execution
*/
- public void updateResourceInput(DelegateExecution execution) {
+ public ResourceInput updateResourceInput(DelegateExecution execution) {
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
@@ -225,19 +163,36 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String serInput = jsonUtil.getJsonValue(resourceInputTmp, "requestsInputs")
switch (modelName) {
- case ~/[\w\s\W]*AccessConnectivity[\w\s\W]*/ :
+ case ~/[\w\s\W]*OLT[\w\s\W]*/ :
// get the required properties and update in resource input
def resourceInput = resourceInputObj.getResourceParameters()
String incomingRequest = resourceInputObj.getRequestsInputs()
String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters")
String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
- String cvlan = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.cvlan")
- String svlan = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.svlan")
- String remoteId = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id")
+ String cvlan
+ String svlan
+ String remoteId
+
+ List<Metadatum> metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(),
+ resourceInputObj.getServiceType(),
+ resourceInputObj.getServiceInstanceId())
+ for(Metadatum datum: metadatum) {
+ if (datum.getMetaname().equalsIgnoreCase("cvlan")) {
+ cvlan = datum.getMetaval()
+ }
+
+ if (datum.getMetaname().equalsIgnoreCase("svlan")) {
+ svlan = datum.getMetaval()
+ }
+
+ if (datum.getMetaname().equalsIgnoreCase("remoteId")) {
+ remoteId = datum.getMetaval()
+ }
+ }
+
+ logger.debug("cvlan: "+cvlan+" | svlan: "+svlan+" | remoteId: "+remoteId)
+
String manufacturer = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_manufacturer")
String ontsn = jsonUtil.getJsonValue(serInput,
@@ -254,7 +209,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.debug("new resource Input :" + resourceInputObj.toString())
break
- case ~/[\w\s\W]*InternetProfile[\w\s\W]*/ :
+ case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ :
// get the required properties and update in resource input
def resourceInput = resourceInputObj.getResourceParameters()
String incomingRequest = resourceInputObj.getRequestsInputs()
@@ -262,34 +217,37 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
JSONObject inputParameters = new JSONObject(requestInputs)
- String cvlan = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.cvlan")
- String svlan = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.svlan")
+ String cvlan
+ String svlan
+ String remoteId
String manufacturer = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_manufacturer")
- String remoteId = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id")
+
String ontsn = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_serial_num")
- String serviceType = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.edgeinternetprofile_ip_service_type")
- String macAddr = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.edgeinternetprofile_ip_rg_mac_addr")
- String upStream = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.edgeinternetprofile_ip_upstream_speed")
- String downStream = jsonUtil.getJsonValue(serInput,
- "service.parameters.requestInputs.edgeinternetprofile_ip_downstream_speed")
+
+ List<Metadatum> metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(),
+ resourceInputObj.getServiceType(),
+ resourceInputObj.getServiceInstanceId())
+ for(Metadatum datum: metadatum) {
+ if (datum.getMetaname().equalsIgnoreCase("cvlan")) {
+ cvlan = datum.getMetaval()
+ }
+
+ if (datum.getMetaname().equalsIgnoreCase("svlan")) {
+ svlan = datum.getMetaval()
+ }
+
+ if (datum.getMetaname().equalsIgnoreCase("remoteId")) {
+ remoteId = datum.getMetaval()
+ }
+ }
String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_remote_id", remoteId)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_access_id", remoteId)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ont_sn", ontsn)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_service_type", serviceType)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_rg_mac_addr", macAddr)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_upstream_speed", upStream)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_downstream_speed", downStream)
logger.debug("old resource input:" + resourceInputObj.toString())
resourceInputObj.setResourceParameters(uResourceInput)
execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
@@ -318,25 +276,47 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ case ~/[\w\s\W]*SOTN-Attachment[\w\s\W]*/ :
// fill attachment TP in networkInputParamJson
- String customer = resourceInputObj.getGlobalSubscriberId()
- String serviceType = resourceInputObj.getServiceType()
-
- def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName"
- String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName)
-
- AAIResourcesClient client = new AAIResourcesClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName)
- ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get()
- ServiceInstance si = sis.getServiceInstance().get(0)
-
- def parentServiceInstanceId = si.getServiceInstanceId()
- execution.setVariable("parentServiceInstanceId", parentServiceInstanceId)
+ def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : (StringUtils.containsIgnoreCase(modelName, "SOTN-Attachment") ? "elinesotnattachmentvf0_elinesotnattachmentvfc0_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName")
+ fillAttachmentTPInfo(resourceInputObj, execution, vpnName)
break
default:
+ // Special case for handling alloted resource types
+ // in case name is different as expected
+ if ("ALLOTTED_RESOURCE".equals(resourceInputObj.getResourceModelInfo().getModelType())) {
+ def vpnName = modelName + "_sotnVpnName"
+ fillAttachmentTPInfo(resourceInputObj, execution, vpnName)
+ }
break
}
+ return resourceInputObj
+ }
+
+ private void fillAttachmentTPInfo(ResourceInput resourceInputObj, DelegateExecution execution, String vpnName) {
+
+ String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName)
+
+ AAIResourcesClient client = new AAIResourcesClient()
+ logger.info("sending request to resolve vpn-name:" + vpnName)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(new AAIObjectPlurals("/nodes", "/service-instances", "queryByName")).queryParam("service-instance-name", parentServiceName)
+ Optional<ServiceInstances> serviceInstancesOpt = client.get(ServiceInstances.class, uri)
+
+ if(serviceInstancesOpt.isPresent()) {
+ List<ServiceInstance> serviceInstanceList = serviceInstancesOpt.get().getServiceInstance()
+ logger.info("response from aai:" + serviceInstanceList.toString())
+ if (serviceInstanceList.size() > 0) {
+ ServiceInstance si = serviceInstanceList.get(0)
+ String parentServiceInstanceId = si.getServiceInstanceId()
+ execution.setVariable("parentServiceInstanceId", parentServiceInstanceId)
+ logger.info("setting parentService id:" + parentServiceInstanceId)
+ } else {
+ logger.error("No service instance found for given name.")
+ }
+ } else {
+ logger.error("No nodes found with this name" + vpnName)
+ }
}
/**
@@ -367,7 +347,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion()
String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName()
String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
- String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid();
+ String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid()
String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
@@ -379,10 +359,10 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
String sdncTopologyCreateRequest = ""
- switch (modelName) {
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/:
+ String modelType = resourceInputObj.getResourceModelInfo().getModelType()
+
+ switch (modelType) {
+ case "VNF" :
sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -417,7 +397,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
</service-information>
<vnf-information>
- <vnf-id></vnf-id>
<vnf-type></vnf-type>
<onap-model-information>
<model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
@@ -439,9 +418,14 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ case "GROUP" :
+ String vnfid = resourceInputObj.getVnfId()
+ ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo()
+ String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid()
+ String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid()
+ String vnfmodelUuid = vfModelInfo.getModelUuid()
+ String vnfmodelVersion = vfModelInfo.getModelVersion()
+ String vnfmodelName = vfModelInfo.getModelName()
sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -449,7 +433,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
<sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
<sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
@@ -475,36 +459,45 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
<subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
</service-information>
- <allotted-resource-information>
- <!-- TODO: to be filled as per the request input -->
- <allotted-resource-id></allotted-resource-id>
- <allotted-resource-type></allotted-resource-type>
- <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id>
+ <vnf-information>
<onap-model-information>
- <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
+ <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name>
+ </onap-model-information>
+ <vnf-id>${msoUtils.xmlEscape(vnfid)}</vnf-id>
+ </vnf-information>
+ <vf-module-information>
+ <from-preload>false</from-preload>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
<model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
<model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
<model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
<model-name>${msoUtils.xmlEscape(modelName)}</model-name>
</onap-model-information>
- </allotted-resource-information>
- <connection-attachment-request-input>
- $netowrkInputParameters
- </connection-attachment-request-input>
+ </vf-module-information>
+ <vf-module-request-input>
+ <vf-module-input-parameters>
+ $netowrkInputParameters
+ </vf-module-input-parameters>
+ </vf-module-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- // for SDWANConnectivity and SOTNConnectivity:
- default:
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE" :
sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
<sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
<sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
@@ -528,8 +521,12 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</onap-model-information>
<service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
<global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
</service-information>
- <network-information>
+ <allotted-resource-information>
+ <allotted-resource-id></allotted-resource-id>
+ <allotted-resource-type></allotted-resource-type>
+ <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id>
<onap-model-information>
<model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
<model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
@@ -537,12 +534,65 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
<model-name>${msoUtils.xmlEscape(modelName)}</model-name>
</onap-model-information>
- </network-information>
- <network-request-input>
- <network-input-parameters>$netowrkInputParameters</network-input-parameters>
- </network-request-input>
+ </allotted-resource-information>
+ <connection-attachment-request-input>
+ $netowrkInputParameters
+ </connection-attachment-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
+ break
+
+ // for SDWANConnectivity and SOTNConnectivity:
+ default:
+ sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEscape(source)}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
+ </onap-model-information>
+ <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ </service-information>
+ <network-information>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
+ </onap-model-information>
+ </network-information>
+ <network-request-input>
+ <network-input-parameters>$netowrkInputParameters</network-input-parameters>
+ </network-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
+
}
String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest)
@@ -591,7 +641,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
@@ -624,7 +674,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
}
@@ -634,41 +684,37 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
- def isActivateRequried = execution.getVariable("isActivateRequired")
- if (StringUtils.equalsIgnoreCase(isActivateRequried, "true")) {
- def instnaceId = getInstnaceId(execution)
- execution.setVariable("networkInstanceId", instnaceId)
- }
+ def instnaceId = getInstanceId(execution)
+ execution.setVariable("resourceInstanceId", instnaceId)
logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
logger.info(" ***** Exit prepareSDNCRequest *****")
}
- private def getInstnaceId(DelegateExecution execution) {
+ private def getInstanceId(DelegateExecution execution) {
def response = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse"))
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
def val = ""
- switch (modelName) {
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- case ~/[\w\s\W]*Site[\w\s\W]*/:
+ String modelType = resourceInputObj.getResourceModelInfo().getModelType()
+ switch (modelType) {
+ case "VNF" :
val = response."response-data"."RequestData"."output"."vnf-response-information"."instance-id"
break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/:
+ case "GROUP":
+ val = response."response-data"."RequestData"."output"."vf-module-response-information"."instance-id"
+ break
+ case "ALLOTTED_RESOURCE":
+ // sdwanvpnattachment or sotnvpnattachment
val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id"
break
-
- // for SDWANConnectivity and SOTNConnectivity and default:
default:
+ // SDWANConnectivity or SOTN Connectivity
val = response."response-data"."RequestData"."output"."network-response-information"."instance-id"
break
}
-
return val.toString()
}
@@ -678,7 +724,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
try {
String operationStatus = "finished"
// RESTResponse for main flow
- String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
+ String vnfid=execution.getVariable("resourceInstanceId")
+ String resourceOperationResp = """{"operationStatus":"${operationStatus}","vnf-id":"${vnfid}"}""".trim()
logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
index 433a8d0bb9..901964f465 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -25,7 +25,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.client.HttpClientFactory
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -44,7 +44,7 @@ import org.onap.so.utils.TargetEntity
* flow for VFC Network Service Create
*/
public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( CreateVFCNSResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateVFCNSResource.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -77,7 +77,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId")
logger.info("globalSubscriberId:" + globalSubscriberId)
//set local globalSubscriberId variable
- execution.setVariable("globalSubscriberId", globalSubscriberId);
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
String serviceType = execution.getVariable("serviceType")
logger.info("serviceType:" + serviceType)
@@ -110,9 +110,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
"operationId":"${operationId}",
"nodeTemplateUUID":"${nodeTemplateUUID}"
}"""
- execution.setVariable("nsOperationKey", nsOperationKey);
+ execution.setVariable("nsOperationKey", nsOperationKey)
execution.setVariable("nsParameters", nsParameters)
- execution.setVariable("nsServiceModelUUID", nsServiceModelUUID);
+ execution.setVariable("nsServiceModelUUID", nsServiceModelUUID)
String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
@@ -128,7 +128,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.info(msg)
@@ -143,9 +143,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
public void createNetworkService(DelegateExecution execution) {
logger.trace("createNetworkService ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
- String nsOperationKey = execution.getVariable("nsOperationKey");
- String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID");
- String nsParameters = execution.getVariable("nsParameters");
+ String nsOperationKey = execution.getVariable("nsOperationKey")
+ String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID")
+ String nsParameters = execution.getVariable("nsParameters")
String nsServiceName = execution.getVariable("nsServiceName")
String nsServiceDescription = execution.getVariable("nsServiceDescription")
String locationConstraints = jsonUtil.getJsonValue(nsParameters, "locationConstraints")
@@ -163,7 +163,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
String returnCode = apiResponse.getStatus ()
String aaiResponseAsString = apiResponse.readEntity(String.class)
- String nsInstanceId = "";
+ String nsInstanceId = ""
if(returnCode== "200" || returnCode == "201"){
nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId")
}
@@ -177,8 +177,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
public void instantiateNetworkService(DelegateExecution execution) {
logger.trace("instantiateNetworkService ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
- String nsOperationKey = execution.getVariable("nsOperationKey");
- String nsParameters = execution.getVariable("nsParameters");
+ String nsOperationKey = execution.getVariable("nsOperationKey")
+ String nsParameters = execution.getVariable("nsParameters")
String nsServiceName = execution.getVariable("nsServiceName")
String nsServiceDescription = execution.getVariable("nsServiceDescription")
String reqBody ="""{
@@ -192,7 +192,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
Response apiResponse = postRequest(execution, url, reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
- String jobId = "";
+ String jobId = ""
if(returnCode== "200"|| returnCode == "201"){
jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
}
@@ -207,7 +207,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
logger.trace("queryNSProgress ")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
- String nsOperationKey = execution.getVariable("nsOperationKey");
+ String nsOperationKey = execution.getVariable("nsOperationKey")
String url = vfcAdapterUrl + "/jobs/" + jobId
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
@@ -225,9 +225,9 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void timeDelay(DelegateExecution execution) {
try {
- Thread.sleep(5000);
+ Thread.sleep(5000)
} catch(InterruptedException e) {
- logger.error("Time Delay exception" + e.getMessage());
+ logger.error("Time Delay exception" + e.getMessage())
}
}
@@ -252,7 +252,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
getAAIClient().connect(nsUri,relatedServiceUri)
logger.info("NS relationship to Service added successfully")
}catch(Exception e){
- logger.error("Exception occured while Creating NS relationship."+ e.getMessage());
+ logger.error("Exception occured while Creating NS relationship."+ e.getMessage())
throw new BpmnError("MSOWorkflowException")
}
}
@@ -268,7 +268,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
Response apiResponse = null
try{
- URL url = new URL(urlString);
+ URL url = new URL(urlString)
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
@@ -282,7 +282,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
logger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
}catch(Exception e){
- logger.error("VFC Aatpter Post Call Exception:" + e.getMessage());
+ logger.error("VFC Aatpter Post Call Exception:" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VFC Aatpter Post Call Exception")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
index fa9fe62df4..c9dadf57cb 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.v12.GenericVnf;
@@ -251,7 +252,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
String restFaultMessage = e.getMessage()
//execution.setVariable("CVFMODVOL2_RESTFault", restFaultMessage)
//execution.setVariable("CVFMODVOL2_isDataOk", false)
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
" Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - During PreProcessRequest")
@@ -301,7 +302,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Encountered ", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
@@ -402,7 +403,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
logger.debug("Outgoing MsoCompletionRequest: \n" + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing PostProcessResponse - " + "\n", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occured during PostProcessResponse Method:\n" + e.getMessage())
@@ -479,7 +480,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method , "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
@@ -528,7 +529,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
logger.debug("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing prepareUpdateInfraRequest.", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage())
@@ -584,7 +585,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method , "BPMN",
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 5ba90eb989..1fba23d3c8 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,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
@@ -306,7 +307,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String xmlHandlerRequest = utils.formatXml(falloutHandlerRequest)
execution.setVariable(prefix+'FalloutHandlerRequest', xmlHandlerRequest)
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response " +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Overall Error Response " +
"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 e941d50155..3eb15558d2 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.logger.ErrorCode
@@ -168,7 +169,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
String sdncCallbackUrl = 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
@@ -194,7 +195,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
logger.debug("Rethrowing MSOWorkflowException")
throw b
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in " +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in " +
"CreateVnfInfra PreProcessRequest method", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in CreateVnfInfra PreProcessRequest")
@@ -220,7 +221,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
execution.setVariable("CREVI_sentSyncResponse", true)
} catch (Exception ex) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), " Error Occurred in CreateVnfInfra SendSyncResponse Process", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVnfInfra SendSyncResponse Process")
@@ -246,7 +247,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
}
@@ -270,7 +271,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
logger.debug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
"Processing preProcessSDNCActivateRequest", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
}
@@ -461,7 +462,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
logger.debug("obtained VNF list: " + vnfs)
if (vnfs == null) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching " +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching " +
"VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), "");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
}
@@ -470,7 +471,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
JSONObject vnf = vnfs.get(0)
if (vnf == null) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF" +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "No matching VNF" +
" in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, "BPMN", ErrorCode.UnknownError.getValue(), "");
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "No matching VNF in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid)
}
@@ -543,7 +544,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId)
}catch(Exception ex){
String msg = "Exception in LineOfBusiness. " + ex.getMessage();
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
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 4233147f83..1a689d426c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -31,6 +31,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.slf4j.Logger
@@ -41,7 +42,7 @@ import org.slf4j.LoggerFactory
* flow for SDNC Network Resource Activate
*/
public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( DeActivateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeActivateSDNCNetworkResource.class)
String Prefix = "DEACTSDNCRES_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -52,7 +53,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
MsoUtils msoUtils = new MsoUtils()
- public void preProcessRequest(DelegateExecution execution) {
+ void preProcessRequest(DelegateExecution execution) {
logger.info(" ***** Started preProcessRequest *****")
@@ -80,45 +81,14 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
//the operationType from worflow(first node) is highest priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
-
-
- // TODO: based on the resource type decide action and operation type
- String sdnc_svcAction = "deactivate"
- switch (resourceInputObj.getResourceModelInfo().getModelName()) {
- case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
- operationType = "SOTNConnectivity"
- break
-
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
- operationType = "SOTNAttachment"
- break
-
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
- operationType = "Site"
- break
-
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- operationType = "SDWANDevice"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
- operationType = "SDWANConnectivity"
- break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- operationType = "SDWANAttachment"
- break
-
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- operationType = "SDWANPort"
- execution.setVariable("isActivateRequired", "true")
- break
-
- default:
- break
+ String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type")
+ if (StringUtils.isNotEmpty(operationTypeFromConfig)) {
+ // highest priority if operation type configured
+ operationType = operationTypeFromConfig
}
+ // based on the resource type decide action and operation type
+ String sdnc_svcAction = "deactivate"
String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
execution.setVariable(Prefix + "requestAction", sdnc_requestAction)
@@ -126,7 +96,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
execution.setVariable("mso-request-id", requestId)
execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug(msg)
@@ -134,7 +104,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
}
}
- public void prepareSDNCRequest(DelegateExecution execution) {
+ void prepareSDNCRequest(DelegateExecution execution) {
logger.info(" ***** Started prepareSDNCRequest *****")
try {
@@ -148,6 +118,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId")
String source = execution.getVariable("source")
String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId")
+ String resourceInput = execution.getVariable("resourceInput")
+ String allotedParentServiceInstanceId = execution.getVariable("allotedParentServiceInstanceId")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String serviceType = resourceInputObj.getServiceType()
String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
@@ -155,19 +127,18 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion()
String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName()
String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
- String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid();
+ String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid()
String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion()
String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid()
+ String modelType = resourceInputObj.getResourceModelInfo().getModelType()
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
String sdncTopologyDeleteRequest = ""
- switch (modelName) {
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/:
+ switch (modelType) {
+ case "VNF" :
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -224,8 +195,84 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ case "GROUP" :
+ //When a new resource creation request reaches SO, the parent resources information needs to be provided
+ //while creating the child resource.
+ String vnfid = resourceInputObj.getVnfId()
+ ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo()
+ String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid()
+ String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid()
+ String vnfmodelUuid = vfModelInfo.getModelUuid()
+ String vnfmodelVersion = vfModelInfo.getModelVersion()
+ String vnfmodelName = vfModelInfo.getModelName()
+
+ sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEscape(source)}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
+ </onap-model-information>
+ <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
+ </service-information>
+ <vnf-information>
+ <vnf-id>$vnfid</vnf-id>
+ <vnf-type></vnf-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name>
+ </onap-model-information>
+ </vnf-information>
+ <vf-module-information>
+ <vf-module-id>$resourceInstnaceId</vf-module-id>
+ <vf-module-type></vf-module-type>
+ <from-preload>false</from-preload>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
+ </onap-model-information>
+ </vf-module-information>
+ <vf-module-request-input>
+ <vf-module-input-parameters>
+ </vf-module-input-parameters>
+ </vf-module-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+ break
+
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE" :
+
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -262,7 +309,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
<allotted-resource-information>
<allotted-resource-id>$resourceInstnaceId</allotted-resource-id>
<allotted-resource-type></allotted-resource-type>
- <parent-service-instance-id></parent-service-instance-id>
+ <parent-service-instance-id>$allotedParentServiceInstanceId</parent-service-instance-id>
<onap-model-information>
<model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
<model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
@@ -275,8 +322,10 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
</connection-attachment-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
break
+ // for SDWANConnectivity and SOTNConnectivity:
default:
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
@@ -325,6 +374,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
</network-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
}
String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest)
@@ -340,7 +390,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
logger.info(" ***** Exit prepareSDNCRequest *****")
}
- public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) {
+ void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) {
+ String resourceInput = execution.getVariable("resourceInput")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String operType = resourceInputObj.getOperationType()
String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
@@ -367,7 +418,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
setProgressUpdateVariables(execution, body)
}
@@ -378,7 +429,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
execution.setVariable("CVFMI_updateResOperStatusRequest", body)
}
- public void postDeactivateSDNCCall(DelegateExecution execution) {
+ void postDeactivateSDNCCall(DelegateExecution execution) {
logger.info(" ***** Started prepareSDNCRequest *****")
String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
@@ -387,7 +438,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
logger.info(" ***** Exit prepareSDNCRequest *****")
}
- public void sendSyncResponse(DelegateExecution execution) {
+ void sendSyncResponse(DelegateExecution execution) {
logger.debug(" *** sendSyncResponse *** ")
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
index 443c8f6616..da486bb1c3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -60,7 +60,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( Delete3rdONAPE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( Delete3rdONAPE2EServiceInstance.class)
public void checkSPPartnerInfoFromAAI (DelegateExecution execution) {
logger.info(" ***** Started checkSPPartnerInfo *****")
@@ -217,6 +217,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
// ExternalAPI message format
String externalId = execution.getVariable("resourceName")
+ String serviceType = execution.getVariable("serviceType")
String category = "E2E Service"
String description = "Service Order from SPPartner"
String requestedStartDate = utils.generateCurrentTimeInUtc()
@@ -224,13 +225,14 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String priority = "1" // 0-4 0:highest
String subscriberId = execution.getVariable("globalSubscriberId")
String customerRole = "ONAPcustomer"
- String subscriberName = subscriberId
+ // Below SO will pass serviceType as subscriberName and externalAPI will use
+ // the same serviceType in another domain instead of model name
+ String subscriberName = serviceType
String referredType = "Consumer"
String orderItemId = "1"
String action = "delete" //for delete
String serviceState = "active"
String serviceName = ""
- String serviceType = execution.getVariable("serviceType")
String serviceId = execution.getVariable(Prefix + "SppartnerId")
queryServicefrom3rdONAP(execution)
@@ -260,7 +262,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
String payload = externalAPIUtil.setTemplate(ExternalAPIUtil.PostServiceOrderRequestsTemplate, valueMap)
execution.setVariable(Prefix + "Payload", payload)
- logger.info( "Exit " + prepare3rdONAPRequest)
+ logger.info( "***** Exit prepare3rdONAPRequest *****")
}
private void queryServicefrom3rdONAP(DelegateExecution execution)
@@ -294,7 +296,8 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
{
logger.debug("Get Service Received a Good Response")
JSONArray responseList = new JSONArray(extApiResponse)
- for(JSONObject obj : responseList) {
+ for(int i=0; i< responseList.length(); i++) {
+ JSONObject obj = responseList.getJSONObject(i)
String svcId = obj.get("id")
if(StringUtils.equalsIgnoreCase(SppartnerServiceId, svcId)) {
JSONObject serviceSpecification = obj.get("serviceSpecification")
@@ -311,7 +314,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}catch(Exception e) {
logger.error("queryServicefrom3rdONAP exception:" + e.getMessage())
}
- logger.info( "Exit " + queryServicefrom3rdONAP)
+ logger.info( "***** Exit queryServicefrom3rdONAP *****")
}
public void doDeleteE2ESIin3rdONAP(DelegateExecution execution) {
@@ -354,7 +357,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}catch(Exception e) {
logger.error("doDeleteE2ESIin3rdONAP exception:" + e.getMessage())
}
- logger.info( "Exit " + doDeleteE2ESIin3rdONAP)
+ logger.info( "***** Exit doDeleteE2ESIin3rdONAP *****")
}
@@ -450,7 +453,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
execution.setVariable("statusDescription", "Get Delete ServiceOrder Exception")
logger.error("getE2ESIProgressin3rdONAP exception:" + e.getMessage())
}
- logger.info( "Exit " + getE2ESIProgressin3rdONAP)
+ logger.info( "***** Exit getE2ESIProgressin3rdONAP *****")
}
/**
@@ -495,7 +498,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
// throw new BpmnError("MSOWorkflowException")
}
- logger.info( "Exit " + getSPPartnerInAAI)
+ logger.info( "***** Exit getSPPartnerInAAI *****")
}
public void deleteSPPartnerInAAI(DelegateExecution execution) {
@@ -516,7 +519,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso
}
- logger.info( "Exit " + deleteSPPartnerInAAI)
+ logger.info( "**** Exit deleteSPPartnerInAAI ****")
}
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
index a9b1fdaac3..2a65ae97a2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy
@@ -8,7 +8,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -22,9 +22,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -38,7 +38,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.web.util.UriUtils;
+import org.springframework.web.util.UriUtils
import groovy.json.*
@@ -52,7 +52,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- private static final Logger logger = LoggerFactory.getLogger( DeleteCustomE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteCustomE2EServiceInstance.class)
public void preProcessRequest (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
index 1e2f50148c..5c7127f36e 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -354,7 +355,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
logger.debug(falloutHandlerRequest)
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, "BPMN",
ErrorCode.UnknownError.getValue())
@@ -377,7 +378,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor {
</aetgt:WorkflowException>
</aetgt:FalloutHandlerRequest>"""
execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest)
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest,"BPMN",
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 dd9991bbd4..61b1250522 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
@@ -25,17 +25,29 @@ 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.AllottedResource
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.RelationshipData
import org.onap.so.bpmn.common.recipe.ResourceInput
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
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.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ResourceType
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import javax.ws.rs.NotFoundException
+
import static org.apache.commons.lang3.StringUtils.*
/**
@@ -52,10 +64,10 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
-
+
MsoUtils msoUtils = new MsoUtils()
- public void preProcessRequest(DelegateExecution execution){
+ void preProcessRequest(DelegateExecution execution){
logger.info(" ***** Started preProcessRequest *****")
try {
@@ -74,6 +86,27 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
//Deal with recipeParams
String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName()
+ String resourceInstanceId = resourceInputObj.getResourceInstancenUuid()
+ String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
+ String serviceType = resourceInputObj.getServiceType()
+ String serviceInstanceId = resourceInputObj.getServiceInstanceId()
+
+ // fetch parent instance id for allotted resources
+ String modelType = resourceInputObj.getResourceModelInfo().getModelType()
+ switch (modelType) {
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE":
+ String parentServiceId = fetchParentServiceInstance(globalCustomerId, serviceType, serviceInstanceId, resourceInstanceId)
+ if (null != parentServiceId) {
+ execution.setVariable("allotedParentServiceInstanceId", parentServiceId)
+ } else {
+ logger.warn("Alloted Resource ParentServiceInstanceId not found in AAI response for allotedId: " + resourceInstanceId)
+ }
+ break;
+ default:
+ break;
+ }
+
//For sdnc requestAction default is "NetworkInstance"
String operationType = "Network"
if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){
@@ -84,62 +117,18 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
//the operationType from worflow(first node) is highest priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
+ String operationTypeFromConfig = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".operation-type")
+ if (StringUtils.isNotEmpty(operationTypeFromConfig)) {
+ // highest priority if operation type configured
+ operationType = operationTypeFromConfig
+ }
//For sdnc, generate svc_action and request_action
String sdnc_svcAction = "delete"
- switch (resourceInputObj.getResourceModelInfo().getModelName()) {
-
- case ~/[\w\s\W]*overlay[\w\s\W]*/ :
- ///This will be resolved in R3.
- sdnc_svcAction ="deactivate"
- operationType = "NCINetwork"
- break
-
- case ~/[\w\s\W]*underlay[\w\s\W]*/ :
- //This will be resolved in R3.
- operationType ="Network"
- break
-
- case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
- operationType = "SOTNConnectivity"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
- operationType = "SOTNAttachment"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
- operationType = "Site"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- operationType = "SDWANDevice"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
- operationType = "SDWANConnectivity"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- operationType = "SDWANAttachment"
- execution.setVariable("isActivateRequired", "true")
- break
-
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- operationType = "SDWANPort"
- execution.setVariable("isActivateRequired", "true")
- break
-
- default:
- break
- }
- String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
+ String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType + "Instance"
+ String isActivateRequired = UrnPropertiesReader.getVariable("resource-config." + resourceInputObj.resourceModelInfo.getModelName() + ".activation-required")
+ execution.setVariable("isActivateRequired", isActivateRequired)
execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
execution.setVariable(Prefix + "requestAction", sdnc_requestAction)
execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId())
@@ -148,20 +137,54 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
- msg = "Exception in preProcessRequest " + ex.getMessage()
+ String msg = "Exception in preProcessRequest " + ex.getMessage()
logger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
logger.info(" ***** Exit preProcessRequest *****")
}
+ private String fetchParentServiceInstance(String globalCustId, String serviceType, String serviceInstanceId, String allotedResourceId ) {
+ logger.trace("Entered fetchParentServiceInstance")
+ try {
+ String parentServiceId = "";
+ AAIResourcesClient resourceClient = new AAIResourcesClient();
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, globalCustId, serviceType, serviceInstanceId, allotedResourceId)
+ AAIResultWrapper aaiResult = resourceClient.get(serviceInstanceUri, NotFoundException.class)
+ Optional<AllottedResource> si = aaiResult.asBean(AllottedResource.class)
+ if((si.present) && (null != si.get().getRelationshipList()) && (null != si.get().getRelationshipList().getRelationship())) {
+ logger.debug("SI Data relationship-list exists")
+ List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+ for (Relationship relationship : relationshipList) {
+ String rt = relationship.getRelatedTo()
+ List<RelationshipData> rl_datas = relationship.getRelationshipData()
+ if(rt.equals("service-instance") ){
+ for (RelationshipData rl_data : rl_datas) {
+ String eKey = rl_data.getRelationshipKey()
+ String eValue = rl_data.getRelationshipValue()
+ if(eKey.equals("service-instance.service-instance-id") && (!eValue.equals(serviceInstanceId))){
+ return eValue
+ }
+ }
+ }
+ }
+ }
+
+ logger.trace("Exited fetchParentServiceInstance")
+ }catch(Exception e){
+ logger.debug("Error occured within deleteServiceInstance method: " + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai")
+ }
+ return null
+ }
+
/**
* Pre Process the BPMN Flow Request
* Includes:
* generate the nsOperationKey
* generate the nsParameters
*/
- public void prepareSDNCRequest (DelegateExecution execution) {
+ void prepareSDNCRequest (DelegateExecution execution) {
logger.info(" ***** Started prepareSDNCRequest *****")
try {
@@ -177,6 +200,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId")
String resourceInput = execution.getVariable(Prefix + "resourceInput")
logger.info("The resourceInput is: " + resourceInput)
+ String allotedParentServiceInstanceId = execution.getVariable("allotedParentServiceInstanceId")
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String serviceType = resourceInputObj.getServiceType()
String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
@@ -190,13 +214,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion()
String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid()
+ String modelType = resourceInputObj.getResourceModelInfo().getModelType()
+
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
String sdncTopologyDeleteRequest = ""
- switch (modelName) {
- case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
- case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
- case ~/[\w\s\W]*SiteVF[\w\s\W]*/:
+ switch (modelType) {
+ case "VNF":
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -252,9 +276,83 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
+ case "GROUP" :
+ //When a new resource creation request reaches SO, the parent resources information needs to be provided
+ //while creating the child resource.
+ String vnfid = resourceInputObj.getVnfId()
+ ModelInfo vfModelInfo = resourceInputObj.getVfModelInfo()
+ String vnfmodelInvariantUuid = vfModelInfo.getModelInvariantUuid()
+ String vnfmodelCustomizationUuid = vfModelInfo.getModelCustomizationUuid()
+ String vnfmodelUuid = vfModelInfo.getModelUuid()
+ String vnfmodelVersion = vfModelInfo.getModelVersion()
+ String vnfmodelName = vfModelInfo.getModelName()
+
+ sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>vf-module-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEscape(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEscape(source)}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(serviceModelName)}</model-name>
+ </onap-model-information>
+ <service-instance-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
+ </service-information>
+ <vnf-information>
+ <vnf-id>$vnfid</vnf-id>
+ <vnf-type></vnf-type>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(vnfmodelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(vnfmodelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(vnfmodelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(vnfmodelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(vnfmodelName)}</model-name>
+ </onap-model-information>
+ </vnf-information>
+ <vf-module-information>
+ <vf-module-id>$resourceInstnaceId</vf-module-id>
+ <vf-module-type></vf-module-type>
+ <from-preload>false</from-preload>
+ <onap-model-information>
+ <model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEscape(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEscape(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEscape(modelName)}</model-name>
+ </onap-model-information>
+ </vf-module-information>
+ <vf-module-request-input>
+ <vf-module-input-parameters>
+ </vf-module-input-parameters>
+ </vf-module-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+ break
- case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
- case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ // sdwanvpnattachment or sotnvpnattachment
+ case "ALLOTTED_RESOURCE" :
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -291,7 +389,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
<allotted-resource-information>
<allotted-resource-id>$resourceInstnaceId</allotted-resource-id>
<allotted-resource-type></allotted-resource-type>
- <parent-service-instance-id></parent-service-instance-id>
+ <parent-service-instance-id>$allotedParentServiceInstanceId</parent-service-instance-id>
<onap-model-information>
<model-invariant-uuid>${msoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
<model-customization-uuid>${msoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
@@ -304,8 +402,10 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
</connection-attachment-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
break
+ // for SDWANConnectivity and SOTNConnectivity:
default:
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
@@ -375,8 +475,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
execution.setVariable("CVFMI_updateResOperStatusRequest", body)
}
- public void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) {
- logger.debug( " *** prepareUpdateBeforeDeleteSDNCResource *** ")
+ void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) {
+ logger.debug(" *** prepareUpdateBeforeDeleteSDNCResource *** ")
String resourceInput = execution.getVariable(Prefix + "resourceInput");
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String operType = resourceInputObj.getOperationType()
@@ -411,8 +511,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
- public void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) {
- logger.debug( " *** prepareUpdateAfterDeleteSDNCResource *** ")
+ void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) {
+ logger.debug(" *** prepareUpdateAfterDeleteSDNCResource *** ")
String resourceInput = execution.getVariable(Prefix + "resourceInput");
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
String operType = resourceInputObj.getOperationType()
@@ -446,7 +546,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.debug(" ***** Exit prepareUpdateAfterDeleteSDNCResource *****")
}
- public void postDeleteSDNCCall(DelegateExecution execution){
+ void postDeleteSDNCCall(DelegateExecution execution){
logger.info(" ***** Started postDeleteSDNCCall *****")
String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
@@ -455,7 +555,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.info(" ***** Exit postDeleteSDNCCall *****")
}
- public void sendSyncResponse (DelegateExecution execution) {
+ void sendSyncResponse (DelegateExecution execution) {
logger.debug( " *** sendSyncResponse *** ")
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
index 9b269c734f..642609a970 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
@@ -63,14 +63,14 @@ public class DeleteVFCNSResource extends AbstractServiceTaskProcessor {
logger.info(" ***** end preProcessRequest *****")
}
- public void postProcessRequest (DelegateExecution execution) {
+ void postProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
logger.info(" ***** start postProcessRequest *****")
logger.info(" ***** end postProcessRequest *****")
}
- public void sendSyncResponse (DelegateExecution execution) {
+ void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.debug( " *** sendSyncResponse *** ")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
index 3a1815cfe6..79aa745792 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
@@ -126,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",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Caught exception",
"BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
@@ -159,7 +160,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
@@ -202,7 +203,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
@@ -229,7 +230,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in '
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in '
+ method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage())
}
@@ -277,7 +278,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepInfraRequest(): ' + e.getMessage())
@@ -322,7 +323,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
@@ -375,7 +376,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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 cf53aff878..9fa488f8a7 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.VolumeGroup
@@ -463,7 +464,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
logger.debug(xmlHandlerRequest)
execution.setVariable("DELVfModVol_FalloutHandlerRequest", xmlHandlerRequest)
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Overall Error Response going to FalloutHandler", "BPMN",
ErrorCode.UnknownError.getValue(), "\n" + xmlHandlerRequest);
}
@@ -484,7 +485,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
def String errorMessage = 'TenantId ' + tenantId + ' in incoming request does not match Tenant Id ' + volumeGroupTenantId +
' retrieved from AAI for Volume Group Id ' + volumeGroupId
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Error in DeleteVfModuleVolume: " + "\n" + errorMessage, "BPMN",
ErrorCode.UnknownError.getValue());
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
index fff2503308..324e6b42ba 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -19,9 +19,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.Resource
@@ -52,7 +52,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
String Prefix="DCMPMDV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( DoCompareModelVersions.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCompareModelVersions.class)
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -196,8 +196,8 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")
ServiceDecomposition serviceDecomposition_Original = execution.getVariable("serviceDecomposition_Original")
- List<Resource> allSR_target = serviceDecomposition_Target.getServiceResources();
- List<Resource> allSR_original = serviceDecomposition_Original.getServiceResources();
+ List<Resource> allSR_target = serviceDecomposition_Target.getServiceResources()
+ List<Resource> allSR_original = serviceDecomposition_Original.getServiceResources()
List<Resource> addResourceList = new ArrayList<String>()
List<Resource> delResourceList = new ArrayList<String>()
@@ -214,8 +214,8 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
if(rc_o.getModelInfo().getModelUuid() == muuid
&& rc_o.getModelInfo().getModelInvariantUuid() == mIuuid
&& rc_o.getModelInfo().getModelCustomizationUuid() == mCuuid) {
- addResourceList.remove(rc_t);
- delResourceList.remove(rc_o);
+ addResourceList.remove(rc_t)
+ delResourceList.remove(rc_o)
}
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
index 7ad929b1c2..9f378e567c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
@@ -184,7 +184,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
rmodel.setResourceCustomizationUuid(resourceCustomizationUuid)
addedResourceList.add(rmodel)
- Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null)
+ Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(rc, null, null)
requestInputs.addAll(resourceParameters.keySet())
}
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 125c3e4504..9d8b953f0e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -7,7 +7,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -22,14 +22,19 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
-import org.onap.so.logger.ErrorCode;
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.SerializationFeature
-import static org.apache.commons.lang3.StringUtils.*;
+import org.onap.so.logger.LoggingAnchor
+import org.onap.so.logger.ErrorCode
+
+import static org.apache.commons.lang3.StringUtils.*
import javax.ws.rs.NotFoundException
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
import org.onap.aai.domain.yang.ServiceInstance
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -78,7 +83,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
*
*/
public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( DoCreateE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateE2EServiceInstance.class)
String Prefix="DCRESI_"
@@ -160,7 +165,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInstanceData", si)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.info(msg)
@@ -205,7 +210,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
//we need a service plugin platform here.
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- String newUuiRequest = ServicePluginFactory.getInstance().preProcessService(serviceDecomposition, uuiRequest);
+ String newUuiRequest = ServicePluginFactory.getInstance().preProcessService(serviceDecomposition, uuiRequest)
execution.setVariable("uuiRequest", newUuiRequest)
}
@@ -213,7 +218,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
//we need a service plugin platform here.
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- String newUuiRequest = ServicePluginFactory.getInstance().doServiceHoming(serviceDecomposition, uuiRequest);
+ String newUuiRequest = ServicePluginFactory.getInstance().doServiceHoming(serviceDecomposition, uuiRequest)
execution.setVariable("uuiRequest", newUuiRequest)
}
@@ -249,7 +254,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
}
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
logger.info(msg)
@@ -271,7 +276,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
client.create(uri, si)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
//start rollback set up
RollbackData rollbackData = new RollbackData()
@@ -290,6 +295,103 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit createServiceInstance ")
}
+ public void createCustomRelationship(DelegateExecution execution) {
+ logger.trace("createCustomRelationship ")
+ String msg = ""
+ try {
+ String uuiRequest = execution.getVariable("uuiRequest")
+ String vpnName = isNeedProcessCustomRelationship(uuiRequest)
+
+ if(null != vpnName){
+ logger.debug("fetching resource-link information for the given sotnVpnName:"+vpnName)
+ // fetch the service instance to link the relationship
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.NODES_QUERY).queryParam("search-node-type","service-instance").queryParam("filter","service-instance-name:EQUALS:"+vpnName)
+ AAIResultWrapper aaiResult = client.get(uri,NotFoundException.class)
+ Map<String, Object> result = aaiResult.asMap()
+ List<Object> resources =
+ (List<Object>) result.getOrDefault("result-data", Collections.emptyList())
+ if(resources.size()>0) {
+ String relationshipUrl = ((Map<String, Object>) resources.get(0)).get("resource-link")
+
+ final Relationship body = new Relationship()
+ body.setRelatedLink(relationshipUrl)
+
+ createRelationShipInAAI(execution, body)
+ } else {
+ logger.warn("No resource-link found for the given sotnVpnName:"+vpnName)
+ }
+
+ } else {
+ logger.error("VPNName not found in request input")
+ }
+
+
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+
+ msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.trace("Exit createCustomRelationship ")
+ }
+
+ private void createRelationShipInAAI(DelegateExecution execution, final Relationship relationship){
+ logger.trace("createRelationShipInAAI ")
+ String msg = ""
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), serviceInstanceId).relationshipAPI()
+ client.create(uri, relationship)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+
+ msg = "Exception in DoCreateE2EServiceInstance.createRelationShipInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.trace("Exit createRelationShipInAAI ")
+
+ }
+
+ private String isNeedProcessCustomRelationship(String uuiRequest) {
+ String requestInput = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs")
+ Map<String, String> requestInputObject = getJsonObject(requestInput, Map.class)
+ if (requestInputObject == null) {
+ return null
+ }
+
+ Optional<Map.Entry> firstKey =
+ requestInputObject.entrySet()
+ .stream()
+ .filter({entry -> entry.getKey().toString().contains("_sotnVpnName")})
+ .findFirst()
+ if (firstKey.isPresent()) {
+ return firstKey.get().getValue()
+ }
+
+ return null
+ }
+
+ private static <T> T getJsonObject(String jsonstr, Class<T> type) {
+ ObjectMapper mapper = new ObjectMapper()
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true)
+ try {
+ return mapper.readValue(jsonstr, type)
+ } catch (IOException e) {
+ logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(),
+ ErrorCode.BusinessProcesssError.getValue(), e)
+ }
+ return null
+ }
+
+
/**
* Gets the service instance and its relationships from aai
*/
@@ -307,7 +409,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInstanceName", si.get().getServiceInstanceName())
}catch(BpmnError e) {
- throw e;
+ throw e
}catch(Exception ex) {
String msg = "Internal Error in getServiceInstance: " + ex.getMessage()
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
@@ -347,7 +449,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
}
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
logger.info(msg)
@@ -360,12 +462,12 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("preProcessRollback ")
try {
- Object workflowException = execution.getVariable("WorkflowException");
+ Object workflowException = execution.getVariable("WorkflowException")
if (workflowException instanceof WorkflowException) {
logger.info("Prev workflowException: " + workflowException.getErrorMessage())
- execution.setVariable("prevWorkflowException", workflowException);
- //execution.setVariable("WorkflowException", null);
+ execution.setVariable("prevWorkflowException", workflowException)
+ //execution.setVariable("WorkflowException", null)
}
} catch (BpmnError e) {
logger.info("BPMN Error during preProcessRollback")
@@ -380,15 +482,15 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("postProcessRollback ")
String msg = ""
try {
- Object workflowException = execution.getVariable("prevWorkflowException");
+ Object workflowException = execution.getVariable("prevWorkflowException")
if (workflowException instanceof WorkflowException) {
logger.info("Setting prevException to WorkflowException: ")
- execution.setVariable("WorkflowException", workflowException);
+ execution.setVariable("WorkflowException", workflowException)
}
execution.setVariable("rollbackData", null)
} catch (BpmnError b) {
logger.info("BPMN Error during postProcessRollback")
- throw b;
+ throw b
} catch(Exception ex) {
msg = "Exception in postProcessRollback. " + ex.getMessage()
logger.info(msg)
@@ -443,21 +545,21 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), e);
+ ErrorCode.UnknownError.getValue(), e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preInitResourcesOperStatus Process ")
}
- // if site location is in local Operator, create all resources in local ONAP;
+ // if site location is in local Operator, create all resources in local ONAP
// if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP
public void doProcessSiteLocation(DelegateExecution execution){
logger.trace("======== Start doProcessSiteLocation Process ======== ")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest);
+ uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest)
execution.setVariable("uuiRequest", uuiRequest)
execution.setVariable("serviceDecomposition", serviceDecomposition)
@@ -469,7 +571,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("======== Start doTPResourcesAllocation Process ======== ")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest);
+ uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest)
execution.setVariable("uuiRequest", uuiRequest)
logger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ")
}
@@ -482,6 +584,13 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
List<Resource> addResourceList = serviceDecomposition.getServiceResources()
execution.setVariable("addResourceList", addResourceList)
+ boolean isCreateResourceListValid = true
+ if (addResourceList == null || addResourceList.isEmpty()) {
+ isCreateResourceListValid = false
+ }
+
+ execution.setVariable("isCreateResourceListValid", isCreateResourceListValid)
+
logger.trace("COMPLETED preProcessForAddResource Process ")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index b49f00a247..bc26aa10ec 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -6,12 +6,12 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in 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,7 +22,14 @@
package org.onap.so.bpmn.infrastructure.scripts
+
+import com.google.common.reflect.TypeToken
+import com.google.gson.Gson
+import org.apache.http.util.EntityUtils
+import org.onap.so.bpmn.common.resource.InstanceResourceList
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ResourceType
import org.onap.so.bpmn.infrastructure.properties.BPMNProperties
import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
@@ -44,11 +51,12 @@ import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import java.lang.reflect.Type
/**
* This groovy class supports the <class>DoCreateResources.bpmn</class> process.
- *
+ *
* Inputs:
* @param - msoRequestId
* @param - globalSubscriberId - O
@@ -56,7 +64,7 @@ import org.slf4j.LoggerFactory
* @param - serviceInstanceId
* @param - serviceInstanceName - O
* @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
- * @param - sdncVersion
+ * @param - sdncVersion
*
* @param - addResourceList
*
@@ -64,13 +72,13 @@ import org.slf4j.LoggerFactory
* @param - WorkflowException
*/
public class DoCreateResources extends AbstractServiceTaskProcessor{
- private static final Logger logger = LoggerFactory.getLogger( DoCreateResources.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateResources.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
- public void preProcessRequest(DelegateExecution execution) {
+ void preProcessRequest(DelegateExecution execution) {
logger.trace("preProcessRequest ")
String msg = ""
@@ -87,9 +95,9 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("Exit preProcessRequest ")
}
- public void sequenceResoure(DelegateExecution execution) {
+ void sequenceResoure(DelegateExecution execution) {
logger.trace("Start sequenceResoure Process ")
-
+
String incomingRequest = execution.getVariable("uuiRequest")
String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid")
@@ -102,10 +110,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
String serviceDecompose = execution.getVariable("serviceDecomposition")
String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName")
- // get Sequence from properties
+ // get Sequence from properties
def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName)
- // get Sequence from csar(model)
+ // get Sequence from csar(model)
if(resourceSequence == null) {
resourceSequence = ResourceRequestBuilder.getResourceSequence(serviceModelUuid)
logger.info("Get Sequence from csar : " + resourceSequence)
@@ -115,8 +123,21 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
for (resourceType in resourceSequence) {
for (resource in addResourceList) {
if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
- sequencedResourceList.add(resource)
+
+ // if resource type is vnfResource then check for groups also
+ // Did not use continue because if same model type is used twice
+ // then we would like to add it twice for processing
+ // ex-1. S{ V1{G1, G2}} --> S{ V1{G1, G1, G2}}
+ // ex-2. S{ V1{G1, G2}} --> S{ V1{G1, G2, G2, G2} V1 {G1, G1, G2}}
+ if ((resource.getResourceType() == ResourceType.VNF) && (resource instanceof VnfResource)) {
+
+ // check the size of VNF/Group list from UUI
+ List<Resource> sequencedInstanceResourceList = InstanceResourceList.getInstanceResourceList((VnfResource) resource, incomingRequest)
+ sequencedResourceList.addAll(sequencedInstanceResourceList)
+ } else {
+ sequencedResourceList.add(resource)
+ }
if (resource instanceof NetworkResource) {
networkResourceList.add(resource)
}
@@ -126,13 +147,15 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
} else {
//define sequenced resource list, we deploy vf first and then network and then ar
- //this is defaule sequence
+ //this is default sequence
List<VnfResource> vnfResourceList = new ArrayList<VnfResource>()
List<AllottedResource> arResourceList = new ArrayList<AllottedResource>()
for (Resource rc : addResourceList){
if (rc instanceof VnfResource) {
- vnfResourceList.add(rc)
+ // check the size of VNF/Group list from UUI
+ List<Resource> sequencedGroupResourceList = InstanceResourceList.getInstanceResourceList((VnfResource) rc, incomingRequest)
+ vnfResourceList.addAll(sequencedGroupResourceList)
} else if (rc instanceof NetworkResource) {
networkResourceList.add(rc)
} else if (rc instanceof AllottedResource) {
@@ -147,7 +170,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true"
//if no networkResource, get SDNC config from properties file
if( "false".equals(isContainsWanResource)) {
- String serviceNeedSDNC = "mso.workflow.custom." + serviceModelName + ".sdnc.need";
+ String serviceNeedSDNC = "mso.workflow.custom." + serviceModelName + ".sdnc.need"
isContainsWanResource = BPMNProperties.getProperty(serviceNeedSDNC, isContainsWanResource)
}
@@ -158,7 +181,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("COMPLETED sequenceResoure Process ")
}
- public prepareServiceTopologyRequest(DelegateExecution execution) {
+ void prepareServiceTopologyRequest(DelegateExecution execution) {
logger.trace("======== Start prepareServiceTopologyRequest Process ======== ")
@@ -178,22 +201,22 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("======== End prepareServiceTopologyRequest Process ======== ")
}
- public void getCurrentResoure(DelegateExecution execution){
+ void getCurrentResoure(DelegateExecution execution){
logger.trace("Start getCurrentResoure Process ")
def currentIndex = execution.getVariable("currentResourceIndex")
List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
Resource currentResource = sequencedResourceList.get(currentIndex)
execution.setVariable("resourceType", currentResource.getModelInfo().getModelName())
- logger.info("Now we deal with resouce:" + currentResource.getModelInfo().getModelName())
- logger.trace("COMPLETED getCurrentResoure Process ")
+ logger.info("Now we deal with resource:" + currentResource.getModelInfo().getModelName())
+ logger.trace("COMPLETED getCurrentResource Process ")
}
- public void parseNextResource(DelegateExecution execution){
+ void parseNextResource(DelegateExecution execution){
logger.trace("Start parseNextResource Process ")
def currentIndex = execution.getVariable("currentResourceIndex")
def nextIndex = currentIndex + 1
execution.setVariable("currentResourceIndex", nextIndex)
- List<String> sequencedResourceList = execution.getVariable("sequencedResourceList")
+ List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
if(nextIndex >= sequencedResourceList.size()){
execution.setVariable("allResourceFinished", "true")
}else{
@@ -202,7 +225,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("COMPLETED parseNextResource Process ")
}
- public void prepareResourceRecipeRequest(DelegateExecution execution){
+ void prepareResourceRecipeRequest(DelegateExecution execution){
logger.trace("Start prepareResourceRecipeRequest Process ")
ResourceInput resourceInput = new ResourceInput()
String serviceInstanceName = execution.getVariable("serviceInstanceName")
@@ -219,28 +242,49 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
resourceInput.setServiceType(serviceType)
resourceInput.setServiceInstanceId(serviceInstanceId)
resourceInput.setOperationId(operationId)
- resourceInput.setOperationType(operationType);
+ resourceInput.setOperationType(operationType)
def currentIndex = execution.getVariable("currentResourceIndex")
List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
Resource currentResource = sequencedResourceList.get(currentIndex)
- resourceInput.setResourceModelInfo(currentResource.getModelInfo());
+ resourceInput.setResourceModelInfo(currentResource.getModelInfo())
+ resourceInput.getResourceModelInfo().setModelType(currentResource.getResourceType().toString())
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo());
- def String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid();
+
+ if (currentResource.getResourceType() == ResourceType.VNF) {
+ execution.setVariable("vfModelInfo", currentResource.getModelInfo())
+ }
+
+ resourceInput.setVfModelInfo(execution.getVariable("vfModelInfo") as ModelInfo)
+ String vnfId = execution.getVariable("vnf-id")
+ if (vnfId != null) {
+ resourceInput.setVnfId(vnfId)
+ }
+
+
+ resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo())
String incomingRequest = execution.getVariable("uuiRequest")
- //set the requestInputs from tempalte To Be Done
- String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid")
- String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
- String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
+ //set the requestInputs from template To Be Done
+ String uuiServiceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
+
+ // current vfdata holds information for preparing input for resource
+ // e.g. it will hold
+ // { top_level_list_name, second_level_list_name, top_index, second_index, last processed node}
+ Map<String, Object> currentVFData = (Map) execution.getVariable("currentVFData")
+
+ if (null == currentVFData) {
+ currentVFData = new HashMap<>()
+ }
+ String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, currentResource, uuiServiceParameters, currentVFData)
resourceInput.setResourceParameters(resourceParameters)
resourceInput.setRequestsInputs(incomingRequest)
execution.setVariable("resourceInput", resourceInput.toString())
execution.setVariable("resourceModelUUID", resourceInput.getResourceModelInfo().getModelUuid())
+ execution.setVariable("currentVFData",currentVFData)
logger.trace("COMPLETED prepareResourceRecipeRequest Process ")
}
- public void executeResourceRecipe(DelegateExecution execution){
+ void executeResourceRecipe(DelegateExecution execution){
logger.trace("Start executeResourceRecipe Process ")
try {
@@ -262,6 +306,22 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
BpmnRestClient bpmnRestClient = new BpmnRestClient()
HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd)
+
+ def currentIndex = execution.getVariable("currentResourceIndex")
+ List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") as List<Resource>
+ Resource currentResource = sequencedResourceList.get(currentIndex)
+ if(ResourceType.VNF == currentResource.getResourceType()) {
+ if (resp.getStatusLine().getStatusCode() > 199 && resp.getStatusLine().getStatusCode() < 300) {
+ String responseString = EntityUtils.toString(resp.getEntity(), "UTF-8")
+ if (responseString != null) {
+ Gson gson = new Gson()
+ Type type = new TypeToken<Map<String, String>>() {}.getType()
+ Map<String, Object> map = gson.fromJson(responseString, type)
+ Map<String, String> map1 = gson.fromJson(map.get("response"), type)
+ execution.setVariable("vnf-id",map1.get("vnf-id"))
+ }
+ }
+ }
} else {
String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceModelUUID
logger.trace(exceptionMessage)
@@ -278,7 +338,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
}
}
- public void postConfigRequest(DelegateExecution execution){
+ void postConfigRequest(DelegateExecution execution){
//now do noting
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
for (VnfResource resource : serviceDecomposition.vnfResources) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
index bf52b11de2..64d9827c7c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
@@ -83,7 +83,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
- public void preProcessRequest (DelegateExecution execution) {
+ void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
logger.trace("preProcessRequest")
@@ -286,7 +286,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit preProcessRequest")
}
- public void getAAICustomerById (DelegateExecution execution) {
+ void getAAICustomerById (DelegateExecution execution) {
// https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId}
try {
@@ -306,7 +306,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
}
- public void putServiceInstance(DelegateExecution execution) {
+ void putServiceInstance(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("putServiceInstance")
String msg = ""
@@ -380,7 +380,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit putServiceInstance")
}
- public void preProcessSDNCAssignRequest(DelegateExecution execution) {
+ void preProcessSDNCAssignRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
logger.trace("preProcessSDNCAssignRequest")
@@ -479,7 +479,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit preProcessSDNCAssignRequest")
}
- public void postProcessSDNCAssign (DelegateExecution execution) {
+ void postProcessSDNCAssign (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("postProcessSDNCAssign")
try {
@@ -518,7 +518,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit postProcessSDNCAssign")
}
- public void postProcessAAIGET2(DelegateExecution execution) {
+ void postProcessAAIGET2(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("postProcessAAIGET2")
String msg = ""
@@ -561,7 +561,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit postProcessAAIGET2")
}
- public void preProcessRollback (DelegateExecution execution) {
+ void preProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("preProcessRollback")
try {
@@ -582,7 +582,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit preProcessRollback")
}
- public void postProcessRollback (DelegateExecution execution) {
+ void postProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("postProcessRollback")
String msg = ""
@@ -603,7 +603,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit postProcessRollback")
}
- public void createProject(DelegateExecution execution) {
+ void createProject(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("createProject")
@@ -631,7 +631,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
logger.trace("Exit createProject")
}
- public void createOwningEntity(DelegateExecution execution) {
+ void createOwningEntity(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
logger.trace("createOwningEntity")
String msg = "";
@@ -679,7 +679,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
// Build Error Section
// *******************************
- public void processJavaException(DelegateExecution execution){
+ void processJavaException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try{
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy
index 1eeba493f4..af82bf091a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy
@@ -69,7 +69,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
String Prefix="DCRESIRB_"
- public void preProcessRequest(DelegateExecution execution) {
+ void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
String msg = ""
@@ -139,7 +139,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
logger.trace("Exit preProcessRequest")
}
- public void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
logger.trace("validateSDNCResponse")
String msg = ""
@@ -172,7 +172,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
logger.trace("Exit validateSDNCResponse")
}
- public void postProcessRequest(DelegateExecution execution) {
+ void postProcessRequest(DelegateExecution execution) {
logger.trace("postProcessRequest")
String msg = ""
@@ -206,7 +206,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
}
- public void processRollbackException(DelegateExecution execution){
+ void processRollbackException(DelegateExecution execution){
logger.trace("processRollbackException")
try{
@@ -224,7 +224,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso
logger.debug("Exit processRollbackException")
}
- public void processRollbackJavaException(DelegateExecution execution){
+ void processRollbackJavaException(DelegateExecution execution){
logger.trace("processRollbackJavaException")
try{
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
index 468f603ef6..1517a335d9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.HttpClientFactory
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
@@ -60,7 +61,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
* generate the nsOperationKey
* generate the nsParameters
*/
- public void preProcessRequest (DelegateExecution execution) {
+ void preProcessRequest (DelegateExecution execution) {
String msg = ""
logger.trace("preProcessRequest()")
try {
@@ -129,7 +130,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* create NS task
*/
- public void createNetworkService(DelegateExecution execution) {
+ void createNetworkService(DelegateExecution execution) {
logger.trace("createNetworkService")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
@@ -156,7 +157,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* instantiate NS task
*/
- public void instantiateNetworkService(DelegateExecution execution) {
+ void instantiateNetworkService(DelegateExecution execution) {
logger.trace("instantiateNetworkService")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
@@ -185,7 +186,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* query NS task
*/
- public void queryNSProgress(DelegateExecution execution) {
+ void queryNSProgress(DelegateExecution execution) {
logger.trace("queryNSProgress")
String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
@@ -205,7 +206,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* delay 5 sec
*/
- public void timeDelay(DelegateExecution execution) {
+ void timeDelay(DelegateExecution execution) {
try {
Thread.sleep(5000);
} catch(InterruptedException e) {
@@ -216,7 +217,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
/**
* finish NS task
*/
- public void addNSRelationship(DelegateExecution execution) {
+ void addNSRelationship(DelegateExecution execution) {
logger.trace("addNSRelationship")
String nsInstanceId = execution.getVariable("nsInstanceId")
if(nsInstanceId == null || nsInstanceId == ""){
@@ -234,7 +235,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
getAAIClient().connect(nsUri,relatedServiceUri)
logger.info("NS relationship to Service added successfully")
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception occured while executing AAI Put Call", "BPMN",
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 ea9987e2ec..731c5b8dc5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.client.HttpClientFactory
import org.onap.so.logger.ErrorCode
@@ -568,7 +569,7 @@ public class DoCreateVfModule extends VfModuleBase {
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",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
@@ -620,7 +621,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
@@ -747,7 +748,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
@@ -827,7 +828,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.SIX, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e, e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModuleForStatus(): ' + e.getMessage())
@@ -863,7 +864,7 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCAssignRequest", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage())
@@ -957,7 +958,7 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
@@ -1165,7 +1166,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
@@ -1556,7 +1557,7 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessUpdateAAIVfModuleRequestOrch", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestOrch Method:\n" + e.getMessage())
@@ -1586,7 +1587,7 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessUpdateAAIVfModuleStatus", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage())
@@ -1616,7 +1617,7 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessUpdateAAIVfModuleRequestGroup", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleRequestGroup Method:\n" + e.getMessage())
@@ -1696,7 +1697,7 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCGetRequest", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
@@ -1818,14 +1819,14 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug(" is Cloud Region Good: " + execution.getVariable("DCVFM_isCloudRegionGood"))
} catch(BpmnError b){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Rethrowing MSOWorkflowException", "BPMN",
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(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI Query Cloud Region Failed " + errorMessage, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during queryCloudRegion method")
@@ -1888,7 +1889,7 @@ public class DoCreateVfModule extends VfModuleBase {
logger.debug("Outgoing CreateAAIVfModuleVolumeGroupRequest is: \n" + createAAIVfModuleVolumeGroupRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Exception Occured Processing prepareCreateAAIVfModuleVolumeGroupRequest', "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareCreateAAIVfModuleVolumeGroupRequest Method:\n" + e.getMessage())
@@ -2021,7 +2022,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Encountered in " + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
@@ -2066,7 +2067,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage())
@@ -2119,7 +2120,7 @@ public class DoCreateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in queryCatalogDB', "BPMN",
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 65f6f76a21..4bab2b390d 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
@@ -21,6 +21,8 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.NetworkPolicies
@@ -263,7 +265,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest.", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
@@ -448,7 +450,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
// -
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI error occurred deleting the Generic Vnf" + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
"BPMN", ErrorCode.UnknownError.getValue());
String processKey = getProcessKey(execution);
@@ -609,7 +611,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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{
execution.setVariable("rollbackError", null)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing setSuccessfulRollbackStatus.", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
@@ -647,7 +649,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
execution.setVariable("rollbackData", null)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing setFailedRollbackStatus.", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
index fb5c0fa0aa..e9b748b14b 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.db.catalog.beans.HomingInstance
import org.onap.so.logger.ErrorCode
@@ -215,7 +216,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -406,7 +407,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
logger.debug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCAssignRequest", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCAssignRequest Method:\n" + e.getMessage())
@@ -624,7 +625,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
logger.debug("Outgoing GetSDNCRequest is: \n" + SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest. ", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during prepareProvision Method:\n" + e.getMessage())
@@ -663,7 +664,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in " + method, "BPMN",
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 725a139b59..180032c8f0 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.json.JSONObject;
import org.json.JSONArray;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -308,7 +309,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule ", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
@@ -326,7 +327,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("addOnModulesDeployed", addOnModulesDeployed + 1)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing postProcessAddOnModule ", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during postProcessAddOnModule Method:\n" + e.getMessage())
@@ -356,7 +357,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing validateBaseModule ", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during validateBaseModule Method:\n" + e.getMessage())
@@ -387,7 +388,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "${numOfCreatedAddOnModules}")
execution.setVariable("rollbackData", rollbackData)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule ", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
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 7ea32d2a60..a6cb5cf4cc 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,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -163,7 +164,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("DCVAMR_RollbackData", vfModuleRollbackData)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessCreateVfModuleRollback ", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessCreateVfModuleRollback Method:\n" + e.getMessage())
@@ -183,14 +184,14 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
def numOfModulesToDelete = execution.getVariable("DCVAMR_numOfModulesToDelete")
execution.setVariable("DCVAMR_numOfModulesToDelete", numOfModulesToDelete - 1)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing postProcessCreateVfModuleRollback ", "BPMN",
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(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Unsuccessful rollback of DoCreateVfModule ", "BPMN",
ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during rollback of DoCreateVfModule")
@@ -216,7 +217,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest ", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
@@ -339,7 +340,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackError", null)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
"Processing setSuccessfulRollbackStatus ", "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setSuccessfulRollbackStatus Method:\n" + e.getMessage())
}
@@ -361,7 +362,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor {
execution.setVariable("rollbackData", null)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception Occured " +
"Processing setFailedRollbackStatus. ", "BPMN",ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during setFailedRollbackStatus Method:\n" + e.getMessage())
}
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 f1b7328bcc..a88becad1a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
@@ -7,7 +7,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -22,9 +22,10 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
@@ -32,8 +33,8 @@ import javax.xml.parsers.DocumentBuilderFactory
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONArray;
-import org.json.JSONObject;
+import org.json.JSONArray
+import org.json.JSONObject
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -43,7 +44,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.web.util.UriUtils;
+import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.Node
@@ -78,7 +79,7 @@ import groovy.json.*
* Rollback - Deferred
*/
public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
- private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoCustomDeleteE2EServiceInstance.class)
String Prefix="DDELSI_"
@@ -150,7 +151,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
execution.setVariable("siParamsXml", siParamsXml)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.info(msg)
@@ -270,7 +271,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
logger.info("sdncDelete:\n" + sdncDelete)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch(Exception ex) {
msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
logger.info(msg)
@@ -301,7 +302,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
}
} catch (BpmnError e) {
- throw e;
+ throw e
} catch(Exception ex) {
msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage()
logger.info(msg)
@@ -336,8 +337,8 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
//Confirm there are no related service instances (vnf/network or volume)
if (utils.nodeExists(siData, "relationship-list")) {
logger.info("SI Data relationship-list exists:")
- InputSource source = new InputSource(new StringReader(siData));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ InputSource source = new InputSource(new StringReader(siData))
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance()
DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
Document serviceXml = docBuilder.parse(source)
serviceXml.getDocumentElement().normalize()
@@ -432,7 +433,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
logger.info("Service-instance NOT found in AAI. Silent Success")
}
}catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex) {
msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
logger.info(msg)
@@ -451,7 +452,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
String serviceType = execution.getVariable("serviceType")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- AAIResourcesClient resourceClient = new AAIResourcesClient();
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
resourceClient.delete(serviceInstanceUri)
@@ -532,9 +533,9 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
- ErrorCode.UnknownError.getValue(), e);
+ ErrorCode.UnknownError.getValue(), e)
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
}
logger.trace("COMPLETED preInitResourcesOperStatus Process ")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
index 1912d65ce3..48e4fdf2ff 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
@@ -22,6 +22,7 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.aai.domain.yang.AllottedResource
import org.onap.so.logger.ErrorCode
@@ -944,7 +945,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN",
ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index e5b8d52376..34ea20ba62 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -6,7 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -21,9 +21,11 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import org.apache.commons.lang3.StringUtils
+import org.apache.commons.lang3.tuple.ImmutablePair
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONArray
@@ -36,9 +38,12 @@ 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.UrnPropertiesReader
-import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.domain.GroupResource
import org.onap.so.bpmn.core.domain.Resource
+import org.onap.so.bpmn.core.domain.ResourceType
import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.VnfResource
+import org.onap.so.bpmn.core.domain.VnfcResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
@@ -51,14 +56,10 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import org.springframework.web.util.UriUtils
-import org.w3c.dom.Document
-import org.w3c.dom.Node
-import org.xml.sax.InputSource
import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
-import javax.xml.parsers.DocumentBuilder
-import javax.xml.parsers.DocumentBuilderFactory
import static org.apache.commons.lang3.StringUtils.isBlank
@@ -89,7 +90,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String Prefix="DDEESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger( DoDeleteE2EServiceInstance.class);
+ private static final Logger logger = LoggerFactory.getLogger( DoDeleteE2EServiceInstance.class)
public void preProcessRequest (DelegateExecution execution) {
@@ -157,7 +158,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("siParamsXml", siParamsXml)
} catch (BpmnError e) {
- throw e;
+ throw e
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
logger.error(msg)
@@ -171,23 +172,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String msg = ""
try {
-
String serviceInstanceId = execution.getVariable('serviceInstanceId')
String globalSubscriberId = execution.getVariable('globalSubscriberId')
String serviceType = execution.getVariable('serviceType')
-
-
AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
-
if (!resourceClient.exists(serviceInstanceUri)) {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
}
-
AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
-
Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
-
// found in AAI
if (si.isPresent() && StringUtils.isNotEmpty(si.get().getServiceInstanceName())) {
logger.debug("Found Service-instance in AAI")
@@ -196,12 +190,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
// Get Template uuid and version
if ((null != si.get().getModelInvariantId()) && (null != si.get().getModelVersionId())) {
logger.debug("SI Data model-invariant-id and model-version-id exist")
-
// Set Original Template info
execution.setVariable("model-invariant-id-original", si.get().getModelInvariantId())
execution.setVariable("model-version-id-original", si.get().getModelVersionId())
}
-
if ((null != si.get().getRelationshipList()) && (null != si.get().getRelationshipList().getRelationship())) {
logger.debug("SI Data relationship-list exists")
List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
@@ -210,12 +202,9 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
def jObj = getRelationShipData(relationship)
jArray.put(jObj)
}
-
execution.setVariable("serviceRelationShip", jArray.toString())
}
-
} else {
-
msg = "Service-instance: " + serviceInstanceId + " NOT found in AAI."
logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
@@ -235,34 +224,30 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
private JSONObject getRelationShipData(Relationship relationship) {
JSONObject jObj = new JSONObject()
-
-
def rt = relationship.getRelatedTo()
-
def rl = relationship.getRelatedLink()
logger.debug("ServiceInstance Related NS/Configuration :" + rl)
-
List<RelationshipData> rl_datas = relationship.getRelationshipData()
for (RelationshipData rl_data : rl_datas) {
def eKey = rl_data.getRelationshipKey()
def eValue = rl_data.getRelationshipValue()
-
if ((rt.equals("service-instance") && eKey.equals("service-instance.service-instance-id"))
//for overlay/underlay
|| (rt.equals("configuration") && eKey.equals("configuration.configuration-id")
)) {
jObj.put("resourceInstanceId", eValue)
}
+ else if (rt.equals("allotted-resource") && eKey.equals("allotted-resource.id")){
+ jObj.put("resourceInstanceId", eValue)
+ }
// for sp-partner and others
else if (eKey.endsWith("-id")) {
jObj.put("resourceInstanceId", eValue)
- String resourceName = rt + eValue;
+ String resourceName = rt + eValue
jObj.put("resourceType", resourceName)
}
-
jObj.put("resourceLinkUrl", rl)
}
-
List<RelatedToProperty> rl_props = relationship.getRelatedToProperty()
for (RelatedToProperty rl_prop : rl_props) {
def eKey = rl_prop.getPropertyKey()
@@ -273,11 +258,66 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
jObj.put("resourceType", eValue)
}
}
-
logger.debug("Relationship related to Resource:" + jObj.toString())
return jObj
}
+ private Relationship getRelationShipFromNode(groovy.util.slurpersupport.Node relationshipNode) {
+ Relationship relationship = new Relationship()
+ def rtn = relationshipNode.childNodes()
+ List<RelationshipData> relationshipDatas = new ArrayList<>()
+ List<RelatedToProperty> relationshipProperties = new ArrayList<>()
+ while (rtn.hasNext()) {
+ groovy.util.slurpersupport.Node node = rtn.next()
+ def key = node.name()
+
+ if(key.equals("related-to")){
+ def rt = node.text()
+ relationship.setRelatedTo(rt)
+ } else if (key.equals("related-link")){
+ def rl = node.text()
+ relationship.setRelatedLink(rl)
+ } else if (key.equals("relationship-label")){
+ def label = node.text()
+ relationship.setRelationshipLabel(label)
+ } else if (key.equals("relationship-data")){
+ def rData = node.childNodes()
+ RelationshipData relationshipData = new RelationshipData()
+ while(rData.hasNext()){
+ groovy.util.slurpersupport.Node datanode = rData.next()
+ def dataKey = datanode.name()
+ if(dataKey.equals("relationship-key")) {
+ relationshipData.setRelationshipKey(datanode.text())
+ } else if(dataKey.equals("relationship-value")) {
+ relationshipData.setRelationshipValue(datanode.text())
+ }
+ }
+ relationshipDatas.add(relationshipData)
+ } else if (key.equals("related-to-property")){
+ def rProperty = node.childNodes()
+ RelatedToProperty relationshipProperty = new RelatedToProperty()
+ while(rProperty.hasNext()){
+ groovy.util.slurpersupport.Node propnode = rProperty.next()
+
+ def dataKey = propnode.name()
+ if(dataKey.equals("property-key")) {
+ relationshipProperty.setPropertyKey(propnode.text())
+ } else if(dataKey.equals("property-value")) {
+ relationshipProperty.setPropertyValue(propnode.text())
+ }
+
+ }
+ relationshipProperties.add(relationshipProperty)
+ }
+
+ }
+ relationship.getRelationshipData().addAll(relationshipDatas)
+ relationship.getRelatedToProperty().addAll(relationshipProperties)
+
+ logger.debug("Relationship related to Resource:" + relationship.toString())
+ return relationship
+ }
+
public void getCurrentNS(DelegateExecution execution){
logger.info( "======== Start getCurrentNS Process ======== ")
@@ -315,19 +355,31 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
}
- private void generateRelatedResourceInfo(String response, JSONObject jObj){
+ private void generateRelatedResourceInfo(String response, JSONObject jObj, boolean processRelationship){
def xml = new XmlSlurper().parseText(response)
def rtn = xml.childNodes()
while (rtn.hasNext()) {
groovy.util.slurpersupport.Node node = rtn.next()
def key = node.name()
- def value = node.text()
- jObj.put(key, value)
+ if (key.equals("relationship-list") && processRelationship) {
+ def relns = node.childNodes()
+ JSONArray jArray = new JSONArray()
+ while (relns.hasNext()) {
+ groovy.util.slurpersupport.Node relNode = relns.next()
+ Relationship relationship = getRelationShipFromNode(relNode)
+ def relationObj = getRelationShipData(relationship)
+ jArray.put(relationObj)
+ }
+ jObj.put(key, jArray)
+ } else {
+ def value = node.text()
+ jObj.put(key, value)
+ }
}
}
- private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj)
+ private JSONObject getRelatedResourceInAAI (DelegateExecution execution, JSONObject jObj, boolean processRelationship)
{
logger.debug(" ***** Started getRelatedResourceInAAI *****")
@@ -337,7 +389,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
URL url = new URL(serviceAaiPath)
HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI)
-
+ client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ client.addAdditionalHeader("X-FromAppId", "MSO")
+ client.addAdditionalHeader("X-TransactionId", utils.getRequestID())
+ client.setAcceptType(MediaType.APPLICATION_XML)
Response response = client.get()
int responseCode = response.getStatus()
@@ -355,7 +410,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "SuccessIndicator", true)
execution.setVariable(Prefix + "FoundIndicator", true)
- generateRelatedResourceInfo(aaiResponse, jObj)
+ generateRelatedResourceInfo(aaiResponse, jObj, processRelationship)
//get model-invariant-uuid and model-uuid
String modelInvariantId = ""
@@ -364,12 +419,17 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
if(jObj.has("model-invariant-id")) {
modelInvariantId = jObj.get("model-invariant-id")
modelUuid = jObj.get("model-version-id")
- modelCustomizationId = jObj.get("model-customization-id")
+ if (jObj.has("model-customization-id")) {
+ modelCustomizationId = jObj.get("model-customization-id")
+ } else {
+ logger.info("resource customization id is not found for :" + url)
+ }
}
jObj.put("modelInvariantId", modelInvariantId)
jObj.put("modelVersionId", modelUuid)
jObj.put("modelCustomizationId", modelCustomizationId)
+ logger.info("resource detail from AAI:" + jObj)
}
else {
String exceptionMessage = "Get RelatedResource Received a Bad Response Code. Response Code is: " + responseCode
@@ -399,7 +459,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
relationShipList = jsonSlurper.parseText(serviceRelationShip)
}
- List<Resource> deleteRealResourceList = new ArrayList<Resource>()
+ List<ImmutablePair<Resource, List<Resource>>> deleteRealResourceList = new ArrayList<ImmutablePair<Resource, List<Resource>>>()
//Set the real resource instance id to the decomosed resource list
//reset the resource instance id , because in the decompose flow ,its a random one.
@@ -407,21 +467,27 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
if (relationShipList != null) {
relationShipList.each {
- JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it)
+ JSONObject obj = getRelatedResourceInAAI(execution, (JSONObject)it, true)
for (Resource resource : deleteResourceList) {
- String modelName = resource.getModelInfo().getModelName()
-
- String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid()
- if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) {
- resource.setResourceId(obj.get("resourceInstanceId"))
- deleteRealResourceList.add(resource)
- }
- else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId"))) {
- resource.setResourceId(obj.get("resourceInstanceId"))
- resource.setResourceInstanceName(obj.get("resourceType"))
- deleteRealResourceList.add(resource)
+ boolean matches = processMatchingResource(resource, obj)
+ if((matches) && resource.getResourceType().equals(ResourceType.VNF)) {
+ List<Resource> delGroupList = new ArrayList<Resource>()
+ JSONArray vfRelationship = obj.getJSONArray("relationship-list")
+ for (int idx = 0; idx < vfRelationship.length(); idx++) {
+ JSONObject vfItem = vfRelationship.getJSONObject(idx)
+ JSONObject groupObject = getRelatedResourceInAAI(execution, vfItem, false)
+ List<GroupResource> groups = ((VnfResource)resource).getGroups()
+ for (GroupResource group : groups){
+ if(processMatchingResource(group, groupObject)){
+ delGroupList.add(group)
+ }
+ }
+ }
+ def delMap = new ImmutablePair(resource, delGroupList)
+
+ deleteRealResourceList.add(delMap)
}
}
}
@@ -429,7 +495,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
// only delete real existing resources
execution.setVariable("deleteResourceList", deleteRealResourceList)
-
+
boolean isDeleteResourceListValid = false
if(deleteRealResourceList.size() > 0) {
isDeleteResourceListValid = true
@@ -442,7 +508,26 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.error(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- logger.debug( " ***** exit postDecomposeService() of delete generic e2e service flow ***** ")
+ logger.debug(" ***** exit postDecomposeService() of delete generic e2e service flow ***** ")
+ }
+
+ private boolean processMatchingResource(Resource resource, JSONObject obj) {
+ boolean matches = false
+ String modelName = resource.getModelInfo().getModelName()
+
+ String modelCustomizationUuid = resource.getModelInfo().getModelCustomizationUuid()
+ String modelUuid = resource.getModelInfo().getModelUuid()
+ if (StringUtils.containsIgnoreCase(obj.get("resourceType"), modelName)) {
+ resource.setResourceId(obj.get("resourceInstanceId"))
+ //deleteRealResourceList.add(resource)
+ matches = true
+ } else if (modelCustomizationUuid.equals(obj.get("modelCustomizationId")) || modelUuid.equals(obj.get("model-version-id")) ) {
+ resource.setResourceId(obj.get("resourceInstanceId"))
+ resource.setResourceInstanceName(obj.get("resourceType"))
+ //deleteRealResourceList.add(resource)
+ matches = true
+ }
+ return matches
}
public void preInitResourcesOperStatus(DelegateExecution execution){
@@ -461,11 +546,12 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
execution.setVariable("operationType", operationType)
- List<Resource> deleteResourceList = execution.getVariable("deleteResourceList")
+ List<ImmutablePair<Resource, List<Resource>>> deleteResourceList = execution.getVariable("deleteResourceList")
String serviceRelationShip = execution.getVariable("serviceRelationShip")
- for(Resource resource : deleteResourceList){
- resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
+ for (ImmutablePair rc : deleteResourceList) {
+ Resource resource = rc.getKey()
+ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
}
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
@@ -496,7 +582,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
logger.debug("======== COMPLETED preInitResourcesOperStatus Process ======== ")
}
-
+
public void prepareUpdateServiceOperationStatus(DelegateExecution execution){
logger.debug(" ======== STARTED prepareUpdateServiceOperationStatus Process ======== ")
try{
@@ -507,7 +593,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String progress = execution.getVariable("progress")
String reason = ""
String operationContent = execution.getVariable("operationContent")
-
+
serviceId = UriUtils.encode(serviceId,"UTF-8")
def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
@@ -550,5 +636,26 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
//to do
}
+ /**
+ * Deletes the service instance in aai
+ */
+ public void deleteServiceInstance(DelegateExecution execution) {
+ logger.trace("Entered deleteServiceInstance")
+ try {
+ String globalCustId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustId, serviceType, serviceInstanceId)
+ resourceClient.delete(serviceInstanceUri)
+
+ logger.trace("Exited deleteServiceInstance")
+ }catch(Exception e){
+ logger.debug("Error occured within deleteServiceInstance method: " + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteServiceInstance from aai")
+ }
+ }
+
}
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 2558f7eff5..df8735aaaa 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.L3Network
@@ -266,7 +267,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix + "queryAAIResponse", l3Network.get())
execution.setVariable(Prefix + "isAAIGood", true)
if (relationships.isPresent()){
- if(relationships.get().getRelatedAAIUris(AAIObjectType.VF_MODULE).isEmpty()){
+ if(!relationships.get().getRelatedAAIUris(AAIObjectType.VF_MODULE).isEmpty()){
execution.setVariable(Prefix + "isVfRelationshipExist", true)
isVfRelationshipExist = true
String relationshipMessage = "AAI Query Success Response but 'vf-module' relationship exist, not allowed to delete: network Id: " + networkId
@@ -465,7 +466,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage()
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
"BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
@@ -517,7 +518,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage()
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
"BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
@@ -558,7 +559,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage()
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
"BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
@@ -998,7 +999,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
// caught exception
String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage()
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), exceptionMessage,
"BPMN", ErrorCode.UnknownError.getValue(),
"Exception is:\n" + ex);
logger.debug(exceptionMessage)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
index 0d096f3b16..53c1e311e2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
@@ -22,7 +22,12 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import org.apache.commons.lang3.tuple.ImmutablePair
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.bpmn.core.domain.GroupResource
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ResourceType
import static org.apache.commons.lang3.StringUtils.isBlank
@@ -151,17 +156,61 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
List<Resource> wanResources = new ArrayList<Resource>()
// get delete resource list and order list
- List<Resource> delResourceList = execution.getVariable("deleteResourceList")
+ List<ImmutablePair<Resource, List<Resource>>> delResourceList = execution.getVariable("deleteResourceList")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String serviceModelName = serviceDecomposition.getModelInfo().getModelName();
-
+ String serviceModelUuid = serviceDecomposition.getModelInfo().getModelUuid();
+
+ Map<String, Map<String, Object>> parentVNF = new HashMap<>()
+
+ // get Sequence from properties
def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName)
+ // get Sequence from catalog db csar(model)
+ if(resourceSequence == null) {
+ resourceSequence = ResourceRequestBuilder.getResourceSequence(serviceModelUuid)
+ logger.info("Get Sequence from catalog db csar : " + resourceSequence)
+ }
+
if(resourceSequence != null) {
for (resourceType in resourceSequence.reverse()) {
- for (resource in delResourceList) {
+
+ boolean vfFound = false
+
+ for (ImmutablePair resourceTuple : delResourceList) {
+ Resource resource = resourceTuple.getKey()
+ List<Resource> groupResources = resourceTuple.getValue()
+
if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
+
+
+
+ // if resource type is vnfResource then check for groups also
+ // Did not use continue because if same model type is used twice
+ // then we would like to add it twice for processing
+ // e.g. S{ V1{G1, G2, G1}} --> S{ {G2, G1, G1}V1}
+ // we will add in reverse order for deletion
+ if (resource instanceof VnfResource) {
+ if (resource.getGroupOrder() != null && !StringUtils.isEmpty(resource.getGroupOrder())) {
+ String[] grpSequence = resource.getGroupOrder().split(",")
+
+ Map<String, Object> parentVNFData = new HashMap<>()
+ parentVNFData.put("vfModelInfo", resource.getModelInfo())
+ parentVNFData.put("vnf-id", resource.getResourceId())
+
+ for (String grpType in grpSequence.reverse()) {
+ for (GroupResource gResource in groupResources) {
+ if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) {
+ sequencedResourceList.add(gResource)
+ // Store parent VNF info for the group resource id
+ parentVNF.put(gResource.getResourceId(), parentVNFData)
+ }
+ }
+ }
+ }
+ }
+
sequencedResourceList.add(resource)
if (resource instanceof NetworkResource) {
@@ -173,11 +222,32 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
}else {
//define sequenced resource list, we deploy vf first and then network and then ar
//this is defaule sequence
+ // While deleting we will delete in resource order group resource, ar, network, then VF.
List<VnfResource> vnfResourceList = new ArrayList<VnfResource>()
List<AllottedResource> arResourceList = new ArrayList<AllottedResource>()
- for (Resource rc : delResourceList) {
+ for (ImmutablePair resourceTuple : delResourceList) {
+ Resource rc = resourceTuple.getKey()
+ List<Resource> groupResources = resourceTuple.getValue()
+
if (rc instanceof VnfResource) {
vnfResourceList.add(rc)
+ if (rc.getGroupOrder() != null && !StringUtils.isEmpty(rc.getGroupOrder())) {
+ String[] grpSequence = rc.getGroupOrder().split(",")
+
+ Map<String, Object> parentVNFData = new HashMap<>()
+ parentVNFData.put("vfModelInfo", rc.getModelInfo())
+ parentVNFData.put("vnf-id", rc.getResourceId())
+
+ for (String grpType in grpSequence.reverse()) {
+ for (GroupResource gResource in groupResources) {
+ if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) {
+ sequencedResourceList.add(gResource)
+ // Store parent VNF info for the group resource id
+ parentVNF.put(gResource.getResourceId(), parentVNFData)
+ }
+ }
+ }
+ }
} else if (rc instanceof NetworkResource) {
wanResources.add(rc)
} else if (rc instanceof AllottedResource) {
@@ -199,7 +269,9 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
execution.setVariable("isContainsWanResource", isContainsWanResource)
execution.setVariable("currentResourceIndex", 0)
execution.setVariable("sequencedResourceList", sequencedResourceList)
+ execution.setVariable("parentVNF", parentVNF)
logger.debug("resourceSequence: " + resourceSequence)
+ logger.debug("delete resource sequence list : " + sequencedResourceList)
logger.debug(" ======== END sequenceResource Process ======== ")
}
@@ -235,46 +307,58 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
*/
public void executeResourceDelete(DelegateExecution execution) {
logger.debug("======== Start executeResourceDelete Process ======== ")
- try {
- String requestId = execution.getVariable("msoRequestId")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String serviceType = execution.getVariable("serviceType")
-
- String resourceInstanceId = execution.getVariable("resourceInstanceId")
-
- Resource currentResource = execution.getVariable("currentResource")
- String action = "deleteInstance"
- JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action)
- String recipeUri = resourceRecipe.getString("orchestrationUri")
- int recipeTimeout = resourceRecipe.getInt("recipeTimeout")
- String recipeParamXsd = resourceRecipe.get("paramXSD")
-
-
- ResourceInput resourceInput = new ResourceInput();
- resourceInput.setServiceInstanceId(serviceInstanceId)
- resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName())
- resourceInput.setResourceInstancenUuid(currentResource.getResourceId())
- resourceInput.setOperationId(execution.getVariable("operationId"))
- resourceInput.setOperationType(execution.getVariable("operationType"))
- String globalSubscriberId = execution.getVariable("globalSubscriberId")
- resourceInput.setGlobalSubscriberId(globalSubscriberId)
- resourceInput.setResourceModelInfo(currentResource.getModelInfo());
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo());
- resourceInput.setServiceType(serviceType)
-
- String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + recipeUri
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String serviceType = execution.getVariable("serviceType")
+
+ String resourceInstanceId = execution.getVariable("resourceInstanceId")
+
+ Resource currentResource = execution.getVariable("currentResource")
+ String action = "deleteInstance"
+ JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action)
+ String recipeUri = resourceRecipe.getString("orchestrationUri")
+ int recipeTimeout = resourceRecipe.getInt("recipeTimeout")
+ String recipeParamXsd = resourceRecipe.get("paramXSD")
+
+
+ ResourceInput resourceInput = new ResourceInput();
+ resourceInput.setServiceInstanceId(serviceInstanceId)
+ resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName())
+ resourceInput.setResourceInstancenUuid(currentResource.getResourceId())
+ resourceInput.setOperationId(execution.getVariable("operationId"))
+ resourceInput.setOperationType(execution.getVariable("operationType"))
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ resourceInput.setGlobalSubscriberId(globalSubscriberId)
+ resourceInput.setResourceModelInfo(currentResource.getModelInfo());
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo());
+ resourceInput.setServiceType(serviceType)
+ resourceInput.getResourceModelInfo().setModelType(currentResource.getResourceType().toString())
+ if (currentResource.getResourceType() == ResourceType.GROUP) {
+ Map<String, Map<String, Object>> parentVNF = execution.getVariable("parentVNF")
+ if((null != parentVNF) && (null!=parentVNF.get(currentResource.getResourceId()))){
+ Map<String, Object> parentVNFData = parentVNF.get(currentResource.getResourceId())
+ ModelInfo parentVNFModel = parentVNFData.get("vfModelInfo")
+ String parentResourceId = parentVNFData.get("vnf-id")
+ resourceInput.setVfModelInfo(parentVNFModel)
+ resourceInput.setVnfId(parentResourceId)
+ }
+ }
+
+ String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + recipeUri
BpmnRestClient bpmnRestClient = new BpmnRestClient()
- HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
- logger.debug(" ======== END executeResourceDelete Process ======== ")
- }catch(BpmnError b){
- logger.error("Rethrowing MSOWorkflowException")
- throw b
- }catch(Exception e){
- logger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog")
- }
+
+ HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
+ logger.debug(" ======== END executeResourceDelete Process ======== ")
+ } catch (BpmnError b) {
+ logger.error("Rethrowing MSOWorkflowException")
+ throw b
+ } catch (Exception e) {
+ logger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog")
+ }
}
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 b21dcf3433..4c8247a309 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.aai.domain.yang.NetworkPolicies
import org.onap.aai.domain.yang.NetworkPolicy
import org.onap.so.logger.ErrorCode
@@ -359,7 +360,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
// generates a WorkflowException if
// -
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"),
"BPMN", ErrorCode.UnknownError.getValue(), "Exception");
String processKey = getProcessKey(execution);
@@ -580,7 +581,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
@@ -628,7 +629,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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 e5306c40de..eba43632a7 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.NetworkPolicies
import org.onap.aai.domain.yang.NetworkPolicy
@@ -114,7 +115,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
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",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -160,7 +161,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVfModule(): ' + e.getMessage())
@@ -213,7 +214,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
@@ -239,7 +240,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest. Exception is:\n" + e, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
@@ -403,7 +404,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
// generates a WorkflowException if
// -
public void handleDoDeleteVfModuleFailure(DelegateExecution execution) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"),
"BPMN", ErrorCode.UnknownError.getValue(), "Exception");
String processKey = getProcessKey(execution);
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 9bd3388b79..20d250d89f 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.VfModule
import org.camunda.bpm.engine.delegate.BpmnError
@@ -110,7 +111,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
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",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception");
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -238,7 +239,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule." + e, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage())
@@ -338,7 +339,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
@@ -366,7 +367,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule." + e, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToDelete Method:\n" + e.getMessage())
@@ -392,7 +393,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor {
logger.debug("Outgoing DeactivateSDNCRequest is: \n" + deactivateSDNCRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessSDNCDeactivateRequest." + e, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCDeactivateRequest Method:\n" + e.getMessage())
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 ce3b243533..231fe6e252 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,7 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode
import static org.apache.commons.lang3.StringUtils.*;
@@ -138,7 +139,7 @@ public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
logger.debug("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preInitResourcesOperStatus.", "BPMN",
ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
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 1b089d2a2b..2a8cc08cdf 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONArray
import org.json.JSONObject;
@@ -182,7 +183,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
try {
Thread.sleep(5000)
} catch (InterruptedException e) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Time Delay exception" + e, "BPMN",
ErrorCode.UnknownError.getValue());
}
@@ -216,7 +217,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
logger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
logger.trace("Completed Execute VF-C adapter Post Process ")
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Exception occured " +
"while executing VFC Post Call.", "BPMN", ErrorCode.UnknownError.getValue(), e);
throw new BpmnError("MSOWorkflowException")
}
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 abbcf66323..f7852431e5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
@@ -333,7 +334,7 @@ public class DoUpdateVfModule extends VfModuleBase {
def 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",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -342,7 +343,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
@@ -383,7 +384,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preparePrepareUpdateAAIVfModule(): ' + e.getMessage())
@@ -434,14 +435,14 @@ public class DoUpdateVfModule extends VfModuleBase {
logger.debug(" is Cloud Region Good: " + execution.getVariable(prefix + "isCloudRegionGood"))
} catch(BpmnError b){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Rethrowing MSOWorkflowException", "BPMN",
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(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"AAI Query Cloud Region Failed. Exception - " + "\n" + errorMessage, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception occured during prepConfirmVolumeGroupTenant(): " + e.getMessage())
@@ -548,7 +549,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyChg(): ' + e.getMessage())
@@ -612,7 +613,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyQuery(): ' + e.getMessage())
@@ -716,7 +717,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage())
@@ -764,7 +765,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage())
@@ -838,7 +839,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIVfModule(): ' + e.getMessage())
@@ -941,7 +942,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepSDNCTopologyAct(): ' + e.getMessage())
@@ -962,7 +963,7 @@ public class DoUpdateVfModule extends VfModuleBase {
try {
def WorkflowException workflowException = (WorkflowException) execution.getVariable('WorkflowException')
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
method + ' caught WorkflowException: ' + workflowException.getErrorMessage(), "BPMN",
ErrorCode.UnknownError.getValue());
@@ -970,7 +971,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildWorkflowException(execution, 1002, 'Error in handleWorkflowException(): ' + e.getMessage())
@@ -1048,7 +1049,7 @@ public class DoUpdateVfModule extends VfModuleBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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 eb788a85b7..75ac6900fa 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.HttpClientFactory
import org.onap.so.logger.ErrorCode
@@ -272,7 +273,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage())
@@ -328,7 +329,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
}
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareNextModuleToUpdate Method:\n" + e.getMessage())
@@ -404,7 +405,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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/HandlePNF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy
index cbeb1d3d69..97eb3b3960 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2017 - 2019 Huawei Intellectual Property. All rights reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -34,7 +34,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
public class HandlePNF extends AbstractServiceTaskProcessor{
- private static final Logger logger = LoggerFactory.getLogger( HandlePNF.class);
+ private static final Logger logger = LoggerFactory.getLogger( HandlePNF.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -95,7 +95,7 @@ public class HandlePNF extends AbstractServiceTaskProcessor{
<statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
- </soapenv:Envelope>""";
+ </soapenv:Envelope>"""
logger.debug("body: "+body)
setProgressUpdateVariables(execution, body)
logger.debug("exit postProcess for HandlePNF")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/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 4321dbadd5..e36f32578d 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
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.appc.client.lcm.model.Action;
@@ -233,7 +234,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
@@ -276,7 +277,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
@@ -327,7 +328,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage())
@@ -369,7 +370,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
@@ -413,7 +414,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
@@ -461,7 +462,7 @@ public class ReplaceVnfInfra extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
@@ -531,19 +532,19 @@ public class ReplaceVnfInfra extends VnfCmBase {
logger.trace('Exited ' + method)
} catch (BpmnError e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + 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(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + 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(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
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 ef4a78ffde..ed65616d89 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,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.camunda.bpm.engine.delegate.DelegateExecution
@@ -87,7 +88,7 @@ public class RollbackVnf extends VnfCmBase {
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Encountered - " + "\n" + restFaultMessage, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("rollbackErrorCode", "1")
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 0afa34bdec..b21efdd563 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,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
@@ -294,7 +295,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor
logger.debug("Scale network service updateServiceOperStatusRequest Request: " + payload)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
ErrorCode.UnknownError.getValue(), e);
execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
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 9db5b7366a..6946eebc56 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -96,7 +97,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
@@ -151,7 +152,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage())
@@ -181,7 +182,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
@@ -237,7 +238,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage())
@@ -278,7 +279,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
@@ -333,7 +334,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
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/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
index 0344206145..7f2bbebc8d 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import groovy.json.JsonException
import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
@@ -482,7 +483,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
" retrieved from AAI for Volume Group Id " + volumeGroupId + ", AIC Cloud Region " + aicCloudRegion
ExceptionUtil exceptionUtil = new ExceptionUtil()
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' +
'UpdateVfModuleVol: ' + errorMessage, "BPMN", ErrorCode.UnknownError.getValue(), "Exception")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage)
}
@@ -501,7 +502,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
" retrieved from AAI for Volume Group Id "
ExceptionUtil exceptionUtil = new ExceptionUtil()
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Error in ' +
'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/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
index 05aff713bc..3cb40115ba 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.logger.LoggingAnchor
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
@@ -351,7 +352,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
@@ -396,7 +397,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
@@ -441,7 +442,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
' ' + method, "BPMN", ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
execution.setVariable("errorCode", "1002")
execution.setVariable("errorText", e.getMessage())
@@ -520,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' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
' ' + 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' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
' ' + 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' +
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), 'Caught exception in' +
' ' + 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 9829419128..d57011f61f 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
@@ -21,6 +21,7 @@
*/
package org.onap.so.bpmn.vcpe.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.ErrorCode;
import static org.apache.commons.lang3.StringUtils.*
@@ -420,7 +421,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
'Caught exception in ' + method, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
@@ -847,7 +848,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
// Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
} catch (BpmnError b) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Rethrowing MSOWorkflowException", "BPMN",
ErrorCode.UnknownError.getValue());
throw b
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 a1cdacaf08..553ec2397c 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
@@ -21,6 +21,7 @@
*/
package org.onap.so.bpmn.vcpe.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -419,7 +420,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
}catch(BpmnError b){
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Rethrowing MSOWorkflowException", "BPMN",
ErrorCode.UnknownError.getValue());
throw b
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 2c5b6430e6..0681e54bba 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.vcpe.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.AllottedResource
@@ -585,7 +586,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
execution.setVariable("sdncGetRequest", SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
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 58c0ef2dcf..f24bb46981 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.vcpe.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.AllottedResource
@@ -205,7 +206,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
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 61dd13b4e2..51d04dd092 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.vcpe.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.AllottedResource
@@ -520,7 +521,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
execution.setVariable("sdncGetRequest", SDNCGetRequest)
}catch(Exception e){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage())
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 44e27d99cf..1427730187 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.vcpe.scripts
+import org.onap.so.logger.LoggingAnchor
import org.onap.aai.domain.yang.AllottedResource;
import org.onap.so.bpmn.common.scripts.*;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -206,7 +207,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
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 9dcee3dfb2..29ee1a648e 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.vcpe.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AllottedResourceUtils
@@ -351,7 +352,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
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 43e095859e..404f19eca9 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.vcpe.scripts
+import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AllottedResourceUtils
@@ -355,7 +356,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e;
}catch(Exception ex){
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN",
ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
index d67e6ef0db..a011346756 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java
@@ -45,7 +45,7 @@ public class ConfigCheckerDelegate implements JavaDelegate {
private Logger logger = LoggerFactory.getLogger(ConfigCheckerDelegate.class);
// ERROR CODE for variable not found in the delegation Context
- private static int ERROR_CODE = 601;
+ private static final int ERROR_CODE = 601;
@Autowired
protected ExceptionBuilder exceptionUtil;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index 94ceddae97..2ababac7e3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -24,11 +24,17 @@ import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.runtime.Execution;
+import org.onap.aai.domain.yang.v13.Metadatum;
+import org.onap.so.bpmn.common.recipe.ResourceInput;
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder;
+import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.HashMap;
+import java.util.Optional;
@Component
public class InformDmaapClient implements JavaDelegate {
@@ -41,8 +47,25 @@ public class InformDmaapClient implements JavaDelegate {
String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
String processBusinessKey = execution.getProcessBusinessKey();
- dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService.createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey(processBusinessKey).correlateWithResult());
+ HashMap<String, String> updateInfo = createUpdateInfo(execution);
+ updateInfo.put("pnfCorrelationId", pnfCorrelationId);
+ dmaapClient
+ .registerForUpdate(pnfCorrelationId,
+ () -> runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey(processBusinessKey).correlateWithResult(),
+ Optional.of(updateInfo));
+ }
+
+ private HashMap<String, String> createUpdateInfo(DelegateExecution execution) {
+ HashMap<String, String> map = new HashMap();
+
+ ResourceInput resourceInputObj = ResourceRequestBuilder
+
+ .getJsonObject((String) execution.getVariable("resourceInput"), ResourceInput.class);
+ map.put("globalSubscriberID", resourceInputObj.getGlobalSubscriberId());
+ map.put("serviceType", resourceInputObj.getServiceType());
+ map.put("serviceInstanceId", resourceInputObj.getServiceInstanceId());
+ return map;
}
@Autowired
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
index fbf86cc411..d513684659 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
@@ -20,9 +20,13 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
+import java.util.HashMap;
+import java.util.Optional;
+
public interface DmaapClient {
- void registerForUpdate(String pnfCorrelationId, Runnable informConsumer);
+ void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
+ Optional<HashMap<String, String>> updateInfo);
Runnable unregister(String pnfCorrelationId);
}
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 7cb78a10e5..8010ce62ab 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
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* 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.
@@ -35,15 +36,18 @@ public final class JsonUtilForPnfCorrelationId {
private static final String JSON_PNF_CORRELATION_ID_FIELD_NAME = "correlationId";
+ private JsonUtilForPnfCorrelationId() {
+ throw new IllegalStateException("Utility class");
+ }
+
static List<String> parseJsonToGelAllPnfCorrelationId(String json) {
JsonElement je = new JsonParser().parse(json);
JsonArray array = je.getAsJsonArray();
List<String> list = new ArrayList<>();
Spliterator<JsonElement> spliterator = array.spliterator();
- spliterator.forEachRemaining(jsonElement -> {
- handleEscapedCharacters(jsonElement).ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
- .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)));
- });
+ spliterator.forEachRemaining(jsonElement -> handleEscapedCharacters(jsonElement)
+ .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
+ .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId))));
return list;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 96562fe90f..48061db887 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -23,9 +23,7 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -40,6 +38,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.AAIObjectType;
@Component
public class PnfEventReadyDmaapClient implements DmaapClient {
@@ -53,6 +55,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private volatile ScheduledThreadPoolExecutor executor;
private volatile boolean dmaapThreadListenerIsRunning;
+ public volatile List<HashMap<String, String>> updateInfoMap;
+
@Autowired
public PnfEventReadyDmaapClient(Environment env) {
httpClient = HttpClientBuilder.create().build();
@@ -64,11 +68,19 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
.port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName"))
.path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId"))
.build());
+ updateInfoMap = new ArrayList<>();
}
@Override
- public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
+ Optional<HashMap<String, String>> updateInfo) {
logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
+ HashMap<String, String> map = updateInfo.get();
+ if (map != null && map.size() > 0) {
+ synchronized (updateInfoMap) {
+ updateInfoMap.add(map);
+ }
+ }
pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer);
if (!dmaapThreadListenerIsRunning) {
startDmaapThreadListener();
@@ -79,6 +91,16 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
public synchronized Runnable unregister(String pnfCorrelationId) {
logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
+ synchronized (updateInfoMap) {
+ for (int i = updateInfoMap.size() - 1; i >= 0; i--) {
+ if (!updateInfoMap.get(i).containsKey("pnfCorrelationId"))
+ continue;
+ String id = updateInfoMap.get(i).get("pnfCorrelationId");
+ if (id != pnfCorrelationId)
+ continue;
+ updateInfoMap.remove(i);
+ }
+ }
if (pnfCorrelationIdToThreadMap.isEmpty()) {
stopDmaapThreadListener();
}
@@ -111,7 +133,17 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
try {
logger.debug("dmaap listener starts listening pnf ready dmaap topic");
HttpResponse response = httpClient.execute(getRequest);
- getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
+ List<String> idList = getPnfCorrelationIdListFromResponse(response);
+
+ // idList is never null
+ if (!idList.isEmpty()) {
+ // send only body of response
+ registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8"));
+ }
+
+ if (idList != null) {
+ idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
+ }
} catch (IOException e) {
logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
} finally {
@@ -136,5 +168,36 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
runnable.run();
}
}
+
+ private void registerClientResponse(String pnfCorrelationId, String response) {
+
+ String customerId = null;
+ String serviceType = null;
+ String serId = null;
+ synchronized (updateInfoMap) {
+ for (HashMap<String, String> map : updateInfoMap) {
+ if (!map.containsKey("pnfCorrelationId"))
+ continue;
+ if (pnfCorrelationId != map.get("pnfCorrelationId"))
+ continue;
+ if (!map.containsKey("globalSubscriberID"))
+ continue;
+ if (!map.containsKey("serviceType"))
+ continue;
+ if (!map.containsKey("serviceInstanceId"))
+ continue;
+ customerId = map.get("pnfCorrelationId");
+ serviceType = map.get("serviceType");
+ serId = map.get("serviceInstanceId");
+ }
+ }
+ if (customerId == null || serviceType == null || serId == null)
+ return;
+ AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE_METADATA, customerId,
+ serviceType, serId);
+ client.update(uri, response);
+ }
+
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java
index ad388feffc..c7c12bf4e7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java
@@ -37,7 +37,7 @@ public class NsParameters {
private List<LocationConstraint> locationConstraints;
- private Map<String, Object> additionalParamForNs = new HashMap<String, Object>();
+ private Map<String, Object> additionalParamForNs = new HashMap<>();
/**
* @return Returns the locationConstraints.
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 22c4f95a6f..29dca19820 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -26,14 +26,17 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import java.io.IOException;
+import java.io.InputStream;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
+import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
@@ -47,6 +50,7 @@ import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -54,6 +58,8 @@ import org.camunda.bpm.engine.runtime.Execution;
import org.onap.aai.domain.yang.LogicalLink;
import org.onap.aai.domain.yang.LogicalLinks;
import org.onap.aai.domain.yang.PInterface;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.aai.domain.yang.Relationship;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.core.domain.Resource;
import org.onap.so.bpmn.core.domain.ServiceDecomposition;
@@ -73,13 +79,9 @@ import org.springframework.web.util.UriUtils;
public class ServicePluginFactory {
- // SOTN calculate route
- public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc";
-
- public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
-
- public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory";
-
+ private static String OOF_DEFAULT_ENDPOINT;
+ private static String THIRD_SP_DEFAULT_ENDPOINT;
+ private static String INVENTORY_OSS_DEFAULT_ENDPOINT;
private static final int DEFAULT_TIME_OUT = 60000;
static JsonUtils jsonUtil = new JsonUtils();
@@ -88,6 +90,29 @@ public class ServicePluginFactory {
private static ServicePluginFactory instance;
+ private static final String CUSTOM_RESOURCE_TP = "custom-resource-tp";
+ private static final String VS_MONITORED = "VS_assured";
+ private static final String VS_UNMONITORED = "VS_besteffort";
+ private static final String TS_MONITORED = "TS1";
+ private static final String TS_UNMONITORED = "TS2";
+ private static final String CUSTOM_TP_LIST[] =
+ new String[] {VS_MONITORED, VS_UNMONITORED, TS_MONITORED, TS_UNMONITORED};
+
+ static {
+ try (InputStream is = ClassLoader.class.getResourceAsStream("/application.properties")) {
+ if (null != is) {
+ Properties prop = new Properties();
+ prop.load(is);
+ OOF_DEFAULT_ENDPOINT = prop.getProperty("oof.default.endpoint");
+ THIRD_SP_DEFAULT_ENDPOINT = prop.getProperty("third.sp.default.endpoint");
+ INVENTORY_OSS_DEFAULT_ENDPOINT = prop.getProperty("inventory.oss.default.endpoint");
+ } else {
+ logger.error("Failed to load property file, Either property file is missing or empty!");
+ }
+ } catch (IOException e) {
+ logger.error("Failed to load property file!");
+ }
+ }
public static synchronized ServicePluginFactory getInstance() {
if (null == instance) {
@@ -157,8 +182,7 @@ public class ServicePluginFactory {
}
private boolean isNeedProcessSite(String uuiRequest) {
- return uuiRequest.toLowerCase().contains("site_address")
- && uuiRequest.toLowerCase().contains("sotncondition_clientsignal");
+ return uuiRequest.toLowerCase().contains("address") && uuiRequest.toLowerCase().contains("clientsignal");
}
@SuppressWarnings("unchecked")
@@ -169,6 +193,7 @@ public class ServicePluginFactory {
return true;
}
String host = (String) tpInfoMap.get("host");
+ logger.info("host string from tpinfo:" + host);
// host is empty means TP is in local, not empty means TP is in remote ONAP
if (!host.isEmpty()) {
return false;
@@ -182,17 +207,33 @@ public class ServicePluginFactory {
accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id"));
// change resources
+ boolean flgResourceFound = false;
String resourceName = (String) tpInfoMap.get("resourceName");
for (Object curResource : resources) {
Map<String, Object> resource = (Map<String, Object>) curResource;
String curResourceName = (String) resource.get("resourceName");
curResourceName = curResourceName.replaceAll(" ", "");
if (resourceName.equalsIgnoreCase(curResourceName)) {
+ flgResourceFound = true;
+ logger.info("found match to add site tp info using uui template resource name");
putResourceRequestInputs(resource, accessTPInfo);
break;
}
}
+ if (!flgResourceFound) {
+ String attacmentResName = UrnPropertiesReader.getVariable("sp-partner.attachment-resource-name");
+ for (Object curResource : resources) {
+ Map<String, Object> resource = (Map<String, Object>) curResource;
+ String curResourceName = (String) resource.get("resourceName");
+
+ if (attacmentResName.equals(curResourceName)) {
+ logger.info("found match to add site tp info using customized resource name");
+ putResourceRequestInputs(resource, accessTPInfo);
+ }
+ }
+ }
+
return true;
}
@@ -206,10 +247,10 @@ public class ServicePluginFactory {
// logic for R2 uuiRequest params in service level
for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
String key = entry.getKey();
- if (key.toLowerCase().contains("site_address")) {
+ if (key.toLowerCase().contains("address")) {
location = entry.getValue();
}
- if (key.toLowerCase().contains("sotncondition_clientsignal")) {
+ if (key.toLowerCase().contains("clientsignal")) {
clientSignal = entry.getValue();
vpnAttachmentResourceName = key.substring(0, key.indexOf("_"));
}
@@ -233,10 +274,12 @@ public class ServicePluginFactory {
tpInfoMap = tpJson;
// add resourceName
tpInfoMap.put("resourceName", vpnAttachmentResourceName);
+ logger.info("*** we will try to find resourcename(" + vpnAttachmentResourceName
+ + ") to add resource input ***");
break;
}
}
- logger.debug("Get Terminal TP from InventoryOSS");
+ logger.info("Get Terminal TP from InventoryOSS: " + tpInfoMap);
return tpInfoMap;
}
@@ -321,10 +364,33 @@ public class ServicePluginFactory {
return false;
}
+ private void customizeTP(Map<String, Object> crossTps, String svcName, DelegateExecution execution) {
+ Optional<String> customType = Arrays.stream(CUSTOM_TP_LIST).filter(svcName::contains).findFirst();
+ if (customType.isPresent()) {
+ logger.info("customizing TP");
+ String localTPs = UrnPropertiesReader.getVariable(CUSTOM_RESOURCE_TP + "." + customType.get() + ".local");
+ String remoteTPs = UrnPropertiesReader.getVariable(CUSTOM_RESOURCE_TP + "." + customType.get() + ".remote");
+
+ String localTP = (String) crossTps.get("local-access-ltp-id");
+ String remoteTP = (String) crossTps.get("remote-access-ltp-id");
+
+ if (localTPs.contains(localTP) && remoteTPs.contains(remoteTP)) {
+ logger.info("using same tp returned from AAI");
+ return;
+ }
+
+ crossTps.put("local-access-ltp-id", localTPs.split(",")[0]);
+ crossTps.put("remote-access-ltp-id", remoteTPs.split(",")[0]);
+ }
+ logger.info("cross TP info:" + crossTps);
+ }
+
@SuppressWarnings("unchecked")
private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) {
- Map<String, Object> crossTPs = this.getTPsfromAAI();
+ String serviceName = (String) execution.getVariable("serviceInstanceName");
+ Map<String, Object> crossTPs = this.getTPsfromAAI(serviceName);
+ // customizeTP(crossTPs, serviceName, execution);
if (crossTPs == null || crossTPs.isEmpty()) {
serviceRequestInputs.put("local-access-provider-id", "");
@@ -344,17 +410,45 @@ public class ServicePluginFactory {
serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id"));
serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"));
serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"));
- serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id"));
- serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id"));
- serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id"));
- serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id"));
+ serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-access-client-id"));
+ serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-access-topology-id"));
+ serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-access-node-id"));
+ serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-access-ltp-id"));
}
return;
}
+ private LogicalLink selectLogicalLink(List<LogicalLink> logicalLinks, String svcName) {
+ Optional<String> customType = Arrays.stream(CUSTOM_TP_LIST).filter(svcName::contains).findFirst();
+ if (customType.isPresent()) {
+
+ String[] allowedList =
+ UrnPropertiesReader.getVariable(CUSTOM_RESOURCE_TP + "." + customType.get() + ".local").split(",");
+
+ for (String localTp : allowedList) {
+ for (LogicalLink link : logicalLinks) {
+ for (Relationship relationship : link.getRelationshipList().getRelationship()) {
+ if (relationship.getRelatedTo().equals("p-interface")
+ && relationship.getRelatedLink().contains("-ltpId-" + localTp)
+ && link.getOperationalStatus().equalsIgnoreCase("up")) {
+ logger.info("linkname:" + link.getLinkName() + " is matching with allowed list");
+ return link;
+ }
+ }
+ }
+ }
+
+ logger.error("There is no matching logical link for allowed list :" + Arrays.toString(allowedList));
+ return null;
+ } else {
+ logger.info("link customization is not required");
+ return logicalLinks.get(0);
+ }
+ }
+
// This method returns Local and remote TPs information from AAI
- public Map getTPsfromAAI() {
+ public Map getTPsfromAAI(String serviceName) {
Map<String, Object> tpInfo = new HashMap<>();
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
@@ -363,11 +457,11 @@ public class ServicePluginFactory {
if (result.isPresent()) {
LogicalLinks links = result.get();
- boolean isRemoteLink = false;
-
- links.getLogicalLink();
+ LogicalLink link = selectLogicalLink(links.getLogicalLink(), serviceName);
- for (LogicalLink link : links.getLogicalLink()) {
+ if (link != null) {
+ boolean isRemoteLink = false;
+ logger.info("processing link :" + link.getLinkName());
AAIResultWrapper wrapper = new AAIResultWrapper(link);
Optional<Relationships> optRelationships = wrapper.getRelationships();
List<AAIResourceUri> pInterfaces = new ArrayList<>();
@@ -377,57 +471,85 @@ public class ServicePluginFactory {
isRemoteLink = true;
}
pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE));
- }
-
- if (isRemoteLink) {
- // find remote p interface
- AAIResourceUri localTP = null;
- AAIResourceUri remoteTP = null;
-
- AAIResourceUri pInterface0 = pInterfaces.get(0);
-
- if (isRemotePInterface(client, pInterface0)) {
- remoteTP = pInterfaces.get(0);
- localTP = pInterfaces.get(1);
- } else {
- localTP = pInterfaces.get(0);
- remoteTP = pInterfaces.get(1);
- }
-
- if (localTP != null && remoteTP != null) {
- // give local tp
- String tpUrl = localTP.build().toString();
- PInterface intfLocal = client.get(PInterface.class, localTP).get();
- tpInfo.put("local-access-node-id", tpUrl.split("/")[6]);
-
- String[] networkRef = intfLocal.getNetworkRef().split("/");
- if (networkRef.length == 6) {
- tpInfo.put("local-access-provider-id", networkRef[1]);
- tpInfo.put("local-access-client-id", networkRef[3]);
- tpInfo.put("local-access-topology-id", networkRef[5]);
- }
- String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
- if (ltpIdStr.contains("-")) {
- tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
+ if (isRemoteLink) {
+ // find remote p interface
+ AAIResourceUri localTP = null;
+ AAIResourceUri remoteTP = null;
+
+ AAIResourceUri pInterface0 = pInterfaces.get(0);
+
+ if (isRemotePInterface(client, pInterface0)) {
+ remoteTP = pInterfaces.get(0);
+ localTP = pInterfaces.get(1);
+ } else {
+ localTP = pInterfaces.get(0);
+ remoteTP = pInterfaces.get(1);
}
- // give remote tp
- tpUrl = remoteTP.build().toString();
- PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
- tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]);
-
- String[] networkRefRemote = intfRemote.getNetworkRef().split("/");
-
- if (networkRefRemote.length == 6) {
- tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
- tpInfo.put("remote-access-client-id", networkRefRemote[3]);
- tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
- }
- String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
- if (ltpIdStrR.contains("-")) {
- tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
+ if (localTP != null && remoteTP != null) {
+ // give local tp
+ String tpUrl = localTP.build().toString();
+ String localNodeId = tpUrl.split("/")[4];
+ tpInfo.put("local-access-node-id", localNodeId);
+
+ logger.info("Get info for local TP :" + localNodeId);
+ Optional<Pnf> optLocalPnf = client.get(Pnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.PNF, localNodeId));
+
+ if (optLocalPnf.isPresent()) {
+ Pnf localPnf = optLocalPnf.get();
+
+ for (Relationship rel : localPnf.getRelationshipList().getRelationship()) {
+ if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) {
+ String[] networkRef = rel.getRelatedLink()
+ .substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-");
+ if (networkRef.length == 6) {
+ tpInfo.put("local-access-provider-id", networkRef[1]);
+ tpInfo.put("local-access-client-id", networkRef[3]);
+ tpInfo.put("local-access-topology-id", networkRef[5]);
+ }
+ }
+ }
+ }
+ String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStr.contains("-")) {
+ tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
+
+ // give remote tp
+ tpUrl = remoteTP.build().toString();
+ PInterface intfRemote = client.get(PInterface.class, remoteTP).get();
+
+ String remoteNodeId = tpUrl.split("/")[4];
+ tpInfo.put("remote-access-node-id", remoteNodeId);
+
+ logger.info("Get info for remote TP:" + remoteNodeId);
+
+ String[] networkRefRemote = intfRemote.getNetworkRef().split("-");
+ Optional<Pnf> optRemotePnf = client.get(Pnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.PNF, remoteNodeId));
+
+ if (optRemotePnf.isPresent()) {
+ Pnf remotePnf = optRemotePnf.get();
+
+ for (Relationship rel : remotePnf.getRelationshipList().getRelationship()) {
+ if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) {
+ String[] networkRef = rel.getRelatedLink()
+ .substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-");
+ if (networkRef.length == 6) {
+ tpInfo.put("remote-access-provider-id", networkRefRemote[1]);
+ tpInfo.put("remote-access-client-id", networkRefRemote[3]);
+ tpInfo.put("remote-access-topology-id", networkRefRemote[5]);
+ }
+ }
+ }
+ }
+
+ String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1);
+ if (ltpIdStrR.contains("-")) {
+ tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1));
+ }
}
- return tpInfo;
}
}
}
@@ -733,31 +855,29 @@ public class ServicePluginFactory {
HttpRequestBase method = null;
HttpResponse httpResponse = null;
- try {
+ try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
int timeout = DEFAULT_TIME_OUT;
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout).build();
- HttpClient client = HttpClientBuilder.create().build();
-
- if ("POST".equals(methodType.toUpperCase())) {
+ if ("POST".equalsIgnoreCase(methodType)) {
HttpPost httpPost = new HttpPost(msbUrl);
httpPost.setConfig(requestConfig);
httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
method = httpPost;
- } else if ("PUT".equals(methodType.toUpperCase())) {
+ } else if ("PUT".equalsIgnoreCase(methodType)) {
HttpPut httpPut = new HttpPut(msbUrl);
httpPut.setConfig(requestConfig);
httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
method = httpPut;
- } else if ("GET".equals(methodType.toUpperCase())) {
+ } else if ("GET".equalsIgnoreCase(methodType)) {
HttpGet httpGet = new HttpGet(msbUrl);
httpGet.setConfig(requestConfig);
httpGet.addHeader("X-FromAppId", "MSO");
httpGet.addHeader("Accept", "application/json");
method = httpGet;
- } else if ("DELETE".equals(methodType.toUpperCase())) {
+ } else if ("DELETE".equalsIgnoreCase(methodType)) {
HttpDelete httpDelete = new HttpDelete(msbUrl);
httpDelete.setConfig(requestConfig);
method = httpDelete;
@@ -780,9 +900,6 @@ public class ServicePluginFactory {
method = null;
return responseContent;
- } catch (SocketTimeoutException | ConnectTimeoutException e) {
- return null;
-
} catch (Exception e) {
return null;
@@ -791,13 +908,14 @@ public class ServicePluginFactory {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch (Exception e) {
+ logger.debug("Exception while executing finally block", e);
}
}
if (method != null) {
try {
method.reset();
} catch (Exception e) {
-
+ logger.debug("Exception while executing finally block", e);
}
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index 5451f9ff57..f933277f3c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -27,6 +27,8 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
@@ -40,7 +42,6 @@ import org.json.JSONObject;
import org.onap.msb.sdk.discovery.common.RouteException;
import org.onap.msb.sdk.httpclient.RestServiceCreater;
import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
-import org.onap.so.bpmn.core.BaseTask;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi;
import org.onap.so.db.request.beans.ResourceOperationStatus;
@@ -55,7 +56,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-public abstract class AbstractSdncOperationTask extends BaseTask {
+public abstract class AbstractSdncOperationTask implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class);
@@ -282,8 +283,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
} catch (Exception exception) {
logger.info("exception: AbstractSdncOperationTask.updateProgress fail!");
logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception);
- logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(),
- " updateProgress catch exception: ", this.getTaskName(), ErrorCode.UnknownError.getValue(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.GENERAL_EXCEPTION.toString(),
+ " updateProgress catch exception: ", ErrorCode.UnknownError.getValue(),
exception.getClass().toString());
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
index 4d58439fda..8775b39f97 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.infrastructure.workflow.serviceTask;
import java.util.Map;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
@@ -78,7 +79,7 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask
httpPost.addHeader("Authorization", defaulAuth);
httpPost.addHeader("Content-type", "application/json");
String postBody = getPostbody(inputEntity);
- logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC");
httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML));
httpPost(url, httpPost);
logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!");
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
index 4fb6817a39..ab0bb718ab 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask;
import java.util.Map;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
@@ -77,7 +78,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
httpPost.addHeader("Authorization", defaulAuth);
httpPost.addHeader("Content-type", "application/json");
String postBody = getPostbody(inputEntity);
- logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC");
+ logger.info(LoggingAnchor.THREE, MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC");
httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML));
httpPost(url, httpPost);
logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!");
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
index 5b7f3bb432..16bd194f99 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
@@ -22,12 +22,12 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask;
import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.bpmn.core.BaseTask;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import org.springframework.stereotype.Component;
@Component
-public class SdncUnderlayVpnPreprocessTask extends BaseTask {
+public class SdncUnderlayVpnPreprocessTask implements JavaDelegate {
public static final String RESOURCE_OPER_TYPE = "resourceOperType";
@Override
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
index 21b14c35f9..2418479da6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
@@ -38,31 +38,23 @@ public abstract class AbstractBuilder<I, O> {
public static final String RESOURCE_TYPE = "resourceType";
public enum RequestAction {
- CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), ACTIVATE_NETWORK_INSTANCE(1,
- "ActivateNetworkInstance"), CREATE_SERVICE_INSTANCE(2,
- "CreateServiceInstance"), DELETE_SERVICE_INSTANCE(3,
- "DeleteServiceInstance"), DELETE_NETWORK_INSTANCE(4,
- "DeleteNetworkInstance"), CREATE_VNF_INSTANCE(5,
- "CreateVnfInstance"), ACTIVATE_VNF_INSTANCE(6,
- "ActivateVnfInstance"), DELETE_VNF_INSTANCE(7,
- "DeleteVnfInstance"), CREATE_VF_MODULE_INSTANCE(8,
- "CreateVfModuleInstance"), ACTIVATE_VF_MODULE_INSTANCE(
- 9,
- "ActivateVfModuleInstance"), DELETE_VF_MODULE_INSTANCE(
- 10,
- "DeleteVfModuleInstance"), CREATE_CONTRAIL_ROUTE_INSTANCE(
- 11,
- "CreateContrailRouteInstance"), DELETE_CONTRAIL_ROUTE_INSTANCE(
- 12,
- "DeleteContrailRouteInstance"), CREATE_SECURITY_ZONE_INSTANCE(
- 13,
- "CreateSecurityZoneInstance"), DELETE_SECURITY_ZONE_INSTANCE(
- 14,
- "DeleteSecurityZoneInstance"), ACTIVATE_DCI_NETWORK_INSTANCE(
- 15,
- "ActivateDCINetworkInstance"), DEACTIVATE_DCI_NETWORK_INSTANCE(
- 16,
- "DeActivateDCINetworkInstance");
+ CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"),
+ ACTIVATE_NETWORK_INSTANCE(1, "ActivateNetworkInstance"),
+ CREATE_SERVICE_INSTANCE(2, "CreateServiceInstance"),
+ DELETE_SERVICE_INSTANCE(3, "DeleteServiceInstance"),
+ DELETE_NETWORK_INSTANCE(4, "DeleteNetworkInstance"),
+ CREATE_VNF_INSTANCE(5, "CreateVnfInstance"),
+ ACTIVATE_VNF_INSTANCE(6, "ActivateVnfInstance"),
+ DELETE_VNF_INSTANCE(7, "DeleteVnfInstance"),
+ CREATE_VF_MODULE_INSTANCE(8, "CreateVfModuleInstance"),
+ ACTIVATE_VF_MODULE_INSTANCE(9, "ActivateVfModuleInstance"),
+ DELETE_VF_MODULE_INSTANCE(10, "DeleteVfModuleInstance"),
+ CREATE_CONTRAIL_ROUTE_INSTANCE(11, "CreateContrailRouteInstance"),
+ DELETE_CONTRAIL_ROUTE_INSTANCE(12, "DeleteContrailRouteInstance"),
+ CREATE_SECURITY_ZONE_INSTANCE(13, "CreateSecurityZoneInstance"),
+ DELETE_SECURITY_ZONE_INSTANCE(14, "DeleteSecurityZoneInstance"),
+ ACTIVATE_DCI_NETWORK_INSTANCE(15, "ActivateDCINetworkInstance"),
+ DEACTIVATE_DCI_NETWORK_INSTANCE(16, "DeActivateDCINetworkInstance");
String name;
int value;
@@ -82,9 +74,16 @@ public abstract class AbstractBuilder<I, O> {
}
public enum SvcAction {
- RESERVE(0, "reserve"), ASSIGN(1, "assign"), ACTIVATE(2, "activate"), DELETE(3, "delete"), CHANGEASSIGN(4,
- "changeassign"), CHANGEDELETE(5, "changedelete"), ROLLBACK(6,
- "rollback"), DEACTIVATE(7, "deactivate"), UNASSIGN(8, "unassign"), CREATE(9, "create");
+ RESERVE(0, "reserve"),
+ ASSIGN(1, "assign"),
+ ACTIVATE(2, "activate"),
+ DELETE(3, "delete"),
+ CHANGEASSIGN(4, "changeassign"),
+ CHANGEDELETE(5, "changedelete"),
+ ROLLBACK(6, "rollback"),
+ DEACTIVATE(7, "deactivate"),
+ UNASSIGN(8, "unassign"),
+ CREATE(9, "create");
String name;
int value;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/resources/application.properties b/bpmn/so-bpmn-infrastructure-common/src/main/resources/application.properties
new file mode 100644
index 0000000000..87af45139c
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/resources/application.properties
@@ -0,0 +1,3 @@
+oof.default.endpoint=http://192.168.1.223:8443/oof/sotncalc
+third.sp.default.endpoint=http://192.168.1.223:8443/sp/resourcemgr/querytps
+inventory.oss.default.endpoint=http://192.168.1.199:8443/oss/inventory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy
index 8dde45be81..e547981b2d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy
@@ -27,6 +27,7 @@ import org.junit.Test
import org.mockito.MockitoAnnotations
import org.onap.so.bpmn.common.recipe.ResourceInput
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
+import org.onap.so.bpmn.core.json.JsonUtils
import static org.mockito.Mockito.*
/**
@@ -106,6 +107,46 @@ class CreateSDNCNetworkResourceTest extends GroovyTestCase {
return resourceInputObj
}
+ private ResourceInput getUpdateResInputObj(String modelName) {
+
+ String resourceInput = "{\n" +
+ "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n" +
+ "\t\"resourceInstanceDes\": null,\n" +
+ "\t\"globalSubscriberId\": \"sdwandemo\",\n" +
+ "\t\"serviceType\": \"CCVPN\",\n" +
+ "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n" +
+ "\t\"serviceModelInfo\": {\n" +
+ "\t\t\"modelName\": \"WanConnectionSvc03\",\n" +
+ "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n" +
+ "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n" +
+ "\t\t\"modelVersion\": \"1.0\",\n" +
+ "\t\t\"modelCustomizationUuid\": \"\",\n" +
+ "\t\t\"modelCustomizationName\": \"\",\n" +
+ "\t\t\"modelInstanceName\": \"\",\n" +
+ "\t\t\"modelType\": \"\"\n" +
+ "\t},\n" +
+ "\t\"resourceModelInfo\": {\n" +
+ "\t\t\"modelName\": \"" +
+ modelName +
+ "\",\n" +
+ "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n" +
+ "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n" +
+ "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n" +
+ "\t\t\"modelCustomizationName\": \"\",\n" +
+ "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" +
+ "\t\t\"modelType\": \"\"\n" +
+ "\t},\n" +
+ "\t\"resourceInstancenUuid\": null,\n" +
+ "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n" +
+ "\t\"operationType\": \"createInstance\",\n" +
+ "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n" +
+ "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n" +
+ "}"
+
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
+ return resourceInputObj
+ }
+
@Test
void testAfterCreateSDNCCall() {
init()
@@ -132,4 +173,30 @@ class CreateSDNCNetworkResourceTest extends GroovyTestCase {
def instanceId = response."response-data"."RequestData"."output"."network-response-information"."instance-id"
return instanceId
}
+
+ @Test
+ void testUpdateResourceInput() {
+ init()
+
+ def execution = getExecutionDelegate("OLT")
+ CreateSDNCNetworkResource createSDNCNetworkResource = new CreateSDNCNetworkResource()
+ def inputObject = createSDNCNetworkResource.updateResourceInput(execution)
+
+ println(inputObject.getResourceParameters())
+ assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.SVLAN")
+ assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.CVLAN")
+ assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.manufacturer")
+ assert JsonUtils.jsonElementExist(inputObject.getResourceParameters(), "requestInputs.ONTSN")
+ }
+
+ private ExecutionEntity getExecutionDelegate(String modelName) {
+ def input = getUpdateResInputObj(modelName)
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ when(mockExecution.getVariable(Prefix + "sdncCreateReturnCode")).thenReturn("200")
+ when(mockExecution.getVariable(Prefix + "SuccessIndicator")).thenReturn("false")
+ when(mockExecution.getVariable("isActivateRequired")).thenReturn("true")
+ when(mockExecution.getVariable("CRENWKI_createSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse)
+ when(mockExecution.getVariable(Prefix + "resourceInput")).thenReturn(input.toString())
+ return mockExecution
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
index c2af155d51..1ed3214214 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 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
@@ -36,7 +38,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
.antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService",
"/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify")
- .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()).and().httpBasic();
+ .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and().httpBasic();
}
@Override
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
index e755214362..bfaf9cfee0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
@@ -42,7 +42,7 @@ public class CancelDmaapSubscriptionTest {
.thenReturn(TEST_PNF_CORRELATION_ID);
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> {
- });
+ }, null);
// when
delegate.execute(delegateExecution);
// then
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index 19ba18f6de..2634f03d4b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -21,7 +21,9 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
+import java.util.HashMap;
import java.util.Objects;
+import java.util.Optional;
public class DmaapClientTestImpl implements DmaapClient {
@@ -29,7 +31,8 @@ public class DmaapClientTestImpl implements DmaapClient {
private Runnable informConsumer;
@Override
- public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
+ Optional<HashMap<String, String>> updateInfo) {
this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
index df060ed014..93a71b31ec 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
@@ -34,10 +34,12 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
+import org.onap.so.bpmn.common.recipe.ResourceInput;
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder;
public class InformDmaapClientTest {
@Before
- public void setUp() throws Exception {
+ public void setUp() {
informDmaapClient = new InformDmaapClient();
dmaapClientTest = new DmaapClientTestImpl();
informDmaapClient.setDmaapClient(dmaapClientTest);
@@ -53,7 +55,7 @@ public class InformDmaapClientTest {
private MessageCorrelationBuilder messageCorrelationBuilder;
@Test
- public void shouldSendListenerToDmaapClient() throws Exception {
+ public void shouldSendListenerToDmaapClient() {
// when
informDmaapClient.execute(delegateExecution);
// then
@@ -63,7 +65,7 @@ public class InformDmaapClientTest {
}
@Test
- public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() throws Exception {
+ public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() {
// when
informDmaapClient.execute(delegateExecution);
dmaapClientTest.getInformConsumer().run();
@@ -74,11 +76,41 @@ public class InformDmaapClientTest {
inOrder.verify(messageCorrelationBuilder).correlateWithResult();
}
+ private ResourceInput getUpdateResInputObj(String modelName) {
+
+ String resourceInput = "{\n" + "\t\"resourceInstanceName\": \"SotnFc-wan-connection_wanconnection-37\",\n"
+ + "\t\"resourceInstanceDes\": null,\n" + "\t\"globalSubscriberId\": \"sdwandemo\",\n"
+ + "\t\"serviceType\": \"CCVPN\",\n" + "\t\"operationId\": \"df3387b5-4fbf-41bd-82a0-13a955ac178a\",\n"
+ + "\t\"serviceModelInfo\": {\n" + "\t\t\"modelName\": \"WanConnectionSvc03\",\n"
+ + "\t\t\"modelUuid\": \"198b066c-0771-4157-9594-1824adfdda7e\",\n"
+ + "\t\t\"modelInvariantUuid\": \"43fb5165-7d03-4009-8951-a8f45d3f0148\",\n"
+ + "\t\t\"modelVersion\": \"1.0\",\n" + "\t\t\"modelCustomizationUuid\": \"\",\n"
+ + "\t\t\"modelCustomizationName\": \"\",\n" + "\t\t\"modelInstanceName\": \"\",\n"
+ + "\t\t\"modelType\": \"\"\n" + "\t},\n" + "\t\"resourceModelInfo\": {\n" + "\t\t\"modelName\": \""
+ + modelName + "\",\n" + "\t\t\"modelUuid\": \"6a0bf88b-343c-415b-88c1-6f73702452c4\",\n"
+ + "\t\t\"modelInvariantUuid\": \"50bc3415-2e01-4e50-a9e1-ec9584599bb3\",\n"
+ + "\t\t\"modelCustomizationUuid\": \"b205d620-84bd-4058-afa0-e3aeee8bb712\",\n"
+ + "\t\t\"modelCustomizationName\": \"\",\n"
+ + "\t\t\"modelInstanceName\": \"SotnFc-wan-connection 0\",\n" + "\t\t\"modelType\": \"\"\n" + "\t},\n"
+ + "\t\"resourceInstancenUuid\": null,\n"
+ + "\t\"resourceParameters\": \"{\\n\\\"locationConstraints\\\":[],\\n\\\"requestInputs\\\":{\\\"sotnfcspecwanconnection0_route-objective-function\\\":null,\\\"sotnfcspecwanconnection0_colorAware\\\":null,\\\"3rdctlspecwanconnection0_thirdPartyAdaptorRpc\\\":null,\\\"sotnfcspecwanconnection0_couplingFlag\\\":null,\\\"sotnfcspecwanconnection0_pbs\\\":null,\\\"3rdctlspecwanconnection0_thirdPartySdncId\\\":null,\\\"sotnfcspecwanconnection0_cbs\\\":null,\\\"3rdctlspecwanconnection0_thirdpartySdncName\\\":null,\\\"sotnfcspecwanconnection0_total-size\\\":null,\\\"3rdctlspecwanconnection0_templateFileName\\\":\\\"sotn_create_zte_template.json\\\",\\\"fcwanconnection0_type\\\":null,\\\"sotnfcspecwanconnection0_cir\\\":null,\\\"fcwanconnection0_uuid\\\":null,\\\"sotnfcspecwanconnection0_diversity-policy\\\":null,\\\"nf_naming\\\":true,\\\"multi_stage_design\\\":false,\\\"availability_zone_max_count\\\":1,\\\"3rdctlspecwanconnection0_restapiUrl\\\":\\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\\"max_instances\\\":null,\\\"sotnfcspecwanconnection0_reroute\\\":null,\\\"fcwanconnection0_name\\\":null,\\\"sotnfcspecwanconnection0_dualLink\\\":null,\\\"min_instances\\\":null,\\\"sotnfcspecwanconnection0_pir\\\":null,\\\"sotnfcspecwanconnection0_service-type\\\":null}\\n}\",\n"
+ + "\t\"operationType\": \"createInstance\",\n"
+ + "\t\"serviceInstanceId\": \"ffa07ae4-f820-45af-9439-1416b3bc1d39\",\n"
+ + "\t\"requestsInputs\": \"{\\r\\n\\t\\\"service\\\": {\\r\\n\\t\\t\\\"name\\\": \\\"wanconnection-37\\\",\\r\\n\\t\\t\\\"description\\\": \\\"deafe\\\",\\r\\n\\t\\t\\\"serviceInvariantUuid\\\": \\\"43fb5165-7d03-4009-8951-a8f45d3f0148\\\",\\r\\n\\t\\t\\\"serviceUuid\\\": \\\"198b066c-0771-4157-9594-1824adfdda7e\\\",\\r\\n\\t\\t\\\"globalSubscriberId\\\": \\\"sdwandemo\\\",\\r\\n\\t\\t\\\"serviceType\\\": \\\"CCVPN\\\",\\r\\n\\t\\t\\\"parameters\\\": {\\r\\n\\t\\t\\t\\\"resources\\\": [\\r\\n\\t\\t\\t],\\r\\n\\t\\t\\t\\\"requestInputs\\\": {\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sotnfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sotn_create_zte_template.json\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_restapiUrl\\\": \\\"http://10.80.80.21:8443/restconf/operations/ZTE-API-ConnectivityService:create-connectivity-service\\\",\\r\\n\\t\\t\\t\\t\\\"sdwanfcwanconnection0_3rdctlspecwanconnection0_templateFileName\\\": \\\"sdwan_create_zte_template.json\\\",\\\"ont_ont_manufacturer\\\":\\\"huawei\\\",\\\"ont_ont_serial_num\\\":\\\"123\\\"\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t}\\r\\n}\"\n"
+ + "}";
+
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class);
+ return resourceInputObj;
+ }
+
private DelegateExecution mockDelegateExecution() {
+ ResourceInput input = getUpdateResInputObj("OLT");
DelegateExecution delegateExecution = mock(DelegateExecution.class);
+
when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID)))
.thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
+ when(delegateExecution.getVariable("resourceInput")).thenReturn(input.toString());
ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
RuntimeService runtimeService = mock(RuntimeService.class);
@@ -86,6 +118,7 @@ public class InformDmaapClientTest {
messageCorrelationBuilder = mock(MessageCorrelationBuilder.class);
when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder);
when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder);
+
return delegateExecution;
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java
index 0b4050beec..6b310773b1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java
@@ -20,6 +20,7 @@
package org.onap.so.bpmn.infrastructure.workflow.service;
import static org.mockito.Mockito.doReturn;
+import org.apache.commons.lang.reflect.FieldUtils;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -109,7 +110,7 @@ public class ServicePluginFactoryTest {
@Test
public void doTPResourcesAllocation_Success() {
- doReturn(null).when(servicePluginFactory).getTPsfromAAI();
+ doReturn(null).when(servicePluginFactory).getTPsfromAAI("test");
String result = servicePluginFactory.doTPResourcesAllocation(null, uuiRequest);
Assert.assertNotEquals(result, uuiRequest);
}
@@ -154,4 +155,21 @@ public class ServicePluginFactoryTest {
String result = servicePluginFactory.doServiceHoming(null, invalidJsonWithOnlyNeededValues);
Assert.assertEquals(result, invalidJsonWithOnlyNeededValues);
}
+
+ @Test
+ public void verifyExternalConfigurationLoading() throws IllegalAccessException {
+
+ ServicePluginFactory servicePluginFactory = ServicePluginFactory.getInstance();
+
+ String oofDefaultEndpoint = (String) FieldUtils.readField(servicePluginFactory, "OOF_DEFAULT_ENDPOINT", true);
+ Assert.assertNotNull(oofDefaultEndpoint);
+
+ String thirdSpDefaultEndpoint =
+ (String) FieldUtils.readField(servicePluginFactory, "THIRD_SP_DEFAULT_ENDPOINT", true);
+ Assert.assertNotNull(thirdSpDefaultEndpoint);
+
+ String inventoryOssDefaultEndpoint =
+ (String) FieldUtils.readField(servicePluginFactory, "INVENTORY_OSS_DEFAULT_ENDPOINT", true);
+ Assert.assertNotNull(inventoryOssDefaultEndpoint);
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/CreateNetworkCollection.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/CreateNetworkCollection.json
index 7b369ab97e..ce0e5aa643 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/CreateNetworkCollection.json
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/CreateNetworkCollection.json
@@ -4,7 +4,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10"
},
"cloudConfiguration": {
@@ -34,7 +34,7 @@
{
"service": {
"modelInfo": {
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceParams": [],
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/ServiceMacroAssign.json
index 51caddd48a..b86a2a28f6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/ServiceMacroAssign.json
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/Macro/ServiceMacroAssign.json
@@ -4,7 +4,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10.0"
},
"owningEntity": {
@@ -31,7 +31,7 @@
"service": {
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceParams": [],
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn
index 8cde4f6c56..e5b361643f 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
<bpmn:process id="ActivateSDNCNetworkResource" name="ActivateSDNCNetworkResource" isExecutable="true">
<bpmn:startEvent id="createNS_StartEvent_activate" name="createNS_StartEvent">
<bpmn:outgoing>SequenceFlow_1c92ks3_activate</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:endEvent id="EndEvent_1x6k78c_activate" name="create SDNC call end">
- <bpmn:incoming>SequenceFlow_17md60u_activate</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0ow44q0_activate</bpmn:incoming>
</bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_activate" sourceRef="Task_023hred_activate" targetRef="ScriptTask_1g5zyi6_activate" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ow44q0_activate" sourceRef="Task_023hred_activate" targetRef="EndEvent_1x6k78c_activate" />
<bpmn:scriptTask id="Task_023hred_activate" name="post SDNC activate call">
<bpmn:incoming>SequenceFlow_1vnx1pp_activate</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ow44q0_activate</bpmn:outgoing>
@@ -54,14 +54,6 @@ dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1jr6zi0_activate" sourceRef="Task_0uwlr22_activate" targetRef="ServiceTask_1cm8iwr_activate" />
<bpmn:sequenceFlow id="SequenceFlow_1vnx1pp_activate" sourceRef="ServiceTask_1cm8iwr_activate" targetRef="Task_023hred_activate" />
- <bpmn:scriptTask id="ScriptTask_1g5zyi6_activate" name="Send Sync Ack Response" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_0ow44q0_activate</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_17md60u_activate</bpmn:outgoing>
- <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def csi = new ActivateSDNCNetworkResource()
-csi.sendSyncResponse(execution)</bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="SequenceFlow_17md60u_activate" sourceRef="ScriptTask_1g5zyi6_activate" targetRef="EndEvent_1x6k78c_activate" />
<bpmn:sequenceFlow id="SequenceFlow_1c92ks3_activate" sourceRef="createNS_StartEvent_activate" targetRef="Task_13sx2bp_activate" />
<bpmn:scriptTask id="ScriptTask_1gih50a_activate" name="Prepare SDNC Actiate request" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_18l3crb_activate</bpmn:incoming>
@@ -96,14 +88,14 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_activate">
- <dc:Bounds x="930" y="306" width="36" height="36" />
+ <dc:Bounds x="776" y="306" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="893" y="348" width="85" height="27" />
+ <dc:Bounds x="740" y="348" width="84" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0_activate">
<di:waypoint x="694" y="324" />
- <di:waypoint x="765" y="324" />
+ <di:waypoint x="776" y="324" />
<bpmndi:BPMNLabel>
<dc:Bounds x="780.5" y="314" width="90" height="12" />
</bpmndi:BPMNLabel>
@@ -141,16 +133,6 @@ dcsi.prepareSDNCRequest(execution)</bpmn:script>
<dc:Bounds x="641" y="314" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6_activate">
- <dc:Bounds x="765" y="284" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u_activate">
- <di:waypoint x="865" y="324" />
- <di:waypoint x="930" y="324" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="998" y="313" width="0" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1c92ks3_di" bpmnElement="SequenceFlow_1c92ks3_activate">
<di:waypoint x="-239" y="324" />
<di:waypoint x="-205" y="324" />
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn
index 0bdc6dc0bd..5a4b3ac348 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.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="2.0.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: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.16.2">
<bpmn:process id="CreateSDNCNetworkResource" name="CreateSDNCNetworkResource" isExecutable="true">
<bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent">
<bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
@@ -137,8 +137,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)</bpmn:script>
<camunda:in source="requestAction" target="requestAction" />
<camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" />
<camunda:in source="networkRequest" target="networkRequest" />
- <camunda:in source="networkInstanceId" target="networkInstanceId" />
- <camunda:in source="parentServiceInstanceId" target="parentServiceInstanceId" />
+ <camunda:in source="resourceInstanceId" target="resourceInstanceId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1dww8ye</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_05niqbf</bpmn:outgoing>
@@ -309,4 +308,4 @@ dcsi.afterCreateSDNCCall(execution)</bpmn:script>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn:definitions> \ No newline at end of file
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn
index cfcd259d7c..082860dd65 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.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="2.0.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: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="3.1.0">
<bpmn:process id="DeActivateSDNCNetworkResource" name="DeActivateSDNCNetworkResource" isExecutable="true">
<bpmn:startEvent id="deleteNetworkResource_StartEvent_deactivate" name="deleteNetworkResource_StartEvent">
<bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
@@ -14,9 +14,9 @@ def dcsi = new DeActivateSDNCNetworkResource()
dcsi.prepareSDNCRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:endEvent id="EndEvent_1x6k78c_deactivate" name="delete SDNC call end">
- <bpmn:incoming>SequenceFlow_15wux6a</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming>
</bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred_deactivate" targetRef="ScriptTask_1emjxm2_deactivate" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred_deactivate" targetRef="EndEvent_1x6k78c_deactivate" />
<bpmn:scriptTask id="Task_023hred_deactivate" name="post SDNC deactivate call">
<bpmn:incoming>SequenceFlow_13gl3wv</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing>
@@ -39,14 +39,6 @@ dcsi.preProcessRequest(execution)</bpmn:script>
def dcsi = new DeActivateSDNCNetworkResource()
dcsi.prepareUpdateAfterDeActivateSDNCResource(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:scriptTask id="ScriptTask_1emjxm2_deactivate" name="Send Sync Ack Response" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing>
- <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def csi = new DeActivateSDNCNetworkResource()
-csi.sendSyncResponse(execution)</bpmn:script>
- </bpmn:scriptTask>
- <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2_deactivate" targetRef="EndEvent_1x6k78c_deactivate" />
<bpmn:sequenceFlow id="SequenceFlow_1fjtgq7" sourceRef="PreprocessIncomingRequest_deactivate" targetRef="Task_0n0lj30_deactivate" />
<bpmn:callActivity id="Task_0n0lj30_deactivate" name="Call SDNC &#10; Adapter V1" calledElement="SDNCAdapterRestV1">
<bpmn:incoming>SequenceFlow_1fjtgq7</bpmn:incoming>
@@ -98,85 +90,75 @@ csi.sendSyncResponse(execution)</bpmn:script>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeActivateSDNCNetworkResource">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent_deactivate">
- <dc:Bounds x="-111" y="111" width="36" height="36" />
+ <dc:Bounds x="180" y="111" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-135" y="147" width="88" height="40" />
+ <dc:Bounds x="156" y="147" width="88" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
- <di:waypoint x="-75" y="129" />
- <di:waypoint x="5" y="129" />
+ <di:waypoint x="216" y="129" />
+ <di:waypoint x="296" y="129" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-87.5" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_deactivate">
- <dc:Bounds x="178" y="89" width="100" height="80" />
+ <dc:Bounds x="469" y="89" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_deactivate">
- <dc:Bounds x="964" y="327" width="36" height="36" />
+ <dc:Bounds x="1255" y="327" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="928" y="369" width="84" height="27" />
+ <dc:Bounds x="1219" y="369" width="84" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0">
- <di:waypoint x="735" y="345" />
- <di:waypoint x="795" y="345" />
+ <di:waypoint x="1026" y="345" />
+ <di:waypoint x="1255" y="345" />
<bpmndi:BPMNLabel>
<dc:Bounds x="719" y="314" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_deactivate">
- <dc:Bounds x="635" y="305" width="100" height="80" />
+ <dc:Bounds x="926" y="305" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb">
- <di:waypoint x="105" y="129" />
- <di:waypoint x="178" y="129" />
+ <di:waypoint x="396" y="129" />
+ <di:waypoint x="469" y="129" />
<bpmndi:BPMNLabel>
<dc:Bounds x="235.5" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_deactivate">
- <dc:Bounds x="5" y="89" width="100" height="80" />
+ <dc:Bounds x="296" y="89" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4_deactivate">
- <dc:Bounds x="333" y="305" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2_deactivate">
- <dc:Bounds x="795" y="305" width="100" height="80" />
+ <dc:Bounds x="624" y="305" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a">
- <di:waypoint x="895" y="345" />
- <di:waypoint x="964" y="345" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="930" y="313" width="0" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fjtgq7_di" bpmnElement="SequenceFlow_1fjtgq7">
<di:waypoint x="278" y="129" />
<di:waypoint x="333" y="129" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1pzm7qx_di" bpmnElement="SequenceFlow_1pzm7qx">
- <di:waypoint x="433" y="345" />
- <di:waypoint x="487" y="345" />
+ <di:waypoint x="724" y="345" />
+ <di:waypoint x="778" y="345" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0k4fp1d_di" bpmnElement="Task_1a6f0p9_deactivate">
- <dc:Bounds x="487" y="305" width="100" height="80" />
+ <dc:Bounds x="778" y="305" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_13gl3wv_di" bpmnElement="SequenceFlow_13gl3wv">
- <di:waypoint x="587" y="345" />
- <di:waypoint x="635" y="345" />
+ <di:waypoint x="878" y="345" />
+ <di:waypoint x="926" y="345" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_0a0txik_di" bpmnElement="CallActivity_0a0txik_DeActivate">
- <dc:Bounds x="333" y="89" width="100" height="80" />
+ <dc:Bounds x="624" y="89" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0rn8vky_di" bpmnElement="SequenceFlow_0rn8vky">
- <di:waypoint x="383" y="169" />
- <di:waypoint x="383" y="305" />
+ <di:waypoint x="674" y="169" />
+ <di:waypoint x="674" y="305" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0nmt8ph_di" bpmnElement="SequenceFlow_0nmt8ph">
- <di:waypoint x="278" y="129" />
- <di:waypoint x="333" y="129" />
+ <di:waypoint x="569" y="129" />
+ <di:waypoint x="624" y="129" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn
index c2d4de3973..4cd4ab527f 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.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="2.0.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: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="3.1.0">
<bpmn:process id="DeleteSDNCNetworkResource" name="DeleteSDNCNetworkResource" isExecutable="true">
<bpmn:startEvent id="deleteNetworkResource_StartEvent_delete" name="deleteNetworkResource_StartEvent">
<bpmn:outgoing>SequenceFlow_1qo2pln_delete</bpmn:outgoing>
@@ -123,6 +123,7 @@ csi.sendSyncResponse(execution)</bpmn:script>
<camunda:in source="recipeParamXsd" target="recipeParamXsd" />
<camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" />
<camunda:in source="resourceInput" target="resourceInput" />
+ <camunda:in source="allotedParentServiceInstanceId" target="allotedParentServiceInstanceId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0h3klf0_delete</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_00vqgvt_delete</bpmn:outgoing>
@@ -154,145 +155,145 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution)</bpmn:script>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSDNCNetworkResource">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent_delete">
- <dc:Bounds x="-111" y="111" width="36" height="36" />
+ <dc:Bounds x="180" y="244" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-135" y="147" width="88" height="40" />
+ <dc:Bounds x="156" y="280" width="88" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln_delete">
- <di:waypoint x="-75" y="129" />
- <di:waypoint x="-10" y="129" />
+ <di:waypoint x="216" y="262" />
+ <di:waypoint x="281" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-87.5" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova_delete">
- <di:waypoint x="593" y="129" />
- <di:waypoint x="684" y="129" />
+ <di:waypoint x="884" y="262" />
+ <di:waypoint x="975" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="391.5" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task_delete">
- <dc:Bounds x="493" y="89" width="100" height="80" />
+ <dc:Bounds x="784" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_delete">
- <dc:Bounds x="898" y="317" width="36" height="36" />
+ <dc:Bounds x="1189" y="450" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="862" y="359" width="84" height="27" />
+ <dc:Bounds x="1153" y="492" width="84" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0_delete">
- <di:waypoint x="624" y="335" />
- <di:waypoint x="709" y="335" />
+ <di:waypoint x="915" y="468" />
+ <di:waypoint x="1000" y="468" />
<bpmndi:BPMNLabel>
<dc:Bounds x="719" y="314" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_delete">
- <dc:Bounds x="524" y="295" width="100" height="80" />
+ <dc:Bounds x="815" y="428" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j_delete">
- <di:waypoint x="90" y="129" />
- <di:waypoint x="148" y="129" />
+ <di:waypoint x="381" y="262" />
+ <di:waypoint x="439" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="74" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb_delete">
- <di:waypoint x="248" y="129" />
- <di:waypoint x="325" y="129" />
+ <di:waypoint x="539" y="262" />
+ <di:waypoint x="616" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="235.5" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw_delete">
- <dc:Bounds x="-10" y="89" width="100" height="80" />
+ <dc:Bounds x="281" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_delete">
- <dc:Bounds x="148" y="89" width="100" height="80" />
+ <dc:Bounds x="439" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx_delete">
- <di:waypoint x="784" y="129" />
- <di:waypoint x="900" y="129" />
+ <di:waypoint x="1075" y="262" />
+ <di:waypoint x="1191" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="608" y="123" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq_delete">
- <di:waypoint x="950" y="169" />
- <di:waypoint x="950" y="246" />
- <di:waypoint x="-106" y="246" />
- <di:waypoint x="-106" y="335" />
- <di:waypoint x="9" y="335" />
+ <di:waypoint x="1241" y="302" />
+ <di:waypoint x="1241" y="379" />
+ <di:waypoint x="185" y="379" />
+ <di:waypoint x="185" y="468" />
+ <di:waypoint x="300" y="468" />
<bpmndi:BPMNLabel>
<dc:Bounds x="349" y="197" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tfzqd4_delete">
- <dc:Bounds x="684" y="89" width="100" height="80" />
+ <dc:Bounds x="975" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl_delete">
- <dc:Bounds x="900" y="89" width="100" height="80" />
+ <dc:Bounds x="1191" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr_delete">
- <dc:Bounds x="355" y="295" width="100" height="80" />
+ <dc:Bounds x="646" y="428" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2_delete">
- <dc:Bounds x="709" y="295" width="100" height="80" />
+ <dc:Bounds x="1000" y="428" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a_delete">
- <di:waypoint x="809" y="335" />
- <di:waypoint x="898" y="335" />
+ <di:waypoint x="1100" y="468" />
+ <di:waypoint x="1189" y="468" />
<bpmndi:BPMNLabel>
<dc:Bounds x="930" y="313" width="0" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ds04u5_di" bpmnElement="SequenceFlow_0ds04u5_delete">
- <di:waypoint x="455" y="335" />
- <di:waypoint x="524" y="335" />
+ <di:waypoint x="746" y="468" />
+ <di:waypoint x="815" y="468" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0xrgeq3_di" bpmnElement="ExclusiveGateway_0xrgeq3_delete" isMarkerVisible="true">
- <dc:Bounds x="325" y="104" width="50" height="50" />
+ <dc:Bounds x="616" y="237" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="320" y="161" width="63" height="27" />
+ <dc:Bounds x="611" y="294" width="63" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0jh88qw_di" bpmnElement="SequenceFlow_0jh88qw_delete">
- <di:waypoint x="375" y="129" />
- <di:waypoint x="493" y="129" />
+ <di:waypoint x="666" y="262" />
+ <di:waypoint x="784" y="262" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="427" y="111" width="14" height="14" />
+ <dc:Bounds x="718" y="244" width="14" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0h3klf0_di" bpmnElement="SequenceFlow_0h3klf0_delete">
- <di:waypoint x="350" y="104" />
- <di:waypoint x="350" y="-12" />
- <di:waypoint x="493" y="-12" />
+ <di:waypoint x="641" y="237" />
+ <di:waypoint x="641" y="121" />
+ <di:waypoint x="784" y="121" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="356" y="43" width="19" height="14" />
+ <dc:Bounds x="647" y="176" width="19" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_00vqgvt_di" bpmnElement="SequenceFlow_00vqgvt_delete">
- <di:waypoint x="543" y="28" />
- <di:waypoint x="543" y="89" />
+ <di:waypoint x="834" y="161" />
+ <di:waypoint x="834" y="222" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_1lddjec_di" bpmnElement="Task_1xychp0_delete">
- <dc:Bounds x="493" y="-52" width="100" height="80" />
+ <dc:Bounds x="784" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1wj862v_di" bpmnElement="Task_1ikbt2h_delete">
- <dc:Bounds x="205" y="295" width="100" height="80" />
+ <dc:Bounds x="496" y="428" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0yooswe_di" bpmnElement="SequenceFlow_0yooswe_delete">
- <di:waypoint x="305" y="335" />
- <di:waypoint x="355" y="335" />
+ <di:waypoint x="596" y="468" />
+ <di:waypoint x="646" y="468" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_0bj0odq_di" bpmnElement="CallActivity_0bj0odq">
- <dc:Bounds x="9" y="295" width="100" height="80" />
+ <dc:Bounds x="300" y="428" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0lplazm_di" bpmnElement="SequenceFlow_0lplazm">
- <di:waypoint x="109" y="335" />
- <di:waypoint x="205" y="335" />
+ <di:waypoint x="400" y="468" />
+ <di:waypoint x="496" y="468" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
index 76dd6facd6..125f08c49e 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoCreateE2EServiceInstanceV3" name="DoCreateE2EServiceInstanceV3" isExecutable="true">
<bpmn2:startEvent id="createSI_startEvent" name="Start Flow">
<bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing>
@@ -9,8 +9,7 @@
<bpmn2:outgoing>SequenceFlow_0w9t6tc</bpmn2:outgoing>
<bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateE2EServiceInstance()
-dcsi.preProcessRequest(execution)
-</bpmn2:script>
+dcsi.preProcessRequest(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:subProcess id="SubProcess_06d8lk8" name="Sub-process for Application Errors" triggeredByEvent="true">
<bpmn2:startEvent id="StartEvent_0yljq9y">
@@ -38,8 +37,7 @@ dcsi.preProcessRequest(execution)
<bpmn2:outgoing>SequenceFlow_1lqktwf</bpmn2:outgoing>
<bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateE2EServiceInstance()
-dcsi.preProcessRollback(execution)
-</bpmn2:script>
+dcsi.preProcessRollback(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_1lqktwf" sourceRef="ScriptTask_0ocetux" targetRef="CallActivity_1srx6p6" />
<bpmn2:scriptTask id="ScriptTask_1p0vyip" name="Post Process Rollback" scriptFormat="groovy">
@@ -47,8 +45,7 @@ dcsi.preProcessRollback(execution)
<bpmn2:outgoing>SequenceFlow_1xzgv5k</bpmn2:outgoing>
<bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateE2EServiceInstance()
-dcsi.postProcessRollback(execution)
-</bpmn2:script>
+dcsi.postProcessRollback(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_1xzgv5k" sourceRef="ScriptTask_1p0vyip" targetRef="EndEvent_117lkk3" />
</bpmn2:subProcess>
@@ -98,10 +95,10 @@ dcsi.prepareDecomposeService(execution)</bpmn2:script>
<bpmn2:sequenceFlow id="SequenceFlow_1qiiycn" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" />
<bpmn2:sequenceFlow id="SequenceFlow_166w91p" sourceRef="IntermediateCatchEvent_0tv85pg" targetRef="ScriptTask_1cllqk3" />
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_16okck2" name="GoTo StartPrepareResource">
- <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_19zefa9</bpmn2:incoming>
<bpmn2:linkEventDefinition name="StartPrepareResource" />
</bpmn2:intermediateThrowEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="IntermediateThrowEvent_16okck2" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="Task_0osptcq" />
<bpmn2:sequenceFlow id="SequenceFlow_0w9t6tc" sourceRef="preProcessRequest_ScriptTask" targetRef="IntermediateThrowEvent_0bq4fxs" />
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource">
<bpmn2:outgoing>SequenceFlow_0yuzaen</bpmn2:outgoing>
@@ -156,7 +153,7 @@ ddsi.preInitResourcesOperStatus(execution)</bpmn2:script>
<camunda:in source="msoRequestId" target="msoRequestId" />
<camunda:out source="serviceDecomposition" target="serviceDecomposition" />
</bpmn2:extensionElements>
- <bpmn2:incoming>SequenceFlow_0b1dsaj</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_11zobkq</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0sphcy5</bpmn2:outgoing>
</bpmn2:callActivity>
<bpmn2:scriptTask id="ScriptTask_0ns08tn" name="PreProcess for Add Resources" scriptFormat="groovy">
@@ -168,6 +165,7 @@ csi.preProcessForAddResource(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_19t13rd" name="PostProcess for Add Resource" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0sphcy5</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1mvvc6c</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_18gnns6</bpmn2:outgoing>
<bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def csi = new DoCreateE2EServiceInstance()
@@ -193,253 +191,289 @@ dcsi.doTPResourcesAllocation(execution)</bpmn2:script>
<bpmn2:sequenceFlow id="SequenceFlow_1y9rkfr" sourceRef="ScriptTask_0jxdler" targetRef="ScriptTask_1rzf8a1" />
<bpmn2:sequenceFlow id="SequenceFlow_0n7nbx3" sourceRef="ScriptTask_1rzf8a1" targetRef="ServiceTask_1asgesv" />
<bpmn2:sequenceFlow id="SequenceFlow_0ckto7v" sourceRef="ServiceTask_1asgesv" targetRef="ScriptTask_0ts3c3b" />
- <bpmn2:sequenceFlow id="SequenceFlow_0b1dsaj" sourceRef="ScriptTask_0ns08tn" targetRef="CallActivity_1gae03e" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0b1dsaj" sourceRef="ScriptTask_0ns08tn" targetRef="ExclusiveGateway_1hmlw0b" />
<bpmn2:sequenceFlow id="SequenceFlow_0sphcy5" sourceRef="CallActivity_1gae03e" targetRef="ScriptTask_19t13rd" />
<bpmn2:sequenceFlow id="SequenceFlow_022onug" sourceRef="ScriptTask_0ts3c3b" targetRef="ScriptTask_0ns08tn" />
<bpmn2:sequenceFlow id="SequenceFlow_18gnns6" sourceRef="ScriptTask_19t13rd" targetRef="EndEvent_1x4kvfh" />
<bpmn2:sequenceFlow id="SequenceFlow_0yuzaen" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="ScriptTask_0jxdler" />
+ <bpmn2:sequenceFlow id="SequenceFlow_19zefa9" sourceRef="Task_0osptcq" targetRef="IntermediateThrowEvent_16okck2" />
+ <bpmn2:scriptTask id="Task_0osptcq" name="AAI&#10;Create Custom &#10;Relationship&#10;" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_19zefa9</bpmn2:outgoing>
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def ddsi = new DoCreateE2EServiceInstance()
+ddsi.createCustomRelationship(execution)</bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1hmlw0b" default="SequenceFlow_1mvvc6c">
+ <bpmn2:incoming>SequenceFlow_0b1dsaj</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_11zobkq</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1mvvc6c</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_11zobkq" name="yes" sourceRef="ExclusiveGateway_1hmlw0b" targetRef="CallActivity_1gae03e">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{(execution.getVariable("isCreateResourceListValid" ) == true)}</bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_1mvvc6c" sourceRef="ExclusiveGateway_1hmlw0b" targetRef="ScriptTask_19t13rd" />
</bpmn2:process>
<bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateE2EServiceInstanceV3">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSI_startEvent">
- <dc:Bounds x="9" y="-22" width="36" height="36" />
+ <dc:Bounds x="172" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="3" y="19" width="50" height="12" />
+ <dc:Bounds x="166" y="144" width="50" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask">
- <dc:Bounds x="117" y="-44" width="100" height="80" />
+ <dc:Bounds x="280" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true">
- <dc:Bounds x="15" y="865" width="783" height="195" />
+ <dc:Bounds x="178" y="990" width="783" height="195" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0yljq9y_di" bpmnElement="StartEvent_0yljq9y">
- <dc:Bounds x="111" y="942" width="36" height="36" />
+ <dc:Bounds x="274" y="1067" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="84" y="983" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_117lkk3_di" bpmnElement="EndEvent_117lkk3">
- <dc:Bounds x="744" y="942" width="36" height="36" />
+ <dc:Bounds x="907" y="1067" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="717" y="983" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_1srx6p6_di" bpmnElement="CallActivity_1srx6p6">
- <dc:Bounds x="409" y="920" width="100" height="80" />
+ <dc:Bounds x="572" y="1045" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0eumzpf_di" bpmnElement="SequenceFlow_0eumzpf">
- <di:waypoint x="509" y="960" />
- <di:waypoint x="577" y="960" />
+ <di:waypoint x="672" y="1085" />
+ <di:waypoint x="740" y="1085" />
<bpmndi:BPMNLabel>
<dc:Bounds x="498" y="945" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0tgrn11_di" bpmnElement="SequenceFlow_0tgrn11">
- <di:waypoint x="147" y="960" />
- <di:waypoint x="246" y="960" />
+ <di:waypoint x="310" y="1085" />
+ <di:waypoint x="409" y="1085" />
<bpmndi:BPMNLabel>
<dc:Bounds x="152" y="945" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9">
- <dc:Bounds x="1012" y="106" width="100" height="80" />
+ <dc:Bounds x="1103" y="231" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0ocetux_di" bpmnElement="ScriptTask_0ocetux">
- <dc:Bounds x="246" y="920" width="100" height="80" />
+ <dc:Bounds x="409" y="1045" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1lqktwf_di" bpmnElement="SequenceFlow_1lqktwf">
- <di:waypoint x="346" y="960" />
- <di:waypoint x="409" y="960" />
+ <di:waypoint x="509" y="1085" />
+ <di:waypoint x="572" y="1085" />
<bpmndi:BPMNLabel>
<dc:Bounds x="333" y="945" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1p0vyip_di" bpmnElement="ScriptTask_1p0vyip">
- <dc:Bounds x="577" y="920" width="100" height="80" />
+ <dc:Bounds x="740" y="1045" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1xzgv5k_di" bpmnElement="SequenceFlow_1xzgv5k">
- <di:waypoint x="677" y="960" />
- <di:waypoint x="709" y="960" />
- <di:waypoint x="709" y="960" />
- <di:waypoint x="744" y="960" />
+ <di:waypoint x="840" y="1085" />
+ <di:waypoint x="872" y="1085" />
+ <di:waypoint x="872" y="1085" />
+ <di:waypoint x="907" y="1085" />
<bpmndi:BPMNLabel>
<dc:Bounds x="679" y="960" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs">
- <dc:Bounds x="1306" y="-22" width="36" height="36" />
+ <dc:Bounds x="1469" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1281" y="18" width="88" height="36" />
+ <dc:Bounds x="1444" y="143" width="88" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1o01d7d_di" bpmnElement="ScriptTask_1o01d7d">
- <dc:Bounds x="704" y="106" width="100" height="80" />
+ <dc:Bounds x="867" y="231" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0biblpc_di" bpmnElement="CallActivity_0biblpc">
- <dc:Bounds x="469" y="106" width="100" height="80" />
+ <dc:Bounds x="632" y="231" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1cllqk3_di" bpmnElement="ScriptTask_1cllqk3">
- <dc:Bounds x="187" y="106" width="100" height="80" />
+ <dc:Bounds x="350" y="231" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_0tv85pg_di" bpmnElement="IntermediateCatchEvent_0tv85pg">
- <dc:Bounds x="17" y="128" width="36" height="36" />
+ <dc:Bounds x="180" y="253" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-7" y="164" width="88" height="24" />
+ <dc:Bounds x="156" y="289" width="88" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0xjwb45_di" bpmnElement="SequenceFlow_0xjwb45">
- <di:waypoint x="569" y="146" />
- <di:waypoint x="704" y="146" />
+ <di:waypoint x="732" y="271" />
+ <di:waypoint x="867" y="271" />
<bpmndi:BPMNLabel>
<dc:Bounds x="592" y="125" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0qxzgvq_di" bpmnElement="SequenceFlow_0qxzgvq">
- <di:waypoint x="287" y="146" />
- <di:waypoint x="469" y="146" />
+ <di:waypoint x="450" y="271" />
+ <di:waypoint x="632" y="271" />
<bpmndi:BPMNLabel>
<dc:Bounds x="333" y="125" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qiiycn_di" bpmnElement="SequenceFlow_1qiiycn">
- <di:waypoint x="45" y="-4" />
- <di:waypoint x="117" y="-4" />
+ <di:waypoint x="208" y="121" />
+ <di:waypoint x="280" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="36" y="-25" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_166w91p_di" bpmnElement="SequenceFlow_166w91p">
- <di:waypoint x="53" y="146" />
- <di:waypoint x="187" y="146" />
+ <di:waypoint x="216" y="271" />
+ <di:waypoint x="350" y="271" />
<bpmndi:BPMNLabel>
<dc:Bounds x="75" y="125" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_16okck2_di" bpmnElement="IntermediateThrowEvent_16okck2">
- <dc:Bounds x="1306" y="128" width="36" height="36" />
+ <dc:Bounds x="1469" y="253" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1285" y="169" width="82" height="36" />
+ <dc:Bounds x="1448" y="294" width="83" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1tkgqu3_di" bpmnElement="SequenceFlow_1tkgqu3">
- <di:waypoint x="1112" y="146" />
- <di:waypoint x="1222" y="146" />
- <di:waypoint x="1222" y="146" />
- <di:waypoint x="1306" y="146" />
+ <di:waypoint x="1203" y="271" />
+ <di:waypoint x="1286" y="271" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1192" y="140" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc">
- <di:waypoint x="217" y="-4" />
- <di:waypoint x="762" y="-4" />
- <di:waypoint x="762" y="-4" />
- <di:waypoint x="1306" y="-4" />
+ <di:waypoint x="380" y="121" />
+ <di:waypoint x="925" y="121" />
+ <di:waypoint x="925" y="121" />
+ <di:waypoint x="1469" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="732" y="-10" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b">
- <dc:Bounds x="18" y="282" width="36" height="36" />
+ <dc:Bounds x="181" y="407" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-3" y="318" width="82" height="24" />
+ <dc:Bounds x="160" y="443" width="83" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_012h7yx_di" bpmnElement="SequenceFlow_012h7yx">
- <di:waypoint x="804" y="146" />
- <di:waypoint x="917" y="146" />
- <di:waypoint x="917" y="146" />
- <di:waypoint x="1012" y="146" />
+ <di:waypoint x="967" y="271" />
+ <di:waypoint x="1103" y="271" />
<bpmndi:BPMNLabel>
<dc:Bounds x="887" y="139" width="90" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1rzf8a1_di" bpmnElement="ScriptTask_1rzf8a1">
- <dc:Bounds x="262" y="260" width="100" height="80" />
+ <dc:Bounds x="425" y="385" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1asgesv_di" bpmnElement="ServiceTask_1asgesv">
- <dc:Bounds x="433" y="260" width="100" height="80" />
+ <dc:Bounds x="576" y="385" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_1gae03e_di" bpmnElement="CallActivity_1gae03e">
- <dc:Bounds x="957" y="260" width="100" height="80" />
+ <dc:Bounds x="1146" y="385" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0ns08tn_di" bpmnElement="ScriptTask_0ns08tn">
- <dc:Bounds x="785" y="260" width="100" height="80" />
+ <dc:Bounds x="894" y="385" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_19t13rd_di" bpmnElement="ScriptTask_19t13rd">
- <dc:Bounds x="1131" y="260" width="100" height="80" />
+ <dc:Bounds x="1294" y="385" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1x4kvfh_di" bpmnElement="EndEvent_1x4kvfh">
- <dc:Bounds x="1301" y="282" width="36" height="36" />
+ <dc:Bounds x="1464" y="407" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1274" y="322" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0jxdler_di" bpmnElement="ScriptTask_0jxdler">
- <dc:Bounds x="88" y="260" width="100" height="80" />
+ <dc:Bounds x="251" y="385" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0ts3c3b_di" bpmnElement="ScriptTask_0ts3c3b">
- <dc:Bounds x="599" y="260" width="100" height="80" />
+ <dc:Bounds x="733" y="385" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1y9rkfr_di" bpmnElement="SequenceFlow_1y9rkfr">
- <di:waypoint x="188" y="300" />
- <di:waypoint x="262" y="300" />
+ <di:waypoint x="351" y="425" />
+ <di:waypoint x="425" y="425" />
<bpmndi:BPMNLabel>
<dc:Bounds x="180" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0n7nbx3_di" bpmnElement="SequenceFlow_0n7nbx3">
- <di:waypoint x="362" y="300" />
- <di:waypoint x="433" y="300" />
+ <di:waypoint x="525" y="425" />
+ <di:waypoint x="576" y="425" />
<bpmndi:BPMNLabel>
<dc:Bounds x="353.5" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ckto7v_di" bpmnElement="SequenceFlow_0ckto7v">
- <di:waypoint x="533" y="300" />
- <di:waypoint x="599" y="300" />
+ <di:waypoint x="676" y="425" />
+ <di:waypoint x="733" y="425" />
<bpmndi:BPMNLabel>
<dc:Bounds x="521" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0b1dsaj_di" bpmnElement="SequenceFlow_0b1dsaj">
- <di:waypoint x="885" y="300" />
- <di:waypoint x="957" y="300" />
+ <di:waypoint x="994" y="425" />
+ <di:waypoint x="1044" y="425" />
<bpmndi:BPMNLabel>
<dc:Bounds x="876" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0sphcy5_di" bpmnElement="SequenceFlow_0sphcy5">
- <di:waypoint x="1057" y="300" />
- <di:waypoint x="1131" y="300" />
+ <di:waypoint x="1246" y="425" />
+ <di:waypoint x="1294" y="425" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1049" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_022onug_di" bpmnElement="SequenceFlow_022onug">
- <di:waypoint x="699" y="300" />
- <di:waypoint x="785" y="300" />
+ <di:waypoint x="833" y="425" />
+ <di:waypoint x="894" y="425" />
<bpmndi:BPMNLabel>
<dc:Bounds x="697" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_18gnns6_di" bpmnElement="SequenceFlow_18gnns6">
- <di:waypoint x="1231" y="300" />
- <di:waypoint x="1301" y="300" />
+ <di:waypoint x="1394" y="425" />
+ <di:waypoint x="1464" y="425" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1221" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0yuzaen_di" bpmnElement="SequenceFlow_0yuzaen">
- <di:waypoint x="54" y="300" />
- <di:waypoint x="88" y="300" />
+ <di:waypoint x="217" y="425" />
+ <di:waypoint x="251" y="425" />
<bpmndi:BPMNLabel>
<dc:Bounds x="71" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_19zefa9_di" bpmnElement="SequenceFlow_19zefa9">
+ <di:waypoint x="1386" y="271" />
+ <di:waypoint x="1469" y="271" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1495sm9_di" bpmnElement="Task_0osptcq">
+ <dc:Bounds x="1286" y="231" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1hmlw0b_di" bpmnElement="ExclusiveGateway_1hmlw0b" isMarkerVisible="true">
+ <dc:Bounds x="1044" y="400" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_11zobkq_di" bpmnElement="SequenceFlow_11zobkq">
+ <di:waypoint x="1094" y="425" />
+ <di:waypoint x="1146" y="425" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1112" y="407" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1mvvc6c_di" bpmnElement="SequenceFlow_1mvvc6c">
+ <di:waypoint x="1069" y="450" />
+ <di:waypoint x="1069" y="607" />
+ <di:waypoint x="1344" y="607" />
+ <di:waypoint x="1344" y="465" />
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn
index dc2cf9b676..2a2093522f 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateResources.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoCreateResourcesV3" name="DoCreateResourcesV3" isExecutable="true">
<bpmn2:startEvent id="createSI_startEvent" name="Start Flow">
<bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing>
@@ -7,17 +7,16 @@
<bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1qiiycn</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0w9t6tc</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateResources()
-dcsi.preProcessRequest(execution)
-]]></bpmn2:script>
+dcsi.preProcessRequest(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_1xdjlzm" name="Post Config Service Instance Creation" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_16nxl6h</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0epxs3b</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def csi = new DoCreateResources()
-csi.postConfigRequest(execution)]]></bpmn2:script>
+csi.postConfigRequest(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:serviceTask id="Task_0io5qby" name="Call Sync SDNC service Create " camunda:class="org.onap.so.bpmn.infrastructure.workflow.serviceTask.SdncServiceTopologyOperationTask">
<bpmn2:incoming>SequenceFlow_0k0f7lm</bpmn2:incoming>
@@ -27,9 +26,9 @@ csi.postConfigRequest(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="ScriptTask_1y0los4" name="Sequence Resource" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_13d9g1n</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCreateResources()
-ddsi.sequenceResoure(execution)]]></bpmn2:script>
+ddsi.sequenceResoure(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_13d9g1n" sourceRef="ScriptTask_1y0los4" targetRef="ExclusiveGateway_07rr3wp" />
<bpmn2:exclusiveGateway id="ExclusiveGateway_0n9y4du" name="All ResourceFinished?" default="SequenceFlow_0q6uy30">
@@ -41,18 +40,18 @@ ddsi.sequenceResoure(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="ScriptTask_0y4u2ty" name="Parse Next Resource" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_13c7bhn</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1jenxlp</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCreateResources()
-ddsi.parseNextResource(execution)]]></bpmn2:script>
+ddsi.parseNextResource(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_1jenxlp" sourceRef="ScriptTask_0y4u2ty" targetRef="ExclusiveGateway_0n9y4du" />
<bpmn2:scriptTask id="ScriptTask_0l4nkqr" name="Get Current Resource" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0q6uy30</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_1qozd66</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0uiygod</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCreateResources()
-ddsi.getCurrentResoure(execution)]]></bpmn2:script>
+ddsi.getCurrentResoure(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:exclusiveGateway id="ExclusiveGateway_07rr3wp" name="Is SDN-C Service Needed" default="SequenceFlow_18wj44x">
<bpmn2:incoming>SequenceFlow_13d9g1n</bpmn2:incoming>
@@ -63,16 +62,16 @@ ddsi.getCurrentResoure(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="Task_0qlkmvt" name="Prepare resource recipe Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0uiygod</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1u9k0dm</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCreateResources()
-ddsi.prepareResourceRecipeRequest(execution)]]></bpmn2:script>
+ddsi.prepareResourceRecipeRequest(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="Task_12ghoph" name="Execute Resource Recipe" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1u9k0dm</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_13c7bhn</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCreateResources()
-ddsi.executeResourceRecipe(execution)]]></bpmn2:script>
+ddsi.executeResourceRecipe(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to StratPrepareService">
<bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming>
@@ -86,7 +85,7 @@ ddsi.executeResourceRecipe(execution)]]></bpmn2:script>
<bpmn2:linkEventDefinition name="ResourceLoop" />
</bpmn2:intermediateThrowEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1vprtt9" name="yes" sourceRef="ExclusiveGateway_07rr3wp" targetRef="Task_1blaq0f">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "true" )}]]></bpmn2:conditionExpression>
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{(execution.getVariable("isContainsWanResource" ) == "true" )}</bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource">
<bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing>
@@ -98,7 +97,7 @@ ddsi.executeResourceRecipe(execution)]]></bpmn2:script>
<bpmn2:linkEventDefinition name="ResourceLoop" />
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_16nxl6h" name="yes" sourceRef="ExclusiveGateway_0n9y4du" targetRef="ScriptTask_1xdjlzm">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("allResourceFinished" ) == "true" )}]]></bpmn2:conditionExpression>
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{(execution.getVariable("allResourceFinished" ) == "true" )}</bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="SequenceFlow_0uiygod" sourceRef="ScriptTask_0l4nkqr" targetRef="Task_0qlkmvt" />
<bpmn2:sequenceFlow id="SequenceFlow_1u9k0dm" sourceRef="Task_0qlkmvt" targetRef="Task_12ghoph" />
@@ -119,9 +118,9 @@ ddsi.executeResourceRecipe(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="ScriptTask_1648adp" name="Log / Print Unexpected Error" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0gr9xqj</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0a6l29p</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.common.scripts.*
ExceptionUtil ex = new ExceptionUtil()
-ex.processJavaException(execution)]]></bpmn2:script>
+ex.processJavaException(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_0gr9xqj" name="" sourceRef="StartEvent_0x7o2ug" targetRef="ScriptTask_1648adp" />
<bpmn2:sequenceFlow id="SequenceFlow_0a6l29p" name="" sourceRef="ScriptTask_1648adp" targetRef="EndEvent_0lgdyyb" />
@@ -129,9 +128,9 @@ ex.processJavaException(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="Task_1blaq0f" name="Prepare SDNC service Create" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1vprtt9</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0k0f7lm</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCreateResources()
-ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script>
+ddsi.prepareServiceTopologyRequest(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_0k0f7lm" sourceRef="Task_1blaq0f" targetRef="Task_0io5qby" />
</bpmn2:process>
@@ -140,227 +139,227 @@ ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateResourcesV3">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSI_startEvent">
- <dc:Bounds x="18" y="-207" width="36" height="36" />
+ <dc:Bounds x="215" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="12" y="-166" width="50" height="12" />
+ <dc:Bounds x="209" y="144" width="50" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask">
- <dc:Bounds x="126" y="-229" width="100" height="80" />
+ <dc:Bounds x="323" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1xdjlzm_di" bpmnElement="ScriptTask_1xdjlzm">
- <dc:Bounds x="1119" y="485" width="100" height="80" />
+ <dc:Bounds x="1316" y="795" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0qi8cgg_di" bpmnElement="Task_0io5qby">
- <dc:Bounds x="1047" y="353" width="100" height="80" />
+ <dc:Bounds x="1244" y="663" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11f2zuu_di" bpmnElement="SequenceFlow_11f2zuu">
- <di:waypoint xsi:type="dc:Point" x="1147" y="393" />
- <di:waypoint xsi:type="dc:Point" x="1219" y="393" />
- <di:waypoint xsi:type="dc:Point" x="1219" y="300" />
- <di:waypoint xsi:type="dc:Point" x="1315" y="300" />
+ <di:waypoint x="1344" y="703" />
+ <di:waypoint x="1416" y="703" />
+ <di:waypoint x="1416" y="610" />
+ <di:waypoint x="1512" y="610" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1189" y="340.5" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1y0los4_di" bpmnElement="ScriptTask_1y0los4">
- <dc:Bounds x="444" y="260" width="100" height="80" />
+ <dc:Bounds x="641" y="570" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_13d9g1n_di" bpmnElement="SequenceFlow_13d9g1n">
- <di:waypoint xsi:type="dc:Point" x="544" y="300" />
- <di:waypoint xsi:type="dc:Point" x="753" y="300" />
+ <di:waypoint x="741" y="610" />
+ <di:waypoint x="950" y="610" />
<bpmndi:BPMNLabel>
<dc:Bounds x="603.5" y="279" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0n9y4du_di" bpmnElement="ExclusiveGateway_0n9y4du" isMarkerVisible="true">
- <dc:Bounds x="929" y="500" width="50" height="50" />
+ <dc:Bounds x="1126" y="810" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="911" y="454" width="85" height="36" />
+ <dc:Bounds x="1109" y="764" width="83" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0q6uy30_di" bpmnElement="SequenceFlow_0q6uy30">
- <di:waypoint xsi:type="dc:Point" x="954" y="550" />
- <di:waypoint xsi:type="dc:Point" x="954" y="691" />
- <di:waypoint xsi:type="dc:Point" x="246" y="691" />
- <di:waypoint xsi:type="dc:Point" x="246" y="565" />
+ <di:waypoint x="1151" y="860" />
+ <di:waypoint x="1151" y="1001" />
+ <di:waypoint x="443" y="1001" />
+ <di:waypoint x="443" y="875" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="593" y="670" width="15" height="12" />
+ <dc:Bounds x="791" y="980" width="13" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0y4u2ty_di" bpmnElement="ScriptTask_0y4u2ty">
- <dc:Bounds x="728" y="485" width="100" height="80" />
+ <dc:Bounds x="925" y="795" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1jenxlp_di" bpmnElement="SequenceFlow_1jenxlp">
- <di:waypoint xsi:type="dc:Point" x="828" y="525" />
- <di:waypoint xsi:type="dc:Point" x="929" y="525" />
+ <di:waypoint x="1025" y="835" />
+ <di:waypoint x="1126" y="835" />
<bpmndi:BPMNLabel>
<dc:Bounds x="833.5" y="504" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0l4nkqr_di" bpmnElement="ScriptTask_0l4nkqr">
- <dc:Bounds x="196" y="485" width="100" height="80" />
+ <dc:Bounds x="393" y="795" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_07rr3wp_di" bpmnElement="ExclusiveGateway_07rr3wp" isMarkerVisible="true">
- <dc:Bounds x="753" y="275" width="50" height="50" />
+ <dc:Bounds x="950" y="585" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="734" y="243" width="88" height="24" />
+ <dc:Bounds x="931" y="553" width="88" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_18wj44x_di" bpmnElement="SequenceFlow_18wj44x">
- <di:waypoint xsi:type="dc:Point" x="803" y="300" />
- <di:waypoint xsi:type="dc:Point" x="1315" y="300" />
+ <di:waypoint x="1000" y="610" />
+ <di:waypoint x="1512" y="610" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="831" y="294" width="15" height="12" />
+ <dc:Bounds x="1029" y="604" width="13" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0u88n0f_di" bpmnElement="Task_0qlkmvt">
- <dc:Bounds x="357" y="485" width="100" height="80" />
+ <dc:Bounds x="554" y="795" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1y17r20_di" bpmnElement="Task_12ghoph">
- <dc:Bounds x="551" y="485" width="100" height="80" />
+ <dc:Bounds x="748" y="795" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs">
- <dc:Bounds x="1315" y="-207" width="36" height="36" />
+ <dc:Bounds x="1512" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1292" y="-167" width="88" height="36" />
+ <dc:Bounds x="1490" y="143" width="86" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1qiiycn_di" bpmnElement="SequenceFlow_1qiiycn">
- <di:waypoint xsi:type="dc:Point" x="54" y="-189" />
- <di:waypoint xsi:type="dc:Point" x="126" y="-189" />
+ <di:waypoint x="251" y="121" />
+ <di:waypoint x="323" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="90" y="-210" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc">
- <di:waypoint xsi:type="dc:Point" x="226" y="-189" />
- <di:waypoint xsi:type="dc:Point" x="771" y="-189" />
- <di:waypoint xsi:type="dc:Point" x="771" y="-189" />
- <di:waypoint xsi:type="dc:Point" x="1315" y="-189" />
+ <di:waypoint x="423" y="121" />
+ <di:waypoint x="968" y="121" />
+ <di:waypoint x="968" y="121" />
+ <di:waypoint x="1512" y="121" />
<bpmndi:BPMNLabel>
<dc:Bounds x="786" y="-195" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_0f2w7aj_di" bpmnElement="IntermediateThrowEvent_0f2w7aj">
- <dc:Bounds x="1315" y="282" width="36" height="36" />
+ <dc:Bounds x="1512" y="592" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1299" y="323" width="73" height="24" />
+ <dc:Bounds x="1497" y="633" width="72" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1vprtt9_di" bpmnElement="SequenceFlow_1vprtt9">
- <di:waypoint xsi:type="dc:Point" x="778" y="325" />
- <di:waypoint xsi:type="dc:Point" x="778" y="393" />
- <di:waypoint xsi:type="dc:Point" x="861" y="394" />
+ <di:waypoint x="975" y="635" />
+ <di:waypoint x="975" y="703" />
+ <di:waypoint x="1058" y="704" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="784" y="353" width="20" height="12" />
+ <dc:Bounds x="982" y="663" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b">
- <dc:Bounds x="18" y="282" width="36" height="36" />
+ <dc:Bounds x="215" y="592" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-3" y="318" width="82" height="24" />
+ <dc:Bounds x="194" y="628" width="83" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1hbesp9_di" bpmnElement="SequenceFlow_1hbesp9">
- <di:waypoint xsi:type="dc:Point" x="54" y="300" />
- <di:waypoint xsi:type="dc:Point" x="444" y="300" />
+ <di:waypoint x="251" y="610" />
+ <di:waypoint x="641" y="610" />
<bpmndi:BPMNLabel>
<dc:Bounds x="204" y="279" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateCatchEvent_02bah5m_di" bpmnElement="IntermediateCatchEvent_02bah5m">
- <dc:Bounds x="18" y="507" width="36" height="36" />
+ <dc:Bounds x="171" y="817" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="2" y="543" width="73" height="12" />
+ <dc:Bounds x="156" y="853" width="72" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_16nxl6h_di" bpmnElement="SequenceFlow_16nxl6h">
- <di:waypoint xsi:type="dc:Point" x="979" y="525" />
- <di:waypoint xsi:type="dc:Point" x="1119" y="525" />
+ <di:waypoint x="1176" y="835" />
+ <di:waypoint x="1316" y="835" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1040" y="504" width="19" height="12" />
+ <dc:Bounds x="1238" y="814" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0uiygod_di" bpmnElement="SequenceFlow_0uiygod">
- <di:waypoint xsi:type="dc:Point" x="296" y="525" />
- <di:waypoint xsi:type="dc:Point" x="357" y="525" />
+ <di:waypoint x="493" y="835" />
+ <di:waypoint x="554" y="835" />
<bpmndi:BPMNLabel>
<dc:Bounds x="326.5" y="504" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1u9k0dm_di" bpmnElement="SequenceFlow_1u9k0dm">
- <di:waypoint xsi:type="dc:Point" x="457" y="525" />
- <di:waypoint xsi:type="dc:Point" x="551" y="525" />
+ <di:waypoint x="654" y="835" />
+ <di:waypoint x="748" y="835" />
<bpmndi:BPMNLabel>
<dc:Bounds x="504" y="504" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_13c7bhn_di" bpmnElement="SequenceFlow_13c7bhn">
- <di:waypoint xsi:type="dc:Point" x="651" y="525" />
- <di:waypoint xsi:type="dc:Point" x="728" y="525" />
+ <di:waypoint x="848" y="835" />
+ <di:waypoint x="925" y="835" />
<bpmndi:BPMNLabel>
<dc:Bounds x="689.5" y="504" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qozd66_di" bpmnElement="SequenceFlow_1qozd66">
- <di:waypoint xsi:type="dc:Point" x="54" y="525" />
- <di:waypoint xsi:type="dc:Point" x="196" y="525" />
+ <di:waypoint x="207" y="835" />
+ <di:waypoint x="393" y="835" />
<bpmndi:BPMNLabel>
<dc:Bounds x="125" y="504" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1ddg1di_di" bpmnElement="EndEvent_1ddg1di">
- <dc:Bounds x="1314.8151147098515" y="506.9419703103914" width="36" height="36" />
+ <dc:Bounds x="1512" y="817" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1332.8151147098515" y="546.9419703103914" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0epxs3b_di" bpmnElement="SequenceFlow_0epxs3b">
- <di:waypoint xsi:type="dc:Point" x="1219" y="525" />
- <di:waypoint xsi:type="dc:Point" x="1315" y="525" />
+ <di:waypoint x="1416" y="835" />
+ <di:waypoint x="1512" y="835" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1267" y="504" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_0sfdqc1_di" bpmnElement="SubProcess_0sfdqc1" isExpanded="true">
- <dc:Bounds x="338" y="817" width="467" height="193" />
+ <dc:Bounds x="535" y="1127" width="467" height="193" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0x7o2ug_di" bpmnElement="StartEvent_0x7o2ug">
- <dc:Bounds x="407" y="885" width="36" height="36" />
+ <dc:Bounds x="604" y="1195" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="335" y="926" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0lgdyyb_di" bpmnElement="EndEvent_0lgdyyb">
- <dc:Bounds x="700" y="885" width="36" height="36" />
+ <dc:Bounds x="897" y="1195" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="628" y="926" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1648adp_di" bpmnElement="ScriptTask_1648adp">
- <dc:Bounds x="511" y="863" width="100" height="80" />
+ <dc:Bounds x="708" y="1173" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0gr9xqj_di" bpmnElement="SequenceFlow_0gr9xqj">
- <di:waypoint xsi:type="dc:Point" x="443" y="903" />
- <di:waypoint xsi:type="dc:Point" x="511" y="903" />
+ <di:waypoint x="640" y="1213" />
+ <di:waypoint x="708" y="1213" />
<bpmndi:BPMNLabel>
<dc:Bounds x="387" y="888" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0a6l29p_di" bpmnElement="SequenceFlow_0a6l29p">
- <di:waypoint xsi:type="dc:Point" x="611" y="903" />
- <di:waypoint xsi:type="dc:Point" x="700" y="903" />
+ <di:waypoint x="808" y="1213" />
+ <di:waypoint x="897" y="1213" />
<bpmndi:BPMNLabel>
<dc:Bounds x="567.5" y="888" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0dh2mj1_di" bpmnElement="Task_1blaq0f">
- <dc:Bounds x="861" y="354" width="100" height="80" />
+ <dc:Bounds x="1058" y="664" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0k0f7lm_di" bpmnElement="SequenceFlow_0k0f7lm">
- <di:waypoint xsi:type="dc:Point" x="961" y="394" />
- <di:waypoint xsi:type="dc:Point" x="1047" y="393" />
+ <di:waypoint x="1158" y="704" />
+ <di:waypoint x="1244" y="703" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1004" y="372.5" width="0" height="12" />
</bpmndi:BPMNLabel>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
index 4d0324e478..1149cc9ea9 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
@@ -9,8 +9,7 @@
<bpmn:outgoing>SequenceFlow_11e6bfy</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoDeleteE2EServiceInstance()
-ddsi.preProcessRequest(execution)
-</bpmn:script>
+ddsi.preProcessRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:endEvent id="EndEvent_1uqzt26">
<bpmn:incoming>SequenceFlow_0e7inkl</bpmn:incoming>
@@ -27,7 +26,7 @@ ddsi.postProcessAAIGET(execution)</bpmn:script>
<bpmn:incoming>SequenceFlow_12rr1yy</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0e7inkl</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def ddsi = new DoCustomDeleteE2EServiceInstance()
+def ddsi = new DoDeleteE2EServiceInstance()
ddsi.deleteServiceInstance(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:subProcess id="SubProcess_1u8zt9i" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
index 35f8f45999..5b095a9983 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
@@ -27,14 +27,15 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
-import com.google.protobuf.Struct;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
@@ -45,6 +46,7 @@ import org.onap.so.bpmn.mock.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import com.google.protobuf.Struct;
/**
@@ -102,6 +104,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
}
+ @Ignore
@Test
public void workflow_validInput_expectedOuput() throws InterruptedException {
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/CreateNetworkCollection.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/CreateNetworkCollection.json
index 7b369ab97e..ce0e5aa643 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/CreateNetworkCollection.json
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/CreateNetworkCollection.json
@@ -4,7 +4,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10"
},
"cloudConfiguration": {
@@ -34,7 +34,7 @@
{
"service": {
"modelInfo": {
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceParams": [],
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/ServiceMacroAssign.json
index 51caddd48a..b86a2a28f6 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/ServiceMacroAssign.json
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/__files/Macro/ServiceMacroAssign.json
@@ -4,7 +4,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10.0"
},
"owningEntity": {
@@ -31,7 +31,7 @@
"service": {
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceParams": [],
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
index 513ff74180..4e74e5d414 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
@@ -55,7 +55,7 @@ public class HomingV2 {
private boolean isOof(BuildingBlockExecution execution) {
for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters()
.getUserParams()) {
- if (params.containsKey(HOMINGSOLUTION) && params.get(HOMINGSOLUTION).equals("oof")) {
+ if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) {
return true;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
index 2696313daf..d5a085aba7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
@@ -81,6 +81,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
@Component("OofHoming")
public class OofHomingV2 {
+ public static final String ERROR_WHILE_PREPARING_OOF_REQUEST = " Error - while preparing oof request: ";
private static final Logger logger = LoggerFactory.getLogger(OofHomingV2.class);
private JsonUtils jsonUtils = new JsonUtils();
@Autowired
@@ -91,13 +92,9 @@ public class OofHomingV2 {
private OofValidator oofValidator;
@Autowired
private ExceptionBuilder exceptionUtil;
- private static final String MODEL_NAME = "modelName";
private static final String MODEL_INVARIANT_ID = "modelInvariantId";
private static final String MODEL_VERSION_ID = "modelVersionId";
- private static final String MODEL_VERSION = "modelVersion";
private static final String SERVICE_RESOURCE_ID = "serviceResourceId";
- private static final String RESOURCE_MODULE_NAME = "resourceModuleName";
- private static final String RESOURCE_MODEL_INFO = "resourceModelInfo";
private static final String IDENTIFIER_TYPE = "identifierType";
private static final String SOLUTIONS = "solutions";
private static final String RESOURCE_MISSING_DATA = "Resource does not contain: ";
@@ -128,7 +125,7 @@ public class OofHomingV2 {
OofRequest oofRequest = new OofRequest();
- RequestInfo requestInfo = (RequestInfo) buildRequestInfo(requestId, timeout);
+ RequestInfo requestInfo = buildRequestInfo(requestId, timeout);
oofRequest.setRequestInformation(requestInfo);
ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
@@ -157,13 +154,13 @@ public class OofHomingV2 {
logger.trace("Completed Oof Homing Call Oof");
} catch (BpmnError e) {
- logger.debug(" Error - while preparing oof request: " + e.getStackTrace());
+ logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace());
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
} catch (BadResponseException e) {
- logger.debug(" Error - while preparing oof request: " + e.getStackTrace());
+ logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace());
exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
} catch (Exception e) {
- logger.debug(" Error - while preparing oof request: " + e.getStackTrace());
+ logger.debug(ERROR_WHILE_PREPARING_OOF_REQUEST + e.getStackTrace());
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while "
+ "preparing oof request: " + e + " Stack:" + ExceptionUtils.getFullStackTrace(e));
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index 2f898b6697..f1fd23fe82 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -65,6 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import org.onap.so.client.sniro.beans.SubscriberInfo;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -90,19 +91,17 @@ public class SniroHomingV2 {
private SniroClient client;
@Autowired
private ExceptionBuilder exceptionUtil;
- private static final String MODEL_NAME = "modelName";
private static final String MODEL_INVARIANT_ID = "modelInvariantId";
private static final String MODEL_VERSION_ID = "modelVersionId";
- private static final String MODEL_VERSION = "modelVersion";
private static final String SERVICE_RESOURCE_ID = "serviceResourceId";
- private static final String RESOURCE_MODULE_NAME = "resourceModuleName";
- private static final String RESOURCE_MODEL_INFO = "resourceModelInfo";
private static final String IDENTIFIER_TYPE = "identifierType";
private static final String SOLUTIONS = "solutions";
private static final String RESOURCE_MISSING_DATA = "Resource does not contain: ";
private static final String SERVICE_MISSING_DATA = "Service Instance does not contain: ";
private static final String UNPROCESSABLE = "422";
private static final int INTERNAL = 500;
+ private static final String EXCEPTION_OCCURRED = "Exception occurred";
+ private static final String VNF_HOST_NAME = "vnfHostName";
/**
* Generates the request payload then sends to sniro manager to perform homing and licensing for the provided
@@ -147,7 +146,7 @@ public class SniroHomingV2 {
licenseInfo.setDemands(licenseDemands);
request.setLicenseInformation(licenseInfo);
- if (placementDemands.size() > 0 || licenseDemands.size() > 0) {
+ if (!placementDemands.isEmpty() || !licenseDemands.isEmpty()) {
client.postDemands(request);
} else {
logger.debug(SERVICE_MISSING_DATA + "resources eligible for homing or licensing");
@@ -161,15 +160,16 @@ public class SniroHomingV2 {
logger.trace("Completed Sniro Homing Call Sniro");
} catch (BpmnError e) {
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ logger.error(EXCEPTION_OCCURRED, e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
+ TargetEntity.SNIRO);
} catch (BadResponseException e) {
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ logger.error(EXCEPTION_OCCURRED, e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
} catch (Exception e) {
- logger.error("Exception occurred", e);
+ logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while preparing sniro request: " + e.getMessage());
+ "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO);
}
}
@@ -183,7 +183,6 @@ public class SniroHomingV2 {
logger.trace("Started Sniro Homing Process Solution");
try {
// TODO improve handling multiple solutions but is dependent on sniro enhancing api + work with sniro
- // conductor to improve "inventoryType" representation
validateSolution(asyncResponse);
ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription()
.getServiceInstances().get(0);
@@ -213,15 +212,17 @@ public class SniroHomingV2 {
logger.trace("Completed Sniro Homing Process Solution");
} catch (BpmnError e) {
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ logger.error(EXCEPTION_OCCURRED, e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
+ TargetEntity.SNIRO);
} catch (BadResponseException e) {
- logger.error("Exception occurred", e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ logger.error(EXCEPTION_OCCURRED, e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
} catch (Exception e) {
- logger.error("Exception occurred", e);
+ logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage());
+ "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(),
+ TargetEntity.SO);
}
}
@@ -230,7 +231,7 @@ public class SniroHomingV2 {
*
* @throws Exception
*/
- private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception {
+ private RequestInfo buildRequestInfo(String requestId, String timeout) {
logger.trace("Building request information");
RequestInfo requestInfo = new RequestInfo();
if (requestId != null) {
@@ -305,7 +306,7 @@ public class SniroHomingV2 {
*/
private List<Demand> buildPlacementDemands(ServiceInstance serviceInstance) {
logger.trace("Building placement information demands");
- List<Demand> placementDemands = new ArrayList<Demand>();
+ List<Demand> placementDemands = new ArrayList<>();
List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
if (!allottedResourceList.isEmpty()) {
@@ -334,6 +335,18 @@ public class SniroHomingV2 {
}
}
}
+ List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies();
+ if (!serviceProxies.isEmpty()) {
+ logger.debug("Adding service proxies to placement demands list");
+ for (ServiceProxy sp : serviceProxies) {
+ if (isBlank(sp.getId())) {
+ sp.setId(UUID.randomUUID().toString());
+ }
+ Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
+ addCandidates(sp, demand);
+ placementDemands.add(demand);
+ }
+ }
return placementDemands;
}
@@ -343,7 +356,7 @@ public class SniroHomingV2 {
*/
private List<Demand> buildLicenseDemands(ServiceInstance serviceInstance) {
logger.trace("Building license information");
- List<Demand> licenseDemands = new ArrayList<Demand>();
+ List<Demand> licenseDemands = new ArrayList<>();
List<GenericVnf> vnfList = serviceInstance.getVnfs();
if (!vnfList.isEmpty()) {
logger.debug("Adding vnfs to license demands list");
@@ -394,37 +407,46 @@ public class SniroHomingV2 {
}
/**
- * Adds required, excluded, and existing candidates to a demand
+ * Adds required, excluded, and existing candidates as well as filtering attributes to a demand
*
*/
private void addCandidates(SolutionCandidates candidates, Demand demand) {
List<Candidate> required = candidates.getRequiredCandidates();
List<Candidate> excluded = candidates.getExcludedCandidates();
- if (!required.isEmpty()) {
- List<org.onap.so.client.sniro.beans.Candidate> cans =
- new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
- for (Candidate c : required) {
- org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- can.setIdentifierType(c.getIdentifierType());
- can.setIdentifiers(c.getIdentifiers());
- can.setCloudOwner(c.getCloudOwner());
- cans.add(can);
- }
- demand.setRequiredCandidates(cans);
+ List<Candidate> existing = candidates.getExistingCandidates();
+ List<Candidate> filtering = candidates.getFilteringAttributes();
+
+ List<org.onap.so.client.sniro.beans.Candidate> candidateList = getCandidates(required);
+ if (!candidateList.isEmpty()) {
+ demand.setRequiredCandidates(candidateList);
}
- if (!excluded.isEmpty()) {
- List<org.onap.so.client.sniro.beans.Candidate> cans =
- new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
- for (Candidate c : excluded) {
+ candidateList = getCandidates(excluded);
+ if (!candidateList.isEmpty()) {
+ demand.setExcludedCandidates(candidateList);
+ }
+ candidateList = getCandidates(existing);
+ if (!candidateList.isEmpty()) {
+ demand.setExistingCandidates(candidateList);
+ }
+
+ candidateList = getCandidates(filtering);
+ if (!candidateList.isEmpty()) {
+ demand.setFilteringAttributes(candidateList);
+ }
+ }
+
+ private List<org.onap.so.client.sniro.beans.Candidate> getCandidates(List<Candidate> candidates) {
+ List<org.onap.so.client.sniro.beans.Candidate> candidateList = new ArrayList<>();
+ if (!candidates.isEmpty()) {
+ for (Candidate c : candidates) {
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
can.setIdentifierType(c.getIdentifierType());
can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
- cans.add(can);
+ candidateList.add(can);
}
- demand.setExcludedCandidates(cans);
}
- // TODO support existing candidates
+ return candidateList;
}
/**
@@ -462,6 +484,7 @@ public class SniroHomingV2 {
List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
List<AllottedResource> allottes = serviceInstance.getAllottedResources();
List<GenericVnf> vnfs = serviceInstance.getVnfs();
+ List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies();
logger.debug("Processing placement solution " + i + 1);
for (int p = 0; p < placements.length(); p++) {
@@ -502,6 +525,12 @@ public class SniroHomingV2 {
break search;
}
}
+ for (ServiceProxy proxy : serviceProxies) {
+ if (placement.getString(SERVICE_RESOURCE_ID).equals(proxy.getId())) {
+ proxy.setServiceInstance(setSolution(solutionInfo, placement));
+ break search;
+ }
+ }
}
}
}
@@ -531,7 +560,7 @@ public class SniroHomingV2 {
si.setServiceInstanceId(identifierValue);
si.setOrchestrationStatus(OrchestrationStatus.CREATED);
cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId"));
- if (assignmentsMap.containsKey("vnfHostName") && !assignmentsMap.get("vnfHostName").isEmpty()) {
+ if (assignmentsMap.containsKey(VNF_HOST_NAME) && !assignmentsMap.get(VNF_HOST_NAME).isEmpty()) {
logger.debug("Resources has been homed to a vnf");
GenericVnf vnf = setVnf(assignmentsMap);
vnf.setCloudRegion(cloud);
@@ -581,7 +610,7 @@ public class SniroHomingV2 {
private GenericVnf setVnf(Map<String, String> assignmentsMap) {
GenericVnf vnf = new GenericVnf();
vnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
- vnf.setVnfName(assignmentsMap.get("vnfHostName"));
+ vnf.setVnfName(assignmentsMap.get(VNF_HOST_NAME));
vnf.setVnfId(assignmentsMap.get("vnfId"));
return vnf;
}
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 d23f9c52ea..bd60fbe38c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -29,6 +29,7 @@ import java.util.TreeSet;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -49,6 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
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.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@@ -69,6 +71,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import com.google.common.base.Strings;
@Component
public class AAICreateTasks {
@@ -102,6 +105,14 @@ public class AAICreateTasks {
@Autowired
private Environment env;
+ /**
+ * This method is used for creating the service instance in A&AI.
+ *
+ * It will check the alaCarte and create the service instance in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createServiceInstance(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -113,6 +124,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating and subscribing the service in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createServiceSubscription(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -122,8 +139,8 @@ public class AAICreateTasks {
String errorMessage =
"Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: "
+ serviceInstance.getServiceInstanceId();
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage, "BPMN",
- ErrorCode.UnknownError.getValue(), errorMessage);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorMessage,
+ "BPMN", ErrorCode.UnknownError.getValue(), errorMessage);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessage);
}
aaiSIResources.createServiceSubscription(customer);
@@ -134,6 +151,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creation of the project A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createProject(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -151,32 +174,49 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating OwningEntity A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createOwningEntity(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
OwningEntity owningEntity = serviceInstance.getOwningEntity();
- String owningEntityId = owningEntity.getOwningEntityId();
- String owningEntityName = owningEntity.getOwningEntityName();
- if (owningEntityId == null || "".equals(owningEntityId)) {
- String msg = "Exception in AAICreateOwningEntity. OwningEntityId is null.";
+ if (Strings.isNullOrEmpty(owningEntity.getOwningEntityId())
+ && Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
+ String msg = "Exception in AAICreateOwningEntity. OwningEntityId and Name are null.";
execution.setVariable("ErrorCreateOEAAI", msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ } else if (Strings.isNullOrEmpty(owningEntity.getOwningEntityId())
+ && !Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
+ if (aaiSIResources.existsOwningEntityName(owningEntity.getOwningEntityName())) {
+ org.onap.aai.domain.yang.OwningEntity aaiEntity =
+ aaiSIResources.getOwningEntityByName(owningEntity.getOwningEntityName());
+ owningEntity.setOwningEntityId(aaiEntity.getOwningEntityId());
+ owningEntity.setOwningEntityName(owningEntity.getOwningEntityName());
+ aaiSIResources.connectOwningEntityandServiceInstance(owningEntity, serviceInstance);
+ } else {
+ owningEntity.setOwningEntityId(UUID.randomUUID().toString());
+ aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
+ }
} else {
if (aaiSIResources.existsOwningEntity(owningEntity)) {
aaiSIResources.connectOwningEntityandServiceInstance(owningEntity, serviceInstance);
} else {
- if (owningEntityName == null || "".equals(owningEntityName)) {
+ if (Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
String msg =
"Exception in AAICreateOwningEntity. Can't create an owningEntity with no owningEntityName.";
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
} else {
- if (aaiSIResources.existsOwningEntityName(owningEntityName)) {
+ if (aaiSIResources.existsOwningEntityName(owningEntity.getOwningEntityName())) {
String msg =
"Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)";
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg,
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg,
"BPMN", ErrorCode.UnknownError.getValue(), msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
} else {
@@ -190,6 +230,16 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating Vnf in A&AI.
+ *
+ * It will check if the Vnf Name is exits in A&AI then it will throw the duplicate name exception.
+ *
+ * Otherwise it will create the vnf amd connect to the serviceinstance.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -202,6 +252,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for separating (,) from the string.
+ *
+ * @param str
+ * @throws @return
+ */
public void createPlatform(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -221,10 +277,22 @@ public class AAICreateTasks {
}
+ /**
+ * This method is used for separating (,) from the string.
+ *
+ * @param str
+ * @throws @return
+ */
public List<String> splitCDL(String str) {
return Stream.of(str.split(",")).map(String::trim).map(elem -> new String(elem)).collect(Collectors.toList());
}
+ /**
+ * This method is used for creating the type of business in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createLineOfBusiness(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -244,6 +312,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating the volume group in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -259,6 +333,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating the vfModule in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createVfModule(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -277,7 +357,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -302,7 +382,7 @@ public class AAICreateTasks {
/**
* BPMN access method to execute Create L3Network operation (PUT )in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -323,6 +403,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating the customer in A&AI.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void createCustomer(BuildingBlockExecution execution) throws Exception {
try {
Customer customer = execution.getGeneralBuildingBlock().getCustomer();
@@ -335,7 +421,7 @@ public class AAICreateTasks {
/**
* BPMN access method to execute NetworkCollection operation (PUT) in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -355,7 +441,7 @@ public class AAICreateTasks {
/**
* BPMN access method to execute NetworkCollectionInstanceGroup operation (PUT) in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -376,7 +462,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -391,7 +477,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -407,7 +493,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -430,7 +516,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -445,7 +531,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -462,7 +548,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -480,6 +566,11 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for configuring the service in A&AI.
+ *
+ * @param execution @throws
+ */
public void createConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
@@ -489,6 +580,11 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating vnf instance group in A&AI.
+ *
+ * @param execution @throws
+ */
public void createInstanceGroupVnf(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -500,6 +596,11 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used to put the network policy in A&AI.
+ *
+ * @param execution @throws
+ */
public void createNetworkPolicies(BuildingBlockExecution execution) {
try {
String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
@@ -534,10 +635,10 @@ public class AAICreateTasks {
/**
* Groups existing vf modules by the model uuid of our new vf module and returns the lowest unused index
- *
+ *
* if we have a module type A, and there are 3 instances of those, and then module type B has 2 instances, if we are
* adding a new module type A, the vf-module-index should be 3 assuming contiguous indices (not 5, or 2)
- *
+ *
*/
protected int getLowestUnusedVfModuleIndexFromAAIVnfResponse(GenericVnf genericVnf, VfModule newVfModule) {
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 28186528e4..15f8c5e4ef 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -58,8 +58,8 @@ import org.springframework.stereotype.Component;
public class AAIDeleteTasks {
private static final Logger logger = LoggerFactory.getLogger(AAIDeleteTasks.class);
- private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
- private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
+ private static String contrailNetworkPolicyFqdnList = "contrailNetworkPolicyFqdnList";
+ private static String networkPolicyFqdnParam = "network-policy-fqdn";
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -80,6 +80,16 @@ public class AAIDeleteTasks {
@Autowired
private AAIInstanceGroupResources aaiInstanceGroupResources;
+ /**
+ * BPMN access method to delete the VfModule from A&AI.
+ *
+ * It will extract the genericVnf & VfModule from the BBObject.
+ *
+ * Before deleting it set the aaiVfModuleRollback as false & then it will delete the VfModule.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -89,10 +99,21 @@ public class AAIDeleteTasks {
aaiVfModuleResources.deleteVfModule(vfModule, genericVnf);
execution.setVariable("aaiVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteVfModule process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the Vnf from A&AI.
+ *
+ * It will extract the genericVnf from the BBObject.
+ *
+ * Before deleting it set the aaiVnfRollback as false & then it will delete the Vnf.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteVnf(BuildingBlockExecution execution) throws Exception {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -101,90 +122,165 @@ public class AAIDeleteTasks {
aaiVnfResources.deleteVnf(genericVnf);
execution.setVariable("aaiVnfRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the ServiceInstance from A&AI.
+ *
+ * It will extract the serviceInstance from the BBObject.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteServiceInstance(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiSIResources.deleteServiceInstance(serviceInstance);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteServiceInstance process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the l3network from A&AI.
+ *
+ * It will extract the l3network from the BBObject.
+ *
+ * After deleting the l3network it set the isRollbackNeeded as true.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteNetwork(BuildingBlockExecution execution) throws Exception {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.deleteNetwork(l3network);
execution.setVariable("isRollbackNeeded", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteNetwork process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the Collection from A&AI.
+ *
+ * It will extract the serviceInstance from the BBObject.
+ *
+ * Then it will get the collection from serviceinstance.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteCollection(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiNetworkResources.deleteCollection(serviceInstance.getCollection());
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteCollection process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the InstanceGroup from A&AI.
+ *
+ * It will extract the serviceInstance from the BBObject.
+ *
+ * Then it will get the Instance group from serviceInstance.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteInstanceGroup(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiNetworkResources.deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroup process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the VolumeGroup from A&AI.
+ *
+ * It will extract the volumeGroup from the BBObject and cloudRegion from execution object .
+ *
+ * Then it will delete from A&AI.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteVolumeGroup(BuildingBlockExecution execution) {
try {
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteVolumeGroup process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the Configuration from A&AI.
+ *
+ * It will extract the configuration from the BBObject.
+ *
+ * Then it will delete from A&AI.
+ *
+ * @param execution
+ */
public void deleteConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.deleteConfiguration(configuration);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteConfiguration process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the InstanceGroupVnf from A&AI.
+ *
+ * It will extract the instanceGroup from the BBObject.
+ *
+ * Then it will delete from A&AI.
+ *
+ * @param execution
+ */
public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
try {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroupVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
public void deleteNetworkPolicies(BuildingBlockExecution execution) {
try {
- String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
+ String fqdns = execution.getVariable(contrailNetworkPolicyFqdnList);
if (fqdns != null && !fqdns.isEmpty()) {
- String fqdnList[] = fqdns.split(",");
+ String[] fqdnList = fqdns.split(",");
int fqdnCount = fqdnList.length;
if (fqdnCount > 0) {
for (int i = 0; i < fqdnCount; i++) {
String fqdn = fqdnList[i];
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
- uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
+ uri.queryParam(networkPolicyFqdnParam, fqdn);
Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
if (oNetPolicies.isPresent()) {
NetworkPolicies networkPolicies = oNetPolicies.get();
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 12aade71bc..1add5e6d24 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
@@ -35,7 +35,6 @@ import org.springframework.stereotype.Component;
@Component
public class AAIFlagTasks {
- private static final Logger logger = LoggerFactory.getLogger(AAIFlagTasks.class);
@Autowired
private AAIVnfResources aaiVnfResources;
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 01bdc09419..86645391b4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -79,6 +79,11 @@ public class AAIUpdateTasks {
@Autowired
private AAIConfigurationResources aaiConfigurationResources;
+ /**
+ * BPMN access method to update the status of Service to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -87,10 +92,16 @@ public class AAIUpdateTasks {
OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiServiceInstanceRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedService", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of Service to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -98,28 +109,46 @@ public class AAIUpdateTasks {
aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveService", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of Vnf to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of Vnf to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of VolumeGroup to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -130,10 +159,16 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of VolumeGroup to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActiveVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -144,10 +179,16 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of VolumeGroup to Created in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusCreatedVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -158,10 +199,16 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
OrchestrationStatus.CREATED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update HeatStackId and VolumeGroup in AAI
+ *
+ * @param execution
+ */
public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -175,10 +222,16 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of VfModule to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -186,10 +239,16 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of VfModule to PendingActivation in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -197,10 +256,16 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
OrchestrationStatus.PENDING_ACTIVATION);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusPendingActivationVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of VfModule to AssignedOrPendingActivation in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -218,20 +283,36 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
}
} catch (Exception ex) {
+ logger.error(
+ "Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedOrPendingActivationVfModule",
+ ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of VfModule to Created in AAI
+ *
+ * @param execution
+ *
+ */
public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
try {
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) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule
+ *
+ * @param execution
+ * @throws buildAndThrowWorkflowException
+ */
public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeactivateVfModuleRollback", false);
try {
@@ -240,13 +321,14 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED);
execution.setVariable("aaiDeactivateVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to update status of L3Network to Assigned in AAI
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -256,7 +338,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Active in AAI
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -266,7 +348,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Created in AAI
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -279,6 +361,7 @@ public class AAIUpdateTasks {
L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
updateNetworkAAI(l3Network, status);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -302,7 +385,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network Collection to Active in AAI
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -319,10 +402,16 @@ public class AAIUpdateTasks {
aaiCollectionResources.updateCollection(copiedNetworkCollection);
execution.setVariable("aaiNetworkCollectionActivateRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveNetworkCollection", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of VfModule to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiActivateVfModuleRollback", false);
try {
@@ -331,10 +420,16 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
execution.setVariable("aaiActivateVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update HeatStackId of VfModule in AAI
+ *
+ * @param execution
+ */
public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
try {
String heatStackId = execution.getVariable("heatStackId");
@@ -346,13 +441,14 @@ public class AAIUpdateTasks {
vfModule.setHeatStackId(heatStackId);
aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to update L3Network after it was created in cloud
- *
+ *
* @param execution
* @throws Exception
*/
@@ -389,13 +485,14 @@ public class AAIUpdateTasks {
execution.setVariable("aaiNetworkActivateRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateNetworkCreated", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to update L3Network after it was updated in cloud
- *
+ *
* @param execution
* @throws Exception
*/
@@ -418,22 +515,29 @@ public class AAIUpdateTasks {
}
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateNetworkUpdated", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update L3Network Object
+ *
+ * @param execution
+ */
public void updateObjectNetwork(BuildingBlockExecution execution) {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.updateNetwork(l3network);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateObjectNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to update ServiceInstance
- *
+ *
* @param execution
*/
public void updateServiceInstance(BuildingBlockExecution execution) {
@@ -442,19 +546,31 @@ public class AAIUpdateTasks {
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiServiceInstanceResources.updateServiceInstance(serviceInstance);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateServiceInstance", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update Vnf Object
+ *
+ * @param execution
+ */
public void updateObjectVnf(BuildingBlockExecution execution) {
try {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateObjectVnf(genericVnf);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateObjectVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of VfModuleRollback as true
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeleteVfModuleRollback", false);
try {
@@ -467,49 +583,81 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiDeleteVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeleteVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update Model of VfModule
+ *
+ * @param execution
+ */
public void updateModelVfModule(BuildingBlockExecution execution) {
try {
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) {
+ logger.error("Exception occurred in AAIUpdateTasks updateModelVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of FabricConfiguration to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,
OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignFabricConfiguration", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of FabricConfiguration to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateFabricConfiguration",
+ ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of FabricConfiguration to deactive in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,
OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateFabricConfiguration",
+ ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update Ipv4OamAddress of Vnf
+ *
+ * @param execution
+ */
public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
try {
String ipv4OamAddress = execution.getVariable("oamManagementV4Address");
@@ -523,10 +671,16 @@ public class AAIUpdateTasks {
aaiVnfResources.updateObjectVnf(copiedGenericVnf);
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateIpv4OamAddressVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update ManagementV6Address of Vnf
+ *
+ * @param execution
+ */
public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
try {
String managementV6Address = execution.getVariable("oamManagementV6Address");
@@ -540,10 +694,16 @@ public class AAIUpdateTasks {
aaiVnfResources.updateObjectVnf(copiedGenericVnf);
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateManagementV6AddressVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update ContrailServiceInstanceFqdn of VfModule
+ *
+ * @param execution
+ */
public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
try {
String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn");
@@ -554,36 +714,55 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateContrailServiceInstanceFqdnVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to update status of Vnf to ConfigAssigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigAssignedVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
- public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution) {
+ /**
+ * BPMN access method to update status of Vnf to Configure in AAI
+ *
+ * @param execution
+ */
+ public void updateOrchestrationStatusConfigDeployConfigureVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfigureVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
- public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution) {
+ /**
+ * BPMN access method to update status of Vnf to configured in AAI
+ *
+ * @param execution
+ */
+ public void updateOrchestrationStatusConfigDeployConfiguredVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfiguredVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 426ef931b6..d9c6857ef1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -22,15 +22,18 @@
package org.onap.so.bpmn.infrastructure.activity;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables;
import org.camunda.bpm.engine.variable.VariableMap;
import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure;
import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -57,9 +60,18 @@ public class ExecuteActivity implements JavaDelegate {
private static final String VNF_ID = "vnfId";
private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
private static final String WORKFLOW_SYNC_ACK_SENT = "workflowSyncAckSent";
+ private static final String BUILDING_BLOCK = "buildingBlock";
+ private static final String EXECUTE_BUILDING_BLOCK = "ExecuteBuildingBlock";
+ private static final String RETRY_COUNT = "retryCount";
+ private static final String A_LA_CARTE = "aLaCarte";
+ private static final String SUPPRESS_ROLLBACK = "suppressRollback";
+ private static final String WORKFLOW_EXCEPTION = "WorkflowException";
+ private static final String HANDLING_CODE = "handlingCode";
+ private static final String ABORT_HANDLING_CODE = "Abort";
private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation";
private static final String ACTIVITY_PREFIX = "activity:";
+ private static final String EXECUTE_ACTIVITY_ERROR_MESSAGE = "ExecuteActivityErrorMessage";
private ObjectMapper mapper = new ObjectMapper();
@@ -68,12 +80,15 @@ public class ExecuteActivity implements JavaDelegate {
@Autowired
private ExceptionBuilder exceptionBuilder;
@Autowired
+ private WorkflowActionBBFailure workflowActionBBFailure;
+ @Autowired
private WorkflowActionBBTasks workflowActionBBTasks;
@Override
public void execute(DelegateExecution execution) throws Exception {
final String requestId = (String) execution.getVariable(G_REQUEST_ID);
-
+ WorkflowException workflowException = null;
+ String handlingCode = null;
try {
Boolean workflowSyncAckSent = (Boolean) execution.getVariable(WORKFLOW_SYNC_ACK_SENT);
if (workflowSyncAckSent == null || workflowSyncAckSent == false) {
@@ -93,24 +108,44 @@ public class ExecuteActivity implements JavaDelegate {
ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock);
Map<String, Object> variables = new HashMap<>();
- variables.put("buildingBlock", executeBuildingBlock);
- variables.put("mso-request-id", requestId);
- variables.put("retryCount", 1);
- variables.put("aLaCarte", true);
+
+ if (execution.getVariables() != null) {
+ execution.getVariables().forEach((key, value) -> {
+ if (value instanceof Serializable) {
+ variables.put(key, (Serializable) value);
+ }
+ });
+ }
+
+ variables.put(BUILDING_BLOCK, executeBuildingBlock);
+ variables.put(G_REQUEST_ID, requestId);
+ variables.put(RETRY_COUNT, 1);
+ variables.put(A_LA_CARTE, true);
+ variables.put(SUPPRESS_ROLLBACK, true);
ProcessInstanceWithVariables buildingBlockResult =
- runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables)
+ runtimeService.createProcessInstanceByKey(EXECUTE_BUILDING_BLOCK).setVariables(variables)
.executeWithVariablesInReturn();
VariableMap variableMap = buildingBlockResult.getVariables();
- WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException");
+ workflowException = (WorkflowException) variableMap.get(WORKFLOW_EXCEPTION);
if (workflowException != null) {
logger.error("Workflow exception is: {}", workflowException.getErrorMessage());
}
- execution.setVariable("WorkflowException", workflowException);
+
+ handlingCode = (String) variableMap.get(HANDLING_CODE);
+ logger.debug("Handling code: " + handlingCode);
+
+ execution.setVariable(WORKFLOW_EXCEPTION, workflowException);
} catch (Exception e) {
buildAndThrowException(execution, e.getMessage());
}
+
+ if (workflowException != null && handlingCode != null && handlingCode.equals(ABORT_HANDLING_CODE)) {
+ logger.debug("Aborting execution of the custom workflow");
+ buildAndThrowException(execution, workflowException.getErrorMessage());
+ }
+
}
protected BuildingBlock buildBuildingBlock(String activityName) {
@@ -144,15 +179,17 @@ public class ExecuteActivity implements JavaDelegate {
}
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg, ex);
- execution.setVariable("ExecuteActivityErrorMessage", msg);
+ execution.setVariable(EXECUTE_ACTIVITY_ERROR_MESSAGE, msg);
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
protected void buildAndThrowException(DelegateExecution execution, String msg) {
logger.error(msg);
- execution.setVariable("ExecuteActuvityErrorMessage", msg);
+ execution.setVariable(EXECUTE_ACTIVITY_ERROR_MESSAGE, msg);
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index 859db11037..e9d33f46ab 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -38,6 +38,7 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -93,7 +94,7 @@ public class NetworkAdapterRestV1 {
throw new Exception("No Network Request was created. networkAdapterRequest was null.");
}
} catch (Exception ex) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
@@ -138,7 +139,7 @@ public class NetworkAdapterRestV1 {
}
} catch (Exception e) {
logger.error("Error in Openstack Adapter callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK);
}
}
@@ -151,7 +152,7 @@ public class NetworkAdapterRestV1 {
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on Openstack Async-Response");
+ "Error timed out waiting on Openstack Async-Response", TargetEntity.SO);
}
public void handleSyncError(DelegateExecution execution) {
@@ -159,6 +160,6 @@ public class NetworkAdapterRestV1 {
String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = "
+ responseString;
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK);
}
}
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 77898dd5cc..428f5e703d 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
@@ -32,7 +32,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.client.orchestration.NetworkAdapterResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,7 +39,6 @@ import org.springframework.stereotype.Component;
@Component
public class NetworkAdapterUpdateTasks {
- private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterUpdateTasks.class);
@Autowired
private ExtractPojosForBB extractPojosForBB;
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 849465e787..4285e9aa84 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -48,6 +48,7 @@ import static org.apache.commons.lang3.StringUtils.*;
@Component
public class VnfAdapterCreateTasks {
private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateTasks.class);
+ public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_";
private static final String VNFREST_REQUEST = "VNFREST_Request";
@Autowired
@@ -59,6 +60,12 @@ public class VnfAdapterCreateTasks {
@Autowired
private ExceptionBuilder exceptionUtil;
+ /**
+ * This method is used for creating the request for the VolumeGroup.
+ *
+ * @param execution
+ * @return
+ */
public void createVolumeGroupRequest(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -73,13 +80,15 @@ public class VnfAdapterCreateTasks {
try {
vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
- sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
+ sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId());
} else {
throw new Exception("Vf Module " + vfModule.getVfModuleId()
+ " exists in gBuildingBlock but does not have a selflink value");
}
} catch (BBObjectNotFoundException bbException) {
- // If there is not a vf module in the general building block (in aLaCarte case), we will not retrieve
+ logger.error("Exception occurred", bbException);
+ // If there is not a vf module in the general building block (in aLaCarte case),
+ // we will not retrieve
// the SDNCQueryResponse and proceed as normal without throwing an error
}
@@ -88,11 +97,18 @@ public class VnfAdapterCreateTasks {
genericVnf, volumeGroup, sdncVfModuleQueryResponse);
execution.setVariable(VNFREST_REQUEST, createVolumeGroupRequest.toXmlString());
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used for creating the request for the VfModule.
+ *
+ * @param execution
+ * @return
+ */
public void createVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -105,21 +121,23 @@ public class VnfAdapterCreateTasks {
try {
volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch (BBObjectNotFoundException bbException) {
+ logger.error("Exception occurred if bb objrct not found in VnfAdapterCreateTasks createVfModule ",
+ bbException);
}
CloudRegion cloudRegion = gBBInput.getCloudRegion();
RequestContext requestContext = gBBInput.getRequestContext();
OrchestrationContext orchestrationContext = gBBInput.getOrchContext();
- String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
- String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId());
+ String sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId());
+ String sdncVnfQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId());
CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(
requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule,
volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString());
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
index 116dc30d63..5fe80b79f9 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
@@ -42,7 +42,7 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterDeleteTasks {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteTasks.class);
+
private static final String VNFREST_REQUEST = "VNFREST_Request";
@Autowired
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 bfa76c5053..e5f28aa4c3 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.adapter.vnf.tasks;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.lang3.StringUtils;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -63,6 +64,7 @@ public class VnfAdapterImpl {
private static final String OAM_MANAGEMENT_V4_ADDRESS = "oamManagementV4Address";
private static final String OAM_MANAGEMENT_V6_ADDRESS = "oamManagementV6Address";
private static final String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
+ public static final String HEAT_STACK_ID = "heatStackId";
@Autowired
private ExtractPojosForBB extractPojosForBB;
@@ -77,7 +79,7 @@ public class VnfAdapterImpl {
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);
+ execution.setVariable(HEAT_STACK_ID, null);
execution.setVariable(CONTRAIL_SERVICE_INSTANCE_FQDN, null);
execution.setVariable(OAM_MANAGEMENT_V4_ADDRESS, null);
execution.setVariable(OAM_MANAGEMENT_V6_ADDRESS, null);
@@ -97,7 +99,7 @@ public class VnfAdapterImpl {
String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
if (!StringUtils.isEmpty(heatStackId)) {
vfModule.setHeatStackId(heatStackId);
- execution.setVariable("heatStackId", heatStackId);
+ execution.setVariable(HEAT_STACK_ID, heatStackId);
}
Map<String, String> vfModuleOutputs =
((CreateVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
@@ -110,7 +112,7 @@ public class VnfAdapterImpl {
Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
if (null != vfModuleDelete && vfModuleDelete) {
vfModule.setHeatStackId(null);
- execution.setVariable("heatStackId", null);
+ execution.setVariable(HEAT_STACK_ID, null);
Map<String, String> vfModuleOutputs =
((DeleteVfModuleResponse) vnfRestResponse).getVfModuleOutputs();
if (vfModuleOutputs != null) {
@@ -134,7 +136,7 @@ public class VnfAdapterImpl {
String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId();
if (!StringUtils.isEmpty(heatStackId)) {
volumeGroup.setHeatStackId(heatStackId);
- execution.setVariable("heatStackId", heatStackId);
+ execution.setVariable(HEAT_STACK_ID, heatStackId);
} else {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
"HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
@@ -144,7 +146,7 @@ public class VnfAdapterImpl {
Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted();
if (null != volumeGroupDelete && volumeGroupDelete) {
volumeGroup.setHeatStackId(null);
- execution.setVariable("heatStackId", null);
+ execution.setVariable(HEAT_STACK_ID, null);
}
}
}
@@ -170,8 +172,8 @@ public class VnfAdapterImpl {
SAXSource source = new SAXSource(xmlReader, inputSource);
return jaxbUnmarshaller.unmarshal(source);
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
- e.getMessage(), e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.GENERAL_EXCEPTION.toString(),
+ ErrorCode.SchemaError.getValue(), e.getMessage(), e);
throw new MarshallerException("Error parsing VNF Adapter response. " + e.getMessage(),
ErrorCode.SchemaError.getValue(), e);
}
@@ -184,7 +186,7 @@ public class VnfAdapterImpl {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>();
+ List<String> contrailNetworkPolicyFqdnList = new ArrayList<>();
Iterator<String> keys = vfModuleOutputs.keySet().iterator();
while (keys.hasNext()) {
String key = keys.next();
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
index 01519fab6e..c112d200e3 100644
--- 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
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
* ================================================================================
+ * 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
@@ -20,8 +22,7 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
-import static com.google.common.collect.Sets.newHashSet;
-import java.util.Set;
+import com.google.common.collect.ImmutableSet;
import org.onap.vnfmadapter.v1.model.OperationStateEnum;
import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
@@ -44,18 +45,18 @@ public class Constants {
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_URL = "https://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/";
- public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES =
- newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
+ public static final ImmutableSet<OperationStateEnum> OPERATION_FINISHED_STATES =
+ ImmutableSet.of(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
- public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet(
- OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
+ public static final ImmutableSet<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = ImmutableSet
+ .of(OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus";
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
index 4c84bcaa1f..30f0d38754 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Ericsson. All rights reserved.
+ * Copyright (C) 2019 Ericsson. All rights reserved.
* ================================================================================
- * Modifications Copyright (c) 2019 Samsung
+ * 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.
@@ -15,8 +15,6 @@
* WITHOUT 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;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
index 34e3efa8f5..8fecb81d75 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Ericsson. All rights reserved.
+ * Copyright (C) 2019 Ericsson. All rights reserved.
* ================================================================================
- * Modifications Copyright (c) 2019 Samsung
+ * 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.
@@ -15,8 +15,6 @@
* WITHOUT 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;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
index f5bae2c82a..c3c0047fff 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
@@ -21,14 +21,32 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import javax.net.ssl.SSLContext;
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
/**
@@ -40,13 +58,55 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class VnfmAdapterCreateVnfTaskConfiguration {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterCreateVnfTaskConfiguration.class);
+
+ @Value("${rest.http.client.configuration.ssl.trustStore:#{null}}")
+ private Resource trustStore;
+
+ @Value("${rest.http.client.configuration.ssl.trustStorePassword:#{null}}")
+ private String trustStorePassword;
+
+ @Value("${rest.http.client.configuration.ssl.keyStore:#{null}}")
+ private Resource keyStoreResource;
+
+ @Value("${rest.http.client.configuration.ssl.keyStorePassword:#{null}}")
+ private String keyStorePassword;
+
@Bean
public HttpRestServiceProvider databaseHttpRestServiceProvider(
@Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate,
@Autowired final VnfmBasicHttpConfigProvider etsiVnfmAdapter) {
+ if (trustStore != null) {
+ setTrustStore(restTemplate);
+ }
return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(etsiVnfmAdapter.getAuth()));
}
+ private void setTrustStore(final RestTemplate restTemplate) {
+ SSLContext sslContext;
+ try {
+ if (keyStoreResource != null) {
+ KeyStore keystore = KeyStore.getInstance("pkcs12");
+ keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
+ sslContext =
+ new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray())
+ .loadKeyMaterial(keystore, keyStorePassword.toCharArray()).build();
+ } else {
+ sslContext = new SSLContextBuilder()
+ .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build();
+ }
+ logger.info("Setting truststore: {}", trustStore.getURL());
+ final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
+ final HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
+ final HttpComponentsClientHttpRequestFactory factory =
+ new HttpComponentsClientHttpRequestFactory(httpClient);
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
+ } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
+ | IOException | UnrecoverableKeyException exception) {
+ logger.error("Error reading truststore, TLS connection to VNFM will fail.", exception);
+ }
+ }
+
private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
final HttpHeadersProvider httpHeadersProvider) {
return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
index 4a51891184..32516c1dcb 100644
--- 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
@@ -42,6 +42,7 @@ import com.google.common.base.Optional;
public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(VnfmAdapterServiceProviderImpl.class);
+ public static final String RECEIVED_RESPONSE_WITHOUT_BODY = "Received response without body: {}";
private final VnfmAdapterUrlProvider urlProvider;
private final HttpRestServiceProvider httpServiceProvider;
@@ -69,7 +70,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
}
if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
+ LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response);
return Optional.absent();
}
@@ -107,7 +108,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
}
if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
+ LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response);
return Optional.absent();
}
final DeleteVnfResponse deleteVnfResponse = response.getBody();
@@ -139,7 +140,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
}
if (!response.hasBody()) {
- LOGGER.error("Received response without body: {}", response);
+ LOGGER.error(RECEIVED_RESPONSE_WITHOUT_BODY, response);
return Optional.absent();
}
return Optional.of(response.getBody());
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 ef882b4694..127d21c0ed 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -23,7 +23,12 @@
package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.HashMap;
+import java.util.List;
import java.util.Optional;
+import org.onap.so.logger.LoggingAnchor;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -32,9 +37,14 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIVnfResources;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.logger.ErrorCode;
@@ -47,6 +57,9 @@ import org.springframework.stereotype.Component;
@Component
public class AppcRunTasks {
private static final Logger logger = LoggerFactory.getLogger(AppcRunTasks.class);
+ public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop";
+ public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock";
+ public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic";
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -55,6 +68,8 @@ public class AppcRunTasks {
private CatalogDbClient catalogDbClient;
@Autowired
private ApplicationControllerAction appCClient;
+ @Autowired
+ private AAIVnfResources aaiVnfResources;
public void preProcessActivity(BuildingBlockExecution execution) {
execution.setVariable("actionSnapshot", Action.Snapshot);
@@ -71,9 +86,25 @@ public class AppcRunTasks {
execution.setVariable("actionHealthCheck", Action.HealthCheck);
execution.setVariable("actionDistributeTraffic", Action.DistributeTraffic);
execution.setVariable("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
- execution.setVariable("rollbackVnfStop", false);
- execution.setVariable("rollbackVnfLock", false);
- execution.setVariable("rollbackQuiesceTraffic", false);
+ execution.setVariable(ROLLBACK_VNF_STOP, false);
+ execution.setVariable(ROLLBACK_VNF_LOCK, false);
+ execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false);
+ execution.setVariable("vmIdList", null);
+ execution.setVariable("vserverIdList", null);
+
+ GenericVnf vnf = null;
+ try {
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ } catch (BBObjectNotFoundException e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists");
+ }
+
+ try {
+ getVserversForAppc(execution, vnf);
+ } catch (Exception e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Unable to retrieve vservers");
+ }
+
}
public void runAppcCommand(BuildingBlockExecution execution, Action action) {
@@ -137,7 +168,7 @@ public class AppcRunTasks {
appcMessage = appCClient.getErrorMessage();
mapRollbackVariables(execution, action, appcCode);
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
}
@@ -151,19 +182,19 @@ public class AppcRunTasks {
}
protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
- if (appcCode.equals("0") && action != null) {
+ if (appcCode != null && appcCode.equals("0") && action != null) {
if (action.equals(Action.Lock)) {
- execution.setVariable("rollbackVnfLock", true);
+ execution.setVariable(ROLLBACK_VNF_LOCK, true);
} else if (action.equals(Action.Unlock)) {
- execution.setVariable("rollbackVnfLock", false);
+ execution.setVariable(ROLLBACK_VNF_LOCK, false);
} else if (action.equals(Action.Start)) {
- execution.setVariable("rollbackVnfStop", false);
+ execution.setVariable(ROLLBACK_VNF_STOP, false);
} else if (action.equals(Action.Stop)) {
- execution.setVariable("rollbackVnfStop", true);
+ execution.setVariable(ROLLBACK_VNF_STOP, true);
} else if (action.equals(Action.QuiesceTraffic)) {
- execution.setVariable("rollbackQuiesceTraffic", true);
+ execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, true);
} else if (action.equals(Action.ResumeTraffic)) {
- execution.setVariable("rollbackQuiesceTraffic", false);
+ execution.setVariable(ROLLBACK_QUIESCE_TRAFFIC, false);
}
}
}
@@ -180,4 +211,45 @@ public class AppcRunTasks {
payloadInfo.put("vfModuleId", vfModuleId);
return payloadInfo;
}
+
+ protected void getVserversForAppc(BuildingBlockExecution execution, GenericVnf vnf) throws Exception {
+ AAIResultWrapper aaiRW = aaiVnfResources.queryVnfWrapperById(vnf);
+
+ if (aaiRW != null && aaiRW.getRelationships() != null && aaiRW.getRelationships().isPresent()) {
+ Relationships relationships = aaiRW.getRelationships().get();
+ if (relationships != null) {
+ List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
+ JSONArray vserverIds = new JSONArray();
+ JSONArray vserverSelfLinks = new JSONArray();
+ if (vserverUris != null) {
+ for (AAIResourceUri j : vserverUris) {
+ if (j != null) {
+ if (j.getURIKeys() != null) {
+ String vserverId = j.getURIKeys().get("vserver-id");
+ vserverIds.put(vserverId);
+ }
+ Optional<Vserver> oVserver = aaiVnfResources.getVserver(j);
+ if (oVserver.isPresent()) {
+ Vserver vserver = oVserver.get();
+ if (vserver != null) {
+ String vserverSelfLink = vserver.getVserverSelflink();
+ vserverSelfLinks.put(vserverSelfLink);
+ }
+ }
+ }
+ }
+ }
+
+ JSONObject vmidsArray = new JSONObject();
+ JSONObject vserveridsArray = new JSONObject();
+ vmidsArray.put("vmIds", vserverSelfLinks.toString());
+ vserveridsArray.put("vserverIds", vserverIds.toString());
+ logger.debug("vmidsArray is: {}", vmidsArray.toString());
+ logger.debug("vserveridsArray is: {}", vserveridsArray.toString());
+
+ execution.setVariable("vmIdList", vmidsArray.toString());
+ execution.setVariable("vserverIdList", vserveridsArray.toString());
+ }
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
index a223259d4d..922b721098 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
@@ -21,15 +21,21 @@
package org.onap.so.bpmn.infrastructure.audit;
+import java.util.List;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -60,6 +66,16 @@ public class AuditTasks {
}
}
+ public void isDeleteAuditNeeded(BuildingBlockExecution execution) {
+ try {
+ logger.debug("deleteAuditInventoryNeeded Value: {}", env.getProperty("mso.infra.deleteAuditInventory"));
+ execution.setVariable("auditInventoryNeeded",
+ Boolean.parseBoolean(env.getProperty("mso.infra.deleteAuditInventory")));
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
public void setupAuditVariable(BuildingBlockExecution execution) {
try {
execution.setVariable("auditInventory", createAuditInventory(execution));
@@ -73,12 +89,17 @@ public class AuditTasks {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ auditInventory.setMsoRequestId(gBBInput.getRequestContext().getMsoRequestId());
auditInventory.setCloudOwner(cloudRegion.getCloudOwner());
auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId());
auditInventory.setTenantId(cloudRegion.getTenantId());
+ auditInventory.setVfModuleId(vfModule.getVfModuleId());
auditInventory.setHeatStackName(vfModule.getVfModuleName());
+ auditInventory.setGenericVnfId(genericVnf.getVnfId());
return auditInventory;
}
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java
index ab8818f682..4b88f741de 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtils.java
@@ -54,9 +54,9 @@ public class AssignNetworkBBUtils {
* @return
*/
public boolean networkFoundByName(BuildingBlockExecution execution) throws Exception {
- boolean found = false;
+
// TODO - populate logic after iTrack MSO-2143 implemented
- return found;
+ return false;
}
/**
@@ -71,7 +71,7 @@ public class AssignNetworkBBUtils {
CloudRegion cloudRegion = gBBInput.getCloudRegion();
String cloudRegionSdnc;
String cloudRegionPo = cloudRegion.getLcpCloudRegionId();
- if (cloudRegion.getCloudRegionVersion().equalsIgnoreCase("2.5")) {
+ if ("2.5".equalsIgnoreCase(cloudRegion.getCloudRegionVersion())) {
cloudRegionSdnc = "AAIAIC25";
} else {
cloudRegionSdnc = cloudRegionPo;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
index 6e7ca5f4e5..6a8058938f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
@@ -1,15 +1,20 @@
-/*
- * ============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_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=========================================================
*/
@@ -40,9 +45,9 @@ import org.springframework.stereotype.Component;
@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";
+ private static final String ORIGINATOR_ID = "SO";
+ private static final String ACTION_NAME = "config-deploy";
+ private static final String MODE = "async";
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -57,7 +62,7 @@ public class ConfigDeployVnf {
* @param execution
*/
public void updateAAIConfigure(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+ aaiUpdateTask.updateOrchestrationStatusConfigDeployConfigureVnf(execution);
}
@@ -124,7 +129,7 @@ public class ConfigDeployVnf {
* @param execution
*/
public void updateAAIConfigured(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+ aaiUpdateTask.updateOrchestrationStatusConfigDeployConfiguredVnf(execution);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
index 1925d8b69f..ff9d7376de 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
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.appc.payload.beans.ConfigScaleOutPayload;
import org.onap.so.bpmn.appc.payload.beans.RequestParametersConfigScaleOut;
@@ -152,7 +153,7 @@ public class ConfigurationScaleOut {
appcMessage = appCClient.getErrorMessage();
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand in ConfigurationScaleOut", "BPMN",
ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
@@ -160,7 +161,7 @@ public class ConfigurationScaleOut {
logger.error("Error Message: " + appcMessage);
logger.error("ERROR CODE: " + appcCode);
logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
+ if (appcCode != null && !("0").equals(appcCode)) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
}
}
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 c2d9c6e7bb..b7ddc11f35 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
@@ -39,7 +39,7 @@ import org.springframework.stereotype.Component;
@Component
public class CreateNetwork {
- private static final Logger logger = LoggerFactory.getLogger(CreateNetwork.class);
+
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
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 4eaec381e9..36eab8f981 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
@@ -36,7 +36,7 @@ import org.springframework.stereotype.Component;
@Component
public class CreateNetworkCollection {
- private static final Logger logger = LoggerFactory.getLogger(CreateNetworkCollection.class);
+
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
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 98b602eca1..1a7d22c0dd 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
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.HashMap;
import java.util.Optional;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -45,6 +46,9 @@ import org.springframework.stereotype.Component;
public class GenericVnfHealthCheck {
private static final Logger logger = LoggerFactory.getLogger(GenericVnfHealthCheck.class);
+ public static final String VNF_NAME = "vnfName";
+ public static final String OAM_IP_ADDRESS = "oamIpAddress";
+ public static final String VNF_HOST_IP_ADDRESS = "vnfHostIpAddress";
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -71,9 +75,9 @@ public class GenericVnfHealthCheck {
String controllerName = controllerSelectionReference.getControllerName();
execution.setVariable("vnfId", vnfId);
- execution.setVariable("vnfName", vnfName);
- execution.setVariable("oamIpAddress", oamIpAddress);
- execution.setVariable("vnfHostIpAddress", oamIpAddress);
+ execution.setVariable(VNF_NAME, vnfName);
+ execution.setVariable(OAM_IP_ADDRESS, oamIpAddress);
+ execution.setVariable(VNF_HOST_IP_ADDRESS, oamIpAddress);
execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("action", actionCategory);
execution.setVariable("controllerType", controllerName);
@@ -98,11 +102,11 @@ public class GenericVnfHealthCheck {
payload = Optional.of(pay);
}
String controllerType = execution.getVariable("controllerType");
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
- payloadInfo.put("vnfName", execution.getVariable("vnfName"));
+ HashMap<String, String> payloadInfo = new HashMap<>();
+ payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME));
payloadInfo.put("vfModuleId", execution.getVariable("vfModuleId"));
- payloadInfo.put("oamIpAddress", execution.getVariable("oamIpAddress"));
- payloadInfo.put("vnfHostIpAddress", execution.getVariable("vnfHostIpAddress"));
+ payloadInfo.put(OAM_IP_ADDRESS, execution.getVariable(OAM_IP_ADDRESS));
+ payloadInfo.put(VNF_HOST_IP_ADDRESS, execution.getVariable(VNF_HOST_IP_ADDRESS));
logger.debug("Running APP-C action: {}", action.toString());
logger.debug("VNFID: {}", vnfId);
@@ -111,19 +115,19 @@ public class GenericVnfHealthCheck {
appcCode = appCClient.getErrorCode();
appcMessage = appCClient.getErrorMessage();
} catch (BpmnError ex) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
"Caught exception in GenericVnfHealthCheck", "BPMN", ErrorCode.UnknownError.getValue(), ex);
appcMessage = ex.getMessage();
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
} catch (Exception e) {
if (e instanceof java.util.concurrent.TimeoutException) {
appcMessage = "Request to APPC timed out. ";
- logger.error("{} {} {} {} {}", MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONNECTION_EXCEPTION.toString(),
"Caught timedOut exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
ErrorCode.UnknownError.getValue(), "APPC Error", e);
throw e;
} else {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
"Caught exception in runAppcCommand in GenericVnfHealthCheck", "BPMN",
ErrorCode.UnknownError.getValue(), "APPC Error", e);
appcMessage = e.getMessage();
@@ -133,7 +137,7 @@ public class GenericVnfHealthCheck {
logger.error("Error Message: " + appcMessage);
logger.error("ERROR CODE: " + appcCode);
logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
+ if (appcCode != null && !("0").equals(appcCode)) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
}
}
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 27415190cc..c9a937b824 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
@@ -30,19 +30,16 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAINetworkResources;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UnassignNetworkBB {
- private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class);
- private static String MESSAGE_CANNOT_PERFORM_UNASSIGN =
+ private static String messageCannotPerformUnassign =
"Cannot perform Unassign Network. Network is still related to ";
- private static String MESSAGE_ERROR_ROLLBACK = " Rollback is not possible. Please restore data manually.";
+ private static String messageErrorRollback = " Rollback is not possible. Please restore data manually.";
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -62,17 +59,17 @@ public class UnassignNetworkBB {
* @param execution - BuildingBlockExecution
* @param relatedToValue - String, ex: vf-module
* @return void - nothing
- * @throws Exception
+ *
*/
- public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) throws Exception {
+ public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<org.onap.aai.domain.yang.L3Network> network =
aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
- String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue;
+ String msg = messageCannotPerformUnassign + relatedToValue;
execution.setVariable("ErrorUnassignNetworkBB", msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
@@ -86,10 +83,10 @@ public class UnassignNetworkBB {
*
* @param execution - BuildingBlockExecution
* @return void - nothing
- * @throws Exception
+ *
*/
- public void getCloudSdncRegion(BuildingBlockExecution execution) throws Exception {
+ public void getCloudSdncRegion(BuildingBlockExecution execution) {
try {
String cloudRegionSdnc = networkBBUtils.getCloudRegion(execution, SourceSystem.SDNC);
execution.setVariable("cloudRegionSdnc", cloudRegionSdnc);
@@ -108,8 +105,8 @@ public class UnassignNetworkBB {
String msg;
boolean isRollbackNeeded =
execution.getVariable("isRollbackNeeded") != null ? execution.getVariable("isRollbackNeeded") : false;
- if (isRollbackNeeded == true) {
- msg = execution.getVariable("ErrorUnassignNetworkBB") + MESSAGE_ERROR_ROLLBACK;
+ if (isRollbackNeeded) {
+ msg = execution.getVariable("ErrorUnassignNetworkBB") + messageErrorRollback;
} else {
msg = execution.getVariable("ErrorUnassignNetworkBB");
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
index e51774c12c..0afca71b99 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
@@ -30,12 +30,15 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component()
public class UnassignVnf {
+ private static final Logger logger = LoggerFactory.getLogger(UnassignVnf.class);
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -45,6 +48,17 @@ public class UnassignVnf {
@Autowired
private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator;
+ /**
+ * BPMN access method to deleting instanceGroup in AAI.
+ *
+ * It will extract the vnf from BBobject ,It will get the instance group from the vnf and add it into a list.
+ *
+ * Then iterate that list and check the ModelInfoInstanceGroup type.
+ *
+ * Then it will delete that.
+ *
+ * @param execution
+ */
public void deleteInstanceGroups(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -56,6 +70,7 @@ public class UnassignVnf {
}
}
} catch (Exception ex) {
+ logger.error("Exception occurred in UnassignVnf deleteInstanceGroups", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
index b906b8a662..7e45c3b640 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
@@ -1,11 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.manualhandling.tasks;
import java.util.Map;
import java.util.HashMap;
+import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateTask;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.ticket.ExternalTicket;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -23,6 +45,14 @@ public class ManualHandlingTasks {
private static final String TASK_TYPE_PAUSE = "pause";
private static final String TASK_TYPE_FALLOUT = "fallout";
+ public static final String VNF_TYPE = "vnfType";
+ public static final String SERVICE_TYPE = "serviceType";
+ public static final String MSO_REQUEST_ID = "mso-request-id";
+ public static final String REQUESTOR_ID = "requestorId";
+ public static final String ERROR_CODE = "errorCode";
+ public static final String VALID_RESPONSES = "validResponses";
+ public static final String DESCRIPTION = "description";
+ public static final String BPMN_EXCEPTION = "BPMN exception: ";
@Autowired
private ExceptionBuilder exceptionUtil;
@@ -37,39 +67,39 @@ public class ManualHandlingTasks {
String taskId = task.getId();
logger.debug("taskId is: " + taskId);
String type = TASK_TYPE_FALLOUT;
- String nfRole = (String) execution.getVariable("vnfType");
- String subscriptionServiceType = (String) execution.getVariable("serviceType");
- String originalRequestId = (String) execution.getVariable("msoRequestId");
- String originalRequestorId = (String) execution.getVariable("requestorId");
+ String nfRole = (String) execution.getVariable(VNF_TYPE);
+ String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE);
+ String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID);
+ String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID);
String description = "";
String timeout = "";
String errorSource = (String) execution.getVariable("failedActivity");
- String errorCode = (String) execution.getVariable("errorCode");
+ String errorCode = (String) execution.getVariable(ERROR_CODE);
String errorMessage = (String) execution.getVariable("errorText");
String buildingBlockName = (String) execution.getVariable("currentActivity");
String buildingBlockStep = (String) execution.getVariable("workStep");
- String validResponses = (String) execution.getVariable("validResponses");
+ String validResponses = (String) execution.getVariable(VALID_RESPONSES);
- Map<String, String> taskVariables = new HashMap<String, String>();
+ Map<String, String> taskVariables = new HashMap<>();
taskVariables.put("type", type);
taskVariables.put("nfRole", nfRole);
taskVariables.put("subscriptionServiceType", subscriptionServiceType);
taskVariables.put("originalRequestId", originalRequestId);
taskVariables.put("originalRequestorId", originalRequestorId);
taskVariables.put("errorSource", errorSource);
- taskVariables.put("errorCode", errorCode);
+ taskVariables.put(ERROR_CODE, errorCode);
taskVariables.put("errorMessage", errorMessage);
taskVariables.put("buildingBlockName", buildingBlockName);
taskVariables.put("buildingBlockStep", buildingBlockStep);
- taskVariables.put("validResponses", validResponses);
+ taskVariables.put(VALID_RESPONSES, validResponses);
taskVariables.put("tmeout", timeout);
- taskVariables.put("description", description);
+ taskVariables.put(DESCRIPTION, description);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
taskService.setVariables(taskId, taskVariables);
logger.debug("successfully created fallout task: " + taskId);
} catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
+ logger.debug(BPMN_EXCEPTION + e.getMessage());
throw e;
} catch (Exception ex) {
String msg = "Exception in setFalloutTaskVariables " + ex.getMessage();
@@ -86,39 +116,39 @@ public class ManualHandlingTasks {
String taskId = task.getId();
logger.debug("taskId is: " + taskId);
String type = TASK_TYPE_PAUSE;
- String nfRole = (String) execution.getVariable("vnfType");
- String subscriptionServiceType = (String) execution.getVariable("serviceType");
- String originalRequestId = (String) execution.getVariable("msoRequestId");
- String originalRequestorId = (String) execution.getVariable("requestorId");
- String description = (String) execution.getVariable("description");
- String timeout = (String) execution.getVariable("taskTimeout");
+ String nfRole = (String) execution.getVariable(VNF_TYPE);
+ String subscriptionServiceType = (String) execution.getVariable(SERVICE_TYPE);
+ String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID);
+ String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID);
+ String description = (String) execution.getVariable(DESCRIPTION);
+ String timeout = "";
String errorSource = "";
String errorCode = "";
String errorMessage = "";
String buildingBlockName = "";
String buildingBlockStep = "";
- String validResponses = (String) execution.getVariable("validResponses");
+ String validResponses = (String) execution.getVariable(VALID_RESPONSES);
- Map<String, String> taskVariables = new HashMap<String, String>();
+ Map<String, String> taskVariables = new HashMap<>();
taskVariables.put("type", type);
taskVariables.put("nfRole", nfRole);
- taskVariables.put("description", description);
+ taskVariables.put(DESCRIPTION, description);
taskVariables.put("timeout", timeout);
taskVariables.put("subscriptionServiceType", subscriptionServiceType);
taskVariables.put("originalRequestId", originalRequestId);
taskVariables.put("originalRequestorId", originalRequestorId);
taskVariables.put("errorSource", errorSource);
- taskVariables.put("errorCode", errorCode);
+ taskVariables.put(ERROR_CODE, errorCode);
taskVariables.put("errorMessage", errorMessage);
taskVariables.put("buildingBlockName", buildingBlockName);
taskVariables.put("buildingBlockStep", buildingBlockStep);
- taskVariables.put("validResponses", validResponses);
+ taskVariables.put(VALID_RESPONSES, validResponses);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
taskService.setVariables(taskId, taskVariables);
logger.debug("successfully created pause task: " + taskId);
} catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
+ logger.debug(BPMN_EXCEPTION + e.getMessage());
throw e;
} catch (Exception ex) {
String msg = "Exception in setPauseTaskVariables " + ex.getMessage();
@@ -149,7 +179,7 @@ public class ManualHandlingTasks {
execution.setVariable("responseValueTask", responseValueUppercaseStart);
} catch (BpmnError e) {
- logger.debug("BPMN exception: " + e.getMessage());
+ logger.debug(BPMN_EXCEPTION + e.getMessage());
throw e;
} catch (Exception ex) {
String msg = "Exception in completeManualTask " + ex.getMessage();
@@ -159,39 +189,39 @@ public class ManualHandlingTasks {
}
- public void createExternalTicket(DelegateExecution execution) {
+ public void createExternalTicket(BuildingBlockExecution execution) {
try {
ExternalTicket ticket = new ExternalTicket();
- ticket.setRequestId((String) execution.getVariable("msoRequestId"));
+ ticket.setRequestId((String) execution.getVariable(MSO_REQUEST_ID));
ticket.setCurrentActivity((String) execution.getVariable("currentActivity"));
- ticket.setNfRole((String) execution.getVariable("vnfType"));
- ticket.setDescription((String) execution.getVariable("description"));
- ticket.setSubscriptionServiceType((String) execution.getVariable("serviceType"));
- ticket.setRequestorId((String) execution.getVariable("requestorId"));
+ ticket.setNfRole((String) execution.getVariable(VNF_TYPE));
+ ticket.setDescription((String) execution.getVariable(DESCRIPTION));
+ ticket.setSubscriptionServiceType((String) execution.getVariable(SERVICE_TYPE));
+ ticket.setRequestorId((String) execution.getVariable(REQUESTOR_ID));
ticket.setTimeout((String) execution.getVariable("taskTimeout"));
ticket.setErrorSource((String) execution.getVariable("failedActivity"));
- ticket.setErrorCode((String) execution.getVariable("errorCode"));
+ ticket.setErrorCode((String) execution.getVariable(ERROR_CODE));
ticket.setErrorMessage((String) execution.getVariable("errorText"));
ticket.setWorkStep((String) execution.getVariable("workStep"));
ticket.createTicket();
} catch (BpmnError e) {
String msg = "BPMN error in createAOTSTicket " + e.getMessage();
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
ErrorCode.UnknownError.getValue());
} catch (Exception ex) {
String msg = "Exception in createExternalTicket " + ex.getMessage();
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
+ logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN",
ErrorCode.UnknownError.getValue());
}
}
- public void updateRequestDbStatus(DelegateExecution execution, String status) {
+ public void updateRequestDbStatus(BuildingBlockExecution execution, String status) {
try {
- String requestId = (String) execution.getVariable("msoRequestId");
+ String requestId = (String) execution.getVariable(MSO_REQUEST_ID);
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
request.setRequestStatus(status);
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 d248ad5443..ea0b408e41 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
@@ -20,12 +20,28 @@
package org.onap.so.bpmn.infrastructure.namingservice.tasks;
-
+import java.util.List;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Zone;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.namingservice.NamingRequestObject;
+import org.onap.so.client.namingservice.NamingServiceConstants;
import org.onap.so.client.orchestration.NamingServiceResources;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -40,6 +56,14 @@ public class NamingServiceCreateTasks {
@Autowired
private NamingServiceResources namingServiceResources;
+ @Autowired
+ protected InjectionHelper injectionHelper;
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+
+ public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
+ this.bbInputSetupUtils = bbInputSetupUtils;
+ }
public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
@@ -54,4 +78,46 @@ public class NamingServiceCreateTasks {
}
instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
}
+
+ public void createWanTransportServiceName(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ NamingRequestObject namingRequestObject = new NamingRequestObject();
+ namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
+ namingRequestObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
+ namingRequestObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
+ namingRequestObject.setPolicyInstanceNameValue(serviceInstance.getModelInfoServiceInstance().getNamingPolicy());
+ namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName());
+ namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+
+ String generatedWanTransportServiceName = "";
+ try {
+ generatedWanTransportServiceName = namingServiceResources.generateServiceInstanceName(namingRequestObject);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ serviceInstance.setServiceInstanceName(generatedWanTransportServiceName);
+ }
+
+ public void createVpnBondingServiceName(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ VpnBinding vpnBinding = extractPojosForBB.extractByKey(execution, ResourceKey.VPN_ID);
+ NamingRequestObject namingRequestObject = new NamingRequestObject();
+ namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
+ namingRequestObject.setPolicyInstanceNameValue(serviceInstance.getModelInfoServiceInstance().getNamingPolicy());
+ namingRequestObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
+ namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName());
+ namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion());
+ namingRequestObject.setNetworkNameValue(network.getNetworkName());
+ namingRequestObject.setVpnNameValue(vpnBinding.getVpnName());
+ namingRequestObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
+
+ String generatedVpnBondingServiceName = "";
+ try {
+ generatedVpnBondingServiceName = namingServiceResources.generateServiceInstanceName(namingRequestObject);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ serviceInstance.setServiceInstanceName(generatedVpnBondingServiceName);
+ }
}
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 9a8c9df8b5..507e14e42a 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
@@ -23,9 +23,11 @@ package org.onap.so.bpmn.infrastructure.namingservice.tasks;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.namingservice.NamingRequestObject;
import org.onap.so.client.orchestration.NamingServiceResources;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -50,4 +52,16 @@ public class NamingServiceDeleteTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
+ public void deleteServiceInstanceName(BuildingBlockExecution execution) throws Exception {
+ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ NamingRequestObject namingRequestObject = new NamingRequestObject();
+ namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
+ try {
+ namingServiceResources.deleteServiceInstanceName(namingRequestObject);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
index d76d860b3b..b8f025aaa6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/exceptions/SDNCErrorResponseException.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.sdnc.exceptions;
public class SDNCErrorResponseException extends Exception {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java
new file mode 100644
index 0000000000..c134f31b42
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/AbstractSDNCTask.java
@@ -0,0 +1,22 @@
+package org.onap.so.bpmn.infrastructure.sdnc.tasks;
+
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AbstractSDNCTask {
+
+ @Autowired
+ Environment env;
+
+
+ public URI buildCallbackURI(SDNCRequest sdncRequest) {
+ UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint"))
+ .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue());
+ return builder.build();
+ }
+}
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 7a0008d5a2..f61b40ad23 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
@@ -46,11 +46,14 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class SDNCActivateTasks {
+public class SDNCActivateTasks extends AbstractSDNCTask {
+
private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class);
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCVnfResources sdncVnfResources;
@Autowired
@@ -61,8 +64,16 @@ public class SDNCActivateTasks {
private SDNCNetworkResources sdncNetworkResources;
@Autowired
private SDNCVfModuleResources sdncVfModuleResources;
+ @Autowired
+ private Environment env;
-
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for activate the vnf.
+ *
+ * @param execution
+ */
public void activateVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -72,20 +83,21 @@ public class SDNCActivateTasks {
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);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(vnf, serviceInstance, customer,
+ cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCActivateTasks activateVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to perform Assign action on SDNC for L3Network
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -103,12 +115,19 @@ public class SDNCActivateTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for activate the activateVfModule.
+ *
+ * @param execution
+ */
public void activateVfModule(BuildingBlockExecution execution) {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
@@ -121,13 +140,14 @@ public class SDNCActivateTasks {
vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf,
- serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf,
+ serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCActivateTasks activateVfModule process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
index d3878f06b7..b8f5c8629d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
@@ -49,11 +49,17 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+/*
+ * This class is used for creating the service instance, assigning vnf, assigning the Vfmodule & assigning the L3Network
+ * on SDNC.
+ */
@Component
-public class SDNCAssignTasks {
+public class SDNCAssignTasks extends AbstractSDNCTask {
private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class);
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCServiceInstanceResources sdncSIResources;
@Autowired
@@ -66,7 +72,16 @@ public class SDNCAssignTasks {
private ExtractPojosForBB extractPojosForBB;
@Autowired
private SDNCNetworkResources sdncNetworkResources;
+ @Autowired
+ private Environment env;
+ /**
+ * BPMN access method to assigning the service instance in SDNC.
+ *
+ * It will assign the service instance by the service instance id.
+ *
+ * @param execution
+ */
public void assignServiceInstance(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -79,12 +94,20 @@ public class SDNCAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to assigning the vnf in SDNC.
+ *
+ * It will assign the vnf according to the service instance id and vnf id.
+ *
+ * @param execution
+ */
public void assignVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -94,17 +117,27 @@ public class SDNCAssignTasks {
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()));
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext,
+ Boolean.TRUE.equals(vnf.isCallHoming()), buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
+ /**
+ * BPMN access method to assigning the vfModule in SDNC.
+ *
+ * It will assign the VfModule by the service instance id ,Vnf id and module id.
+ *
+ * @param execution
+ */
public void assignVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -121,13 +154,15 @@ public class SDNCAssignTasks {
}
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.assignVfModule(vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVfModuleOperationInformation req =
+ sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -152,7 +187,7 @@ public class SDNCAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
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 50cf0fb074..c5ebc5e447 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
@@ -43,10 +43,12 @@ import org.onap.so.client.orchestration.SDNCVnfResources;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class SDNCChangeAssignTasks {
+public class SDNCChangeAssignTasks extends AbstractSDNCTask {
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCNetworkResources sdncNetworkResources;
@Autowired
@@ -59,6 +61,8 @@ public class SDNCChangeAssignTasks {
private ExceptionBuilder exceptionUtil;
@Autowired
private SDNCVfModuleResources sdncVfModuleResources;
+ @Autowired
+ private Environment env;
public void changeModelServiceInstance(BuildingBlockExecution execution) {
try {
@@ -70,7 +74,7 @@ public class SDNCChangeAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -82,12 +86,13 @@ public class SDNCChangeAssignTasks {
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();
+ GenericResourceApiVnfOperationInformation req =
+ sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(),
+ gBBInput.getCloudRegion(), gBBInput.getRequestContext(), buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -104,7 +109,7 @@ public class SDNCChangeAssignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -120,12 +125,12 @@ public class SDNCChangeAssignTasks {
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();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule,
+ vnf, serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
index 3a1528946d..96b656ff95 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
@@ -47,11 +47,14 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class SDNCDeactivateTasks {
+public class SDNCDeactivateTasks extends AbstractSDNCTask {
+
private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class);
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCNetworkResources sdncNetworkResources;
@Autowired
@@ -64,7 +67,15 @@ public class SDNCDeactivateTasks {
private ExceptionBuilder exceptionUtil;
@Autowired
private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private Environment env;
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object. Which is used for deactivate
+ * VfModule.
+ *
+ * @param execution
+ */
public void deactivateVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -75,20 +86,21 @@ public class SDNCDeactivateTasks {
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, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf,
+ serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to perform Service Topology Deactivate action on SDNC for Vnf
- *
+ *
* @param execution
* @throws Exception
*/
@@ -102,22 +114,23 @@ public class SDNCDeactivateTasks {
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);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(vnf, serviceInstance,
+ customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/*
* BPMN access method to perform Service Topology Deactivate action on SDNC for Service Instance
- *
+ *
* @param execution
- *
+ *
* @throws Exception
*/
public void deactivateServiceInstance(BuildingBlockExecution execution) throws Exception {
@@ -132,15 +145,16 @@ public class SDNCDeactivateTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateServiceInstance", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to invoke deactivate on a L3Network object
- *
+ *
* @param execution
*/
public void deactivateNetwork(BuildingBlockExecution execution) {
@@ -157,8 +171,9 @@ public class SDNCDeactivateTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 7ae6117c61..080d6d34b1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -29,17 +29,24 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.SDNCVnfResources;
+import org.onap.so.utils.TargetEntity;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+/**
+ * This class is used for querying the SDNC.
+ */
@Component
public class SDNCQueryTasks {
private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class);
+ private static final String NO_RESPONSE_FROM_SDNC = "Error did not receive a response from SDNC.";
+ public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_";
@Autowired
private SDNCVnfResources sdncVnfResources;
@Autowired
@@ -49,6 +56,14 @@ public class SDNCQueryTasks {
@Autowired
private ExtractPojosForBB extractPojosForBB;
+ /**
+ * BPMN access method to query the SDNC for fetching the vnf details.
+ *
+ * It will get the vnf details according to service instance id.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void queryVnf(BuildingBlockExecution execution) throws Exception {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -61,13 +76,29 @@ public class SDNCQueryTasks {
genericVnf.setSelflink(selfLink);
}
String response = sdncVnfResources.queryVnf(genericVnf);
- execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), response);
+ execution.setVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId(), response);
+ } catch (BadResponseException ex) {
+ logger.error("Exception occurred", ex);
+ if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ }
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ logger.error("Exception occurred", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
+ /**
+ * BPMN access method to query the SDNC for fetching the VfModule details.
+ *
+ * It will get the vnf details according to service instance id, vnf id & Vf module id.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void queryVfModule(BuildingBlockExecution execution) throws Exception {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -82,36 +113,63 @@ public class SDNCQueryTasks {
}
if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
String response = sdncVfModuleResources.queryVfModule(vfModule);
- execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response);
+ execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response);
} else {
throw new Exception("Vf Module " + vfModule.getVfModuleId()
+ " exists in gBuildingBlock but does not have a selflink value");
}
+ } catch (BadResponseException ex) {
+ logger.error("Exception occurred for BadResponse ", ex);
+ if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ }
} catch (Exception ex) {
+ logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to query the SDNC for fetching the VfModuleForVolumeGroup details.
+ *
+ * It will get the vnf details according to Vf module id.
+ *
+ * @param execution @throws
+ */
public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) {
try {
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);
+ execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response);
} else {
throw new Exception("Vf Module " + vfModule.getVfModuleId()
+ " exists in gBuildingBlock but does not have a selflink value");
}
} catch (BBObjectNotFoundException bbException) {
- // If there is not a vf module in the general building block, we will not call SDNC and proceed as normal
+ logger.error("Error occurred if bb object not found in SDNCQueryTasks queryVfModuleForVolumeGroup ",
+ bbException);
+ // If there is not a vf module in the general building block, we will not call
+ // SDNC and proceed as normal
// without throwing an error
- // If we see a bb object not found exception for something that is not a vf module id, then we should throw
+ // If we see a bb object not found exception for something that is not a vf
+ // module id, then we should throw
// the error as normal
if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO);
+ }
+ } catch (BadResponseException ex) {
+ logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex);
+ if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ logger.error("Exception occurred", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index f32ffd72c3..03714db943 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -21,8 +21,13 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import java.io.StringReader;
+import java.io.StringWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -32,6 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
+import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -74,17 +80,19 @@ public class SDNCRequestTasks {
} catch (PathNotFoundException e) {
logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Recieved invalid response from SDNC, unable to read message content.");
+ "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO);
} catch (MapperException e) {
logger.error("Failed to map SDNC object to JSON prior to POST.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Failed to map SDNC object to JSON prior to POST.");
+ "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO);
} catch (BadResponseException e) {
logger.error("Did not receive a successful response from SDNC.", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(),
+ TargetEntity.SDNC);
} catch (HttpClientErrorException e) {
logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.");
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.",
+ TargetEntity.SO);
}
}
@@ -98,27 +106,34 @@ public class SDNCRequestTasks {
Document doc = db.parse(new InputSource(new StringReader(asyncRequest)));
String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator");
+
boolean isCallbackCompleted = convertIndicatorToBoolean(finalMessageIndicator);
execution.setVariable(IS_CALLBACK_COMPLETED, isCallbackCompleted);
if (isCallbackCompleted) {
String responseCode = getXmlElement(doc, "/input/response-code");
- String responseMessage = getXmlElement(doc, "/input/response-message");
if (!SDNC_SUCCESS.equalsIgnoreCase(responseCode)) {
+ String responseMessage;
+ try {
+ responseMessage = getXmlElement(doc, "/input/response-message");
+ } catch (Exception e) {
+ responseMessage = "Unknown Error in SDNC";
+ }
throw new SDNCErrorResponseException(responseMessage);
}
}
} catch (SDNCErrorResponseException e) {
logger.error("SDNC error response - " + e.getMessage());
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
} catch (Exception e) {
- logger.error("Error procesing SDNC callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error procesing SDNC callback");
+ logger.error("Error processing SDNC callback", e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback",
+ TargetEntity.SO);
}
}
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on SDNC Async-Response");
+ "Error timed out waiting on SDNC Async-Response", TargetEntity.SO);
}
protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
@@ -126,8 +141,16 @@ public class SDNCRequestTasks {
}
protected String getXmlElement(Document doc, String exp) throws Exception {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer transformer = tf.newTransformer();
+ StringWriter writer = new StringWriter();
+ transformer.transform(new DOMSource(doc), new StreamResult(writer));
+ logger.debug(writer.getBuffer().toString());
XPath xPath = XPathFactory.newInstance().newXPath();
- return xPath.evaluate(exp, doc);
+ String result = xPath.evaluate(exp, doc);
+ if (result == null || result.isEmpty()) {
+ throw new Exception("XPath Failed to find element expression: " + exp);
+ }
+ return result;
}
-
}
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 e9848d1646..4817ba8b61 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
@@ -47,11 +47,14 @@ import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class SDNCUnassignTasks {
+public class SDNCUnassignTasks extends AbstractSDNCTask {
+
private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class);
+ public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCServiceInstanceResources sdncSIResources;
@Autowired
@@ -64,7 +67,16 @@ public class SDNCUnassignTasks {
private ExtractPojosForBB extractPojosForBB;
@Autowired
private SDNCNetworkResources sdncNetworkResources;
+ @Autowired
+ private Environment env;
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the ServiceInstance.
+ *
+ * @param execution
+ */
public void unassignServiceInstance(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -77,29 +89,47 @@ public class SDNCUnassignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.SERVICE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignServiceInstance", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the VfModule.
+ *
+ * @param execution
+ */
public void unassignVfModule(BuildingBlockExecution execution) {
try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ RequestContext requestContext = gBBInput.getRequestContext();
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericResourceApiVfModuleOperationInformation req =
- sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf,
+ serviceInstance, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the Vnf.
+ *
+ * @param execution
+ */
public void unassignVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -109,17 +139,25 @@ public class SDNCUnassignTasks {
RequestContext requestContext = gBBInput.getRequestContext();
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- GenericResourceApiVnfOperationInformation req =
- sdncVnfResources.unassignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext);
SDNCRequest sdncRequest = new SDNCRequest();
+ GenericResourceApiVnfOperationInformation req = sdncVnfResources.unassignVnf(vnf, serviceInstance, customer,
+ cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VNF);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the Network.
+ *
+ * @param execution
+ */
public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -136,8 +174,9 @@ public class SDNCUnassignTasks {
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
- execution.setVariable("SDNCRequest", sdncRequest);
+ execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
index 47855eaa6e..52d294955a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
@@ -23,10 +23,10 @@ package org.onap.so.bpmn.infrastructure.validations;
import java.util.Optional;
import java.util.regex.Pattern;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.validation.PreBuildingBlockValidator;
-import org.onap.so.bpmn.common.validation.Skip;
+import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.listener.Skip;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
new file mode 100644
index 0000000000..1852485083
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Samsung Electronics 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
+
+import java.util.List;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+public class ConfigBuildingBlocksDataObject {
+
+ private ServiceInstancesRequest sIRequest;
+ private List<OrchestrationFlow> orchFlows;
+ private String requestId;
+ private Resource resourceKey;
+ private String apiVersion;
+ private String resourceId;
+ private String requestAction;
+ private boolean aLaCarte;
+ private String vnfType;
+ private WorkflowResourceIds workflowResourceIds;
+ private RequestDetails requestDetails;
+ private DelegateExecution execution;
+
+ public ServiceInstancesRequest getsIRequest() {
+ return sIRequest;
+ }
+
+ public ConfigBuildingBlocksDataObject setsIRequest(ServiceInstancesRequest sIRequest) {
+ this.sIRequest = sIRequest;
+ return this;
+ }
+
+ public List<OrchestrationFlow> getOrchFlows() {
+ return orchFlows;
+ }
+
+ public ConfigBuildingBlocksDataObject setOrchFlows(List<OrchestrationFlow> orchFlows) {
+ this.orchFlows = orchFlows;
+ return this;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public ConfigBuildingBlocksDataObject setRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
+ }
+
+ public Resource getResourceKey() {
+ return resourceKey;
+ }
+
+ public ConfigBuildingBlocksDataObject setResourceKey(Resource resourceKey) {
+ this.resourceKey = resourceKey;
+ return this;
+ }
+
+ public String getApiVersion() {
+ return apiVersion;
+ }
+
+ public ConfigBuildingBlocksDataObject setApiVersion(String apiVersion) {
+ this.apiVersion = apiVersion;
+ return this;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public ConfigBuildingBlocksDataObject setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ return this;
+ }
+
+ public String getRequestAction() {
+ return requestAction;
+ }
+
+ public ConfigBuildingBlocksDataObject setRequestAction(String requestAction) {
+ this.requestAction = requestAction;
+ return this;
+ }
+
+ public boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public ConfigBuildingBlocksDataObject setaLaCarte(boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ return this;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public ConfigBuildingBlocksDataObject setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ return this;
+ }
+
+ public WorkflowResourceIds getWorkflowResourceIds() {
+ return workflowResourceIds;
+ }
+
+ public ConfigBuildingBlocksDataObject setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
+ this.workflowResourceIds = workflowResourceIds;
+ return this;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public ConfigBuildingBlocksDataObject setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ return this;
+ }
+
+ public DelegateExecution getExecution() {
+ return execution;
+ }
+
+ public ConfigBuildingBlocksDataObject setExecution(DelegateExecution execution) {
+ this.execution = execution;
+ return this;
+ }
+
+
+
+}
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 4fcacb3c42..8822bc39dd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -55,7 +55,6 @@ public class OrchestrationStatusValidator {
private static final String MULTI_STAGE_DESIGN_OFF = "false";
private static final String MULTI_STAGE_DESIGN_ON = "true";
-
@Autowired
private ExtractPojosForBB extractPojosForBB;
@Autowired
@@ -63,6 +62,12 @@ public class OrchestrationStatusValidator {
@Autowired
private CatalogDbClient catalogDbClient;
+
+ /**
+ * This method validate's the status of the OrchestrationStatus against the buildingBlockDetail ResourceType
+ *
+ * @param execution
+ */
public void validateOrchestrationStatus(BuildingBlockExecution execution) {
try {
OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult =
@@ -132,7 +137,8 @@ public class OrchestrationStatusValidator {
OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
return;
default:
- // can't currently get here, so not tested. Added in case enum is expanded without a change to this
+ // can't currently get here, so not tested. Added in case enum is expanded
+ // without a change to this
// code
throw new OrchestrationStatusValidationException(
String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName,
@@ -167,6 +173,9 @@ public class OrchestrationStatusValidator {
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
orchestrationStatusStateTransitionDirective.getFlowDirective());
} catch (BBObjectNotFoundException ex) {
+ logger.error(
+ "Error occurred for bb object notfound in OrchestrationStatusValidator validateOrchestrationStatus ",
+ ex);
if (execution.getFlowToBeCalled().contains("Unassign")) {
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
OrchestrationStatusValidationDirective.SILENT_SUCCESS);
@@ -174,6 +183,7 @@ public class OrchestrationStatusValidator {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
}
} catch (Exception e) {
+ logger.error("Exception occurred", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfBondingServiceException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfBondingServiceException.java
new file mode 100644
index 0000000000..0584472e14
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfBondingServiceException.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
+
+public class VrfBondingServiceException extends Exception {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4277883464681291740L;
+
+ public VrfBondingServiceException(String errorMessage) {
+ super(errorMessage);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java
new file mode 100644
index 0000000000..1e0208b6ec
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java
@@ -0,0 +1,163 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
+
+import java.util.List;
+import java.util.Optional;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class VrfValidation {
+
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+
+ public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
+ this.bbInputSetupUtils = bbInputSetupUtils;
+ }
+
+ protected void vrfServiceValidation(org.onap.so.db.catalog.beans.Service service)
+ throws VrfBondingServiceException {
+ if (!"BONDING".equalsIgnoreCase(service.getServiceType())
+ || !"INFRASTRUCTURE-VPN".equalsIgnoreCase(service.getServiceRole())) {
+ throw new VrfBondingServiceException("Service: " + service.getModelName()
+ + " does not have service type of BONDING and does not have service role of INFRASTRUCTURE-VPN");
+ }
+ }
+
+ protected void vrfCatalogDbChecks(org.onap.so.db.catalog.beans.Service service) throws VrfBondingServiceException {
+ ConfigurationResourceCustomization configuration = getVrfConfiguration(service);
+ if (configuration == null || configuration.getServiceProxyResourceCustomization() == null
+ || configuration.getServiceProxyResourceCustomization().getSourceService() == null
+ || !configuration.getServiceProxyResourceCustomization().getSourceService().getServiceType()
+ .equalsIgnoreCase("TRANSPORT")) {
+ throw new VrfBondingServiceException("Service: " + service.getModelName()
+ + " does not have a configuration of type VRF-ENTRY and role INFRASTRUCTURE-CLOUD-VPN"
+ + ", and serviceProxy that does not have source service that has a serviceType of TRANSPORT)");
+ }
+ }
+
+ protected ConfigurationResourceCustomization getVrfConfiguration(org.onap.so.db.catalog.beans.Service service) {
+ for (ConfigurationResourceCustomization configuration : service.getConfigurationCustomizations()) {
+ if (configuration.getType() != null && configuration.getType().equalsIgnoreCase("VRF-ENTRY")
+ && configuration.getRole() != null
+ && configuration.getRole().equalsIgnoreCase("INFRASTRUCTURE-CLOUD-VPN")) {
+ return configuration;
+ }
+ }
+ return null;
+ }
+
+ protected void aaiVpnBindingValidation(String relatedVpnId, org.onap.aai.domain.yang.VpnBinding aaiVpnBinding)
+ throws VrfBondingServiceException {
+ if (aaiVpnBinding == null) {
+ throw new VrfBondingServiceException("The infrastructure vpn " + relatedVpnId + " does not exist in A&AI.");
+ } else if (aaiVpnBinding.getVpnType() != null
+ && !aaiVpnBinding.getVpnType().equalsIgnoreCase("SERVICE-INFRASTRUCTURE")) {
+ throw new VrfBondingServiceException(
+ "VpnBinding: " + relatedVpnId + " does not have a vpn type of SERVICE-INFRASTRUCTURE.");
+ }
+ }
+
+ protected void aaiAggregateRouteValidation(org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
+ throws VrfBondingServiceException {
+ if (aaiLocalNetwork.getAggregateRoutes() == null
+ || aaiLocalNetwork.getAggregateRoutes().getAggregateRoute() == null) {
+ return;
+ }
+ if (aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().size() == 1 && !aaiLocalNetwork
+ .getAggregateRoutes().getAggregateRoute().get(0).getIpVersion().equalsIgnoreCase("4")) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " has 1 aggregate route but the Ip version of aggregate route is : "
+ + aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().get(0).getIpVersion() + " and is not 4");
+ } else if (aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().size() == 2
+ && !ipVersionValidation(aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().get(0).getIpVersion(),
+ aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().get(1).getIpVersion())) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " has 2 aggregate routes but the combination of the Ip versions for the aggregate routes did not match the ip version of one of them to be 4 and one to be 6");
+ } else if (aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().size() > 2) {
+ throw new VrfBondingServiceException(
+ "LocalNetwork: " + aaiLocalNetwork.getNetworkId() + " either has more than 2 aggregate routes");
+ }
+ }
+
+ protected void aaiNetworkValidation(String relatedNetworkid, org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
+ throws VrfBondingServiceException {
+ if (aaiLocalNetwork == null) {
+ throw new VrfBondingServiceException("The local network " + relatedNetworkid + " does not exist in A&AI.");
+ }
+ }
+
+ protected void aaiSubnetValidation(org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
+ throws VrfBondingServiceException {
+ if (aaiLocalNetwork.getSubnets() == null || aaiLocalNetwork.getSubnets().getSubnet() == null) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId() + " has no subnets");
+ } else if (aaiLocalNetwork.getSubnets().getSubnet().size() == 1
+ && !aaiLocalNetwork.getSubnets().getSubnet().get(0).getIpVersion().equalsIgnoreCase("4")) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " has 1 subnet but the Ip version of subnet is : "
+ + aaiLocalNetwork.getSubnets().getSubnet().get(0).getIpVersion() + " and is not 4");
+ } else if (aaiLocalNetwork.getSubnets().getSubnet().size() == 2
+ && !ipVersionValidation(aaiLocalNetwork.getSubnets().getSubnet().get(0).getIpVersion(),
+ aaiLocalNetwork.getSubnets().getSubnet().get(1).getIpVersion())) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " has 2 subnets but the combination of the Ip versions for the subnets did not match the ip version of one of them to be 4 and one to be 6");
+ } else if (aaiLocalNetwork.getSubnets().getSubnet().isEmpty()
+ || aaiLocalNetwork.getSubnets().getSubnet().size() > 2) {
+ throw new VrfBondingServiceException("LocalNetwork: " + aaiLocalNetwork.getNetworkId()
+ + " either has no subnets or more than 2 subnets");
+ }
+ }
+
+ protected boolean ipVersionValidation(String ipVersion1, String ipVersion2) {
+ return (ipVersion1.equalsIgnoreCase("4") && ipVersion2.equalsIgnoreCase("6"))
+ || (ipVersion1.equalsIgnoreCase("6") && ipVersion2.equalsIgnoreCase("4"));
+ }
+
+ protected void aaiRouteTargetValidation(L3Network aaiLocalNetwork) throws VrfBondingServiceException {
+ AAIResultWrapper networkWrapper = new AAIResultWrapper(aaiLocalNetwork);
+ if (networkWrapper.getRelationships().isPresent()) {
+ List<AAIResourceUri> vpnBindingUris =
+ networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING);
+ if (!vpnBindingUris.isEmpty()) {
+ Optional<org.onap.aai.domain.yang.VpnBinding> vpnBindingOp =
+ bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUris.get(0))
+ .asBean(org.onap.aai.domain.yang.VpnBinding.class);
+ if (vpnBindingOp.isPresent()) {
+ org.onap.aai.domain.yang.VpnBinding vpnBinding = vpnBindingOp.get();
+ if (vpnBinding.getRouteTargets() != null
+ && !vpnBinding.getRouteTargets().getRouteTarget().isEmpty()) {
+ return;
+ }
+ }
+ }
+ }
+ throw new VrfBondingServiceException("The Local Network: " + aaiLocalNetwork.getNetworkId()
+ + " does not have vpn binding and/or RT information");
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 94209908be..1f07166b60 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -35,13 +35,16 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
-import org.slf4j.LoggerFactory;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.ServiceInstances;
import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
@@ -50,6 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -61,9 +65,9 @@ import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -71,16 +75,17 @@ import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.Networks;
import org.onap.so.serviceinstancebeans.RelatedInstance;
-import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.VfModules;
import org.onap.so.serviceinstancebeans.Vnfs;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
@@ -88,18 +93,10 @@ public class WorkflowAction {
private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
private static final String SERVICE_INSTANCES = "serviceInstances";
+ private static final String SERVICE_INSTANCE = "serviceInstance";
private static final String VF_MODULES = "vfModules";
private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI =
"WorkflowAction was unable to verify if the instance name already exist in AAI.";
- private static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow";
- private static final String G_ACTION = "requestAction";
- private static final String G_CURRENT_SEQUENCE = "gCurrentSequence";
- private static final String G_REQUEST_ID = "mso-request-id";
- private static final String G_BPMN_REQUEST = "bpmnRequest";
- private static final String G_ALACARTE = "aLaCarte";
- private static final String G_APIVERSION = "apiVersion";
- private static final String G_URI = "requestUri";
- private static final String G_ISTOPLEVELFLOW = "isTopLevelFlow";
private static final String VNF_TYPE = "vnfType";
private static final String SERVICE = "Service";
private static final String VNF = "Vnf";
@@ -111,14 +108,24 @@ public class WorkflowAction {
private static final String ASSIGNINSTANCE = "assignInstance";
private static final String CREATEINSTANCE = "createInstance";
private static final String USERPARAMSERVICE = "service";
- private static final String supportedTypes =
+ private static final String SUPPORTEDTYPES =
"vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups";
private static final String HOMINGSOLUTION = "Homing_Solution";
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
- private static final String G_SERVICE_TYPE = "serviceType";
private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT";
+ private static final String SERVICE_TYPE_BONDING = "BONDING";
private static final String CLOUD_OWNER = "DEFAULT";
private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
+ private static final String NAME_EXISTS_WITH_DIFF_VERSION_ID = "(%s) and different version id (%s)";
+ private static final String NAME_EXISTS_MULTIPLE =
+ "(%s) and multiple combination of model-version-id + service-type + global-customer-id";
+ private static final String NAME_EXISTS_WITH_DIFF_COMBINATION =
+ "(%s) and global-customer-id (%s), service-type (%s), model-version-id (%s)";
+ private static final String NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID =
+ "(%s), same parent and different customization id (%s)";
+ private static final String NAME_EXISTS_WITH_DIFF_PARENT = "(%s) id (%s) and different parent relationship";
+ private static final String CREATENETWORKBB = "CreateNetworkBB";
+ private static final String ACTIVATENETWORKBB = "ActivateNetworkBB";
@Autowired
protected BBInputSetup bbInputSetup;
@@ -132,6 +139,8 @@ public class WorkflowAction {
private AAIConfigurationResources aaiConfigurationResources;
@Autowired
private WorkflowActionExtractResourcesAAI workflowActionUtils;
+ @Autowired
+ private VrfValidation vrfValidation;
@Autowired
private Environment environment;
@@ -146,17 +155,20 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- final String requestAction = (String) execution.getVariable(G_ACTION);
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
- final String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- final String apiVersion = (String) execution.getVariable(G_APIVERSION);
- final String uri = (String) execution.getVariable(G_URI);
+ final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
+ final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+ final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
+ String uri = (String) execution.getVariable(BBConstants.G_URI);
final String vnfType = (String) execution.getVariable(VNF_TYPE);
String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
- final String serviceType = Optional.ofNullable((String) execution.getVariable(G_SERVICE_TYPE)).orElse("");
+ final String createInstanceAction = "createInstance";
+ final String serviceType =
+ Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
- List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(G_ORCHESTRATION_FLOW);
+ List<OrchestrationFlow> orchFlows =
+ (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
@@ -167,167 +179,187 @@ public class WorkflowAction {
try {
ObjectMapper mapper = new ObjectMapper();
- execution.setVariable(G_ISTOPLEVELFLOW, true);
+ execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
String cloudOwner = "";
try {
cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner();
} catch (Exception ex) {
+ logger.error("Exception in getCloundOwner", ex);
cloudOwner = environment.getProperty(defaultCloudOwner);
}
boolean suppressRollback = false;
try {
suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
} catch (Exception ex) {
+ logger.error("Exception in getSuppressRollback", ex);
suppressRollback = false;
}
execution.setVariable("suppressRollback", suppressRollback);
+ if (isUriResume(uri)) {
+ logger.debug("replacing URI {}", uri);
+ uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
+ logger.debug("for RESUME with original value {}", uri);
+ }
Resource resource = extractResourceIdAndTypeFromUri(uri);
WorkflowType resourceType = resource.getResourceType();
execution.setVariable("resourceName", resourceType.toString());
String resourceId = "";
- if (resource.isGenerated()) {
+ if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction)
+ && sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
workflowResourceIds);
} else {
resourceId = resource.getResourceId();
}
- if ((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE) {
+ if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) {
serviceInstanceId = resourceId;
}
execution.setVariable("resourceId", resourceId);
execution.setVariable("resourceType", resourceType);
- if (aLaCarte) {
- if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
- cloudOwner, serviceType);
- }
- String key = "";
- ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
- if (modelInfo != null) {
- if (modelInfo.getModelType().equals(ModelType.service)) {
- key = modelInfo.getModelVersionId();
- } else {
- key = modelInfo.getModelCustomizationId();
- }
- }
- boolean isConfiguration = isConfiguration(orchFlows);
- Resource resourceKey = new Resource(resourceType, key, aLaCarte);
- if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
- List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(sIRequest, orchFlows,
- requestId, resourceKey, apiVersion, resourceId, requestAction, aLaCarte, vnfType,
- workflowResourceIds, requestDetails, execution);
- flowsToExecute.addAll(configBuildingBlocks);
- }
- orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
- .collect(Collectors.toList());
- for (OrchestrationFlow orchFlow : orchFlows) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion,
- resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false,
- null, false);
- flowsToExecute.add(ebb);
+ if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) {
+ flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
+ if (flowsToExecute == null) {
+ buildAndThrowException(execution, "Could not resume Macro flow. Error loading execution path.");
}
} else {
- boolean foundRelated = false;
- boolean containsService = false;
- if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) {
- // SERVICE-MACRO-ASSIGN will always get user params with a
- // service.
- if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams =
- sIRequest.getRequestDetails().getRequestParameters().getUserParams();
- for (Map<String, Object> params : userParams) {
- if (params.containsKey(USERPARAMSERVICE)) {
- containsService = true;
+ if (aLaCarte) {
+ if (orchFlows == null || orchFlows.isEmpty()) {
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ cloudOwner, serviceType);
+ }
+ String key = "";
+ ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
+ if (modelInfo != null) {
+ if (modelInfo.getModelType().equals(ModelType.service)) {
+ key = modelInfo.getModelVersionId();
+ } else {
+ key = modelInfo.getModelCustomizationId();
+ }
+ }
+ boolean isConfiguration = isConfiguration(orchFlows);
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(
+ new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
+ .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte)
+ .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
+ .setRequestDetails(requestDetails).setExecution(execution));
+
+ flowsToExecute.addAll(configBuildingBlocks);
+ }
+ orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
+ .collect(Collectors.toList());
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
+ apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds,
+ requestDetails, false, null, false);
+ flowsToExecute.add(ebb);
+ }
+ } else {
+ boolean foundRelated = false;
+ boolean containsService = false;
+ if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) {
+ // SERVICE-MACRO-ASSIGN will always get user params with a
+ // service.
+ if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ List<Map<String, Object>> userParams =
+ sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ for (Map<String, Object> params : userParams) {
+ if (params.containsKey(USERPARAMSERVICE)) {
+ containsService = true;
+ }
+ }
+ if (containsService) {
+ traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ }
+ } else {
+ buildAndThrowException(execution,
+ "Service-Macro-Assign request details must contain user params with a service");
+ }
+ } else if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ // SERVICE-MACRO-CREATE will get user params with a service,
+ // a service with a network, a service with a
+ // networkcollection, OR an empty service.
+ // If user params is just a service or null and macro
+ // queries the SI and finds a VNF, macro fails.
+
+ if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ List<Map<String, Object>> userParams =
+ sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ for (Map<String, Object> params : userParams) {
+ if (params.containsKey(USERPARAMSERVICE)) {
+ containsService = true;
+ }
}
}
if (containsService) {
- traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ foundRelated =
+ traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ }
+ if (!foundRelated) {
+ traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
}
+ } else if (resourceType == WorkflowType.SERVICE
+ && ("activateInstance".equalsIgnoreCase(requestAction)
+ || "unassignInstance".equalsIgnoreCase(requestAction)
+ || "deleteInstance".equalsIgnoreCase(requestAction)
+ || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
+ // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
+ // SERVICE-MACRO-DELETE
+ // Will never get user params with service, macro will have
+ // to query the SI in AAI to find related instances.
+ traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
+ } else if (resourceType == WorkflowType.SERVICE
+ && "deactivateInstance".equalsIgnoreCase(requestAction)) {
+ resourceCounter.add(new Resource(WorkflowType.SERVICE, "", false));
+ } else if (resourceType == WorkflowType.VNF && ("replaceInstance".equalsIgnoreCase(requestAction)
+ || ("recreateInstance".equalsIgnoreCase(requestAction)))) {
+ traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(),
+ workflowResourceIds.getVnfId(), aaiResourceIds);
} else {
- buildAndThrowException(execution,
- "Service-Macro-Assign request details must contain user params with a service");
+ buildAndThrowException(execution, "Current Macro Request is not supported");
}
- } else if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
- // SERVICE-MACRO-CREATE will get user params with a service,
- // a service with a network, a service with a
- // networkcollection, OR an empty service.
- // If user params is just a service or null and macro
- // queries the SI and finds a VNF, macro fails.
-
- if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams =
- sIRequest.getRequestDetails().getRequestParameters().getUserParams();
- for (Map<String, Object> params : userParams) {
- if (params.containsKey(USERPARAMSERVICE)) {
- containsService = true;
- }
- }
+ String foundObjects = "";
+ for (WorkflowType type : WorkflowType.values()) {
+ foundObjects = foundObjects + type + " - " + resourceCounter.stream()
+ .filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size()
+ + " ";
}
- if (containsService) {
- foundRelated = traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ logger.info("Found {}", foundObjects);
+
+ if (orchFlows == null || orchFlows.isEmpty()) {
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ cloudOwner, serviceType);
}
- if (!foundRelated) {
- traverseCatalogDbService(execution, sIRequest, resourceCounter);
+ flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion,
+ resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails);
+ if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ .collect(Collectors.toList()).isEmpty()) {
+ logger.info("Sorting for Vlan Tagging");
+ flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
+ }
+ // By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE
+ if (resourceType == WorkflowType.SERVICE
+ && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
+ && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType()))
+ .collect(Collectors.toList()).isEmpty()) {
+ execution.setVariable("homing", true);
+ execution.setVariable("calledHoming", false);
+ }
+ if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE)
+ || requestAction.equalsIgnoreCase(CREATEINSTANCE))) {
+ generateResourceIds(flowsToExecute, resourceCounter, serviceInstanceId);
+ } else {
+ updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds,
+ serviceInstanceId);
}
- } else if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase("activateInstance")
- || requestAction.equalsIgnoreCase("unassignInstance")
- || requestAction.equalsIgnoreCase("deleteInstance")
- || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
- // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
- // SERVICE-MACRO-DELETE
- // Will never get user params with service, macro will have
- // to query the SI in AAI to find related instances.
- traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
- } else if (resourceType == WorkflowType.SERVICE
- && requestAction.equalsIgnoreCase("deactivateInstance")) {
- resourceCounter.add(new Resource(WorkflowType.SERVICE, "", false));
- } else if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance")
- || (requestAction.equalsIgnoreCase("recreateInstance")))) {
- traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(),
- workflowResourceIds.getVnfId(), aaiResourceIds);
- } else {
- buildAndThrowException(execution, "Current Macro Request is not supported");
- }
- String foundObjects = "";
- for (WorkflowType type : WorkflowType.values()) {
- foundObjects = foundObjects + type + " - " + resourceCounter.stream()
- .filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " ";
- }
- logger.info("Found {}", foundObjects);
-
- if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
- cloudOwner, serviceType);
- }
- flowsToExecute =
- buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId,
- resourceType, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails);
- if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
- .collect(Collectors.toList()).isEmpty()) {
- logger.info("Sorting for Vlan Tagging");
- flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
- }
- // By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE
- if (resourceType == WorkflowType.SERVICE
- && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
- && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType()))
- .collect(Collectors.toList()).isEmpty()) {
- execution.setVariable("homing", true);
- execution.setVariable("calledHoming", false);
- }
- if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE)
- || requestAction.equalsIgnoreCase(CREATEINSTANCE))) {
- generateResourceIds(flowsToExecute, resourceCounter, serviceInstanceId);
- } else {
- updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds,
- serviceInstanceId);
}
}
-
// If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified,
// enable it.
if (sIRequest.getRequestDetails().getRequestParameters() != null
@@ -336,7 +368,7 @@ public class WorkflowAction {
sIRequest.getRequestDetails().getRequestParameters().getUserParams();
for (Map<String, Object> params : userParams) {
if (params.containsKey(HOMINGSOLUTION)) {
- if (params.get(HOMINGSOLUTION).equals("none")) {
+ if ("none".equals(params.get(HOMINGSOLUTION))) {
execution.setVariable("homing", false);
} else {
execution.setVariable("homing", true);
@@ -345,7 +377,7 @@ public class WorkflowAction {
}
}
- if (flowsToExecute.isEmpty()) {
+ if (flowsToExecute == null || flowsToExecute.isEmpty()) {
throw new IllegalStateException("Macro did not come up with a valid execution path.");
}
List<String> flowNames = new ArrayList<>();
@@ -354,15 +386,19 @@ public class WorkflowAction {
logger.info(ebb.getBuildingBlock().getBpmnFlowName());
flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
}
+
+ if (!aLaCarte) {
+ bbInputSetupUtils.persistFlowExecutionPath(requestId, flowsToExecute);
+ }
execution.setVariable("flowNames", flowNames);
- execution.setVariable(G_CURRENT_SEQUENCE, 0);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0);
execution.setVariable("retryCount", 0);
execution.setVariable("isRollback", false);
execution.setVariable("flowsToExecute", flowsToExecute);
execution.setVariable("isRollbackComplete", false);
} catch (Exception ex) {
- buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
+ buildAndThrowException(execution, "Exception in create execution list. " + ex.getMessage(), ex);
}
}
@@ -416,24 +452,20 @@ public class WorkflowAction {
protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
for (OrchestrationFlow flow : orchFlows) {
- if (flow.getFlowName().contains("Configuration") && !flow.getFlowName().equals("ConfigurationScaleOutBB")) {
+ if (flow.getFlowName().contains(CONFIGURATION) && !"ConfigurationScaleOutBB".equals(flow.getFlowName())) {
return true;
}
}
return false;
}
- protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ServiceInstancesRequest sIRequest,
- List<OrchestrationFlow> orchFlows, String requestId, Resource resourceKey, String apiVersion,
- String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, DelegateExecution execution) {
+ protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ConfigBuildingBlocksDataObject dataObj) {
List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
- List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
- result = orchFlows.stream().filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION))
- .collect(Collectors.toList());
- String vnfId = workflowResourceIds.getVnfId();
- String vfModuleId = workflowResourceIds.getVfModuleId();
+ List<OrchestrationFlow> result = dataObj.getOrchFlows().stream()
+ .filter(item -> item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
+ String vnfId = dataObj.getWorkflowResourceIds().getVnfId();
+ String vfModuleId = dataObj.getWorkflowResourceIds().getVfModuleId();
String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
String vfModuleCustomizationUUID =
@@ -447,21 +479,22 @@ public class WorkflowAction {
if (configurations.size() > 1) {
String multipleRelationshipsError =
"Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
- buildAndThrowException(execution, multipleRelationshipsError,
+ buildAndThrowException(dataObj.getExecution(), multipleRelationshipsError,
new Exception(multipleRelationshipsError));
}
for (org.onap.aai.domain.yang.Configuration configuration : configurations) {
- workflowResourceIds.setConfigurationId(configuration.getConfigurationId());
+ dataObj.getWorkflowResourceIds().setConfigurationId(configuration.getConfigurationId());
for (OrchestrationFlow orchFlow : result) {
- resourceKey.setVfModuleCustomizationId(vfModuleCustomizationUUID);
- resourceKey.setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
- resourceKey.setVnfCustomizationId(vnfCustomizationUUID);
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion,
- resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false,
- null, true);
+ dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID);
+ dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
+ dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID);
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(),
+ dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(),
+ dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(),
+ dataObj.getWorkflowResourceIds(), dataObj.getRequestDetails(), false, null, true);
String vnfcName = getVnfcNameForConfiguration(configuration);
if (vnfcName == null || vnfcName.isEmpty()) {
- buildAndThrowException(execution, "Exception in create execution list "
+ buildAndThrowException(dataObj.getExecution(), "Exception in create execution list "
+ ": VnfcName does not exist or is null while there is a configuration for the vfModule",
new Exception("Vnfc and Configuration do not match"));
}
@@ -617,97 +650,179 @@ public class WorkflowAction {
}
protected void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest,
- List<Resource> resourceCounter) {
+ List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds)
+ throws JsonProcessingException, VrfBondingServiceException {
String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId();
org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID);
if (service == null) {
buildAndThrowException(execution, "Could not find the service model in catalog db.");
} else {
resourceCounter.add(new Resource(WorkflowType.SERVICE, service.getModelUUID(), false));
- if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
- List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
- if (customizations.isEmpty()) {
- logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
- } else {
- CollectionResourceCustomization collectionResourceCustomization =
- findCatalogNetworkCollection(execution, service);
- if (collectionResourceCustomization != null) {
- resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
- collectionResourceCustomization.getModelCustomizationUUID(), false));
- logger.debug("Found a network collection");
- if (collectionResourceCustomization.getCollectionResource() != null) {
- if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) {
- String toscaNodeType = collectionResourceCustomization.getCollectionResource()
- .getInstanceGroup().getToscaNodeType();
- if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) {
- int minNetworks = 0;
- org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
- collectionResourceCustomization.getCollectionResource().getInstanceGroup();
- CollectionResourceInstanceGroupCustomization collectionInstCust = null;
- if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
- for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
- .getCollectionInstanceGroupCustomizations()) {
- if (collectionInstanceGroupTemp.getModelCustomizationUUID()
- .equalsIgnoreCase(collectionResourceCustomization
- .getModelCustomizationUUID())) {
- collectionInstCust = collectionInstanceGroupTemp;
- break;
- }
- }
- if (collectionInstCust != null
- && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
- minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
- }
- }
- logger.debug("minNetworks: {}", minNetworks);
- CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
- for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
- .getCollectionNetworkResourceCustomizations()) {
- if (collectionNetworkTemp.getNetworkResourceCustomization()
- .getModelCustomizationUUID().equalsIgnoreCase(
- collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionNetworkResourceCust = collectionNetworkTemp;
+ RelatedInstance relatedVpnBinding =
+ bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.vpnBinding);
+ RelatedInstance relatedLocalNetwork =
+ bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.network);
+ if (relatedVpnBinding != null && relatedLocalNetwork != null) {
+ traverseVrfConfiguration(aaiResourceIds, resourceCounter, service, relatedVpnBinding,
+ relatedLocalNetwork);
+ } else {
+ traverseNetworkCollection(execution, resourceCounter, service);
+ }
+ }
+ }
+
+ protected void traverseVrfConfiguration(List<Pair<WorkflowType, String>> aaiResourceIds,
+ List<Resource> resourceCounter, org.onap.so.db.catalog.beans.Service service,
+ RelatedInstance relatedVpnBinding, RelatedInstance relatedLocalNetwork)
+ throws VrfBondingServiceException, JsonProcessingException {
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork =
+ bbInputSetupUtils.getAAIL3Network(relatedLocalNetwork.getInstanceId());
+ vrfValidation.vrfServiceValidation(service);
+ vrfValidation.vrfCatalogDbChecks(service);
+ vrfValidation.aaiVpnBindingValidation(relatedVpnBinding.getInstanceId(),
+ bbInputSetupUtils.getAAIVpnBinding(relatedVpnBinding.getInstanceId()));
+ vrfValidation.aaiNetworkValidation(relatedLocalNetwork.getInstanceId(), aaiLocalNetwork);
+ vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
+ vrfValidation.aaiAggregateRouteValidation(aaiLocalNetwork);
+ vrfValidation.aaiRouteTargetValidation(aaiLocalNetwork);
+ String existingAAIVrfConfiguration = getExistingAAIVrfConfiguration(relatedVpnBinding, aaiLocalNetwork);
+ if (existingAAIVrfConfiguration != null) {
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
+ }
+ resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,
+ service.getConfigurationCustomizations().get(0).getModelCustomizationUUID(), false));
+
+ }
+
+ protected String getExistingAAIVrfConfiguration(RelatedInstance relatedVpnBinding,
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
+ throws JsonProcessingException, VrfBondingServiceException {
+ Optional<Relationships> relationshipsOp = new AAIResultWrapper(
+ new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiLocalNetwork)).getRelationships();
+ if (relationshipsOp.isPresent()) {
+ List<AAIResultWrapper> configurationsRelatedToLocalNetwork =
+ relationshipsOp.get().getByType(AAIObjectType.CONFIGURATION);
+ if (configurationsRelatedToLocalNetwork.size() > 1) {
+ throw new VrfBondingServiceException(
+ "Network: " + aaiLocalNetwork.getNetworkId() + " has more than 1 configuration related to it");
+ }
+ if (configurationsRelatedToLocalNetwork.size() == 1) {
+ AAIResultWrapper configWrapper = configurationsRelatedToLocalNetwork.get(0);
+ Optional<Configuration> relatedConfiguration = configWrapper.asBean(Configuration.class);
+ if (relatedConfiguration.isPresent() && vrfConfigurationAlreadyExists(relatedVpnBinding,
+ relatedConfiguration.get(), configWrapper)) {
+ return relatedConfiguration.get().getConfigurationId();
+ }
+ }
+ }
+ return null;
+ }
+
+ protected boolean vrfConfigurationAlreadyExists(RelatedInstance relatedVpnBinding, Configuration vrfConfiguration,
+ AAIResultWrapper configWrapper) throws VrfBondingServiceException {
+ if ("VRF-ENTRY".equalsIgnoreCase(vrfConfiguration.getConfigurationType())) {
+ Optional<Relationships> relationshipsConfigOp = configWrapper.getRelationships();
+ if (relationshipsConfigOp.isPresent()) {
+ Optional<VpnBinding> relatedInfraVpnBindingOp =
+ workflowActionUtils.extractRelationshipsVpnBinding(relationshipsConfigOp.get());
+ if (relatedInfraVpnBindingOp.isPresent()) {
+ VpnBinding relatedInfraVpnBinding = relatedInfraVpnBindingOp.get();
+ if (!relatedInfraVpnBinding.getVpnId().equalsIgnoreCase(relatedVpnBinding.getInstanceId())) {
+ throw new VrfBondingServiceException("Configuration: " + vrfConfiguration.getConfigurationId()
+ + " is not connected to the same vpn binding id provided in request: "
+ + relatedVpnBinding.getInstanceId());
+ } else {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceCounter,
+ org.onap.so.db.catalog.beans.Service service) {
+ if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
+ List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
+ if (customizations.isEmpty()) {
+ logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
+ } else {
+ CollectionResourceCustomization collectionResourceCustomization =
+ findCatalogNetworkCollection(execution, service);
+ if (collectionResourceCustomization != null) {
+ resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ collectionResourceCustomization.getModelCustomizationUUID(), false));
+ logger.debug("Found a network collection");
+ if (collectionResourceCustomization.getCollectionResource() != null) {
+ if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) {
+ String toscaNodeType = collectionResourceCustomization.getCollectionResource()
+ .getInstanceGroup().getToscaNodeType();
+ if (toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION)) {
+ int minNetworks = 0;
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ CollectionResourceInstanceGroupCustomization collectionInstCust = null;
+ if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
+ for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
+ .getCollectionInstanceGroupCustomizations()) {
+ if (collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(
+ collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionInstCust = collectionInstanceGroupTemp;
break;
}
}
- for (int i = 0; i < minNetworks; i++) {
- if (collectionNetworkResourceCust != null && collectionInstCust != null) {
- Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
- collectionNetworkResourceCust.getModelCustomizationUUID(), false);
- resource.setVirtualLinkKey(Integer.toString(i));
- resourceCounter.add(resource);
- }
+ if (collectionInstCust != null
+ && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
+ minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
+ }
+ }
+ logger.debug("minNetworks: {}", minNetworks);
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
+ for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
+ .getCollectionNetworkResourceCustomizations()) {
+ if (collectionNetworkTemp.getNetworkResourceCustomization()
+ .getModelCustomizationUUID().equalsIgnoreCase(
+ collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionNetworkResourceCust = collectionNetworkTemp;
+ break;
+ }
+ }
+ for (int i = 0; i < minNetworks; i++) {
+ if (collectionNetworkResourceCust != null && collectionInstCust != null) {
+ Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
+ collectionNetworkResourceCust.getModelCustomizationUUID(), false);
+ resource.setVirtualLinkKey(Integer.toString(i));
+ resourceCounter.add(resource);
}
- } else {
- logger.debug(
- "Instance Group tosca node type does not contain NetworkCollection: {}",
- toscaNodeType);
}
} else {
- logger.debug("No Instance Group found for network collection.");
+ logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}",
+ toscaNodeType);
}
} else {
- logger.debug("No Network Collection found. collectionResource is null");
+ logger.debug("No Instance Group found for network collection.");
}
} else {
- logger.debug("No Network Collection Customization found");
+ logger.debug("No Network Collection found. collectionResource is null");
}
+ } else {
+ logger.debug("No Network Collection Customization found");
}
- if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
- .collect(Collectors.toList()).isEmpty()) {
- if (service.getNetworkCustomizations() == null) {
- logger.debug("No networks were found on this service model");
- } else {
- for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
- resourceCounter.add(new Resource(WorkflowType.NETWORK,
- service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
- }
+ }
+ if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ .collect(Collectors.toList()).isEmpty()) {
+ if (service.getNetworkCustomizations() == null) {
+ logger.debug("No networks were found on this service model");
+ } else {
+ for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
+ resourceCounter.add(new Resource(WorkflowType.NETWORK,
+ service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
}
}
- } else {
- buildAndThrowException(execution,
- "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
}
+ } else {
+ buildAndThrowException(execution,
+ "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
}
}
@@ -726,7 +841,9 @@ public class WorkflowAction {
for (VfModule vfModule : vnf.getVfModules()) {
aaiResourceIds.add(
new Pair<WorkflowType, String>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
- resourceCounter.add(new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false));
+ Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
+ resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
+ resourceCounter.add(resource);
}
}
if (vnf.getVolumeGroups() != null) {
@@ -760,7 +877,8 @@ public class WorkflowAction {
aaiConfigurationResources.getConfiguration(config.getConfigurationId());
if (aaiConfig.isPresent() && aaiConfig.get().getRelationshipList() != null) {
for (Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()) {
- if (relationship.getRelatedTo().contains("vnfc")) {
+ if (relationship.getRelatedTo().contains("vnfc")
+ || relationship.getRelatedTo().contains("vpn-binding")) {
aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
config.getConfigurationId()));
resourceCounter.add(
@@ -772,6 +890,7 @@ public class WorkflowAction {
}
}
} catch (Exception ex) {
+ logger.error("Exception in traverseAAIService", ex);
buildAndThrowException(execution,
"Could not find existing Service Instance or related Instances to execute the request on.");
}
@@ -813,6 +932,7 @@ public class WorkflowAction {
}
}
} catch (Exception ex) {
+ logger.error("Exception in traverseAAIVnf", ex);
buildAndThrowException(execution,
"Could not find existing Vnf or related Instances to execute the request on.");
}
@@ -840,6 +960,7 @@ public class WorkflowAction {
}
}
} catch (Exception ex) {
+ logger.error("Exception in findConfigurationsInsideVfModule", ex);
buildAndThrowException(execution, "Failed to find Configuration object from the vfModule.");
}
}
@@ -902,8 +1023,8 @@ public class WorkflowAction {
vfModuleCustomizationUUID =
vfModule.getModelInfo().getModelCustomizationUuid();
}
- if (!vnfCustomizationUUID.equals("")
- && !vfModuleCustomizationUUID.equals("")) {
+ if (!vnfCustomizationUUID.isEmpty()
+ && !vfModuleCustomizationUUID.isEmpty()) {
List<CvnfcConfigurationCustomization> configs =
traverseCatalogDbForConfiguration(
validate.getModelInfo().getModelVersionId(),
@@ -997,7 +1118,7 @@ public class WorkflowAction {
protected Resource extractResourceIdAndTypeFromUri(String uri) {
Pattern patt = Pattern.compile(
- "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
+ "[vV]\\d+.*?(?:(?:/(?<type>" + SUPPORTEDTYPES + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
Matcher m = patt.matcher(uri);
Boolean generated = false;
@@ -1010,15 +1131,15 @@ public class WorkflowAction {
throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri);
}
if (action == null) {
- if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
+ if (type.equals(SERVICE_INSTANCES) && (id == null || "assign".equals(id))) {
id = UUID.randomUUID().toString();
generated = true;
- } else if (type.equals(VF_MODULES) && id.equals("scaleOut")) {
+ } else if (type.equals(VF_MODULES) && "scaleOut".equals(id)) {
id = UUID.randomUUID().toString();
generated = true;
}
} else {
- if (action.matches(supportedTypes)) {
+ if (action.matches(SUPPORTEDTYPES)) {
id = UUID.randomUUID().toString();
generated = true;
type = action;
@@ -1034,55 +1155,146 @@ public class WorkflowAction {
RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws Exception {
try {
if ("SERVICE".equalsIgnoreCase(type.toString())) {
+ // Service name verification based upon name + model-version-id
+ // + service-type + global-customer-id per requirements
String globalCustomerId = reqDetails.getSubscriberInfo().getGlobalSubscriberId();
String serviceType = reqDetails.getRequestParameters().getSubscriptionServiceType();
if (instanceName != null) {
Optional<ServiceInstance> serviceInstanceAAI =
bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, instanceName);
if (serviceInstanceAAI.isPresent()) {
- return serviceInstanceAAI.get().getServiceInstanceId();
+ if (serviceInstanceAAI.get().getModelVersionId()
+ .equalsIgnoreCase(reqDetails.getModelInfo().getModelVersionId())) {
+ return serviceInstanceAAI.get().getServiceInstanceId();
+ } else {
+ throw new DuplicateNameException(SERVICE_INSTANCE,
+ String.format(NAME_EXISTS_WITH_DIFF_VERSION_ID, instanceName,
+ reqDetails.getModelInfo().getModelVersionId()));
+ }
+ } else {
+ ServiceInstances aaiServiceInstances =
+ bbInputSetupUtils.getAAIServiceInstancesGloballyByName(instanceName);
+ if (aaiServiceInstances != null) {
+ if (aaiServiceInstances.getServiceInstance() != null
+ && !aaiServiceInstances.getServiceInstance().isEmpty()) {
+ if (aaiServiceInstances.getServiceInstance().size() > 1) {
+ throw new DuplicateNameException(SERVICE_INSTANCE,
+ String.format(NAME_EXISTS_MULTIPLE, instanceName));
+ } else {
+ ServiceInstance si =
+ aaiServiceInstances.getServiceInstance().stream().findFirst().get();
+ Map<String, String> keys =
+ bbInputSetupUtils.getURIKeysFromServiceInstance(si.getServiceInstanceId());
+
+ throw new DuplicateNameException(SERVICE_INSTANCE,
+ String.format(NAME_EXISTS_WITH_DIFF_COMBINATION, instanceName,
+ keys.get("global-customer-id"), keys.get("service-type"),
+ si.getModelVersionId()));
+ }
+ }
+ }
}
}
} else if ("NETWORK".equalsIgnoreCase(type.toString())) {
Optional<L3Network> network = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(
workflowResourceIds.getServiceInstanceId(), instanceName);
if (network.isPresent()) {
- return network.get().getNetworkId();
+ if (network.get().getModelCustomizationId()
+ .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
+ return network.get().getNetworkId();
+ } else {
+ throw new DuplicateNameException("l3Network",
+ String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName,
+ network.get().getModelCustomizationId()));
+ }
}
+
+ if (bbInputSetupUtils.existsAAINetworksGloballyByName(instanceName)) {
+ throw new DuplicateNameException("l3Network", String.format(NAME_EXISTS_WITH_DIFF_PARENT,
+ instanceName, workflowResourceIds.getServiceInstanceId()));
+ }
+
} else if ("VNF".equalsIgnoreCase(type.toString())) {
Optional<GenericVnf> vnf = bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(
workflowResourceIds.getServiceInstanceId(), instanceName);
if (vnf.isPresent()) {
- return vnf.get().getVnfId();
+ if (vnf.get().getModelCustomizationId()
+ .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
+ return vnf.get().getVnfId();
+ } else {
+ throw new DuplicateNameException("generic-vnf",
+ String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName,
+ vnf.get().getModelCustomizationId()));
+ }
+ }
+ GenericVnfs vnfs = bbInputSetupUtils.getAAIVnfsGloballyByName(instanceName);
+ if (vnfs != null) {
+ throw new DuplicateNameException("generic-vnf", String.format(NAME_EXISTS_WITH_DIFF_PARENT,
+ instanceName, vnfs.getGenericVnf().get(0).getVnfId()));
}
} else if ("VFMODULE".equalsIgnoreCase(type.toString())) {
GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId());
if (vnf != null && vnf.getVfModules() != null) {
for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) {
if (vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) {
- return vfModule.getVfModuleId();
+ if (vfModule.getModelCustomizationId()
+ .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
+ return vfModule.getVfModuleId();
+ } else {
+ throw new DuplicateNameException("vfModule",
+ String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName,
+ reqDetails.getModelInfo().getModelCustomizationId()));
+ }
}
}
}
} else if ("VOLUMEGROUP".equalsIgnoreCase(type.toString())) {
+ GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId());
Optional<VolumeGroup> volumeGroup = bbInputSetupUtils
.getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName);
if (volumeGroup.isPresent()) {
- return volumeGroup.get().getVolumeGroupId();
+ if (vnf.getModelCustomizationId()
+ .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
+ return volumeGroup.get().getVolumeGroupId();
+ } else {
+ throw new DuplicateNameException("volumeGroup", volumeGroup.get().getVolumeGroupName());
+ }
}
- GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId());
if (vnf != null && vnf.getVfModules() != null) {
for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) {
Optional<VolumeGroup> volumeGroupFromVfModule =
bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnf.getVnfId(),
vfModule.getVfModuleId(), instanceName);
if (volumeGroupFromVfModule.isPresent()) {
- return volumeGroupFromVfModule.get().getVolumeGroupId();
+ if (vnf.getModelCustomizationId()
+ .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
+ return volumeGroupFromVfModule.get().getVolumeGroupId();
+ } else {
+ throw new DuplicateNameException("volumeGroup",
+ String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName,
+ volumeGroupFromVfModule.get().getModelCustomizationId()));
+ }
}
}
}
+ } else if ("CONFIGURATION".equalsIgnoreCase(type.toString())) {
+ Optional<org.onap.aai.domain.yang.Configuration> configuration =
+ bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance(
+ workflowResourceIds.getServiceInstanceId(), instanceName);
+ if (configuration.isPresent()) {
+ if (configuration.get().getModelCustomizationId()
+ .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) {
+ return configuration.get().getConfigurationId();
+ } else {
+ throw new DuplicateNameException("configuration",
+ String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName,
+ configuration.get().getConfigurationId()));
+ }
+ }
}
return generatedResourceId;
+ } catch (DuplicateNameException dne) {
+ throw dne;
} catch (Exception ex) {
logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex);
throw new IllegalStateException(
@@ -1091,7 +1303,7 @@ public class WorkflowAction {
}
protected String convertTypeFromPlural(String type) {
- if (!type.matches(supportedTypes)) {
+ if (!type.matches(SUPPORTEDTYPES)) {
return type;
} else {
if (type.equals(SERVICE_INSTANCES)) {
@@ -1113,31 +1325,31 @@ public class WorkflowAction {
String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey();
sortedOrchFlows.add(ebb);
for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
&& ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
sortedOrchFlows.add(ebb2);
break;
}
- if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
&& ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
sortedOrchFlows.add(ebb2);
break;
}
}
for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)
&& ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
sortedOrchFlows.add(ebb2);
break;
}
- if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)
&& ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
sortedOrchFlows.add(ebb2);
break;
}
}
- } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
- || ebb.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")) {
+ } else if (ebb.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
+ || ebb.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)) {
continue;
} else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) {
sortedOrchFlows.add(ebb);
@@ -1175,8 +1387,8 @@ public class WorkflowAction {
protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
List<Resource> resourceCounter, String requestId, String apiVersion, String resourceId,
- WorkflowType resourceType, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails) {
+ String requestAction, boolean aLaCarte, String vnfType, WorkflowResourceIds workflowResourceIds,
+ RequestDetails requestDetails) {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
for (OrchestrationFlow orchFlow : orchFlows) {
if (orchFlow.getFlowName().contains(SERVICE)) {
@@ -1220,7 +1432,7 @@ public class WorkflowAction {
}
} else if (orchFlow.getFlowName().contains(VFMODULE)) {
List<Resource> vfModuleResourcesSorted = null;
- if (requestAction.equals("createInstance") || requestAction.equals("assignInstance")
+ if (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)
|| requestAction.equals("activateInstance")) {
vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream()
.filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList()));
@@ -1316,7 +1528,8 @@ public class WorkflowAction {
WorkflowType resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
List<OrchestrationFlow> listToExecute = new ArrayList<>();
NorthBoundRequest northBoundRequest = null;
- if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)) {
+ if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)
+ || serviceType.equalsIgnoreCase(SERVICE_TYPE_BONDING)) {
northBoundRequest =
catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(
requestAction, resourceName.toString(), aLaCarte, cloudOwner, serviceType);
@@ -1338,7 +1551,7 @@ public class WorkflowAction {
}
} else {
if (northBoundRequest.getIsToplevelflow() != null) {
- execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
+ execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
}
List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList();
if (flows == null)
@@ -1388,4 +1601,17 @@ public class WorkflowAction {
}
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, runtimeErrorMessage);
}
+
+ protected boolean isUriResume(String uri) {
+ return uri.endsWith("/resume");
+ }
+
+ protected boolean isRequestMacroServiceResume(boolean aLaCarte, WorkflowType resourceType, String requestAction,
+ String serviceInstanceId) {
+ return (!aLaCarte && resourceType == WorkflowType.SERVICE
+ && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) || requestAction.equalsIgnoreCase(CREATEINSTANCE))
+ && (serviceInstanceId != null && serviceInstanceId.trim().length() > 1)
+ && (bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId) != null));
+ }
}
+
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index 4fc4d85b97..be3e06c9ea 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 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
@@ -20,11 +22,13 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
+import java.sql.Timestamp;
import java.util.Optional;
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.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.slf4j.Logger;
@@ -36,6 +40,7 @@ import org.springframework.stereotype.Component;
public class WorkflowActionBBFailure {
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
+ public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState";
@Autowired
private RequestsDbClient requestDbclient;
@Autowired
@@ -52,7 +57,15 @@ public class WorkflowActionBBFailure {
} else {
errorMsg = "Failed to determine error message";
}
- request.setStatusMessage(errorMsg);
+ Boolean isRollback = (Boolean) execution.getVariable("isRollback");
+ if (!Boolean.TRUE.equals(isRollback)) {
+ request.setStatusMessage(errorMsg);
+ } else {
+ request.setRollbackStatusMessage(errorMsg);
+ }
+ request.setProgress(Long.valueOf(100));
+ request.setLastModifiedBy("CamundaBPMN");
+ request.setEndTime(new Timestamp(System.currentTimeMillis()));
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception e) {
logger.error(
@@ -80,6 +93,8 @@ public class WorkflowActionBBFailure {
rollbackErrorMsg = "Rollback has been completed successfully.";
request.setRollbackStatusMessage(rollbackErrorMsg);
execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ String rollbackTargetState = (String) execution.getVariable(ROLLBACK_TARGET_STATE);
+ request.setRequestStatus(rollbackTargetState);
} else if (isRollbackFailure) {
Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
if (rollbackErrorMsgOp.isPresent()) {
@@ -89,6 +104,7 @@ public class WorkflowActionBBFailure {
}
request.setRollbackStatusMessage(rollbackErrorMsg);
execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ request.setRequestStatus(Status.FAILED.toString());
} else {
Optional<String> errorMsgOp = retrieveErrorMessage(execution);
if (errorMsgOp.isPresent()) {
@@ -98,6 +114,12 @@ public class WorkflowActionBBFailure {
}
request.setStatusMessage(errorMsg);
execution.setVariable("ErrorMessage", errorMsg);
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ if ("Abort".equalsIgnoreCase(handlingCode)) {
+ request.setRequestStatus(Status.ABORTED.toString());
+ } else {
+ request.setRequestStatus(Status.FAILED.toString());
+ }
}
if (ebb != null && ebb.getBuildingBlock() != null) {
String flowStatus = "";
@@ -111,8 +133,8 @@ public class WorkflowActionBBFailure {
}
request.setProgress(Long.valueOf(100));
- request.setRequestStatus("FAILED");
request.setLastModifiedBy("CamundaBPMN");
+ request.setEndTime(new Timestamp(System.currentTimeMillis()));
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception e) {
workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e);
@@ -120,15 +142,19 @@ public class WorkflowActionBBFailure {
}
private Optional<String> retrieveErrorMessage(DelegateExecution execution) {
- String errorMsg = "";
+ String errorMsg = null;
try {
WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
- if (exception != null && (exception.getErrorMessage() != null || !exception.getErrorMessage().equals(""))) {
+ if (exception != null && (exception.getErrorMessage() != null || !"".equals(exception.getErrorMessage()))) {
errorMsg = exception.getErrorMessage();
}
- if (errorMsg == null || errorMsg.equals("")) {
+ if (errorMsg == null || "".equals(errorMsg)) {
errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
}
+ if (errorMsg == null) {
+ throw new IllegalStateException(
+ "could not find WorkflowException or WorkflowExceptionErrorMessage in execution");
+ }
return Optional.of(errorMsg);
} catch (Exception ex) {
logger.error("Failed to extract workflow exception from execution.", ex);
@@ -141,7 +167,7 @@ public class WorkflowActionBBFailure {
updateRequestStatusToFailed(execution);
}
- public void abortCallErrorHandling(DelegateExecution execution) {
+ public void abortCallErrorHandling() {
String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
logger.error(msg);
throw new BpmnError(msg);
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 938a0c9f62..d5798150d1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -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.
@@ -27,6 +27,9 @@ import java.util.UUID;
import javax.persistence.EntityNotFoundException;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.aai.domain.yang.Vnfc;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
@@ -37,7 +40,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -62,6 +64,9 @@ public class WorkflowActionBBTasks {
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
+ private static final String COMPLETED = "completed";
+ private static final String HANDLINGCODE = "handlingCode";
+ private static final String ROLLBACKTOCREATED = "RollbackToCreated";
protected String maxRetries = "mso.rainyDay.maxRetries";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@@ -77,47 +82,27 @@ public class WorkflowActionBBTasks {
private BBInputSetupUtils bbInputSetupUtils;
@Autowired
private CatalogDbClient catalogDbClient;
+ @Autowired
+ private FlowManipulatorListenerRunner flowManipulatorListenerRunner;
+ @Autowired
+ private RequestsDbListenerRunner requestsDbListener;
public void selectBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
execution.setVariable("MacroRollback", false);
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
- if (ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigAssignVnfBB")
- || ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigDeployVnfBB")) {
- String vnfCustomizationUUID = ebb.getBuildingBlock().getKey();
+ flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- List<VnfResourceCustomization> vnfResourceCustomizations = catalogDbClient
- .getVnfResourceCustomizationByModelUuid(ebb.getRequestDetails().getModelInfo().getModelUuid());
- if (vnfResourceCustomizations != null && vnfResourceCustomizations.size() >= 1) {
- VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID,
- vnfResourceCustomizations);
- boolean skipConfigVNF = vrc.isSkipPostInstConf();
- if (skipConfigVNF) {
- currentSequence++;
- ebb = flowsToExecute.get(currentSequence);
- }
- }
- }
+ ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
- boolean homing = (boolean) execution.getVariable("homing");
- boolean calledHoming = (boolean) execution.getVariable("calledHoming");
- if (homing && !calledHoming) {
- if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignVnfBB")) {
- ebb.setHoming(true);
- execution.setVariable("calledHoming", true);
- }
- } else {
- ebb.setHoming(false);
- }
execution.setVariable("buildingBlock", ebb);
currentSequence++;
if (currentSequence >= flowsToExecute.size()) {
- execution.setVariable("completed", true);
+ execution.setVariable(COMPLETED, true);
} else {
- execution.setVariable("completed", false);
+ execution.setVariable(COMPLETED, false);
}
execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
}
@@ -131,7 +116,8 @@ public class WorkflowActionBBTasks {
}
} catch (Exception ex) {
logger.warn(
- "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.");
+ "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.",
+ ex);
}
}
@@ -226,11 +212,16 @@ public class WorkflowActionBBTasks {
final String action = (String) execution.getVariable(G_ACTION);
final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
final String resourceName = (String) execution.getVariable("resourceName");
+ String statusMessage = (String) execution.getVariable("StatusMessage");
String macroAction = "";
- if (aLaCarte) {
- macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
+ if (statusMessage == null) {
+ if (aLaCarte) {
+ macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
+ } else {
+ macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
+ }
} else {
- macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly.";
+ macroAction = statusMessage;
}
execution.setVariable("finalStatusMessage", macroAction);
Timestamp endTime = new Timestamp(System.currentTimeMillis());
@@ -240,6 +231,7 @@ public class WorkflowActionBBTasks {
request.setProgress(Long.valueOf(100));
request.setRequestStatus("COMPLETE");
request.setLastModifiedBy("CamundaBPMN");
+ requestsDbListener.post(request, new DelegateExecutionImpl(execution));
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception ex) {
workflowAction.buildAndThrowException(execution, "Error Updating Request Database", ex);
@@ -247,7 +239,7 @@ public class WorkflowActionBBTasks {
}
public void checkRetryStatus(DelegateExecution execution) {
- String handlingCode = (String) execution.getVariable("handlingCode");
+ String handlingCode = (String) execution.getVariable(HANDLINGCODE);
String requestId = (String) execution.getVariable(G_REQUEST_ID);
String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
@@ -255,11 +247,11 @@ public class WorkflowActionBBTasks {
try {
envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
} catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries", ex);
envMaxRetries = 5;
}
int nextCount = retryCount + 1;
- if (handlingCode.equals("Retry")) {
+ if ("Retry".equals(handlingCode)) {
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
try {
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
@@ -270,8 +262,8 @@ public class WorkflowActionBBTasks {
logger.warn("Failed to update Request Db Infra Active Requests with Retry Status", ex);
}
if (retryCount < envMaxRetries) {
- int currSequence = (int) execution.getVariable("gCurrentSequence");
- execution.setVariable("gCurrentSequence", currSequence - 1);
+ int currSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ execution.setVariable(G_CURRENT_SEQUENCE, currSequence - 1);
execution.setVariable(RETRY_COUNT, nextCount);
} else {
workflowAction.buildAndThrowException(execution,
@@ -312,30 +304,29 @@ public class WorkflowActionBBTasks {
}
}
- String handlingCode = (String) execution.getVariable("handlingCode");
+ String handlingCode = (String) execution.getVariable(HANDLINGCODE);
List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
rollbackFlowsFiltered.addAll(rollbackFlows);
- if (handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")) {
+ if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
for (int i = 0; i < rollbackFlows.size(); i++) {
if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")) {
rollbackFlowsFiltered.remove(rollbackFlows.get(i));
} else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
- && handlingCode.equals("RollbackToCreated")) {
+ && ROLLBACKTOCREATED.equals(handlingCode)) {
rollbackFlowsFiltered.remove(rollbackFlows.get(i));
}
}
}
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
-
if (rollbackFlows.isEmpty())
execution.setVariable("isRollbackNeeded", false);
else
execution.setVariable("isRollbackNeeded", true);
execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
- execution.setVariable("handlingCode", "PreformingRollback");
+ execution.setVariable(HANDLINGCODE, "PreformingRollback");
execution.setVariable("isRollback", true);
- execution.setVariable("gCurrentSequence", 0);
+ execution.setVariable(G_CURRENT_SEQUENCE, 0);
execution.setVariable(RETRY_COUNT, 0);
} else {
workflowAction.buildAndThrowException(execution,
@@ -366,6 +357,7 @@ public class WorkflowActionBBTasks {
}
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception ex) {
+ logger.error("Exception in updateInstanceId", ex);
workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
}
}
@@ -373,12 +365,12 @@ public class WorkflowActionBBTasks {
public void postProcessingExecuteBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- String handlingCode = (String) execution.getVariable("handlingCode");
+ String handlingCode = (String) execution.getVariable(HANDLINGCODE);
final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
- if (bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) {
+ if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) {
postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
}
}
@@ -422,16 +414,16 @@ public class WorkflowActionBBTasks {
.forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
executeBB.getBuildingBlock().getBpmnFlowName()));
execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("completed", false);
+ execution.setVariable(COMPLETED, false);
} else {
- logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
+ logger.debug("No cvnfcCustomization found for customizationId: {}", modelCustomizationId);
}
}
} catch (EntityNotFoundException e) {
- logger.debug(e.getMessage() + " Will not be running Fabric Config Building Blocks");
+ logger.debug("Will not be running Fabric Config Building Blocks", e);
} catch (Exception e) {
String errorMessage = "Error occurred in post processing of Vf Module create";
- execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable(HANDLINGCODE, ROLLBACKTOCREATED);
execution.setVariable("WorkflowActionErrorMessage", errorMessage);
logger.error(errorMessage, e);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
index 99ae2e7495..f672aa4b59 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAI.java
@@ -22,18 +22,25 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.List;
import java.util.Optional;
+import org.onap.aai.domain.yang.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class WorkflowActionExtractResourcesAAI {
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionExtractResourcesAAI.class);
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+
public Optional<Configuration> extractRelationshipsConfiguration(Relationships relationships) {
List<AAIResultWrapper> configurations = relationships.getByType(AAIObjectType.CONFIGURATION);
for (AAIResultWrapper configWrapper : configurations) {
@@ -45,6 +52,18 @@ public class WorkflowActionExtractResourcesAAI {
return Optional.empty();
}
+ public Optional<VpnBinding> extractRelationshipsVpnBinding(Relationships relationships) {
+ List<AAIResourceUri> configurations = relationships.getRelatedUris(AAIObjectType.VPN_BINDING);
+ for (AAIResourceUri vpnBindingUri : configurations) {
+ AAIResultWrapper vpnBindingWrapper = bbInputSetupUtils.getAAIResourceDepthOne(vpnBindingUri);
+ Optional<VpnBinding> vpnBinding = vpnBindingWrapper.asBean(VpnBinding.class);
+ if (vpnBinding.isPresent()) {
+ return vpnBinding;
+ }
+ }
+ return Optional.empty();
+ }
+
public Optional<Relationships> extractRelationshipsVnfc(Relationships relationships) {
List<AAIResultWrapper> vnfcs = relationships.getByType(AAIObjectType.VNFC);
for (AAIResultWrapper vnfcWrapper : vnfcs) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
index af8f93b92b..05a51797dd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java
@@ -22,9 +22,15 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
public enum WorkflowType {
- SERVICE("Service"), VNF("Vnf"), VFMODULE("VfModule"), VOLUMEGROUP("VolumeGroup"), NETWORK("Network"), VIRTUAL_LINK(
- "VirtualLink"), NETWORKCOLLECTION(
- "NetworkCollection"), CONFIGURATION("Configuration"), INSTANCE_GROUP("InstanceGroup");
+ SERVICE("Service"),
+ VNF("Vnf"),
+ VFMODULE("VfModule"),
+ VOLUMEGROUP("VolumeGroup"),
+ NETWORK("Network"),
+ VIRTUAL_LINK("VirtualLink"),
+ NETWORKCOLLECTION("NetworkCollection"),
+ CONFIGURATION("Configuration"),
+ INSTANCE_GROUP("InstanceGroup");
private final String type;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java
new file mode 100644
index 0000000000..6254aae029
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners;
+
+import java.util.List;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.springframework.stereotype.Component;
+
+@Component
+public class HomingListener implements FlowManipulator {
+
+
+ @Override
+ public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
+ return "AssignVnfBB".equals(currentBBName);
+ }
+
+ @Override
+ public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
+ BuildingBlockExecution execution) {
+
+ boolean homing = (boolean) execution.getVariable("homing");
+ boolean calledHoming = (boolean) execution.getVariable("calledHoming");
+ if (homing && !calledHoming) {
+ currentBB.setHoming(true);
+ execution.setVariable("calledHoming", true);
+ }
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java
new file mode 100644
index 0000000000..4cde9c1fc8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.db.PostCompletionRequestsDbListener;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MultiStageSkipListener implements FlowManipulator, PostCompletionRequestsDbListener {
+
+ @Autowired
+ protected BBInputSetupUtils bbInputSetupUtils;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ private static final String G_MULTI_STAGE_DESIGN = "multiStageDesign";
+
+ @Override
+ public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
+ return ((boolean) execution.getVariable(BBConstants.G_ALACARTE)) && "AssignVfModuleBB".equals(currentBBName)
+ && isFirst;
+ }
+
+
+ @Override
+ public boolean shouldRunFor(BuildingBlockExecution execution) {
+
+ return (boolean) Optional.ofNullable(execution.getVariable(G_MULTI_STAGE_DESIGN)).orElse(false);
+ }
+
+ @Override
+ public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
+ BuildingBlockExecution execution) {
+ String vfModuleId = currentBB.getResourceId();
+ String vnfId = currentBB.getWorkflowResourceIds().getVnfId();
+ org.onap.aai.domain.yang.VfModule vfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
+ if (vfModule == null) {
+ org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
+ if (vnf != null) {
+ VnfResourceCustomization vnfCust = catalogDbClient
+ .getVnfResourceCustomizationByModelCustomizationUUID(vnf.getModelCustomizationId());
+ if (vnfCust != null && vnfCust.getMultiStageDesign() != null
+ && vnfCust.getMultiStageDesign().equalsIgnoreCase("true")) {
+ flowsToExecute.retainAll(Collections.singletonList(currentBB));
+ execution.setVariable(G_MULTI_STAGE_DESIGN, Boolean.valueOf(vnfCust.getMultiStageDesign()));
+ }
+ }
+ }
+
+ }
+
+ @Override
+ public void run(InfraActiveRequests request, BuildingBlockExecution execution) {
+ request.setFlowStatus("Successfully completed Assign Building Block only due to multi-stage-design VNF");
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java
new file mode 100644
index 0000000000..772fca0841
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java
@@ -0,0 +1,44 @@
+package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners;
+
+import java.util.List;
+import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SkipConfigVnfListener implements FlowManipulator {
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ @Override
+ public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
+ return "ConfigAssignVnfBB".equals(currentBBName) || "ConfigDeployVnfBB".equals(currentBBName);
+ }
+
+ @Override
+ public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
+ BuildingBlockExecution execution) {
+ String vnfCustomizationUUID = currentBB.getBuildingBlock().getKey();
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = catalogDbClient
+ .getVnfResourceCustomizationByModelUuid(currentBB.getRequestDetails().getModelInfo().getModelUuid());
+ if (vnfResourceCustomizations != null && !vnfResourceCustomizations.isEmpty()) {
+ VnfResourceCustomization vrc =
+ catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations);
+ boolean skipConfigVNF = vrc.isSkipPostInstConf();
+ if (skipConfigVNF) {
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE,
+ ((int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE)) + 1);
+ }
+ }
+ }
+
+
+
+}
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 4fee1f909b..173e776af9 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
@@ -34,7 +34,6 @@ import org.onap.so.adapters.nwrest.ContrailNetwork;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.adapters.nwrest.NetworkTechnology;
import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
@@ -261,7 +260,7 @@ public class NetworkAdapterObjectMapper {
* @param L3Network
* @return List<org.onap.so.openstack.beans.Subnet>
*/
- private List<Subnet> buildOpenstackSubnetList(L3Network l3Network) {
+ protected List<Subnet> buildOpenstackSubnetList(L3Network l3Network) {
List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets();
List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<org.onap.so.openstack.beans.Subnet>();
@@ -292,9 +291,10 @@ public class NetworkAdapterObjectMapper {
.setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask()));
List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes();
List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>();
- org.onap.so.openstack.beans.HostRoute openstackHostRoute = new org.onap.so.openstack.beans.HostRoute();
+ org.onap.so.openstack.beans.HostRoute openstackHostRoute = null;
// TODO only 2 fields available on openstack object. Confirm it is sufficient or add as needed
for (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute hostRoute : hostRouteList) {
+ openstackHostRoute = new org.onap.so.openstack.beans.HostRoute();
openstackHostRoute.setNextHop(hostRoute.getNextHop());
openstackHostRoute.setPrefix(hostRoute.getRoutePrefix());
// add host route to the list
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 b0ba0595d5..5c69987a54 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -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
@@ -31,9 +33,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Optional;
import javax.annotation.PostConstruct;
-import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang3.StringUtils;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
@@ -77,6 +79,9 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.entity.MsoRequest;
import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.openstack.utils.MsoMulticloudUtils;
+import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonParseException;
@@ -91,6 +96,7 @@ import com.google.common.base.Joiner;
public class VnfAdapterVfModuleObjectMapper {
@Autowired
protected VnfAdapterObjectMapperUtils vnfAdapterObjectMapperUtils;
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleObjectMapper.class);
private static List<String> sdncResponseParamsToSkip =
asList("vnf_id", "vf_module_id", "vnf_name", "vf_module_name");
@@ -118,7 +124,7 @@ public class VnfAdapterVfModuleObjectMapper {
public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
- throws JsonParseException, JsonMappingException, IOException {
+ throws IOException, MissingValueTagException {
CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
@@ -167,7 +173,7 @@ public class VnfAdapterVfModuleObjectMapper {
private Map<String, Object> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance,
GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
- throws JsonParseException, JsonMappingException, IOException {
+ throws IOException, MissingValueTagException {
GenericResourceApiVnfTopology vnfTop =
@@ -202,22 +208,28 @@ public class VnfAdapterVfModuleObjectMapper {
return paramsMap;
}
- private void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive,
- Map<String, Object> srcMap) {
+ protected void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive,
+ Map<String, Object> srcMap) throws MissingValueTagException {
StringBuilder directives = new StringBuilder();
- int no_directives_size = 0;
- if (directives.equals(MsoMulticloudUtils.USER_DIRECTIVES)
+ int noOfDirectivesSize = 0;
+ if (directive.equals(MsoMulticloudUtils.USER_DIRECTIVES)
&& srcMap.containsKey(MsoMulticloudUtils.OOF_DIRECTIVES)) {
- no_directives_size = 1;
+ noOfDirectivesSize = 1;
}
- if (srcMap.size() > no_directives_size) {
+ if (srcMap.size() > noOfDirectivesSize) {
directives.append("{ \"attributes\": [ ");
int i = 0;
- for (String attributeName : srcMap.keySet()) {
- if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directives)
+ for (Map.Entry<String, Object> attributeEntry : srcMap.entrySet()) {
+ String attributeName = attributeEntry.getKey();
+ Object attributeValue = attributeEntry.getValue();
+ if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directive)
&& attributeName.equals(MsoMulticloudUtils.OOF_DIRECTIVES))) {
- directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString()));
- if (i < (srcMap.size() - 1 + no_directives_size))
+ if (attributeValue == null) {
+ logger.error("No value tag found for attribute: {}", attributeName);
+ throw new MissingValueTagException("No value tag found for " + attributeName);
+ }
+ directives.append(new AttributeNameValue(attributeName, attributeValue.toString()));
+ if (i < (srcMap.size() - 1 + noOfDirectivesSize))
directives.append(", ");
i++;
}
@@ -247,7 +259,7 @@ public class VnfAdapterVfModuleObjectMapper {
private void buildParamsMapFromVnfSdncResponse(Map<String, Object> paramsMap,
GenericResourceApiVnftopologyVnfTopology vnfTopology, Map<String, String> networkRoleMap,
- boolean skipVnfResourceAssignments) throws JsonParseException, JsonMappingException, IOException {
+ boolean skipVnfResourceAssignments) throws IOException {
// Get VNF parameters from SDNC response
GenericResourceApiParam vnfParametersData = vnfTopology.getVnfParametersData();
buildParamsMapFromSdncParams(paramsMap, vnfParametersData);
@@ -324,7 +336,7 @@ public class VnfAdapterVfModuleObjectMapper {
private void buildParamsMapFromVfModuleSdncResponse(Map<String, Object> paramsMap,
GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology, boolean skipVfModuleAssignments)
- throws JsonParseException, JsonMappingException, IOException {
+ throws IOException {
// Get VF Module parameters from SDNC response
GenericResourceApiParam vfModuleParametersData = vfModuleTopology.getVfModuleParameters();
buildParamsMapFromSdncParams(paramsMap, vfModuleParametersData);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/exceptions/MissingValueTagException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/exceptions/MissingValueTagException.java
new file mode 100644
index 0000000000..7271971e46
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/exceptions/MissingValueTagException.java
@@ -0,0 +1,15 @@
+package org.onap.so.client.adapter.vnf.mapper.exceptions;
+
+public class MissingValueTagException extends Exception {
+
+ private static final long serialVersionUID = -1598147488593823724L;
+
+ public MissingValueTagException() {
+ super();
+ }
+
+ public MissingValueTagException(String message) {
+ super(message);
+ }
+
+}
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 717bb04099..088ce1ac38 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
@@ -24,6 +24,7 @@ package org.onap.so.client.namingservice;
import java.io.IOException;
import java.util.List;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.namingservice.model.NameGenDeleteResponse;
import org.onap.namingservice.model.NameGenResponse;
@@ -43,6 +44,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class NamingClientResponseValidator {
private static final Logger logger = LoggerFactory.getLogger(NamingClientResponseValidator.class);
private static final String INSTANCE_GROUP_NAME = "instance-group-name";
+ private static final String SERVICE_INSTANCE_NAME = "Service-Instance-Name";
private static final String NO_RESPONSE_FROM_NAMING_SERVICE =
"Error did not receive a response from Naming Service.";
private static final String NULL_RESPONSE_FROM_NAMING_SERVICE =
@@ -51,8 +53,9 @@ 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", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
+ NO_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -60,7 +63,7 @@ public class NamingClientResponseValidator {
String generatedName = "";
NameGenResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
NULL_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
@@ -78,6 +81,9 @@ public class NamingClientResponseValidator {
if (INSTANCE_GROUP_NAME.equals(resourceName)) {
generatedName = respElement.getResourceValue();
break;
+ } else if (SERVICE_INSTANCE_NAME.equals(resourceName)) {
+ generatedName = respElement.getResourceValue();
+ break;
}
}
}
@@ -90,7 +96,7 @@ public class NamingClientResponseValidator {
errorMessageString = error.getMessage();
}
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
@@ -99,8 +105,9 @@ 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", ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_NAMING_SERVICE);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ NO_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
+ NO_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NO_RESPONSE_FROM_NAMING_SERVICE);
}
@@ -108,7 +115,7 @@ public class NamingClientResponseValidator {
String responseMessage = "";
NameGenDeleteResponse responseBody = response.getBody();
if (responseBody == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
NULL_RESPONSE_FROM_NAMING_SERVICE, "BPMN", ErrorCode.UnknownError.getValue(),
NULL_RESPONSE_FROM_NAMING_SERVICE);
throw new BadResponseException(NULL_RESPONSE_FROM_NAMING_SERVICE);
@@ -121,7 +128,7 @@ public class NamingClientResponseValidator {
String errorMessageString = NAMING_SERVICE_ERROR;
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
@@ -141,7 +148,7 @@ public class NamingClientResponseValidator {
errorMessageString = error.getMessage();
}
String errorMessage = String.format(NAMING_SERVICE_ERROR, errorMessageString);
- logger.error("{} {} {} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), errorMessage, "BPMN",
ErrorCode.DataError.getValue(), errorMessage);
return errorMessage;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
new file mode 100644
index 0000000000..3d3058da0b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.namingservice;
+
+import java.util.HashMap;
+
+public class NamingRequestObject {
+
+ private HashMap<String, String> namingRequestMap = new HashMap<String, String>();
+
+ public HashMap<String, String> getNamingRequestObjectMap() {
+ return this.namingRequestMap;
+ }
+
+ public String getExternalKeyValue() {
+ return namingRequestMap.get(NamingServiceConstants.NS_EXTERNAL_KEY);
+ }
+
+ public void setExternalKeyValue(String externalKey) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_EXTERNAL_KEY, externalKey);
+ }
+
+ public String getPolicyInstanceNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_POLICY_INSTANCE_NAME);
+ }
+
+ public void setPolicyInstanceNameValue(String policyInstanceName) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_POLICY_INSTANCE_NAME, policyInstanceName);
+ }
+
+ public String getNamingTypeValue() {
+ return namingRequestMap.get(NamingServiceConstants.NS_NAMING_TYPE);
+ }
+
+ public void setNamingTypeValue(String namingType) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_NAMING_TYPE, namingType);
+ }
+
+ public String getResourceNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_RESOURCE_NAME);
+ }
+
+ public void setResourceNameValue(String resourceName) {
+ namingRequestMap.put(NamingServiceConstants.NS_RESOURCE_NAME, resourceName);
+ }
+
+ public String getNfNamingCodeValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_NF_NAMING_CODE);
+ }
+
+ public void setNfNamingCodeValue(String nfNamingCode) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_NF_NAMING_CODE, nfNamingCode);
+ }
+
+ public String getServiceModelNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_SERVICE_MODEL_NAME);
+ }
+
+ public void setServiceModelNameValue(String serviceModelName) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_SERVICE_MODEL_NAME, serviceModelName);
+ }
+
+ public String getModelVersionValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_MODEL_VERSION);
+ }
+
+ public void setModelVersionValue(String modelVersion) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_MODEL_VERSION, modelVersion);
+ }
+
+ public String getNetworkNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_NETWORK_NAME);
+ }
+
+ public void setNetworkNameValue(String networkName) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_NETWORK_NAME, networkName);
+ }
+
+ public String getVpnNameValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_VPN_NAME);
+ }
+
+ public void setVpnNameValue(String vpnName) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_VPN_NAME, vpnName);
+ }
+
+ public String getZoneIdValue() {
+ return this.namingRequestMap.get(NamingServiceConstants.NS_ZONE_ID);
+ }
+
+ public void setZoneIdValue(String zoneId) {
+ this.namingRequestMap.put(NamingServiceConstants.NS_ZONE_ID, zoneId);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceConstants.java
new file mode 100644
index 0000000000..5637410af0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceConstants.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.namingservice;
+
+public class NamingServiceConstants {
+ public static final String NS_EXTERNAL_KEY = "external-key";
+ public static final String NS_POLICY_INSTANCE_NAME = "policy-instance-name";
+ public static final String NS_NAMING_TYPE = "naming-type";
+ public static final String NS_RESOURCE_NAME = "resource-name";
+ public static final String NS_NF_NAMING_CODE = "nf-naming-code";
+ public static final String NS_SERVICE_MODEL_NAME = "service-model-name";
+ public static final String NS_MODEL_VERSION = "model-version";
+ public static final String NS_NETWORK_NAME = "network-name";
+ public static final String NS_VPN_NAME = "vpn-name";
+ public static final String NS_ZONE_ID = "zone-id";
+ public static final String NS_RESOURCE_VALUE = "resource-value";
+
+ public static final String NAMING_TYPE_SERVICE = "SERVICE";
+ public static final String RESOURCE_NAME_SERVICE_INSTANCE_NAME = "Service-Instance-Name";
+ public static final String RESOURCE_NAME_SERVICEINSTANCE = "ServiceInstance";
+
+ private NamingServiceConstants() {}
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceUtils.java
new file mode 100644
index 0000000000..16c8e5549c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingServiceUtils.java
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.namingservice;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class NamingServiceUtils {
+
+ private static String errorMessages = "Policy name is not present, or Onap name was not generated! ";
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ public void checkVpnBondingService(BuildingBlockExecution execution) {
+ execution.setVariable("isVpnBondingService", false);
+ boolean isNamingPolicyAndOnapGeneratedNaming = false;
+ checkBondingAndInfrastureVpn(execution);
+ boolean isBondingAndInsfrastructureVpn = execution.getVariable("isBondingAndInsfrastructureVpn");
+ if (isBondingAndInsfrastructureVpn) {
+ checkNamingPolicyAndOnapGeneratedNaming(execution);
+ isNamingPolicyAndOnapGeneratedNaming = execution.getVariable("isNamingPolicyAndOnapGeneratedNaming");
+ }
+ if (isBondingAndInsfrastructureVpn && isNamingPolicyAndOnapGeneratedNaming) {
+ execution.setVariable("isVpnBondingService", true);
+ }
+ }
+
+ public void checkBondingAndInfrastureVpn(BuildingBlockExecution execution) {
+ execution.setVariable("isBondingAndInsfrastructureVpn", false);
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ if ("bonding".equalsIgnoreCase(serviceInstance.getModelInfoServiceInstance().getServiceType())
+ && "infrastructure-vpn"
+ .equalsIgnoreCase(serviceInstance.getModelInfoServiceInstance().getServiceRole())) {
+ execution.setVariable("isBondingAndInsfrastructureVpn", true);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void checkNamingPolicyAndOnapGeneratedNaming(BuildingBlockExecution execution) {
+ execution.setVariable("isNamingPolicyAndOnapGeneratedNaming", false);
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ if (serviceInstance.getModelInfoServiceInstance().getNamingPolicy() != null
+ && !serviceInstance.getModelInfoServiceInstance().getNamingPolicy().isEmpty()
+ && serviceInstance.getModelInfoServiceInstance().getOnapGeneratedNaming() != null
+ && serviceInstance.getModelInfoServiceInstance().getOnapGeneratedNaming() == true) {
+ execution.setVariable("isNamingPolicyAndOnapGeneratedNaming", true);
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, errorMessages);
+ }
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
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 1453e40653..8b939940fa 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -24,6 +24,7 @@ import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -51,7 +52,7 @@ public class AAIConfigurationResources {
AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
- injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
+ injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration));
}
/**
@@ -79,7 +80,7 @@ public class AAIConfigurationResources {
/**
* A&AI call to disconnect configuration relation with service instance
- *
+ *
* @param configurationId
* @param serviceInstanceId
*/
@@ -211,7 +212,7 @@ public class AAIConfigurationResources {
/**
* Get Configuration from AAI using related Link
- *
+ *
* @param relatedLink related link - URI
* @return AAI Configuration object
*/
@@ -228,4 +229,20 @@ public class AAIConfigurationResources {
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
}
+
+ public void updateConfigurationOrchestrationStatus(Configuration configuration,
+ OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri aaiResourceUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration();
+ aaiConfiguration.setOrchestrationStatus(orchestrationStatus.name());
+ injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
+ }
+
+ public boolean checkConfigurationNameInUse(String configurationName) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ .queryParam("configuration-name", configurationName);
+ return injectionHelper.getAaiClient().exists(uri);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIEntityNotFoundException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIEntityNotFoundException.java
new file mode 100644
index 0000000000..5f65e5d76d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIEntityNotFoundException.java
@@ -0,0 +1,16 @@
+package org.onap.so.client.orchestration;
+
+public class AAIEntityNotFoundException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -107868951852460677L;
+
+ public AAIEntityNotFoundException(String error) {
+ super(error);
+ }
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
index c48593037a..296d052315 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
@@ -25,6 +25,7 @@ import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -84,4 +85,11 @@ public class AAIInstanceGroupResources {
injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup))
.connect(instanceGroupUri, serviceInstanceURI);
}
+
+ public boolean checkInstanceGroupNameInUse(String instanceGroupName) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ .queryParam("instance-group-name", instanceGroupName);
+ return injectionHelper.getAaiClient().exists(uri);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
index b936551549..bc702c9fb4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
@@ -32,6 +32,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -206,4 +207,11 @@ public class AAINetworkResources {
AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, networkPolicyId);
injectionHelper.getAaiClient().delete(networkPolicyURI);
}
+
+ public boolean checkNetworkNameInUse(String networkName) {
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
+ return injectionHelper.getAaiClient().exists(uri);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
index e391349d2c..fc1528526c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
@@ -22,7 +22,9 @@
package org.onap.so.client.orchestration;
+import java.util.List;
import java.util.Optional;
+import org.onap.aai.domain.yang.OwningEntities;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
@@ -61,9 +63,9 @@ public class AAIServiceInstanceResources {
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
customer.getServiceSubscription().getServiceType(), serviceInstance.getServiceInstanceId());
serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance =
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
aaiObjectMapper.mapServiceInstance(serviceInstance);
- injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(AAIServiceInstance));
+ injectionHelper.getAaiClient().createIfNotExists(serviceInstanceURI, Optional.of(aaiServiceInstance));
}
/**
@@ -87,24 +89,24 @@ public class AAIServiceInstanceResources {
public void createProject(Project project) {
AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
- org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project);
- injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject));
+ org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project);
+ injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject));
}
public void createProjectandConnectServiceInstance(Project project, ServiceInstance serviceInstance) {
AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, project.getProjectName());
AAIResourceUri serviceInstanceURI =
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
- org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project);
- injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(AAIProject)).connect(projectURI,
+ org.onap.aai.domain.yang.Project aaiProject = aaiObjectMapper.mapProject(project);
+ injectionHelper.getAaiClient().createIfNotExists(projectURI, Optional.of(aaiProject)).connect(projectURI,
serviceInstanceURI);
}
public void createOwningEntity(OwningEntity owningEntity) {
AAIResourceUri owningEntityURI =
AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
- org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
- injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity));
+ org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
+ injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity));
}
public boolean existsOwningEntity(OwningEntity owningEntity) {
@@ -120,6 +122,25 @@ public class AAIServiceInstanceResources {
return aaiRC.exists(owningEntityUri);
}
+ public org.onap.aai.domain.yang.OwningEntity getOwningEntityByName(String owningEntityName)
+ throws AAIEntityNotFoundException {
+ AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
+ .queryParam("owning-entity-name", owningEntityName);
+ AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
+ Optional<OwningEntities> owningEntities = aaiRC.get(OwningEntities.class, owningEntityUri);
+ if (owningEntities.isPresent()) {
+ List<org.onap.aai.domain.yang.OwningEntity> owningEntityList = owningEntities.get().getOwningEntity();
+ if (owningEntityList.size() > 1) {
+ throw new AAIEntityNotFoundException(
+ "Non unique result returned for owning entity name: " + owningEntityName);
+ } else {
+ return owningEntityList.get(0);
+ }
+ } else {
+ throw new AAIEntityNotFoundException("No result returned for owning entity name: " + owningEntityName);
+ }
+ }
+
public void connectOwningEntityandServiceInstance(OwningEntity owningEntity, ServiceInstance serviceInstance) {
AAIResourceUri owningEntityURI =
AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
@@ -134,8 +155,8 @@ public class AAIServiceInstanceResources {
AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntity.getOwningEntityId());
AAIResourceUri serviceInstanceURI =
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
- org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
- injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(AAIOwningEntity))
+ org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = aaiObjectMapper.mapOwningEntity(owningEntity);
+ injectionHelper.getAaiClient().createIfNotExists(owningEntityURI, Optional.of(aaiOwningEntity))
.connect(owningEntityURI, serviceInstanceURI);
}
@@ -152,10 +173,15 @@ public class AAIServiceInstanceResources {
public void updateServiceInstance(ServiceInstance serviceInstance) {
AAIResourceUri serviceInstanceURI =
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance.getServiceInstanceId());
- org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance =
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance =
aaiObjectMapper.mapServiceInstance(serviceInstance);
- injectionHelper.getAaiClient().update(serviceInstanceURI, AAIServiceInstance);
+ injectionHelper.getAaiClient().update(serviceInstanceURI, aaiServiceInstance);
}
+ public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) {
+ AAIResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ .queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
+ return injectionHelper.getAaiClient().exists(uriSI);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
index 83fe31a116..4d1a6dce38 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
@@ -23,12 +23,15 @@
package org.onap.so.client.orchestration;
import java.util.Optional;
+import org.onap.aai.domain.yang.VfModules;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -40,7 +43,6 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVfModuleResources.class);
@Autowired
private InjectionHelper injectionHelper;
@@ -97,8 +99,8 @@ public class AAIVfModuleResources {
public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) {
AAIResourceUri vfModuleURI =
AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
- org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
- injectionHelper.getAaiClient().update(vfModuleURI, AAIVfModule);
+ org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(vfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
}
public void connectVfModuleToVolumeGroup(GenericVnf vnf, VfModule vfModule, VolumeGroup volumeGroup,
@@ -109,4 +111,19 @@ public class AAIVfModuleResources {
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
injectionHelper.getAaiClient().connect(vfModuleURI, volumeGroupURI);
}
+
+ public boolean checkNameInUse(VfModule vfModule) {
+ boolean nameInUse = false;
+ AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ .queryParam("vf-module-name", vfModule.getVfModuleName());
+ AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ if (injectionHelper.getAaiClient().exists(vfModuleUriWithCustomization)) {
+ // assume it's a resume case and return false
+ nameInUse = false;
+ } else {
+ nameInUse = injectionHelper.getAaiClient().exists(vfModuleUri);
+ }
+ return nameInUse;
+ }
}
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 fc61d862aa..63bde79b3f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
@@ -24,26 +24,27 @@ package org.onap.so.client.orchestration;
import java.io.IOException;
import java.util.Optional;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
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.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIValidatorImpl;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AAIVnfResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVnfResources.class);
@Autowired
private InjectionHelper injectionHelper;
@@ -153,4 +154,20 @@ public class AAIVnfResources {
return aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
}
+
+ public boolean checkNameInUse(String vnfName) {
+ AAIResourceUri vnfUri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
+ return injectionHelper.getAaiClient().exists(vnfUri);
+ }
+
+ public AAIResultWrapper queryVnfWrapperById(GenericVnf vnf) {
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()).depth(Depth.ALL);
+ return injectionHelper.getAaiClient().get(uri);
+ }
+
+ public Optional<Vserver> getVserver(AAIResourceUri uri) {
+ return injectionHelper.getAaiClient().get(uri).asBean(Vserver.class);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
index c24d1483e2..b9e4aeb888 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
@@ -26,6 +26,7 @@ import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
@@ -38,7 +39,6 @@ import org.springframework.stereotype.Component;
@Component
public class AAIVolumeGroupResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIVolumeGroupResources.class);
@Autowired
private InjectionHelper injectionHelper;
@@ -94,4 +94,10 @@ public class AAIVolumeGroupResources {
copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup));
}
+
+ public boolean checkNameInUse(VolumeGroup volumeGroup) {
+ AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ .queryParam("volume-group-name", volumeGroup.getVolumeGroupName());
+ return injectionHelper.getAaiClient().exists(volumeGroupUri);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
index 3ac61dff60..168d370521 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
@@ -21,7 +21,6 @@
package org.onap.so.client.orchestration;
import java.util.Optional;
-import javax.ws.rs.NotFoundException;
import org.onap.aai.domain.yang.VpnBindings;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
index 06535bb765..5513122560 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
@@ -24,12 +24,14 @@ package org.onap.so.client.orchestration;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import org.onap.namingservice.model.Element;
import org.onap.namingservice.model.Deleteelement;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.namingservice.NamingClient;
+import org.onap.so.client.namingservice.NamingRequestObject;
import org.onap.so.client.namingservice.NamingRequestObjectBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,4 +65,25 @@ public class NamingServiceResources {
return (namingClient
.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements)));
}
+
+ public String generateServiceInstanceName(NamingRequestObject namingRequestObject)
+ throws BadResponseException, IOException {
+ HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap();
+ Element element = new Element();
+ nsRequestObject.forEach((k, v) -> element.put(k, v));
+ List<Element> elements = new ArrayList<Element>();
+ elements.add(element);
+ return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
+ }
+
+ public String deleteServiceInstanceName(NamingRequestObject namingRequestObject)
+ throws BadResponseException, IOException {
+ HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap();
+ Deleteelement delElement = new Deleteelement();
+ nsRequestObject.forEach((k, v) -> delElement.setExternalKey(v));
+ List<Deleteelement> delElements = new ArrayList<Deleteelement>();
+ delElements.add(delElement);
+ return (namingClient.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(delElements)));
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
index ca32130c23..4aa6a1026a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
@@ -28,9 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
-import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
index 54a9cabb57..0123eb67be 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
@@ -32,14 +32,11 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SDNCNetworkResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCNetworkResources.class);
@Autowired
private NetworkTopologyOperationRequestMapper sdncRM;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
index 60cad78f5d..01511eaccc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
@@ -22,6 +22,7 @@
package org.onap.so.client.orchestration;
+import java.net.URI;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -36,14 +37,11 @@ import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SDNCVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class);
@Autowired
private VfModuleTopologyOperationRequestMapper sdncRM;
@@ -53,22 +51,22 @@ public class SDNCVfModuleResources {
public GenericResourceApiVfModuleOperationInformation assignVfModule(VfModule vfModule, VolumeGroup volumeGroup,
GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion,
- RequestContext requestContext) throws MapperException {
+ RequestContext requestContext, URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
}
public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance) throws MapperException {
+ ServiceInstance serviceInstance, RequestContext requestContext, URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
- vnf, serviceInstance, null, null, null, null);
+ vnf, serviceInstance, null, null, requestContext, null, callbackURI);
}
public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
+ URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
}
public String queryVfModule(VfModule vfModule) throws MapperException, BadResponseException {
@@ -77,16 +75,16 @@ public class SDNCVfModuleResources {
}
public GenericResourceApiVfModuleOperationInformation activateVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
+ URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
}
public GenericResourceApiVfModuleOperationInformation changeAssignVfModule(VfModule vfModule, GenericVnf vnf,
- ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext)
- throws MapperException {
+ ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
+ URI callbackURI) throws MapperException {
return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule,
- null, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ null, vnf, serviceInstance, customer, cloudRegion, requestContext, null, callbackURI);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
index 954cbc1b1d..27edeed02a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
@@ -22,6 +22,7 @@
package org.onap.so.client.orchestration;
+import java.net.URI;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -35,14 +36,11 @@ import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SDNCVnfResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVnfResources.class);
@Autowired
private VnfTopologyOperationRequestMapper sdncRM;
@@ -50,50 +48,122 @@ public class SDNCVnfResources {
@Autowired
private SDNCClient sdncClient;
+ /**
+ * This method is used for setting the SDNCSvcAction for assignVnf .
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing,
+ URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, homing);
+ cloudRegion, requestContext, homing, callbackURI);
}
+ /**
+ * This method is used for setting the SDNCSvcAction for activate vnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
-
+ /**
+ * This method is used for setting the SDNCSvcAction for deactivate vnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
-
+ /**
+ * This method is used for setting the SDNCSvcAction for unassign vnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
+ /**
+ * This method is used for setting the SDNCSvcAction for delete vnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
+ /**
+ * This method is used for setting the SDNCSvcAction for changeModelVnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ cloudRegion, requestContext, false, callbackURI);
}
+ /**
+ * This method is used for querying SDNC client for getting the vnf details.
+ *
+ * @param vnf
+ * @exception MapperException & BadResponseException
+ * @return
+ */
public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException {
String queryPath = vnf.getSelflink();
return sdncClient.get(queryPath);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
index 939f53727d..6a15ca321a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
@@ -33,27 +33,59 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+/**
+ * This class is used for creating and deleting the request for VfModule.
+ *
+ */
@Component
public class VnfAdapterVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVfModuleResources.class);
@Autowired
private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper;
+ /**
+ * This method is used for creating the request for the VfModule.
+ *
+ * This method take these parameter and call the VnfAdapterVfModuleObjectMapper to create the request.
+ *
+ * @param requestContext
+ * @param cloudRegion
+ * @param orchestrationContext
+ * @param serviceInstance
+ * @param genericVnf
+ * @param vfModule
+ * @param volumeGroup
+ * @param sdncVnfQueryResponse
+ * @param sdncVfModuleQueryResponse
+ * @throws IOException & MissingValueTagException
+ * @return
+ */
public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse)
- throws IOException {
+ throws IOException, MissingValueTagException {
return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion,
orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse,
sdncVfModuleQueryResponse);
}
+ /**
+ * This method is used for delete the request for the VfModule.
+ *
+ * This method take these parameter and call the VnfAdapterVfModuleObjectMapper to delete the request.
+ *
+ * @param requestContext
+ * @param cloudRegion
+ * @param serviceInstance
+ * @param genericVnf
+ * @param vfModule
+ * @throws IOException
+ * @return
+ */
public DeleteVfModuleRequest deleteVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion,
ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule) throws IOException {
return vnfAdapterVfModuleObjectMapper.deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance,
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
index c97ca8e0ea..2ec63182a0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
@@ -39,7 +39,6 @@ import org.springframework.stereotype.Component;
@Component
public class VnfAdapterVolumeGroupResources {
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterVolumeGroupResources.class);
@Autowired
private VnfAdapterObjectMapper vnfAdapterObjectMapper;
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 f02d5e48ee..07f448e5e1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -29,8 +29,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCProperties;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
@@ -39,8 +37,6 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCClient {
- private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
-
@Autowired
private SDNCProperties properties;
@Autowired
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 e21f64accd..1144648517 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
@@ -25,6 +25,7 @@ package org.onap.so.client.sdnc;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.onap.so.client.exception.BadResponseException;
@@ -52,6 +53,7 @@ public class SdnCommonTasks {
private static final String SDNC_CODE_NOT_0_OR_IN_200_299 = "Error from SDNC: %s";
private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON =
"ERROR: Could not convert SDNC pojo to json string.";
+ private static final String BRACKETS = LoggingAnchor.FIVE;
/***
*
@@ -66,8 +68,8 @@ public class SdnCommonTasks {
try {
jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
} catch (JsonProcessingException e) {
- logger.error("{} {} {} {} {}", MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON,
- "BPMN", ErrorCode.DataError.getValue(), e.getMessage());
+ logger.error(BRACKETS, MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, "BPMN",
+ ErrorCode.DataError.getValue(), e.getMessage());
throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON);
}
jsonRequest = "{\"input\":" + jsonRequest + "}";
@@ -84,7 +86,7 @@ public class SdnCommonTasks {
HttpHeaders httpHeader = new HttpHeaders();
httpHeader.set("Authorization", auth);
httpHeader.setContentType(MediaType.APPLICATION_JSON);
- List<MediaType> acceptMediaTypes = new ArrayList<MediaType>();
+ List<MediaType> acceptMediaTypes = new ArrayList<>();
acceptMediaTypes.add(MediaType.APPLICATION_JSON);
httpHeader.setAccept(acceptMediaTypes);
return httpHeader;
@@ -98,7 +100,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",
+ logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
}
@@ -125,7 +127,7 @@ public class SdnCommonTasks {
return jsonResponse;
} else {
String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
+ logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
ErrorCode.DataError.getValue(), errorMessage);
throw new BadResponseException(errorMessage);
}
@@ -139,7 +141,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",
+ logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
}
@@ -149,7 +151,7 @@ public class SdnCommonTasks {
try {
stringOutput = objMapper.writeValueAsString(output);
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN",
+ logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "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/beans/SDNCRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
index 5910975051..2c8bdd931c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
@@ -21,7 +21,6 @@
package org.onap.so.client.sdnc.beans;
import java.io.Serializable;
-import java.time.Duration;
import java.util.UUID;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -35,9 +34,9 @@ public class SDNCRequest implements Serializable {
private static final long serialVersionUID = 4679678988657593282L;
private String timeOut = "PT1H";
private SDNCTopology topology;
- private String CorrelationValue = UUID.randomUUID().toString();
- private String CorrelationName = "SDNCCallback";
- private Object SDNCPayload;
+ private String correlationValue = UUID.randomUUID().toString();
+ private String correlationName = "SDNCCallback";
+ private transient Object sdncPayload;
public String getTimeOut() {
@@ -57,27 +56,27 @@ public class SDNCRequest implements Serializable {
}
public String getCorrelationValue() {
- return CorrelationValue;
+ return correlationValue;
}
public void setCorrelationValue(String correlationValue) {
- CorrelationValue = correlationValue;
+ this.correlationValue = correlationValue;
}
public String getCorrelationName() {
- return CorrelationName;
+ return correlationName;
}
public void setCorrelationName(String correlationName) {
- CorrelationName = correlationName;
+ this.correlationName = correlationName;
}
public Object getSDNCPayload() {
- return SDNCPayload;
+ return sdncPayload;
}
public void setSDNCPayload(Object sDNCPayload) {
- SDNCPayload = sDNCPayload;
+ this.sdncPayload = sDNCPayload;
}
@Override
@@ -86,13 +85,13 @@ public class SDNCRequest implements Serializable {
return false;
}
SDNCRequest castOther = (SDNCRequest) other;
- return new EqualsBuilder().append(CorrelationValue, castOther.CorrelationValue)
- .append(CorrelationName, castOther.CorrelationName).isEquals();
+ return new EqualsBuilder().append(correlationValue, castOther.correlationValue)
+ .append(correlationName, castOther.correlationName).isEquals();
}
@Override
public int hashCode() {
- return new HashCodeBuilder().append(CorrelationValue).append(CorrelationName).toHashCode();
+ return new HashCodeBuilder().append(correlationValue).append(correlationName).toHashCode();
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
index 1718de9fe0..d6216c509d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
@@ -23,22 +23,17 @@ package org.onap.so.client.sdnc.beans;
import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration;
public enum SDNCSvcAction {
- ACTIVATE("activate", GenericResourceApiSvcActionEnumeration.ACTIVATE), DELETE("delete",
- GenericResourceApiSvcActionEnumeration.DELETE), ASSIGN("assign",
- GenericResourceApiSvcActionEnumeration.ASSIGN), ROLLBACK("rollback",
- GenericResourceApiSvcActionEnumeration.ROLLBACK), UNASSIGN("unassign",
- GenericResourceApiSvcActionEnumeration.UNASSIGN), DEACTIVATE("deactivate",
- GenericResourceApiSvcActionEnumeration.DEACTIVATE), CHANGE_DELETE(
- "changedelete",
- GenericResourceApiSvcActionEnumeration.CHANGEDELETE), CHANGE_ASSIGN(
- "changeassign",
- GenericResourceApiSvcActionEnumeration.CHANGEASSIGN), CREATE(
- "create",
- GenericResourceApiSvcActionEnumeration.CREATE), ENABLE(
- "enable",
- GenericResourceApiSvcActionEnumeration.ENABLE), DISABLE(
- "disable",
- GenericResourceApiSvcActionEnumeration.DISABLE);
+ ACTIVATE("activate", GenericResourceApiSvcActionEnumeration.ACTIVATE),
+ DELETE("delete", GenericResourceApiSvcActionEnumeration.DELETE),
+ ASSIGN("assign", GenericResourceApiSvcActionEnumeration.ASSIGN),
+ ROLLBACK("rollback", GenericResourceApiSvcActionEnumeration.ROLLBACK),
+ UNASSIGN("unassign", GenericResourceApiSvcActionEnumeration.UNASSIGN),
+ DEACTIVATE("deactivate", GenericResourceApiSvcActionEnumeration.DEACTIVATE),
+ CHANGE_DELETE("changedelete", GenericResourceApiSvcActionEnumeration.CHANGEDELETE),
+ CHANGE_ASSIGN("changeassign", GenericResourceApiSvcActionEnumeration.CHANGEASSIGN),
+ CREATE("create", GenericResourceApiSvcActionEnumeration.CREATE),
+ ENABLE("enable", GenericResourceApiSvcActionEnumeration.ENABLE),
+ DISABLE("disable", GenericResourceApiSvcActionEnumeration.DISABLE);
private final String name;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
index b9b04bc7b7..4edbf37bad 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
@@ -22,14 +22,14 @@ package org.onap.so.client.sdnc.beans;
public enum SDNCSvcOperation {
- VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"), NETWORK_TOPOLOGY_OPERATION(
- "network-topology-operation"), VNF_TOPOLOGY_OPERATION(
- "vnf-topology-operation"), CONTRAIL_ROUTE_TOPOLOGY_OPERATION(
- "contrail-route-topology-operation"), SECURITY_ZONE_TOPOLOGY_OPERATION(
- "security-zone-topology-operation"), PORT_MIRROR_TOPOLOGY_OPERATION(
- "port-mirror-topology-operation"), SERVICE_TOPOLOGY_OPERATION(
- "service-topology-operation"), GENERIC_CONFIGURATION_TOPOLOGY_OPERATION(
- "generic-configuration-topology-operation");
+ VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"),
+ NETWORK_TOPOLOGY_OPERATION("network-topology-operation"),
+ VNF_TOPOLOGY_OPERATION("vnf-topology-operation"),
+ CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"),
+ SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"),
+ PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"),
+ SERVICE_TOPOLOGY_OPERATION("service-topology-operation"),
+ GENERIC_CONFIGURATION_TOPOLOGY_OPERATION("generic-configuration-topology-operation");
private final String name;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
index fb5f24694b..ae9fe6ad70 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
@@ -22,11 +22,14 @@ package org.onap.so.client.sdnc.endpoint;
public enum SDNCTopology {
- SERVICE("service-topology-operation"), VNF("vnf-topology-operation"), VFMODULE(
- "vf-module-topology-operation"), CONTRAILROUTE("contrail-route-topology-operation"), PORTMIRROR(
- "port-mirror-topology-operation"), NETWORK("network-topology-operation"), SECURITYZONE(
- "security-zone-topology-operation"), CONFIGURATION(
- "generic-configuration-topology-operation");
+ SERVICE("service-topology-operation"),
+ VNF("vnf-topology-operation"),
+ VFMODULE("vf-module-topology-operation"),
+ CONTRAILROUTE("contrail-route-topology-operation"),
+ PORTMIRROR("port-mirror-topology-operation"),
+ NETWORK("network-topology-operation"),
+ SECURITYZONE("security-zone-topology-operation"),
+ CONFIGURATION("generic-configuration-topology-operation");
private final String topology;
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 6627625d62..6ddb292a6c 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
@@ -22,8 +22,10 @@
package org.onap.so.client.sdnc.mapper;
+import java.net.URI;
import java.util.Map;
import java.util.UUID;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
@@ -64,7 +66,7 @@ public class VfModuleTopologyOperationRequestMapper {
public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation,
SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf,
ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext,
- String sdncAssignResponse) throws MapperException {
+ String sdncAssignResponse, URI callbackURL) throws MapperException {
GenericResourceApiVfModuleOperationInformation req = new GenericResourceApiVfModuleOperationInformation();
boolean includeModelInformation = false;
@@ -113,7 +115,7 @@ public class VfModuleTopologyOperationRequestMapper {
GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput =
buildVfModuleRequestInput(vfModule, volumeGroup, cloudRegion, requestContext);
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
- buildVfModuleSdncRequestHeader(sdncReqId, genericResourceApiSvcAction);
+ buildVfModuleSdncRequestHeader(sdncReqId, genericResourceApiSvcAction, callbackURL);
req.setRequestInformation(requestInformation);
req.setSdncRequestHeader(sdncRequestHeader);
@@ -169,13 +171,12 @@ public class VfModuleTopologyOperationRequestMapper {
}
private GenericResourceApiSdncrequestheaderSdncRequestHeader buildVfModuleSdncRequestHeader(String sdncReqId,
- GenericResourceApiSvcActionEnumeration svcAction) {
+ GenericResourceApiSvcActionEnumeration svcAction, URI callbackUrl) {
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
new GenericResourceApiSdncrequestheaderSdncRequestHeader();
-
sdncRequestHeader.setSvcRequestId(sdncReqId);
sdncRequestHeader.setSvcAction(svcAction);
-
+ sdncRequestHeader.setSvcNotificationUrl(callbackUrl.toString());
return sdncRequestHeader;
}
@@ -188,7 +189,7 @@ public class VfModuleTopologyOperationRequestMapper {
mapper.readValue(sdncAssignResponse, GenericResourceApiVfModuleResponseInformation.class);
objectPath = assignResponseInfo.getVfModuleResponseInformation().getObjectPath();
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
+ logger.error(LoggingAnchor.FIVE, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), e.getMessage(), "BPMN",
ErrorCode.UnknownError.getValue(), e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
index f31bff988a..fd0af3a4dd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
@@ -20,6 +20,7 @@
package org.onap.so.client.sdnc.mapper;
+import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -54,9 +55,26 @@ public class VnfTopologyOperationRequestMapper {
@Autowired
private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+ /**
+ * This method is used for creating the vnf request.
+ *
+ * By these parameter it will get he detailas and prepare the request.
+ *
+ * @param svcOperation
+ * @param svcAction
+ * @param requestAction
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return request
+ */
public GenericResourceApiVnfOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction,
GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing,
+ URI callbackUrl) {
String sdncReqId = UUID.randomUUID().toString();
String msoRequestId = UUID.randomUUID().toString();
if (requestContext != null && requestContext.getMsoRequestId() != null) {
@@ -64,7 +82,7 @@ public class VnfTopologyOperationRequestMapper {
}
GenericResourceApiVnfOperationInformation req = new GenericResourceApiVnfOperationInformation();
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader =
- generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
+ generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId, callbackUrl.toString());
GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper
.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
GenericResourceApiServiceinformationServiceInformation serviceInformation =
@@ -126,7 +144,7 @@ public class VnfTopologyOperationRequestMapper {
}
List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
List<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds> networkInstanceGroupIdList =
- new ArrayList<GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds>();
+ new ArrayList<>();
for (InstanceGroup instanceGroup : instanceGroups) {
if (ModelInfoInstanceGroup.TYPE_L3_NETWORK
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
index 21c0b971b8..c63cbc0b68 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -37,7 +37,6 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
@Component
@@ -57,10 +56,10 @@ public class SniroClient {
*
* @param homingRequest
* @return
- * @throws JsonProcessingException
+ * @throws BadResponseException
* @throws BpmnError
*/
- public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException, JsonProcessingException {
+ public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException {
logger.trace("Started Sniro Client Post Demands");
String url = managerProperties.getHost() + managerProperties.getUri().get("v2");
logger.debug("Post demands url: {}", url);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
index a448082cfe..eb73001f42 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
@@ -49,7 +49,7 @@ public class SniroValidator {
JSONObject jsonResponse = new JSONObject(response);
if (jsonResponse.has("requestStatus")) {
String status = jsonResponse.getString("requestStatus");
- if (status.equals("accepted")) {
+ if ("accepted".equals(status)) {
logger.debug("Sniro Managers synchronous response indicates accepted");
} else {
String message = jsonResponse.getString("statusMessage");
@@ -111,7 +111,7 @@ public class SniroValidator {
if (!response.isEmpty()) {
String status = (String) response.get("status");
if (isNotBlank(status)) {
- if (status.equals("success")) {
+ if ("success".equals(status)) {
logger.debug("Sniro Conductors synchronous response indicates success");
} else {
String message = (String) response.get("message");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
index cded23aad2..3127275b24 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.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,13 @@ public class Candidate implements Serializable {
@JsonProperty("cloudOwner")
private String cloudOwner;
+ public Candidate() {}
+
+ public Candidate(CandidateType identifierType, List<String> identifiers, String cloudOwner) {
+ this.identifierType = identifierType;
+ this.identifiers = identifiers;
+ this.cloudOwner = cloudOwner;
+ }
public CandidateType getIdentifierType() {
return identifierType;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
index 19378cdbfa..0cc993560d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.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.
@@ -38,6 +38,10 @@ public class Demand implements Serializable {
private List<Candidate> requiredCandidates;
@JsonProperty("excludedCandidates")
private List<Candidate> excludedCandidates;
+ @JsonProperty("existingCandidates")
+ private List<Candidate> existingCandidates;
+ @JsonProperty("filteringAttributes")
+ private List<Candidate> filteringAttributes;
public List<Candidate> getRequiredCandidates() {
@@ -80,4 +84,20 @@ public class Demand implements Serializable {
this.modelInfo = modelInfo;
}
+ public List<Candidate> getExistingCandidates() {
+ return existingCandidates;
+ }
+
+ public void setExistingCandidates(List<Candidate> existingCandidates) {
+ this.existingCandidates = existingCandidates;
+ }
+
+ public List<Candidate> getFilteringAttributes() {
+ return filteringAttributes;
+ }
+
+ public void setFilteringAttributes(List<Candidate> filteringAttributes) {
+ this.filteringAttributes = filteringAttributes;
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
index d71b4ec5fc..9ab3ae673a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
@@ -30,7 +30,7 @@ public class LicenseInfo implements Serializable {
private static final long serialVersionUID = 6878164369491185856L;
@JsonProperty("licenseDemands")
- private List<Demand> demands = new ArrayList<Demand>();
+ private List<Demand> demands = new ArrayList<>();
public List<Demand> getDemands() {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
index ae13903a22..bbbbf9cfd6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
@@ -37,7 +37,7 @@ public class PlacementInfo implements Serializable {
@JsonProperty("subscriberInfo")
private SubscriberInfo subscriberInfo;
@JsonProperty("placementDemands")
- private List<Demand> demands = new ArrayList<Demand>();
+ private List<Demand> demands = new ArrayList<>();
@JsonRawValue
@JsonProperty("requestParameters")
private String requestParameters;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
index f632424c26..b8896a2bab 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
@@ -40,7 +40,7 @@ public class SniroConductorRequest implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class);
@JsonProperty("release-locks")
- private List<Resource> resources = new ArrayList<Resource>();
+ private List<Resource> resources = new ArrayList<>();
public List<Resource> getResources() {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
index eaf8b6e379..35a4cac459 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
@@ -22,7 +22,6 @@ package org.onap.so.client.sniro.beans;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("subscriberInfo")
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
index a78dffb4e0..12adec9e24 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/ticket/ExternalTicket.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.client.ticket;
public class ExternalTicket {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
index b40e43b959..39efa6dc76 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
@@ -35,6 +35,7 @@ import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.namingservice.NamingRequestObject;
import org.onap.so.client.orchestration.AAICollectionResources;
import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
@@ -150,4 +151,8 @@ public abstract class BaseTaskTest extends TestDataSetup {
@Mock
protected Environment env;
+
+ @Mock
+ protected NamingRequestObject namingRequestObject;
+
}
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 ff6426d351..4f1ad996dc 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
@@ -159,7 +159,7 @@ public class TestDataSetup {
public RequestContext buildRequestContext() {
RequestContext requestContext = new RequestContext();
- requestContext.setMsoRequestId(UUID.randomUUID().toString());
+ requestContext.setMsoRequestId("fb06f44c-c797-4f38-9b17-b4b975344600");
requestContext.setProductFamilyId("testProductFamilyId");
requestContext.setRequestorId("testRequestorId");
@@ -542,6 +542,11 @@ public class TestDataSetup {
modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter);
modelInfoVfModule.setModelName("testModelName" + vfModuleCounter);
modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter);
+ if (vfModuleCounter == 1) {
+ modelInfoVfModule.setIsBaseBoolean(Boolean.TRUE);
+ } else {
+ modelInfoVfModule.setIsBaseBoolean(Boolean.FALSE);
+ }
vfModule.setModelInfoVfModule(modelInfoVfModule);
return vfModule;
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 b054cc17bb..a8550d8df9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -54,16 +54,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
public class AAICreateTasksTest extends BaseTaskTest {
@@ -122,6 +122,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
@Test
public void createServiceInstanceTest() throws Exception {
+ doReturn(false).when(aaiServiceInstanceResources).checkInstanceServiceNameInUse(serviceInstance);
doNothing().when(aaiServiceInstanceResources).createServiceInstance(serviceInstance, customer);
aaiCreateTasks.createServiceInstance(execution);
verify(aaiServiceInstanceResources, times(1)).createServiceInstance(serviceInstance, customer);
@@ -140,7 +141,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
@Test
public void createVolumeGroupTest() throws Exception {
volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
-
+ execution.setVariable("aLaCarte", Boolean.FALSE);
doNothing().when(aaiVolumeGroupResources).createVolumeGroup(volumeGroup, cloudRegion);
doNothing().when(aaiVolumeGroupResources).connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion);
@@ -271,24 +272,6 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createOwningEntityNullOwningEntityIdTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- serviceInstance.getOwningEntity().setOwningEntityId(null);
-
- aaiCreateTasks.createOwningEntity(execution);
- }
-
- @Test
- public void createOwningEntityEmptyOwningEntityIdTest() throws Exception {
- expectedException.expect(BpmnError.class);
-
- serviceInstance.getOwningEntity().setOwningEntityId("");
-
- aaiCreateTasks.createOwningEntity(execution);
- }
-
- @Test
public void createOwningEntityNullOwningEntityNameTest() throws Exception {
expectedException.expect(BpmnError.class);
@@ -325,6 +308,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
@Test
public void createVnfTest() throws Exception {
doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
+ execution.setVariable("aLaCarte", Boolean.FALSE);
aaiCreateTasks.createVnf(execution);
verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
}
@@ -352,6 +336,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
.thenReturn(newVfModule);
assertEquals(null, newVfModule.getModuleIndex());
+ execution.setVariable("aLaCarte", Boolean.FALSE);
aaiCreateTasks.createVfModule(execution);
assertEquals(1, newVfModule.getModuleIndex().intValue());
verify(aaiVfModuleResources, times(1)).createVfModule(newVfModule, genericVnf);
@@ -398,7 +383,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
@Test
public void createNetworkTest() throws Exception {
network.getModelInfoNetwork().setNeutronNetworkType("PROVIDER");
-
+ execution.setVariable("aLaCarte", Boolean.FALSE);
doNothing().when(aaiNetworkResources).createNetworkConnectToServiceInstance(network, serviceInstance);
aaiCreateTasks.createNetwork(execution);
verify(aaiNetworkResources, times(1)).createNetworkConnectToServiceInstance(network, serviceInstance);
@@ -444,6 +429,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
public void createNetworkCollectionInstanceGroupTest() throws Exception {
doNothing().when(aaiNetworkResources)
.createNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ execution.setVariable("aLaCarte", Boolean.FALSE);
aaiCreateTasks.createNetworkCollectionInstanceGroup(execution);
verify(aaiNetworkResources, times(1))
.createNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
@@ -509,6 +495,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
public void createConfigurationTest() throws Exception {
gBBInput = execution.getGeneralBuildingBlock();
doNothing().when(aaiConfigurationResources).createConfiguration(configuration);
+ execution.setVariable("aLaCarte", Boolean.FALSE);
aaiCreateTasks.createConfiguration(execution);
verify(aaiConfigurationResources, times(1)).createConfiguration(configuration);
}
@@ -543,8 +530,11 @@ public class AAICreateTasksTest extends BaseTaskTest {
@Test
public void createInstanceGroupVnfTest() throws Exception {
+ doReturn(false).when(aaiInstanceGroupResources)
+ .checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName());
doNothing().when(aaiInstanceGroupResources).createInstanceGroupandConnectServiceInstance(instanceGroup,
serviceInstance);
+ execution.setVariable("aLaCarte", Boolean.FALSE);
aaiCreateTasks.createInstanceGroupVnf(execution);
verify(aaiInstanceGroupResources, times(1)).createInstanceGroupandConnectServiceInstance(instanceGroup,
serviceInstance);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index 905f244278..c337f7f1b5 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -733,7 +733,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CONFIGURE);
- aaiUpdateTasks.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+ aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfigureVnf(execution);
}
@Test
@@ -741,6 +741,6 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CONFIGURED);
- aaiUpdateTasks.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+ aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfiguredVnf(execution);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
index 56ff813e73..c0056291ef 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
@@ -22,22 +22,41 @@ package org.onap.so.bpmn.infrastructure.activity;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
import java.nio.file.Files;
import java.nio.file.Paths;
+import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.onap.so.client.exception.ExceptionBuilder;
public class ExecuteActivityTest extends BaseTaskTest {
@InjectMocks
protected ExecuteActivity executeActivity = new ExecuteActivity();
+ @InjectMocks
+ @Spy
+ private ExceptionBuilder exceptionBuilder;
+
+ @Mock
+ private WorkflowActionBBFailure workflowActionBBFailure;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
private DelegateExecution execution;
@Before
@@ -72,4 +91,17 @@ public class ExecuteActivityTest extends BaseTaskTest {
assertEquals(ebb.getBuildingBlock(), bb);
}
+ @Test
+ public void buildAndThrowException_Test() throws Exception {
+ doNothing().when(workflowActionBBFailure).updateRequestStatusToFailed(execution);
+ doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
+ thrown.expect(BpmnError.class);
+ executeActivity.buildAndThrowException(execution, "TEST EXCEPTION MSG");
+ String errorMessage = (String) execution.getVariable("ExecuteActivityErrorMessage");
+ assertEquals(errorMessage, "TEST EXCEPTION MSG");
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals(workflowException.getErrorMessage(), "TEST EXCEPTION MSG");
+ assertEquals(workflowException.getErrorCode(), 7000);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index d0cee42178..8aea2d2650 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -39,12 +39,14 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
+import org.onap.so.utils.TargetEntity;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -110,8 +112,9 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
delegateExecution.setVariable("networkAdapterRequest", updateNetworkRequest);
delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
- doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder)
- .buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(), any(String.class));
+ doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException(
+ any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class));
+
try {
networkAdapterRestV1Tasks.processCallback(delegateExecution);
} catch (BpmnError be) {
@@ -119,6 +122,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
}
assertNull(delegateExecution.getVariable("updateNetworkResponse"));
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
- eq("test error message"));
+ eq("test error message"), eq(TargetEntity.OPENSTACK));
}
}
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
index 5805ea5ec1..caae90bfff 100644
--- 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
@@ -119,5 +119,10 @@ public class InputParameterRetrieverTaskTest extends BaseTaskTest {
return null;
}
+ @Override
+ public int getCurrentSequence() {
+ return 0;
+ }
+
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java
index 84012e8b8d..a4d8aa85a2 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/StubbedBuildingBlockExecution.java
@@ -79,6 +79,11 @@ public class StubbedBuildingBlockExecution implements BuildingBlockExecution {
return null;
}
+ @Override
+ public int getCurrentSequence() {
+ return 0;
+ }
+
public static String getTenantId() {
return TENANT_ID;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java
index e7a8b35db8..8328e0e08b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksIT.java
@@ -19,11 +19,17 @@
*/
package org.onap.so.bpmn.infrastructure.appc.tasks;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Optional;
import java.util.UUID;
@@ -39,6 +45,8 @@ import org.springframework.beans.factory.annotation.Autowired;
public class AppcRunTasksIT extends BaseIntegrationTest {
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
@Autowired
private AppcRunTasks appcRunTasks;
@@ -56,8 +64,51 @@ public class AppcRunTasksIT extends BaseIntegrationTest {
}
@Test
- public void preProcessActivityTest() throws Exception {
+ public void preProcessActivityWithVserversTest() throws Exception {
+ final String aaiVnfJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnfWithVservers.json")));
+ wireMockServer.stubFor(
+ get(urlEqualTo("/aai/v15/network/generic-vnfs/generic-vnf/testVnfId1?depth=all")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody(aaiVnfJson).withStatus(200)));
+
+ final String aaiVserverJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverFullQueryResponse.json")));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(aaiVserverJson)
+ .withStatus(200)));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(aaiVserverJson)
+ .withStatus(200)));
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(aaiVserverJson)
+ .withStatus(200)));
+
+ appcRunTasks.preProcessActivity(execution);
+ String vserverIdList = execution.getVariable("vserverIdList");
+ String expectedVserverIdList =
+ "{\"vserverIds\":\"[\\\"1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5\\\",\\\"14551849-1e70-45cd-bc5d-a256d49548a2\\\",\\\"48bd7f11-408f-417c-b834-b41c1b98f7d7\\\"]\"}";
+ String vmIdList = execution.getVariable("vmIdList");
+ String expectedVmIdList =
+ "{\"vmIds\":\"[\\\"http://VSERVER-link.com\\\",\\\"http://VSERVER-link.com\\\",\\\"http://VSERVER-link.com\\\"]\"}";
+
+ assertEquals(vserverIdList, expectedVserverIdList);
+ assertEquals(vmIdList, expectedVmIdList);
+ assertEquals(execution.getVariable("actionQuiesceTraffic"), Action.QuiesceTraffic);
+ assertEquals(execution.getVariable("rollbackQuiesceTraffic"), false);
+ }
+
+ @Test
+ public void preProcessActivityNoVserversTest() throws Exception {
+ final String aaiVnfJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnf.json")));
+ wireMockServer.stubFor(
+ get(urlEqualTo("/aai/v15/network/generic-vnfs/generic-vnf/testVnfId1?depth=all")).willReturn(aResponse()
+ .withHeader("Content-Type", "application/json").withBody(aaiVnfJson).withStatus(200)));
appcRunTasks.preProcessActivity(execution);
+ assertNull(execution.getVariable("vmIdList"));
+ assertNull(execution.getVariable("vServerIdList"));
assertEquals(execution.getVariable("actionQuiesceTraffic"), Action.QuiesceTraffic);
assertEquals(execution.getVariable("rollbackQuiesceTraffic"), false);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
index cf673c5eb5..cc25689358 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
@@ -26,12 +26,17 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Optional;
import org.junit.Test;
import org.mockito.InjectMocks;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -39,11 +44,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class AppcRunTasksTest extends BaseTaskTest {
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
@InjectMocks
private AppcRunTasks appcRunTasks = new AppcRunTasks();
@@ -132,6 +142,32 @@ public class AppcRunTasksTest extends BaseTaskTest {
assertEquals(true, execution.getVariable("rollbackVnfLock"));
}
+ @Test
+ public void getVserversForAppcTest() throws Exception {
+
+ GenericVnf genericVnf = getTestGenericVnf();
+
+ final String aaiVnfJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnfWithVservers.json")));
+ final String aaiVserverJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverQueryResponse.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiVnfJson);
+ ObjectMapper mapper = new ObjectMapper();
+ Vserver vserver = mapper.readValue(aaiVserverJson, Vserver.class);
+ doReturn(aaiResultWrapper).when(aaiVnfResources).queryVnfWrapperById(genericVnf);
+ doReturn(Optional.of(vserver)).when(aaiVnfResources).getVserver(any(AAIResourceUri.class));
+ appcRunTasks.getVserversForAppc(execution, genericVnf);
+ String vserverIdList = execution.getVariable("vserverIdList");
+ String expectedVserverIdList =
+ "{\"vserverIds\":\"[\\\"1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5\\\",\\\"14551849-1e70-45cd-bc5d-a256d49548a2\\\",\\\"48bd7f11-408f-417c-b834-b41c1b98f7d7\\\"]\"}";
+ String vmIdList = execution.getVariable("vmIdList");
+ String expectedVmIdList =
+ "{\"vmIds\":\"[\\\"http://VSERVER-link.com\\\",\\\"http://VSERVER-link.com\\\",\\\"http://VSERVER-link.com\\\"]\"}";
+
+ assertEquals(vserverIdList, expectedVserverIdList);
+ assertEquals(vmIdList, expectedVmIdList);
+ }
+
private void mockReferenceResponse() {
ControllerSelectionReference reference = new ControllerSelectionReference();
reference.setControllerName("TEST-CONTROLLER-NAME");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java
index 3bf24291ea..cee06caa75 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
@@ -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,14 +21,20 @@ package org.onap.so.bpmn.infrastructure.audit;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
+import org.mockito.Mockito;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -36,6 +42,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import com.fasterxml.jackson.core.JsonProcessingException;
public class AuditTasksTest extends BaseTaskTest {
@@ -50,16 +61,29 @@ public class AuditTasksTest extends BaseTaskTest {
public final ExpectedException exception = ExpectedException.none();
@Before
- public void before() throws BBObjectNotFoundException {
+ public void before() throws BBObjectNotFoundException, JsonProcessingException {
serviceInstance = setServiceInstance();
genericVnf = setGenericVnf();
vfModule = setVfModule();
+ buildRequestContext();
setCloudRegion();
+ setRequestContext();
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);
+ execution.setVariable("auditQuerySuccess", true);
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ auditList.setHeatStackName("testHeatStackName");
+ AAIObjectAudit audit = new AAIObjectAudit();
+ Vserver vserver = new Vserver();
+ vserver.setVserverId("testVserverId");
+ audit.setAaiObject(vserver);
+ auditList.getAuditList().add(audit);
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ String auditListString = objectMapper.getMapper().writeValueAsString(audit);
+ execution.setVariable("auditList", auditListString);
}
@Test
@@ -68,8 +92,12 @@ public class AuditTasksTest extends BaseTaskTest {
expectedAuditInventory.setCloudOwner("testCloudOwner");
expectedAuditInventory.setCloudRegion("testLcpCloudRegionId");
expectedAuditInventory.setHeatStackName("testVfModuleName1");
+ expectedAuditInventory.setVfModuleId("testVfModuleId1");
expectedAuditInventory.setTenantId("testTenantId");
+ expectedAuditInventory.setGenericVnfId("testVnfId1");
+ expectedAuditInventory.setMsoRequestId("fb06f44c-c797-4f38-9b17-b4b975344600");
auditTasks.setupAuditVariable(execution);
assertThat((AuditInventory) execution.getVariable("auditInventory"), sameBeanAs(expectedAuditInventory));
}
+
}
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
index 6f76c83c6f..982b75ae8e 100644
--- 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
@@ -1,16 +1,20 @@
-
-/*
- * ============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_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=========================================================
*/
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
index 8d51ceb65f..7b6ba6b8fd 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
@@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.isA;
@@ -53,6 +53,7 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
public class SniroHomingV2IT extends BaseIntegrationTest {
@@ -107,6 +108,18 @@ public class SniroHomingV2IT extends BaseIntegrationTest {
serviceInstance.getAllottedResources().add(setAllottedResource("3"));
}
+ public void beforeServiceProxy() {
+ ServiceProxy sp = setServiceProxy("1", "infrastructure");
+ Candidate filteringAttributes = new Candidate();
+ filteringAttributes.setIdentifierType(CandidateType.CLOUD_REGION_ID);
+ List<String> c = new ArrayList<String>();
+ c.add("testCloudRegionId");
+ filteringAttributes.setCloudOwner("att");
+ filteringAttributes.setIdentifiers(c);
+ sp.getFilteringAttributes().add(filteringAttributes);
+ serviceInstance.getServiceProxies().add(sp);
+ }
+
public void beforeVnf() {
setGenericVnf();
}
@@ -191,6 +204,23 @@ public class SniroHomingV2IT extends BaseIntegrationTest {
verify(sniroClient, times(1)).postDemands(isA(SniroManagerRequest.class));
}
+ @Test
+ public void testCallSniro_success_1ServiceProxy() throws JsonProcessingException, BadResponseException {
+ beforeServiceProxy();
+
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
+
+ sniroHoming.callSniro(execution);
+
+ String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest1SP.json");
+ request = request.replace("28080", wireMockPort);
+
+ ArgumentCaptor<SniroManagerRequest> argument = ArgumentCaptor.forClass(SniroManagerRequest.class);
+ verify(sniroClient, times(1)).postDemands(argument.capture());
+ assertEquals(request, argument.getValue().toJsonString());
+ }
+
@Test(expected = Test.None.class)
public void testProcessSolution_success_1VpnLink_1Solution() {
beforeVpnBondingLink("1");
@@ -563,10 +593,57 @@ public class SniroHomingV2IT extends BaseIntegrationTest {
assertEquals(2, vnf.getLicense().getLicenseKeyGroupUuids().size());
assertEquals("f1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getEntitlementPoolUuids().get(0));
assertEquals("s1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getLicenseKeyGroupUuids().get(0));
+ }
+ @Test
+ public void testProcessSolution_success_1ServiceProxy_1Solutions() {
+ beforeServiceProxy();
+
+ JSONObject asyncResponse = new JSONObject();
+ asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState",
+ "completed");
+ JSONArray solution1 = new JSONArray();
+ solution1
+ .put(new JSONObject()
+ .put("serviceResourceId", "testProxyId1").put(
+ "solution",
+ new JSONObject()
+ .put("identifierType", "serviceInstanceId")
+ .put("identifiers", new JSONArray().put("testServiceInstanceId1")))
+ .put("assignmentInfo",
+ new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False"))
+ .put(new JSONObject().put("key", "cloudOwner").put("value", ""))
+ .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1"))
+ .put(new JSONObject().put("key", "aicVersion").put("value", "3"))
+ .put(new JSONObject().put("key", "cloudRegionId").put("value", ""))
+ .put(new JSONObject().put("key", "primaryPnfName").put("value",
+ "testPrimaryPnfName"))
+ .put(new JSONObject().put("key", "secondaryPnfName").put("value",
+ "testSecondaryPnfName"))));
+
+ asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1))
+ .put("licenseSolutions", new JSONArray()));
+ sniroHoming.processSolution(execution, asyncResponse.toString());
+
+ ServiceInstance si =
+ execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
+
+ ServiceProxy sp = si.getServiceProxies().get(0);
+ assertNotNull(sp);
+ assertNotNull(sp.getServiceInstance());
+
+ assertEquals("testServiceInstanceId1", sp.getServiceInstance().getServiceInstanceId());
+ assertNotNull(sp.getServiceInstance().getSolutionInfo());
+
+ assertFalse(sp.getServiceInstance().getPnfs().isEmpty());
+ assertEquals("testPrimaryPnfName", sp.getServiceInstance().getPnfs().get(0).getPnfName());
+ assertEquals("primary", sp.getServiceInstance().getPnfs().get(0).getRole());
+ assertEquals("testSecondaryPnfName", sp.getServiceInstance().getPnfs().get(1).getPnfName());
+ assertEquals("secondary", sp.getServiceInstance().getPnfs().get(1).getRole());
}
+
@Test(expected = BpmnError.class)
public void testCallSniro_error_0Resources() throws BadResponseException, JsonProcessingException {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
index f9ad473e5a..b40195c07b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.manualhandling.tasks;
import static org.junit.Assert.assertEquals;
@@ -18,6 +38,8 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.db.request.beans.InfraActiveRequests;
public class ManualHandlingTasksTest extends BaseTaskTest {
@@ -36,11 +58,13 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
@Mock
private DelegateTask task;
- private DelegateExecution delegateExecution;
+ @Mock
+ private BuildingBlockExecution buildingBlockExecution;
@Before
public void before() throws Exception {
delegateExecution = new DelegateExecutionFake();
+ buildingBlockExecution = new DelegateExecutionImpl(delegateExecution);
}
@Test
@@ -79,18 +103,18 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
@Test
public void updateRequestDbStatus_Test() throws Exception {
InfraActiveRequests mockedRequest = new InfraActiveRequests();
- delegateExecution.setVariable("msoRequestId", "testMsoRequestId");
+ buildingBlockExecution.setVariable("mso-request-id", "msoRequestId");
when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest);
doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class));
- manualHandlingTasks.updateRequestDbStatus(delegateExecution, "IN_PROGRESS");
+ manualHandlingTasks.updateRequestDbStatus(buildingBlockExecution, "IN_PROGRESS");
verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class));
assertEquals(mockedRequest.getRequestStatus(), "IN_PROGRESS");
}
@Test
public void createExternalTicket_Test() throws Exception {
- delegateExecution.setVariable("msoRequestId", ("testMsoRequestId"));
- delegateExecution.setVariable("vnfType", "testVnfType");
- manualHandlingTasks.createExternalTicket(delegateExecution);
+ buildingBlockExecution.setVariable("mso-request-id", ("testMsoRequestId"));
+ buildingBlockExecution.setVariable("vnfType", "testVnfType");
+ manualHandlingTasks.createExternalTicket(buildingBlockExecution);
}
}
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 f5785f94fd..609d2dabd8 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
@@ -21,32 +21,55 @@
package org.onap.so.bpmn.infrastructure.namingservice.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aai.domain.yang.Zone;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+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.BBInputSetupUtils;
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.namingservice.NamingRequestObject;
+import org.onap.so.client.namingservice.NamingServiceConstants;
public class NamingServiceCreateTasksTest extends BaseTaskTest {
@InjectMocks
- private NamingServiceCreateTasks namingServiceCreateTasks = new NamingServiceCreateTasks();
+ private NamingServiceCreateTasks namingServiceCreateTasks;
+
+ @Mock
+ private BBInputSetupUtils MOCK_bbInputSetupUtils;
private InstanceGroup instanceGroup;
+ private ServiceInstance serviceInstance;
@Before
public void before() throws BBObjectNotFoundException {
instanceGroup = setInstanceGroup();
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)))
.thenReturn(instanceGroup);
+ serviceInstance = setServiceInstance();
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
}
@Test
@@ -80,7 +103,47 @@ public class NamingServiceCreateTasksTest extends BaseTaskTest {
namingServiceCreateTasks.createInstanceGroupName(execution);
verify(namingServiceResources, times(1)).generateInstanceGroupName(instanceGroup, policyInstanceName,
nfNamingCode);
+ }
+
+ @Test
+ public void createWanTransportServiceNameTest() throws Exception {
+ String generatedName = "generatedWanTransportServiceName";
+ doReturn(generatedName).when(namingServiceResources).generateServiceInstanceName(any());
+ NamingServiceCreateTasks spy = Mockito.spy(namingServiceCreateTasks);
+ ArgumentCaptor<NamingRequestObject> captor = ArgumentCaptor.forClass(NamingRequestObject.class);
+ spy.createWanTransportServiceName(execution);
+ verify(namingServiceResources, times(1)).generateServiceInstanceName(captor.capture());
+ assertTrue(captor.getAllValues().get(0).getExternalKeyValue().startsWith("testServiceInstanceId"));
+ assertEquals(captor.getAllValues().get(0).getNamingTypeValue(), NamingServiceConstants.NAMING_TYPE_SERVICE);
+ assertEquals(captor.getAllValues().get(0).getResourceNameValue(),
+ NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
+ assertEquals(captor.getAllValues().get(0).getPolicyInstanceNameValue(), null);
+ assertTrue(captor.getAllValues().get(0).getServiceModelNameValue().startsWith("testModelName"));
+ assertTrue(captor.getAllValues().get(0).getModelVersionValue().startsWith("testModelVersion"));
+ assertEquals(generatedName, serviceInstance.getServiceInstanceName());
}
+ @Test
+ public void createVpnBondingServiceNameTest() throws Exception {
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID)))
+ .thenReturn(buildL3Network());
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VPN_ID)))
+ .thenReturn(buildVpnBinding());
+ ArgumentCaptor<NamingRequestObject> captor = ArgumentCaptor.forClass(NamingRequestObject.class);
+ String generatedName = "generatedWanTransportServiceName";
+ doReturn(generatedName).when(namingServiceResources).generateServiceInstanceName(any());
+ namingServiceCreateTasks.createVpnBondingServiceName(execution);
+ verify(namingServiceResources, times(1)).generateServiceInstanceName(captor.capture());
+ assertTrue(captor.getAllValues().get(0).getExternalKeyValue().startsWith("testServiceInstanceId"));
+ assertEquals(captor.getAllValues().get(0).getPolicyInstanceNameValue(), null);
+ assertEquals(captor.getAllValues().get(0).getNamingTypeValue(), NamingServiceConstants.NAMING_TYPE_SERVICE);
+ assertTrue(captor.getAllValues().get(0).getServiceModelNameValue().startsWith("testModelName"));
+ assertTrue(captor.getAllValues().get(0).getModelVersionValue().startsWith("testModelVersion"));
+ assertTrue(captor.getAllValues().get(0).getNetworkNameValue().startsWith("testNetworkName"));
+ assertTrue(captor.getAllValues().get(0).getVpnNameValue().startsWith("testVpnName"));
+ assertEquals(captor.getAllValues().get(0).getResourceNameValue(),
+ NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
+ assertEquals(generatedName, serviceInstance.getServiceInstanceName());
+ }
}
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 758b8f4ffd..32550a5467 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,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.namingservice.tasks;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
@@ -32,14 +33,17 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.namingservice.NamingRequestObject;
public class NamingServiceDeleteTasksTest extends BaseTaskTest {
@InjectMocks
private NamingServiceDeleteTasks namingServiceDeleteTasks = new NamingServiceDeleteTasks();
private InstanceGroup instanceGroup;
+ private ServiceInstance serviceInstance;
@Before
public void before() throws BBObjectNotFoundException {
@@ -68,4 +72,15 @@ public class NamingServiceDeleteTasksTest extends BaseTaskTest {
verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup);
}
+ @Test
+ public void deleteServiceInstanceNameTest() throws Exception {
+ serviceInstance = setServiceInstance();
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ doNothing().when(namingRequestObject).setExternalKeyValue(serviceInstance.getServiceInstanceId());
+ doReturn("").when(namingServiceResources).deleteServiceInstanceName(namingRequestObject);
+ namingServiceDeleteTasks.deleteServiceInstanceName(execution);
+ verify(namingServiceResources, times(1)).deleteServiceInstanceName(any(NamingRequestObject.class));
+ }
+
}
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 4eb1432bbf..510dc47649 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
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.net.URI;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -85,16 +86,19 @@ public class SDNCActivateTaskTest extends BaseTaskTest {
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.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090");
}
@Test
public void activateVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).activateVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).activateVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncActivateTasks.activateVnf(execution);
- verify(sdncVnfResources, times(1)).activateVnf(genericVnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ verify(sdncVnfResources, times(1)).activateVnf(eq(genericVnf), eq(serviceInstance), eq(customer),
+ eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@@ -102,8 +106,8 @@ public class SDNCActivateTaskTest extends BaseTaskTest {
@Test
public void activateVnfTestException() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).activateVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVnfResources).activateVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncActivateTasks.activateVnf(execution);
}
@@ -129,11 +133,12 @@ public class SDNCActivateTaskTest extends BaseTaskTest {
@Test
public void activateVfModuleTest() throws Exception {
- doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources)
- .activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).activateVfModule(
+ eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext),
+ any(URI.class));
sdncActivateTasks.activateVfModule(execution);
- verify(sdncVfModuleResources, times(1)).activateVfModule(vfModule, genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ verify(sdncVfModuleResources, times(1)).activateVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
}
@@ -141,8 +146,8 @@ public class SDNCActivateTaskTest extends BaseTaskTest {
@Test
public void activateVfModuleTestException() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVfModuleResources).activateVfModule(eq(vfModule), eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncActivateTasks.activateVfModule(execution);
}
}
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 7d8e94d1e9..b72766c386 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
@@ -28,6 +28,7 @@ import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.net.URI;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -89,6 +90,7 @@ public class SDNCAssignTasksTest extends BaseTaskTest {
.thenReturn(serviceInstance);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
.thenReturn(volumeGroup);
+ when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090");
}
@Test
@@ -111,12 +113,12 @@ public class SDNCAssignTasksTest extends BaseTaskTest {
@Test
public void assignVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext, false);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), eq(false), any(URI.class));
execution.setVariable("generalBuildingBlock", gBBInput);
sdncAssignTasks.assignVnf(execution);
- verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext,
- false);
+ verify(sdncVnfResources, times(1)).assignVnf(eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion),
+ eq(requestContext), eq(false), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@@ -124,18 +126,19 @@ public class SDNCAssignTasksTest extends BaseTaskTest {
@Test
public void assignVnfExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext, false);
+ doThrow(RuntimeException.class).when(sdncVnfResources).assignVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), eq(false), any(URI.class));
sdncAssignTasks.assignVnf(execution);
}
@Test
public void assignVfModuleTest() throws Exception {
doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).assignVfModule(
- vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ eq(vfModule), eq(volumeGroup), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion),
+ eq(requestContext), any(URI.class));
sdncAssignTasks.assignVfModule(execution);
- verify(sdncVfModuleResources, times(1)).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance,
- customer, cloudRegion, requestContext);
+ verify(sdncVfModuleResources, times(1)).assignVfModule(eq(vfModule), eq(volumeGroup), eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
}
@@ -143,8 +146,8 @@ public class SDNCAssignTasksTest extends BaseTaskTest {
@Test
public void assignVfModuleExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVfModuleResources).assignVfModule(eq(vfModule), eq(volumeGroup),
+ eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncAssignTasks.assignVfModule(execution);
}
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 1c1616a472..96ff01f78b 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
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.net.URI;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -74,15 +75,16 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
+ when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090");
}
@Test
public void changeModelVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).changeModelVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).changeModelVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncChangeAssignTasks.changeModelVnf(execution);
- verify(sdncVnfResources, times(1)).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ verify(sdncVnfResources, times(1)).changeModelVnf(eq(genericVnf), eq(serviceInstance), eq(customer),
+ eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@@ -90,18 +92,19 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest {
@Test
public void changeModelVnfExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVnfResources).changeModelVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncChangeAssignTasks.changeModelVnf(execution);
}
@Test
public void changeAssignModelVfModuleTest() throws Exception {
- doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources)
- .changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).changeAssignVfModule(
+ eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext),
+ any(URI.class));
sdncChangeAssignTasks.changeAssignModelVfModule(execution);
- verify(sdncVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ verify(sdncVfModuleResources, times(1)).changeAssignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
}
@@ -109,8 +112,8 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest {
@Test
public void changeAssignModelVfModuleExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVfModuleResources).changeAssignVfModule(eq(vfModule), eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncChangeAssignTasks.changeAssignModelVfModule(execution);
}
}
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 08d4d196da..3714f9d9a9 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
@@ -28,6 +28,7 @@ import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.net.URI;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -81,16 +82,17 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
-
+ when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090");
}
@Test
public void deactivateVfModuleTest() throws Exception {
- doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources)
- .deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).deactivateVfModule(
+ eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext),
+ any(URI.class));
sdncDeactivateTasks.deactivateVfModule(execution);
- verify(sdncVfModuleResources, times(1)).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ verify(sdncVfModuleResources, times(1)).deactivateVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
}
@@ -98,26 +100,26 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest {
@Test
public void deactivateVfModuleExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVfModuleResources).deactivateVfModule(eq(vfModule), eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncDeactivateTasks.deactivateVfModule(execution);
}
@Test
public void deactivateVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).deactivateVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).deactivateVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncDeactivateTasks.deactivateVnf(execution);
- verify(sdncVnfResources, times(1)).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ verify(sdncVnfResources, times(1)).deactivateVnf(eq(genericVnf), eq(serviceInstance), eq(customer),
+ eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@Test
public void deactivateVnfExceptionTest() throws Exception {
- doThrow(RuntimeException.class).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVnfResources).deactivateVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
expectedException.expect(BpmnError.class);
sdncDeactivateTasks.deactivateVnf(execution);
}
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 3ea8474b24..0ba9237aaf 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
@@ -43,6 +43,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.utils.TargetEntities;
+import org.onap.so.utils.TargetEntity;
public class SDNCQueryTasksTest extends BaseTaskTest {
@InjectMocks
@@ -61,8 +64,8 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
genericVnf = setGenericVnf();
vfModule = setVfModule();
- 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(Exception.class), any(TargetEntities.class));
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
@@ -88,6 +91,28 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
}
@Test
+ public void queryVfModuleBadResponseExceptionTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error received from SDNC");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModule(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void queryVfModuleResponseExceptionNoResponseTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error did not receive a response from SDNC.");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModule(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ }
+
+ @Test
public void queryVnfTest() throws Exception {
String sdncQueryResponse = "response";
@@ -101,6 +126,28 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
}
@Test
+ public void queryVnfBadResponseExceptionTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error received from SDNC");
+ doThrow(exception).when(sdncVnfResources).queryVnf(genericVnf);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVnf(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void queryVnfBadResponseExceptionNoResponseTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error did not receive a response from SDNC.");
+ doThrow(exception).when(sdncVnfResources).queryVnf(genericVnf);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVnf(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ }
+
+ @Test
public void queryVfModuleForVolumeGroupTest() throws Exception {
String sdncQueryResponse = "response";
vfModule.setSelflink("vfModuleSelfLink");
@@ -115,6 +162,28 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
}
@Test
+ public void queryVfModuleForVolumeGroupBadResponseExceptionTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error received from SDNC");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void queryVfModuleForVolumeGroupBadResponseExceptionNoResponseTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error did not receive a response from SDNC.");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ }
+
+ @Test
public void queryVfModuleForVolumeGroupNoSelfLinkExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
index b5d34ea4c9..0fc33fe5ce 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
@@ -21,10 +21,9 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
import java.io.IOException;
import java.io.StringReader;
import java.nio.file.Files;
@@ -39,7 +38,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
@@ -51,6 +49,7 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.utils.TargetEntity;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import com.fasterxml.jackson.core.JsonParseException;
@@ -151,7 +150,7 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks {
db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(new StringReader(sdncResponse)));
- String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator");
+ String finalMessageIndicator = getXmlElement(doc, "//*:ack-final-indicator");
String responseCode = getXmlElement(doc, "/input/response-code");
String responseMessage = getXmlElement(doc, "/input/response-message");
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 968723c628..98f6bfab9c 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
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.net.URI;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -81,6 +82,7 @@ public class SDNCUnassignTasksTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
+ when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090");
}
@Test
@@ -104,10 +106,11 @@ public class SDNCUnassignTasksTest extends BaseTaskTest {
@Test
public void unassignVfModuleTest() throws Exception {
- doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources)
- .unassignVfModule(vfModule, genericVnf, serviceInstance);
+ doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).unassignVfModule(
+ eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(requestContext), any(URI.class));
sdncUnassignTasks.unassignVfModule(execution);
- verify(sdncVfModuleResources, times(1)).unassignVfModule(vfModule, genericVnf, serviceInstance);
+ verify(sdncVfModuleResources, times(1)).unassignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance),
+ eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology());
}
@@ -115,18 +118,18 @@ public class SDNCUnassignTasksTest extends BaseTaskTest {
@Test
public void unassignVfModuleExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf,
- serviceInstance);
+ doThrow(RuntimeException.class).when(sdncVfModuleResources).unassignVfModule(eq(vfModule), eq(genericVnf),
+ eq(serviceInstance), eq(requestContext), any(URI.class));
sdncUnassignTasks.unassignVfModule(execution);
}
@Test
public void unassignVnfTest() throws Exception {
- doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).unassignVnf(genericVnf,
- serviceInstance, customer, cloudRegion, requestContext);
+ doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).unassignVnf(eq(genericVnf),
+ eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncUnassignTasks.unassignVnf(execution);
- verify(sdncVnfResources, times(1)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ verify(sdncVnfResources, times(1)).unassignVnf(eq(genericVnf), eq(serviceInstance), eq(customer),
+ eq(cloudRegion), eq(requestContext), any(URI.class));
SDNCRequest sdncRequest = execution.getVariable("SDNCRequest");
assertEquals(SDNCTopology.VNF, sdncRequest.getTopology());
}
@@ -134,8 +137,8 @@ public class SDNCUnassignTasksTest extends BaseTaskTest {
@Test
public void unassignVnfExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(RuntimeException.class).when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer,
- cloudRegion, requestContext);
+ doThrow(RuntimeException.class).when(sdncVnfResources).unassignVnf(eq(genericVnf), eq(serviceInstance),
+ eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class));
sdncUnassignTasks.unassignVnf(execution);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
new file mode 100644
index 0000000000..c05fd879ac
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
@@ -0,0 +1,219 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.InjectMocks;
+import org.mockito.Mockito;
+import org.onap.aai.domain.yang.AggregateRoute;
+import org.onap.aai.domain.yang.AggregateRoutes;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.RouteTarget;
+import org.onap.aai.domain.yang.RouteTargets;
+import org.onap.aai.domain.yang.Subnet;
+import org.onap.aai.domain.yang.Subnets;
+import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class VrfValidationTest extends BaseTaskTest {
+
+ protected ObjectMapper mapper = new ObjectMapper();
+
+ @InjectMocks
+ protected VrfValidation vrfValidation;
+
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
+ @Before
+ public void before() throws Exception {
+ vrfValidation.setBbInputSetupUtils(bbSetupUtils);
+ }
+
+ @Test
+ public void testVrfServiceValidation() throws VrfBondingServiceException {
+ Service service = new Service();
+ service.setModelName("modelName");
+ service.setServiceType("BONDING");
+ service.setServiceRole("VPN");
+ exceptionRule.expect(VrfBondingServiceException.class);
+ exceptionRule.expectMessage(
+ "Service: modelName does not have service type of BONDING and does not have service role of INFRASTRUCTURE-VPN");
+ vrfValidation.vrfServiceValidation(service);
+
+ service.setServiceType("BOND");
+ service.setServiceRole("INFRASTRUCTURE-VPN");
+ exceptionRule.expect(VrfBondingServiceException.class);
+ exceptionRule.expectMessage(
+ "Service: modelName does not have service type of BONDING and does not have service role of INFRASTRUCTURE-VPN");
+ vrfValidation.vrfServiceValidation(service);
+
+ service.setServiceType("BONDING");
+ service.setServiceRole("INFRASTRUCTURE-VPN");
+ ExpectedException.none();
+ vrfValidation.vrfServiceValidation(service);
+ }
+
+ @Test
+ public void testVrfCatalogDbChecks() throws VrfBondingServiceException {
+ Service service = new Service();
+ service.setModelName("modelName");
+ ConfigurationResourceCustomization configuration = new ConfigurationResourceCustomization();
+ service.setConfigurationCustomizations(new ArrayList<>());
+ service.getConfigurationCustomizations().add(configuration);
+ ServiceProxyResourceCustomization serviceProxy = new ServiceProxyResourceCustomization();
+ configuration.setServiceProxyResourceCustomization(serviceProxy);
+ service.setServiceProxyCustomizations(new ArrayList<>());
+ service.getServiceProxyCustomizations().add(serviceProxy);
+ Service sourceService = new Service();
+ sourceService.setServiceType("TRANSPORT");
+ serviceProxy.setSourceService(sourceService);
+ configuration.setType("VRF-ENTRY");
+ configuration.setRole("INFRASTRUCTURE-CLOUD-VPN");
+ ExpectedException.none();
+ vrfValidation.vrfCatalogDbChecks(service);
+ }
+
+ @Test
+ public void testAaiVpnBindingValidation() throws VrfBondingServiceException {
+ org.onap.aai.domain.yang.VpnBinding aaiVpnBinding = new org.onap.aai.domain.yang.VpnBinding();
+ aaiVpnBinding.setVpnType("SERVICE-INFRASTRUCTURE");
+ ExpectedException.none();
+ vrfValidation.aaiVpnBindingValidation("test-vpn", aaiVpnBinding);
+ }
+
+ @Test
+ public void testAaiVpnBindingValidationVpnBindingIsNull() throws VrfBondingServiceException {
+ exceptionRule.expect(VrfBondingServiceException.class);
+ exceptionRule.expectMessage("The infrastructure vpn test-vpn does not exist in A&AI.");
+ vrfValidation.aaiVpnBindingValidation("test-vpn", null);
+ }
+
+ @Test
+ public void testAaiNetworkValidation() throws VrfBondingServiceException {
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork = new org.onap.aai.domain.yang.L3Network();
+ aaiLocalNetwork.setNetworkId("test-network");
+ ExpectedException.none();
+ vrfValidation.aaiNetworkValidation("test-network", aaiLocalNetwork);
+ }
+
+ @Test
+ public void testAaiNetworkValidationNetworkIsNull() throws VrfBondingServiceException {
+ exceptionRule.expect(VrfBondingServiceException.class);
+ exceptionRule.expectMessage("The local network test-network does not exist in A&AI.");
+ vrfValidation.aaiNetworkValidation("test-network", null);
+ }
+
+ @Test
+ public void testAaiAggregateRouteValidation() throws VrfBondingServiceException {
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork = new org.onap.aai.domain.yang.L3Network();
+ aaiLocalNetwork.setAggregateRoutes(new AggregateRoutes());
+ aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().add(new AggregateRoute());
+ aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().get(0).setIpVersion("4");
+ ExpectedException.none();
+ vrfValidation.aaiAggregateRouteValidation(aaiLocalNetwork);
+
+ aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().add(new AggregateRoute());
+ aaiLocalNetwork.getAggregateRoutes().getAggregateRoute().get(1).setIpVersion("6");
+ ExpectedException.none();
+ vrfValidation.aaiAggregateRouteValidation(aaiLocalNetwork);
+
+ aaiLocalNetwork.setAggregateRoutes(null);
+ ExpectedException.none();
+ vrfValidation.aaiAggregateRouteValidation(aaiLocalNetwork);
+ }
+
+ @Test
+ public void testAaiSubnetValidation() throws VrfBondingServiceException {
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork = new org.onap.aai.domain.yang.L3Network();
+ aaiLocalNetwork.setNetworkId("myNetworkID");
+ aaiLocalNetwork.setSubnets(new Subnets());
+ aaiLocalNetwork.getSubnets().getSubnet().add(new Subnet());
+ aaiLocalNetwork.getSubnets().getSubnet().get(0).setIpVersion("4");
+ ExpectedException.none();
+ vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
+
+ aaiLocalNetwork.getSubnets().getSubnet().add(new Subnet());
+ aaiLocalNetwork.getSubnets().getSubnet().get(1).setIpVersion("6");
+ ExpectedException.none();
+ vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
+
+ aaiLocalNetwork.setSubnets(null);
+ exceptionRule.expect(VrfBondingServiceException.class);
+ exceptionRule.expectMessage("LocalNetwork: myNetworkID has no subnets");
+ vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
+ }
+
+ @Test
+ public void testIpVersionValidation() {
+ String ipVersion1 = "4";
+ String ipVersion2 = "6";
+ boolean validation = vrfValidation.ipVersionValidation(ipVersion1, ipVersion2);
+ assertEquals("Validation is correct", true, validation);
+
+
+ validation = vrfValidation.ipVersionValidation(ipVersion2, ipVersion1);
+ assertEquals("Validation is correct", true, validation);
+
+ ipVersion1 = "6";
+ validation = vrfValidation.ipVersionValidation(ipVersion1, ipVersion2);
+ assertEquals("Validation is correct", false, validation);
+ }
+
+ @Test
+ public void testAaiRouteTargetValidation()
+ throws VrfBondingServiceException, JsonParseException, JsonMappingException, IOException {
+ L3Network l3Network = mapper.readValue(
+ new File("src/test/resources/__files/BuildingBlocks/aaiNetworkWrapper.json"), L3Network.class);
+ AAIResultWrapper networkWrapper = new AAIResultWrapper(l3Network);
+ if (networkWrapper.getRelationships().isPresent()) {
+ List<AAIResourceUri> vpnBindingUris =
+ networkWrapper.getRelationships().get().getRelatedUris(AAIObjectType.VPN_BINDING);
+ VpnBinding vpnBinding = new VpnBinding();
+ vpnBinding.setRouteTargets(new RouteTargets());
+ vpnBinding.getRouteTargets().getRouteTarget().add(new RouteTarget());
+ AAIResultWrapper wrapper = Mockito.mock(AAIResultWrapper.class);
+ doReturn(wrapper).when(bbSetupUtils).getAAIResourceDepthOne(vpnBindingUris.get(0));
+ doReturn(Optional.of(vpnBinding)).when(wrapper).asBean(VpnBinding.class);
+ ExpectedException.none();
+ vrfValidation.aaiRouteTargetValidation(l3Network);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
index a6ce88f164..2d48d02774 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
@@ -21,11 +21,13 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
+import java.sql.Timestamp;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
@@ -39,6 +41,7 @@ import org.mockito.Spy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
public class WorkflowActionBBFailureTest extends BaseTaskTest {
@@ -84,6 +87,7 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
Mockito.verify(reqMock, Mockito.times(1)).setRequestStatus("FAILED");
Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100));
Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN");
+ Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class));
}
@Test
@@ -99,6 +103,24 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
workflowActionBBFailure.updateRequestStatusToFailed(execution);
String errorMsg = (String) execution.getVariable("ErrorMessage");
assertEquals("error in test case", errorMsg);
+ assertEquals(Status.FAILED.toString(), req.getRequestStatus());
+ }
+
+ @Test
+ public void updateRequestStatusToAborted() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", false);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "Abort");
+ InfraActiveRequests req = new InfraActiveRequests();
+ WorkflowException wfe = new WorkflowException("processKey123", 1, "error in test case");
+ execution.setVariable("WorkflowException", wfe);
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("ErrorMessage");
+ assertEquals("error in test case", errorMsg);
+ assertEquals(Status.ABORTED.toString(), req.getRequestStatus());
}
@Test
@@ -114,19 +136,52 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
workflowActionBBFailure.updateRequestStatusToFailed(execution);
String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
assertEquals("error in rollback", errorMsg);
+ assertEquals(Status.FAILED.toString(), req.getRequestStatus());
+ }
+
+ @Test
+ public void updateRequestStatusToRolledback() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", true);
+ execution.setVariable("isRollback", true);
+ execution.setVariable("rollbackTargetState", "ROLLED_BACK");
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
+ assertEquals("Rollback has been completed successfully.", errorMsg);
+ assertEquals(Status.ROLLED_BACK.toString(), req.getRequestStatus());
+ }
+
+ @Test
+ public void updateRequestStatusToRolledbackToAssigned() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", true);
+ execution.setVariable("isRollback", true);
+ execution.setVariable("rollbackTargetState", "ROLLED_BACK_TO_ASSIGNED");
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
+ assertEquals("Rollback has been completed successfully.", errorMsg);
+ assertEquals(Status.ROLLED_BACK_TO_ASSIGNED.toString(), req.getRequestStatus());
}
@Test
- public void updateRequestStatusToFailedRollbackCompleted() {
+ public void updateRequestStatusToRolledbackToCreated() {
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", true);
execution.setVariable("isRollback", true);
+ execution.setVariable("rollbackTargetState", "ROLLED_BACK_TO_CREATED");
InfraActiveRequests req = new InfraActiveRequests();
doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
workflowActionBBFailure.updateRequestStatusToFailed(execution);
String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
assertEquals("Rollback has been completed successfully.", errorMsg);
+ assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), req.getRequestStatus());
}
@Test
@@ -142,4 +197,53 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
String errorMsg = (String) execution.getVariable("ErrorMessage");
assertEquals("error in test case", errorMsg);
}
+
+ @Test
+ public void updateRequestErrorStatusMessageTest() {
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ WorkflowException we = new WorkflowException("WorkflowAction", 1231, "Error Case");
+ execution.setVariable("WorkflowException", we);
+
+ doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
+ Mockito.verify(reqMock, Mockito.times(1)).setStatusMessage("Error Case");
+ Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100));
+ Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN");
+ Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class));
+ }
+
+ @Test
+ public void updateRequestRollbackErrorStatusMessageTest() {
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ WorkflowException we = new WorkflowException("WorkflowAction", 1231, "Error Case");
+ execution.setVariable("WorkflowException", we);
+ execution.setVariable("isRollback", true);
+
+ doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
+ Mockito.verify(reqMock, Mockito.times(0)).setStatusMessage("Error Case");
+ Mockito.verify(reqMock, Mockito.times(1)).setRollbackStatusMessage("Error Case");
+ Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100));
+ Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN");
+ Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class));
+ }
+
+ @Test
+ public void updateRequestNotRollbackErrorStatusMessageTest() {
+ String reqId = "reqId123";
+ execution.setVariable("mso-request-id", reqId);
+ WorkflowException we = new WorkflowException("WorkflowAction", 1231, "Error Case");
+ execution.setVariable("WorkflowException", we);
+ execution.setVariable("isRollback", false);
+
+ doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
+ workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
+ Mockito.verify(reqMock, Mockito.times(1)).setStatusMessage("Error Case");
+ Mockito.verify(reqMock, Mockito.times(0)).setRollbackStatusMessage("Error Case");
+ Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100));
+ Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN");
+ Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index 1013cc8330..aac09b4475 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -42,6 +42,7 @@ import org.mockito.Mockito;
import org.mockito.Spy;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -72,6 +73,9 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
@Mock
protected Environment environment;
+ @Mock
+ private FlowManipulatorListenerRunner flowManipulatorListenerRunner;
+
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index ad1238b86f..eea885288e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -22,12 +22,19 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -37,14 +44,17 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.javatuples.Pair;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
@@ -54,13 +64,15 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.L3Networks;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.ServiceInstances;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VfModules;
-import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
@@ -68,6 +80,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
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.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
@@ -78,6 +92,7 @@ import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.HeatTemplate;
@@ -86,9 +101,11 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@@ -104,7 +121,6 @@ public class WorkflowActionTest extends BaseTaskTest {
protected WorkflowAction workflowAction;
private DelegateExecution execution;
-
@InjectMocks
@Spy
protected WorkflowAction SPY_workflowAction;
@@ -342,13 +358,10 @@ public class WorkflowActionTest extends BaseTaskTest {
new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
vnf.setVnfId("vnf0");
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
- new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
- vfModule.setVfModuleId("vfModule0");
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 =
- new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
- vfModule2.setVfModuleId("vfModule1");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule();
vnf.getVfModules().add(vfModule2);
org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup =
@@ -369,10 +382,10 @@ public class WorkflowActionTest extends BaseTaskTest {
"ActivateServiceInstanceBB");
assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId());
assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId());
- assertEquals("vfModule0", ebbs.get(2).getWorkflowResourceIds().getVfModuleId());
- assertEquals("vfModule1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
- assertEquals("vfModule0", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
- assertEquals("vfModule1", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("testVfModuleId1", ebbs.get(2).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("testVfModuleId2", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("testVfModuleId1", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
+ assertEquals("testVfModuleId2", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId());
@@ -677,13 +690,9 @@ public class WorkflowActionTest extends BaseTaskTest {
new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
vnf.setVnfId("vnfId123");
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
- new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
- vfModule.setVfModuleId("vfModule1");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 =
- new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
- vfModule2.setVfModuleId("vfModule2");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule();
vnf.getVfModules().add(vfModule2);
org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup =
@@ -732,13 +741,9 @@ public class WorkflowActionTest extends BaseTaskTest {
new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
vnf.setVnfId("vnfId123");
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
- new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
- vfModule.setVfModuleId("vfModule1");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 =
- new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
- vfModule2.setVfModuleId("vfModule2");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule();
vnf.getVfModules().add(vfModule2);
org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup =
@@ -1058,7 +1063,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName1");
vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
- Set<CvnfcConfigurationCustomization> custSet = new HashSet<CvnfcConfigurationCustomization>();
+ List<CvnfcConfigurationCustomization> custSet = new ArrayList<CvnfcConfigurationCustomization>();
custSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
cvnfcCustomization.setCvnfcConfigurationCustomization(custSet);
cvnfcCustomization.setDescription("description");
@@ -1072,7 +1077,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vnfVfmoduleCvnfcConfigurationCustomization2.setConfigurationResource(configurationResource2);
vnfVfmoduleCvnfcConfigurationCustomization2.setModelInstanceName("modelInstanceName2");
vnfVfmoduleCvnfcConfigurationCustomization2.setCvnfcCustomization(cvnfcCustomization2);
- Set<CvnfcConfigurationCustomization> custSet2 = new HashSet<CvnfcConfigurationCustomization>();
+ List<CvnfcConfigurationCustomization> custSet2 = new ArrayList<CvnfcConfigurationCustomization>();
custSet2.add(vnfVfmoduleCvnfcConfigurationCustomization2);
cvnfcCustomization2.setCvnfcConfigurationCustomization(custSet2);
cvnfcCustomization2.setDescription("description2");
@@ -1199,6 +1204,49 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListMacroResumeTest() throws Exception {
+ String gAction = "createInstance";
+ String resource = "Service";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ Service service = new Service();
+ service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+
+ ServiceInstance si = new ServiceInstance();
+
+ when(bbSetupUtils.getAAIServiceInstanceById("123")).thenReturn(si);
+ when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
+
+ String flowsToExecuteString =
+ "[{\"buildingBlock\":{\"mso-id\":\"2f9ddc4b-4dcf-4129-a35f-be1625ae0176\",\"bpmn-flow-name\":\"AssignServiceInstanceBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":{\"vfModuleCustomizationUUID\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"vnfResourceCustomizationUUID\":\"a80f05b8-d651-44af-b999-8ed78fb4582f\",\"cvnfcCustomizationUUID\":\"69cce457-9ffd-4359-962b-0596a1e83ad1\",\"vnfcName\":\"zauk51bmcmr01mcm001\"}}]";
+ ObjectMapper om = new ObjectMapper();
+ List<ExecuteBuildingBlock> flowsToExecute = null;
+ try {
+ ExecuteBuildingBlock[] asArray = om.readValue(flowsToExecuteString, ExecuteBuildingBlock[].class);
+ flowsToExecute = Arrays.asList(asArray);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ when(bbSetupUtils.loadOriginalFlowExecutionPath(anyString())).thenReturn(flowsToExecute);
+
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB");
+ }
+
+ @Test
public void getRelatedResourcesInVfModuleTest() throws Exception {
org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
vnfc.setModelInvariantId("modelInvariantId");
@@ -1428,6 +1476,21 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void isUriResumeTest() {
+ assertTrue(workflowAction.isUriResume(
+ "http://localhost:9100/onap/so/infra/orchestrationRequests/v7/requests/2f8ab587-ef6a-4456-b7b2-d73f9363dabd/resume"));
+ assertFalse(workflowAction.isUriResume("/v6/serviceInstances/123/vnfs/1234/vfmodules/5678/replace"));
+ }
+
+ @Test
+ public void isRequestMacroServiceResumeTest() {
+ ServiceInstance si = new ServiceInstance();
+ when(bbSetupUtils.getAAIServiceInstanceById(anyString())).thenReturn(si);
+ assertFalse(workflowAction.isRequestMacroServiceResume(false, WorkflowType.SERVICE, "createInstance", ""));
+ assertTrue(workflowAction.isRequestMacroServiceResume(false, WorkflowType.SERVICE, "createInstance", "123"));
+ }
+
+ @Test
public void populateResourceIdsFromApiHandlerTest() {
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "888");
@@ -1437,104 +1500,368 @@ public class WorkflowActionTest extends BaseTaskTest {
assertNull(x.getVolumeGroupId());
}
- @Test
- public void validateResourceIdInAAITest() throws Exception {
- // SI
+ private RequestDetails setupRequestDetails(String globalSubscriberId, String subscriptionServiceType,
+ String modelCustomizationId) {
RequestDetails reqDetails = new RequestDetails();
SubscriberInfo subInfo = new SubscriberInfo();
- subInfo.setGlobalSubscriberId("id123");
+ subInfo.setGlobalSubscriberId(globalSubscriberId);
reqDetails.setSubscriberInfo(subInfo);
RequestParameters reqParams = new RequestParameters();
- reqParams.setSubscriptionServiceType("subServiceType123");
+ reqParams.setSubscriptionServiceType(subscriptionServiceType);
reqDetails.setRequestParameters(reqParams);
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(modelCustomizationId);
+ reqDetails.setModelInfo(modelInfo);
+ return reqDetails;
+ }
+
+ @Test
+ public void validateVnfResourceIdInAAITest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- ServiceInstance si = new ServiceInstance();
- si.setServiceInstanceId("siId123");
- Optional<ServiceInstance> siOp = Optional.of(si);
- when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp);
- when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "111111"))
- .thenReturn(Optional.empty());
- String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123",
- reqDetails, workflowResourceIds);
- assertEquals("siId123", id);
- String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111",
- reqDetails, workflowResourceIds);
+ workflowResourceIds.setServiceInstanceId("siId123");
+ // Vnf
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("id123");
+ vnf.setVnfName("vnfName123");
+ vnf.setModelCustomizationId("1234567");
+ Optional<GenericVnf> opVnf = Optional.of(vnf);
+ GenericVnf vnf2 = new GenericVnf();
+ vnf2.setVnfId("id123");
+ vnf2.setVnfName("vnfName222");
+ vnf2.setModelCustomizationId("222");
+ Optional<GenericVnf> opVnf2 = Optional.of(vnf2);
+ when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf);
+ when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName222")).thenReturn(opVnf2);
+ when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "111111")).thenReturn(Optional.empty());
+ String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName123", reqDetails,
+ workflowResourceIds);
+ assertEquals("id123", id);
+ String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "111111", reqDetails,
+ workflowResourceIds);
assertEquals("generatedId123", id2);
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(containsString(
+ "generic-vnf with name (vnfName222), same parent and different customization id (222) already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName222", reqDetails,
+ workflowResourceIds);
+ }
+
+ @Test
+ public void validateVnfResourceNameInAAITest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+
+ // Vnf
+ GenericVnfs genericVnfs = new GenericVnfs();
+ GenericVnf vnf3 = new GenericVnf();
+ vnf3.setVnfId("id123");
+ vnf3.setVnfName("vnfName333");
+ genericVnfs.getGenericVnf().add(vnf3);
+ when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName333")).thenReturn(Optional.empty());
+ when(bbSetupUtils.getAAIVnfsGloballyByName("vnfName333")).thenReturn(genericVnfs);
+
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(containsString(
+ "generic-vnf with name (vnfName333) id (id123) and different parent relationship already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName333", reqDetails,
+ workflowResourceIds);
+ }
+
+ @Test
+ public void validateNetworkResourceIdInAAITest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+
// Network
L3Network network = new L3Network();
network.setNetworkId("id123");
network.setNetworkName("name123");
+ network.setModelCustomizationId("1234567");
workflowResourceIds.setServiceInstanceId("siId123");
Optional<L3Network> opNetwork = Optional.of(network);
+ L3Network network2 = new L3Network();
+ network2.setNetworkId("id123");
+ network2.setNetworkName("networkName222");
+ network2.setModelCustomizationId("222");
+ Optional<L3Network> opNetwork2 = Optional.of(network2);
when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork);
+ when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "networkName222"))
+ .thenReturn(opNetwork2);
when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "111111")).thenReturn(Optional.empty());
- id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", reqDetails,
- workflowResourceIds);
+ String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123",
+ reqDetails, workflowResourceIds);
assertEquals("id123", id);
- id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", reqDetails,
- workflowResourceIds);
+ String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111",
+ reqDetails, workflowResourceIds);
assertEquals("generatedId123", id2);
- // Vnf
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(containsString(
+ "l3Network with name (networkName222), same parent and different customization id (222) already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName222", reqDetails,
+ workflowResourceIds);
+ }
+
+ @Test
+ public void validateNetworkResourceNameExistsInAAITest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+
+ // Network
+ L3Network network = new L3Network();
+ network.setNetworkId("id123");
+ network.setNetworkName("name123");
+ network.setModelCustomizationId("1234567");
+ workflowResourceIds.setServiceInstanceId("siId123");
+
+ when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("networkName333", "111111"))
+ .thenReturn(Optional.empty());
+ when(bbSetupUtils.existsAAINetworksGloballyByName("networkName333")).thenReturn(true);
+
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(containsString(
+ "l3Network with name (networkName333) id (siId123) and different parent relationship already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName333", reqDetails,
+ workflowResourceIds);
+ }
+
+ @Test
+ public void validateVfModuleResourceIdInAAITest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+
GenericVnf vnf = new GenericVnf();
vnf.setVnfId("id123");
vnf.setVnfName("vnfName123");
- Optional<GenericVnf> opVnf = Optional.of(vnf);
- when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "name123")).thenReturn(opVnf);
- when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "111111")).thenReturn(Optional.empty());
- id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "name123", reqDetails,
- workflowResourceIds);
- assertEquals("id123", id);
- id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "111111", reqDetails,
- workflowResourceIds);
- assertEquals("generatedId123", id2);
+ vnf.setModelCustomizationId("222");
// VfModule
VfModules vfModules = new VfModules();
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("id123");
vfModule.setVfModuleName("name123");
+ vfModule.setModelCustomizationId("1234567");
vfModules.getVfModule().add(vfModule);
vnf.setVfModules(vfModules);
workflowResourceIds.setVnfId("id123");
when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf);
- id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "name123", reqDetails,
- workflowResourceIds);
+ String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "name123",
+ reqDetails, workflowResourceIds);
assertEquals("id123", id);
- GenericVnf vnf2 = new GenericVnf();
+ GenericVnf vnf1 = new GenericVnf();
VfModules vfModules2 = new VfModules();
VfModule vfModule2 = new VfModule();
vfModule2.setVfModuleId("id123");
- vfModule2.setVfModuleName("name123");
+ vfModule2.setVfModuleName("vFModName222");
+ vfModule2.setModelCustomizationId("222");
vfModules2.getVfModule().add(vfModule2);
- vnf2.setVfModules(vfModules2);
+ vnf1.setVfModules(vfModules2);
workflowResourceIds.setVnfId("id111");
- when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf2);
- id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "111111", reqDetails,
- workflowResourceIds);
+ when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf1);
+ String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "111111",
+ reqDetails, workflowResourceIds);
assertEquals("generatedId123", id2);
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(containsString(
+ "vfModule with name (vFModName222), same parent and different customization id (1234567) already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName222", reqDetails,
+ workflowResourceIds);
+
+ }
+
+ @Test
+ public void validateVolumeGroupResourceIdInAAITest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("id123");
+ vnf.setVnfName("vnfName123");
+ vnf.setModelCustomizationId("1234567");
+
+ GenericVnf vnf2 = new GenericVnf();
+ vnf2.setVnfId("id123");
+ vnf2.setVnfName("vnfName123");
+ vnf2.setModelCustomizationId("222");
+
// VolumeGroup
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("id123");
volumeGroup.setVolumeGroupName("name123");
workflowResourceIds.setVnfId("id123");
Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup);
+
+ workflowResourceIds.setVnfId("id123");
+
+ when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf);
when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "name123")).thenReturn(opVolumeGroup);
- id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails,
- workflowResourceIds);
+ String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123",
+ reqDetails, workflowResourceIds);
assertEquals("id123", id);
- workflowResourceIds.setVnfId("id444");
- when(bbSetupUtils.getAAIGenericVnf("id444")).thenReturn(vnf);
+ when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf2);
when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123", "111111"))
.thenReturn(opVolumeGroup);
- when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id444", "111111")).thenReturn(Optional.empty());
- id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", reqDetails,
+
+ when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "111111")).thenReturn(Optional.empty());
+ String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111",
+ reqDetails, workflowResourceIds);
+ assertEquals("generatedId123", id2);
+ }
+
+ @Test
+ public void validateConfigurationResourceIdInAAITest() throws Exception {
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+
+ // Configuration
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("id123");
+ configuration.setConfigurationName("name123");
+ configuration.setModelCustomizationId("1234567");
+ Optional<org.onap.aai.domain.yang.Configuration> opConfiguration = Optional.of(configuration);
+
+ org.onap.aai.domain.yang.Configuration configuration2 = new org.onap.aai.domain.yang.Configuration();
+ configuration2.setConfigurationId("id123");
+ configuration2.setConfigurationName("name123");
+ configuration2.setModelCustomizationId("222");
+ Optional<org.onap.aai.domain.yang.Configuration> opConfiguration2 = Optional.of(configuration2);
+
+ workflowResourceIds.setVnfId("id123");
+
+ when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123"))
+ .thenReturn(opConfiguration);
+ String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "name123",
+ reqDetails, workflowResourceIds);
+ assertEquals("id123", id);
+
+ when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "111111"))
+ .thenReturn(Optional.empty());
+ String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "111111",
+ reqDetails, workflowResourceIds);
+ assertEquals("generatedId123", id2);
+
+ when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name222"))
+ .thenReturn(opConfiguration2);
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(containsString(
+ "configuration with name (name222), same parent and different customization id (id123) already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "name222", reqDetails,
+ workflowResourceIds);
+ }
+
+ @Test
+ public void validateServiceInstanceResourceIdInAAITest() throws Exception {
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ reqDetails.getModelInfo().setModelVersionId("1234567");
+
+ ServiceInstance si = new ServiceInstance();
+ si.setServiceInstanceId("siId123");
+ si.setModelVersionId("1234567");
+ ServiceInstances serviceInstances = new ServiceInstances();
+ serviceInstances.getServiceInstance().add(si);
+ Optional<ServiceInstance> siOp = Optional.of(si);
+ ServiceInstance si2 = new ServiceInstance();
+ si2.setServiceInstanceId("siId222");
+ si2.setModelVersionId("22222");
+ si2.setServiceInstanceName("siName222");
+ Optional<ServiceInstance> siOp2 = Optional.of(si2);
+ ServiceInstances serviceInstances2 = new ServiceInstances();
+ serviceInstances2.getServiceInstance().add(si2);
+
+ when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp);
+ when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName222")).thenReturn(siOp2);
+ when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "111111"))
+ .thenReturn(Optional.empty());
+
+ when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances);
+ String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123",
+ reqDetails, workflowResourceIds);
+ assertEquals("siId123", id);
+ String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111",
+ reqDetails, workflowResourceIds);
+ assertEquals("generatedId123", id2);
+
+ when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName222")).thenReturn(serviceInstances2);
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(containsString(
+ "serviceInstance with name (siName222) and different version id (1234567) already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName222", reqDetails,
+ workflowResourceIds);
+ }
+
+ @Test
+ public void validateServiceInstanceResourceIdInAAIMultipleTest() throws Exception {
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ reqDetails.getModelInfo().setModelVersionId("1234567");
+
+ ServiceInstance si = new ServiceInstance();
+ si.setServiceInstanceId("siId123");
+ si.setModelVersionId("1234567");
+ ServiceInstances serviceInstances = new ServiceInstances();
+ serviceInstances.getServiceInstance().add(si);
+
+ ServiceInstance si2 = new ServiceInstance();
+ si2.setServiceInstanceId("siId222");
+ si2.setModelVersionId("22222");
+ si2.setServiceInstanceName("siName222");
+ serviceInstances.getServiceInstance().add(si2);
+
+ when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siId123"))
+ .thenReturn(Optional.empty());
+
+ when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances);
+
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(containsString(
+ "serviceInstance with name (siName123) and multiple combination of model-version-id + service-type + global-customer-id already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails,
+ workflowResourceIds);
+ }
+
+ @Test
+ public void validateServiceInstanceResourceIdInAAIExistsTest() throws Exception {
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("siId123");
+ RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567");
+ reqDetails.getModelInfo().setModelVersionId("1234567");
+
+ ServiceInstance si = new ServiceInstance();
+ si.setServiceInstanceId("siId123");
+ si.setModelVersionId("1234567");
+ ServiceInstances serviceInstances = new ServiceInstances();
+ serviceInstances.getServiceInstance().add(si);
+
+ when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siId123"))
+ .thenReturn(Optional.empty());
+
+ when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances);
+
+ Map<String, String> uriKeys = new HashMap<>();
+ uriKeys.put("global-customer-id", "globalCustomerId");
+ uriKeys.put("service-type", "serviceType");
+
+ when(bbSetupUtils.getURIKeysFromServiceInstance("siId123")).thenReturn(uriKeys);
+
+ this.expectedException.expect(DuplicateNameException.class);
+ this.expectedException.expectMessage(containsString(
+ "serviceInstance with name (siName123) and global-customer-id (globalCustomerId), service-type (serviceType), model-version-id (1234567) already exists. The name must be unique."));
+ workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails,
workflowResourceIds);
- assertEquals("id123", id2);
}
@Test
@@ -1550,7 +1877,7 @@ public class WorkflowActionTest extends BaseTaskTest {
@Ignore
@Test
- public void traverseCatalogDbServiceMultipleNetworkTest() throws IOException {
+ public void traverseCatalogDbServiceMultipleNetworkTest() throws IOException, VrfBondingServiceException {
execution.setVariable("testProcessKey", "testProcessKeyValue");
Service service = new Service();
List<NetworkResourceCustomization> networkCustomizations = new ArrayList<>();
@@ -1584,7 +1911,8 @@ public class WorkflowActionTest extends BaseTaskTest {
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
List<Resource> resourceCounter = new ArrayList<>();
thrown.expect(BpmnError.class);
- workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter);
+ List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
+ workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
}
@Test
@@ -1672,6 +2000,73 @@ public class WorkflowActionTest extends BaseTaskTest {
assertNotNull(result);
}
+ @Test
+ public void traverseAAIServiceTest() {
+ List<Resource> resourceCounter = new ArrayList<>();
+ String resourceId = "si0";
+ List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
+
+ ServiceInstance serviceInstanceAAI = new ServiceInstance();
+ serviceInstanceAAI.setServiceInstanceId(resourceId);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = setServiceInstance();
+ setGenericVnf();
+ setVfModule(true);
+ setVolumeGroup();
+ setL3Network();
+ setCollection();
+ setConfiguration();
+
+ Configuration config = new Configuration();
+ config.setConfigurationId("testConfigurationId2");
+ serviceInstance.getConfigurations().add(config);
+
+ Relationship relationship1 = new Relationship();
+ relationship1.setRelatedTo("vnfc");
+ RelationshipList relationshipList1 = new RelationshipList();
+ relationshipList1.getRelationship().add(relationship1);
+
+ Relationship relationship2 = new Relationship();
+ relationship2.setRelatedTo("vpn-binding");
+ RelationshipList relationshipList2 = new RelationshipList();
+ relationshipList2.getRelationship().add(relationship2);
+
+ org.onap.aai.domain.yang.Configuration aaiConfiguration1 = new org.onap.aai.domain.yang.Configuration();
+ aaiConfiguration1.setConfigurationId("testConfigurationId");
+ aaiConfiguration1.setRelationshipList(relationshipList1);
+
+ org.onap.aai.domain.yang.Configuration aaiConfiguration2 = new org.onap.aai.domain.yang.Configuration();
+ aaiConfiguration2.setConfigurationId("testConfigurationId2");
+ aaiConfiguration2.setRelationshipList(relationshipList1);
+
+ try {
+ doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById(resourceId);
+ doReturn(serviceInstance).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
+ doReturn(Optional.of(aaiConfiguration1)).when(aaiConfigurationResources)
+ .getConfiguration("testConfigurationId");
+ doReturn(Optional.of(aaiConfiguration2)).when(aaiConfigurationResources)
+ .getConfiguration("testConfigurationId2");
+ workflowAction.traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
+ assertEquals(8, resourceCounter.size());
+ assertTrue(resourceCounter.get(2).isBaseVfModule());
+ assertThat(aaiResourceIds, sameBeanAs(getExpectedResourceIds()));
+ } catch (Exception e) {
+ fail("Unexpected exception was thrown.");
+ }
+ }
+
+ private List<Pair<WorkflowType, String>> getExpectedResourceIds() {
+ List<Pair<WorkflowType, String>> resourceIds = new ArrayList<>();
+ resourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VNF, "testVnfId1"));
+ resourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VFMODULE, "testVfModuleId1"));
+ resourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP, "testVolumeGroupId1"));
+ resourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORK, "testNetworkId1"));
+ resourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, "testId"));
+ resourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, "testConfigurationId"));
+ resourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, "testConfigurationId2"));
+ return resourceIds;
+ }
+
private List<OrchestrationFlow> createFlowList(String... flowNames) {
List<OrchestrationFlow> result = new ArrayList<>();
for (String flowName : flowNames) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
index 34ad1b0fd4..6b5395ae07 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
@@ -89,7 +89,7 @@ public class WorkflowActionUnitTest {
configuration.setToscaNodeType("FabricConfiguration");
configuration.setModelUUID("my-uuid");
vfModuleCustomization.setConfigurationResource(configuration);
- cvnfcCustomization.setCvnfcConfigurationCustomization(Collections.singleton(vfModuleCustomization));
+ cvnfcCustomization.setCvnfcConfigurationCustomization(Collections.singletonList(vfModuleCustomization));
List<CvnfcCustomization> cvnfcCustomizations = Arrays.asList(cvnfcCustomization);
// when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(any(String.class),
// any(String.class)))
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
new file mode 100644
index 0000000000..82d610fa97
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+
+@RunWith(MockitoJUnitRunner.class)
+public class MultiStageSkipListenerTest {
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @Mock
+ private BBInputSetupUtils bbInputSetupUtils;
+
+ @InjectMocks
+ private MultiStageSkipListener multiStageSkipListener;
+
+ @Test
+ public void testTrigger() {
+ BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
+ execution.setVariable(BBConstants.G_ALACARTE, true);
+
+ assertTrue("should be triggered", multiStageSkipListener.shouldRunFor("AssignVfModuleBB", true, execution));
+
+ execution.setVariable(BBConstants.G_ALACARTE, false);
+ assertFalse("should not be triggered",
+ multiStageSkipListener.shouldRunFor("AssignVfModuleBB", true, execution));
+
+ execution.setVariable(BBConstants.G_ALACARTE, true);
+ assertFalse("should not be triggered",
+ multiStageSkipListener.shouldRunFor("AssignVfModuleBB2", true, execution));
+
+ execution.setVariable("multiStageDesign", true);
+ assertTrue("should be triggered", multiStageSkipListener.shouldRunFor(execution));
+
+ execution.setVariable("multiStageDesign", false);
+ assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor(execution));
+
+ execution.setVariable("multiStageDesign", null);
+ assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor(execution));
+
+ }
+
+ @Test
+ public void testProcessMultiStageSkip() {
+ String vfModuleId = "vfModuleId";
+ String vnfId = "vnfId";
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId("serviceInstanceId");
+ workflowResourceIds.setVnfId(vnfId);
+ flowsToExecute.add(new ExecuteBuildingBlock());
+ flowsToExecute.add(new ExecuteBuildingBlock());
+ flowsToExecute.add(new ExecuteBuildingBlock());
+ flowsToExecute.get(0).setResourceId(vfModuleId);
+ flowsToExecute.get(0).setBuildingBlock(new BuildingBlock());
+ flowsToExecute.get(0).getBuildingBlock().setBpmnFlowName("AssignVfModuleBB");
+ flowsToExecute.get(0).setWorkflowResourceIds(workflowResourceIds);
+ BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
+
+ org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
+ vfModule.setVfModuleId(vfModuleId);
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setModelCustomizationId("modelCustomizationUUID");
+ VnfResourceCustomization vnfCust = new VnfResourceCustomization();
+ vnfCust.setModelCustomizationUUID("modelCustomizationUUID");
+ vnfCust.setMultiStageDesign("true");
+ when(catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(vnf.getModelCustomizationId()))
+ .thenReturn(vnfCust);
+ when(bbInputSetupUtils.getAAIVfModule(eq(vnfId), eq(vfModuleId))).thenReturn(null);
+ when(bbInputSetupUtils.getAAIGenericVnf(eq(vnfId))).thenReturn(vnf);
+
+ multiStageSkipListener.run(flowsToExecute, flowsToExecute.get(0), execution);
+ assertEquals("Flows should only have Assign", flowsToExecute.size(), 1);
+ assertEquals("Flows should only have Assign", flowsToExecute.get(0).getBuildingBlock().getBpmnFlowName(),
+ "AssignVfModuleBB");
+ }
+
+ @Test
+ public void postCompletionRequestsDbListenerTest() {
+ InfraActiveRequests request = new InfraActiveRequests();
+ BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
+ multiStageSkipListener.run(request, execution);
+
+ assertEquals("Successfully completed Assign Building Block only due to multi-stage-design VNF",
+ request.getFlowStatus());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
index ccd677c80e..d6485bd57f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
@@ -21,8 +21,7 @@ package org.onap.so.client.adapter.network.mapper;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.isA;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
import java.io.UnsupportedEncodingException;
import java.nio.file.Files;
@@ -39,7 +38,6 @@ import org.onap.so.adapters.nwrest.ContrailNetwork;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.adapters.nwrest.NetworkTechnology;
import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
@@ -385,4 +383,19 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup {
assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("messageId")
.ignoring("msoRequest.requestId").ignoring("networkParams"));
}
+
+ @Test
+ public void buildOpenstackSubnetListMultipleHostRoutesTest() throws Exception {
+
+ ObjectMapper omapper = new ObjectMapper();
+ String l3NetworkJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "l3-network-multiple-subnets.json")));
+ L3Network l3Network = omapper.readValue(l3NetworkJson, L3Network.class);
+
+ List<org.onap.so.openstack.beans.Subnet> subnets =
+ SPY_networkAdapterObjectMapper.buildOpenstackSubnetList(l3Network);
+ assertEquals("192.168.0.0/16", subnets.get(0).getHostRoutes().get(0).getPrefix());
+ assertEquals("192.168.1.5/16", subnets.get(0).getHostRoutes().get(1).getPrefix());
+
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
index 5a8e57135a..44a08139d6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
@@ -29,7 +29,9 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmNetworkData;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
@@ -43,6 +45,8 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.openstack.utils.MsoMulticloudUtils;
+import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class VnfAdapterVfModuleObjectMapperPayloadTest {
@@ -52,6 +56,9 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
private VnfAdapterVfModuleObjectMapper vfModuleObjectMapper = new VnfAdapterVfModuleObjectMapper();
private ObjectMapper omapper = new ObjectMapper();
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
@Before
public void setUp() {
vfModuleObjectMapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils();
@@ -362,6 +369,34 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
}
@Test
+ public void buildDirectivesParamFromMapNoValueTagTest() throws Exception {
+
+ Map<String, Object> paramsMap = new HashMap<>();
+ Map<String, Object> srcMap = new HashMap<>();
+ srcMap.put("key1", "value1");
+ srcMap.put("key2", "value2");
+ srcMap.put("key3", null);
+
+ expectedException.expect(MissingValueTagException.class);
+ vfModuleObjectMapper.buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.SDNC_DIRECTIVES, srcMap);
+ }
+
+ @Test
+ public void buildDirectivesParamFromMapSunnyDayTest() throws Exception {
+
+ Map<String, Object> paramsMap = new HashMap<>();
+ Map<String, Object> srcMap = new HashMap<>();
+ srcMap.put("key1", "value1");
+ srcMap.put("key2", "value2");
+ String expectedResult =
+ "[{ \"attributes\": [ {\"attribute_name\": \"key1\", \"attribute_value\": \"value1\"}, {\"attribute_name\": \"key2\", \"attribute_value\": \"value2\"}] }]";
+
+ vfModuleObjectMapper.buildDirectivesParamFromMap(paramsMap, MsoMulticloudUtils.SDNC_DIRECTIVES, srcMap);
+
+ assertEquals(expectedResult, paramsMap.values().toString());
+ }
+
+ @Test
public void createVfModuleWithVolumeGroupRequestMapperTest() throws Exception {
// prepare and set service instance
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java
index f50916c0be..f7fd00a673 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingClientResponseValidatorTest.java
@@ -36,6 +36,7 @@ public class NamingClientResponseValidatorTest extends TestDataSetup {
private NamingClientResponseValidator responseValidator = new NamingClientResponseValidator();
private String instanceGroupName = "generatedInstanceGroupName";
+ private String serviceInstanceName = "generatedServiceInstanceName";
@Test
public void validateNameGenResponseSuccessTest() throws BadResponseException {
@@ -54,6 +55,22 @@ public class NamingClientResponseValidatorTest extends TestDataSetup {
}
@Test
+ public void validateServiceInstanceNameGenResponseSuccessTest() throws BadResponseException {
+ NameGenResponse name = new NameGenResponse();
+ Respelement respElement = new Respelement();
+ respElement.setResourceName("Service-Instance-Name");
+ respElement.setResourceValue(serviceInstanceName);
+ List<Respelement> respList = new ArrayList<Respelement>();
+ respList.add(respElement);
+ name.setElements(respList);
+ ResponseEntity<NameGenResponse> resp = new ResponseEntity<>(name, null, HttpStatus.OK);
+
+ String actual = responseValidator.validateNameGenResponse(resp);
+
+ assertEquals(actual, "generatedServiceInstanceName");
+ }
+
+ @Test
public void validateNameGenResponseNoNameGeneratedTest() throws BadResponseException {
NameGenResponse name = new NameGenResponse();
Respelement respElement = new Respelement();
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectTest.java
new file mode 100644
index 0000000000..7c50b2031d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestObjectTest.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.namingservice;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertThat;
+import java.util.HashMap;
+import org.junit.Test;
+import org.onap.namingservice.model.Element;
+
+public class NamingRequestObjectTest {
+
+ private String externalKey = "95cbbe59-1017-4c13-b4e8-d824e54def3e";
+ private String policyInstanceName = "MSO_Policy.Config_MS_VNFInstanceGroup";
+ private String namingType = "Service";
+ private String nfNamingCode = "NamingCode";
+ private String resourceName = "resourceName";
+ private String serviceModelName = "serviceModelName";
+ private String modelVersion = "modelVersion";
+
+ @Test
+ public void namingRequestObjectTest() {
+
+ Element expected = new Element();
+ expected.put(NamingServiceConstants.NS_EXTERNAL_KEY, externalKey);
+ expected.put(NamingServiceConstants.NS_POLICY_INSTANCE_NAME, policyInstanceName);
+ expected.put(NamingServiceConstants.NS_NAMING_TYPE, namingType);
+ expected.put(NamingServiceConstants.NS_RESOURCE_NAME, resourceName);
+ expected.put(NamingServiceConstants.NS_NF_NAMING_CODE, nfNamingCode);
+
+ NamingRequestObject namingRequestObject = new NamingRequestObject();
+ namingRequestObject.setExternalKeyValue(externalKey);
+ namingRequestObject.setPolicyInstanceNameValue(policyInstanceName);
+ namingRequestObject.setNamingTypeValue(namingType);
+ namingRequestObject.setNfNamingCodeValue(nfNamingCode);
+ namingRequestObject.setResourceNameValue(resourceName);
+
+ HashMap<String, String> actual = namingRequestObject.getNamingRequestObjectMap();
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void namingWanTransportRequestObjectTest() {
+
+ Element expected = new Element();
+ expected.put(NamingServiceConstants.NS_EXTERNAL_KEY, externalKey);
+ expected.put(NamingServiceConstants.NS_POLICY_INSTANCE_NAME, policyInstanceName);
+ expected.put(NamingServiceConstants.NS_NAMING_TYPE, namingType);
+ expected.put(NamingServiceConstants.NS_RESOURCE_NAME, resourceName);
+ expected.put(NamingServiceConstants.NS_SERVICE_MODEL_NAME, serviceModelName);
+ expected.put(NamingServiceConstants.NS_MODEL_VERSION, modelVersion);
+
+ NamingRequestObject namingRequestObject = new NamingRequestObject();
+ namingRequestObject.setExternalKeyValue(externalKey);
+ namingRequestObject.setPolicyInstanceNameValue(policyInstanceName);
+ namingRequestObject.setNamingTypeValue(namingType);
+ namingRequestObject.setResourceNameValue(resourceName);
+ namingRequestObject.setModelVersionValue(modelVersion);
+ namingRequestObject.setServiceModelNameValue(serviceModelName);
+
+ HashMap<String, String> actual = namingRequestObject.getNamingRequestObjectMap();
+ assertThat(actual, sameBeanAs(expected));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestUtilsTest.java
new file mode 100644
index 0000000000..5fdb790405
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/namingservice/NamingRequestUtilsTest.java
@@ -0,0 +1,136 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.namingservice;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+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.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+
+public class NamingRequestUtilsTest extends BaseTaskTest {
+
+ @Mock
+ private ServiceInstance serviceInstanceMock;
+
+ @Mock
+ ModelInfoServiceInstance modelInfoServiceInstanceMock;
+
+ @InjectMocks
+ private NamingServiceUtils namingServiceUtils = new NamingServiceUtils();
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstanceMock);
+ doReturn(modelInfoServiceInstanceMock).when(serviceInstanceMock).getModelInfoServiceInstance();
+ }
+
+ @Test
+ public void checkVpnBondingServiceTest() {
+ doReturn("bonding").when(modelInfoServiceInstanceMock).getServiceType();
+ doReturn("infrastructure-vpn").when(modelInfoServiceInstanceMock).getServiceRole();
+ doReturn("testNaminPolicy").when(modelInfoServiceInstanceMock).getNamingPolicy();
+ doReturn(true).when(modelInfoServiceInstanceMock).getOnapGeneratedNaming();
+ namingServiceUtils.checkVpnBondingService(execution);
+ assertTrue(execution.getVariable("isVpnBondingService"));
+
+ doReturn("bonding-false").when(modelInfoServiceInstanceMock).getServiceType();
+ doReturn("infrastructure-vpn").when(modelInfoServiceInstanceMock).getServiceRole();
+ namingServiceUtils.checkVpnBondingService(execution);
+ assertFalse(execution.getVariable("isVpnBondingService"));
+ }
+
+ @Test
+ public void checkBondingAndInfrastureVpnTrueTest() {
+ doReturn("bonding").when(modelInfoServiceInstanceMock).getServiceType();
+ doReturn("infrastructure-vpn").when(modelInfoServiceInstanceMock).getServiceRole();
+ namingServiceUtils.checkBondingAndInfrastureVpn(execution);
+ assertTrue(execution.getVariable("isBondingAndInsfrastructureVpn"));
+ }
+
+ @Test
+ public void checkBondingAndInfrastureVpnFalse1Test() {
+ doReturn("falseBonding").when(modelInfoServiceInstanceMock).getServiceType();
+ doReturn("infrastructure-vpn").when(modelInfoServiceInstanceMock).getServiceRole();
+ namingServiceUtils.checkBondingAndInfrastureVpn(execution);
+ assertFalse(execution.getVariable("isBondingAndInsfrastructureVpn"));
+ }
+
+ @Test
+ public void checkBondingAndInfrastureVpnFalse2Test() {
+ doReturn("bonding").when(modelInfoServiceInstanceMock).getServiceType();
+ doReturn("false-infrastructure-vpn").when(modelInfoServiceInstanceMock).getServiceRole();
+ namingServiceUtils.checkBondingAndInfrastureVpn(execution);
+ assertFalse(execution.getVariable("isBondingAndInsfrastructureVpn"));
+ }
+
+ @Test
+ public void checkNamingPolicyAndAndEcompGeneratedNaming_TrueTest() {
+ doReturn("testNaminPolicy").when(modelInfoServiceInstanceMock).getNamingPolicy();
+ doReturn(true).when(modelInfoServiceInstanceMock).getOnapGeneratedNaming();
+ namingServiceUtils.checkNamingPolicyAndOnapGeneratedNaming(execution);
+ assertTrue(execution.getVariable("isNamingPolicyAndOnapGeneratedNaming"));
+ }
+
+ @Test
+ public void checkNamingPolicyAndAndEcompGeneratedNamingFalse1Test() throws BBObjectNotFoundException {
+ doReturn(null).when(modelInfoServiceInstanceMock).getNamingPolicy();
+ doReturn(true).when(modelInfoServiceInstanceMock).getOnapGeneratedNaming();
+ namingServiceUtils.checkNamingPolicyAndOnapGeneratedNaming(execution);
+ assertFalse(execution.getVariable("isNamingPolicyAndOnapGeneratedNaming"));
+ }
+
+ @Test
+ public void checkNamingPolicyAndAndEcompGeneratedNamingFalse2Test() throws BBObjectNotFoundException {
+ doReturn("testNaminPolicy").when(modelInfoServiceInstanceMock).getNamingPolicy();
+ doReturn(false).when(modelInfoServiceInstanceMock).getOnapGeneratedNaming();
+ namingServiceUtils.checkNamingPolicyAndOnapGeneratedNaming(execution);
+ assertFalse(execution.getVariable("isNamingPolicyAndOnapGeneratedNaming"));
+ }
+
+ @Test
+ public void checkNamingPolicyAndAndEcompGeneratedNamingFalse3Test() throws BBObjectNotFoundException {
+ doReturn("").when(modelInfoServiceInstanceMock).getNamingPolicy();
+ doReturn(false).when(modelInfoServiceInstanceMock).getOnapGeneratedNaming();
+ namingServiceUtils.checkNamingPolicyAndOnapGeneratedNaming(execution);
+ assertFalse(execution.getVariable("isNamingPolicyAndOnapGeneratedNaming"));
+ }
+
+ @Test
+ public void checkNamingPolicyAndAndEcompGeneratedNamingFalse4Test() throws BBObjectNotFoundException {
+ doReturn("bonding").when(modelInfoServiceInstanceMock).getNamingPolicy();
+ doReturn(null).when(modelInfoServiceInstanceMock).getOnapGeneratedNaming();
+ namingServiceUtils.checkNamingPolicyAndOnapGeneratedNaming(execution);
+ assertFalse(execution.getVariable("isNamingPolicyAndOnapGeneratedNaming"));
+ }
+
+}
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 be58ccb046..9855c8587a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,8 @@
package org.onap.so.client.orchestration;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
@@ -44,6 +46,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
@@ -93,14 +96,12 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
public void createConfigurationTest() {
doReturn(new org.onap.aai.domain.yang.Configuration()).when(MOCK_aaiObjectMapper)
.mapConfiguration(configuration);
- doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class),
- isA(org.onap.aai.domain.yang.Configuration.class));
-
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ any(Optional.class));
aaiConfigurationResources.createConfiguration(configuration);
assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus());
- verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class),
- isA(org.onap.aai.domain.yang.Configuration.class));
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
}
@Test
@@ -231,4 +232,32 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), ArgumentMatchers.isNull());
assertEquals(OrchestrationStatus.ACTIVE, configuration.getOrchestrationStatus());
}
+
+ @Test
+ public void updateConfigurationOrchestrationStatusTest() throws Exception {
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class),
+ isA(org.onap.aai.domain.yang.Configuration.class));
+ aaiConfigurationResources.updateConfigurationOrchestrationStatus(configuration, OrchestrationStatus.ACTIVE);
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class),
+ any(org.onap.aai.domain.yang.Configuration.class));
+ }
+
+ @Test
+ public void checkConfigurationNameInUseTrueTest() throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ .queryParam("configuration-name", "configurationName");
+ doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
+ boolean nameInUse = aaiConfigurationResources.checkConfigurationNameInUse("configurationName");
+ assertTrue(nameInUse);
+ }
+
+ @Test
+ public void checkConfigurationNameInUseFalseTest() throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ .queryParam("configuration-name", "configurationName");
+ doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
+ boolean nameInUse = aaiConfigurationResources.checkConfigurationNameInUse("configurationName");
+ assertFalse(nameInUse);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
index 8c0d27f799..cb5683d9d8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
@@ -22,6 +22,8 @@ package org.onap.so.client.orchestration;
import static org.mockito.ArgumentMatchers.eq;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
@@ -40,6 +42,7 @@ import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
@@ -131,4 +134,22 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
+ @Test
+ public void checkInstanceGroupNameInUseTrueTest() throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ .queryParam("instance-group-name", "instanceGroupName");
+ doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
+ boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
+ assertTrue(nameInUse);
+ }
+
+ @Test
+ public void checkInstanceGroupNameInUseFalseTest() throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ .queryParam("instance-group-name", "instanceGroupName");
+ doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
+ boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
+ assertFalse(nameInUse);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
index d41148d784..b6161d7669 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
@@ -23,6 +23,7 @@ package org.onap.so.client.orchestration;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -425,4 +426,22 @@ public class AAINetworkResourcesTest extends TestDataSetup {
verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
}
+ @Test
+ public void checkInstanceGroupNameInUseTrueTest() throws Exception {
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
+ doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
+ boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
+ assertTrue(nameInUse);
+ }
+
+ @Test
+ public void checkInstanceGroupNameInUseFalseTest() throws Exception {
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
+ doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
+ boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
+ assertFalse(nameInUse);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
index 14df832754..ea98ee0169 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
@@ -21,8 +21,11 @@
package org.onap.so.client.orchestration;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
@@ -43,8 +46,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -186,4 +191,23 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class),
any(org.onap.aai.domain.yang.ServiceInstance.class));
}
+
+ @Test
+ public void checkInstanceServiceNameInUseTrueTest() throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ .queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
+ doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
+ boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
+ assertTrue(nameInUse);
+ }
+
+ @Test
+ public void checkInstanceServiceNameInUseFalseTest() throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ .queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
+ doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
+ boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
+ assertFalse(nameInUse);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
index ae3ebeddbd..9e3bc4f552 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
@@ -21,7 +21,10 @@
package org.onap.so.client.orchestration;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
@@ -41,8 +44,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -154,4 +159,39 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
assertEquals("testContrailServiceInstanceFqdn", vfModule.getContrailServiceInstanceFqdn());
}
+
+ @Test
+ public void checkNameInUseTrueTest() throws Exception {
+ AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ .queryParam("vf-module-name", vfModule.getVfModuleName());
+ AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
+ doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUri));
+ boolean nameInUse = aaiVfModuleResources.checkNameInUse(vfModule);
+ assertTrue(nameInUse);
+ }
+
+ @Test
+ public void checkNameInUseFalseIsResumeTest() throws Exception {
+ AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ .queryParam("vf-module-name", vfModule.getVfModuleName());
+ AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
+ boolean nameInUse = aaiVfModuleResources.checkNameInUse(vfModule);
+ assertFalse(nameInUse);
+ }
+
+ @Test
+ public void checkNameInUseFalseTest() throws Exception {
+ AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ .queryParam("vf-module-name", vfModule.getVfModuleName());
+ AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
+ doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUri));
+ boolean nameInUse = aaiVfModuleResources.checkNameInUse(vfModule);
+ assertFalse(nameInUse);
+ }
}
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 cdc601c1e4..3680eaac81 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
@@ -20,7 +20,10 @@
package org.onap.so.client.orchestration;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -30,6 +33,8 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
@@ -45,17 +50,22 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
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.AAIObjectPlurals;
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.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIVnfResourcesTest extends TestDataSetup {
+ private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+
private GenericVnf genericVnf;
private ServiceInstance serviceInstance;
@@ -227,4 +237,56 @@ public class AAIVnfResourcesTest extends TestDataSetup {
verify(MOCK_aaiValidatorImpl, times(1)).isPhysicalServerLocked(isA(String.class));
assertTrue(isVnfPserversLockedFlag);
}
+
+
+ @Test
+ public void checkNameInUseTrueTest() {
+ AAIResourceUri vnfUri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
+ doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
+ boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
+ assertTrue(nameInUse);
+ }
+
+ @Test
+ public void checkNameInUseFalseTest() {
+ AAIResourceUri vnfUri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
+ doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
+ boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
+ assertFalse(nameInUse);
+ }
+
+ @Test
+ public void queryVnfWrapperByIdTest() throws Exception {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId").depth(Depth.ALL);
+ final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiGenericVnf.json")));
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("vnfId");
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(eq(uri));
+ AAIResultWrapper actualResult = aaiVnfResources.queryVnfWrapperById(genericVnf);
+ assertEquals(actualResult, aaiResultWrapper);
+
+ }
+
+ @Test
+ public void getVserverTest() throws Exception {
+ final String content =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVserverQueryResponse.json")));
+ AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+ Optional<org.onap.aai.domain.yang.Vserver> oVserver = Optional.empty();
+ AAIResourceUri vserverUri = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "ModelInvariantUUID",
+ "serviceModelVersionId", "abc", "abc");
+
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ oVserver = aaiVnfResources.getVserver(vserverUri);
+
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+
+ if (oVserver.isPresent()) {
+ org.onap.aai.domain.yang.Vserver vserver = oVserver.get();
+ assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.Vserver.class).get(), sameBeanAs(vserver));
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
index 2bdcf30a4c..5772cab995 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
@@ -21,7 +21,10 @@
package org.onap.so.client.orchestration;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
@@ -39,8 +42,11 @@ import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -146,4 +152,22 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
assertEquals("testVolumeHeatStackId", volumeGroup.getHeatStackId());
}
+
+ @Test
+ public void checkNameInUseTrueTest() {
+ AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ .queryParam("volume-group-name", "testVolumeGroupName1");
+ doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
+ boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
+ assertTrue(nameInUse);
+ }
+
+ @Test
+ public void checkNameInUseFalseTest() {
+ AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ .queryParam("volume-group-name", "testVolumeGroupName1");
+ doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
+ boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
+ assertFalse(nameInUse);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java
index 195c89a651..c60e749a29 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NamingServiceResourcesTest.java
@@ -42,7 +42,9 @@ import org.onap.namingservice.model.NameGenRequest;
import org.onap.namingservice.model.NameGenResponse;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.client.namingservice.NamingClient;
+import org.onap.so.client.namingservice.NamingRequestObject;
import org.onap.so.client.namingservice.NamingRequestObjectBuilder;
+import org.onap.so.client.namingservice.NamingServiceConstants;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -100,5 +102,37 @@ public class NamingServiceResourcesTest extends TestDataSetup {
}
+ @Test
+ public void generateServiceInstanceNameTest() throws Exception {
+
+ NameGenRequest req = new NameGenRequest();
+ doReturn("generatedServiceInstanceName").when(MOCK_namingClient).postNameGenRequest(isA(NameGenRequest.class));
+ doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenRequestMapper(isA(List.class));
+ NamingRequestObject nrObject = new NamingRequestObject();
+ nrObject.setExternalKeyValue("testExternalKey");
+ nrObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
+ nrObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
+ nrObject.setPolicyInstanceNameValue(execution.getVariable("policyInstanceName"));
+ nrObject.setServiceModelNameValue("testServiceInstanceModelName");
+ nrObject.setModelVersionValue("testServiceInstanceModelVersion");
+ nrObject.setZoneIdValue(execution.getVariable("zoneId"));
+
+ String generatedName = namingServiceResources.generateServiceInstanceName(nrObject);
+
+ verify(MOCK_namingClient, times(1)).postNameGenRequest(any(NameGenRequest.class));
+ assertEquals("generatedServiceInstanceName", generatedName);
+ }
+
+ @Test
+ public void deleteServiceInstanceNameTest() throws Exception {
+ NameGenDeleteRequest req = new NameGenDeleteRequest();
+ doReturn(req).when(MOCK_namingRequestObjectBuilder).nameGenDeleteRequestMapper(isA(List.class));
+
+ NamingRequestObject nrObject = new NamingRequestObject();
+ nrObject.setExternalKeyValue("testExternalKey");
+ nrObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
+ namingServiceResources.deleteServiceInstanceName(nrObject);
+ verify(MOCK_namingClient, times(1)).deleteNameGenRequest(any(NameGenDeleteRequest.class));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
index 2b45a3302c..14e993281a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
@@ -23,6 +23,8 @@ package org.onap.so.client.orchestration;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -62,6 +64,8 @@ public class SDNCVfModuleResourcesTest extends TestDataSetup {
private RequestContext requestContext;
private GenericResourceApiVfModuleOperationInformation sdncReq;
+ private URI testURI;
+
@Before
public void before() {
vfModule = buildVfModule();
@@ -72,60 +76,69 @@ public class SDNCVfModuleResourcesTest extends TestDataSetup {
cloudRegion = buildCloudRegion();
requestContext = buildRequestContext();
sdncReq = new GenericResourceApiVfModuleOperationInformation();
+ try {
+ testURI = new URI("http://localhost:9800");
+ } catch (URISyntaxException e) {
+
+ }
}
@Test
public void assignVfModuleTest() throws MapperException {
doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion,
- requestContext, null);
+ requestContext, null, testURI);
sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ requestContext, testURI);
verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion,
- requestContext, null);
+ requestContext, null, testURI);
}
@Test
public void unassignVfModuleTest() throws MapperException {
doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
- SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null);
- sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance);
+ SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, requestContext, null,
+ testURI);
+ sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, requestContext, testURI);
verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
- SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null);
+ SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, requestContext, null,
+ testURI);
}
@Test
public void activateVfModuleTest() throws MapperException {
doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext,
- null);
- sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ null, testURI);
+ sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext,
+ testURI);
verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext,
- null);
+ null, testURI);
}
@Test
public void deactivateVfModuleTest() throws MapperException {
doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext,
- null);
- sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext);
+ null, testURI);
+ sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext,
+ testURI);
verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext,
- null);
+ null, testURI);
}
@Test
public void changeAssignVfModuleTest() throws MapperException, BadResponseException {
doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion,
- requestContext, null);
+ requestContext, null, testURI);
sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion,
- requestContext);
+ requestContext, testURI);
verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION,
SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion,
- requestContext, null);
+ requestContext, null, testURI);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
index 4c0e2b873f..0ccf056ddc 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
@@ -28,6 +28,8 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -66,6 +68,7 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
private CloudRegion cloudRegion;
private RequestContext requestContext;
private GenericResourceApiVnfOperationInformation sdncReq;
+ private URI testURI;
@Before
public void before() {
@@ -75,6 +78,11 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
cloudRegion = buildCloudRegion();
requestContext = buildRequestContext();
sdncReq = new GenericResourceApiVnfOperationInformation();
+ try {
+ testURI = new URI("http://localhost:9800");
+ } catch (URISyntaxException e) {
+
+ }
}
@Test
@@ -82,12 +90,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
- sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
+ anyBoolean(), any(URI.class));
}
@Test
@@ -95,12 +103,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
- sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
+ anyBoolean(), any(URI.class));
}
@Test
@@ -108,12 +116,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
- sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
+ anyBoolean(), any(URI.class));
}
@Test
@@ -137,11 +145,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class),
isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class),
isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class),
- anyBoolean());
- sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
- verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION,
- SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, genericVnf,
- serviceInstance, customer, cloudRegion, requestContext, false);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
+ verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION),
+ eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE),
+ eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), eq(false),
+ any(URI.class));
}
@Test
@@ -150,12 +159,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),
isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),
any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class),
- anyBoolean());
- sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION),
eq(SDNCSvcAction.DEACTIVATE), isA(GenericResourceApiRequestActionEnumeration.class),
any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),
- any(RequestContext.class), anyBoolean());
+ any(RequestContext.class), anyBoolean(), any(URI.class));
}
@@ -166,8 +175,8 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),
isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),
any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class),
- anyBoolean());
- sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
}
@Test
@@ -176,12 +185,12 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),
isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),
any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class),
- anyBoolean());
- sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION),
eq(SDNCSvcAction.UNASSIGN), isA(GenericResourceApiRequestActionEnumeration.class),
any(GenericVnf.class), any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),
- any(RequestContext.class), anyBoolean());
+ any(RequestContext.class), anyBoolean(), any(URI.class));
}
@Test
@@ -191,7 +200,7 @@ public class SDNCVnfResourcesTest extends TestDataSetup {
eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),
isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),
any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class), any(RequestContext.class),
- anyBoolean());
- sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext);
+ anyBoolean(), any(URI.class));
+ sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, testURI);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
index 275e9f7dbb..b71ddba63b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
@@ -25,6 +25,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
@@ -38,6 +39,7 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -53,7 +55,6 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
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.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
@@ -134,9 +135,9 @@ public class VfModuleTopologyOperationRequestMapperTest {
CloudRegion cloudRegion = new CloudRegion();
- GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest =
- mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule,
- volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
+ SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf,
+ serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080"));
String jsonToCompare = new String(Files.readAllBytes(
Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationAssign.json")));
@@ -145,7 +146,7 @@ public class VfModuleTopologyOperationRequestMapperTest {
GenericResourceApiVfModuleOperationInformation reqMapper1 =
omapper.readValue(jsonToCompare, GenericResourceApiVfModuleOperationInformation.class);
- assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId")
+ assertThat(vfModuleSDNCrequest, sameBeanAs(reqMapper1).ignoring("sdncRequestHeader.svcRequestId")
.ignoring("requestInformation.requestId"));
assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId());
}
@@ -174,7 +175,7 @@ public class VfModuleTopologyOperationRequestMapperTest {
GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest =
mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
- vnf, serviceInstance, null, null, requestContext, null);
+ vnf, serviceInstance, null, null, requestContext, null, new URI("http://localhost:8080"));
String jsonToCompare = new String(Files.readAllBytes(
Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationUnassign.json")));
@@ -183,7 +184,7 @@ public class VfModuleTopologyOperationRequestMapperTest {
GenericResourceApiVfModuleOperationInformation reqMapper1 =
omapper.readValue(jsonToCompare, GenericResourceApiVfModuleOperationInformation.class);
- assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId")
+ assertThat(vfModuleSDNCrequest, sameBeanAs(reqMapper1).ignoring("sdncRequestHeader.svcRequestId")
.ignoring("requestInformation.requestId"));
assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId());
}
@@ -211,7 +212,7 @@ public class VfModuleTopologyOperationRequestMapperTest {
GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest =
mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null,
- vnf, serviceInstance, null, null, requestContext, null);
+ vnf, serviceInstance, null, null, requestContext, null, new URI("http://localhost:8080"));
assertNotNull(vfModuleSDNCrequest.getRequestInformation().getRequestId());
}
@@ -271,9 +272,9 @@ public class VfModuleTopologyOperationRequestMapperTest {
CloudRegion cloudRegion = new CloudRegion();
- GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest =
- mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null,
- vnf, serviceInstance, customer, cloudRegion, requestContext, null);
+ GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
+ SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf,
+ serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080"));
assertNull(vfModuleSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid());
assertEquals("vnfModelCustomizationUuid",
@@ -330,7 +331,7 @@ public class VfModuleTopologyOperationRequestMapperTest {
expectedException.expectMessage(ERRORMESSAGE);
mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf,
- serviceInstance, customer, cloudRegion, requestContext, null);
+ serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080"));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
index cecf34ea10..00836176f0 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
@@ -23,15 +23,18 @@ package org.onap.so.client.sdnc.mapper;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Map;
import java.util.List;
+import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -45,8 +48,6 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
@RunWith(MockitoJUnitRunner.class)
public class VnfTopologyOperationRequestMapperTest {
@@ -127,11 +128,11 @@ public class VnfTopologyOperationRequestMapperTest {
GenericResourceApiVnfOperationInformation vnfOpInformation =
mapper.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, requestContext, true);
+ cloudRegion, requestContext, true, new URI("http://localhost:8080"));
GenericResourceApiVnfOperationInformation vnfOpInformationNullReqContext =
mapper.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,
GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
- cloudRegion, null, true);
+ cloudRegion, null, true, new URI("http://localhost:8080"));
assertNull(vnfOpInformation.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid());
assertEquals("vnfModelCustomizationUUID",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json
new file mode 100644
index 0000000000..e9b25ff266
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json
@@ -0,0 +1,53 @@
+{
+ "network-id" : "aNetworkId",
+ "cascaded" : false,
+ "cloud-params" : { },
+ "network-name" : "aNetworkName",
+ "neutron-network-id" : null,
+ "network-type" : "aNetworkType",
+ "network-technology" : "aNetworkTechnology",
+ "network-role" : "",
+ "is-bound-to-vpn" : false,
+ "service-id" : "aServiceId",
+ "network-role-instance" : 0,
+ "orchestration-status" : "ACTIVE",
+ "heat-stack-id" : null,
+ "contrail-network-fqdn" : null,
+ "network-policies" : [ ],
+ "contrail-network-route-table-references" : [ ],
+ "widget-model-id" : null,
+ "widget-model-version" : null,
+ "physical-network-name" : "pNetworkName",
+ "is-provider-network" : false,
+ "is-shared-network" : false,
+ "is-external-network" : false,
+ "self-link" : "/",
+ "operational-status" : null,
+ "subnets" : [ {
+ "subnet-id" : "subnetId1",
+ "subnet-name" : "aSubnetName1",
+ "neutron-subnet-id" : null,
+ "gateway-address" : "192.168.1.1",
+ "network-start-address" : "192.168.1.2",
+ "cidr-mask" : "10",
+ "ip-version" : "4",
+ "orchestration-status" : "ACTIVE",
+ "dhcp-enabled" : true,
+ "dhcp-start" : "192.168.1.2",
+ "dhcp-end" : "192.168.1.16",
+ "subnet-role" : "",
+ "ip-assignment-direction" : "true",
+ "subnet-sequence" : null,
+ "host-routes": [{
+ "host-route-id": "hrId1",
+ "route-prefix": "192.168.0.0/16",
+ "next-hop": "192.168.1.1",
+ "next-hop-type": null
+ }, {
+ "host-route-id": "hrId2",
+ "route-prefix": "192.168.1.5/16",
+ "next-hop": "192.168.1.1",
+ "next-hop-type": null
+ }]
+ }]
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json
new file mode 100644
index 0000000000..31e6fd5f53
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json
@@ -0,0 +1,46 @@
+{
+ "requestInfo" : {
+ "transactionId" : "testRequestId",
+ "requestId" : "testRequestId",
+ "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId",
+ "sourceId" : "mso",
+ "requestType" : "create",
+ "timeout" : 1800
+ },
+ "serviceInfo" : {
+ "modelInfo" : {
+ "modelName" : "testModelName1",
+ "modelVersionId" : "testModelUUID1",
+ "modelVersion" : "testModelVersion1",
+ "modelInvariantId" : "testModelInvariantUUID1"
+ },
+ "serviceRole" : "testServiceRole1",
+ "serviceInstanceId" : "testServiceInstanceId1",
+ "serviceName" : "testServiceType1"
+ },
+ "placementInfo" : {
+ "subscriberInfo" : {
+ "globalSubscriberId" : "testCustomerId",
+ "subscriberName" : "testCustomerName"
+ },
+ "placementDemands" : [ {
+ "serviceResourceId" : "testProxyId1",
+ "resourceModuleName" : "testProxyInstanceName1",
+ "resourceModelInfo" : {
+ "modelName" : "testProxyModelName1",
+ "modelVersionId" : "testProxyModelUuid1",
+ "modelVersion" : "testProxyModelVersion1",
+ "modelInvariantId" : "testProxyModelInvariantUuid1"
+ },
+ "filteringAttributes" : [ {
+ "identifierType" : "cloudRegionId",
+ "identifiers" : [ "testCloudRegionId" ],
+ "cloudOwner" : "att"
+ } ]
+ } ],
+ "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false}
+ },
+ "licenseInfo" : {
+ "licenseDemands" : [ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnf.json
new file mode 100644
index 0000000000..e997db3f69
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnf.json
@@ -0,0 +1,57 @@
+{
+ "closedLoopDisabled":false,
+ "vnf-id":"vnfId1",
+ "vnf-name":"vnfName",
+ "vnf-type":"vnfType",
+ "orchestration-status":"PRECREATED",
+ "vf-modules": {
+ "vf-module": [{
+ "vf-module-id": "lukewarm",
+ "vf-module-name": "testVfModuleNameGWPrim",
+ "heat-stack-id": "fastburn",
+ "is-base-vf-module": true,
+ "orchestration-status": "Created"
+ },
+ {
+ "vf-module-id": "testVfModuleIdGWSec",
+ "vf-module-name": "testVfModuleNameGWSec",
+ "heat-stack-id": "testHeatStackIdGWSec",
+ "orchestration-status": "Created"
+ }]
+ },
+ "volume-groups":[],
+ "line-of-business":null,
+ "platform":null,
+ "cascaded":false,
+ "cloud-params":{},
+ "cloud-context":null,
+ "solution":null,
+ "vnf-name-2":null,
+ "service-id":null,
+ "regional-resource-zone":null,
+ "prov-status":null,
+ "operational-status":null,
+ "equipment-role":null,
+ "management-option":null,
+ "ipv4-oam-address":null,
+ "ipv4-loopback0-address":null,
+ "nm-lan-v6-address":null,
+ "management-v6-address":null,
+ "vcpu":null,
+ "vcpu-units":null,
+ "vmemory":null,
+ "vmemory-units":null,
+ "vdisk":null,
+ "vdisk-units":null,
+ "in-maint":false,
+ "is-closed-loop-disabled":false,
+ "summary-status":null,
+ "encrypted-access-flag":null,
+ "as-number":null,
+ "regional-resource-subzone":null,
+ "self-link":null,
+ "ipv4-oam-gateway-address":null,
+ "ipv4-oam-gateway-address-prefix-length":null,
+ "vlan-id-outer":null,"nm-profile-name":null,
+ "model-info-generic-vnf":null
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnfWithVservers.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnfWithVservers.json
new file mode 100644
index 0000000000..0ad0f054b0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiGenericVnfWithVservers.json
@@ -0,0 +1,434 @@
+{
+ "vnf-id": "example-vnf-id-val-90603",
+ "vnf-name": "example-vnf-name-val-56838",
+ "vnf-name2": "example-vnf-name2-val-56319",
+ "vnf-type": "example-vnf-type-val-30533",
+ "service-id": "example-service-id-val-28290",
+ "regional-resource-zone": "example-regional-resource-zone-val-11059",
+ "prov-status": "example-prov-status-val-59777",
+ "operational-status": "example-operational-status-val-22513",
+ "in-maint": true,
+
+ "equipment-role": "example-equipment-role-val-23396",
+ "orchestration-status": "example-orchestration-status-val-59435",
+ "heat-stack-id": "example-heat-stack-id-val-96869",
+ "mso-catalog-key": "example-mso-catalog-key-val-30721",
+ "management-option": "example-management-option-val-61927",
+ "ipv4-oam-address": "192.168.10.14",
+ "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-87072",
+ "nm-lan-v6-address": "example-nm-lan-v6-address-val-91063",
+ "management-v6-address": "example-management-v6-address-val-80466",
+ "vcpu": 45837298,
+ "vcpu-units": "example-vcpu-units-val-86249",
+ "vmemory": 57288956,
+ "vmemory-units": "example-vmemory-units-val-13291",
+ "vdisk": 16937143,
+ "vdisk-units": "example-vdisk-units-val-73197",
+
+ "is-closed-loop-disabled": true,
+ "summary-status": "example-summary-status-val-86438",
+ "encrypted-access-flag": true,
+
+
+
+
+ "model-invariant-id": "example-model-invariant-id-val-14704",
+ "model-version-id": "example-model-version-id-val-47847",
+ "model-customization-id": "example-model-customization-id-val-52688",
+ "widget-model-id": "example-widget-model-id-val-20939",
+ "widget-model-version": "example-widget-model-version-val-72210",
+ "as-number": "example-as-number-val-68358",
+ "regional-resource-subzone": "example-regional-resource-subzone-val-34391",
+ "nf-type": "example-nf-type-val-54866",
+ "nf-function": "example-nf-function-val-24790",
+ "nf-role": "example-nf-role-val-4780",
+ "nf-naming-code": "example-nf-naming-code-val-25118",
+ "selflink": "example-selflink-val-68404",
+
+ "relationship-list": {"relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v12/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/2c323333-af4f-4849-af03-c862c0e93e3b",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "e433710f-9217-458d-a79d-1c7aff376d89"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "VIRTUAL USP"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "2c323333-af4f-4849-af03-c862c0e93e3b"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "kjhgfd1"
+ }]
+ },
+ {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn23a"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "e6beab145f6b49098277ac163ac1b4f3"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "1b3f44e5-d96d-4aac-bd9a-310e8cfb0af5"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "comx5000vm003"
+ }]
+ },
+ {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/14551849-1e70-45cd-bc5d-a256d49548a2",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn23a"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "e6beab145f6b49098277ac163ac1b4f3"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "14551849-1e70-45cd-bc5d-a256d49548a2"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "comx5000vm002"
+ }]
+ },
+ {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtn23a/tenants/tenant/e6beab145f6b49098277ac163ac1b4f3/vservers/vserver/48bd7f11-408f-417c-b834-b41c1b98f7d7",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "CloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn23a"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "e6beab145f6b49098277ac163ac1b4f3"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "48bd7f11-408f-417c-b834-b41c1b98f7d7"
+ }
+ ],
+ "related-to-property": [ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "comx5000vm001"
+ }]
+ }
+ ]},
+
+
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "example-interface-name-val-50593",
+ "interface-role": "example-interface-role-val-23375",
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-5921",
+ "selflink": "example-selflink-val-75663",
+ "interface-id": "example-interface-id-val-37465",
+ "macaddr": "example-macaddr-val-62657",
+ "network-name": "example-network-name-val-7252",
+ "management-option": "example-management-option-val-32963",
+ "interface-description": "example-interface-description-val-89453",
+ "is-port-mirrored": true,
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-interface": "example-vlan-interface-val-16684",
+ "vlan-id-inner": 8602916,
+ "vlan-id-outer": 97348542,
+ "speed-value": "example-speed-value-val-90330",
+ "speed-units": "example-speed-units-val-15849",
+ "vlan-description": "example-vlan-description-val-46942",
+ "backdoor-connection": "example-backdoor-connection-val-78445",
+
+ "orchestration-status": "example-orchestration-status-val-44994",
+
+
+
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-90277",
+ "l3-interface-ipv4-prefix-length": 3364150,
+ "vlan-id-inner": 44021171,
+ "vlan-id-outer": 55708677,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-43267",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-62870"
+ }
+ ],
+ "l3-interface-ipv6-address-list": [
+ {
+ "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-45323",
+ "l3-interface-ipv6-prefix-length": 56688923,
+ "vlan-id-inner": 5703071,
+ "vlan-id-outer": 86682265,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-28366",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-53034"
+ }
+ ]
+ }
+ ]
+ },
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "pci-id": "example-pci-id-val-4720",
+ "vf-vlan-filter": "example-vf-vlan-filter-val-42594",
+ "vf-mac-filter": "example-vf-mac-filter-val-13375",
+ "vf-vlan-strip": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-mirrors": "example-vf-mirrors-val-6057",
+ "vf-broadcast-allow": true,
+ "vf-unknown-multicast-allow": true,
+ "vf-unknown-unicast-allow": true,
+ "vf-insert-stag": true,
+ "vf-link-status": "example-vf-link-status-val-81448",
+ "neutron-network-id": "example-neutron-network-id-val-9504"
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "example-interface-name-val-16738",
+ "interface-role": "example-interface-role-val-13943",
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-63173",
+ "selflink": "example-selflink-val-43085",
+ "interface-id": "example-interface-id-val-51379",
+ "macaddr": "example-macaddr-val-16195",
+ "network-name": "example-network-name-val-45683",
+ "management-option": "example-management-option-val-78983",
+ "interface-description": "example-interface-description-val-34414",
+ "is-port-mirrored": true
+ }
+ ]
+ },
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-99078",
+ "l3-interface-ipv4-prefix-length": 55755841,
+ "vlan-id-inner": 81525473,
+ "vlan-id-outer": 90908072,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-47919",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-84236"
+ }
+ ],
+ "l3-interface-ipv6-address-list": [
+ {
+ "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-21939",
+ "l3-interface-ipv6-prefix-length": 50057584,
+ "vlan-id-inner": 75774660,
+ "vlan-id-outer": 4421090,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-46377",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-16585"
+ }
+ ]
+ }
+ ]
+ },
+ "lag-interfaces": {
+ "lag-interface": [
+ {
+ "interface-name": "example-interface-name-val-39234",
+ "interface-description": "example-interface-description-val-1037",
+ "speed-value": "example-speed-value-val-1929",
+ "speed-units": "example-speed-units-val-74937",
+ "interface-id": "example-interface-id-val-91265",
+ "interface-role": "example-interface-role-val-19613",
+
+
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "example-interface-name-val-10722",
+ "interface-role": "example-interface-role-val-95194",
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-24328",
+ "selflink": "example-selflink-val-24987",
+ "interface-id": "example-interface-id-val-75726",
+ "macaddr": "example-macaddr-val-36940",
+ "network-name": "example-network-name-val-65359",
+ "management-option": "example-management-option-val-49521",
+ "interface-description": "example-interface-description-val-70528",
+ "is-port-mirrored": true,
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-interface": "example-vlan-interface-val-70827",
+ "vlan-id-inner": 55659612,
+ "vlan-id-outer": 90335612,
+ "speed-value": "example-speed-value-val-54761",
+ "speed-units": "example-speed-units-val-91398",
+ "vlan-description": "example-vlan-description-val-17018",
+ "backdoor-connection": "example-backdoor-connection-val-4021",
+
+ "orchestration-status": "example-orchestration-status-val-18315",
+
+
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-59336",
+ "l3-interface-ipv4-prefix-length": 57636053,
+ "vlan-id-inner": 34068397,
+ "vlan-id-outer": 48570286,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-69862",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-75795"
+ }
+ ],
+ "l3-interface-ipv6-address-list": [
+ {
+ "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-15038",
+ "l3-interface-ipv6-prefix-length": 42694503,
+ "vlan-id-inner": 15929806,
+ "vlan-id-outer": 87413856,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-52519",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-24471"
+ }
+ ]
+ }
+ ]
+ },
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "pci-id": "example-pci-id-val-44669",
+ "vf-vlan-filter": "example-vf-vlan-filter-val-53436",
+ "vf-mac-filter": "example-vf-mac-filter-val-71902",
+ "vf-vlan-strip": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-mirrors": "example-vf-mirrors-val-54963",
+ "vf-broadcast-allow": true,
+ "vf-unknown-multicast-allow": true,
+ "vf-unknown-unicast-allow": true,
+ "vf-insert-stag": true,
+ "vf-link-status": "example-vf-link-status-val-1546",
+ "neutron-network-id": "example-neutron-network-id-val-92159"
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "example-interface-name-val-9327",
+ "interface-role": "example-interface-role-val-21859",
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-21445",
+ "selflink": "example-selflink-val-6085",
+ "interface-id": "example-interface-id-val-39854",
+ "macaddr": "example-macaddr-val-14433",
+ "network-name": "example-network-name-val-3722",
+ "management-option": "example-management-option-val-64739",
+ "interface-description": "example-interface-description-val-5814",
+ "is-port-mirrored": true
+
+
+
+ }
+ ]
+ },
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "example-l3-interface-ipv4-address-val-64531",
+ "l3-interface-ipv4-prefix-length": 66545882,
+ "vlan-id-inner": 12194134,
+ "vlan-id-outer": 29589286,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-91108",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-56984"
+ }
+ ],
+ "l3-interface-ipv6-address-list": [
+ {
+ "l3-interface-ipv6-address": "example-l3-interface-ipv6-address-val-37408",
+ "l3-interface-ipv6-prefix-length": 5116459,
+ "vlan-id-inner": 39229896,
+ "vlan-id-outer": 15091934,
+ "is-floating": true,
+ "neutron-network-id": "example-neutron-network-id-val-87700",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-37352"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "example-vf-module-id-val-56249",
+ "vf-module-name": "example-vf-module-name-val-18987",
+ "heat-stack-id": "example-heat-stack-id-val-80110",
+ "orchestration-status": "example-orchestration-status-val-8226",
+ "is-base-vf-module": true,
+ "model-invariant-id": "example-model-invariant-id-val-5071",
+ "model-version-id": "example-model-version-id-val-80793",
+ "model-customization-id": "example-model-customization-id-val-83277",
+ "widget-model-id": "example-widget-model-id-val-99814",
+ "widget-model-version": "example-widget-model-version-val-22799",
+ "contrail-service-instance-fqdn": "example-contrail-service-instance-fqdn-val-52133",
+ "module-index": 1933,
+ "selflink": "example-selflink-val-69992"
+ }
+ ]
+ },
+ "licenses": {
+ "license": [
+ {
+ "group-uuid": "example-group-uuid-val-73012",
+ "resource-uuid": "example-resource-uuid-val-80045"
+ }
+ ]
+ },
+ "entitlements": {
+ "entitlement": [
+ {
+ "group-uuid": "example-group-uuid-val-14874",
+ "resource-uuid": "example-resource-uuid-val-49146"
+ }
+ ]
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiNetworkWrapper.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiNetworkWrapper.json
new file mode 100644
index 0000000000..aaa2c4ba35
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiNetworkWrapper.json
@@ -0,0 +1,42 @@
+{
+ "networkId": "0384d743-f69b-4cc8-9aa8-c3ae66662c44",
+ "networkName": "Dev_Bindings_1802_020118",
+ "networkType": "CONTRAIL30_BASIC",
+ "networkRole": "GN_EVPN_direct",
+ "networkTechnology": "contrail",
+ "neutronNetworkId": "1112b912-0e00-4d6d-9392-014e106399ee",
+ "isBoundToVpn": true,
+ "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "networkRoleInstance": 0,
+ "resourceVersion": "1517496965485",
+ "orchestrationStatus": "Active",
+ "heatStackId": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb",
+ "contrailNetworkFqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118",
+ "physicalNetworkName": "tbd",
+ "isProviderNetwork": false,
+ "isSharedNetwork": true,
+ "isExternalNetwork": false,
+ "relationshipList": {
+ "relationship": [
+ {
+ "relatedTo": "vpn-binding",
+ "relatedLink": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001",
+ "relationshipData": [
+ {
+ "relationshipKey": "vpn-binding.vpn-id",
+ "relationshipValue": "9a7b327d9-287aa00-82c4b0-100001"
+ }
+ ],
+ "relatedToProperty": [
+ {
+ "propertyKey": "vpn-binding.vpn-name",
+ "propertyValue": "MSO_VPN_TEST"
+ },
+ {
+ "propertyKey": "vpn-binding.vpn-type"
+ }
+ ]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverFullQueryResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverFullQueryResponse.json
new file mode 100644
index 0000000000..1c7e1fb970
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverFullQueryResponse.json
@@ -0,0 +1,13 @@
+{
+ "in-maint": null,
+ "is-closed-loop-disabled": null,
+ "linterfaces": null,
+ "prov-status": null,
+ "relationship-list": null,
+ "resource-version": null,
+ "volumes": null,
+ "vserver-id": "VServerId",
+ "vserver-name": "VServerName",
+ "vserver-name2": "VServerName2",
+ "vserver-selflink": "http://VSERVER-link.com"
+ } \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverQueryResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverQueryResponse.json
new file mode 100644
index 0000000000..eca735b810
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVserverQueryResponse.json
@@ -0,0 +1,6 @@
+{
+ "vserverId": "VServerId",
+ "vserverName": "VServerName",
+ "vserverName2": "VServerName2",
+ "vserverSelflink": "http://VSERVER-link.com"
+ } \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
index 777f3444d2..53c1997126 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
@@ -43,7 +43,7 @@
},
"sdnc-request-header" : {
"svc-request-id" : "svcRequestId",
- "svc-notification-url" : null,
+ "svc-notification-url" : "http://localhost:8080",
"svc-action" : "assign"
},
"vf-module-information" : {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
index c28b0fa689..9f93c0df1f 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
@@ -17,7 +17,7 @@
},
"sdnc-request-header" : {
"svc-request-id" : "svcRequestId",
- "svc-notification-url" : null,
+ "svc-notification-url" : "http://localhost:8080",
"svc-action" : "unassign"
},
"vf-module-information" : {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json
index 579075f502..692ecfdf75 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json
@@ -4,7 +4,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10"
},
"cloudConfiguration": {
@@ -35,7 +35,7 @@
{
"service": {
"modelInfo": {
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceParams": [],
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json
index 26838024da..5753f69d3f 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json
@@ -4,7 +4,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10.0"
},
"cloudConfiguration": {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json
index ddb118ea49..39e87f19f1 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json
@@ -4,7 +4,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10.0"
},
"cloudConfiguration": {
@@ -34,7 +34,7 @@
"service": {
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceParams": [],
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json
index 51caddd48a..b86a2a28f6 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json
@@ -4,7 +4,7 @@
"modelType": "service",
"modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersion": "10.0"
},
"owningEntity": {
@@ -31,7 +31,7 @@
"service": {
"modelInfo": {
"modelType": "service",
- "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelName": "Sample Service Model",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
},
"instanceParams": [],
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java
index 1893590106..d15fbf9322 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClient.java
@@ -95,6 +95,11 @@ public class CloudifyClient {
*/
public <T> T execute(CloudifyRequest<T> request) {
CloudifyResponse response = request(request);
+
+ if (null == response) {
+ return null;
+ }
+
return (request.returnType() != null && request.returnType() != Void.class)
? response.getEntity(request.returnType())
: null;
@@ -130,7 +135,7 @@ public class CloudifyClient {
* @return An object of Class <R>
*/
public <R> CloudifyRequest<R> get(String path, Class<R> returnType) {
- return new CloudifyRequest<R>(this, HttpMethod.GET, path, null, returnType);
+ return new CloudifyRequest<>(this, HttpMethod.GET, path, null, returnType);
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java
index f031f10bb5..652df6ff0d 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientConnector.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,7 @@
package org.onap.so.cloudify.base.client;
-
+@FunctionalInterface
public interface CloudifyClientConnector {
public <T> CloudifyResponse request(CloudifyRequest<T> request);
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java
index 2478557afc..c4dcc89d0b 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyClientTokenProvider.java
@@ -59,7 +59,9 @@ public class CloudifyClientTokenProvider implements CloudifyTokenProvider {
tokenRequest.setBasicAuthentication(user, password);
Token newToken = tokenRequest.execute();
- token = newToken.getValue();
+ if (newToken != null) {
+ token = newToken.getValue();
+ }
if (expiration == null) {
expiration = new Date();
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java
index 0f9ad2da39..006768f2f1 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyRequest.java
@@ -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,27 +31,13 @@ public class CloudifyRequest<R> {
private CloudifyClient client;
- public CloudifyRequest() {
-
- }
-
- public CloudifyRequest(CloudifyClient client, HttpMethod method, CharSequence path, Entity<?> entity,
- Class<R> returnType) {
- this.client = client;
- this.method = method;
- this.path = new StringBuilder(path);
- this.entity = entity;
- this.returnType = returnType;
- header("Accept", "application/json");
- }
-
private String endpoint;
private HttpMethod method;
private StringBuilder path = new StringBuilder();
- private Map<String, List<Object>> headers = new HashMap<String, List<Object>>();
+ private Map<String, List<Object>> headers = new HashMap<>();
private Entity<?> entity;
@@ -61,6 +47,20 @@ public class CloudifyRequest<R> {
private String user = null;
private String password = null;
+ public CloudifyRequest() {
+
+ }
+
+ public CloudifyRequest(CloudifyClient client, HttpMethod method, CharSequence path, Entity<?> entity,
+ Class<R> returnType) {
+ this.client = client;
+ this.method = method;
+ this.path = new StringBuilder(path);
+ this.entity = entity;
+ this.returnType = returnType;
+ header("Accept", "application/json");
+ }
+
public CloudifyRequest<R> endpoint(String endpoint) {
this.endpoint = endpoint;
return this;
@@ -100,7 +100,7 @@ public class CloudifyRequest<R> {
}
public <T> Entity<T> entity(T entity, String contentType) {
- return new Entity<T>(entity, contentType);
+ return new Entity<>(entity, contentType);
}
public Entity<?> entity() {
@@ -151,7 +151,7 @@ public class CloudifyRequest<R> {
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
@@ -160,7 +160,7 @@ public class CloudifyRequest<R> {
+ headers + ", entity=" + entity + ", returnType=" + returnType + "]";
}
- private Map<String, List<Object>> queryParams = new LinkedHashMap<String, List<Object>>();
+ private Map<String, List<Object>> queryParams = new LinkedHashMap<>();
public Map<String, List<Object>> queryParams() {
return queryParams;
@@ -171,7 +171,7 @@ public class CloudifyRequest<R> {
List<Object> values = queryParams.get(key);
values.add(value);
} else {
- List<Object> values = new ArrayList<Object>();
+ List<Object> values = new ArrayList<>();
values.add(value);
queryParams.put(key, values);
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java
index 966cc8f144..0ca3212238 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/base/client/CloudifyResponseException.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,11 +26,11 @@ public class CloudifyResponseException extends CloudifyBaseException {
private static final long serialVersionUID = 7294957362769575271L;
- protected String message;
- protected int status;
+ private final String message;
+ private final int status;
// Make the response available for exception handling (includes body)
- protected CloudifyResponse response;
+ private final CloudifyResponse response;
public CloudifyResponseException(String message, int status) {
this.message = message;
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
index e1992d98ca..54519bac72 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -94,7 +94,7 @@ public class HttpClientConnector implements CloudifyClientConnector {
public <T> CloudifyResponse request(CloudifyRequest<T> request) {
- CloseableHttpClient httpClient = null; // HttpClients.createDefault();
+ CloseableHttpClient httpClient = null;
if (request.isBasicAuth()) {
// Use Basic Auth for this request.
@@ -211,11 +211,14 @@ public class HttpClientConnector implements CloudifyClientConnector {
} catch (HttpResponseException e) {
// What exactly does this mean? It does not appear to get thrown for
// non-2XX responses as documented.
+ logger.error("Client HttpResponseException", e);
throw new CloudifyResponseException(e.getMessage(), e.getStatusCode());
} catch (UnknownHostException e) {
+ logger.error("Client UnknownHostException", e);
throw new CloudifyConnectException("Unknown Host: " + e.getMessage());
} catch (IOException e) {
// Catch all other IOExceptions and throw as OpenStackConnectException
+ logger.error("Client IOException", e);
throw new CloudifyConnectException(e.getMessage());
} catch (Exception e) {
// Catchall for anything else, must throw as a RuntimeException
@@ -227,13 +230,17 @@ public class HttpClientConnector implements CloudifyClientConnector {
try {
httpResponse.close();
} catch (IOException e) {
- logger.debug("Unable to close HTTP Response: " + e);
+ logger.debug("Unable to close HTTP Response: ", e);
}
}
// Get here on an error response (4XX-5XX)
- throw new CloudifyResponseException(httpResponse.getStatusLine().getReasonPhrase(),
- httpResponse.getStatusLine().getStatusCode(), httpClientResponse);
+ if (httpResponse != null) {
+ throw new CloudifyResponseException(httpResponse.getStatusLine().getReasonPhrase(),
+ httpResponse.getStatusLine().getStatusCode(), httpClientResponse);
+ } else {
+ throw new CloudifyResponseException("Null httpResponse", 0, httpClientResponse);
+ }
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
index a96fdb6b50..f1aa06cb39 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientResponse.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,7 +39,7 @@ public class HttpClientResponse implements CloudifyResponse {
private static Logger logger = LoggerFactory.getLogger(HttpClientResponse.class);
- private HttpResponse response = null;
+ private transient HttpResponse response = null;
private String entityBody = null;
public HttpClientResponse(HttpResponse response) {
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java
index 3eae02bcee..9877eb9f43 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/BlueprintsResource.java
@@ -31,6 +31,7 @@ import org.onap.so.cloudify.base.client.CloudifyRequest;
public class BlueprintsResource {
private final CloudifyClient client;
+ private static final String BLUEPRINTS_PATH = "/api/v3/blueprints/";
public BlueprintsResource(CloudifyClient client) {
this.client = client;
@@ -72,7 +73,7 @@ public class BlueprintsResource {
// If a URL is provided, add it to the query string
// If a Stream is provided, set it as the Entity body
super(client, HttpMethod.PUT,
- "/api/v3/blueprints/" + blueprintId + "?application_file_name=" + mainFileName
+ BLUEPRINTS_PATH + blueprintId + "?application_file_name=" + mainFileName
+ ((blueprintUrl != null) ? "&blueprint_archive=" + blueprintUrl : ""),
((blueprint != null) ? Entity.stream(blueprint) : null), Blueprint.class);
}
@@ -80,13 +81,13 @@ public class BlueprintsResource {
public class DeleteBlueprint extends CloudifyRequest<Blueprint> {
public DeleteBlueprint(String blueprintId) {
- super(client, HttpMethod.DELETE, "/api/v3/blueprints/" + blueprintId, null, Blueprint.class);
+ super(client, HttpMethod.DELETE, BLUEPRINTS_PATH + blueprintId, null, Blueprint.class);
}
}
public class GetBlueprint extends CloudifyRequest<Blueprint> {
public GetBlueprint(String id, String queryArgs) {
- super(client, HttpMethod.GET, "/api/v3/blueprints/" + id + queryArgs, null, Blueprint.class);
+ super(client, HttpMethod.GET, BLUEPRINTS_PATH + id + queryArgs, null, Blueprint.class);
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java
index 262045a367..335f6b1697 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/DeploymentsResource.java
@@ -32,6 +32,7 @@ import org.onap.so.cloudify.base.client.CloudifyRequest;
public class DeploymentsResource {
private final CloudifyClient client;
+ private static final String DEPLOYMENT_PATH = "/api/v3/deployments/";
public DeploymentsResource(CloudifyClient client) {
this.client = client;
@@ -59,25 +60,25 @@ public class DeploymentsResource {
public class CreateDeployment extends CloudifyRequest<Deployment> {
public CreateDeployment(String deploymentId, CreateDeploymentParams body) {
- super(client, HttpMethod.PUT, "/api/v3/deployments/" + deploymentId, Entity.json(body), Deployment.class);
+ super(client, HttpMethod.PUT, DEPLOYMENT_PATH + deploymentId, Entity.json(body), Deployment.class);
}
}
public class DeleteDeployment extends CloudifyRequest<Deployment> {
public DeleteDeployment(String deploymentId) {
- super(client, HttpMethod.DELETE, "/api/v3/deployments/" + deploymentId, null, Deployment.class);
+ super(client, HttpMethod.DELETE, DEPLOYMENT_PATH + deploymentId, null, Deployment.class);
}
}
public class GetDeployment extends CloudifyRequest<Deployment> {
public GetDeployment(String id) {
- super(client, HttpMethod.GET, "/api/v3/deployments/" + id, null, Deployment.class);
+ super(client, HttpMethod.GET, DEPLOYMENT_PATH + id, null, Deployment.class);
}
}
public class GetDeploymentOutputs extends CloudifyRequest<DeploymentOutputs> {
public GetDeploymentOutputs(String id) {
- super(client, HttpMethod.GET, "/api/v3/deployments/" + id + "/outputs", null, DeploymentOutputs.class);
+ super(client, HttpMethod.GET, DEPLOYMENT_PATH + id + "/outputs", null, DeploymentOutputs.class);
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java
index 51aaea94bb..34251bfe52 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/client/ExecutionsResource.java
@@ -33,6 +33,7 @@ import org.onap.so.cloudify.base.client.CloudifyRequest;
public class ExecutionsResource {
private final CloudifyClient client;
+ private static final String EXECUTIONS_PATH = "/api/v3/executions/";
public ExecutionsResource(CloudifyClient client) {
this.client = client;
@@ -76,7 +77,7 @@ public class ExecutionsResource {
public class GetExecution extends CloudifyRequest<Execution> {
public GetExecution(String id) {
- super(client, HttpMethod.GET, "/api/v3/executions/" + id, null, Execution.class);
+ super(client, HttpMethod.GET, EXECUTIONS_PATH + id, null, Execution.class);
}
}
@@ -95,13 +96,13 @@ public class ExecutionsResource {
public class UpdateExecution extends CloudifyRequest<Execution> {
public UpdateExecution(String executionId, UpdateExecutionParams body) {
- super(client, HttpMethod.PATCH, "/api/v3/executions/" + executionId, Entity.json(body), Execution.class);
+ super(client, HttpMethod.PATCH, EXECUTIONS_PATH + executionId, Entity.json(body), Execution.class);
}
}
public class CancelExecution extends CloudifyRequest<Execution> {
public CancelExecution(String executionId, CancelExecutionParams body) {
- super(client, HttpMethod.POST, "/api/v3/executions/" + executionId, Entity.json(body), Execution.class);
+ super(client, HttpMethod.POST, EXECUTIONS_PATH + executionId, Entity.json(body), Execution.class);
}
}
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java
index 0fbe1fc33d..7f96b8f7c6 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/v3/model/CancelExecutionParams.java
@@ -30,8 +30,8 @@ public class CancelExecutionParams implements Serializable {
@JsonProperty("action")
private String action;
- public final static String CANCEL_ACTION = "cancel";
- public final static String FORCE_CANCEL_ACTION = "force-cancel";
+ public static final String CANCEL_ACTION = "cancel";
+ public static final String FORCE_CANCEL_ACTION = "force-cancel";
public String getAction() {
return action;
diff --git a/common/pom.xml b/common/pom.xml
index 2742afee1a..2553038e6b 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -111,7 +111,7 @@
<dependency>
<groupId>net.jodah</groupId>
<artifactId>failsafe</artifactId>
- <version>1.1.0</version>
+ <version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
@@ -140,7 +140,10 @@
<artifactId>reflections</artifactId>
<version>0.9.11</version>
</dependency>
-
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ </dependency>
<!-- CDS dependencies -->
<dependency>
<groupId>org.onap.ccsdk.cds.components</groupId>
@@ -183,8 +186,24 @@
<version>${grpc.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.javatuples</groupId>
+ <artifactId>javatuples</artifactId>
+ <version>1.2</version>
+ </dependency>
</dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${springboot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<build>
<resources>
<resource>
diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java
index 3fb09433e1..715ba32831 100644
--- a/common/src/main/java/org/onap/so/client/HttpClient.java
+++ b/common/src/main/java/org/onap/so/client/HttpClient.java
@@ -83,4 +83,16 @@ public class HttpClient extends RestClient {
}
}
+ public void setAcceptType(String value) {
+ try {
+ if (isNotBlank(value)) {
+ super.accept = value;
+ } else {
+ log.warn("Not adding accept to headers.");
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
}
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index 0b10d85bbf..d3a4d444f7 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -26,15 +26,14 @@ import java.net.SocketTimeoutException;
import java.net.URI;
import java.net.URL;
import java.security.GeneralSecurityException;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Base64;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
-import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@@ -276,22 +275,20 @@ public abstract class RestClient {
}
public Response method(String method, Object entity) {
- RetryPolicy policy = new RetryPolicy();
List<Predicate<Throwable>> items = retryOn();
Predicate<Throwable> pred = items.stream().reduce(Predicate::or).orElse(x -> false);
- policy.retryOn(error -> pred.test(error));
+ RetryPolicy<Object> policy =
+ new RetryPolicy<>().handleIf(pred).withDelay(Duration.ofMillis(this.props.getDelayBetweenRetries()))
+ .withMaxRetries(this.props.getRetries());
- policy.withDelay(this.props.getDelayBetweenRetries(), TimeUnit.MILLISECONDS)
- .withMaxRetries(this.props.getRetries());
-
- return Failsafe.with(policy).get(buildRequest(method, entity));
+ return Failsafe.with(policy).get(() -> buildRequest(method, entity));
}
- protected RestRequest buildRequest(String method, Object entity) {
- return new RestRequest(this, method, entity);
+ protected Response buildRequest(String method, Object entity) throws Exception {
+ return new RestRequest(this, method, entity).get();
}
private <T> Optional<T> format(Response response, Class<T> resultClass) {
diff --git a/common/src/main/java/org/onap/so/client/RestRequest.java b/common/src/main/java/org/onap/so/client/RestRequest.java
index 9d2fa42d00..9e6e818171 100644
--- a/common/src/main/java/org/onap/so/client/RestRequest.java
+++ b/common/src/main/java/org/onap/so/client/RestRequest.java
@@ -23,15 +23,15 @@
package org.onap.so.client;
import java.util.Optional;
-import java.util.concurrent.Callable;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import net.jodah.failsafe.function.CheckedSupplier;
-public class RestRequest implements Callable<Response> {
+public class RestRequest implements CheckedSupplier<Response> {
private static final Logger logger = LoggerFactory.getLogger(RestRequest.class);
@@ -46,7 +46,7 @@ public class RestRequest implements Callable<Response> {
}
@Override
- public Response call() throws Exception {
+ public Response get() throws Exception {
final Response response;
if ("GET".equals(method)) {
response = this.client.getBuilder().accept(this.client.getAccept()).get();
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClient.java b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
index 131bc27783..a1e0d7c102 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
@@ -25,7 +25,6 @@ import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.RestClient;
import org.onap.so.client.graphinventory.GraphInventoryClient;
-import org.onap.so.client.graphinventory.GraphInventoryVersion;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
import org.slf4j.Logger;
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 7029ffe5e4..66ea8f950e 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
@@ -24,8 +24,6 @@ import java.io.IOException;
import java.util.Optional;
import javax.annotation.Priority;
import javax.ws.rs.ext.Provider;
-import javax.annotation.Priority;
-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;
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
index d02b482008..e42a2a2383 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
@@ -70,6 +70,8 @@ public class AAIObjectPlurals implements GraphInventoryObjectPlurals, Serializab
new AAIObjectPlurals(AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces", "l-interface");
public static final AAIObjectPlurals SUB_L_INTERFACE =
new AAIObjectPlurals(AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces", "l-interface");
+ public static final AAIObjectPlurals INSTANCE_GROUP =
+ new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/instance-groups", "instance-group");
public static final AAIObjectPlurals PNF = new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/pnfs", "pnfs");
private final String uriTemplate;
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 cd4e1125ce..c2c8e933b1 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
@@ -36,9 +36,7 @@ import org.onap.aai.domain.yang.Configuration;
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.EsrSystemInfoList;
import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.ExtAaiNetwork;
import org.onap.aai.domain.yang.Flavor;
import org.onap.aai.domain.yang.GenericVnf;
@@ -74,6 +72,7 @@ import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aai.domain.yang.VpnBinding;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.aai.domain.yang.Zone;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
import org.onap.so.constants.Defaults;
import org.reflections.Reflections;
@@ -188,7 +187,7 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
"/esr-vnfm/{vnfm-id}/esr-system-info-list", "vnfm-esr-system-info-list");
public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType(
AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list");
-
+ public static final AAIObjectType ZONE = new AAIObjectType(AAINamespaceConstants.NETWORK, Zone.class);
private final String uriTemplate;
private final String parentUri;
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
index 6eafb965a2..b546aaa23e 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
@@ -23,11 +23,9 @@ package org.onap.so.client.aai;
import java.net.URI;
import java.util.Map;
import java.util.Optional;
-import javax.ws.rs.core.Response;
import org.onap.so.client.ResponseExceptionMapper;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.so.client.graphinventory.GraphInventoryRestClient;
-import org.onap.so.client.policy.CommonObjectMapperProvider;
import org.onap.so.utils.TargetEntity;
public class AAIRestClient extends GraphInventoryRestClient {
diff --git a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
index 1370bb3fa3..3f9715bdef 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
@@ -116,17 +116,23 @@ public class AAISingleTransactionClient
}
@Override
- public void put(String uri, Object body) {
+ protected void put(String uri, Object body) {
request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body));
}
@Override
- public void delete(String uri, Object body) {
- request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(body));
+ protected void delete(String uri) {
+ request.getOperations()
+ .add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(new Object()));
}
@Override
- public void patch(String uri, Object body) {
+ protected void delete(String uri, Object obj) {
+ request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(obj));
+ }
+
+ @Override
+ protected void patch(String uri, Object body) {
request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri).withBody(body));
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
index 11e458a3da..e621566e5a 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
@@ -169,18 +169,22 @@ public class AAITransactionalClient
}
@Override
- public void put(String uri, Object body) {
+ protected void put(String uri, Object body) {
currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body));
}
@Override
- public void delete(String uri, Object body) {
- currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(body));
+ protected void delete(String uri) {
+ currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(null));
+ }
+ @Override
+ protected void delete(String uri, Object obj) {
+ currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(obj));
}
@Override
- public void patch(String uri, Object body) {
+ protected void patch(String uri, Object body) {
currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body));
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java
index 0d400339f9..b2223be688 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java
@@ -21,7 +21,6 @@
package org.onap.so.client.aai;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
public class AAIUpdatorImpl implements AAIUpdator {
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 3987d7375a..96844ff1cb 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
@@ -25,7 +25,6 @@ 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 {
@@ -48,10 +47,12 @@ public class AAIValidatorImpl implements AAIValidator {
List<Pserver> pservers;
boolean isLocked = false;
pservers = client.getPhysicalServerByVnfId(vnfId);
- for (Pserver pserver : pservers) {
- if (pserver.isInMaint()) {
- isLocked = true;
- return isLocked;
+ if (pservers != null) {
+ for (Pserver pserver : pservers) {
+ if (pserver.isInMaint()) {
+ isLocked = true;
+ return isLocked;
+ }
}
}
return isLocked;
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
index 499246d7d1..91030d831a 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
@@ -25,7 +25,7 @@ import org.onap.so.client.graphinventory.GraphInventoryVersion;
public enum AAIVersion implements GraphInventoryVersion {
V13("v13"), V14("v14"), V15("v15");
- public final static AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
+ public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
private final String value;
private AAIVersion(String value) {
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
index 2e70c4925a..456f14e5ee 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
@@ -24,8 +24,9 @@ import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
public enum AAIEdgeLabel implements GraphInventoryEdgeLabel {
- BELONGS_TO("org.onap.relationships.inventory.BelongsTo"), USES(
- "org.onap.relationships.inventory.Uses"), COMPOSED_OF("org.onap.relationships.inventory.ComposedOf");
+ BELONGS_TO("org.onap.relationships.inventory.BelongsTo"),
+ USES("org.onap.relationships.inventory.Uses"),
+ COMPOSED_OF("org.onap.relationships.inventory.ComposedOf");
private final String label;
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java
index af7ccf661e..3433e36151 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java
@@ -34,15 +34,6 @@ public class CustomQuery {
private String query;
private String gremlin;
- public String getGremlin() {
- return gremlin;
- }
-
- public void setGremlin(String gremlin) {
- this.gremlin = gremlin;
- }
-
-
public CustomQuery(List<AAIResourceUri> start) {
this.setStart(start);
}
@@ -56,6 +47,14 @@ public class CustomQuery {
this.gremlin = gremlin;
}
+ public String getGremlin() {
+ return gremlin;
+ }
+
+ public void setGremlin(String gremlin) {
+ this.gremlin = gremlin;
+ }
+
public List<String> getStart() {
return start;
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java
index 16a4c178e5..45f2c965f9 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java
@@ -23,7 +23,6 @@ package org.onap.so.client.aai.entities.bulkprocess;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonInclude(JsonInclude.Include.NON_NULL)
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java
index 5d28013c85..b2d67af156 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java
@@ -23,7 +23,6 @@ package org.onap.so.client.aai.entities.singletransaction;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonInclude(JsonInclude.Include.NON_NULL)
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
index 7572541206..1fe9da984f 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
@@ -21,13 +21,12 @@
package org.onap.so.client.aai.entities.uri;
import java.net.URI;
+import java.util.regex.Pattern;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.graphinventory.Format;
-import org.onap.so.client.graphinventory.GraphInventoryObjectType;
import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
@@ -140,4 +139,9 @@ public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
public AAISimpleUri format(Format format) {
return (AAISimpleUri) super.format(format);
}
+
+ @Override
+ protected Pattern getPrefixPattern() {
+ return Pattern.compile("/aai/v\\d+");
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
index 4ca5690188..8ef08057e6 100644
--- a/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
@@ -35,11 +35,12 @@ public class DefaultDmaapPropertiesImpl implements DmaapProperties {
public DefaultDmaapPropertiesImpl() throws IOException {
File initialFile = new File("src/test/resources/dmaap.properties");
- InputStream targetStream = new FileInputStream(initialFile);
Properties properties = new Properties();
- properties.load(targetStream);
- this.properties = new HashMap<>();
- properties.forEach((key, value) -> this.properties.put((String) key, (String) value));
+ try (InputStream targetStream = new FileInputStream(initialFile)) {
+ properties.load(targetStream);
+ this.properties = new HashMap<>();
+ properties.forEach((key, value) -> this.properties.put((String) key, (String) value));
+ }
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
index 86d4aa7413..48c2d1495d 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
@@ -49,12 +49,12 @@ public abstract class DmaapClient {
this.msoProperties = dmaapProperties.getProperties();
this.properties = new Properties();
this.properties.load(resource.getInputStream());
- try {
- this.properties.put("auth", CryptoUtils.decrypt(this.getAuth(), this.getKey()).getBytes());
- } catch (GeneralSecurityException e) {
- logger.error(e.getMessage(), e);
+ if (this.getAuth() != null && this.getKey() != null) {
+ this.properties.put("auth", this.getAuth());
+ this.properties.put("key", this.getKey());
+ } else {
+ logger.error("Dmaap auth or key is null");
}
- this.properties.put("key", this.getKey());
this.properties.put("topic", this.getTopic());
Optional<String> host = this.getHost();
if (host.isPresent()) {
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
index 3dd0c751e3..4de546e9da 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
@@ -28,6 +28,7 @@ import org.onap.so.client.dmaap.exceptions.ExceededMaximumPollingTime;
import org.onap.so.client.dmaap.rest.RestConsumer;
public abstract class DmaapConsumer extends DmaapClient {
+ static final int MAX_ELAPSED_TIME = 180000;
public DmaapConsumer() throws IOException {
super("dmaap/default-consumer.properties");
@@ -125,7 +126,7 @@ public abstract class DmaapConsumer extends DmaapClient {
* time in milliseconds
*/
public int getMaximumElapsedTime() {
- return 180000;
+ return MAX_ELAPSED_TIME;
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
index 1d85dac7dc..68b4e84448 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
@@ -23,7 +23,6 @@ package org.onap.so.client.dmaap.rest;
import java.net.URL;
import java.util.Map;
import org.onap.so.client.RestClient;
-import org.onap.so.utils.CryptoUtils;
import org.onap.so.utils.TargetEntity;
public class DMaaPRestClient extends RestClient {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/Format.java b/common/src/main/java/org/onap/so/client/graphinventory/Format.java
index b422516e63..078b35aaf4 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/Format.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/Format.java
@@ -22,8 +22,15 @@ package org.onap.so.client.graphinventory;
public enum Format {
- RESOURCE("resource"), RESOURCE_AND_URL("resource_and_url"), SIMPLE("simple"), RAW("raw"), CONSOLE(
- "console"), PATHED("pathed"), GRAPHSON("graphson"), ID("id");
+ RESOURCE("resource"),
+ RESOURCE_AND_URL("resource_and_url"),
+ SIMPLE("simple"),
+ RAW("raw"),
+ CONSOLE("console"),
+ PATHED("pathed"),
+ GRAPHSON("graphson"),
+ ID("id"),
+ COUNT("count");
private final String name;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
index 72b01c268e..a4f9496d17 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
@@ -40,6 +40,7 @@ public class GraphInventoryCommonObjectMapperProvider extends CommonObjectMapper
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
mapper.enable(MapperFeature.USE_ANNOTATIONS);
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
index 2a76dab107..c7cdb2ff58 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
@@ -32,9 +32,7 @@ import org.onap.so.client.RestClient;
import org.onap.so.client.RestProperties;
import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
-import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
@@ -74,7 +72,9 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @return
*/
public boolean exists(Uri uri) {
- GraphInventoryUri forceMinimal = this.addParams(Optional.of(Depth.ZERO), true, uri);
+ GraphInventoryResourceUri forceMinimal = uri.clone();
+ forceMinimal.format(Format.COUNT);
+ forceMinimal.limit(1);
try {
RestClient giRC = client.createClient(forceMinimal);
@@ -314,18 +314,6 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
*/
public abstract SingleTransactionClient beginSingleTransaction();
- private GraphInventoryUri addParams(Optional<Depth> depth, boolean nodesOnly, GraphInventoryUri uri) {
- GraphInventoryUri clone = uri.clone();
- if (depth.isPresent()) {
- clone.depth(depth.get());
- }
- if (nodesOnly) {
- clone.nodesOnly(nodesOnly);
- }
-
- return clone;
- }
-
public <T extends RestProperties> T getRestProperties() {
return client.getRestProperties();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
index 992d1f017b..45ac1f741d 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
@@ -27,16 +27,13 @@ import java.util.Optional;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.GenericType;
import org.onap.aai.domain.yang.Relationship;
-import org.onap.so.client.aai.AAIVersion;
-import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest;
import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel>
- implements TransactionBuilder {
+public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> {
protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class);
@@ -183,7 +180,7 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri.clone())
.orElseThrow(() -> new NotFoundException(uri.build() + " does not exist in " + this.getGraphDBName()));
String resourceVersion = (String) result.get("resource-version");
- this.delete(uri.resourceVersion(resourceVersion).build().toString(), "");
+ this.delete(uri.resourceVersion(resourceVersion).build().toString());
incrementActionAmount();
return (Self) this;
}
@@ -194,6 +191,14 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
protected abstract String getGraphDBName();
+ protected abstract void put(String uri, Object body);
+
+ protected abstract void delete(String uri);
+
+ protected abstract void delete(String uri, Object obj);
+
+ protected abstract void patch(String uri, Object body);
+
/**
* @param obj - can be any object which will marshal into a valid A&AI payload
* @param uri
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
index bf33e8f8d3..e301edb0fd 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
@@ -32,9 +32,9 @@ public class DSLNodeKey implements QueryStep {
private boolean not = false;
private final StringBuilder query = new StringBuilder();
private final String keyName;
- private final List<String> values;
+ private final List<Object> values;
- public DSLNodeKey(String keyName, String... value) {
+ public DSLNodeKey(String keyName, Object... value) {
this.keyName = keyName;
this.values = Arrays.asList(value);
@@ -54,14 +54,18 @@ public class DSLNodeKey implements QueryStep {
result.append(" !");
}
result.append("('").append(keyName).append("', ");
- List<String> temp = new ArrayList<>();
- for (String item : values) {
- if (item.equals("null")) {
+ List<Object> temp = new ArrayList<>();
+ for (Object item : values) {
+ if ("null".equals(item)) {
temp.add(String.format("' %s '", item));
- } else if (item.equals("")) {
+ } else if ("".equals(item)) {
temp.add("' '");
} else {
- temp.add(String.format("'%s'", item));
+ if (item instanceof String) {
+ temp.add(String.format("'%s'", item));
+ } else {
+ temp.add(item);
+ }
}
}
result.append(Joiner.on(", ").join(temp)).append(")");
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
index ffbb86f023..540472a88d 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
@@ -20,12 +20,15 @@
package org.onap.so.client.graphinventory.entities;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.onap.so.client.aai.entities.QueryStep;
import org.onap.so.client.graphinventory.GraphInventoryObjectName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Joiner;
@@ -33,6 +36,7 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
private List<QueryStep> steps = new ArrayList<>();
private String suffix = "";
+ private static final Logger logger = LoggerFactory.getLogger(DSLQueryBuilder.class);
public DSLQueryBuilder() {
@@ -49,8 +53,25 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
}
public DSLQueryBuilder<S, E> output() {
- if (steps.get(steps.size() - 1) instanceof DSLNode) {
+ Object obj = steps.get(steps.size() - 1);
+ if (obj instanceof DSLNode) {
((DSLNode) steps.get(steps.size() - 1)).output();
+ } else if (obj.getClass().getName().contains("$$Lambda$")) {
+ // process lambda expressions
+ for (Field f : obj.getClass().getDeclaredFields()) {
+ f.setAccessible(true);
+ Object o;
+ try {
+ o = f.get(obj);
+ if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNode) {
+ ((DSLNode) ((DSLQueryBuilder) o).steps.get(0)).output();
+ }
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ logger.error("Exception occured", e);
+ }
+ f.setAccessible(false);
+ break;
+ }
}
return this;
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
index 892951f950..6703416832 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
@@ -27,10 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Predicate;
-import org.onap.so.client.aai.AAICommonObjectMapperProvider;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.client.graphinventory.GraphInventoryObjectName;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
index 2fdd6574e5..87d4d84cac 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/__.java
@@ -45,7 +45,7 @@ public class __ {
return __.<DSLNode>start(new DSLNode(name, key));
}
- public static DSLNodeKey key(String keyName, String... value) {
+ public static DSLNodeKey key(String keyName, Object... value) {
return new DSLNodeKey(keyName, value);
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
index d6d3e5eaa2..6b48ad44ef 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
@@ -22,7 +22,6 @@ package org.onap.so.client.graphinventory.entities.uri;
import java.net.URI;
import java.util.Map;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
public interface GraphInventoryUri {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
index 5d0a33909a..ffe47c5c51 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
@@ -29,6 +29,7 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.regex.Pattern;
import javax.ws.rs.core.UriBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.onap.so.client.graphinventory.Format;
@@ -44,8 +45,8 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
private static final long serialVersionUID = -337701171277616439L;
protected transient UriBuilder internalURI;
- protected final static String relationshipAPI = "/relationship-list/relationship";
- protected final static String relatedTo = "/related-to";
+ protected static final String relationshipAPI = "/relationship-list/relationship";
+ protected static final String relatedTo = "/related-to";
protected final Object[] values;
protected final GraphInventoryObjectType type;
protected final GraphInventoryObjectPlurals pluralType;
@@ -61,7 +62,7 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
protected SimpleUri(GraphInventoryObjectType type, URI uri) {
this.type = type;
this.pluralType = null;
- this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll("/aai/v\\d+", ""));
+ this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), ""));
this.values = new Object[0];
}
@@ -174,6 +175,10 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
return build(this.values);
}
+ protected Pattern getPrefixPattern() {
+ return Pattern.compile("/.*?/v\\d+");
+ }
+
protected URI build(Object... values) {
// This is a workaround because resteasy does not encode URIs correctly
final String[] encoded = new String[values.length];
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java
index 14a46c243b..71afdb83d9 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java
@@ -20,7 +20,6 @@
package org.onap.so.client.graphinventory.entities.uri.parsers;
-import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
diff --git a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
index fa155de6a2..507f1130b5 100644
--- a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
@@ -22,11 +22,9 @@ package org.onap.so.client.grm;
import java.net.URI;
-import java.util.Base64;
import java.util.Map;
import java.util.Optional;
import org.onap.so.client.RestClient;
-import org.onap.so.client.RestProperties;
import org.onap.so.utils.TargetEntity;
public class GRMRestClient extends RestClient {
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java
index 5b99fe1a05..6e7baa37e6 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java
@@ -31,7 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
public class DictionaryJson {
@JsonProperty("DictionaryDatas")
- private List<DictionaryData> dictionaryDatas = new ArrayList<DictionaryData>();
+ private List<DictionaryData> dictionaryDatas = new ArrayList<>();
@JsonProperty("DictionaryDatas")
public List<DictionaryData> getDictionaryDatas() {
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java
index b00d22dbad..eb95b75593 100644
--- a/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java
@@ -21,11 +21,18 @@
package org.onap.so.client.policy.entities;
public enum PolicyServiceType {
- GET_CONFIG("getConfig"), SEND_EVENT("sendEvent"), PUSH_POLICY("pushPolicy"), CREATE_POLICY(
- "createPolicy"), UPDATE_POLICY("updatePolicy"), GET_DECISION("getDecision"), GET_METRICS(
- "getMetrics"), DELETE_POLICY("deletePolicy"), LIST_CONFIG("listConfig"), CREATE_DICTIONARY_ITEM(
- "createDictionaryItem"), UPDATE_DICTIONARY_ITEM(
- "updateDictionaryItem"), GET_DICTIONARY_ITEMS("getDictionaryItems");
+ GET_CONFIG("getConfig"),
+ SEND_EVENT("sendEvent"),
+ PUSH_POLICY("pushPolicy"),
+ CREATE_POLICY("createPolicy"),
+ UPDATE_POLICY("updatePolicy"),
+ GET_DECISION("getDecision"),
+ GET_METRICS("getMetrics"),
+ DELETE_POLICY("deletePolicy"),
+ LIST_CONFIG("listConfig"),
+ CREATE_DICTIONARY_ITEM("createDictionaryItem"),
+ UPDATE_DICTIONARY_ITEM("updateDictionaryItem"),
+ GET_DICTIONARY_ITEMS("getDictionaryItems");
private final String name;
diff --git a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
index 4aafd145b7..8e674fb77b 100644
--- a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
@@ -28,7 +28,6 @@ import javax.ws.rs.NotFoundException;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.AAIVersion;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.dmaap.DmaapConsumer;
diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/Body.java b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java
index 84dd83ea6f..8c40b749a6 100644
--- a/common/src/main/java/org/onap/so/client/sdno/beans/Body.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java
@@ -37,8 +37,8 @@ public class Body implements Serializable {
@JsonProperty("input")
private Input input;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
- private final static long serialVersionUID = 9101706044452851559L;
+ private Map<String, Object> additionalProperties = new HashMap<>();
+ private static final long serialVersionUID = 9101706044452851559L;
@JsonProperty("input")
public Input getInput() {
diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/Input.java b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java
index ea537bba09..c8122c06f6 100644
--- a/common/src/main/java/org/onap/so/client/sdno/beans/Input.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java
@@ -40,7 +40,7 @@ public class Input implements Serializable {
private RequestHdCustom requestHdCustom;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
private final static long serialVersionUID = 7155546785389227528L;
@JsonProperty("request-healthdiagnostic")
diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
index c08d1ef386..485f64673f 100644
--- a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
@@ -49,7 +49,7 @@ public class RequestHdCustom implements Serializable {
@JsonProperty("send-detailed-cmd-response")
private String sendDetailedCmdResponse = "false";
@JsonProperty("aai-param-list")
- private List<AAIParamList> aaiParamList = new ArrayList<AAIParamList>();
+ private List<AAIParamList> aaiParamList = new ArrayList<>();
/**
* No args constructor for use in serialization
diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
index c05b470b0e..b1b75ab412 100644
--- a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
@@ -52,8 +52,8 @@ public class RequestHealthDiagnostic implements Serializable {
@JsonProperty("health-diagnostic-code")
private String healthDiagnosticCode;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
- private final static long serialVersionUID = 1166788526178388021L;
+ private Map<String, Object> additionalProperties = new HashMap<>();
+ private static final long serialVersionUID = 1166788526178388021L;
@JsonProperty("request-client-name")
public String getRequestClientName() {
diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
index 93826c752f..8b84cf6659 100644
--- a/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
@@ -44,7 +44,7 @@ public class ResultInfo {
@JsonProperty("status")
private String status;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+ private Map<String, Object> additionalProperties = new HashMap<>();
@JsonProperty("client-name")
public String getClientName() {
diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
index 09f408c967..46e2c1d1fc 100644
--- a/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
@@ -43,8 +43,8 @@ public class SDNO implements Serializable {
@JsonProperty("body")
private Body body;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
- private final static long serialVersionUID = -5303297382564282650L;
+ private Map<String, Object> additionalProperties = new HashMap<>();
+ private static final long serialVersionUID = -5303297382564282650L;
@JsonProperty("operation")
public String getOperation() {
diff --git a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
index b1adc53f3a..b85b7c3bde 100644
--- a/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
+++ b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.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.
@@ -38,7 +38,7 @@ public class SDNOHealthCheckDmaapPublisher extends DmaapPublisher {
@Override
public String getKey() {
- return msoProperties.get("sdno.health-check.dmaap.msoKey");
+ return msoProperties.get("mso.msoKey");
}
@Override
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
index 6d81cba41d..ccfd2f4de6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeleteTasks.java
+++ b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
@@ -18,11 +18,8 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.sdnc.tasks;
-
-import org.springframework.stereotype.Component;
-
-@Component
-public class SDNCDeleteTasks {
+package org.onap.so.constants;
+public enum OrchestrationRequestFormat {
+ DETAIL, STATUSDETAIL
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java b/common/src/main/java/org/onap/so/constants/Status.java
index b791bf147b..b460418f0f 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Status.java
+++ b/common/src/main/java/org/onap/so/constants/Status.java
@@ -18,12 +18,23 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.apihandlerinfra;
+package org.onap.so.constants;
/*
* Enum for Status values returned by API Handler to Tail-F
*/
public enum Status {
- PENDING, IN_PROGRESS, COMPLETE, COMPLETED, FAILED, TIMEOUT, UNLOCKED, PENDING_MANUAL_TASK
+ PENDING,
+ IN_PROGRESS,
+ COMPLETE,
+ COMPLETED,
+ FAILED,
+ TIMEOUT,
+ UNLOCKED,
+ PENDING_MANUAL_TASK,
+ ABORTED,
+ ROLLED_BACK,
+ ROLLED_BACK_TO_ASSIGNED,
+ ROLLED_BACK_TO_CREATED
}
diff --git a/common/src/main/java/org/onap/so/db/connections/DbDnsIpAddress.java b/common/src/main/java/org/onap/so/db/connections/DbDnsIpAddress.java
new file mode 100644
index 0000000000..8ee63a487b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/db/connections/DbDnsIpAddress.java
@@ -0,0 +1,20 @@
+package org.onap.so.db.connections;
+
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Component
+@Scope("singleton")
+public class DbDnsIpAddress {
+
+ private String ipAddress;
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java b/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java
new file mode 100644
index 0000000000..14f2f5e9b7
--- /dev/null
+++ b/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java
@@ -0,0 +1,78 @@
+package org.onap.so.db.connections;
+
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Set;
+import javax.management.JMX;
+import javax.management.MBeanServer;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import com.zaxxer.hikari.HikariPoolMXBean;
+
+@Component
+@Profile("!test")
+public class ScheduledDnsLookup {
+
+ private static final String JMX_HIKARI_DB_POOL_LOOKUP = "com.zaxxer.hikari:type=Pool (*,*";
+
+ private static final String DB_HOST = "DB_HOST";
+
+ @Autowired
+ private DbDnsIpAddress dnsIpAddress;
+
+ private static Logger logger = LoggerFactory.getLogger(ScheduledDnsLookup.class);
+
+ @Scheduled(fixedRate = 15000)
+ public void performDnsLookup() {
+
+ String dnsUrl = System.getenv(DB_HOST);
+
+ try {
+ if (dnsUrl == null) {
+ logger.error("Database DNS is not provided. Please verify the configuration");
+ return;
+ }
+
+ InetAddress inetAddress = java.net.InetAddress.getByName(dnsUrl);
+ String ipAddress = inetAddress.getHostAddress();
+ String currentIpAddress = dnsIpAddress.getIpAddress();
+ /* This is in initial state */
+ if (currentIpAddress == null) {
+ dnsIpAddress.setIpAddress(ipAddress);
+ return;
+ }
+
+ if ((ipAddress != null) && (!ipAddress.equalsIgnoreCase(currentIpAddress))) {
+ logger.debug("Switched Database IP Address from {} to {}", currentIpAddress, ipAddress);
+ softEvictConnectionPool();
+ dnsIpAddress.setIpAddress(ipAddress);
+ }
+ } catch (UnknownHostException e) {
+ logger.warn("Database DNS %s is not resolvable to an IP Address", dnsUrl);
+ }
+
+ }
+
+ private void softEvictConnectionPool() {
+ try {
+ MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
+ ObjectName queryObj = new ObjectName(JMX_HIKARI_DB_POOL_LOOKUP);
+ Set<ObjectInstance> objects = mBeanServer.queryMBeans(queryObj, null);
+ for (ObjectInstance objectInstance : objects) {
+ ObjectName poolObject = objectInstance.getObjectName();
+ HikariPoolMXBean poolProxy = JMX.newMXBeanProxy(mBeanServer, poolObject, HikariPoolMXBean.class);
+ logger.debug("database connection pool is soft evicted for connections");
+ poolProxy.softEvictConnections();
+ }
+ } catch (Exception e) {
+ logger.warn("Error encountered in evicting DB connection pool", e);
+ }
+ }
+}
diff --git a/common/src/main/java/org/onap/so/listener/ListenerRunner.java b/common/src/main/java/org/onap/so/listener/ListenerRunner.java
new file mode 100644
index 0000000000..a489be6070
--- /dev/null
+++ b/common/src/main/java/org/onap/so/listener/ListenerRunner.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.listener;
+
+import java.lang.annotation.Annotation;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import javax.annotation.Priority;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+
+public abstract class ListenerRunner {
+
+ @Autowired
+ protected ApplicationContext context;
+
+ public <T> List<T> filterListeners(List<T> validators, Predicate<T> predicate) {
+ return validators.stream().filter(item -> {
+ return !item.getClass().isAnnotationPresent(Skip.class) && predicate.test(item);
+ }).sorted(Comparator.comparing(item -> {
+ Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() {
+ public int value() {
+ return 1000;
+ }
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return Priority.class;
+ }
+ });
+ return p.value();
+ })).collect(Collectors.toList());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java b/common/src/main/java/org/onap/so/listener/Skip.java
index fe03a10795..aa3ec2a204 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/Skip.java
+++ b/common/src/main/java/org/onap/so/listener/Skip.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.validation;
+package org.onap.so.listener;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
diff --git a/common/src/main/java/org/onap/so/logger/ErrorCode.java b/common/src/main/java/org/onap/so/logger/ErrorCode.java
index 2d6fb791d5..7fb9522b7c 100644
--- a/common/src/main/java/org/onap/so/logger/ErrorCode.java
+++ b/common/src/main/java/org/onap/so/logger/ErrorCode.java
@@ -1,8 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.logger;
public enum ErrorCode {
- PermissionError(100), AvailabilityError(200), DataError(300), SchemaError(400), BusinessProcesssError(
- 500), UnknownError(900);
+ PermissionError(100),
+ AvailabilityError(200),
+ DataError(300),
+ SchemaError(400),
+ BusinessProcesssError(500),
+ UnknownError(900);
private int 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
index f34b4b5a9a..83b860ff01 100644
--- a/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
+++ b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.logger;
public class HttpHeadersConstants {
diff --git a/common/src/main/java/org/onap/so/logger/LoggingAnchor.java b/common/src/main/java/org/onap/so/logger/LoggingAnchor.java
new file mode 100644
index 0000000000..119ae4c43c
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logger/LoggingAnchor.java
@@ -0,0 +1,29 @@
+package org.onap.so.logger;
+
+import java.util.Collections;
+import java.util.stream.Collectors;
+
+public class LoggingAnchor {
+ public static final String ONE = Collections.nCopies(1, "{}").stream().collect(Collectors.joining(" "));
+
+ public static final String TWO = Collections.nCopies(2, "{}").stream().collect(Collectors.joining(" "));
+
+ public static final String THREE = Collections.nCopies(3, "{}").stream().collect(Collectors.joining(" "));
+
+ public static final String FOUR = Collections.nCopies(4, "{}").stream().collect(Collectors.joining(" "));
+
+ public static final String FIVE = Collections.nCopies(5, "{}").stream().collect(Collectors.joining(" "));
+
+ public static final String SIX = Collections.nCopies(6, "{}").stream().collect(Collectors.joining(" "));
+
+ public static final String SEVEN = Collections.nCopies(7, "{}").stream().collect(Collectors.joining(" "));
+
+ public static final String EIGHT = Collections.nCopies(8, "{}").stream().collect(Collectors.joining(" "));
+
+ public static final String NINE = Collections.nCopies(9, "{}").stream().collect(Collectors.joining(" "));
+
+ public static final String TEN = Collections.nCopies(10, "{}").stream().collect(Collectors.joining(" "));
+
+ private LoggingAnchor() {}
+
+}
diff --git a/common/src/main/java/org/onap/so/logger/MdcConstants.java b/common/src/main/java/org/onap/so/logger/MdcConstants.java
index 9f8417e047..33fceb2f0f 100644
--- a/common/src/main/java/org/onap/so/logger/MdcConstants.java
+++ b/common/src/main/java/org/onap/so/logger/MdcConstants.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.logger;
public class MdcConstants {
@@ -10,4 +30,5 @@ public class MdcConstants {
public static final String SERVICE_NAME = "ServiceName";
public static final String STATUSCODE = "StatusCode";
public static final String ENDTIME = "EndTimestamp";
+ public static final String ORIGINAL_PARTNER_NAME = "OriginalPartnerName";
}
diff --git a/common/src/main/java/org/onap/so/logger/MessageEnum.java b/common/src/main/java/org/onap/so/logger/MessageEnum.java
index e92d50a685..bcf699beaf 100644
--- a/common/src/main/java/org/onap/so/logger/MessageEnum.java
+++ b/common/src/main/java/org/onap/so/logger/MessageEnum.java
@@ -24,13 +24,200 @@ package org.onap.so.logger;
public enum MessageEnum {
// Api Handler Messages
- APIH_REQUEST_NULL, APIH_QUERY_FOUND, APIH_QUERY_NOT_FOUND, APIH_QUERY_PARAM_WRONG, APIH_DB_ACCESS_EXC, APIH_DB_ACCESS_EXC_REASON, APIH_VALIDATION_ERROR, APIH_REQUEST_VALIDATION_ERROR, APIH_SERVICE_VALIDATION_ERROR, APIH_GENERAL_EXCEPTION_ARG, APIH_GENERAL_EXCEPTION, APIH_GENERAL_WARNING, APIH_AUDIT_EXEC, APIH_GENERAL_METRICS, APIH_DUPLICATE_CHECK_EXC, APIH_DUPLICATE_FOUND, APIH_BAD_ORDER, APIH_DB_ATTRIBUTE_NOT_FOUND, APIH_BPEL_COMMUNICATE_ERROR, APIH_BPEL_RESPONSE_ERROR, APIH_WARP_REQUEST, APIH_ERROR_FROM_BPEL_SERVER, APIH_DB_INSERT_EXC, APIH_DB_UPDATE_EXC, APIH_NO_PROPERTIES, APIH_PROPERTY_LOAD_SUC, APIH_LOAD_PROPERTIES_FAIL, APIH_SDNC_COMMUNICATE_ERROR, APIH_SDNC_RESPONSE_ERROR, APIH_CANNOT_READ_SCHEMA, APIH_HEALTH_CHECK_EXCEPTION, APIH_REQUEST_VALIDATION_ERROR_REASON, APIH_JAXB_MARSH_ERROR, APIH_JAXB_UNMARSH_ERROR, APIH_VNFREQUEST_VALIDATION_ERROR, APIH_DOM2STR_ERROR, APIH_READ_VNFOUTPUT_CLOB_EXCEPTION, APIH_DUPLICATE_CHECK_EXC_ATT, APIH_GENERATED_REQUEST_ID, APIH_GENERATED_SERVICE_INSTANCE_ID, APIH_REPLACE_REQUEST_ID,
+ APIH_REQUEST_NULL,
+ APIH_QUERY_FOUND,
+ APIH_QUERY_NOT_FOUND,
+ APIH_QUERY_PARAM_WRONG,
+ APIH_DB_ACCESS_EXC,
+ APIH_DB_ACCESS_EXC_REASON,
+ APIH_VALIDATION_ERROR,
+ APIH_REQUEST_VALIDATION_ERROR,
+ APIH_SERVICE_VALIDATION_ERROR,
+ APIH_GENERAL_EXCEPTION_ARG,
+ APIH_GENERAL_EXCEPTION,
+ APIH_GENERAL_WARNING,
+ APIH_AUDIT_EXEC,
+ APIH_GENERAL_METRICS,
+ APIH_DUPLICATE_CHECK_EXC,
+ APIH_DUPLICATE_FOUND,
+ APIH_BAD_ORDER,
+ APIH_DB_ATTRIBUTE_NOT_FOUND,
+ APIH_BPEL_COMMUNICATE_ERROR,
+ APIH_BPEL_RESPONSE_ERROR,
+ APIH_WARP_REQUEST,
+ APIH_ERROR_FROM_BPEL_SERVER,
+ APIH_DB_INSERT_EXC,
+ APIH_DB_UPDATE_EXC,
+ APIH_NO_PROPERTIES,
+ APIH_PROPERTY_LOAD_SUC,
+ APIH_LOAD_PROPERTIES_FAIL,
+ APIH_SDNC_COMMUNICATE_ERROR,
+ APIH_SDNC_RESPONSE_ERROR,
+ APIH_CANNOT_READ_SCHEMA,
+ APIH_HEALTH_CHECK_EXCEPTION,
+ APIH_REQUEST_VALIDATION_ERROR_REASON,
+ APIH_JAXB_MARSH_ERROR,
+ APIH_JAXB_UNMARSH_ERROR,
+ APIH_VNFREQUEST_VALIDATION_ERROR,
+ APIH_DOM2STR_ERROR,
+ APIH_READ_VNFOUTPUT_CLOB_EXCEPTION,
+ APIH_DUPLICATE_CHECK_EXC_ATT,
+ APIH_GENERATED_REQUEST_ID,
+ APIH_GENERATED_SERVICE_INSTANCE_ID,
+ APIH_REPLACE_REQUEST_ID,
// Resource Adapter Messages
- RA_GENERAL_EXCEPTION_ARG, RA_GENERAL_EXCEPTION, RA_GENERAL_WARNING, RA_MISSING_PARAM, RA_AUDIT_EXEC, RA_GENERAL_METRICS, RA_CREATE_STACK_TIMEOUT, RA_DELETE_STACK_TIMEOUT, RA_UPDATE_STACK_TIMEOUT, RA_CONNECTION_EXCEPTION, RA_PARSING_ERROR, RA_PROPERTIES_NOT_FOUND, RA_LOAD_PROPERTIES_SUC, RA_NETWORK_ALREADY_EXIST, RA_UPDATE_NETWORK_ERR, RA_CREATE_STACK_ERR, RA_UPDATE_STACK_ERR, RA_CREATE_TENANT_ERR, RA_NETWORK_NOT_FOUND, RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, RA_CREATE_NETWORK_EXC, RA_NS_EXC, RA_PARAM_NOT_FOUND, RA_CONFIG_EXC, RA_UNKOWN_PARAM, RA_VLAN_PARSE, RA_DELETE_NETWORK_EXC, RA_ROLLBACK_NULL, RA_TENANT_NOT_FOUND, RA_QUERY_NETWORK_EXC, RA_CREATE_NETWORK_NOTIF_EXC, RA_ASYNC_ROLLBACK, RA_WSDL_NOT_FOUND, RA_WSDL_URL_CONVENTION_EXC, RA_INIT_NOTIF_EXC, RA_SET_CALLBACK_AUTH_EXC, RA_FAULT_INFO_EXC, RA_MARSHING_ERROR, RA_PARSING_REQUEST_ERROR, RA_SEND_REQUEST_SDNC, RA_RESPONSE_FROM_SDNC, RA_EXCEPTION_COMMUNICATE_SDNC, RA_EVALUATE_XPATH_ERROR, RA_ANALYZE_ERROR_EXC, RA_ERROR_GET_RESPONSE_SDNC, RA_CALLBACK_BPEL, RA_INIT_CALLBACK_WSDL_ERR, RA_CALLBACK_BPEL_EXC, RA_CALLBACK_BPEL_COMPLETE, RA_SDNC_MISS_CONFIG_PARAM, RA_SDNC_INVALID_CONFIG, RA_PRINT_URL, RA_ERROR_CREATE_SDNC_REQUEST, RA_ERROR_CREATE_SDNC_RESPONSE, RA_ERROR_CONVERT_XML2STR, RA_RECEIVE_SDNC_NOTIF, RA_INIT_SDNC_ADAPTER, RA_SEND_REQUEST_APPC_ERR, RA_SEND_REQUEST_SDNC_ERR, RA_RECEIVE_BPEL_REQUEST, RA_TENANT_ALREADY_EXIST, RA_UPDATE_TENANT_ERR, RA_DELETE_TEMAMT_ERR, RA_ROLLBACK_TENANT_ERR, RA_QUERY_VNF_ERR, RA_VNF_ALREADY_EXIST, RA_VNF_UNKNOWN_PARAM, RA_VNF_EXTRA_PARAM, RA_CREATE_VNF_ERR, RA_VNF_NOT_EXIST, RA_UPDATE_VNF_ERR, RA_DELETE_VNF_ERR, RA_ASYNC_CREATE_VNF, RA_SEND_VNF_NOTIF_ERR, RA_ASYNC_CREATE_VNF_COMPLETE, RA_ASYNC_UPDATE_VNF, RA_ASYNC_UPDATE_VNF_COMPLETE, RA_ASYNC_QUERY_VNF, RA_ASYNC_QUERY_VNF_COMPLETE, RA_ASYNC_DELETE_VNF, RA_ASYNC_DELETE_VNF_COMPLETE, RA_ASYNC_ROLLBACK_VNF, RA_ASYNC_ROLLBACK_VNF_COMPLETE, RA_ROLLBACK_VNF_ERR, RA_DB_INVALID_STATUS, RA_CANT_UPDATE_REQUEST, RA_DB_REQUEST_NOT_EXIST, RA_CONFIG_NOT_FOUND, RA_CONFIG_LOAD, RA_RECEIVE_WORKFLOW_MESSAGE,
+ RA_GENERAL_EXCEPTION_ARG,
+ RA_GENERAL_EXCEPTION,
+ RA_GENERAL_WARNING,
+ RA_MISSING_PARAM,
+ RA_AUDIT_EXEC,
+ RA_GENERAL_METRICS,
+ RA_CREATE_STACK_TIMEOUT,
+ RA_DELETE_STACK_TIMEOUT,
+ RA_UPDATE_STACK_TIMEOUT,
+ RA_CONNECTION_EXCEPTION,
+ RA_PARSING_ERROR,
+ RA_PROPERTIES_NOT_FOUND,
+ RA_LOAD_PROPERTIES_SUC,
+ RA_NETWORK_ALREADY_EXIST,
+ RA_UPDATE_NETWORK_ERR,
+ RA_CREATE_STACK_ERR,
+ RA_UPDATE_STACK_ERR,
+ RA_CREATE_TENANT_ERR,
+ RA_NETWORK_NOT_FOUND,
+ RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
+ RA_CREATE_NETWORK_EXC,
+ RA_NS_EXC,
+ RA_PARAM_NOT_FOUND,
+ RA_CONFIG_EXC,
+ RA_UNKOWN_PARAM,
+ RA_VLAN_PARSE,
+ RA_DELETE_NETWORK_EXC,
+ RA_ROLLBACK_NULL,
+ RA_TENANT_NOT_FOUND,
+ RA_QUERY_NETWORK_EXC,
+ RA_CREATE_NETWORK_NOTIF_EXC,
+ RA_ASYNC_ROLLBACK,
+ RA_WSDL_NOT_FOUND,
+ RA_WSDL_URL_CONVENTION_EXC,
+ RA_INIT_NOTIF_EXC,
+ RA_SET_CALLBACK_AUTH_EXC,
+ RA_FAULT_INFO_EXC,
+ RA_MARSHING_ERROR,
+ RA_PARSING_REQUEST_ERROR,
+ RA_SEND_REQUEST_SDNC,
+ RA_RESPONSE_FROM_SDNC,
+ RA_EXCEPTION_COMMUNICATE_SDNC,
+ RA_EVALUATE_XPATH_ERROR,
+ RA_ANALYZE_ERROR_EXC,
+ RA_ERROR_GET_RESPONSE_SDNC,
+ RA_CALLBACK_BPEL,
+ RA_INIT_CALLBACK_WSDL_ERR,
+ RA_CALLBACK_BPEL_EXC,
+ RA_CALLBACK_BPEL_COMPLETE,
+ RA_SDNC_MISS_CONFIG_PARAM,
+ RA_SDNC_INVALID_CONFIG,
+ RA_PRINT_URL,
+ RA_ERROR_CREATE_SDNC_REQUEST,
+ RA_ERROR_CREATE_SDNC_RESPONSE,
+ RA_ERROR_CONVERT_XML2STR,
+ RA_RECEIVE_SDNC_NOTIF,
+ RA_INIT_SDNC_ADAPTER,
+ RA_SEND_REQUEST_APPC_ERR,
+ RA_SEND_REQUEST_SDNC_ERR,
+ RA_RECEIVE_BPEL_REQUEST,
+ RA_TENANT_ALREADY_EXIST,
+ RA_UPDATE_TENANT_ERR,
+ RA_DELETE_TEMAMT_ERR,
+ RA_ROLLBACK_TENANT_ERR,
+ RA_QUERY_VNF_ERR,
+ RA_VNF_ALREADY_EXIST,
+ RA_VNF_UNKNOWN_PARAM,
+ RA_VNF_EXTRA_PARAM,
+ RA_CREATE_VNF_ERR,
+ RA_VNF_NOT_EXIST,
+ RA_UPDATE_VNF_ERR,
+ RA_DELETE_VNF_ERR,
+ RA_ASYNC_CREATE_VNF,
+ RA_SEND_VNF_NOTIF_ERR,
+ RA_ASYNC_CREATE_VNF_COMPLETE,
+ RA_ASYNC_UPDATE_VNF,
+ RA_ASYNC_UPDATE_VNF_COMPLETE,
+ RA_ASYNC_QUERY_VNF,
+ RA_ASYNC_QUERY_VNF_COMPLETE,
+ RA_ASYNC_DELETE_VNF,
+ RA_ASYNC_DELETE_VNF_COMPLETE,
+ RA_ASYNC_ROLLBACK_VNF,
+ RA_ASYNC_ROLLBACK_VNF_COMPLETE,
+ RA_ROLLBACK_VNF_ERR,
+ RA_DB_INVALID_STATUS,
+ RA_CANT_UPDATE_REQUEST,
+ RA_DB_REQUEST_NOT_EXIST,
+ RA_CONFIG_NOT_FOUND,
+ RA_CONFIG_LOAD,
+ RA_RECEIVE_WORKFLOW_MESSAGE,
// BPEL engine Messages
- BPMN_GENERAL_INFO, BPMN_GENERAL_EXCEPTION_ARG, BPMN_GENERAL_EXCEPTION, BPMN_GENERAL_WARNING, BPMN_AUDIT_EXEC, BPMN_GENERAL_METRICS, BPMN_URN_MAPPING_FAIL, BPMN_VARIABLE_NULL, BPMN_CALLBACK_EXCEPTION,
+ BPMN_GENERAL_INFO,
+ BPMN_GENERAL_EXCEPTION_ARG,
+ BPMN_GENERAL_EXCEPTION,
+ BPMN_GENERAL_WARNING,
+ BPMN_AUDIT_EXEC,
+ BPMN_GENERAL_METRICS,
+ BPMN_URN_MAPPING_FAIL,
+ BPMN_VARIABLE_NULL,
+ BPMN_CALLBACK_EXCEPTION,
// ASDC Messages
- ASDC_GENERAL_EXCEPTION_ARG, ASDC_GENERAL_EXCEPTION, ASDC_GENERAL_WARNING, ASDC_GENERAL_INFO, ASDC_AUDIT_EXEC, ASDC_GENERAL_METRICS, ASDC_CREATE_SERVICE, ASDC_ARTIFACT_ALREADY_DEPLOYED, ASDC_CREATE_ARTIFACT, ASDC_ARTIFACT_INSTALL_EXC, ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL, ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, ASDC_ARTIFACT_CHECK_EXC, ASDC_INIT_ASDC_CLIENT_EXC, ASDC_INIT_ASDC_CLIENT_SUC, ASDC_LOAD_ASDC_CLIENT_EXC, ASDC_SINGLETON_CHECKT_EXC, ASDC_SHUTDOWN_ASDC_CLIENT_EXC, ASDC_CHECK_HEAT_TEMPLATE, ASDC_START_INSTALL_ARTIFACT, ASDC_ARTIFACT_TYPE_NOT_SUPPORT, ASDC_ARTIFACT_ALREADY_EXIST, ASDC_ARTIFACT_DOWNLOAD_SUC, ASDC_ARTIFACT_DOWNLOAD_FAIL, ASDC_START_DEPLOY_ARTIFACT, ASDC_SEND_NOTIF_ASDC, ASDC_SEND_NOTIF_ASDC_EXEC, ASDC_RECEIVE_CALLBACK_NOTIF, ASDC_RECEIVE_SERVICE_NOTIF, ASDC_ARTIFACT_NULL, ASDC_SERVICE_NOT_SUPPORT, ASDC_ARTIFACT_DEPLOY_SUC, ASDC_PROPERTIES_NOT_FOUND, ASDC_PROPERTIES_LOAD_SUCCESS,
+ ASDC_GENERAL_EXCEPTION_ARG,
+ ASDC_GENERAL_EXCEPTION,
+ ASDC_GENERAL_WARNING,
+ ASDC_GENERAL_INFO,
+ ASDC_AUDIT_EXEC,
+ ASDC_GENERAL_METRICS,
+ ASDC_CREATE_SERVICE,
+ ASDC_ARTIFACT_ALREADY_DEPLOYED,
+ ASDC_CREATE_ARTIFACT,
+ ASDC_ARTIFACT_INSTALL_EXC,
+ ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL,
+ ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
+ ASDC_ARTIFACT_CHECK_EXC,
+ ASDC_INIT_ASDC_CLIENT_EXC,
+ ASDC_INIT_ASDC_CLIENT_SUC,
+ ASDC_LOAD_ASDC_CLIENT_EXC,
+ ASDC_SINGLETON_CHECKT_EXC,
+ ASDC_SHUTDOWN_ASDC_CLIENT_EXC,
+ ASDC_CHECK_HEAT_TEMPLATE,
+ ASDC_START_INSTALL_ARTIFACT,
+ ASDC_ARTIFACT_TYPE_NOT_SUPPORT,
+ ASDC_ARTIFACT_ALREADY_EXIST,
+ ASDC_ARTIFACT_DOWNLOAD_SUC,
+ ASDC_ARTIFACT_DOWNLOAD_FAIL,
+ ASDC_START_DEPLOY_ARTIFACT,
+ ASDC_SEND_NOTIF_ASDC,
+ ASDC_SEND_NOTIF_ASDC_EXEC,
+ ASDC_RECEIVE_CALLBACK_NOTIF,
+ ASDC_RECEIVE_SERVICE_NOTIF,
+ ASDC_ARTIFACT_NULL,
+ ASDC_SERVICE_NOT_SUPPORT,
+ ASDC_ARTIFACT_DEPLOY_SUC,
+ ASDC_PROPERTIES_NOT_FOUND,
+ ASDC_PROPERTIES_LOAD_SUCCESS,
// Default Messages, in case Log catalog is not defined
- GENERAL_EXCEPTION_ARG, GENERAL_EXCEPTION, GENERAL_WARNING, AUDIT_EXEC, GENERAL_METRICS, LOGGER_SETUP, LOGGER_NOT_FOUND, LOGGER_UPDATE_SUC, LOGGER_UPDATE_DEBUG, LOGGER_UPDATE_DEBUG_SUC, LOAD_PROPERTIES_SUC, NO_PROPERTIES, MADATORY_PARAM_MISSING, LOAD_PROPERTIES_FAIL, INIT_LOGGER, INIT_LOGGER_FAIL, JAXB_EXCEPTION, IDENTITY_SERVICE_NOT_FOUND;
+ GENERAL_EXCEPTION_ARG,
+ GENERAL_EXCEPTION,
+ GENERAL_WARNING,
+ AUDIT_EXEC,
+ GENERAL_METRICS,
+ LOGGER_SETUP,
+ LOGGER_NOT_FOUND,
+ LOGGER_UPDATE_SUC,
+ LOGGER_UPDATE_DEBUG,
+ LOGGER_UPDATE_DEBUG_SUC,
+ LOAD_PROPERTIES_SUC,
+ NO_PROPERTIES,
+ MADATORY_PARAM_MISSING,
+ LOAD_PROPERTIES_FAIL,
+ INIT_LOGGER,
+ INIT_LOGGER_FAIL,
+ JAXB_EXCEPTION,
+ IDENTITY_SERVICE_NOT_FOUND;
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
index 975f6bb9d8..5dbf88d346 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
@@ -21,34 +21,24 @@
package org.onap.so.logging.jaxrs.filter;
-import org.apache.commons.io.IOUtils;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
-import org.slf4j.MarkerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Priority;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
import javax.ws.rs.client.ClientResponseContext;
import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Providers;
-import java.io.*;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.Map;
import java.util.UUID;
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
index 635d95be2e..7e2b603ba6 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
@@ -20,7 +20,6 @@
package org.onap.so.logging.jaxrs.filter;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.annotation.Annotation;
@@ -40,13 +39,14 @@ import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.Providers;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.logger.LogConstants;
+import org.onap.so.logger.MdcConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.databind.ObjectMapper;
@Priority(1)
@Provider
@@ -77,8 +77,10 @@ public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResp
mdcSetup.setClientIPAddress(httpServletRequest);
mdcSetup.setInstanceUUID();
mdcSetup.setEntryTimeStamp();
+ MDC.put(HttpHeadersConstants.REQUESTOR_ID, headers.getFirst("X-RequestorID"));
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
MDC.put(LogConstants.URI_BASE, containerRequest.getUriInfo().getBaseUri().toString());
+ MDC.put(MdcConstants.ORIGINAL_PARTNER_NAME, MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
} catch (Exception e) {
logger.warn("Error in incoming JAX-RS Inteceptor", e);
@@ -128,7 +130,6 @@ public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResp
return message;
}
-
private void setRequestId(MultivaluedMap<String, String> headers) {
String requestId = headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID);
if (requestId == null || requestId.isEmpty())
@@ -169,6 +170,4 @@ public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResp
MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
}
-
-
}
diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
index 8e7a95b581..fa5a5d5da4 100644
--- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
+++ b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
@@ -30,7 +30,6 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Providers;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.logger.LogConstants;
import org.onap.so.logging.jaxrs.filter.MDCSetup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAudit.java
index 0a186ccb82..d45cc00b85 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java
+++ b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAudit.java
@@ -1,4 +1,24 @@
-package org.onap.so.adapters.audit;
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.objects.audit;
import java.io.Serializable;
import java.net.URI;
@@ -7,7 +27,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
public class AAIObjectAudit implements Serializable {
/**
- *
+ *
*/
private static final long serialVersionUID = -4560928512855386021L;
private boolean doesObjectExist = false;
@@ -52,4 +72,5 @@ public class AAIObjectAudit implements Serializable {
public void setResourceURI(URI resourceURI) {
this.resourceURI = resourceURI;
}
+
}
diff --git a/common/src/main/java/org/onap/so/objects/audit/AAIObjectAuditList.java b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAuditList.java
new file mode 100644
index 0000000000..2a4b90eef7
--- /dev/null
+++ b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAuditList.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.objects.audit;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+public class AAIObjectAuditList implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6712662349909726930L;
+ private List<AAIObjectAudit> auditList = new ArrayList<>();
+ private String auditType;
+ private String heatStackName;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("auditList", auditList).toString();
+ }
+
+ public List<AAIObjectAudit> getAuditList() {
+ return auditList;
+ }
+
+
+ public String getAuditType() {
+ return auditType;
+ }
+
+
+ public void setAuditType(String auditType) {
+ this.auditType = auditType;
+ }
+
+ public String getHeatStackName() {
+ return heatStackName;
+ }
+
+ public void setHeatStackName(String heatStackName) {
+ this.heatStackName = heatStackName;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
index e63e226457..6e2bc97ee9 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
@@ -73,9 +73,9 @@ public class EqualsAndHashCodeTester implements Tester {
boolean hasEquals = false;
boolean hasHashcode = false;
for (Method method : methods) {
- if (method.getName().equals("equals")) {
+ if ("equals".equals(method.getName())) {
hasEquals = true;
- } else if (method.getName().equals("hashCode")) {
+ } else if ("hashCode".equals(method.getName())) {
hasHashcode = true;
}
}
@@ -114,7 +114,7 @@ public class EqualsAndHashCodeTester implements Tester {
Affirm.affirmTrue("HashCode test failed for [" + classInstanceOne.getClass().getName() + "]",
classInstanceOne.hashCode() == classInstanceTwo.hashCode());
- Affirm.affirmFalse("Expected false for comparison of two unlike objects", classInstanceOne.equals("test"));
+ Affirm.affirmFalse("Expected false for comparison of two unlike objects", "test".equals(classInstanceOne));
}
}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
index fc9bb388f4..42dda850f5 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
@@ -22,7 +22,6 @@ package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anything;
import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
@@ -65,6 +64,6 @@ public class HasAnnotationMatcher<T extends PojoField> extends TypeSafeDiagnosin
public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType,
final Matcher<? super T> annotationMatcher) {
- return new HasAnnotationMatcher<T>(annotationType, annotationMatcher);
+ return new HasAnnotationMatcher<>(annotationType, annotationMatcher);
}
}
diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
index 8a47299c73..a55113b0d0 100644
--- a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
@@ -78,6 +78,6 @@ public class HasAnnotationPropertyWithValueMatcher<T extends PojoField> extends
public static <T extends PojoField> Matcher<T> hasAnnotationPropertyWithValue(Class<? extends Annotation> clazz,
String attribute, final Matcher<?> annotationMatcher) {
- return new HasAnnotationPropertyWithValueMatcher<T>(clazz, attribute, annotationMatcher);
+ return new HasAnnotationPropertyWithValueMatcher<>(clazz, attribute, annotationMatcher);
}
}
diff --git a/common/src/main/java/org/onap/so/rest/exceptions/ExhaustedRetriesException.java b/common/src/main/java/org/onap/so/rest/exceptions/ExhaustedRetriesException.java
new file mode 100644
index 0000000000..6c91516b84
--- /dev/null
+++ b/common/src/main/java/org/onap/so/rest/exceptions/ExhaustedRetriesException.java
@@ -0,0 +1,19 @@
+package org.onap.so.rest.exceptions;
+
+public class ExhaustedRetriesException extends RuntimeException {
+
+ private static final long serialVersionUID = -8303091412739222943L;
+
+ public ExhaustedRetriesException(String s) {
+ super(s);
+ }
+
+ public ExhaustedRetriesException(Throwable t) {
+ super(t);
+ }
+
+ public ExhaustedRetriesException(String s, Throwable t) {
+ super(s, t);
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudRequestData.java b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudRequestData.java
new file mode 100644
index 0000000000..abaef26562
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudRequestData.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.serviceinstancebeans;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class CloudRequestData {
+
+ Object cloudRequest;
+ String cloudIdentifier;
+
+ public CloudRequestData() {}
+
+ public CloudRequestData(Object cloudRequest, String cloudIdentifier) {
+ this.cloudRequest = cloudRequest;
+ this.cloudIdentifier = cloudIdentifier;
+ }
+
+ public Object getCloudRequest() {
+ return cloudRequest;
+ }
+
+ public void setCloudRequest(Object cloudRequest) {
+ this.cloudRequest = cloudRequest;
+ }
+
+ public String getCloudIdentifier() {
+ return cloudIdentifier;
+ }
+
+ public void setCloudIdentifier(String cloudIdentifier) {
+ this.cloudIdentifier = cloudIdentifier;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("cloudRequest", cloudRequest).append("cloudIdentifier", cloudIdentifier)
+ .toString();
+ }
+}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
index 53ce3884e9..7c1df67903 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
@@ -23,7 +23,6 @@ package org.onap.so.serviceinstancebeans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
@JsonInclude(Include.NON_DEFAULT)
public class GetOrchestrationResponse {
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
index 9a184b0a51..6b9b39e5a9 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
@@ -20,9 +20,76 @@
package org.onap.so.serviceinstancebeans;
+import java.lang.reflect.InvocationTargetException;
+import com.google.common.base.CaseFormat;
+
/*
* Enum for Model Type values returned by API Handler to BPMN
*/
public enum ModelType {
- service, vnf, vfModule, volumeGroup, network, configuration, connectionPoint, pnf, networkInstanceGroup, instanceGroup
+ service("serviceInstance"),
+ vnf("vnf"),
+ vfModule("vfModule"),
+ volumeGroup("volumeGroup"),
+ network("network"),
+ configuration("configuration"),
+ connectionPoint("connectionPoint"),
+ pnf("pnf"),
+ networkInstanceGroup("networkInstanceGroup"),
+ instanceGroup("instanceGroup"),
+ vpnBinding("vpnBinding");
+
+ final String name;
+
+ private ModelType(String name) {
+ this.name = name;
+ }
+
+
+ public <T> T getId(Object obj) {
+ return this.get(obj, "Id");
+ }
+
+ public <T> T getName(Object obj) {
+ return this.get(obj, "Name");
+ }
+
+ public void setId(Object obj, Object value) {
+ this.set(obj, "Id", value);
+ }
+
+ public void setName(Object obj, Object value) {
+ this.set(obj, "Name", value);
+ }
+
+ protected <T> T get(Object obj, String field) {
+ T result = null;
+ if (obj != null) {
+ try {
+ result = (T) obj.getClass().getMethod(String.format("%s%s%s", "get",
+ CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, this.name), field)).invoke(obj);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
+ | NoSuchMethodException | SecurityException e) {
+ // silent fail
+ }
+ }
+
+ return result;
+ }
+
+ protected void set(Object obj, String field, Object value) {
+ if (obj != null) {
+ try {
+ obj.getClass()
+ .getMethod(
+ String.format("%s%s%s", "set",
+ CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, this.name), field),
+ value.getClass())
+ .invoke(obj, value);
+ } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException e) {
+ // silent fail
+ }
+ }
+ }
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
index 8635af5b94..75a6ba8280 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
@@ -20,6 +20,7 @@
package org.onap.so.serviceinstancebeans;
+import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -34,10 +35,12 @@ public class Request {
protected String finishTime;
protected String requestScope;
protected String requestType;
+ protected String originalRequestId;
protected RequestDetails requestDetails;
protected InstanceReferences instanceReferences;
protected RequestStatus requestStatus;
protected List<RequestProcessingData> requestProcessingData;
+ protected List<CloudRequestData> cloudRequestData = new ArrayList<>();
public String getRequestId() {
@@ -112,12 +115,30 @@ public class Request {
this.requestProcessingData = requestProcessingData;
}
+
+ public List<CloudRequestData> getCloudRequestData() {
+ return cloudRequestData;
+ }
+
+ public void setCloudRequestData(List<CloudRequestData> cloudRequestData) {
+ this.cloudRequestData = cloudRequestData;
+ }
+
+ public String getOriginalRequestId() {
+ return originalRequestId;
+ }
+
+ public void setOriginalRequestId(String originalRequestId) {
+ this.originalRequestId = originalRequestId;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this).append("requestId", requestId).append("startTime", startTime)
.append("finishTime", finishTime).append("requestScope", requestScope)
.append("requestType", requestType).append("requestDetails", requestDetails)
.append("instanceReferences", instanceReferences).append("requestStatus", requestStatus)
- .append("requestProcessingData", requestProcessingData).toString();
+ .append("requestProcessingData", requestProcessingData).append("cloudRequestData", cloudRequestData)
+ .append("originalRequestId", originalRequestId).toString();
}
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
index 1df2c10411..a72229a25c 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
@@ -20,11 +20,11 @@
package org.onap.so.serviceinstancebeans;
-import java.beans.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -52,9 +52,32 @@ public class RequestParameters implements Serializable {
private Boolean cascadeDelete;
@JsonProperty("testApi")
private String testApi; // usePreload would always be true for Update
+ @JsonProperty("retainAssignments")
+ private Boolean retainAssignments; // usePreload would always be true for Update
@JsonProperty("rebuildVolumeGroups")
private Boolean rebuildVolumeGroups;
+ @JsonProperty("enforceValidNfValues")
+ private Boolean enforceValidNfValues = false;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("subscriptionServiceType", subscriptionServiceType)
+ .append("userParams", userParams).append("aLaCarte", aLaCarte).append("payload", payload)
+ .append("usePreload", usePreload).append("autoBuildVfModules", autoBuildVfModules)
+ .append("cascadeDelete", cascadeDelete).append("testApi", testApi)
+ .append("retainAssignments", retainAssignments).append("rebuildVolumeGroups", rebuildVolumeGroups)
+ .append("enforceValidNfValues", enforceValidNfValues).toString();
+ }
+
+ public Boolean getEnforceValidNfValues() {
+ return enforceValidNfValues;
+ }
+
+ public void setEnforceValidNfValues(Boolean enforceValidNfValues) {
+ this.enforceValidNfValues = enforceValidNfValues;
+ }
+
public String getSubscriptionServiceType() {
return subscriptionServiceType;
}
@@ -150,11 +173,13 @@ public class RequestParameters implements Serializable {
this.rebuildVolumeGroups = rebuildVolumeGroups;
}
- @Override
- public String toString() {
- return "RequestParameters [subscriptionServiceType=" + subscriptionServiceType + ", userParams=" + userParams
- + ", aLaCarte=" + aLaCarte + ", testApi= " + testApi + ", autoBuildVfModules=" + autoBuildVfModules
- + ", usePreload=" + usePreload + ", rebuildVolumeGroups=" + rebuildVolumeGroups + ", payload=" + payload
- + "]";
+ public Boolean getRetainAssignments() {
+ return retainAssignments;
}
+
+ public void setRetainAssignments(Boolean retainAssignments) {
+ this.retainAssignments = retainAssignments;
+ }
+
+
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
index f659ae241a..3ada984b58 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
@@ -36,6 +36,48 @@ public class RequestStatus {
protected Integer percentProgress;
@JsonProperty("timestamp")
protected String timeStamp;
+ @JsonProperty("extSystemErrorSource")
+ protected String extSystemErrorSource;
+ @JsonProperty("rollbackExtSystemErrorSource")
+ protected String rollbackExtSystemErrorSource;
+ @JsonProperty("flowStatus")
+ protected String flowStatus;
+ @JsonProperty("retryStatusMessage")
+ protected String retryStatusMessage;
+ @JsonProperty("rollbackStatusMessage")
+ protected String rollbackStatusMessage;
+
+ public String getFlowStatus() {
+ return flowStatus;
+ }
+
+ public void setFlowStatus(String flowStatus) {
+ this.flowStatus = flowStatus;
+ }
+
+ public String getRetryStatusMessage() {
+ return retryStatusMessage;
+ }
+
+ public void setRetryStatusMessage(String retryStatusMessage) {
+ this.retryStatusMessage = retryStatusMessage;
+ }
+
+ public String getRollbackStatusMessage() {
+ return rollbackStatusMessage;
+ }
+
+ public void setRollbackStatusMessage(String rollbackStatusMessage) {
+ this.rollbackStatusMessage = rollbackStatusMessage;
+ }
+
+ public String getExtSystemErrorSource() {
+ return extSystemErrorSource;
+ }
+
+ public void setExtSystemErrorSource(String extSystemErrorSource) {
+ this.extSystemErrorSource = extSystemErrorSource;
+ }
public String getRequestState() {
return requestState;
@@ -69,9 +111,21 @@ public class RequestStatus {
this.timeStamp = timeStamp;
}
+ public String getRollbackExtSystemErrorSource() {
+ return rollbackExtSystemErrorSource;
+ }
+
+ public void setRollbackExtSystemErrorSource(String rollbackExtSystemErrorSource) {
+ this.rollbackExtSystemErrorSource = rollbackExtSystemErrorSource;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this).append("requestState", requestState).append("statusMessage", statusMessage)
- .append("percentProgress", percentProgress).append("timestamp", timeStamp).toString();
+ .append("percentProgress", percentProgress).append("timestamp", timeStamp)
+ .append("extSystemErrorSource", extSystemErrorSource)
+ .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).append("flowStatus", flowStatus)
+ .append("retryStatusMessage", retryStatusMessage).append("rollbackStatusMessage", rollbackStatusMessage)
+ .toString();
}
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
index f239774d57..2123b2f6fc 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
@@ -24,7 +24,6 @@ package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
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 09b48d266f..640660e97c 100644
--- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java
+++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
@@ -23,6 +23,7 @@
package org.onap.so.utils;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -89,7 +90,7 @@ public final class CryptoUtils {
try {
return CryptoUtils.encrypt(message, CLOUD_KEY);
} catch (GeneralSecurityException e) {
- logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
return null;
}
@@ -99,7 +100,7 @@ public final class CryptoUtils {
try {
return CryptoUtils.decrypt(message, CLOUD_KEY);
} catch (GeneralSecurityException e) {
- logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e);
return null;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java b/common/src/main/java/org/onap/so/utils/TargetEntities.java
index 0c10599a52..67016a1fa9 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/ModelType.java
+++ b/common/src/main/java/org/onap/so/utils/TargetEntities.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,11 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.apihandlerinfra;
+package org.onap.so.utils;
+
+import java.io.Serializable;
+
+public interface TargetEntities extends Serializable {
-/*
- * Enum for Status values returned by API Handler to Tail-F
- */
-public enum ModelType {
- service, vnf, vfModule, volumeGroup, network
}
diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java
index ea0b70413b..3a3ec91d2f 100644
--- a/common/src/main/java/org/onap/so/utils/TargetEntity.java
+++ b/common/src/main/java/org/onap/so/utils/TargetEntity.java
@@ -22,8 +22,26 @@ package org.onap.so.utils;
import java.util.EnumSet;
-public enum TargetEntity {
- OPENSTACK_ADAPTER, BPMN, GRM, AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER, SNIRO, SDC, EXTERNAL, MULTICLOUD, OOF;
+public enum TargetEntity implements TargetEntities {
+ OPENSTACK_ADAPTER,
+ BPMN,
+ GRM,
+ AAI,
+ DMAAP,
+ POLICY,
+ CATALOG_DB,
+ REQUEST_DB,
+ VNF_ADAPTER,
+ SDNC_ADAPTER,
+ SNIRO,
+ SDC,
+ EXTERNAL,
+ MULTICLOUD,
+ OOF,
+ SDNC,
+ SO,
+ UNKNOWN,
+ OPENSTACK;
private static final String PREFIX = "SO";
diff --git a/common/src/main/java/org/onap/so/utils/UUIDChecker.java b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
index 585ffcc7c4..30fc92bf49 100644
--- a/common/src/main/java/org/onap/so/utils/UUIDChecker.java
+++ b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
@@ -24,6 +24,7 @@
package org.onap.so.utils;
import java.util.UUID;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +52,7 @@ public class UUIDChecker {
public static String getUUID() {
String result = UUID.randomUUID().toString();
- logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID, result);
+ logger.info(LoggingAnchor.TWO, MessageEnum.APIH_GENERATED_REQUEST_ID, result);
return result;
}
}
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 0022ecbb96..0ff3ccfa9c 100644
--- a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
+++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
@@ -32,6 +32,7 @@ import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.exceptions.MarshallerException;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
@@ -52,8 +53,8 @@ public class XmlMarshaller {
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.marshal(object, stringWriter);
} catch (JAXBException e) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
- e.getMessage(), e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.GENERAL_EXCEPTION.toString(),
+ ErrorCode.SchemaError.getValue(), e.getMessage(), e);
throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e);
}
@@ -77,8 +78,8 @@ public class XmlMarshaller {
SAXSource source = new SAXSource(xmlReader, inputSource);
object = jaxbUnmarshaller.unmarshal(source, object.getClass()).getValue();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(),
- e.getMessage(), e);
+ logger.error(LoggingAnchor.THREE, MessageEnum.GENERAL_EXCEPTION.toString(),
+ ErrorCode.SchemaError.getValue(), e.getMessage(), e);
throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e);
}
diff --git a/common/src/test/java/org/onap/so/client/RestClientTest.java b/common/src/test/java/org/onap/so/client/RestClientTest.java
index b550079607..745dee23e8 100644
--- a/common/src/test/java/org/onap/so/client/RestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/RestClientTest.java
@@ -22,24 +22,24 @@ package org.onap.so.client;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriBuilderException;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.mockito.ArgumentMatchers;
-import org.onap.so.utils.TargetEntity;
+import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.utils.TargetEntity;
@RunWith(MockitoJUnitRunner.class)
public class RestClientTest {
@@ -49,34 +49,34 @@ public class RestClientTest {
@Mock
private RestProperties props;
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
@Test
public void retries() throws Exception {
RestClient spy = buildSpy();
- RestRequest mockCallable = mock(RestRequest.class);
- when(mockCallable.call()).thenThrow(new WebApplicationException(new SocketTimeoutException()));
- doReturn(mockCallable).when(spy).buildRequest(any(String.class), ArgumentMatchers.isNull());
+ doThrow(new WebApplicationException(new SocketTimeoutException())).when(spy).buildRequest(any(String.class),
+ ArgumentMatchers.isNull());
try {
spy.get();
} catch (Exception e) {
- // we expect an exception, ignore it
+ // ignore this exception for this test
}
- verify(mockCallable, times(3)).call();
+ verify(spy, times(3)).buildRequest(any(String.class), ArgumentMatchers.isNull());
}
@Test
public void exceptionDoNotRetry() throws Exception {
RestClient spy = buildSpy();
- RestRequest mockCallable = mock(RestRequest.class);
- when(mockCallable.call()).thenThrow(new WebApplicationException(new NotFoundException()));
- doReturn(mockCallable).when(spy).buildRequest(any(String.class), ArgumentMatchers.isNull());
+ doThrow(new WebApplicationException(new NotFoundException())).when(spy).buildRequest(any(String.class),
+ ArgumentMatchers.isNull());
try {
spy.get();
} catch (Exception e) {
// we expect an exception, ignore it
}
- verify(mockCallable, times(1)).call();
+ verify(spy, times(1)).buildRequest(any(String.class), ArgumentMatchers.isNull());
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
index 1c49c11382..b07d893adb 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
@@ -24,6 +24,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -32,12 +33,14 @@ import static org.mockito.Mockito.verify;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
+import javax.ws.rs.core.GenericType;
import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Pserver;
@@ -46,7 +49,6 @@ import org.onap.so.client.aai.entities.singletransaction.SingleTransactionReques
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.core.JsonParseException;
@@ -60,11 +62,13 @@ public class AAISingleTransactionClientTest {
private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/singletransaction/";
AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "pserver-hostname");
AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex");
+ AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex2");
ObjectMapper mapper;
public AAIClient client = new AAIClient();
+ @Spy
public AAIResourcesClient aaiClient = new AAIResourcesClient();
@Before
@@ -82,9 +86,11 @@ public class AAISingleTransactionClientTest {
pserver2.setFqdn("patched-fqdn");
Complex complex = new Complex();
complex.setCity("my-city");
- AAISingleTransactionClient singleTransaction =
- aaiClient.beginSingleTransaction().create(uriA, pserver).update(uriA, pserver2).create(uriB, complex);
-
+ Map<String, Object> map = new HashMap<>();
+ map.put("resource-version", "1234");
+ doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriC));
+ AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction().create(uriA, pserver)
+ .update(uriA, pserver2).create(uriB, complex).delete(uriC);
SingleTransactionRequest actual = singleTransaction.getRequest();
diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
index adbdbb419f..305cdf59cc 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
@@ -22,6 +22,7 @@ package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@@ -31,19 +32,19 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import javax.ws.rs.core.GenericType;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
@@ -61,11 +62,13 @@ public class AAITransactionalClientTest {
AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test4");
AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test5");
AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test6");
+ AAIResourceUri uriG = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test7");
ObjectMapper mapper;
public AAIClient client = new AAIClient();
+ @Spy
public AAIResourcesClient aaiClient = new AAIResourcesClient();
@Before
@@ -95,9 +98,12 @@ public class AAITransactionalClientTest {
List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>();
uris.add(uriB);
+ Map<String, Object> map = new HashMap<>();
+ map.put("resource-version", "1234");
+ doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriG));
AAIResourceUri uriAClone = uriA.clone();
AAITransactionalClient transactions = aaiClient.beginTransaction().connect(uriA, uris).connect(uriC, uriD)
- .beginNewTransaction().connect(uriE, uriF);
+ .beginNewTransaction().connect(uriE, uriF).beginNewTransaction().delete(uriG);
String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
Map<String, Object> actual =
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
index 5fa2ff0295..b91d0e705a 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
@@ -91,6 +91,13 @@ public class AAIValidatorTest {
}
@Test
+ public void test_IsPhysicalServerLocked_NoServers_False() throws IOException {
+ when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(null);
+ boolean locked = validator.isPhysicalServerLocked(vnfName);
+ assertEquals(false, locked);
+ }
+
+ @Test
public void test_IsVNFLocked_False() {
when(client.getVnfByName(vnfName)).thenReturn(createGenericVnfs(false));
boolean locked = validator.isVNFLocked(vnfName);
diff --git a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
index 6e55fe17fa..fb45652d53 100644
--- a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.onap.so.client.graphinventory.entities.DSLNode;
+import org.onap.so.client.graphinventory.entities.DSLNodeKey;
import org.onap.so.client.graphinventory.entities.DSLQueryBuilder;
import org.onap.so.client.graphinventory.entities.__;
@@ -108,4 +109,40 @@ public class DSLQueryBuilderTest {
builder.equals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')"));
assertTrue(builder.equals(builder));
}
+
+
+ @Test
+ public void mixedTypeTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.CLOUD_REGION,
+ __.key("cloud-owner", "owner"), __.key("cloud-region-id", "id")));
+ builder.to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", 167), __.key("my-boolean", true)).output());
+ assertTrue(builder.equals(
+ "cloud-region('cloud-owner', 'owner')('cloud-region-id', 'id') > vlan-tag*('vlan-id-outer', 167)('my-boolean', true)"));
+ }
+
+ @Test
+ public void outputOnNodeLambdasTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder =
+ new DSLQueryBuilder<>(new DSLNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId")));
+
+ builder.to(AAIObjectType.VSERVER, __.key("vserver-name", "myName")).output().to(AAIObjectType.P_INTERFACE)
+ .output();
+ assertEquals("l-interface('interface-id', 'myId') > vserver*('vserver-name', 'myName') > p-interface*",
+ builder.build());
+ }
+
+ @Test
+ public void skipOutputOnUnionTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder =
+ new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+
+ builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
+ __.node(AAIObjectType.VSERVER)
+ .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output())))
+ .output();
+
+ assertEquals(
+ "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
+ builder.build());
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java b/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java
deleted file mode 100644
index 4bfac38151..0000000000
--- a/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.so.client.dmaap;
-
-import org.junit.Test;
-import javax.ws.rs.ProcessingException;
-import java.io.IOException;
-import java.util.Optional;
-
-public class DmaapPublisherTest {
-
- DmaapPublisher dmaapPublisher = new DmaapPublisher(120) {
- @Override
- public String getAuth() {
- return "8F73A1691F6271E769329C176EE3EA48F52786AF12A3E16259007EED2A0F0CC3CB965F4AB5318483015723CCE1C0B48AB6C4DED6E251869393B01E4EC532FC88D4A128B92F4CDB34719B171923";
- }
-
- @Override
- public String getKey() {
- return "07a7159d3bf51a0e53be7a8f89699be7";
- }
-
- @Override
- public String getTopic() {
- return "test";
- }
-
- @Override
- public Optional<String> getHost() {
- return Optional.of("http://test");
- }
- };
-
- public DmaapPublisherTest() throws IOException {}
-
- @Test(expected = ProcessingException.class)
- public void sendTest() throws Exception {
- dmaapPublisher.send("{'key': 'value'}");
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/db/connections/DbDnsIpAddressTest.java b/common/src/test/java/org/onap/so/db/connections/DbDnsIpAddressTest.java
new file mode 100644
index 0000000000..0dc35a054c
--- /dev/null
+++ b/common/src/test/java/org/onap/so/db/connections/DbDnsIpAddressTest.java
@@ -0,0 +1,19 @@
+package org.onap.so.db.connections;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class DbDnsIpAddressTest {
+
+ @Test
+ public void test() {
+ final String expectedIpAddress = "10.0.75.1";
+
+ DbDnsIpAddress dbDnsIpAddress = new DbDnsIpAddress();
+ dbDnsIpAddress.setIpAddress(expectedIpAddress);
+
+ assertEquals(expectedIpAddress, dbDnsIpAddress.getIpAddress());
+
+ }
+
+}
diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java
new file mode 100644
index 0000000000..fd1977225f
--- /dev/null
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import org.junit.Test;
+
+public class ModelTypeTest {
+
+
+
+ @Test
+ public void reflectionTest() {
+ TestServiceInstanceBean a = new TestServiceInstanceBean();
+ TestServiceInstanceBean b = new TestServiceInstanceBean();
+
+ a.setServiceInstanceId("my-id-a");
+ a.setServiceInstanceName("my-name-a");
+
+ b.setServiceInstanceId("my-id-b");
+ b.setServiceInstanceName("my-name-b");
+
+ assertEquals("my-id-a", ModelType.service.getId(a));
+ assertEquals("my-name-a", ModelType.service.getName(a));
+ ModelType.service.setName(a, ModelType.service.getName(b));
+ ModelType.service.setId(a, ModelType.service.getId(b));
+ assertEquals("my-name-b", ModelType.service.getName(a));
+ assertEquals("my-id-b", ModelType.service.getId(a));
+ }
+
+ @Test
+ public void testSilentFail() {
+ TestServiceInstanceBean a = new TestServiceInstanceBean();
+
+ a.setServiceInstanceId("my-id-a");
+ a.setServiceInstanceName("my-name-a");
+ assertNull(ModelType.service.get(a, "NoField"));
+ }
+}
diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java b/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java
new file mode 100644
index 0000000000..a14f3bace4
--- /dev/null
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+public class TestServiceInstanceBean {
+
+ private String serviceInstanceId;
+ private String serviceInstanceName;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+}
diff --git a/common/src/test/resources/__files/aai/bulkprocess/test-request.json b/common/src/test/resources/__files/aai/bulkprocess/test-request.json
index f5ffe38285..5a2953c632 100644
--- a/common/src/test/resources/__files/aai/bulkprocess/test-request.json
+++ b/common/src/test/resources/__files/aai/bulkprocess/test-request.json
@@ -18,5 +18,9 @@
"related-link" : "/cloud-infrastructure/pservers/pserver/test6"
}
} ]
- } ]
+ }, {
+ "delete" : [ {
+ "uri" : "/network/generic-vnfs/generic-vnf/test7?resource-version=1234"
+ } ]
+ }]
} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/singletransaction/sample-request.json b/common/src/test/resources/__files/aai/singletransaction/sample-request.json
index f0761a07b6..69024dca83 100644
--- a/common/src/test/resources/__files/aai/singletransaction/sample-request.json
+++ b/common/src/test/resources/__files/aai/singletransaction/sample-request.json
@@ -21,6 +21,12 @@
"body": {
"city": "my-city"
}
+ },
+ {
+ "action": "delete",
+ "uri": "/cloud-infrastructure/complexes/complex/my-complex2?resource-version=1234",
+ "body" : {
+ }
}
]
} \ No newline at end of file
diff --git a/docs/Developer_Info.rst b/docs/Developer_Info.rst
deleted file mode 100644
index 59dc9d6f1c..0000000000
--- a/docs/Developer_Info.rst
+++ /dev/null
@@ -1,14 +0,0 @@
-.. This work is licensed under a Creative Commons Attribution 4.0 International License.
-.. http://creativecommons.org/licenses/by/4.0
-.. Copyright 2018 Huawei Technologies Co., Ltd.
-
-Developer Information
-======================
-
-.. toctree::
- :maxdepth: 1
-
- Install_Configure_SO.rst
- architecture.rst
- FAQs.rst
- \ No newline at end of file
diff --git a/docs/api/apis/SO_Interface.rst b/docs/api/apis/consumed-apis.rst
index b079989aff..0ef69c4da1 100644
--- a/docs/api/apis/SO_Interface.rst
+++ b/docs/api/apis/consumed-apis.rst
@@ -2,1157 +2,14 @@
.. http://creativecommons.org/licenses/by/4.0
.. Copyright 2018 Huawei Technologies Co., Ltd.
-SO Interfaces
-================================
+API consumed by SO
+==================
.. image:: ../../images/SO_1.png
-SO APIs
-----------------
-
-North Bound APIs
-----------------
-Create service instance
-++++++++++++++++++++++++
-
-+--------------------+-------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6 |
-+--------------------+-------------------------------------+
-|Operation Type |POST |
-+--------------------+-------------------------------------+
-|Content-Type |application/json |
-+--------------------+-------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-
-SubscriberInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|GlobalSubscriberId |String |Global customer Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|SubscriberName |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|SubscriptionServiceType |String |The service type of the Subscription |
-+-------------------------+------------------+-------------------------------------------------+
-|UserParams |Array |The product family Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|aLaCarte |Boolean | aLaCarte |
-+-------------------------+------------------+-------------------------------------------------+
-|autoBuildVfModules |Boolean |autoBuildVfModules |
-+-------------------------+------------------+-------------------------------------------------+
-|cascadeDelete |Boolean |cascadeDelete |
-+-------------------------+------------------+-------------------------------------------------+
-|usePreload |Boolean |usePreload |
-+-------------------------+------------------+-------------------------------------------------+
-|rebuildVolumeGroups |Boolean |rebuildVolumeGroups |
-+-------------------------+------------------+-------------------------------------------------+
-|payload |String |payload |
-+-------------------------+------------------+-------------------------------------------------+
-|controllerType |String |controllerType |
-+-------------------------+------------------+-------------------------------------------------+
-
-UserParams Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|name |String |Tag name of attribute |
-+-------------------------+------------------+-------------------------------------------------+
-|value |String |Value of the tag |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-|aicNodeClli |String |aicNodeClli property |
-+-------------------------+------------------+-------------------------------------------------+
-
-Project Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|projectName |String |Name of the project |
-+-------------------------+------------------+-------------------------------------------------+
-
-OwningEntity Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|owningEntityId |String |owningEntityId of the owingEntity |
-+-------------------------+------------------+-------------------------------------------------+
-|owningEntityName |String |owningEntityName of the owingEntity |
-+-------------------------+------------------+-------------------------------------------------+
-
-Platform Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|platformName |String |Platform Name |
-+-------------------------+------------------+-------------------------------------------------+
-
-LineOfBusiness Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lineOfBusinessName |String |Line Of Business Name |
-+-------------------------+------------------+-------------------------------------------------+
-
-Delete service instance
-++++++++++++++++++++++++
-
-+--------------------+---------------------------------------------------------+
-|Interface Definition|Description |
-+====================+=========================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId} |
-+--------------------+---------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+---------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+---------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-Create Volume Group
-++++++++++++++++++++++++
-
-+--------------------+-------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+===========================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups |
-+--------------------+-------------------------------------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+-------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+-------------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-|aicNodeClli |String |aicNodeClli property |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|relatedInstance |Object |relatedInstance Object |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|instanceId |String |instanceId |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInfo |Object |Content of modelInfo object. |
-+-------------------------+------------------+-------------------------------------------------+
-
-Delete Volume Group
-++++++++++++++++++++++++
-
-+--------------------+---------------------------------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volume-groupinstance-id} |
-+--------------------+---------------------------------------------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+---------------------------------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+---------------------------------------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-Create VF Module
-+++++++++++++++++
-
-+--------------------+----------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+========================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules |
-+--------------------+----------------------------------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+----------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+----------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|relatedInstanceList |List |Content of relatedInstanceList. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|InstanceName |String |The instance Name |
-+-------------------------+------------------+-------------------------------------------------+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|SuppressRollback |Boolean |SuppressRollback |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|relatedInstance |Object |relatedInstance Object |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|instanceId |String |instanceId |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInfo |Object |Content of modelInfo object. |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |Name of the instance |
-+-------------------------+------------------+-------------------------------------------------+
-
-Delete VF Module
-++++++++++++++++++++++++
-
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleinstance-id} |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-Create VNF
-+++++++++++++++
-
-+--------------------+--------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs |
-+--------------------+--------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+--------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|relatedInstance |Object |relatedInstance Object |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|instanceId |String |instanceId |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInfo |Object |Content of modelInfo object. |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|UserParams |Array |The product family Id. |
-+-------------------------+------------------+-------------------------------------------------+
-
-UserParams Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|name |String |Tag name of attribute |
-+-------------------------+------------------+-------------------------------------------------+
-|value |String |Value of the tag |
-+-------------------------+------------------+-------------------------------------------------+
-
-Delete VNF
-+++++++++++++++
-
-+--------------------+------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================================+
-|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId} |
-+--------------------+------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|UserParams |Array |The product family Id. |
-+-------------------------+------------------+-------------------------------------------------+
-
-UserParams Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|name |String |Tag name of attribute |
-+-------------------------+------------------+-------------------------------------------------+
-|value |String |Value of the tag |
-+-------------------------+------------------+-------------------------------------------------+
-
-GET Orchestration Request
-++++++++++++++++++++++++++
-
-+--------------------+--------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================+
-|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6/{request-id} |
-+--------------------+--------------------------------------------------------------+
-|Operation Type |GET |
-+--------------------+--------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------+
-
-Response Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|request |M |1 |request Object |Content of request object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-Request Object
-
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+===================+=========+===========+==========================+===========================================+
-|requestId |M |1 |String |Request Id |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|startTime |M |1 |request Object |Start time. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestScope |M |1 |request Object |Scope of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestType |M |1 |request Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestDetails |M |1 |requestDetails Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestStatus |M |1 |requestStatus Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-SubscriberInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|GlobalSubscriberId |String |Global customer Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|SubscriberName |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|SubscriptionServiceType |String |The service type of the Subscription |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestStatus Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|finishTime |String |Time |
-+-------------------------+------------------+-------------------------------------------------+
-|requestState |String |state of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|statusMessage |String |statusMessage |
-+-------------------------+------------------+-------------------------------------------------+
-|percentProgress |String |percentage of progress |
-+-------------------------+------------------+-------------------------------------------------+
-
-GET Orchestration Requests
-++++++++++++++++++++++++++
-
-+--------------------+--------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================+
-|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6 |
-+--------------------+--------------------------------------------------------------+
-|Operation Type |GET |
-+--------------------+--------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------+
-
-Response Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestList |M |1 |Array |Content of request List. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestList :
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|request |M |1 |request Object |Content of request object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-Request Object
-
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+===================+=========+===========+==========================+===========================================+
-|requestId |M |1 |String |Request Id. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|startTime |M |1 |request Object |Start time. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestScope |M |1 |request Object |Scope of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestType |M |1 |request Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestDetails |M |1 |requestDetails Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-|requestStatus |M |1 |requestStatus Object |Type of the request. |
-+-------------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+-------------------+--------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+===================+==========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|project |project Object |Content of project object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|owningEntity |owningEntity Object |Content of owningEntity object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|platform |platform Object |Content of platform object. |
-+-------------------+--------------------------+-------------------------------------------------+
-|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
-+-------------------+--------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelInvariantId |String |The Model Invariant Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelNameVersionId |String |The modelname Version Id |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelVersion |String |Version of the model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelCustomization Name |String |The Model Customization name |
-+-------------------------+------------------+-------------------------------------------------+
-|modelCustomizationUuid |String |The Model Customization UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelVersionId |String |The Model version id |
-+-------------------------+------------------+-------------------------------------------------+
-|modelUuid |String |The Model UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInvariantUuid |String |The Model Invariant UUid |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInstanceName |String |The Model Instance name |
-+-------------------------+------------------+-------------------------------------------------+
-
-SubscriberInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|GlobalSubscriberId |String |Global customer Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|SubscriberName |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|billingAccountNumber |String |billingAccountNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|callbackUrl |String |callbackUrl of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|correlator |String |correlator of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderNumber |String |orderNumber of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|productFamilyId |String |productFamilyId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|orderVersion |String |orderVersion of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|instanceName |String |instanceName of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|suppressRollback |String |suppressRollback of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|requestorId |String |requestorId of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|SubscriptionServiceType |String |The service type of the Subscription |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestStatus Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|finishTime |String |Time |
-+-------------------------+------------------+-------------------------------------------------+
-|requestState |String |state of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|statusMessage |String |statusMessage |
-+-------------------------+------------------+-------------------------------------------------+
-|percentProgress |String |percentage of progress |
-+-------------------------+------------------+-------------------------------------------------+
SDC Client API
-------------------
+--------------
Get List of Existing Catalog Assets
+++++++++++++++++++++++++++++++++++
@@ -1291,7 +148,7 @@ Response:
Resource Object:
+---------------------+---------+-------+-------------------------------------------------------------------------------------------------------------------+
-|Attribute |Qualifier|Content|Description | |
+|Attribute |Qualifier|Content|Description |
+=====================+=========+=======+===================================================================================================================+
|resourceInstanceName |M |String |Logical Resource Instance Name.Unique Identifier of the instance of the specific resource in the service context.|
+---------------------+---------+-------+-------------------------------------------------------------------------------------------------------------------+
@@ -1371,184 +228,9 @@ Response:
|Content-Disposition |M |Specifies the name of file to store the downloaded artifact’s payload ( RFC 2183) . |
+--------------------+---------+--------------------------------------------------------------------------------------------------------------------------+
-E2E Service API
-----------------
-
-Create E2E service instance
-++++++++++++++++++++++++++++
-
-+--------------------+-------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================+
-|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3 |
-+--------------------+-------------------------------------+
-|Operation Type |POST |
-+--------------------+-------------------------------------+
-|Content-Type |application/json |
-+--------------------+-------------------------------------+
-
-Request Body:
-
-+---------+---------+-----------+--------------------------+-----------------------------+
-|Attribute|Qualifier|Cardinality|Content |Description |
-+=========+=========+===========+==========================+=============================+
-|service |M |1 |Service Object |Content of service object. |
-+---------+---------+-----------+--------------------------+-----------------------------+
-
-Service Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|name |String |Service instance name. |
-+------------------------------+-----------------+------------------------------------+
-|description |String |Service instance description |
-+------------------------------+-----------------+------------------------------------+
-|serviceUuid |String |Model UUID |
-+------------------------------+-----------------+------------------------------------+
-|serviceInvariantUuid |String |Model Invariant UUID |
-+------------------------------+-----------------+------------------------------------+
-|gloabalSubscriberId |String |Customer Id |
-+------------------------------+-----------------+------------------------------------+
-|serviceType |String |service Type |
-+------------------------------+-----------------+------------------------------------+
-|parameters |Object |Parameter Object |
-+------------------------------+-----------------+------------------------------------+
-
-Parameter Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|locationConstraints |List of object |location infor for each vnf |
-+------------------------------+-----------------+------------------------------------+
-|resource |List of Resource |resource of service/resource |
-+------------------------------+-----------------+------------------------------------+
-|requestInputs |key-value map |input of service/resource
-+------------------------------+-----------------+------------------------------------+
-
-LocationConstraint Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|vnfProfileId |String |Customization id for VNF |
-+------------------------------+-----------------+------------------------------------+
-|locationConstraints |Object |DC location info of VNF |
-+------------------------------+-----------------+------------------------------------+
-
-VnfLocationConstraint Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|vimId |String |VIM id from ESR definition |
-+------------------------------+-----------------+------------------------------------+
-
-Resource Object
-
-+------------------------------+-----------------+------------------------------------+
-|Attribute |Content |Description |
-+==============================+=================+====================================+
-|resourceName |String |The resource name |
-+------------------------------+-----------------+------------------------------------+
-|resourceInvariantUuid |String |The resource invariant UUID. |
-+------------------------------+-----------------+------------------------------------+
-|resourceUuid |String |The resource UUID. |
-+------------------------------+-----------------+------------------------------------+
-|resourceCustomizationUuid |String |The resource customization UUID. |
-+------------------------------+-----------------+------------------------------------+
-|parameters |Object |Parameter of resource |
-+------------------------------+-----------------+------------------------------------+
-
-Response:
-
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|serviceId |M |1 |String |Service instance ID. |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operationId |M |1 |String |Service Operation ID. |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-
-Delete E2E service instance
-++++++++++++++++++++++++++++
-
-+--------------------+-----------------------------------------------+
-|Interface Definition|Description |
-+====================+===============================================+
-|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}|
-+--------------------+-----------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+-----------------------------------------------+
-
-Request Parameters:
-
-+-------------------+---------+-----------+-------+----------------------------------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+===================+=========+===========+=======+========================================+
-|globalSubscriberId |M |1 |String |The subscriber id. It is defined in AAI |
-+-------------------+---------+-----------+-------+----------------------------------------+
-|serviceType |M |1 |String |The service type. It is defined in AAI |
-+-------------------+---------+-----------+-------+----------------------------------------+
-
-Response:
-
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operationId |M |1 |String |The operation id. |
-+-------------+---------+-----------+-------+------------------------------------------------------------------------+
-
-Query E2E service operation result
-++++++++++++++++++++++++++
-
-+--------------------+------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+========================================================================+
-|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}/operations/{operationId}|
-+--------------------+------------------------------------------------------------------------+
-|Operation Type |GET |
-+--------------------+------------------------------------------------------------------------+
-
-Request Parameters:
-
-+--------------+---------+-----------+-------+--------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+==============+=========+===========+=======+==============+
-|serviceId |M |1 |Service instance ID. |
-+--------------+---------+-----------+-------+--------------+
-|operationId |M |1 |Service Operation ID. |
-+--------------+---------+-----------+-------+--------------+
-
-Response:
-
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content|Description |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operation |M |1 |String |Operation object identify. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operationId |M |1 |String |Operation ID. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operation |M |1 |String |Operation type, create|delete. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|result |M |1 |String |Operation result: finished, error, processing. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|reason |M |1 |String |If failing, need to write fail reason. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|userId |M |1 |String |Operation user ID. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operationContent |M |1 |String |The status detail of current operation which is being executing. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|progress |M |1 |String |Current operation progress. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|operateAt |M |1 |String |Time that it starts to execute operation. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
-|finishedAt |M |1 |String |Time that it finished executing operation. |
-+------------------+---------+-----------+-------+------------------------------------------------------------------------+
Inventory APIs
-----------------
+--------------
create or update an existing service-instance
+++++++++++++++++++++++++++++++++++++++++++++
@@ -1740,10 +422,10 @@ Response:
VFC APIs
----------
+--------
Create NS
-+++++++++++
++++++++++
+--------------------+-------------------+
|Interface Definition|Description |
@@ -1778,7 +460,7 @@ Response:
+-----------------+---------+-----------+----------------+-------------------+
Get NS
-+++++++
+++++++
+--------------------+-------------------+
|Interface Definition|Description |
@@ -1869,7 +551,7 @@ vnffgInfo Array:
+----------------------+---------+-----------+----------------+-------------------+
Instantiate NS
-+++++++++++++++
+++++++++++++++
+--------------------+-------------------------------------+
|Interface Definition|Description |
@@ -1898,7 +580,7 @@ LocationConstraints Array:
+----------------------+---------+-----------+-------+-----------------------+
|Attribute |Qualifier|Cardinality|Content|Description |
+======================+=========+===========+=======+=======================+
-|vnfProfileId |M |1 |String |vnfProfileId |
+|vnfProfileId |M |1 |String |vnfProfileId |
+----------------------+---------+-----------+-------+-----------------------+
|vimid |M |1 |String |vimid |
+----------------------+---------+-----------+-------+-----------------------+
@@ -1912,7 +594,7 @@ Response:
+--------------+---------+-----------+-------+-----------------------+
Terminate NS
-+++++++++++++++
+++++++++++++
+--------------------+-------------------------------------+
|Interface Definition|Description |
@@ -1945,7 +627,7 @@ Response:
+--------------+---------+-----------+-------+-----------------------+
Delete NS
-+++++++++++++++
++++++++++
+--------------------+-------------------------------------+
|Interface Definition|Description |
@@ -1964,9 +646,9 @@ Request Parameters:
+----------------------------+---------+-----------+-------+-----------------------------+
MultiVIM API
-----------------
+------------
Get token
-++++++++++
++++++++++
https://developer.openstack.org/api-ref/identity/v3/#password-authentication-with-unscoped-authorization
@@ -2051,7 +733,7 @@ Response:
+-------------------------+------------------+--------------------------------------------------------------------------+
Create stack
-+++++++++++++
+++++++++++++
https://developer.openstack.org/api-ref/orchestration/v1/#create-stack
@@ -2108,7 +790,7 @@ Response:
+-------------------------+------------------+--------------------------------------------------------------------------+
Get stack
-+++++++++++++
++++++++++
https://developer.openstack.org/api-ref/orchestration/v1/#show-stack-details
@@ -2187,7 +869,7 @@ Response:
+-------------------------+------------------+------------------------------------------------------------------------------+
Delete stack
-+++++++++++++
+++++++++++++
https://developer.openstack.org/api-ref/orchestration/v1/#show-stack-details
@@ -2346,7 +1028,7 @@ Request Body:
+------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+
Create Keypair
-+++++++++++++++
+++++++++++++++
https://developer.openstack.org/api-ref/compute/#create-or-import-keypair
@@ -2397,7 +1079,7 @@ Response:
+-----------------+------------------+------------------------------------------------------------------------------+
Delete Keypair
-+++++++++++++++
+++++++++++++++
https://developer.openstack.org/api-ref/compute/#delete-keypair
@@ -2422,7 +1104,7 @@ Request Body:
+------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+
Create Network
-+++++++++++++++
+++++++++++++++
https://developer.openstack.org/api-ref/network/v2/?expanded=create-network-detail#create-network
@@ -2543,7 +1225,7 @@ Response:
+-----------------------------+------------------+------------------------------------------------------------------------------+
Delete Network
-+++++++++++++++
+++++++++++++++
https://developer.openstack.org/api-ref/network/v2/?expanded=create-network-detail#delete-network
@@ -2566,7 +1248,7 @@ Request Body:
+----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+
Create Subnet
-+++++++++++++++
++++++++++++++
https://developer.openstack.org/api-ref/network/v2/?expanded=create-network-detail,create-subnet-detail#create-subnet
@@ -2675,7 +1357,7 @@ Response:
+-----------------------------+------------------+------------------------------------------------------------------------------+
Delete Subnet
-+++++++++++++++
++++++++++++++
https://developer.openstack.org/api-ref/networking/v2/?expanded=create-network-detail,delete-subnet-detail#delete-subnet
@@ -2698,7 +1380,7 @@ Request Body:
+----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+
Create Port
-+++++++++++++++
++++++++++++
https://developer.openstack.org/api-ref/networking/v2/#create-port
@@ -2829,7 +1511,7 @@ Response:
+-----------------------------+------------------+------------------------------------------------------------------------------+
Delete Port
-+++++++++++++++
++++++++++++
https://developer.openstack.org/api-ref/network/v2/#delete-port
@@ -2852,7 +1534,7 @@ Request Body:
+----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+
Create Security Group
-++++++++++++++++++++++
++++++++++++++++++++++
https://developer.openstack.org/api-ref/network/v2/#create-security-group
@@ -2909,7 +1591,7 @@ Response:
+-----------------------------+------------------+------------------------------------------------------------------------------+
Delete security group
-++++++++++++++++++++++
++++++++++++++++++++++
https://developer.openstack.org/api-ref/network/v2/#delete-security-group
@@ -3007,7 +1689,7 @@ Response:
+-----------------------------+------------------+-------------------------------------------------------------------------------------------------+
Delete security group
-++++++++++++++++++++++
++++++++++++++++++++++
https://developer.openstack.org/api-ref/networking/v2/#delete-security-group-rule
@@ -3948,139 +2630,139 @@ Request Parameters:
+-------------------+---------+-----------+-------+-------------------------------------------------------------+
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|transactionId |Y |1 |String |A unique ID to track an ONAP transaction. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|requestId |Y |1 |String |A unique ID to track multiple requests. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|callbackUrl |Y |1 |String |The end point of a callback service where recommendations are posted. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|callbackHeader |N |1 |String |The header information a client expecting in a async callback. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|sourceId |Y |1 |String |The unique ID of a client making an optimization call. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|requestType |Y |1 |String |The type of a request |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|numSolutions |N |1 |Integer|Expected number of solutions. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|optimizers |Y |1..N |List of Strings|A list of optimization services. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|timeout |N |1 |Integer|A tolerance window (in secs) for expecting solutions. Default is 600 secs.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+===============+==========================================================================+
+|transactionId |Y |1 |String |A unique ID to track an ONAP transaction. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|requestId |Y |1 |String |A unique ID to track multiple requests. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|callbackUrl |Y |1 |String |The end point of a callback service where recommendations are posted. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|callbackHeader |N |1 |String |The header information a client expecting in a async callback. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|sourceId |Y |1 |String |The unique ID of a client making an optimization call. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|requestType |Y |1 |String |The type of a request |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|numSolutions |N |1 |Integer |Expected number of solutions. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|optimizers |Y |1..N |List of Strings|A list of optimization services. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|timeout |N |1 |Integer |A tolerance window (in secs) for expecting solutions. Default is 600 secs.|
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
PlacementInfo Object
-+-------------------+---------+-----------+-------+-------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=============================================================+
-|requestParameters |C |1 |String |A JSON object conaining service and customer-specific data. A client or service designer is required to specify the parameters of interest for a given service and their location in the JSON blob through optimization query policies. This attribute is only required if a request contains service or customer-specific information.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|placementDemands |Y |1..N |List of PlacementDemand Object|The resource information for a placement service.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|subscriberInfo |N |1 |Object |The information of a service subscriber. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+==============================+=======================================================================================================================================================================================================================================================================================================================================+
+|requestParameters |C |1 |String |A JSON object conaining service and customer-specific data. A client or service designer is required to specify the parameters of interest for a given service and their location in the JSON blob through optimization query policies. This attribute is only required if a request contains service or customer-specific information.|
++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|placementDemands |Y |1..N |List of PlacementDemand Object|The resource information for a placement service. |
++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|subscriberInfo |N |1 |Object |The information of a service subscriber. |
++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
PlacementDemand Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|resourceModuleName |Y |1 |String |A resource name as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|tenantId |N |1 |String |A tenant Id as defined in the ordering system. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|resourceModelInfo |Y |1 |Object |Resource model information as defined in SDC. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|existingCandidates |N |1..N |List of Candidates Objects | The existing placement information of a resource. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|excludedCandidates |N |1..N |List of Candidates Objects |Candidates that need to be excluded from solutions.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|requiredCandidates |N |1..N |List of Candidates Objects |Candidates that must be included in solutions. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+============================+=======================================================================+
+|resourceModuleName |Y |1 |String |A resource name as defined in a service model. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|tenantId |N |1 |String |A tenant Id as defined in the ordering system. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|resourceModelInfo |Y |1 |Object |Resource model information as defined in SDC. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|existingCandidates |N |1..N |List of Candidates Objects | The existing placement information of a resource. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|excludedCandidates |N |1..N |List of Candidates Objects |Candidates that need to be excluded from solutions. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|requiredCandidates |N |1..N |List of Candidates Objects |Candidates that must be included in solutions. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
SubscriberInfo Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|globalSubscriberId |Y |1 |String |An ID of a subscriber. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|subscriberName |Y |1.N |String |The name of a subscriber. If the name is not known, the value must be 'unknown'.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|subscriberCommonSiteId |N |1 |String |Id representing a subscriber location. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content|Description |
++=======================+=========+===========+=======+===================================================================================+
+|globalSubscriberId |Y |1 |String |An ID of a subscriber. |
++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+
+|subscriberName |Y |1.N |String |The name of a subscriber. If the name is not known, the value must be 'unknown'. |
++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+
+|subscriberCommonSiteId |N |1 |String |Id representing a subscriber location. |
++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+
ModelMetaData Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|modelInvariantId |Y |1 |String |A model invariant Id as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelVersionId |Y |1 |String |A unique model Id as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelName |N |1 |String |A model name as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelType |N |1 |String |A model type as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelVersion |N |1 |String |A model version as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelCustomizationName |N |1 |String |A model customization name as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content|Description |
++========================+=========+===========+=======+=======================================================================+
+|modelInvariantId |Y |1 |String |A model invariant Id as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelVersionId |Y |1 |String |A unique model Id as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelName |N |1 |String |A model name as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelType |N |1 |String |A model type as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelVersion |N |1 |String |A model version as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelCustomizationName |N |1 |String |A model customization name as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
Candidates Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|identifierType |Y |1 |String |The type of a candidate. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|identifiers |Y |1..N |List |A list of identifiers. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content|Description |
++===================+=========+===========+=======+================================================================================+
+|identifierType |Y |1 |String |The type of a candidate. |
++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
+|identifiers |Y |1..N |List |A list of identifiers. |
++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
+|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id. |
++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
ServiceInfo Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|serviceInstanceId |Y |1 |String |A service instance id associated with a request. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelInfo |Y |1 |ModelMetaData Object |A list of identifiers. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|serviceName |Y |1 |String |The name of a service |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+=====================+=======================================================================+
+|serviceInstanceId |Y |1 |String |A service instance id associated with a request. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|modelInfo |Y |1 |ModelMetaData Object |A list of identifiers. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|serviceName |Y |1 |String |The name of a service |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
LicenseInfo Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|licenseDemands |Y |1..N |List of LicenseDemands Object |A list of resources for license selection. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+------------------------------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+==============================+=======================================================================+
+|licenseDemands |Y |1..N |List of LicenseDemands Object |A list of resources for license selection. |
++-------------------+---------+-----------+------------------------------+-----------------------------------------------------------------------+
LicenseDemand Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|resourceModuleName |Y |1 |String |A resource name as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|resourceModelInfo |Y |1 |ModelMetaData Object |Resource model information as defined in a service model.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|existingLicenses |N |1 |LicenseModel Object |Existing license information assigned to a resource. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+=====================+=======================================================================+
+|resourceModuleName |Y |1 |String |A resource name as defined in a service model. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|resourceModelInfo |Y |1 |ModelMetaData Object |Resource model information as defined in a service model. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|existingLicenses |N |1 |LicenseModel Object |Existing license information assigned to a resource. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
LicenseModel Object
@@ -4105,4 +2787,4 @@ Response Body
|statusMessage |N |1 |String |Reasoning if a requestStatus is failed. |
+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
|requestStatus |Y |1 |String |The status of a request. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ \ No newline at end of file
++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
diff --git a/docs/api/apis/e2eServiceInstances-api.rst b/docs/api/apis/e2eServiceInstances-api.rst
new file mode 100644
index 0000000000..08434efdfd
--- /dev/null
+++ b/docs/api/apis/e2eServiceInstances-api.rst
@@ -0,0 +1,185 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2018 Huawei Technologies Co., Ltd.
+
+e2eServiceInstances API
+=======================
+
+This API allows to manage:
+
+- e2eServiceInstances (create and delete)
+- operations on e2eServiceInstances (get)
+
+
+Create E2E service instance
++++++++++++++++++++++++++++
+
++--------------------+------------------------------------------------------------+
+|Interface Definition|Description |
++====================+============================================================+
+|URI |/onap/so/infra/e2eServiceInstances/v3 |
++--------------------+------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+------------------------------------------------------------+
+
+Request Body:
+
++---------+---------+-----------+--------------------------+-----------------------------+
+|Attribute|Qualifier|Cardinality|Content |Description |
++=========+=========+===========+==========================+=============================+
+|service |M |1 |Service Object |Content of service object. |
++---------+---------+-----------+--------------------------+-----------------------------+
+
+Service Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|name |String |Service instance name. |
++------------------------------+-----------------+------------------------------------+
+|description |String |Service instance description |
++------------------------------+-----------------+------------------------------------+
+|serviceUuid |String |Model UUID |
++------------------------------+-----------------+------------------------------------+
+|serviceInvariantUuid |String |Model Invariant UUID |
++------------------------------+-----------------+------------------------------------+
+|gloabalSubscriberId |String |Customer Id |
++------------------------------+-----------------+------------------------------------+
+|serviceType |String |service Type |
++------------------------------+-----------------+------------------------------------+
+|parameters |Object |Parameter Object |
++------------------------------+-----------------+------------------------------------+
+
+Parameter Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|locationConstraints |List of object |location infor for each vnf |
++------------------------------+-----------------+------------------------------------+
+|resource |List of Resource |resource of service/resource |
++------------------------------+-----------------+------------------------------------+
+|requestInputs |key-value map |input of service/resource |
++------------------------------+-----------------+------------------------------------+
+
+LocationConstraint Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|vnfProfileId |String |Customization id for VNF |
++------------------------------+-----------------+------------------------------------+
+|locationConstraints |Object |DC location info of VNF |
++------------------------------+-----------------+------------------------------------+
+
+VnfLocationConstraint Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|vimId |String |VIM id from ESR definition |
++------------------------------+-----------------+------------------------------------+
+
+Resource Object
+
++------------------------------+-----------------+------------------------------------+
+|Attribute |Content |Description |
++==============================+=================+====================================+
+|resourceName |String |The resource name |
++------------------------------+-----------------+------------------------------------+
+|resourceInvariantUuid |String |The resource invariant UUID. |
++------------------------------+-----------------+------------------------------------+
+|resourceUuid |String |The resource UUID. |
++------------------------------+-----------------+------------------------------------+
+|resourceCustomizationUuid |String |The resource customization UUID. |
++------------------------------+-----------------+------------------------------------+
+|parameters |Object |Parameter of resource |
++------------------------------+-----------------+------------------------------------+
+
+Response:
+
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|serviceId |M |1 |String |Service instance ID. |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operationId |M |1 |String |Service Operation ID. |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+
+Delete E2E service instance
++++++++++++++++++++++++++++
+
++--------------------+----------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+======================================================================+
+|URI |/onap/so/infra/e2eServiceInstances/v3/{serviceId} |
++--------------------+----------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+----------------------------------------------------------------------+
+
+Request Parameters:
+
++-------------------+---------+-----------+-------+----------------------------------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++===================+=========+===========+=======+========================================+
+|globalSubscriberId |M |1 |String |The subscriber id. It is defined in AAI |
++-------------------+---------+-----------+-------+----------------------------------------+
+|serviceType |M |1 |String |The service type. It is defined in AAI |
++-------------------+---------+-----------+-------+----------------------------------------+
+
+Response:
+
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operationId |M |1 |String |The operation id. |
++-------------+---------+-----------+-------+------------------------------------------------------------------------+
+
+Query E2E service operation result
+++++++++++++++++++++++++++++++++++
+
++--------------------+-----------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+===============================================================================================+
+|URI |/onap/so/infra/e2eServiceInstances/v3/{serviceId}/operations/{operationId} |
++--------------------+-----------------------------------------------------------------------------------------------+
+|Operation Type |GET |
++--------------------+-----------------------------------------------------------------------------------------------+
+
+Request Parameters:
+
++--------------+---------+-----------+-------+--------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++==============+=========+===========+=======+==============+
+|serviceId |M |1 |Service instance ID. |
++--------------+---------+-----------+-------+--------------+
+|operationId |M |1 |Service Operation ID. |
++--------------+---------+-----------+-------+--------------+
+
+Response:
+
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content|Description |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operation |M |1 |String |Operation object identify. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operationId |M |1 |String |Operation ID. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operation |M |1 |String |Operation type, create|delete. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|result |M |1 |String |Operation result: finished, error, processing. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|reason |M |1 |String |If failing, need to write fail reason. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|userId |M |1 |String |Operation user ID. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operationContent |M |1 |String |The status detail of current operation which is being executing. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|progress |M |1 |String |Current operation progress. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|operateAt |M |1 |String |Time that it starts to execute operation. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
+|finishedAt |M |1 |String |Time that it finished executing operation. |
++------------------+---------+-----------+-------+------------------------------------------------------------------------+
diff --git a/docs/api/apis/serviceInstances-api.rst b/docs/api/apis/serviceInstances-api.rst
new file mode 100644
index 0000000000..b3fd2cf47d
--- /dev/null
+++ b/docs/api/apis/serviceInstances-api.rst
@@ -0,0 +1,1192 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2018 Huawei Technologies Co., Ltd.
+
+serviceInstances API
+====================
+
+
+This API allows to generate some requests to manage:
+
+- serviceInstances (create, delete)
+- volumeGroups attached to a vnf instance (create, delete)
+- vfModules attached to a vnf instance (create, delete)
+- vnfs attached to a service instance (create, delete)
+- orchestrationRequests (get)
+
+links:
+
+- :ref:`create_service_instance`
+- :ref:`delete_service_instance`
+- :ref:`create_volume_group`
+- :ref:`delete_volume_group`
+- :ref:`create_vf_module`
+- :ref:`delete_vf_module`
+- :ref:`create_vnf`
+- :ref:`delete_vnf`
+- :ref:`get_orchestration_request_by_id`
+- :ref:`get_orchestration_request_all`
+
+
+.. _create_service_instance:
+
+Create service instance
++++++++++++++++++++++++
+
++--------------------+--------------------------------------------------------+
+|Interface Definition|Description |
++====================+========================================================+
+|URI |/onap/so/infra/serviceInstances/v6 |
++--------------------+--------------------------------------------------------+
+|Operation Type |POST |
++--------------------+--------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+
+SubscriberInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|GlobalSubscriberId |String |Global customer Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|SubscriberName |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|SubscriptionServiceType |String |The service type of the Subscription |
++-------------------------+------------------+-------------------------------------------------+
+|UserParams |Array |The product family Id. |
++-------------------------+------------------+-------------------------------------------------+
+|aLaCarte |Boolean | aLaCarte |
++-------------------------+------------------+-------------------------------------------------+
+|autoBuildVfModules |Boolean |autoBuildVfModules |
++-------------------------+------------------+-------------------------------------------------+
+|cascadeDelete |Boolean |cascadeDelete |
++-------------------------+------------------+-------------------------------------------------+
+|usePreload |Boolean |usePreload |
++-------------------------+------------------+-------------------------------------------------+
+|rebuildVolumeGroups |Boolean |rebuildVolumeGroups |
++-------------------------+------------------+-------------------------------------------------+
+|payload |String |payload |
++-------------------------+------------------+-------------------------------------------------+
+|controllerType |String |controllerType |
++-------------------------+------------------+-------------------------------------------------+
+
+UserParams Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|name |String |Tag name of attribute |
++-------------------------+------------------+-------------------------------------------------+
+|value |String |Value of the tag |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+|aicNodeClli |String |aicNodeClli property |
++-------------------------+------------------+-------------------------------------------------+
+
+Project Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|projectName |String |Name of the project |
++-------------------------+------------------+-------------------------------------------------+
+
+OwningEntity Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|owningEntityId |String |owningEntityId of the owingEntity |
++-------------------------+------------------+-------------------------------------------------+
+|owningEntityName |String |owningEntityName of the owingEntity |
++-------------------------+------------------+-------------------------------------------------+
+
+Platform Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|platformName |String |Platform Name |
++-------------------------+------------------+-------------------------------------------------+
+
+LineOfBusiness Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lineOfBusinessName |String |Line Of Business Name |
++-------------------------+------------------+-------------------------------------------------+
+
+
+.. _delete_service_instance:
+
+Delete service instance
++++++++++++++++++++++++
+
++--------------------+--------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId} |
++--------------------+--------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+--------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+
+.. _create_volume_group:
+
+Create Volume Group
++++++++++++++++++++
+
++--------------------+------------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+==================================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups |
++--------------------+------------------------------------------------------------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+------------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+------------------------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+|aicNodeClli |String |aicNodeClli property |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|relatedInstance |Object |relatedInstance Object |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|instanceId |String |instanceId |
++-------------------------+------------------+-------------------------------------------------+
+|modelInfo |Object |Content of modelInfo object. |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _delete_volume_group:
+
+Delete Volume Group
++++++++++++++++++++
+
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+============================================================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volume-groupinstance-id} |
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++---------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=====================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _create_vf_module:
+
+Create VF Module
+++++++++++++++++
+
++--------------------+---------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+===============================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules |
++--------------------+---------------------------------------------------------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+---------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+---------------------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++---------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=====================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|relatedInstanceList |List |Content of relatedInstanceList. |
++---------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|InstanceName |String |The instance Name |
++-------------------------+------------------+-------------------------------------------------+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|SuppressRollback |Boolean |SuppressRollback |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|relatedInstance |Object |relatedInstance Object |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|instanceId |String |instanceId |
++-------------------------+------------------+-------------------------------------------------+
+|modelInfo |Object |Content of modelInfo object. |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |Name of the instance |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _delete_vf_module:
+
+Delete VF Module
+++++++++++++++++
+
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleinstance-id} |
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++---------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=====================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+
+.. _create_vnf:
+
+Create VNF
+++++++++++
+
++--------------------+-------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs |
++--------------------+-------------------------------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+-------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|relatedInstance |Object |relatedInstance Object |
++-------------------------+------------------+-------------------------------------------------+
+
+relatedInstance List
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|instanceId |String |instanceId |
++-------------------------+------------------+-------------------------------------------------+
+|modelInfo |Object |Content of modelInfo object. |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|UserParams |Array |The product family Id. |
++-------------------------+------------------+-------------------------------------------------+
+
+UserParams Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|name |String |Tag name of attribute |
++-------------------------+------------------+-------------------------------------------------+
+|value |String |Value of the tag |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _delete_vnf:
+
+Delete VNF
+++++++++++
+
++--------------------+-----------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================================+
+|URI |/onap/so/infra/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId} |
++--------------------+-----------------------------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+-----------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-----------------------------------------------------------------------------------------------------+
+
+Request Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++---------------------+-------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=====================+=========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++---------------------+-------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++---------------------+-------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+
+CloudConfiguration Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|tenantId |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|UserParams |Array |The product family Id. |
++-------------------------+------------------+-------------------------------------------------+
+
+UserParams Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|name |String |Tag name of attribute |
++-------------------------+------------------+-------------------------------------------------+
+|value |String |Value of the tag |
++-------------------------+------------------+-------------------------------------------------+
+
+.. _get_orchestration_request_by_id:
+
+GET Orchestration Request
++++++++++++++++++++++++++
+
++--------------------+-------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================+
+|URI |/onap/so/infra/orchestrationRequests/v6/{request-id} |
++--------------------+-------------------------------------------------------------------------------------+
+|Operation Type |GET |
++--------------------+-------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-------------------------------------------------------------------------------------+
+
+Response Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|request |M |1 |request Object |Content of request object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+Request Object
+
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++===================+=========+===========+==========================+===========================================+
+|requestId |M |1 |String |Request Id |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|startTime |M |1 |request Object |Start time. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestScope |M |1 |request Object |Scope of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestType |M |1 |request Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestDetails |M |1 |requestDetails Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestStatus |M |1 |requestStatus Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+SubscriberInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|GlobalSubscriberId |String |Global customer Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|SubscriberName |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|SubscriptionServiceType |String |The service type of the Subscription |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestStatus Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|finishTime |String |Time |
++-------------------------+------------------+-------------------------------------------------+
+|requestState |String |state of the request |
++-------------------------+------------------+-------------------------------------------------+
+|statusMessage |String |statusMessage |
++-------------------------+------------------+-------------------------------------------------+
+|percentProgress |String |percentage of progress |
++-------------------------+------------------+-------------------------------------------------+
+
+
+.. _get_orchestration_request_all:
+
+GET Orchestration Requests
+++++++++++++++++++++++++++
+
++--------------------+--------------------------------------------------------------+
+|Interface Definition|Description |
++====================+==============================================================+
+|URI |/onap/so/infra/orchestrationRequests/v6 |
++--------------------+--------------------------------------------------------------+
+|Operation Type |GET |
++--------------------+--------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------------+
+
+Response Body:
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|requestList |M |1 |Array |Content of request List. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestList :
+
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++================+=========+===========+==========================+===========================================+
+|request |M |1 |request Object |Content of request object. |
++----------------+---------+-----------+--------------------------+-------------------------------------------+
+
+Request Object
+
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|Attribute |Qualifier|Cardinality|Content |Description |
++===================+=========+===========+==========================+===========================================+
+|requestId |M |1 |String |Request Id. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|startTime |M |1 |request Object |Start time. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestScope |M |1 |request Object |Scope of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestType |M |1 |request Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestDetails |M |1 |requestDetails Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+|requestStatus |M |1 |requestStatus Object |Type of the request. |
++-------------------+---------+-----------+--------------------------+-------------------------------------------+
+
+RequestDetails Object
+
++-------------------+--------------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++===================+==========================+=================================================+
+|modelInfo |modelInfo Object |Content of modelInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|subscriberInfo |subscriberInfo Object |Content of subscriberInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestInfo |requestInfo Object |Content of requestInfo object. |
++-------------------+--------------------------+-------------------------------------------------+
+|requestParameters |requestParameters Object |Content of requestParameters object. |
++-------------------+--------------------------+-------------------------------------------------+
+|relatedInstanceList|relatedInstanceList Object|Content of relatedInstanceList object. |
++-------------------+--------------------------+-------------------------------------------------+
+|cloudConfiguration |cloudConfiguration Object |Content of cloudConfiguration object. |
++-------------------+--------------------------+-------------------------------------------------+
+|project |project Object |Content of project object. |
++-------------------+--------------------------+-------------------------------------------------+
+|owningEntity |owningEntity Object |Content of owningEntity object. |
++-------------------+--------------------------+-------------------------------------------------+
+|platform |platform Object |Content of platform object. |
++-------------------+--------------------------+-------------------------------------------------+
+|lineOfBusiness |lineOfBusiness Object |Content of lineOfBusiness object. |
++-------------------+--------------------------+-------------------------------------------------+
+
+ModelInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|ModelType |String |Type of model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelInvariantId |String |The Model Invariant Id. |
++-------------------------+------------------+-------------------------------------------------+
+|ModelNameVersionId |String |The modelname Version Id |
++-------------------------+------------------+-------------------------------------------------+
+|ModelName |String |Name of the Model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelVersion |String |Version of the model |
++-------------------------+------------------+-------------------------------------------------+
+|ModelCustomization Name |String |The Model Customization name |
++-------------------------+------------------+-------------------------------------------------+
+|modelCustomizationUuid |String |The Model Customization UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelVersionId |String |The Model version id |
++-------------------------+------------------+-------------------------------------------------+
+|modelUuid |String |The Model UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInvariantUuid |String |The Model Invariant UUid |
++-------------------------+------------------+-------------------------------------------------+
+|modelInstanceName |String |The Model Instance name |
++-------------------------+------------------+-------------------------------------------------+
+
+SubscriberInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|GlobalSubscriberId |String |Global customer Id (in A&AI) |
++-------------------------+------------------+-------------------------------------------------+
+|SubscriberName |String |Name of the Subscriber |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestInfo Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|Source |String |source of the request |
++-------------------------+------------------+-------------------------------------------------+
+|billingAccountNumber |String |billingAccountNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|callbackUrl |String |callbackUrl of the request |
++-------------------------+------------------+-------------------------------------------------+
+|correlator |String |correlator of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderNumber |String |orderNumber of the request |
++-------------------------+------------------+-------------------------------------------------+
+|productFamilyId |String |productFamilyId of the request |
++-------------------------+------------------+-------------------------------------------------+
+|orderVersion |String |orderVersion of the request |
++-------------------------+------------------+-------------------------------------------------+
+|instanceName |String |instanceName of the request |
++-------------------------+------------------+-------------------------------------------------+
+|suppressRollback |String |suppressRollback of the request |
++-------------------------+------------------+-------------------------------------------------+
+|requestorId |String |requestorId of the request |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestParameters Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|SubscriptionServiceType |String |The service type of the Subscription |
++-------------------------+------------------+-------------------------------------------------+
+
+RequestStatus Object
+
++-------------------------+------------------+-------------------------------------------------+
+|Attribute |Content |Description |
++=========================+==================+=================================================+
+|finishTime |String |Time |
++-------------------------+------------------+-------------------------------------------------+
+|requestState |String |state of the request |
++-------------------------+------------------+-------------------------------------------------+
+|statusMessage |String |statusMessage |
++-------------------------+------------------+-------------------------------------------------+
+|percentProgress |String |percentage of progress |
++-------------------------+------------------+-------------------------------------------------+
diff --git a/docs/api/offered_consumed_apis.rst b/docs/api/offered_consumed_apis.rst
index 0caef0a426..1d0a8f005b 100644
--- a/docs/api/offered_consumed_apis.rst
+++ b/docs/api/offered_consumed_apis.rst
@@ -3,7 +3,7 @@
.. Copyright 2018 Huawei Technologies Co., Ltd.
SO Offered and Consumed APIs
-=====================================
+============================
The list of APIs that SO offers can be found in following table:
@@ -22,8 +22,9 @@ The list of APIs that SO offers can be found in following table:
"swagger json file", "html doc", "yaml doc"
":download:`link <swagger/swagger.json>`", ":download:`link <swagger/swagger.html>`", ":download:`link <swagger/swagger.yaml>`"
-
-The list of APIs that SO offerers for monitroing the BPMN flows could be found in the following table:
+
+The list of APIs that SO offerers for monitoring the BPMN flows
+could be found in the following table:
.. csv-table::
:header: "|Swagger-icon|", "|yml-icon|"
@@ -33,11 +34,13 @@ The list of APIs that SO offerers for monitroing the BPMN flows could be found i
":download:`link <swagger/SO_MONITORING_SWAGGER.json>`", ":download:`link <swagger/SO_MONITORING_SWAGGER.yaml>`"
Further Reading
-----------------------------------------
+---------------
Detailed documentation can be found here:
.. toctree::
:maxdepth: 1
- apis/SO_Interface.rst \ No newline at end of file
+ apis/serviceInstances-api.rst
+ apis/e2eServiceInstances-api.rst
+ apis/consumed-apis.rst
diff --git a/docs/architecture/architecture.rst b/docs/architecture/architecture.rst
index 52eb38cfe4..7636792c41 100644
--- a/docs/architecture/architecture.rst
+++ b/docs/architecture/architecture.rst
@@ -3,10 +3,10 @@
.. Copyright 2018 Huawei Technologies Co., Ltd.
SO - Architecture
-===============
+=================
SO Functional View
---------------------
+------------------
.. image:: ../images/SO_Architecture_1.png
@@ -21,9 +21,9 @@ SO Sub-Components
**API Handler**
RESTful interface to northbound clients
-
- * Handle service-level and infrastructure (VNF & network) requests
-
+
+* Handle service-level and infrastructure (VNF & network) requests
+
Service-agnostic APIs
* “Service Instantiation API”
@@ -31,7 +31,7 @@ SO Sub-Components
* Use SO Catalog to map input requests to BPMN flows
* Dynamic lookup based on service-model + action
* Input data forwarded to BPMN flow
-
+
Track open and completed requests via SO Request DB
Multiple API-H modules may support different APIs
@@ -49,7 +49,7 @@ SO Sub-Components
* Request and configure network resources via SDN-C
* Manage cloud resources via PO (OpenStack)
* Update inventory via A&AI
-
+
Perform error handling/rollback
**Resource Adapters**
@@ -59,7 +59,7 @@ SO Sub-Components
* Hides the details of complex interfaces (e.g. OpenStack APIs)
* Expose interfaces to BPMN flows as SOAP or REST APIs
* Support synchronous and asynchronous operations
-
+
Provided as part of SO platform for use by all BPMN flows
Use SO Catalog to map resource requests to a recipe/template
@@ -69,10 +69,10 @@ SO Sub-Components
* Merge input parameters with templates at run-time
**Data Stores**
-
+
Request DB
* Tracks open and completed requests
-
+
SO Catalog
* SO view of the SDC Catalog
* service and resource models, recipes, and templates
@@ -81,13 +81,13 @@ SO Sub-Components
Camunda DB
* Maintain state for BPMN flows
* Supports multiple active engines
-
+
**SDC Distribution Client**
Receive updated service models from SDC
* Event-bus notifications when new models available
* HTTP retrieval of models (TOSCA) and artifacts (Heat)
-
+
Receive distributions as TOSCA models
Populate SO Catalog
@@ -119,11 +119,3 @@ Third Party and Open Source
Tomcat
MySQL/MariaDB
Openstack Java SDK (“woorea”)
-
-
-
-
-
-
-
-
diff --git a/docs/bak/Developer_Info.rst b/docs/bak/Developer_Info.rst
new file mode 100644
index 0000000000..9d9c46c4c2
--- /dev/null
+++ b/docs/bak/Developer_Info.rst
@@ -0,0 +1,14 @@
+\installconfigure.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2018 Huawei Technologies Co., Ltd.
+
+Developer Information
+======================
+
+.. toctree::
+ :maxdepth: 1
+
+ ../installconfigure/Install_Configure_SO.rst
+ ../architecture/architecture.rst
+
+ \ No newline at end of file
diff --git a/docs/installation.rst b/docs/bak/installation.rst
index cde26e021a..cde26e021a 100644
--- a/docs/installation.rst
+++ b/docs/bak/installation.rst
diff --git a/docs/developer_info/developer_information.rst b/docs/developer_info/developer_information.rst
index f6d66b913d..10ea8360b9 100644
--- a/docs/developer_info/developer_information.rst
+++ b/docs/developer_info/developer_information.rst
@@ -8,12 +8,15 @@ SO Developer Information
.. toctree::
:maxdepth: 1
- Camunda_Modeler.rst
+
Building_SO.rst
Working_with_SO_Docker.rst
Camunda_Cockpit_Community_Edition.rst
Camunda_Cockpit_Enterprise_Edition.rst
-.. developer_info_Project_Structure.rst
-.. developer_info_Main_Process_Flows.rst
-.. developer_info_Subprocess_Process_Flows.rst
-.. developer_info_Project_Deployment_Strategy.rst \ No newline at end of file
+ Camunda_Modeler.rst
+ BPMN_Project_Structure.rst
+ BPMN_Main_Process_Flows.rst
+ BPMN_Subprocess_Process_Flows.rst
+ BPMN_Project_Deployment_Strategy.rst
+ instantiate/index.rst
+ FAQs.rst
diff --git a/docs/developer_info/instantiate/index.rst b/docs/developer_info/instantiate/index.rst
new file mode 100644
index 0000000000..21177b59ad
--- /dev/null
+++ b/docs/developer_info/instantiate/index.rst
@@ -0,0 +1,31 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2017 AT&T Intellectual Property. All rights reserved.
+
+
+Instantiate
+===========
+The following guides are provided to describe tasks that a user of
+ONAP may need to perform when instantiating a service.
+
+Instantiation includes the following topics:
+
+.. toctree::
+ :maxdepth: 2
+
+ Pre-instantiation operations <./pre_instantiation/index.rst>
+
+ Instantiation operation(s) <./instantiation/index.rst>
+
+
+**e2eServiceInstance** method is a hard-coded approach with dedicated/specific
+service BPMN workflow. That means it is linked to ONAP source code
+and lifecycle.
+
+**A La Carte** method requires the Operations actor to build and send
+a lot of operations. To build those requests, Operator actor needs to
+define/collect by himself all VNF parameters/values.
+
+**Macro** method required the Operations actor to build and send only one
+request and, thanks to CDS Blueprint templates, ONAP will collect and assign
+all required parameters/values by itself.
diff --git a/docs/developer_info/instantiate/instantiation/index.rst b/docs/developer_info/instantiate/instantiation/index.rst
new file mode 100644
index 0000000000..455bdf070e
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/index.rst
@@ -0,0 +1,28 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst:
+
+
+Service Instantiation methods
+=============================
+
+
+Declare PNF instances:
+
+.. toctree::
+ :maxdepth: 2
+
+ Declare PNF instances <./pnf_instance/index.rst>
+
+Instantiate a Service:
+
+.. toctree::
+ :maxdepth: 2
+
+ using ONAP VID Portal with "A La Carte" method <./vid/index.rst>
+ using ONAP UUI Portal with "e2eServiceInstance" method <./uui/index.rst>
+ using ONAP NBI REST API (TM Forum) <./nbi/index.rst>
+ using ONAP SO REST API with "A La Carte" method <./so1/index.rst>
+ using ONAP SO REST API with "Macro" mode method <./so2/index.rst>
diff --git a/docs/developer_info/instantiate/instantiation/nbi/index.rst b/docs/developer_info/instantiate/instantiation/nbi/index.rst
new file mode 100644
index 0000000000..96bbc3a8dd
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/nbi/index.rst
@@ -0,0 +1,97 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst_nbi:
+
+
+Service Instantiation via ONAP NBI API (TM Forum)
+=================================================
+
+ONAP NBI allow you to use a TM Forum standardized API (serviceOrder API)
+
+Additional info in:
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ NBI Guide <../../../../../submodules/externalapi/nbi.git/docs/offeredapis/offeredapis.rst>
+
+
+ONAP NBI will convert that request to ONAP SO request.
+
+
+ServiceOrder management in NBI will support 2 modes:
+
+* E2E integration - NBI calls SO API to perform an End-To-end integration
+* Service-level only integration - NBI will trigger only SO request at
+ serviceInstance level (not at VNF, not at Vf-module level and nothing will
+ be created on cloud platform)
+
+ONAP SO prerequisite: SO must be able to find a BPMN to process service
+fulfillment (integrate VNF, VNF activation in SDNC, VF module)
+
+The choice of the mode is done by NBI depending on information retrieved
+in SDC. If the serviceSpecification is within a Category "E2E Service" ,
+NBI will use E2E SO API, if not only API at service instance level
+will be used.
+
+There is no difference or specific expectation in the service order API
+used by NBI user.
+
+
+Example of serviceOrder to instantiate (=add) a service based on model
+with id=0d463b0c-e559-4def-8d7b-df64cfbd3159
+
+
+::
+
+ curl -X POST \
+ http://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/serviceOrder \
+ -H 'Accept: application/json' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "externalId": "BSS_order_001",
+ "priority": "1",
+ "description": "this is a service order to instantiate a service",
+ "category": "Consumer",
+ "requestedStartDate": "",
+ "requestedCompletionDate": "",
+ "relatedParty": [
+ {
+ "id": "JohnDoe",
+ "role": "ONAPcustomer",
+ "name": "JohnDoe"
+ }
+ ],
+ "orderItem": [
+ {
+ "id": "1",
+ "action": "add",
+ "service": {
+ "name": "my_service_model_instance_01",
+ "serviceState": "active",
+ "serviceSpecification": {
+ "id": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ }
+ ]
+ }'
+
+In the response, you will obtain the serviceOrderId value.
+
+Then you have the possibility to check about the serviceorder
+(here after the serviceOrderId=5d06309da0e46400017b1123).
+
+This will allow you to get the serviceOrder Status (completed, failed...)
+
+::
+
+ curl -X GET \
+ http://nbi.api.simpledemo.onap.org:30274/nbi/api/v4/serviceOrder/5d06309da0e46400017b1123 \
+ -H 'Accept: application/json' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache'
diff --git a/docs/developer_info/instantiate/instantiation/pnf_instance/index.rst b/docs/developer_info/instantiate/instantiation/pnf_instance/index.rst
new file mode 100644
index 0000000000..7fbfdbe79f
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/pnf_instance/index.rst
@@ -0,0 +1,107 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+
+
+Declare PNF instances in ONAP
+=============================
+
+PNF instances can be declared in ONAP inventory (AAI) using REST API
+
+
+An example:
+
+::
+
+ curl -X PUT \
+ https://{{ONAP_LB_IP@}}:30233/aai/v16/network/pnfs/pnf/my_pnf_instance_001 \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Cache-Control: no-cache' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: f5e2aae0-dc1c-4edb-b9e9-a93b05aee5e8' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 999' \
+ -H 'depth: all' \
+ -d '{
+ "pnf-name":" my_pnf_instance_001",
+ "equip-type":" router",
+ "nf-role":"primary",
+ "p-interfaces": {
+ "p-interface": [
+ {
+ "interface-name": "ae1",
+ "port-description": "Link aggregate for trunk between switches"
+ },
+ {
+ "interface-name": "xe-0/0/6",
+ "port-description": "to PNF_instance_002 trunk1"
+ },
+ {
+ "interface-name": "xe-0/0/2",
+ "port-description": "to PNF_instance_003 trunk1"
+ },
+ {
+ "interface-name": "xe-0/0/10",
+ "port-description": "to PNF_instance_004 trunk1"
+ },
+ {
+ "interface-name": "xe-0/0/0",
+ "port-description": "firewall trunk"
+ },
+ {
+ "interface-name": "xe-0/0/14",
+ "port-description": "to PNF_instance_005 trunk1"
+ }
+ ]
+ }
+ }' -k
+
+
+It is possible to declare the location where is deployed the PNF
+(called a "complex" in ONAP AAI)
+
+::
+
+ curl -X PUT \
+ https:// {{ONAP_LB_IP@}}:30233/aai/v11/cloud-infrastructure/complexes/complex/my_complex_name \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Cache-Control: no-cache' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: 43523984-db01-449a-8a58-8888871110bc' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 999' \
+ -H 'depth: all' \
+ -d '{
+ "physical-location-type":"PoP",
+ "physical-location-id":"my_complex_name",
+ "complex-name":"Name of my Complex",
+ "city":"LANNION",
+ "postal-code":"22300",
+ "country":"FRANCE",
+ "street1":"Avenue Pierre Marzin",
+ "region":"Europe"
+ }' -k
+
+
+
+To indicate that a PNF instance is located in a complex, we create a relation
+
+::
+
+ curl -X PUT \
+ https:// {{ONAP_LB_IP@}}:30233/aai/v14/network/pnfs/pnf/my_pnf_instance_001/relationship-list/relationship \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Cache-Control: no-cache' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: 15315304-17c5-4e64-aada-bb149f1af915' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 999' \
+ -H 'depth: all' \
+ -d '{
+ "related-to": "complex",
+ "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/my_complex_name"
+ }' -k
diff --git a/docs/developer_info/instantiate/instantiation/so1/index.rst b/docs/developer_info/instantiate/instantiation/so1/index.rst
new file mode 100644
index 0000000000..86f03bdd38
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/so1/index.rst
@@ -0,0 +1,366 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst_so1:
+
+
+A La Carte mode Service Instantiation via ONAP SO API
+=====================================================
+
+Using ONAP SO API in "A La Carte" mode, you need to send several requests,
+depending on the service model composition.
+
+For example, if your service model is composed of 2 VNF and a Network,
+you will have to build and send :
+
+* a request to SO to create the "service instance" object
+* a request to SO to create the VNF 1 instance object
+* a request to SDNC to declare VNF 1 instance parameters and values
+ (SDNC preload)
+* a request to SO to create the Vf-module 1 instance object
+* a request to SO to create the VNF 2 instance object
+* a request to SDNC to declare VNF 2 instance parameters and values
+ (SDNC preload)
+* a request to SO to create the Vf-module 2 instance object
+* a request to SO to create the Network instance object
+
+
+
+Example to request a service instance directly to ONAP SO
+
+
+TO BE COMPLETED
+
+
+
+In the response, you will obtain the serviceOrderId value.
+
+Then you have the possibility to check about the SO request
+(here after the requestId=e3ad8df6-ea0d-4384-be95-bcb7dd39bbde).
+
+This will allow you to get the serviceOrder Status (completed, failed...)
+
+::
+
+ curl -X GET \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/orchestrationRequests/v6/e3ad8df6-ea0d-4384-be95-bcb7dd39bbde \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache'
+
+
+To instantiate a VNF, you need to build a complex request.
+All necessary parameters are available in the Tosca service template
+generated by SDC when you defined your service model.
+
+::
+
+ curl -X POST \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/vnfs \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "requestInfo": {
+ "productFamilyId": "0d463b0c-e559-4def-8d7b-df64cfbd3159",
+ "instanceName": "my_service_vnf_instance_001",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "test"
+ },
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "4e66bb92-c597-439e-822d-75aaa69b13d4",
+ "modelVersionId": "3b6ba59c-287c-449e-a1da-2db49984a087",
+ "modelName": "my_service_VF",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "",
+ "modelCustomizationName": ""
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "VNF_API"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "my_cloud_site",
+ "tenantId": "5906b9b8fd9642df9ba1c9e290063439"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "test_LOB"
+ },
+ "platform": {
+ "platformName": "test_platform"
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "95762b50-0244-4723-8fde-35f911db9263",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "my-service-model",
+ "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da",
+ "modelVersion": "1.0",
+ "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ }]
+ }
+ }'
+
+To instantiate a VF module, you need to build two complex requests
+All necessary parameters are available in the Tosca service template
+generated by SDC when you defined your service model.
+
+1st request is called a "SDNC-preload" for a VNF object and is used
+to store in SDNC some VNF parameters values
+that will be needed for the instantiation
+
+::
+
+ curl -X POST \
+ http://sdnc.api.simpledemo.onap.org:30202/restconf/operations/VNF-API:preload-vnf-topology-operation \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: API client' \
+ -H 'X-TransactionId: 0a3f6713-ba96-4971-a6f8-c2da85a3176e' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "input": {
+ "request-information": {
+ "notification-url": "onap.org",
+ "order-number": "1",
+ "order-version": "1",
+ "request-action": "PreloadVNFRequest",
+ "request-id": "test"
+ },
+ "sdnc-request-header": {
+ "svc-action": "reserve",
+ "svc-notification-url": "http:\/\/onap.org:8080\/adapters\/rest\/SDNCNotify",
+ "svc-request-id": "test"
+ },
+ "vnf-topology-information": {
+ "vnf-assignments": {
+ "availability-zones": [],
+ "vnf-networks": [],
+ "vnf-vms": []
+ },
+ "vnf-parameters": [],
+ "vnf-topology-identifier": {
+ "generic-vnf-name": "my_service_vnf_instance_001",
+ "generic-vnf-type": "",
+ "service-type": "95762b50-0244-4723-8fde-35f911db9263",
+ "vnf-name": "my_service_vfmodule_001",
+ "vnf-type": ""
+ }
+ }
+ }
+ }'
+
+The 2nd request is to instantiate the VF module via ONAP SO
+(instance name must be identical in both requests)
+
+::
+
+ curl -X POST \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/vnfs/vfModules \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "requestInfo": {
+ "instanceName": "my_vfmodule_001",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "test"
+ },
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelInvariantId": "",
+ "modelVersionId": "",
+ "modelName": "",
+ "modelVersion": "1",
+ "modelCustomizationId": "",
+ "modelCustomizationName": ""
+ },
+ "requestParameters": {
+ "userParams": [],
+ "testApi": "VNF_API",
+ "usePreload": true
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "my_cloud_site",
+ "tenantId": "5906b9b8fd9642df9ba1c9e290063439"
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "95762b50-0244-4723-8fde-35f911db9263",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "my-service-model",
+ "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da",
+ "modelVersion": "1.0",
+ "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelName": "my_service_model_VF",
+ "modelInvariantId": "4e66bb92-c597-439e-822d-75aaa69b13d4",
+ "modelVersion": "1.0",
+ "modelVersionId": "3b6ba59c-287c-449e-a1da-2db49984a087",
+ "modelCustomizationId": "",
+ "modelCustomizationName": ""
+ }
+ }
+ }]
+ }
+ }'
+
+
+
+To instantiate a Neutron Network, you need to build two complex request.
+All necessary parameters are available in the Tosca service template
+generated by SDC when you defined your service model.
+
+
+1st request is the "SDNC-preload" for a network object:
+
+::
+
+ curl -X POST \
+ http://sdnc.api.simpledemo.onap.org:30202/restconf/operations/VNF-API:preload-network-topology-operation \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: API client' \
+ -H 'X-TransactionId: 0a3f6713-ba96-4971-a6f8-c2da85a3176e' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "input": {
+ "request-information": {
+ "request-id": "postman001",
+ "notification-url": "http://so.onap.org",
+ "order-number": "postman001",
+ "request-sub-action": "SUPP",
+ "request-action": "PreloadNetworkRequest",
+ "source": "postman",
+ "order-version": "1.0"
+ },
+ "network-topology-information": {
+ "network-policy": [],
+ "route-table-reference": [],
+ "vpn-bindings": [],
+ "network-topology-identifier": {
+ "network-role": "integration_test_net",
+ "network-technology": "neutron",
+ "service-type": "my-service-2",
+ "network-name": "my_network_01",
+ "network-type": "Generic NeutronNet"
+ },
+ "provider-network-information": {
+ "is-external-network": "false",
+ "is-provider-network": "false",
+ "is-shared-network": "false"
+ },
+ "subnets": [
+ {
+ "subnet-name": "my_subnet_01",
+ "subnet-role": "OAM",
+ "start-address": "192.168.90.0",
+ "cidr-mask": "24",
+ "ip-version": "4",
+ "dhcp-enabled": "Y",
+ "dhcp-start-address": "",
+ "dhcp-end-address": "",
+ "gateway-address": "192.168.90.1",
+ "host-routes":[]
+ }
+ ]
+ },
+ "sdnc-request-header": {
+ "svc-action": "reserve",
+ "svc-notification-url": "http://so.onap.org",
+ "svc-request-id": "postman001"
+ }
+ }
+ }'
+
+
+2nd request is to instantiate the network via ONAP SO
+(instance name must be identical in both requests)
+
+
+::
+
+ curl -X POST \
+ http://so.api.simpledemo.onap.org:30277/onap/so/infra/serviceInstances/v6/95762b50-0244-4723-8fde-35f911db9263/networks \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: get_aai_subscr' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "requestInfo": {
+ "instanceName": "my_network_01",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "demo",
+ "productFamilyId": "b9ac88f7-0e1b-462d-84ac-74c3c533217c"
+ },
+ "modelInfo": {
+ "modelType": "network",
+ "modelInvariantId": "0070b65c-48cb-4985-b4df-7c67ca99cd95",
+ "modelVersionId": "4f738bed-e804-4765-8d22-07bb4d11f14b",
+ "modelName": "Generic NeutronNet",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "95534a95-dc8d-4ffb-89c7-091e2c49b55d",
+ "modelCustomizationName": "Generic NeutronNet 0"
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "VNF_API"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "my_cloud_site",
+ "tenantId": "5906b9b8fd9642df9ba1c9e290063439"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "Test_LOB"
+ },
+ "platform": {
+ "platformName": "Test_platform"
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "95762b50-0244-4723-8fde-35f911db9263",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "my_service_model_name",
+ "modelInvariantId": "11265d8c-2cc2-40e5-95d8-57cad81c18da",
+ "modelVersion": "1.0",
+ "modelVersionId": "0d463b0c-e559-4def-8d7b-df64cfbd3159"
+ }
+ }
+ }]
+ }
+ }'
diff --git a/docs/developer_info/instantiate/instantiation/so2/index.rst b/docs/developer_info/instantiate/instantiation/so2/index.rst
new file mode 100644
index 0000000000..02a5f70d3c
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/so2/index.rst
@@ -0,0 +1,197 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_ser_inst_so2:
+
+
+Macro mode Service Instantiation via ONAP SO API
+================================================
+
+Using Macro mode, you have to build and send only one request to ONAP SO
+
+In that request you need to indicate all object instances
+that you want to be instantiated.
+
+Reminder : ONAP SO in Macro mode will perform the VNF parameters/values
+assignment based on CDS Blueprint templates
+that are supposed to be defined during Design and Onboard steps.
+That means ONAP has all information
+to be able to get all necessary values by itself (there is no longer need
+for an Operator to provide "SDNC preload").
+
+Additional info in:
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ CDS Documentation <../../../../../submodules/ccsdk/cds.git/docs/index.rst>
+ CDS vDNS E2E Automation <https://wiki.onap.org/display/DW/vDNS+CDS+Dublin>
+
+
+Request Example :
+
+::
+
+ curl -X POST \
+ 'http://{{k8s}}:30277/onap/so/infra/serviceInstantiation/v7/serviceInstances' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "requestDetails": {
+ "subscriberInfo": {
+ "globalSubscriberId": "Demonstration"
+ },
+ "requestInfo": {
+ "suppressRollback": false,
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "adt",
+ "instanceName": "{{cds-instance-name}}",
+ "source": "VID"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "fr1",
+ "tenantId": "6270eaa820934710960682c506115453"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "vFW",
+ "userParams": [
+ {
+ "Homing_Solution": "none"
+ },
+ {
+ "service": {
+ "instanceParams": [
+
+ ],
+ "instanceName": "{{cds-instance-name}}",
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "{{vnf-modelinfo-modelcustomizationuuid}}",
+ "modelInstanceName": "{{vnf-modelinfo-modelinstancename}}"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "fr1",
+ "tenantId": "6270eaa820934710960682c506115453"
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "someValue"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "{{vnf-modelinfo-modelinstancename}}",
+ "instanceParams": [
+ {
+ "onap_private_net_id": "olc-private",
+ "onap_private_subnet_id": "olc-private",
+ "pub_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwj7uJMyKiP1ogEsZv5kKDFw9mFNhxI+woR3Tuv8vjfNnqdB1GfSnvTFyNbdpyNdR8BlljkiZ1SlwJLEkvPk0HpOoSVVek/QmBeGC7mxyRcpMB2cNQwjXGfsVrforddXOnOkj+zx1aNdVGMc52Js3pex8B/L00H68kOcwP26BI1o77Uh+AxjOkIEGs+wlWNUmXabLDCH8l8IJk9mCTruKEN9KNj4NRZcaNC+XOz42SyHV9RT3N6efp31FqKzo8Ko63QirvKEEBSOAf9VlJ7mFMrGIGH37AP3JJfFYEHDdOA3N64ZpJLa39y25EWwGZNlWpO/GW5bNjTME04dl4eRyd",
+ "image_name": "Ubuntu 14.04",
+ "flavor_name":"s1.cw.small-1"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-0-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-0-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-0-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-0-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-0-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-1-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-1-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-1-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-1-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-1-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-2-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-2-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-2-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-2-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-2-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "{{vnf-vfmodule-3-modelinfo-modelname}}",
+ "modelVersionId": "{{vnf-vfmodule-3-modelinfo-modeluuid}}",
+ "modelInvariantUuid": "{{vnf-vfmodule-3-modelinfo-modelinvariantuuid}}",
+ "modelVersion": "1",
+ "modelCustomizationId": "{{vnf-vfmodule-3-modelinfo-modelcustomizationuuid}}"
+ },
+ "instanceName": "{{vnf-vfmodule-3-modelinfo-modelname}}",
+ "instanceParams": [
+ {
+ "sec_group": "olc-open",
+ "public_net_id": "olc-net"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "{{service-uuid}}",
+ "modelInvariantId": "{{service-invariantUUID}}",
+ "modelName": "{{service-name}}",
+ "modelType": "service"
+ }
+ }
+ }
+ ],
+ "aLaCarte": false
+ },
+ "project": {
+ "projectName": "Project-Demonstration"
+ },
+ "owningEntity": {
+ "owningEntityId": "24ef5425-bec4-4fa3-ab03-c0ecf4eaac96",
+ "owningEntityName": "OE-Demonstration"
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "{{service-uuid}}",
+ "modelInvariantId": "{{service-invariantUUID}}",
+ "modelName": "{{service-name}}",
+ "modelType": "service"
+ }
+ }
+ }'
diff --git a/docs/developer_info/instantiate/instantiation/uui/index.rst b/docs/developer_info/instantiate/instantiation/uui/index.rst
new file mode 100644
index 0000000000..fa57be2717
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/uui/index.rst
@@ -0,0 +1,14 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+
+e2eServiceInstance mode via ONAP UUI Portal
+===========================================
+
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ ../../../../../submodules/usecase-ui.git/docs/platform/installation/user-guide/index.rst
diff --git a/docs/developer_info/instantiate/instantiation/vid/index.rst b/docs/developer_info/instantiate/instantiation/vid/index.rst
new file mode 100644
index 0000000000..307ceb9819
--- /dev/null
+++ b/docs/developer_info/instantiate/instantiation/vid/index.rst
@@ -0,0 +1,13 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+
+A La Carte mode Service Instantiation via ONAP VID Portal
+=========================================================
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly:
+
+ ../../../../../submodules/vid.git/docs/humaninterfaces.rst
diff --git a/docs/developer_info/instantiate/pre_instantiation/index.rst b/docs/developer_info/instantiate/pre_instantiation/index.rst
new file mode 100644
index 0000000000..ca9af13d7d
--- /dev/null
+++ b/docs/developer_info/instantiate/pre_instantiation/index.rst
@@ -0,0 +1,225 @@
+.. This work is licensed under a Creative Commons Attribution 4.0
+.. International License. http://creativecommons.org/licenses/by/4.0
+.. Copyright 2019 ONAP Contributors. All rights reserved.
+
+.. _doc_guide_user_pre_ser-inst:
+
+
+Pre Service instantiation Operations
+====================================
+
+Several operations need to be performed after Service model distribution,
+but before instantiating a service.
+
+Those operations are only available via REST API requests.
+
+Various tools can be used to send REST API requests.
+
+Here after are examples using "curl" command line tool that you can use in
+a Unix Terminal.
+
+
+Declare owningEntity, lineOfBusiness, Platform and Project
+----------------------------------------------------------
+
+At one point during Service Instantiation, the user need to select values for
+those 4 parameters
+
+* Owning Entity
+* Line Of Business
+* Platform
+* Project
+
+
+Those parameters and values must be pre-declared in ONAP VID component
+using REST API
+
+Those informations will be available to all service instantiation
+(you only need to declare them once in ONAP)
+
+
+Example for "Owning Entity" named "Test"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/owningEntity \
+ -H 'Accept-Encoding: gzip, deflate' \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": ["Test"]
+ }'
+
+Example for "platform" named "Test_Platform"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/platform \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": [""Test_Platform"]
+ }'
+
+Example for "line of business" named "Test_LOB"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/lineOfBusiness \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": ["Test_LOB"]
+ }'
+
+Example for "project" named "Test_project"
+
+::
+
+ curl -X POST \
+ http://vid.api.simpledemo.onap.org:30238/vid/maintenance/category_parameter/project \
+ -H 'Content-Type: application/json' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "options": ["Test_project"]
+ }'
+
+
+
+
+Declare a customer
+------------------
+
+Each time you have a new customer, you will need to perform those operations
+
+This operation is using ONAP AAI REST API
+
+Any service instance need to be linked to a customer
+
+in the query path, you put the customer_name
+
+in the query body you put the customer name again
+
+Here after an example to declare a customer named "my_customer_name"
+
+
+::
+
+ curl -X PUT \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "global-customer-id": "my_customer_name",
+ "subscriber-name": "my_customer_name",
+ "subscriber-type": "INFRA"
+ }' -k
+
+
+check customers in ONAP AAI (you should see if everything ok in the response)
+
+::
+
+ curl -X GET \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' -k
+
+
+Associate Service Model to Customer
+-----------------------------------
+
+
+This operation is using ONAP AAI REST API
+
+in the query path, you put the customer_name and the service model name
+
+in the query body you put the service model UUID
+
+::
+
+ curl -X PUT \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: d4bc4991-a518-4d75-8a87-674ba44bf13a' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "service-id": "11265d8c-2cc2-40e5-95d8-57cad81c18da"
+ }' -k
+
+
+
+
+Associate Cloud Site to Customer
+--------------------------------
+
+in the query path, you put the customer_name and the service model name
+
+in the query body you put the cloud owner name, the cloud site name,
+the tenant id and the tenant name
+
+
+::
+
+ curl -X PUT \
+ https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions/service-subscription/my_service_model_name/relationship-list/relationship \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'Postman-Token: 11ea9a9e-0dc8-4d20-8a78-c75cd6928916' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' \
+ -d '{
+ "related-to": "tenant",
+ "related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/my_cloud_owner_name/my_cloud_site_name/tenants/tenant/234a9a2dc4b643be9812915b214cdbbb",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "my_cloud_owner_name"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "my_cloud_site_name"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "234a9a2dc4b643be9812915b214cdbbb"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "my_tenant_name"
+ }
+ ]
+ }' -k
+
+
+check (you should see if everything ok in the response)
+
+::
+
+ curl -X GET \
+ 'https://aai.api.sparky.simpledemo.onap.org:30233/aai/v16/business/customers/customer/my_customer_name/service-subscriptions?depth=all' \
+ -H 'Accept: application/json' \
+ -H 'Authorization: Basic QUFJOkFBSQ==' \
+ -H 'Content-Type: application/json' \
+ -H 'X-FromAppId: AAI' \
+ -H 'X-TransactionId: 808b54e3-e563-4144-a1b9-e24e2ed93d4f' \
+ -H 'cache-control: no-cache' -k
diff --git a/docs/images/SO_1.png b/docs/images/SO_1.png
index 715801330b..5bdc14644f 100644
--- a/docs/images/SO_1.png
+++ b/docs/images/SO_1.png
Binary files differ
diff --git a/docs/installconfigure/Configure_git_and_gerrit.rst b/docs/installconfigure/Configure_git_and_gerrit.rst
index c4598faf7b..76a4d75331 100644
--- a/docs/installconfigure/Configure_git_and_gerrit.rst
+++ b/docs/installconfigure/Configure_git_and_gerrit.rst
@@ -25,14 +25,14 @@ Enter your SSH public key (id_rsa) into gerrit:
- Log in
- Open the menu next to your name (under the green search button)
-.. image:: images/Configure_git_1.png
+.. image:: ../images/Configure_git_1.png
- Select "Settings"
- In the "Settings" sidebar, click "SSH Public Keys"`
- Click "Add Key..."
- Paste the entire contents of $HOME/.ssh/id_rsa.pub into the text area and click "Add".
-.. image:: images/Configure_git_2.png
+.. image:: ../images/Configure_git_2.png
Install the git-review package.
@@ -90,4 +90,4 @@ Verify that you have connectivity to gerrit through the proxy. Answer "yes" to
ssh -p 29418 gerrit.onap.org
-.. image:: images/Configure_git_3.png
+.. image:: ../images/Configure_git_3.png
diff --git a/docs/installconfigure/Install_Configure_SO.rst b/docs/installconfigure/Install_Configure_SO.rst
index bdfd328fc5..1ac01cc782 100644
--- a/docs/installconfigure/Install_Configure_SO.rst
+++ b/docs/installconfigure/Install_Configure_SO.rst
@@ -3,7 +3,7 @@
.. Copyright 2017 Huawei Technologies Co., Ltd.
SO Install & Configure
-==========================================
+======================
Get Ubuntu
----------
@@ -13,6 +13,7 @@ Get VirtualBox and VirtualBox Guest Additions
---------------------------------------------
Make sure you have the VirtualBox Guest Additions ISO for your version of VirtualBox. I'm using VirtualBox 5.1.28. Save the Guest Additions ISO on your host computer along with the Ubuntu ISO. Get the Guest Additions ISO from here:
http://download.virtualbox.org/virtualbox
+
*NOTE*: Guest Additions versions prior to 5.1 will not work with Ubuntu 16.04.3. If you have an earlier version of VirtualBox, you should upgrade to the latest 5.1 version.
Create a new VM in VirtualBox for Ubuntu
@@ -73,9 +74,11 @@ Read-only: <unchecked>
Install Ubuntu in the VM
------------------------
-On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image". Select your Ubuntu ISO image.
+On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image".
+
+Select your Ubuntu ISO image:
-.. image:: images/Configure_ubuntu_SO_5.png
+.. image:: ../images/Configure_ubuntu_SO_5.png
After selecting the ISO image, start the VM.
@@ -83,14 +86,15 @@ Follow the prompts to install Ubuntu.
Proxy Configuration (optional)
------------------------------
-If you're behind a corporate firewall, configure some proxy settings. NOTE: your proxy configuration may require username and password credentials, not shown here.
+If you're behind a corporate firewall, configure some proxy settings.
+NOTE: your proxy configuration may require username and password credentials, not shown here.
**Ubuntu system proxy setting:**
System Settings → Network → Network proxy
(Replace "proxyhost" and port with your actual proxy information)
-.. image:: images/Configure_ubuntu_SO_6.png
+.. image:: ../images/Configure_ubuntu_SO_6.png
**apt proxy setting:**
Edit /etc/apt/apt.conf and add one line at the top (replace "proxyhost:port" with your actual proxy information):
@@ -117,7 +121,7 @@ Install VirtualBox Guest Additions
----------------------------------
On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image". Select your VirtualBox Guest Additions ISO image.
-.. image:: images/Configure_ubuntu_SO_8.png
+.. image:: ../images/Configure_ubuntu_SO_8.png
In a VM terminal window, mount the cdrom:
@@ -135,7 +139,7 @@ Install necessary dependencies:
Install the guest additions. NOTE: look for errors in the command output! If you see an error that says you are missing kernel headers, the most likely cause is that you are using a VirtualBox version that is too old. The error message is misleading.
-.. code-block:: bash
+ .. code-block:: bash
cd /media/cdrom
sudo ./VBoxLinuxAdditions.run
@@ -161,4 +165,4 @@ Further Reading
Install_Docker.rst
Configure_git_and_gerrit.rst
- Workspace_and_Development_Tools.rst \ No newline at end of file
+ Workspace_and_Development_Tools.rst
diff --git a/docs/installconfigure/Install_Docker.rst b/docs/installconfigure/Install_Docker.rst
index 91e40ca138..d20c2b1951 100644
--- a/docs/installconfigure/Install_Docker.rst
+++ b/docs/installconfigure/Install_Docker.rst
@@ -3,7 +3,7 @@
.. Copyright 2018 Huawei Technologies Co., Ltd.
Install Docker
-===============
+==============
Make sure curl is installed on the Ubuntu VM:
@@ -58,7 +58,7 @@ If you are behind a corporate firewall, you will need to configure proxy setting
Restart docker:
.. code-block:: bash
-
+
sudo systemctl daemon-reload
sudo systemctl restart docker
@@ -82,4 +82,4 @@ Verify that you can download and run the hello-world container
docker run hello-world
-.. image:: images/Docker_install_1.png \ No newline at end of file
+.. image:: ../images/Docker_install_1.png \ No newline at end of file
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index aea1433c9a..3b2649361e 100644
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -17,7 +17,7 @@ Version: 1.4.4
**Dockers released for SO:**
- - onap/so/api-handler-infra,1.4.3
+ - onap/so/api-handler-infra,1.4.4
- onap/so/bpmn-infra,1.4.4
- onap/so/catalog-db-adapter,1.4.4
- onap/so/openstack-adapter,1.4.4
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java
index 8977f11e36..7fb5df7af6 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaResponse.java
@@ -40,6 +40,8 @@ public class CamundaResponse {
@JsonProperty("variables")
private String variables;
+ public CamundaResponse() {}
+
public String getProcessInstanceID() {
return processInstanceID;
}
@@ -56,8 +58,6 @@ public class CamundaResponse {
this.variables = variables;
}
- public CamundaResponse() {}
-
public String getResponse() {
return response;
}
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 d11f1706e9..5dd99f51cd 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
@@ -29,7 +29,6 @@ import java.util.UUID;
import javax.xml.bind.DatatypeConverter;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
@@ -38,8 +37,6 @@ 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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -49,6 +46,9 @@ import com.fasterxml.jackson.databind.SerializationFeature;
public class CamundaClient extends RequestClient {
private static Logger logger = LoggerFactory.getLogger(CamundaClient.class);
private static final String CAMUNDA_URL_MESAGE = "Camunda url is: ";
+ private static final String CAMUNDA_RESPONSE = "Response is: {}";
+ private static final String AUTHORIZATION = "Authorization";
+ private static final String BASIC = "Basic ";
public CamundaClient() {
super(CommonConstants.CAMUNDA);
@@ -57,7 +57,7 @@ public class CamundaClient extends RequestClient {
@Override
public HttpResponse post(String camundaReqXML, String requestId, String requestTimeout, String schemaVersion,
- String serviceInstanceId, String action) throws ClientProtocolException, IOException {
+ String serviceInstanceId, String action) throws IOException {
HttpPost post = new HttpPost(url);
logger.debug(CAMUNDA_URL_MESAGE + url);
String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
@@ -71,7 +71,7 @@ public class CamundaClient extends RequestClient {
setupHeaders(post);
HttpResponse response = client.execute(post);
- logger.debug("Response is: {}", response);
+ logger.debug(CAMUNDA_RESPONSE, response);
return response;
}
@@ -80,52 +80,26 @@ public class CamundaClient extends RequestClient {
private void setupHeaders(HttpPost post) {
post.addHeader(ONAPLogConstants.Headers.REQUEST_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
post.addHeader(ONAPLogConstants.Headers.INVOCATION_ID, UUID.randomUUID().toString());
-
- String encryptedCredentials = null;
- if (props != null) {
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if (encryptedCredentials != null) {
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
- props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if (userCredentials != null) {
- post.addHeader("Authorization",
- "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
- }
- }
- }
+ addAuthorizationHeader(post);
}
@Override
- public HttpResponse post(String jsonReq) throws ClientProtocolException, IOException {
+ public HttpResponse post(String jsonReq) throws IOException {
HttpPost post = new HttpPost(url);
logger.debug(CAMUNDA_URL_MESAGE + url);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
setupHeaders(post);
-
- String encryptedCredentials = null;
- if (props != null) {
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if (encryptedCredentials != null) {
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
- props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if (userCredentials != null) {
- post.addHeader("Authorization",
- "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
- }
- }
- }
-
-
+ addAuthorizationHeader(post);
post.setEntity(input);
HttpResponse response = client.execute(post);
- logger.debug("Response is: {}", response);
+ logger.debug(CAMUNDA_RESPONSE, response);
return response;
}
- public HttpResponse post(RequestClientParameter parameterObject) throws ClientProtocolException, IOException {
+ public HttpResponse post(RequestClientParameter parameterObject) throws IOException {
HttpPost post = new HttpPost(url);
logger.debug(CAMUNDA_URL_MESAGE + url);
String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(),
@@ -140,26 +114,11 @@ public class CamundaClient extends RequestClient {
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
-
-
setupHeaders(post);
-
- String encryptedCredentials = null;
- if (props != null) {
- encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
- if (encryptedCredentials != null) {
- String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
- props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
- if (userCredentials != null) {
- post.addHeader("Authorization",
- "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
- }
- }
- }
-
+ addAuthorizationHeader(post);
post.setEntity(input);
HttpResponse response = client.execute(post);
- logger.debug("Response is: {}", response);
+ logger.debug(CAMUNDA_RESPONSE, response);
return response;
}
@@ -200,8 +159,7 @@ public class CamundaClient extends RequestClient {
jsonReq = mapper.writeValueAsString(camundaRequest);
logger.trace("request body is {}", jsonReq);
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest",
- ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ logger.error("Error in APIH Warp request", e);
}
return jsonReq;
}
@@ -239,7 +197,6 @@ public class CamundaClient extends RequestClient {
CamundaInput recipeParamsInput = new CamundaInput();
CamundaInput instanceGroupIdInput = new CamundaInput();
- // host.setValue(parseURL());
requestIdInput.setValue(StringUtils.defaultString(requestId));
isBaseVfModuleInput.setValue(isBaseVfModule);
recipeTimeoutInput.setValue(recipeTimeout);
@@ -292,8 +249,7 @@ public class CamundaClient extends RequestClient {
jsonReq = mapper.writeValueAsString(camundaRequest);
logger.trace("request body is {}", jsonReq);
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
- ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ logger.error("Error in APIH Warp request", e);
}
return jsonReq;
}
@@ -309,4 +265,19 @@ public class CamundaClient extends RequestClient {
}
return host;
}
+
+ private void addAuthorizationHeader(HttpPost post) {
+ String encryptedCredentials;
+ if (props != null) {
+ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
+ if (encryptedCredentials != null) {
+ String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH,
+ props.getProperty(CommonConstants.ENCRYPTION_KEY_PROP));
+ if (userCredentials != null) {
+ post.addHeader(AUTHORIZATION,
+ BASIC + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ }
+ }
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java
index 468fe61562..7400c0aaae 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ErrorNumbers.java
@@ -22,8 +22,6 @@ package org.onap.so.apihandler.common;
public final class ErrorNumbers {
- private ErrorNumbers() {}
-
public static final String REQUEST_FAILED_SCHEMA_VALIDATION = "1000";
public static final String RECIPE_DOES_NOT_EXIST = "1010";
public static final String VFMODULE_TYPE_DOES_NOT_EXIST = "1011";
@@ -73,4 +71,6 @@ public final class ErrorNumbers {
public static final String SVC_NO_SERVER_RESOURCES = "SVC1000";
public static final String SVC_DETAILED_SERVICE_ERROR = "SVC2000";
+ private ErrorNumbers() {}
+
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
index ad8cc3f250..e2ea021811 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
@@ -52,7 +52,7 @@ public class PathResourceResolver implements LSResourceResolver {
try {
stream = new FileInputStream(path + systemId);
} catch (FileNotFoundException e) {
- logger.debug("Could not resolve resource based on file: {}", path + systemId, e);
+ logger.debug("Could not resolve resource based on file: ", e);
}
input.setPublicId(publicId);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
index 0aac35d5a9..318b3ba5af 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
@@ -25,7 +25,6 @@ package org.onap.so.apihandler.common;
import java.io.IOException;
import java.security.GeneralSecurityException;
import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
@@ -70,33 +69,18 @@ public abstract class RequestClient {
public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion,
String serviceInstanceId, String action) throws IOException;
- public abstract HttpResponse post(String request) throws ClientProtocolException, IOException;
+ public abstract HttpResponse post(String request) throws IOException;
- public abstract HttpResponse post(RequestClientParameter parameterObject)
- throws ClientProtocolException, IOException;
+ public abstract HttpResponse post(RequestClientParameter parameterObject) throws IOException;
public abstract HttpResponse get() throws IOException;
- protected String decryptPropValue(String prop, String defaultValue, String encryptionKey) {
- try {
- String result = CryptoUtils.decrypt(prop, encryptionKey);
- return result;
- } catch (GeneralSecurityException e) {
- logger.debug("Security exception", e);
- }
- return defaultValue;
- }
-
protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) {
try {
- String result = CryptoUtils.decrypt(prop, encryptionKey);
- return result;
+ return CryptoUtils.decrypt(prop, encryptionKey);
} catch (GeneralSecurityException e) {
logger.debug("Security exception", e);
}
return defaultValue;
}
-
-
-
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java
index 4149d5ee45..c2ffa7e004 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientFactory.java
@@ -4,6 +4,9 @@
* ================================================================================
* 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
@@ -20,9 +23,7 @@
package org.onap.so.apihandler.common;
-
-
-import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -34,7 +35,7 @@ public class RequestClientFactory {
private Environment env;
// based on URI, returns BPEL, CamundaTask or Camunda client
- public RequestClient getRequestClient(String orchestrationURI) throws IllegalStateException {
+ public RequestClient getRequestClient(String orchestrationURI) {
RequestClient retClient;
String url;
@@ -45,7 +46,7 @@ public class RequestClientFactory {
url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
retClient = new CamundaClient();
}
- retClient.setClient(new DefaultHttpClient());
+ retClient.setClient(HttpClientBuilder.create().build());
retClient.setProps(env);
retClient.setUrl(url);
return retClient;
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 fff4c1d508..095182fe98 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
@@ -80,12 +80,8 @@ public class ResponseHandler {
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)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw new ValidateException.Builder("IOException getting Camunda response body", HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
}
ObjectMapper mapper = new ObjectMapper();
@@ -96,11 +92,8 @@ public class ResponseHandler {
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).errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
}
if (response != null) {
responseBody = response.getResponse();
@@ -125,22 +118,16 @@ public class ResponseHandler {
} catch (IOException e) {
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;
+
+ throw new ValidateException.Builder("Could not convert BPEL response to string", HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
}
if (status != HttpStatus.SC_ACCEPTED) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER,
ErrorCode.BusinessProcesssError).targetEntity("BPEL").targetServiceName("parseBpel").build();
-
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
- .errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).build();
}
}
@@ -157,24 +144,17 @@ public class ResponseHandler {
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)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw new ValidateException.Builder("Could not convert CamundaTask response to string",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
}
if (status != HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER,
ErrorCode.BusinessProcesssError).targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask")
.build();
-
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
- .errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
+ .errorInfo(errorLoggerInfo).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 b972f7e1db..2b08d1130f 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
@@ -32,8 +32,6 @@ import javax.xml.validation.Schema;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
@@ -94,8 +92,7 @@ public class XMLValidator {
return "ErrorDetails: " + e.getMessage();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(), ErrorCode.SchemaError.getValue(),
- "APIH cannot read schema file", e);
+ logger.error("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/apihandler/filters/RequestIdFilter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java
index 399e0650f9..2fd426dec2 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java
@@ -24,22 +24,27 @@ import javax.annotation.Priority;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.ext.Provider;
-import org.apache.http.HttpStatus;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestIdException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.slf4j.MDC;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Priority(2)
@Provider
@Component
public class RequestIdFilter implements ContainerRequestFilter {
- protected static Logger logger = LoggerFactory.getLogger(RequestIdFilter.class);
+ private static Logger logger = LoggerFactory.getLogger(RequestIdFilter.class);
@Autowired
private RequestsDbClient infraActiveRequestsClient;
@@ -48,11 +53,33 @@ public class RequestIdFilter implements ContainerRequestFilter {
public void filter(ContainerRequestContext context) throws IOException {
String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+ logger.info("Checking if requestId: {} already exists in requestDb InfraActiveRequests table", requestId);
InfraActiveRequests infraActiveRequests = infraActiveRequestsClient.getInfraActiveRequestbyRequestId(requestId);
if (infraActiveRequests != null) {
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(HttpStatus.SC_BAD_REQUEST));
- logger.error("RequestID exists in RequestDB.InfraActiveRequests : " + requestId);
+ logger.error(
+ "RequestId: {} already exists in RequestDB InfraActiveRequests table, throwing DuplicateRequestIdException",
+ requestId);
+ throw new DuplicateRequestIdException(createRequestError(requestId, "InfraActiveRequests"));
+ }
+ }
+
+ protected String createRequestError(String requestId, String requestTable) {
+ ObjectMapper mapper = new ObjectMapper();
+ RequestError error = new RequestError();
+ ServiceException serviceException = new ServiceException();
+ serviceException.setMessageId(ErrorNumbers.SVC_BAD_PARAMETER);
+ serviceException
+ .setText("RequestId: " + requestId + " already exists in the RequestDB " + requestTable + " table");
+ error.setServiceException(serviceException);
+ String errorMessage = null;
+
+ try {
+ errorMessage = mapper.writeValueAsString(error);
+ } catch (JsonProcessingException e) {
+ return "Unable to write requestError to String when requestId already exists in the RequestDb due to error: "
+ + e.getMessage();
}
+ return errorMessage;
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdateFilter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdateFilter.java
new file mode 100644
index 0000000000..119a0a560e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdateFilter.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandler.filters;
+
+import java.io.IOException;
+import java.sql.Timestamp;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.constants.Status;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+@Provider
+@ResponseUpdater
+public class ResponseUpdateFilter implements ContainerResponseFilter {
+
+ protected static Logger logger = LoggerFactory.getLogger(ResponseUpdateFilter.class);
+
+ @Context
+ private HttpServletRequest httpServletRequest;
+
+ @Context
+ private Providers providers;
+
+ @Autowired
+ protected RequestsDbClient infraActiveRequestsClient;
+
+ @Override
+ public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
+ throws IOException {
+ try {
+ logger.info("updating requests status");
+ updateRequestDBToFailed(responseContext);
+ } catch (Exception e) {
+ logger.warn("Error in outgoing JAX-RS Inteceptor updating request db to failed", e);
+ }
+ }
+
+ private void updateRequestDBToFailed(ContainerResponseContext responseContext) {
+ String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+ if (requestId != null && !Response.Status.Family.familyOf(responseContext.getStatus())
+ .equals(Response.Status.Family.SUCCESSFUL)) {
+ InfraActiveRequests currentRequest = infraActiveRequestsClient.getInfraActiveRequestbyRequestId(requestId);
+ if (currentRequest != null) {
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ RequestError error;
+ try {
+ error = (RequestError) responseContext.getEntity();
+ } catch (Exception e) {
+ logger.warn("Error Casting Entity to Request Error, generating unknown Error", e);
+ error = new RequestError();
+ ServiceException serviceException = new ServiceException();
+ serviceException.setText("Unknown Error Occured during processing");
+ error.setServiceException(serviceException);
+ }
+ if (error.getServiceException() != null && error.getServiceException().getText() != null
+ && !error.getServiceException().getText().isEmpty()) {
+ currentRequest.setStatusMessage(error.getServiceException().getText());
+ } else {
+ currentRequest.setStatusMessage("Unknown Error Occured during processing");
+ }
+ currentRequest.setRequestStatus(Status.FAILED.toString());
+ currentRequest.setEndTime(endTimeStamp);
+ currentRequest.setProgress(100L);
+ infraActiveRequestsClient.updateInfraActiveRequests(currentRequest);
+ }
+ }
+ }
+}
+
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdater.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdater.java
new file mode 100644
index 0000000000..eb2dad03f3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/ResponseUpdater.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandler.filters;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.ws.rs.NameBinding;
+
+
+@NameBinding
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface ResponseUpdater {
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
index 77dbff9ebb..6957e1fe73 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
@@ -24,5 +24,27 @@ package org.onap.so.apihandlerinfra;
* Enum for Status values returned by API Handler to Tail-F
*/
public enum Action implements Actions {
- createInstance, updateInstance, deleteInstance, configureInstance, replaceInstance, activateInstance, deactivateInstance, enablePort, disablePort, addRelationships, removeRelationships, inPlaceSoftwareUpdate, applyUpdatedConfig, completeTask, assignInstance, unassignInstance, compareModel, scaleInstance, deactivateAndCloudDelete, scaleOut, recreateInstance, addMembers, removeMembers
+ createInstance,
+ updateInstance,
+ deleteInstance,
+ configureInstance,
+ replaceInstance,
+ activateInstance,
+ deactivateInstance,
+ enablePort,
+ disablePort,
+ addRelationships,
+ removeRelationships,
+ inPlaceSoftwareUpdate,
+ applyUpdatedConfig,
+ completeTask,
+ assignInstance,
+ unassignInstance,
+ compareModel,
+ scaleInstance,
+ deactivateAndCloudDelete,
+ scaleOut,
+ recreateInstance,
+ addMembers,
+ removeMembers
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java
index 5dbe44f58b..5ae0cea549 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Actions.java
@@ -20,6 +20,8 @@
package org.onap.so.apihandlerinfra;
-public interface Actions {
+import java.io.Serializable;
+
+public interface Actions extends Serializable {
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
index 0bbc3e336f..ec583645ae 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Constants.java
@@ -23,8 +23,6 @@ package org.onap.so.apihandlerinfra;
public class Constants {
- private Constants() {}
-
public static final String REQUEST_ID_PATH = "/{request-id}";
public static final String STATUS_SUCCESS = "SUCCESS";
@@ -43,11 +41,13 @@ public class Constants {
public static final String A_LA_CARTE = "aLaCarte";
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+ public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
- public final static String VNF_REQUEST_SCOPE = "vnf";
- public final static String SERVICE_INSTANCE_PATH = "/serviceInstances";
- public final static String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
- public final static String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests";
+ public static final String VNF_REQUEST_SCOPE = "vnf";
+ public static final String SERVICE_INSTANCE_PATH = "/serviceInstances";
+ public static final String SERVICE_INSTANTIATION_PATH = "/serviceInstantiation";
+ public static final String ORCHESTRATION_REQUESTS_PATH = "/orchestrationRequests";
+
+ private Constants() {}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
index c7f6459482..ab2ce10690 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java
@@ -29,7 +29,7 @@ public abstract class ApiException extends Exception {
*
*/
private static final long serialVersionUID = 683162058616691134L;
- private int httpResponseCode;
+ private int httpResponseCode = 500;
private String messageID;
private ErrorLoggerInfo errorLoggerInfo;
@@ -49,6 +49,15 @@ public abstract class ApiException extends Exception {
super(message, cause);
}
+ public ApiException(String message, int httpResponseCode) {
+ super(message);
+ this.httpResponseCode = httpResponseCode;
+ }
+
+ public ApiException(String message) {
+ super(message);
+ }
+
public String getMessageID() {
return messageID;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
index 3b977639fc..6a56b58f04 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
@@ -37,16 +37,14 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
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.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
@Provider
public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
@@ -72,7 +70,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
@Override
public Response toResponse(ApiException exception) {
-
+ logger.error("Error During API Call", exception);
return Response.status(exception.getHttpResponseCode()).entity(buildErrorString(exception)).build();
}
@@ -134,8 +132,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",
- ErrorCode.DataError.getValue(), errorMsg, e);
+ logger.error("BuildServiceErrorResponse", e);
return errorMsg;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java
index 6b38eec4ae..d5fc01781e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ContactCamundaException.java
@@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.exceptions;
public class ContactCamundaException extends ApiException {
private static final String contactCamundaErrorMessage =
- "Unable to get process-instance history from Camunda for requestId: %s due to error: %s";
+ "Unable to get %s history from Camunda for requestId: %s due to error: %s";
private ContactCamundaException(Builder builder) {
super(builder);
@@ -32,9 +32,9 @@ public class ContactCamundaException extends ApiException {
public static class Builder extends ApiException.Builder<Builder> {
- public Builder(String requestId, String error, int httpResponseCode, String messageID) {
- super(contactCamundaErrorMessage.format(contactCamundaErrorMessage, requestId, error), httpResponseCode,
- messageID);
+ public Builder(String query, String requestId, String error, int httpResponseCode, String messageID) {
+ super(contactCamundaErrorMessage.format(contactCamundaErrorMessage, query, requestId, error),
+ httpResponseCode, messageID);
}
public ContactCamundaException build() {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
index 21e9b44b19..cbbfa16eaa 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestException.java
@@ -22,7 +22,7 @@ package org.onap.so.apihandlerinfra.exceptions;
public class DuplicateRequestException extends ApiException {
- private static final String duplicateFailMessage = "Error: Locked instance - This %s (%s) "
+ private static final String DUPLICATE_FAIL_MESSAGE = "Error: Locked instance - This %s (%s) "
+ "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding.";
private DuplicateRequestException(Builder builder) {
@@ -30,12 +30,13 @@ public class DuplicateRequestException extends ApiException {
}
+
public static class Builder extends ApiException.Builder<Builder> {
public Builder(String requestScope, String instance, String requestStatus, String requestID,
int httpResponseCode, String messageID) {
- super(String.format(duplicateFailMessage, requestScope, instance, requestStatus, requestID),
+ super(String.format(DUPLICATE_FAIL_MESSAGE, requestScope, instance, requestStatus, requestID),
httpResponseCode, messageID);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java
new file mode 100644
index 0000000000..f56b4218ba
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.exceptions;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+public class DuplicateRequestIdException extends WebApplicationException {
+
+ public DuplicateRequestIdException(String response) {
+ super(Response.status(Response.Status.BAD_REQUEST).entity(response).build());
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java
index 620103be4e..3b62e318e4 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RecipeNotFoundException.java
@@ -27,6 +27,7 @@ public class RecipeNotFoundException extends ApiException {
super(builder);
}
+
public static class Builder extends ApiException.Builder<Builder> {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java
index 577a14674b..a8f868da05 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/RequestDbFailureException.java
@@ -22,7 +22,7 @@ package org.onap.so.apihandlerinfra.exceptions;
public class RequestDbFailureException extends ApiException {
- private static final String requestDbFailMessage = "Unable to %s due to error contacting requestDb: %s";
+ private static final String REQUEST_DB_FAIL_MESSAGE = "Unable to %s due to error contacting requestDb: %s";
private RequestDbFailureException(Builder builder) {
super(builder);
@@ -32,7 +32,7 @@ public class RequestDbFailureException extends ApiException {
public Builder(String action, String error, int httpResponseCode, String messageID) {
- super(requestDbFailMessage.format(requestDbFailMessage, action, error), httpResponseCode, messageID);
+ super(REQUEST_DB_FAIL_MESSAGE.format(REQUEST_DB_FAIL_MESSAGE, action, error), httpResponseCode, messageID);
}
public RequestDbFailureException build() {
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
index 372ed30d8e..ae8256e64f 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java
@@ -28,6 +28,11 @@ public class ValidateException extends ApiException {
}
+ public ValidateException(String errorMessage, int httpResponseCode) {
+ super(errorMessage, httpResponseCode);
+ }
+
+
public static class Builder extends ApiException.Builder<Builder> {
public Builder(String message, int httpResponseCode, String messageID) {
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/RequestClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/RequestClientTest.java
new file mode 100644
index 0000000000..86b12ae8f6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/RequestClientTest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019 Samsung. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandler.common;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RequestClientTest {
+
+ private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
+
+ private RequestClient requestClient;
+
+ @Before
+ public void init() {
+ requestClient = Mockito.mock(RequestClient.class, Mockito.CALLS_REAL_METHODS);
+ }
+
+ @Test
+ public void getEncryptedPropValueWithSuccess() {
+
+ String encryptedValue = requestClient.getEncryptedPropValue(
+ "E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE",
+ "defaultValue", ENCRYPTION_KEY);
+
+ Assert.assertEquals("apihBpmn:camunda-R1512!", encryptedValue);
+ }
+
+ @Test
+ public void getDefaultEncryptedPropValue() {
+
+ String encryptedValue =
+ requestClient.getEncryptedPropValue("012345678901234567890123456789", "defaultValue", ENCRYPTION_KEY);
+
+ Assert.assertEquals("defaultValue", encryptedValue);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
index 6c674db9f4..8716047603 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
@@ -1,66 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.apihandler.filters;
-import static org.junit.Assert.assertEquals;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
import java.io.IOException;
+import java.util.Collections;
import javax.ws.rs.container.ContainerRequestContext;
-import org.apache.http.HttpStatus;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoJUnitRunner;
-import org.mockito.junit.MockitoRule;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestIdException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
import org.slf4j.MDC;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class RequestIdFilterTest {
@Mock
- ContainerRequestContext mockContext;
+ private ContainerRequestContext mockContext;
@Mock
- protected RequestsDbClient requestsDbClient;
+ private RequestsDbClient requestsDbClient;
@InjectMocks
@Spy
- RequestIdFilter requestIdFilter;
+ private RequestIdFilter requestIdFilter;
@Rule
public ExpectedException thrown = ExpectedException.none();
- @Rule
- public MockitoRule mockitoRule = MockitoJUnit.rule();
+ private static final String REQUEST_ID = "32807a28-1a14-4b88-b7b3-2950918aa769";
+ private ObjectMapper mapper = new ObjectMapper();
- @Test
- public void filterTest() throws IOException {
+ private RequestError getRequestError() throws IOException {
+ RequestError requestError = new RequestError();
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+ ServiceException serviceException = new ServiceException();
+ serviceException.setMessageId("SVC0002");
+ serviceException.setText(
+ "RequestId: 32807a28-1a14-4b88-b7b3-2950918aa769 already exists in the RequestDB InfraActiveRequests table");
+ serviceException.setVariables(Collections.emptyList());
+ requestError.setServiceException(serviceException);
+ return requestError;
+ }
- String requestId = "32807a28-1a14-4b88-b7b3-2950918aa769";
+ @Test
+ public void filterTestInfra() throws IOException {
+ String error = mapper.writeValueAsString(getRequestError());
+ String requestId = REQUEST_ID;
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
// ExpectedRecord InfraActiveRequests
InfraActiveRequests infraActiveRequests = new InfraActiveRequests();
- infraActiveRequests.setRequestStatus("FAILED");
- infraActiveRequests.setProgress(100L);
- infraActiveRequests.setLastModifiedBy("APIH");
- infraActiveRequests.setRequestScope("network");
- infraActiveRequests.setRequestAction("deleteInstance");
- infraActiveRequests.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa769");
+ infraActiveRequests.setRequestId(REQUEST_ID);
doReturn(infraActiveRequests).when(requestsDbClient).getInfraActiveRequestbyRequestId(requestId);
+ doReturn(error).when(requestIdFilter).createRequestError(REQUEST_ID, "InfraActiveRequests");
+ thrown.expect(DuplicateRequestIdException.class);
+ thrown.expectMessage("HTTP 400 Bad Request");
requestIdFilter.filter(mockContext);
+ }
- Mockito.verify(requestIdFilter, Mockito.times(1)).filter(mockContext);
- assertEquals(MDC.get(ONAPLogConstants.MDCs.RESPONSE_CODE), String.valueOf(HttpStatus.SC_BAD_REQUEST));
+ @Test
+ public void createRequestErrorTest() throws IOException {
+ RequestError requestError = getRequestError();
+ String result = requestIdFilter.createRequestError(REQUEST_ID, "InfraActiveRequests");
+ RequestError resultingError = mapper.readValue(result, RequestError.class);
+ assertThat(resultingError, sameBeanAs(requestError));
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index dc665a9446..a3b9827d9f 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -88,6 +88,10 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.springframework.retry</groupId>
+ <artifactId>spring-retry</artifactId>
+ </dependency>
+ <dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java
deleted file mode 100644
index a3ff1ab95d..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandler/filters/RequestUriFilter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.apihandler.filters;
-
-import java.io.IOException;
-import java.net.URI;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.PreMatching;
-import javax.ws.rs.core.UriInfo;
-import org.onap.so.apihandlerinfra.Constants;
-
-
-@PreMatching
-public class RequestUriFilter implements ContainerRequestFilter {
-
- private String requestURI;
-
- @Override
- public void filter(ContainerRequestContext context) throws IOException {
- UriInfo uriInfo = context.getUriInfo();
- URI baseURI = uriInfo.getBaseUri();
- requestURI = uriInfo.getPath();
-
- if (requestURI.contains("onap/so/infra/serviceInstances")) {
- requestURI = requestURI.replaceFirst("serviceInstances", "serviceInstantiation");
- if (!requestURI.contains(Constants.SERVICE_INSTANCE_PATH)) {
- // Adds /serviceInstances after the version provided in the URI
- requestURI = new StringBuilder(requestURI)
- .insert(requestURI.indexOf(Constants.SERVICE_INSTANTIATION_PATH) + 24,
- Constants.SERVICE_INSTANCE_PATH)
- .toString();
- }
- requestURI = baseURI + requestURI;
- URI uri = URI.create(requestURI);
- context.setRequestUri(uri);
- }
- }
-
- public String getRequestUri() {
- return requestURI;
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
index 77dbff9ebb..d0302f2e59 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java
@@ -20,9 +20,30 @@
package org.onap.so.apihandlerinfra;
-/*
- * Enum for Status values returned by API Handler to Tail-F
- */
+
public enum Action implements Actions {
- createInstance, updateInstance, deleteInstance, configureInstance, replaceInstance, activateInstance, deactivateInstance, enablePort, disablePort, addRelationships, removeRelationships, inPlaceSoftwareUpdate, applyUpdatedConfig, completeTask, assignInstance, unassignInstance, compareModel, scaleInstance, deactivateAndCloudDelete, scaleOut, recreateInstance, addMembers, removeMembers
+ createInstance,
+ updateInstance,
+ deleteInstance,
+ configureInstance,
+ replaceInstance,
+ replaceInstanceRetainAssignments,
+ activateInstance,
+ deactivateInstance,
+ enablePort,
+ disablePort,
+ addRelationships,
+ removeRelationships,
+ inPlaceSoftwareUpdate,
+ applyUpdatedConfig,
+ completeTask,
+ assignInstance,
+ unassignInstance,
+ compareModel,
+ scaleInstance,
+ deactivateAndCloudDelete,
+ scaleOut,
+ recreateInstance,
+ addMembers,
+ removeMembers
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
index bc1972a593..5beb4810ec 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
@@ -21,17 +21,18 @@
package org.onap.so.apihandlerinfra;
import java.util.concurrent.Executor;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
@SpringBootApplication(scanBasePackages = {"org.onap"})
@EnableAsync
+@EnableScheduling
public class ApiHandlerApplication {
@Value("${mso.async.core-pool-size}")
@@ -53,6 +54,7 @@ public class ApiHandlerApplication {
public static void main(String[] args) {
SpringApplication.run(ApiHandlerApplication.class, args);
+ java.security.Security.setProperty("networkaddress.cache.ttl", "10");
System.getProperties().setProperty("mso.db", "MARIADB");
System.getProperties().setProperty("server.name", "Springboot");
setLogsDir();
@@ -69,4 +71,5 @@ public class ApiHandlerApplication {
executor.initialize();
return executor;
}
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
new file mode 100644
index 0000000000..e56eb422d8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
@@ -0,0 +1,180 @@
+package org.onap.so.apihandlerinfra;
+
+import java.security.GeneralSecurityException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.DatatypeConverter;
+import org.apache.http.HttpStatus;
+import org.camunda.bpm.engine.impl.persistence.entity.HistoricActivityInstanceEntity;
+import org.camunda.bpm.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
+import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.core.env.Environment;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.retry.policy.SimpleRetryPolicy;
+import org.springframework.retry.support.RetryTemplate;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.ResourceAccessException;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestTemplate;
+
+@Component
+public class CamundaRequestHandler {
+
+ private static Logger logger = LoggerFactory.getLogger(CamundaRequestHandler.class);
+
+ @Autowired
+ private RestTemplate restTemplate;
+
+ @Autowired
+ private Environment env;
+
+ public ResponseEntity<List<HistoricProcessInstanceEntity>> getCamundaProcessInstanceHistory(String requestId) {
+ RetryTemplate retryTemplate = setRetryTemplate();
+ String path = env.getProperty("mso.camunda.rest.history.uri") + requestId;
+ String targetUrl = env.getProperty("mso.camundaURL") + path;
+ HttpHeaders headers =
+ setCamundaHeaders(env.getRequiredProperty("mso.camundaAuth"), env.getRequiredProperty("mso.msoKey"));
+
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+
+ return retryTemplate.execute(context -> {
+ if (context.getLastThrowable() != null) {
+ logger.error("Retrying: Last call resulted in exception: ", context.getLastThrowable());
+ }
+ if (context.getRetryCount() == 0) {
+ logger.info("Querying Camunda for process-instance history for requestId: {}", requestId);
+ } else {
+ logger.info("Retry: {} of 3. Querying Camunda for process-instance history for requestId: {}",
+ context.getRetryCount(), requestId);
+ }
+ return restTemplate.exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ });
+ }
+
+ protected ResponseEntity<List<HistoricActivityInstanceEntity>> getCamundaActivityHistory(String processInstanceId,
+ String requestId) throws ContactCamundaException {
+ RetryTemplate retryTemplate = setRetryTemplate();
+ String path = env.getProperty("mso.camunda.rest.activity.uri") + processInstanceId;
+ String targetUrl = env.getProperty("mso.camundaURL") + path;
+ HttpHeaders headers =
+ setCamundaHeaders(env.getRequiredProperty("mso.camundaAuth"), env.getRequiredProperty("mso.msoKey"));
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ try {
+ return retryTemplate.execute(context -> {
+ if (context.getLastThrowable() != null) {
+ logger.error("Retrying: Last call resulted in exception: ", context.getLastThrowable());
+ }
+ if (context.getRetryCount() == 0) {
+ logger.info(
+ "Querying Camunda for activity-instance history for processInstanceId: {}, for requestId: {}",
+ processInstanceId, requestId);
+ } else {
+ logger.info(
+ "Retry: {} of 3. Querying Camunda for activity-instance history for processInstanceId: {}, for requestId: {}",
+ context.getRetryCount(), processInstanceId, requestId);
+ }
+
+ return restTemplate.exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
+ });
+
+ } catch (RestClientException e) {
+ logger.error(
+ "Error querying Camunda for activity-instance history for processInstanceId: {}, for requestId: {}, exception: {}",
+ processInstanceId, requestId, e.getMessage());
+ throw new ContactCamundaException.Builder("activity-instance", requestId, e.toString(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).build();
+ }
+ }
+
+ protected String getTaskName(String requestId) throws ContactCamundaException {
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response = null;
+ ResponseEntity<List<HistoricActivityInstanceEntity>> activityResponse = null;
+ String processInstanceId = null;
+ try {
+ response = getCamundaProcessInstanceHistory(requestId);
+ } catch (RestClientException e) {
+ logger.error("Error querying Camunda for process-instance history for requestId: {}, exception: {}",
+ requestId, e.getMessage());
+ throw new ContactCamundaException.Builder("process-instance", requestId, e.toString(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).build();
+ }
+
+ List<HistoricProcessInstanceEntity> historicProcessInstanceList = response.getBody();
+
+ if (historicProcessInstanceList != null && !historicProcessInstanceList.isEmpty()) {
+ Collections.reverse(historicProcessInstanceList);
+ processInstanceId = historicProcessInstanceList.get(0).getId();
+ } else {
+ return "No processInstances returned for requestId: " + requestId;
+ }
+
+ if (processInstanceId != null) {
+ activityResponse = getCamundaActivityHistory(processInstanceId, requestId);
+ } else {
+ return "No processInstanceId returned for requestId: " + requestId;
+ }
+
+ return getActivityName(activityResponse.getBody());
+ }
+
+ protected String getActivityName(List<HistoricActivityInstanceEntity> activityInstanceList) {
+ String activityName = null;
+ HistoricActivityInstanceEntity activityInstance = null;
+ String result = null;
+
+ if (activityInstanceList == null || activityInstanceList.isEmpty()) {
+ result = "No results returned on activityInstance history lookup.";
+ } else {
+ activityInstance = activityInstanceList.get(0);
+ activityName = activityInstance.getActivityName();
+
+ if (activityName == null) {
+ result = "Task name is null.";
+ } else {
+ result = "Last task executed: " + activityName;
+ }
+ }
+
+ return result;
+ }
+
+ protected HttpHeaders setCamundaHeaders(String auth, String msoKey) {
+ HttpHeaders headers = new HttpHeaders();
+ List<org.springframework.http.MediaType> acceptableMediaTypes = new ArrayList<>();
+ acceptableMediaTypes.add(org.springframework.http.MediaType.APPLICATION_JSON);
+ headers.setAccept(acceptableMediaTypes);
+ try {
+ String userCredentials = CryptoUtils.decrypt(auth, msoKey);
+ if (userCredentials != null) {
+ headers.add(HttpHeaders.AUTHORIZATION,
+ "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
+ }
+ } catch (GeneralSecurityException e) {
+ logger.error("Security exception", e);
+ }
+ return headers;
+ }
+
+ protected RetryTemplate setRetryTemplate() {
+ RetryTemplate retryTemplate = new RetryTemplate();
+ Map<Class<? extends Throwable>, Boolean> retryableExceptions = new HashMap<>();
+ retryableExceptions.put(ResourceAccessException.class, true);
+ SimpleRetryPolicy policy = new SimpleRetryPolicy(4, retryableExceptions);
+ retryTemplate.setRetryPolicy(policy);
+ return retryTemplate;
+ }
+}
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 449aa4ba3f..d3a279fd8e 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
@@ -38,6 +38,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
@@ -55,6 +56,7 @@ import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstance
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.constants.Status;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -90,6 +92,8 @@ public class E2EServiceInstances {
private static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+ private static final String SERVICE_ID = "serviceId";
+
@Autowired
private MsoRequest msoRequest;
@@ -136,9 +140,9 @@ public class E2EServiceInstances {
public Response updateE2EServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceId") String serviceId) throws ApiException {
- instanceIdMap.put("serviceId", serviceId);
+ instanceIdMap.put(SERVICE_ID, serviceId);
- return updateE2EserviceInstances(request, Action.updateInstance, instanceIdMap, version);
+ return updateE2EserviceInstances(request, Action.updateInstance, version);
}
/**
@@ -153,9 +157,9 @@ public class E2EServiceInstances {
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class)
public Response deleteE2EServiceInstance(String request, @PathParam("version") String version,
- @PathParam("serviceId") String serviceId) throws ApiException {
+ @PathParam(SERVICE_ID) String serviceId) throws ApiException {
- instanceIdMap.put("serviceId", serviceId);
+ instanceIdMap.put(SERVICE_ID, serviceId);
return deleteE2EserviceInstances(request, Action.deleteInstance, instanceIdMap, version);
}
@@ -165,7 +169,7 @@ public class E2EServiceInstances {
@ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId",
response = Response.class)
@Produces(MediaType.APPLICATION_JSON)
- public Response getE2EServiceInstances(@PathParam("serviceId") String serviceId,
+ public Response getE2EServiceInstances(@PathParam(SERVICE_ID) String serviceId,
@PathParam("version") String version, @PathParam("operationId") String operationId) {
return getE2EServiceInstance(serviceId, operationId, version);
}
@@ -182,11 +186,11 @@ public class E2EServiceInstances {
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Scale E2E Service Instance on a specified version", response = Response.class)
public Response scaleE2EServiceInstance(String request, @PathParam("version") String version,
- @PathParam("serviceId") String serviceId) throws ApiException {
+ @PathParam(SERVICE_ID) String serviceId) throws ApiException {
logger.debug("------------------scale begin------------------");
- instanceIdMap.put("serviceId", serviceId);
- return scaleE2EserviceInstances(request, Action.scaleInstance, instanceIdMap, version);
+ instanceIdMap.put(SERVICE_ID, serviceId);
+ return scaleE2EserviceInstances(request, Action.scaleInstance, version);
}
/**
@@ -205,7 +209,7 @@ public class E2EServiceInstances {
public Response compareModelwithTargetVersion(String request, @PathParam("serviceId") String serviceId,
@PathParam("version") String version) throws ApiException {
- instanceIdMap.put("serviceId", serviceId);
+ instanceIdMap.put(SERVICE_ID, serviceId);
return compareModelwithTargetVersion(request, Action.compareModel, instanceIdMap, version);
}
@@ -214,7 +218,6 @@ public class E2EServiceInstances {
HashMap<String, String> instanceIdMap, String version) throws ApiException {
String requestId = UUID.randomUUID().toString();
- long startTime = System.currentTimeMillis();
CompareModelsRequest e2eCompareModelReq;
@@ -228,19 +231,19 @@ public class E2EServiceInstances {
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString());
return response;
}
- return runCompareModelBPMWorkflow(e2eCompareModelReq, requestJSON, requestId, startTime, action, version);
+ return runCompareModelBPMWorkflow(e2eCompareModelReq, requestJSON, requestId, action, version);
}
private Response runCompareModelBPMWorkflow(CompareModelsRequest e2eCompareModelReq, String requestJSON,
- String requestId, long startTime, Action action, String version) throws ApiException {
+ String requestId, Action action, String version) throws ApiException {
// Define RecipeLookupResult info here instead of query DB for efficiency
String workflowUrl = "/mso/async/services/CompareModelofE2EServiceInstance";
@@ -249,8 +252,6 @@ public class E2EServiceInstances {
RequestClient requestClient;
HttpResponse response;
- long subStartTime = System.currentTimeMillis();
-
try {
requestClient = requestClientFactory.getRequestClient(workflowUrl);
@@ -259,7 +260,7 @@ public class E2EServiceInstances {
// Capture audit event
logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
- String serviceId = instanceIdMap.get("serviceId");
+ String serviceId = instanceIdMap.get(SERVICE_ID);
String serviceType = e2eCompareModelReq.getServiceType();
RequestClientParameter postParam = new RequestClientParameter.Builder().setRequestId(requestId)
.setBaseVfModule(false).setRecipeTimeout(recipeTimeout).setRequestAction(action.name())
@@ -280,8 +281,8 @@ 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,
- ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString());
return resp;
}
@@ -289,8 +290,7 @@ public class E2EServiceInstances {
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- return beplStatusUpdate(requestId, startTime, requestClient, respHandler, bpelStatus, action, instanceIdMap,
- version);
+ return beplStatusUpdate(requestClient, respHandler, bpelStatus, version);
}
private Response getE2EServiceInstance(String serviceId, String operationId, String version) {
@@ -299,14 +299,12 @@ public class E2EServiceInstances {
String apiVersion = version.substring(1);
- long startTime = System.currentTimeMillis();
-
OperationStatus operationStatus;
try {
operationStatus = requestsDbClient.getOneByServiceIdAndOperationId(serviceId, operationId);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
ErrorCode.AvailabilityError.getValue(),
"Exception while communciate with Request DB - Infra Request Lookup", e);
Response response =
@@ -321,8 +319,8 @@ public class E2EServiceInstances {
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT,
MsoException.ServiceException, "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,
- ErrorCode.BusinessProcesssError.getValue(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(),
"Null response from RequestDB when searching by serviceId");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -337,7 +335,6 @@ public class E2EServiceInstances {
private Response deleteE2EserviceInstances(String requestJSON, Action action, HashMap<String, String> instanceIdMap,
String version) throws ApiException {
// TODO should be a new one or the same service instance Id
- long startTime = System.currentTimeMillis();
E2EServiceInstanceDeleteRequest e2eDelReq;
ObjectMapper mapper = new ObjectMapper();
@@ -350,8 +347,8 @@ public class E2EServiceInstances {
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -375,8 +372,8 @@ public class E2EServiceInstances {
return response;
}
if (recipeLookupResult == null) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.DataError.getValue(), "No recipe found in DB");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
@@ -390,7 +387,6 @@ public class E2EServiceInstances {
RequestClient requestClient;
HttpResponse response;
- long subStartTime = System.currentTimeMillis();
try {
requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI());
@@ -401,7 +397,7 @@ public class E2EServiceInstances {
// Capture audit event
logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
- String serviceId = instanceIdMap.get("serviceId");
+ String serviceId = instanceIdMap.get(SERVICE_ID);
String serviceInstanceType = e2eDelReq.getServiceType();
RequestClientParameter clientParam = new RequestClientParameter.Builder().setRequestId(requestId)
.setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
@@ -414,8 +410,9 @@ public class E2EServiceInstances {
Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(),
+ "Exception while communicate with BPMN engine");
logger.debug("End of the transaction, the final response is: " + resp.getEntity());
return resp;
}
@@ -424,8 +421,8 @@ 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,
- ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -433,17 +430,14 @@ public class E2EServiceInstances {
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- return beplStatusUpdate(requestId, startTime, requestClient, respHandler, bpelStatus, action, instanceIdMap,
- version);
+ return beplStatusUpdate(requestClient, respHandler, bpelStatus, version);
}
- private Response updateE2EserviceInstances(String requestJSON, Action action, HashMap<String, String> instanceIdMap,
- String version) throws ApiException {
+ private Response updateE2EserviceInstances(String requestJSON, Action action, String version) throws ApiException {
String requestId = UUID.randomUUID().toString();
- long startTime = System.currentTimeMillis();
E2EServiceInstanceRequest e2eSir;
- String serviceId = instanceIdMap.get("serviceId");
+ String serviceId = instanceIdMap.get(SERVICE_ID);
ObjectMapper mapper = new ObjectMapper();
try {
@@ -455,8 +449,8 @@ public class E2EServiceInstances {
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -473,8 +467,8 @@ public class E2EServiceInstances {
if (requestId != null) {
logger.debug("Logging failed message to the database");
}
- logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -483,7 +477,7 @@ public class E2EServiceInstances {
try {
recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
@@ -495,8 +489,8 @@ public class E2EServiceInstances {
}
if (recipeLookupResult == null) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.DataError.getValue(), "No recipe found in DB");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
@@ -510,7 +504,6 @@ public class E2EServiceInstances {
RequestClient requestClient;
HttpResponse response;
- long subStartTime = System.currentTimeMillis();
String sirRequestJson = convertToString(sir);
try {
@@ -530,8 +523,9 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(),
+ "Exception while communicate with BPMN engine");
logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
return getBPMNResp;
@@ -541,8 +535,8 @@ 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,
- ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity());
return getBPMNResp;
}
@@ -550,15 +544,13 @@ public class E2EServiceInstances {
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- return beplStatusUpdate(serviceId, startTime, requestClient, respHandler, bpelStatus, action, instanceIdMap,
- version);
+ return beplStatusUpdate(requestClient, respHandler, bpelStatus, version);
}
private Response processE2EserviceInstances(String requestJSON, Action action,
HashMap<String, String> instanceIdMap, String version) throws ApiException {
String requestId = UUID.randomUUID().toString();
- long startTime = System.currentTimeMillis();
E2EServiceInstanceRequest e2eSir;
MsoRequest msoRequest = new MsoRequest();
@@ -572,8 +564,8 @@ public class E2EServiceInstances {
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -590,8 +582,8 @@ public class E2EServiceInstances {
if (requestId != null) {
logger.debug("Logging failed message to the database");
}
- logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -600,7 +592,7 @@ public class E2EServiceInstances {
try {
recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
@@ -610,8 +602,8 @@ public class E2EServiceInstances {
}
if (recipeLookupResult == null) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.DataError.getValue(), "No recipe found in DB");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
@@ -621,11 +613,10 @@ public class E2EServiceInstances {
String serviceInstanceType = e2eSir.getService().getServiceType();
- String serviceId = "";
+ String serviceId = e2eSir.getService().getServiceId();
RequestClient requestClient;
HttpResponse response;
- long subStartTime = System.currentTimeMillis();
String sirRequestJson = convertToString(sir);
try {
@@ -644,8 +635,9 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(),
+ "Exception while communicate with BPMN engine");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -654,8 +646,8 @@ 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,
- ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -663,15 +655,12 @@ public class E2EServiceInstances {
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- return beplStatusUpdate(requestId, startTime, requestClient, respHandler, bpelStatus, action, instanceIdMap,
- version);
+ return beplStatusUpdate(requestClient, respHandler, bpelStatus, version);
}
- private Response scaleE2EserviceInstances(String requestJSON, Action action, HashMap<String, String> instanceIdMap,
- String version) throws ApiException {
+ private Response scaleE2EserviceInstances(String requestJSON, Action action, String version) throws ApiException {
String requestId = UUID.randomUUID().toString();
- long startTime = System.currentTimeMillis();
E2EServiceInstanceScaleRequest e2eScaleReq;
ObjectMapper mapper = new ObjectMapper();
@@ -684,8 +673,8 @@ public class E2EServiceInstances {
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST,
MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(),
ErrorNumbers.SVC_BAD_PARAMETER, null, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e);
logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
return response;
}
@@ -695,7 +684,7 @@ public class E2EServiceInstances {
// TODO Get the service template model version uuid from AAI.
recipeLookupResult = getServiceInstanceOrchestrationURI(null, action);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
@@ -708,8 +697,8 @@ public class E2EServiceInstances {
return response;
}
if (recipeLookupResult == null) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.DataError.getValue(), "No recipe found in DB");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
MsoException.ServiceException, "Recipe does not exist in catalog DB",
@@ -723,7 +712,6 @@ public class E2EServiceInstances {
RequestClient requestClient;
HttpResponse response;
- long subStartTime = System.currentTimeMillis();
try {
requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI());
@@ -734,7 +722,7 @@ public class E2EServiceInstances {
// Capture audit event
logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
- String serviceId = instanceIdMap.get("serviceId");
+ String serviceId = instanceIdMap.get(SERVICE_ID);
String serviceInstanceType = e2eScaleReq.getService().getServiceType();
RequestClientParameter postParam = new RequestClientParameter.Builder().setRequestId(requestId)
.setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
@@ -747,8 +735,9 @@ public class E2EServiceInstances {
MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA,
- ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(),
+ "Exception while communicate with BPMN engine", e);
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -757,8 +746,8 @@ 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,
- ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL");
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
}
@@ -766,12 +755,10 @@ public class E2EServiceInstances {
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- return beplStatusUpdate(requestId, startTime, requestClient, respHandler, bpelStatus, action, instanceIdMap,
- version);
+ return beplStatusUpdate(requestClient, respHandler, bpelStatus, version);
}
- private Response beplStatusUpdate(String serviceId, long startTime, RequestClient requestClient,
- ResponseHandler respHandler, int bpelStatus, Action action, HashMap<String, String> instanceIdMap,
+ private Response beplStatusUpdate(RequestClient requestClient, ResponseHandler respHandler, int bpelStatus,
String version) {
String apiVersion = version.substring(1);
@@ -790,8 +777,8 @@ public class E2EServiceInstances {
Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, MsoException.ServiceException,
"Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody,
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version);
- logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(),
- ErrorCode.BusinessProcesssError.getValue(),
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(),
+ requestClient.getUrl(), ErrorCode.BusinessProcesssError.getValue(),
"Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
return resp;
@@ -870,7 +857,6 @@ public class E2EServiceInstances {
ServiceInstancesRequest sir = new ServiceInstancesRequest();
- String returnString = null;
RequestDetails requestDetails = new RequestDetails();
ModelInfo modelInfo = new ModelInfo();
@@ -928,21 +914,14 @@ public class E2EServiceInstances {
// subscriptionServiceType
requestParameters.setSubscriptionServiceType("MOG");
- // Userparams
- // List<E2EUserParam> userParams;
- // userParams =
- // e2eSir.getService().getParameters().getRequestParameters().getUserParams();
+
List<Map<String, Object>> userParamList = new ArrayList<>();
Map<String, Object> userParamMap = new HashMap<>();
// complete json request updated in the camunda
userParamMap.put("UUIRequest", requestJSON);
userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
- // Map<String, String> userParamMap3 = null;
- // for (E2EUserParam userp : userParams) {
- // userParamMap.put(userp.getName(), userp.getValue());
- //
- // }
+
userParamList.add(userParamMap);
requestParameters.setUserParams(userParamList);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GenericStringConverter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GenericStringConverter.java
new file mode 100644
index 0000000000..80144d8ca1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GenericStringConverter.java
@@ -0,0 +1,33 @@
+package org.onap.so.apihandlerinfra;
+
+import java.net.URI;
+import java.util.Set;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
+import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.core.convert.converter.GenericConverter;
+import org.springframework.stereotype.Component;
+import com.google.common.collect.ImmutableSet;
+
+@Component
+@ConfigurationPropertiesBinding
+public class GenericStringConverter implements GenericConverter {
+
+ @Autowired
+ private HealthCheckConverter converter;
+
+ @Override
+ public Set<ConvertiblePair> getConvertibleTypes() {
+
+ ConvertiblePair[] pairs = new ConvertiblePair[] {new ConvertiblePair(String.class, Subsystem.class),
+ new ConvertiblePair(String.class, URI.class)};
+ return ImmutableSet.copyOf(pairs);
+ }
+
+ @Override
+ public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
+
+ return converter.convert(source, sourceType, targetType);
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
index 4d283f26b1..0379ae3578 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
@@ -25,10 +25,8 @@ package org.onap.so.apihandlerinfra;
import java.net.URI;
import java.util.Collections;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
+import java.util.List;
+import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.transaction.Transactional;
import javax.ws.rs.DefaultValue;
@@ -41,14 +39,20 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
+import org.onap.so.apihandlerinfra.HealthCheckConfig.Endpoint;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
-import org.springframework.http.HttpMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -58,45 +62,38 @@ import io.swagger.annotations.ApiOperation;
@Api(value = "/globalhealthcheck", description = "APIH Infra Global Health Check")
public class GlobalHealthcheckHandler {
private static Logger logger = LoggerFactory.getLogger(GlobalHealthcheckHandler.class);
- private static final String CONTEXTPATH_PROPERTY = "management.context-path";
- private static final String PROPERTY_DOMAIN = "mso.health.endpoints";
- private static final String CATALOGDB_PROPERTY = PROPERTY_DOMAIN + ".catalogdb";
- private static final String REQUESTDB_PROPERTY = PROPERTY_DOMAIN + ".requestdb";
- private static final String SDNC_PROPERTY = PROPERTY_DOMAIN + ".sdnc";
- private static final String OPENSTACK_PROPERTY = PROPERTY_DOMAIN + ".openstack";
- private static final String BPMN_PROPERTY = PROPERTY_DOMAIN + ".bpmn";
- private static final String ASDC_PROPERTY = PROPERTY_DOMAIN + ".asdc";
- private static final String REQUESTDBATTSVC_PROPERTY = PROPERTY_DOMAIN + ".requestdbattsvc";
- private static final String DEFAULT_PROPERTY_VALUE = "";
+ protected static final String CONTEXTPATH_PROPERTY = "management.endpoints.web.base-path";
+ protected static final String PROPERTY_DOMAIN = "mso.health";
+ protected static final String CATALOGDB_PROPERTY = PROPERTY_DOMAIN + ".endpoints.catalogdb";
+ protected static final String REQUESTDB_PROPERTY = PROPERTY_DOMAIN + ".endpoints.requestdb";
+ protected static final String SDNC_PROPERTY = PROPERTY_DOMAIN + ".endpoints.sdnc";
+ protected static final String OPENSTACK_PROPERTY = PROPERTY_DOMAIN + ".endpoints.openstack";
+ protected static final String BPMN_PROPERTY = PROPERTY_DOMAIN + ".endpoints.bpmn";
+ protected static final String ASDC_PROPERTY = PROPERTY_DOMAIN + ".endpoints.asdc";
+ protected static final String REQUESTDBATTSVC_PROPERTY = PROPERTY_DOMAIN + ".endpoints.requestdbattsvc";
+ protected static final String MSO_AUTH_PROPERTY = PROPERTY_DOMAIN + ".auth";
+ protected static final String DEFAULT_PROPERTY_VALUE = "";
// e.g. /manage
private String actuatorContextPath;
- private String endpointCatalogdb;
- private String endpointRequestdb;
- private String endpointSdnc;
- private String endpointOpenstack;
- private String endpointBpmn;
- private String endpointAsdc;
- private String endpointRequestdbAttsvc;
@Autowired
private Environment env;
@Autowired
private RestTemplate restTemplate;
- private final String health = "/health";
+ @Autowired
+ private HealthCheckConfig config;
+
+ private static final String HEALTH = "/health";
+
+ private String msoAuth;
@PostConstruct
protected void init() {
actuatorContextPath = env.getProperty(CONTEXTPATH_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointCatalogdb = env.getProperty(CATALOGDB_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointRequestdb = env.getProperty(REQUESTDB_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointSdnc = env.getProperty(SDNC_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointOpenstack = env.getProperty(OPENSTACK_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointBpmn = env.getProperty(BPMN_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointAsdc = env.getProperty(ASDC_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
- endpointRequestdbAttsvc = env.getProperty(REQUESTDBATTSVC_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
+ msoAuth = env.getProperty(MSO_AUTH_PROPERTY, String.class, DEFAULT_PROPERTY_VALUE);
}
@GET
@@ -107,29 +104,25 @@ public class GlobalHealthcheckHandler {
@Context ContainerRequestContext requestContext) {
Response HEALTH_CHECK_RESPONSE = null;
// Build internal response object
- HealthcheckResponse rsp = new HealthcheckResponse();
+ HealthCheckResponse rsp = new HealthCheckResponse();
try {
// Generated RequestId
String requestId = requestContext.getProperty("requestId").toString();
- logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
-
- // set APIH status, this is the main entry point
- rsp.setApih(HealthcheckStatus.UP.toString());
- // set BPMN
- rsp.setBpmn(querySubsystemHealth(MsoSubsystems.BPMN));
- // set SDNCAdapter
- rsp.setSdncAdapter(querySubsystemHealth(MsoSubsystems.SDNC));
- // set ASDCController
- rsp.setAsdcController(querySubsystemHealth(MsoSubsystems.ASDC));
- // set CatalogDbAdapter
- rsp.setCatalogdbAdapter(querySubsystemHealth(MsoSubsystems.CATALOGDB));
- // set RequestDbAdapter
- rsp.setRequestdbAdapter(querySubsystemHealth(MsoSubsystems.REQUESTDB));
- // set OpenStackAdapter
- rsp.setOpenstackAdapter(querySubsystemHealth(MsoSubsystems.OPENSTACK));
- // set RequestDbAdapterAttSvc
- rsp.setRequestdbAdapterAttsvc(querySubsystemHealth(MsoSubsystems.REQUESTDBATT));
+ logger.info(LoggingAnchor.TWO, MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
+
+ List<Endpoint> endpoints = config.getEndpoints().stream().filter(item -> {
+ if (!enableBpmn && SoSubsystems.BPMN.equals(item.getSubsystem())) {
+ return false;
+ } else {
+ return true;
+ }
+ }).collect(Collectors.toList());
+
+ for (Endpoint endpoint : endpoints) {
+ rsp.getSubsystems().add(querySubsystemHealth(endpoint));
+ }
+
// set Message
rsp.setMessage(String.format("HttpStatus: %s", HttpStatus.SC_OK));
logger.info(rsp.toString());
@@ -148,70 +141,51 @@ public class GlobalHealthcheckHandler {
protected HttpEntity<String> buildHttpEntityForRequest() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
- headers.set("Content-Type", "application/json");
+ headers.set(HttpHeaders.CONTENT_TYPE, "application/json");
+ headers.set(HttpHeaders.AUTHORIZATION, msoAuth);
HttpEntity<String> entity = new HttpEntity<>("parameters", headers);
return entity;
}
- protected String querySubsystemHealth(MsoSubsystems subsystem) {
+ protected HealthCheckSubsystem querySubsystemHealth(Endpoint subsystem) {
+ HealthCheckStatus status = HealthCheckStatus.DOWN;
+ URI uri = subsystem.getUri();
try {
// get port number for the subsystem
- String ept = getEndpointUrlForSubsystemEnum(subsystem);
-
// build final endpoint url
- UriBuilder builder = UriBuilder.fromPath(ept).path(actuatorContextPath).path(health);
- URI uri = builder.build();
- logger.info("Calculated URL: {}", uri.toString());
+ uri = UriBuilder.fromUri(subsystem.getUri()).path(actuatorContextPath).path(HEALTH).build();
+ logger.info("Calculated URL: {}", uri);
ResponseEntity<SubsystemHealthcheckResponse> result = restTemplate.exchange(uri, HttpMethod.GET,
buildHttpEntityForRequest(), SubsystemHealthcheckResponse.class);
- return processResponseFromSubsystem(result, subsystem);
+ status = processResponseFromSubsystem(result, subsystem);
+
} catch (Exception ex) {
logger.error("Exception occured in GlobalHealthcheckHandler.querySubsystemHealth() ", ex);
- return HealthcheckStatus.DOWN.toString();
}
+
+ return new HealthCheckSubsystem(subsystem.getSubsystem(), uri, status);
}
- protected String processResponseFromSubsystem(ResponseEntity<SubsystemHealthcheckResponse> result,
- MsoSubsystems subsystem) {
+ protected HealthCheckStatus processResponseFromSubsystem(ResponseEntity<SubsystemHealthcheckResponse> result,
+ Endpoint endpoint) {
if (result == null || result.getStatusCodeValue() != HttpStatus.SC_OK) {
logger.error(String.format("Globalhealthcheck: checking subsystem: %s failed ! result object is: %s",
- subsystem, result == null ? "NULL" : result));
- return HealthcheckStatus.DOWN.toString();
+ endpoint.getSubsystem(), result == null ? "NULL" : result));
+ return HealthCheckStatus.DOWN;
}
SubsystemHealthcheckResponse body = result.getBody();
String status = body.getStatus();
if ("UP".equalsIgnoreCase(status)) {
- return HealthcheckStatus.UP.toString();
+ return HealthCheckStatus.UP;
} else {
- logger.error("{}, query health endpoint did not return UP status!", subsystem);
- return HealthcheckStatus.DOWN.toString();
+ logger.error("{}, query health endpoint did not return UP status!", endpoint.getSubsystem());
+ return HealthCheckStatus.DOWN;
}
}
-
- protected String getEndpointUrlForSubsystemEnum(MsoSubsystems subsystem) {
- switch (subsystem) {
- case SDNC:
- return this.endpointSdnc;
- case ASDC:
- return this.endpointAsdc;
- case BPMN:
- return this.endpointBpmn;
- case CATALOGDB:
- return this.endpointCatalogdb;
- case OPENSTACK:
- return this.endpointOpenstack;
- case REQUESTDB:
- return this.endpointRequestdb;
- case REQUESTDBATT:
- return this.endpointRequestdbAttsvc;
- default:
- return "";
- }
- }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheck.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheck.java
new file mode 100644
index 0000000000..1899cdd765
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheck.java
@@ -0,0 +1,84 @@
+package org.onap.so.apihandlerinfra;
+
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@ConfigurationProperties(prefix = "mso.health.enpoints")
+public class HealthCheck {
+
+ private Subsystem subsystem;
+ private URI uri;
+ private HealthCheckStatus status = HealthCheckStatus.DOWN;
+
+ public HealthCheck() {
+
+ }
+
+ public HealthCheck(String subsystem, String uri) {
+ this.subsystem = SoSubsystems.valueOf(subsystem.toUpperCase());
+ this.uri = UriBuilder.fromUri(uri).build();
+ }
+
+ public HealthCheck(Subsystem subsystem, URI uri) {
+ this.subsystem = subsystem;
+ this.uri = uri;
+ }
+
+ public HealthCheck(Subsystem subsystem, URI uri, HealthCheckStatus status) {
+ this.subsystem = subsystem;
+ this.uri = uri;
+ this.status = status;
+ }
+
+ public Subsystem getSubsystem() {
+ return subsystem;
+ }
+
+ public void setSubsystem(Subsystem component) {
+ this.subsystem = component;
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
+ public HealthCheckStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(HealthCheckStatus status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("subsystem", subsystem).append("uri", uri).append("status", status)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof HealthCheck)) {
+ return false;
+ }
+ HealthCheck castOther = (HealthCheck) other;
+ return new EqualsBuilder().append(subsystem, castOther.subsystem).append(uri, castOther.uri)
+ .append(status, castOther.status).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(subsystem).append(uri).append(status).toHashCode();
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConfig.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConfig.java
new file mode 100644
index 0000000000..11fd94bc91
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConfig.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra;
+
+import java.net.URI;
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.validation.annotation.Validated;
+
+@Configuration
+@ConfigurationProperties(prefix = "mso.health")
+@Validated
+public class HealthCheckConfig {
+
+ @NotNull
+ private List<Endpoint> endpoints;
+
+ public List<Endpoint> getEndpoints() {
+ return endpoints;
+ }
+
+ public void setEndpoints(List<Endpoint> endpoints) {
+ this.endpoints = endpoints;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("endpoints", this.endpoints).toString();
+ }
+
+ @Validated
+ public static class Endpoint {
+ @NotNull
+ private Subsystem subsystem;
+ @NotNull
+ private URI uri;
+
+ public Endpoint() {
+
+ }
+
+ public Endpoint(Subsystem subsystem, URI uri) {
+ this.subsystem = subsystem;
+ this.uri = uri;
+ }
+
+ public Subsystem getSubsystem() {
+ return subsystem;
+ }
+
+ public void setSubsystem(Subsystem subsystem) {
+ this.subsystem = subsystem;
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConverter.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConverter.java
new file mode 100644
index 0000000000..ed06018e7b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckConverter.java
@@ -0,0 +1,22 @@
+package org.onap.so.apihandlerinfra;
+
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
+import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.stereotype.Component;
+
+@Component
+public class HealthCheckConverter {
+
+
+ public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
+ if (sourceType.getType() == String.class && targetType.getType() == Subsystem.class) {
+ return SoSubsystems.valueOf(((String) source).toUpperCase());
+ } else if (sourceType.getType() == String.class && targetType.getType() == URI.class) {
+ return UriBuilder.fromUri((String) source).build();
+ } else {
+ return source;
+ }
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckResponse.java
new file mode 100644
index 0000000000..5400249c65
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckResponse.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class HealthCheckResponse {
+
+
+ private List<HealthCheckSubsystem> subsystems = new ArrayList<>();
+ private String message;
+
+
+ public List<HealthCheckSubsystem> getSubsystems() {
+ return subsystems;
+ }
+
+ public void setSubsystems(List<HealthCheckSubsystem> subsystems) {
+ this.subsystems = subsystems;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckStatus.java
index 077a3c2d60..6b31c1f1ed 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckStatus.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckStatus.java
@@ -19,12 +19,12 @@
*/
package org.onap.so.apihandlerinfra;
-public enum HealthcheckStatus {
+public enum HealthCheckStatus {
UP("UP"), DOWN("DOWN");
private String status;
- private HealthcheckStatus(String status) {
+ private HealthCheckStatus(String status) {
this.status = status;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckSubsystem.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckSubsystem.java
new file mode 100644
index 0000000000..e1335b952c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthCheckSubsystem.java
@@ -0,0 +1,40 @@
+package org.onap.so.apihandlerinfra;
+
+import java.net.URI;
+
+public class HealthCheckSubsystem {
+
+ private Subsystem subsystem;
+ private URI uri;
+ private HealthCheckStatus status;
+
+ public HealthCheckSubsystem(Subsystem subsystem, URI uri, HealthCheckStatus status) {
+ this.subsystem = subsystem;
+ this.uri = uri;
+ this.status = status;
+ }
+
+ public Subsystem getSubsystem() {
+ return subsystem;
+ }
+
+ public void setSubsystem(Subsystem subsystem) {
+ this.subsystem = subsystem;
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(URI uri) {
+ this.uri = uri;
+ }
+
+ public HealthCheckStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(HealthCheckStatus status) {
+ this.status = status;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckResponse.java
deleted file mode 100644
index fad3dd4055..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/HealthcheckResponse.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.so.apihandlerinfra;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-public class HealthcheckResponse {
- private String apih;
- private String bpmn;
- private String sdncAdapter;
- private String asdcController;
- private String catalogdbAdapter;
- private String requestdbAdapter;
- private String openstackAdapter;
- private String requestdbAdapterAttsvc;
- private String message = "";
-
- public String getApih() {
- return apih;
- }
-
- public void setApih(String apih) {
- this.apih = apih;
- }
-
- public String getBpmn() {
- return bpmn;
- }
-
- public void setBpmn(String bpmn) {
- this.bpmn = bpmn;
- }
-
- public String getSdncAdapter() {
- return sdncAdapter;
- }
-
- public void setSdncAdapter(String sdncAdapter) {
- this.sdncAdapter = sdncAdapter;
- }
-
- public String getAsdcController() {
- return asdcController;
- }
-
- public void setAsdcController(String asdcController) {
- this.asdcController = asdcController;
- }
-
- public String getCatalogdbAdapter() {
- return catalogdbAdapter;
- }
-
- public void setCatalogdbAdapter(String catalogdbAdapter) {
- this.catalogdbAdapter = catalogdbAdapter;
- }
-
- public String getRequestdbAdapter() {
- return requestdbAdapter;
- }
-
- public void setRequestdbAdapter(String requestdbAdapter) {
- this.requestdbAdapter = requestdbAdapter;
- }
-
- public String getOpenstackAdapter() {
- return openstackAdapter;
- }
-
- public void setOpenstackAdapter(String openstackAdapter) {
- this.openstackAdapter = openstackAdapter;
- }
-
- public String getRequestdbAdapterAttsvc() {
- return requestdbAdapterAttsvc;
- }
-
- public void setRequestdbAdapterAttsvc(String requestdbAdapterAttsvc) {
- this.requestdbAdapterAttsvc = requestdbAdapterAttsvc;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("apih", this.apih).append("pbmn", this.bpmn)
- .append("sdncAdapter", this.sdncAdapter).append("asdcController", this.asdcController)
- .append("catalogdbAdapter", this.catalogdbAdapter).append("requestdbAdapter", this.requestdbAdapter)
- .append("openstackAdapter", this.openstackAdapter)
- .append("requestdbAdapterAttsvc", this.requestdbAdapterAttsvc).append("message", this.message)
- .toString();
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index dd6050bf60..15572f2b39 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -33,6 +33,7 @@ import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.Workflow;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -104,19 +105,14 @@ public class InstanceManagement {
private Response processCustomWorkflowRequest(String requestJSON, Actions action,
HashMap<String, String> instanceIdMap, String version, String requestId,
ContainerRequestContext requestContext) throws ApiException {
- String serviceInstanceId = null;
- if (instanceIdMap != null) {
- serviceInstanceId = instanceIdMap.get("serviceInstanceId");
- }
+ String serviceInstanceId;
Boolean aLaCarte = true;
- long startTime = System.currentTimeMillis();
- ServiceInstancesRequest sir = null;
+ ServiceInstancesRequest sir;
String apiVersion = version.substring(1);
String requestUri = requestHandlerUtils.getRequestUri(requestContext, uriPrefix);
- sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest,
- requestId, requestUri);
+ sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
String requestScope = requestHandlerUtils.deriveRequestScope(action, sir, requestUri);
InfraActiveRequests currentActiveReq =
msoRequest.createRequestObject(sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope);
@@ -149,16 +145,15 @@ public class InstanceManagement {
InfraActiveRequests dup = null;
boolean inProgress = false;
- dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, startTime, msoRequest, null, requestScope,
- currentActiveReq);
+ dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, null, requestScope, currentActiveReq);
if (dup != null) {
inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq);
}
if (dup != null && inProgress) {
- requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, startTime,
- msoRequest, null, requestScope, dup);
+ requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, null, requestScope,
+ dup);
}
ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
@@ -201,7 +196,7 @@ public class InstanceManagement {
.setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
.setRequestAction(action.toString()).setServiceInstanceId(serviceInstanceId).setVnfId(vnfId)
.setServiceType(serviceInstanceType).setVnfType(vnfType)
- .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action))
+ .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, null, aLaCarte, action))
.setApiVersion(apiVersion).setALaCarte(aLaCarte).setRequestUri(requestUri).build();
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
@@ -221,7 +216,7 @@ public class InstanceManagement {
try {
recipeLookupResult = getCustomWorkflowUri(workflowUuid);
- } catch (IOException e) {
+ } catch (Exception e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -248,7 +243,7 @@ public class InstanceManagement {
return recipeLookupResult;
}
- private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) throws IOException {
+ private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) {
String recipeUri = null;
Workflow workflow = catalogDbClient.findWorkflowByArtifactUUID(workflowUuid);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index 67d6a0d1fc..e162a67680 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,9 +24,18 @@ import javax.annotation.PostConstruct;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletProperties;
-import org.onap.so.apihandler.filters.RequestUriFilter;
import org.onap.so.apihandler.filters.RequestIdFilter;
import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper;
+import org.onap.so.apihandlerinfra.infra.rest.Network;
+import org.onap.so.apihandlerinfra.infra.rest.ServiceInstance;
+import org.onap.so.apihandlerinfra.infra.rest.VfModules;
+import org.onap.so.apihandlerinfra.infra.rest.Vnf;
+import org.onap.so.apihandlerinfra.infra.rest.Volumes;
+import org.onap.so.apihandlerinfra.infra.rest.exception.mapper.AAIEntityNotFoundMapper;
+import org.onap.so.apihandlerinfra.infra.rest.exception.mapper.CloudConfigurationNotFoundMapper;
+import org.onap.so.apihandlerinfra.infra.rest.exception.mapper.NoRecipeExceptionMapper;
+import org.onap.so.apihandlerinfra.infra.rest.exception.mapper.RequestConflictMapper;
+import org.onap.so.apihandlerinfra.infra.rest.exception.mapper.WorkflowEngineConnectionMapper;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration;
import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration;
import org.onap.so.apihandlerinfra.tenantisolation.ModelDistributionRequest;
@@ -41,8 +50,6 @@ import io.swagger.jaxrs.listing.SwaggerSerializers;
@ApplicationPath("/")
public class JerseyConfiguration extends ResourceConfig {
-
-
@PostConstruct
public void setUp() {
register(GlobalHealthcheckHandler.class);
@@ -52,6 +59,11 @@ public class JerseyConfiguration extends ResourceConfig {
register(CloudOrchestration.class);
register(CloudResourcesOrchestration.class);
register(OrchestrationRequests.class);
+ register(VfModules.class);
+ register(Vnf.class);
+ register(Network.class);
+ register(Volumes.class);
+ register(ServiceInstance.class);
register(JaxRsFilterLogging.class);
register(ManualTasks.class);
register(TasksHandler.class);
@@ -59,11 +71,16 @@ public class JerseyConfiguration extends ResourceConfig {
register(SwaggerSerializers.class);
register(ApiExceptionMapper.class);
register(RuntimeExceptionMapper.class);
- register(RequestUriFilter.class);
register(RequestIdFilter.class);
register(E2EServiceInstances.class);
register(WorkflowSpecificationsHandler.class);
register(InstanceManagement.class);
+ register(ResumeOrchestrationRequest.class);
+ register(AAIEntityNotFoundMapper.class);
+ register(CloudConfigurationNotFoundMapper.class);
+ register(NoRecipeExceptionMapper.class);
+ register(RequestConflictMapper.class);
+ register(WorkflowEngineConnectionMapper.class);
// this registration seems to be needed to get predictable
// execution behavior for the above JSON Exception Mappers
register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
index 3c06804594..b9b7fcc0d4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
@@ -34,6 +34,7 @@ import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
@@ -49,7 +50,6 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference;
import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
import org.onap.so.apihandlerinfra.tasksbeans.Value;
import org.onap.so.apihandlerinfra.tasksbeans.Variables;
-import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
@@ -91,8 +91,7 @@ public class ManualTasks {
@PathParam("taskId") String taskId, @Context ContainerRequestContext requestContext) throws ApiException {
String requestId = requestContext.getProperty("requestId").toString();
- logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
- long startTime = System.currentTimeMillis();
+ logger.info(LoggingAnchor.TWO, MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
logger.debug("requestId is: {}", requestId);
TasksRequest taskRequest = null;
String apiVersion = version.substring(1);
@@ -139,9 +138,6 @@ public class ManualTasks {
throw validateException;
}
- // Create Request Record
- InfraActiveRequests currentActiveReq =
- msoRequest.createRequestObject(taskRequest, Action.completeTask, requestId, Status.PENDING, request);
// Transform the request to Camunda-style Complete request
Variables variablesForComplete = new Variables();
@@ -155,7 +151,7 @@ public class ManualTasks {
variablesForComplete.setResponseValue(responseValue);
variablesForComplete.setRequestorId(requestorIdValue);
- String camundaJsonReq = null;
+ String camundaJsonReq;
try {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
@@ -174,9 +170,8 @@ public class ManualTasks {
throw validateException;
}
- RequestClient requestClient = null;
- HttpResponse response = null;
- long subStartTime = System.currentTimeMillis();
+ RequestClient requestClient;
+ HttpResponse response;
String requestUrl = taskUri + "/" + taskId + "/complete";
try {
requestClient = reqClientFactory.getRequestClient(requestUrl);
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 277675f310..4bcc0d4111 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
@@ -25,14 +25,12 @@ package org.onap.so.apihandlerinfra;
import java.io.IOException;
import java.io.StringWriter;
-import java.net.URL;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Optional;
import java.util.StringTokenizer;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
@@ -44,13 +42,13 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
-import org.onap.so.apihandlerinfra.validation.MembersValidation;
import org.onap.so.apihandlerinfra.validation.ApplyUpdatedConfigValidation;
import org.onap.so.apihandlerinfra.validation.CloudConfigurationValidation;
import org.onap.so.apihandlerinfra.validation.ConfigurationParametersValidation;
import org.onap.so.apihandlerinfra.validation.CustomWorkflowValidation;
import org.onap.so.apihandlerinfra.validation.InPlaceSoftwareUpdateValidation;
import org.onap.so.apihandlerinfra.validation.InstanceIdMapValidation;
+import org.onap.so.apihandlerinfra.validation.MembersValidation;
import org.onap.so.apihandlerinfra.validation.ModelInfoValidation;
import org.onap.so.apihandlerinfra.validation.PlatformLOBValidation;
import org.onap.so.apihandlerinfra.validation.ProjectOwningEntityValidation;
@@ -65,12 +63,11 @@ import org.onap.so.apihandlerinfra.validation.ValidationRule;
import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
import org.onap.so.apihandlerinfra.vnfbeans.VnfInputs;
import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.LogConstants;
-import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.InstanceDirection;
import org.onap.so.serviceinstancebeans.ModelInfo;
@@ -151,8 +148,7 @@ public class MsoRequest {
mapper.setSerializationInclusion(Include.NON_DEFAULT);
requestErrorStr = mapper.writeValueAsString(re);
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_VALIDATION_ERROR.toString(), ErrorCode.DataError.getValue(),
- "Exception in buildServiceErrorResponse writing exceptionType to string ", e);
+ logger.error("Exception in buildServiceErrorResponse writing exceptionType to string ", e);
}
return builder.buildResponse(httpResponseCode, null, requestErrorStr, version);
@@ -396,8 +392,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(), ErrorCode.DataError.getValue(),
- "Exception when creation record request", e);
+ logger.error("Exception when creation record request", e);
if (!status.equals(Status.FAILED)) {
throw e;
@@ -437,8 +432,7 @@ public class MsoRequest {
aq.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_DB_INSERT_EXC.toString(), ErrorCode.DataError.getValue(),
- "Exception when creation record request", e);
+ logger.error("Exception when creation record request", e);
if (!status.equals(Status.FAILED)) {
throw e;
@@ -465,8 +459,7 @@ public class MsoRequest {
request.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
requestsDbClient.save(request);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(),
- ErrorCode.DataError.getValue(), "Exception when updating record in DB");
+ logger.error("Exception when updating record in DB", e);
logger.debug("Exception: ", e);
}
}
@@ -547,8 +540,7 @@ public class MsoRequest {
return null;
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.APIH_DOM2STR_ERROR.toString(), ErrorCode.DataError.getValue(),
- "Exception in domToStr", e);
+ logger.error("Exception in domToStr", e);
}
return null;
}
@@ -574,7 +566,7 @@ public class MsoRequest {
throws JsonGenerationException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
- // mapper.configure(Feature.WRAP_ROOT_VALUE, true);
+
logger.debug("building sir from object {}", sir);
String requestJSON = mapper.writeValueAsString(sir);
@@ -636,7 +628,7 @@ public class MsoRequest {
public String getVfModuleType(ServiceInstancesRequest sir, String requestScope, Actions action, int reqVersion) {
String serviceInstanceType = null;
- String networkType = null;
+
String vnfType = null;
String vfModuleType = null;
String vfModuleModelName = null;
@@ -785,22 +777,4 @@ public class MsoRequest {
}
- public Optional<URL> buildSelfLinkUrl(String url, String requestId) {
- Optional<URL> selfLinkUrl = Optional.empty();
- String version = "";
- try {
- URL aUrl = new URL(url);
- String aPath = aUrl.getPath();
- if (aPath.indexOf("/v") == -1) {
- version = aPath.substring(aPath.indexOf("/V"), aPath.indexOf("/V") + 4);
- } else {
- version = aPath.substring(aPath.indexOf("/v"), aPath.indexOf("/v") + 4);
- }
- String selfLinkPath = Constants.ORCHESTRATION_REQUESTS_PATH.concat(version).concat(requestId);
- selfLinkUrl = Optional.of(new URL(aUrl.getProtocol(), aUrl.getHost(), aUrl.getPort(), selfLinkPath));
- } catch (Exception e) {
- selfLinkUrl = Optional.empty(); // ignore
- }
- return selfLinkUrl;
- }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
index 9810895ad9..3337c62afd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
@@ -30,6 +30,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -57,7 +58,7 @@ public class NodeHealthcheckHandler {
public Response nodeHealthcheck(@Context ContainerRequestContext requestContext) throws UnknownHostException {
// Generated RequestId
String requestId = requestContext.getProperty("requestId").toString();
- logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
+ logger.info(LoggingAnchor.TWO, MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
return HEALTH_CHECK_RESPONSE;
}
}
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 34dcd4b0c4..8896e93175 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
@@ -35,24 +35,30 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.EnumUtils;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.OrchestrationRequestFormat;
+import org.onap.so.constants.Status;
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.serviceinstancebeans.CloudRequestData;
import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
import org.onap.so.serviceinstancebeans.InstanceReferences;
@@ -61,6 +67,7 @@ import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestList;
import org.onap.so.serviceinstancebeans.RequestStatus;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.utils.UUIDChecker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -69,13 +76,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+
@Path("onap/so/infra/orchestrationRequests")
@Api(value = "onap/so/infra/orchestrationRequests", description = "API Requests for Orchestration requests")
@Component
public class OrchestrationRequests {
private static Logger logger = LoggerFactory.getLogger(OrchestrationRequests.class);
-
+ private static final String ERROR_MESSAGE_PREFIX = "Error Source: %s, Error Message: %s";
@Autowired
private RequestsDbClient requestsDbClient;
@@ -86,20 +94,32 @@ public class OrchestrationRequests {
@Autowired
private ResponseBuilder builder;
+ @Autowired
+ private CamundaRequestHandler camundaRequestHandler;
+
@GET
@Path("/{version:[vV][4-7]}/{requestId}")
@ApiOperation(value = "Find Orchestrated Requests for a given requestId", response = Response.class)
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response getOrchestrationRequest(@PathParam("requestId") String requestId,
- @PathParam("version") String version) throws ApiException {
+ @PathParam("version") String version, @QueryParam("includeCloudRequest") boolean includeCloudRequest,
+ @QueryParam(value = "format") String format) throws ApiException {
String apiVersion = version.substring(1);
GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
-
InfraActiveRequests infraActiveRequest = null;
List<org.onap.so.db.request.beans.RequestProcessingData> requestProcessingData = null;
+
+ if (!UUIDChecker.isValidUUID(requestId)) {
+
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MODIFIED_BY_APIHANDLER).build();
+ throw new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
+ }
try {
infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(requestId);
@@ -109,14 +129,11 @@ public class OrchestrationRequests {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
-
-
ValidateException validateException =
new ValidateException.Builder("Exception while communciate with Request DB - Infra Request Lookup",
HttpStatus.SC_NOT_FOUND, ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e)
.errorInfo(errorLoggerInfo).build();
-
throw validateException;
}
@@ -126,7 +143,6 @@ public class OrchestrationRequests {
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)
@@ -135,7 +151,8 @@ public class OrchestrationRequests {
throw validateException;
}
- Request request = mapInfraActiveRequestToRequest(infraActiveRequest);
+ Request request = mapInfraActiveRequestToRequest(infraActiveRequest, includeCloudRequest, format);
+
if (!requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
}
@@ -150,16 +167,15 @@ public class OrchestrationRequests {
@ApiOperation(value = "Find Orchestrated Requests for a URI Information", response = Response.class)
@Produces(MediaType.APPLICATION_JSON)
@Transactional
- public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version)
+ public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version,
+ @QueryParam("includeCloudRequest") boolean includeCloudRequest, @QueryParam(value = "format") String format)
throws ApiException {
- long startTime = System.currentTimeMillis();
-
MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
- List<InfraActiveRequests> activeRequests = null;
+ List<InfraActiveRequests> activeRequests;
- GetOrchestrationListResponse orchestrationList = null;
+ GetOrchestrationListResponse orchestrationList;
Map<String, List<String>> orchestrationMap;
String apiVersion = version.substring(1);
@@ -188,7 +204,8 @@ public class OrchestrationRequests {
List<RequestProcessingData> requestProcessingData =
requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId());
RequestList requestList = new RequestList();
- Request request = mapInfraActiveRequestToRequest(infraActive);
+ Request request = mapInfraActiveRequestToRequest(infraActive, includeCloudRequest, format);
+
if (!requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
}
@@ -200,7 +217,6 @@ public class OrchestrationRequests {
return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationList, apiVersion);
}
-
@POST
@Path("/{version: [vV][4-7]}/{requestId}/unlock")
@Consumes(MediaType.APPLICATION_JSON)
@@ -210,12 +226,10 @@ public class OrchestrationRequests {
public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId,
@PathParam("version") String version) throws ApiException {
- long startTime = System.currentTimeMillis();
logger.debug("requestId is: {}", requestId);
- ServiceInstancesRequest sir = null;
+ ServiceInstancesRequest sir;
- InfraActiveRequests infraActiveRequest = null;
- Request request = null;
+ InfraActiveRequests infraActiveRequest;
try {
ObjectMapper mapper = new ObjectMapper();
@@ -251,7 +265,6 @@ public class OrchestrationRequests {
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",
HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo)
@@ -261,9 +274,10 @@ public class OrchestrationRequests {
} else {
String status = infraActiveRequest.getRequestStatus();
- if (status.equalsIgnoreCase("IN_PROGRESS") || status.equalsIgnoreCase("PENDING")
- || status.equalsIgnoreCase("PENDING_MANUAL_TASK")) {
- infraActiveRequest.setRequestStatus("UNLOCKED");
+ if (Status.IN_PROGRESS.toString().equalsIgnoreCase(status)
+ || Status.PENDING.toString().equalsIgnoreCase(status)
+ || Status.PENDING_MANUAL_TASK.toString().equalsIgnoreCase(status)) {
+ infraActiveRequest.setRequestStatus(Status.UNLOCKED.toString());
infraActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
infraActiveRequest.setRequestId(requestId);
requestsDbClient.save(infraActiveRequest);
@@ -273,7 +287,6 @@ public class OrchestrationRequests {
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",
@@ -286,8 +299,8 @@ public class OrchestrationRequests {
return Response.status(HttpStatus.SC_NO_CONTENT).entity("").build();
}
- private Request mapInfraActiveRequestToRequest(InfraActiveRequests iar) throws ApiException {
-
+ protected Request mapInfraActiveRequestToRequest(InfraActiveRequests iar, boolean includeCloudRequest,
+ String format) throws ApiException {
String requestBody = iar.getRequestBody();
Request request = new Request();
@@ -296,10 +309,11 @@ public class OrchestrationRequests {
request.setRequestId(iar.getRequestId());
request.setRequestScope(iar.getRequestScope());
request.setRequestType(iar.getRequestAction());
- String rollbackStatusMessage = iar.getRollbackStatusMessage();
- String flowStatusMessage = iar.getFlowStatus();
- String retryStatusMessage = iar.getRetryStatusMessage();
+ String originalRequestId = iar.getOriginalRequestId();
+ if (originalRequestId != null) {
+ request.setOriginalRequestId(originalRequestId);
+ }
InstanceReferences ir = new InstanceReferences();
if (iar.getNetworkId() != null)
@@ -329,8 +343,6 @@ public class OrchestrationRequests {
if (iar.getInstanceGroupName() != null)
ir.setInstanceGroupName(iar.getInstanceGroupName());
-
-
request.setInstanceReferences(ir);
RequestDetails requestDetails = null;
@@ -367,52 +379,125 @@ public class OrchestrationRequests {
String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getEndTime()) + " GMT";
request.setFinishTime(endTimeStamp);
}
- String statusMessages = null;
+
RequestStatus status = new RequestStatus();
- if (iar.getStatusMessage() != null) {
- statusMessages = "STATUS: " + iar.getStatusMessage();
+
+ if (iar.getModifyTime() != null) {
+ String timeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getModifyTime()) + " GMT";
+ status.setTimeStamp(timeStamp);
}
- if (flowStatusMessage != null) {
- if (statusMessages != null) {
- statusMessages = statusMessages + " " + "FLOW STATUS: " + flowStatusMessage;
+
+ status.setRequestState(mapRequestStatusToRequest(iar, format));
+
+ if (iar.getProgress() != null) {
+ status.setPercentProgress(iar.getProgress().intValue());
+ }
+
+ if (iar.getCloudApiRequests() != null && !iar.getCloudApiRequests().isEmpty() && includeCloudRequest) {
+ iar.getCloudApiRequests().stream().forEach(cloudRequest -> {
+ try {
+ request.getCloudRequestData()
+ .add(new CloudRequestData(mapper.readValue(cloudRequest.getRequestBody(), Object.class),
+ cloudRequest.getCloudIdentifier()));
+ } catch (Exception e) {
+ logger.error("Error reading Cloud Request", e);
+ }
+ });
+ }
+
+ mapRequestStatusAndExtSysErrSrcToRequest(iar, status, format);
+
+ request.setRequestStatus(status);
+ return request;
+ }
+
+ protected String mapRequestStatusToRequest(InfraActiveRequests iar, String format) {
+ if (iar.getRequestStatus() != null) {
+ boolean requestFormat = false;
+ if (format != null) {
+ requestFormat = EnumUtils.isValidEnum(OrchestrationRequestFormat.class, format.toUpperCase());
+ }
+ if (requestFormat) {
+ return iar.getRequestStatus();
} else {
- statusMessages = "FLOW STATUS: " + flowStatusMessage;
+ if (Status.ABORTED.toString().equalsIgnoreCase(iar.getRequestStatus())
+ || Status.ROLLED_BACK.toString().equalsIgnoreCase(iar.getRequestStatus())
+ || Status.ROLLED_BACK_TO_ASSIGNED.toString().equalsIgnoreCase(iar.getRequestStatus())
+ || Status.ROLLED_BACK_TO_CREATED.toString().equalsIgnoreCase(iar.getRequestStatus())) {
+ return Status.FAILED.toString();
+ } else {
+ return iar.getRequestStatus();
+ }
}
}
- if (retryStatusMessage != null) {
- if (statusMessages != null) {
- statusMessages = statusMessages + " " + "RETRY STATUS: " + retryStatusMessage;
- } else {
- statusMessages = "RETRY STATUS: " + retryStatusMessage;
+ return null;
+ }
+
+ protected void mapRequestStatusAndExtSysErrSrcToRequest(InfraActiveRequests iar, RequestStatus status,
+ String format) throws ContactCamundaException {
+ String rollbackStatusMessage = iar.getRollbackStatusMessage();
+ String flowStatusMessage = iar.getFlowStatus();
+ String retryStatusMessage = iar.getRetryStatusMessage();
+ String taskName = null;
+
+ if (flowStatusMessage != null && !flowStatusMessage.equals("Successfully completed all Building Blocks")
+ && !flowStatusMessage.equals("All Rollback flows have completed successfully")) {
+ taskName = camundaRequestHandler.getTaskName(iar.getRequestId());
+ if (taskName != null) {
+ flowStatusMessage = flowStatusMessage + " TASK INFORMATION: " + taskName;
}
}
- if (rollbackStatusMessage != null) {
- if (statusMessages != null) {
- statusMessages = statusMessages + " " + "ROLLBACK STATUS: " + rollbackStatusMessage;
+
+ String statusMessages = null;
+ if (iar.getStatusMessage() != null) {
+ if (StringUtils.isNotBlank(iar.getExtSystemErrorSource())) {
+ statusMessages = "STATUS: "
+ + String.format(ERROR_MESSAGE_PREFIX, iar.getExtSystemErrorSource(), iar.getStatusMessage());
} else {
- statusMessages = "ROLLBACK STATUS: " + rollbackStatusMessage;
+ statusMessages = "STATUS: " + iar.getStatusMessage();
}
}
- if (statusMessages != null) {
- status.setStatusMessage(statusMessages);
- }
- if (iar.getModifyTime() != null) {
- String timeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(iar.getModifyTime()) + " GMT";
- status.setTimeStamp(timeStamp);
- }
+ if (OrchestrationRequestFormat.STATUSDETAIL.toString().equalsIgnoreCase(format)) {
+ if (flowStatusMessage != null) {
+ status.setFlowStatus(flowStatusMessage);
+ }
+ if (retryStatusMessage != null) {
+ status.setRetryStatusMessage(retryStatusMessage);
+ }
+ if (rollbackStatusMessage != null) {
+ status.setRollbackStatusMessage(rollbackStatusMessage);
+ }
+ status.setExtSystemErrorSource(iar.getExtSystemErrorSource());
+ status.setRollbackExtSystemErrorSource(iar.getRollbackExtSystemErrorSource());
+ } else {
- if (iar.getRequestStatus() != null) {
- status.setRequestState(iar.getRequestStatus());
+ if (flowStatusMessage != null) {
+ if (statusMessages != null) {
+ statusMessages = statusMessages + " " + "FLOW STATUS: " + flowStatusMessage;
+ } else {
+ statusMessages = "FLOW STATUS: " + flowStatusMessage;
+ }
+ }
+ if (retryStatusMessage != null) {
+ if (statusMessages != null) {
+ statusMessages = statusMessages + " " + "RETRY STATUS: " + retryStatusMessage;
+ } else {
+ statusMessages = "RETRY STATUS: " + retryStatusMessage;
+ }
+ }
+ if (rollbackStatusMessage != null) {
+ if (statusMessages != null) {
+ statusMessages = statusMessages + " " + "ROLLBACK STATUS: " + rollbackStatusMessage;
+ } else {
+ statusMessages = "ROLLBACK STATUS: " + rollbackStatusMessage;
+ }
+ }
}
- if (iar.getProgress() != null) {
- status.setPercentProgress(iar.getProgress().intValue());
+ if (statusMessages != null) {
+ status.setStatusMessage(statusMessages);
}
-
- request.setRequestStatus(status);
-
- return request;
}
public List<org.onap.so.serviceinstancebeans.RequestProcessingData> mapRequestProcessingData(
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index bbcc120ab6..2fddfd9a95 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -24,8 +24,18 @@
package org.onap.so.apihandlerinfra;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+import java.io.IOException;
+import java.net.URL;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
@@ -47,7 +57,11 @@ import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
+import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -55,44 +69,28 @@ 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.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.RelatedInstance;
import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
-import org.onap.so.utils.CryptoUtils;
import org.onap.so.utils.UUIDChecker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.env.Environment;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpStatusCodeException;
-import org.springframework.web.client.RestTemplate;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.xml.bind.DatatypeConverter;
-import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
-import java.io.IOException;
-import java.net.URL;
-import java.security.GeneralSecurityException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import org.springframework.web.client.RestClientException;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Component
-public class RequestHandlerUtils {
+public class RequestHandlerUtils extends AbstractRestHandler {
private static Logger logger = LoggerFactory.getLogger(RequestHandlerUtils.class);
@@ -114,7 +112,7 @@ public class RequestHandlerUtils {
private MsoRequest msoRequest;
@Autowired
- private RestTemplate restTemplate;
+ private CamundaRequestHandler camundaRequestHandler;
@Autowired
private CatalogDbClient catalogDbClient;
@@ -180,8 +178,8 @@ public class RequestHandlerUtils {
ObjectMapper mapper = new ObjectMapper();
jsonResponse = mapper.readValue(camundaResp.getResponse(), ServiceInstancesResponse.class);
jsonResponse.getRequestReferences().setRequestId(requestClientParameter.getRequestId());
- Optional<URL> selfLinkUrl = msoRequest.buildSelfLinkUrl(currentActiveReq.getRequestUrl(),
- requestClientParameter.getRequestId());
+ Optional<URL> selfLinkUrl =
+ buildSelfLinkUrl(currentActiveReq.getRequestUrl(), requestClientParameter.getRequestId());
if (selfLinkUrl.isPresent()) {
jsonResponse.getRequestReferences().setRequestSelfLink(selfLinkUrl.get());
} else {
@@ -293,12 +291,11 @@ public class RequestHandlerUtils {
return requestUri;
}
- public InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap, long startTime,
- MsoRequest msoRequest, String instanceName, String requestScope, InfraActiveRequests currentActiveReq)
- throws ApiException {
+ public InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap,
+ String instanceName, String requestScope, InfraActiveRequests currentActiveReq) throws ApiException {
InfraActiveRequests dup = null;
try {
- if (!(instanceName == null && requestScope.equals("service") && (action == Action.createInstance
+ if (!(instanceName == null && "service".equals(requestScope) && (action == Action.createInstance
|| action == Action.activateInstance || action == Action.assignInstance))) {
dup = infraActiveRequestsClient.checkInstanceNameDuplicate(instanceIdMap, instanceName, requestScope);
}
@@ -319,30 +316,25 @@ public class RequestHandlerUtils {
public boolean camundaHistoryCheck(InfraActiveRequests duplicateRecord, InfraActiveRequests currentActiveReq)
throws RequestDbFailureException, ContactCamundaException {
String requestId = duplicateRecord.getRequestId();
- String path = env.getProperty("mso.camunda.rest.history.uri") + requestId;
- String targetUrl = env.getProperty("mso.camundaURL") + path;
- HttpHeaders headers =
- setCamundaHeaders(env.getRequiredProperty("mso.camundaAuth"), env.getRequiredProperty("mso.msoKey"));
- HttpEntity<?> requestEntity = new HttpEntity<>(headers);
ResponseEntity<List<HistoricProcessInstanceEntity>> response = null;
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, ErrorCode.DataError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ response = camundaRequestHandler.getCamundaProcessInstanceHistory(requestId);
+ } catch (RestClientException e) {
+ logger.error("Error querying Camunda for process-instance history for requestId: {}, exception: {}",
+ requestId, e.getMessage());
ContactCamundaException contactCamundaException =
- new ContactCamundaException.Builder(requestId, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
+ new ContactCamundaException.Builder("process-instance", requestId, e.toString(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .build();
updateStatus(currentActiveReq, Status.FAILED, contactCamundaException.getMessage());
throw contactCamundaException;
}
+
if (response.getBody().isEmpty()) {
updateStatus(duplicateRecord, Status.COMPLETE, "Request Completed");
}
for (HistoricProcessInstance instance : response.getBody()) {
- if (instance.getState().equals("ACTIVE")) {
+ if (("ACTIVE").equals(instance.getState())) {
return true;
} else {
updateStatus(duplicateRecord, Status.COMPLETE, "Request Completed");
@@ -351,26 +343,8 @@ public class RequestHandlerUtils {
return false;
}
- protected HttpHeaders setCamundaHeaders(String auth, String msoKey) {
- HttpHeaders headers = new HttpHeaders();
- List<org.springframework.http.MediaType> acceptableMediaTypes = new ArrayList<>();
- acceptableMediaTypes.add(org.springframework.http.MediaType.APPLICATION_JSON);
- headers.setAccept(acceptableMediaTypes);
- try {
- String userCredentials = CryptoUtils.decrypt(auth, msoKey);
- if (userCredentials != null) {
- headers.add(HttpHeaders.AUTHORIZATION,
- "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
- }
- } catch (GeneralSecurityException e) {
- logger.error("Security exception", e);
- }
- return headers;
- }
-
public ServiceInstancesRequest convertJsonToServiceInstanceRequest(String requestJSON, Actions action,
- long startTime, ServiceInstancesRequest sir, MsoRequest msoRequest, String requestId, String requestUri)
- throws ApiException {
+ String requestId, String requestUri) throws ApiException {
try {
ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(requestJSON, ServiceInstancesRequest.class);
@@ -415,8 +389,8 @@ public class RequestHandlerUtils {
}
public void buildErrorOnDuplicateRecord(InfraActiveRequests currentActiveReq, Actions action,
- HashMap<String, String> instanceIdMap, long startTime, MsoRequest msoRequest, String instanceName,
- String requestScope, InfraActiveRequests dup) throws ApiException {
+ HashMap<String, String> instanceIdMap, String instanceName, String requestScope, InfraActiveRequests dup)
+ throws ApiException {
String instance = null;
if (instanceName != null) {
@@ -505,24 +479,11 @@ public class RequestHandlerUtils {
boolean isAlaCarte, Actions action) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
- if (msoRawRequest != null) {
- ServiceInstancesRequest sir = mapper.readValue(msoRawRequest, ServiceInstancesRequest.class);
- if (serviceInstRequest != null && serviceInstRequest.getRequestDetails() != null
- && serviceInstRequest.getRequestDetails().getRequestParameters() != null) {
- if (!isAlaCarte && Action.createInstance.equals(action)) {
- sir.getRequestDetails()
- .setCloudConfiguration(serviceInstRequest.getRequestDetails().getCloudConfiguration());
- sir.getRequestDetails().getRequestParameters().setUserParams(
- serviceInstRequest.getRequestDetails().getRequestParameters().getUserParams());
- }
- sir.getRequestDetails().getRequestParameters()
- .setUsePreload(serviceInstRequest.getRequestDetails().getRequestParameters().getUsePreload());
- }
-
- logger.debug("Value as string: {}", mapper.writeValueAsString(sir));
- return mapper.writeValueAsString(sir);
+ if (serviceInstRequest != null) {
+ return mapper.writeValueAsString(serviceInstRequest);
+ } else {
+ return msoRawRequest;
}
- return null;
}
public Optional<String> retrieveModelName(RequestParameters requestParams) {
@@ -622,4 +583,107 @@ public class RequestHandlerUtils {
return requestScope;
}
+ protected InfraActiveRequests createNewRecordCopyFromInfraActiveRequest(InfraActiveRequests infraActiveRequest,
+ String requestId, Timestamp startTimeStamp, String source, String requestUri, String requestorId,
+ String originalRequestId) throws ApiException {
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId(requestId);
+ request.setStartTime(startTimeStamp);
+ request.setSource(source);
+ request.setRequestUrl(requestUri);
+ request.setProgress(new Long(5));
+ request.setRequestorId(requestorId);
+ request.setRequestStatus(Status.IN_PROGRESS.toString());
+ request.setOriginalRequestId(originalRequestId);
+ request.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ if (infraActiveRequest != null) {
+ request.setTenantId(infraActiveRequest.getTenantId());
+ request.setRequestBody(updateRequestorIdInRequestBody(infraActiveRequest, requestorId));
+ request.setAicCloudRegion(infraActiveRequest.getAicCloudRegion());
+ request.setRequestScope(infraActiveRequest.getRequestScope());
+ request.setRequestAction(infraActiveRequest.getRequestAction());
+ setInstanceIdAndName(infraActiveRequest, request);
+ }
+ return request;
+ }
+
+ protected void setInstanceIdAndName(InfraActiveRequests infraActiveRequest,
+ InfraActiveRequests currentActiveRequest) throws ApiException {
+ String requestScope = infraActiveRequest.getRequestScope();
+ try {
+ ModelType type = ModelType.valueOf(requestScope);
+ String instanceName = type.getName(infraActiveRequest);
+ if (instanceName == null && type.equals(ModelType.vfModule)) {
+ logger.error("vfModule for requestId: {} being resumed does not have an instanceName.",
+ infraActiveRequest.getRequestId());
+ ValidateException validateException = new ValidateException.Builder(
+ "vfModule for requestId: " + infraActiveRequest.getRequestId()
+ + " being resumed does not have an instanceName.",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).build();
+ updateStatus(currentActiveRequest, Status.FAILED, validateException.getMessage());
+ throw validateException;
+ }
+ if (instanceName != null) {
+ type.setName(currentActiveRequest, instanceName);
+ }
+ type.setId(currentActiveRequest, type.getId(infraActiveRequest));
+ } catch (IllegalArgumentException e) {
+ logger.error(
+ "requestScope \"{}\" does not match a ModelType enum. Unable to set instanceId and instanceName from the original request.",
+ requestScope);
+ }
+ }
+
+ protected Boolean getIsBaseVfModule(ModelInfo modelInfo, Actions action, String vnfType,
+ String sdcServiceModelVersion, InfraActiveRequests currentActiveReq) throws ApiException {
+ // Get VF Module-specific base module indicator
+ VfModule vfm = null;
+ String modelVersionId = modelInfo.getModelVersionId();
+ Boolean isBaseVfModule = false;
+
+ if (modelVersionId != null) {
+ vfm = catalogDbClient.getVfModuleByModelUUID(modelVersionId);
+ } else if (modelInfo.getModelInvariantId() != null && modelInfo.getModelVersion() != null) {
+ vfm = catalogDbClient.getVfModuleByModelInvariantUUIDAndModelVersion(modelInfo.getModelInvariantId(),
+ modelInfo.getModelVersion());
+ }
+
+ if (vfm != null) {
+ if (vfm.getIsBase()) {
+ isBaseVfModule = true;
+ }
+ } else if (action == Action.createInstance || action == Action.updateInstance) {
+ String serviceVersionText = "";
+ if (sdcServiceModelVersion != null && !sdcServiceModelVersion.isEmpty()) {
+ serviceVersionText = " with version " + sdcServiceModelVersion;
+ }
+ 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, 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());
+ throw vfModuleException;
+ }
+ return isBaseVfModule;
+ }
+
+ protected ModelType getModelType(Actions action, ModelInfo modelInfo) {
+ if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
+ return ModelType.vnf;
+ } else if (action == Action.addMembers || action == Action.removeMembers) {
+ return ModelType.instanceGroup;
+ } else {
+ return modelInfo.getModelType();
+ }
+ }
+
+ protected String updateRequestorIdInRequestBody(InfraActiveRequests infraActiveRequest, String newRequestorId) {
+ String requestBody = infraActiveRequest.getRequestBody();
+ return requestBody.replaceAll(
+ "(?s)(\"requestInfo\"\\s*?:\\s*?\\{.*?\"requestorId\"\\s*?:\\s*?\")(.*?)(\"[ ]*(?:,|\\R|\\}))",
+ "$1" + newRequestorId + "$3");
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
new file mode 100644
index 0000000000..ed300d95c2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
@@ -0,0 +1,277 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra;
+
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import javax.transaction.Transactional;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.http.HttpStatus;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.HttpHeadersConstants;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.logger.MdcConstants;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Path("onap/so/infra/orchestrationRequests")
+@Api(value = "onap/so/infra/orchestrationRequests")
+@Component
+public class ResumeOrchestrationRequest {
+ private static Logger logger = LoggerFactory.getLogger(ResumeOrchestrationRequest.class);
+ private static final String SAVE_TO_DB = "save instance to db";
+ private static String uriPrefix = "/orchestrationRequests/";
+
+ @Autowired
+ private RequestHandlerUtils requestHandlerUtils;
+
+ @Autowired
+ private ServiceInstances serviceInstances;
+
+ @Autowired
+ private RequestsDbClient requestsDbClient;
+
+ @Autowired
+ private MsoRequest msoRequest;
+
+ @POST
+ @Path("/{version:[vV][7]}/{requestId}/resume")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Resume request for a given requestId", response = Response.class)
+ @Transactional
+ public Response resumeOrchestrationRequest(@PathParam("requestId") String requestId,
+ @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ String currentRequestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+ logger.info("Beginning resume operation for new request: {}", currentRequestId);
+ InfraActiveRequests infraActiveRequest = null;
+ String source = MDC.get(MdcConstants.ORIGINAL_PARTNER_NAME);
+ String requestorId = MDC.get(HttpHeadersConstants.REQUESTOR_ID);
+ requestHandlerUtils.getRequestUri(requestContext, uriPrefix);
+ String requestUri = MDC.get(LogConstants.HTTP_URL);
+ version = version.substring(1);
+
+ try {
+ infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
+ } catch (HttpClientErrorException e) {
+ logger.error("Error occurred while performing requestDb lookup by requestId: " + requestId, e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
+ throw new ValidateException.Builder("Exception while performing requestDb lookup by requestId",
+ HttpStatus.SC_NOT_FOUND, ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
+
+ InfraActiveRequests currentActiveRequest = requestHandlerUtils.createNewRecordCopyFromInfraActiveRequest(
+ infraActiveRequest, currentRequestId, startTimeStamp, source, requestUri, requestorId, requestId);
+
+ if (infraActiveRequest == null) {
+ logger.error("No infraActiveRequest record found for requestId: {} in requesteDb lookup", requestId);
+ 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: " + requestId, HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+ requestHandlerUtils.updateStatus(currentActiveRequest, Status.FAILED, validateException.getMessage());
+ throw validateException;
+
+ }
+
+ return resumeRequest(infraActiveRequest, currentActiveRequest, version, requestUri);
+ }
+
+ protected Response resumeRequest(InfraActiveRequests infraActiveRequest, InfraActiveRequests currentActiveRequest,
+ String version, String requestUri) throws ApiException {
+ String requestBody = infraActiveRequest.getRequestBody();
+ Action action = Action.valueOf(infraActiveRequest.getRequestAction());
+ String requestId = currentActiveRequest.getRequestId();
+ String requestScope = infraActiveRequest.getRequestScope();
+ String instanceName = getInstanceName(infraActiveRequest, requestScope, currentActiveRequest);
+ HashMap<String, String> instanceIdMap = setInstanceIdMap(infraActiveRequest, requestScope);
+
+ checkForInProgressRequest(currentActiveRequest, instanceIdMap, requestScope, instanceName, action);
+
+ ServiceInstancesRequest sir = null;
+ sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestBody, action, requestId, requestUri);
+ Boolean aLaCarte = sir.getRequestDetails().getRequestParameters().getALaCarte();
+
+ String pnfCorrelationId = serviceInstances.getPnfCorrelationId(sir);
+ RecipeLookupResult recipeLookupResult = serviceInstances.getServiceInstanceOrchestrationURI(sir, action,
+ msoRequest.getAlacarteFlag(sir), currentActiveRequest);
+
+ requestDbSave(currentActiveRequest);
+
+ if (aLaCarte == null) {
+ aLaCarte = setALaCarteFlagIfNull(requestScope, action);
+ }
+
+ RequestClientParameter requestClientParameter = setRequestClientParameter(recipeLookupResult, version,
+ infraActiveRequest, currentActiveRequest, pnfCorrelationId, aLaCarte, sir);
+
+ return requestHandlerUtils.postBPELRequest(currentActiveRequest, requestClientParameter,
+ recipeLookupResult.getOrchestrationURI(), requestScope);
+ }
+
+ protected Boolean setALaCarteFlagIfNull(String requestScope, Action action) {
+ Boolean aLaCarteFlag;
+ if (!requestScope.equalsIgnoreCase(ModelType.service.name()) && action != Action.recreateInstance) {
+ aLaCarteFlag = true;
+ } else {
+ aLaCarteFlag = false;
+ }
+ return aLaCarteFlag;
+ }
+
+ protected HashMap<String, String> setInstanceIdMap(InfraActiveRequests infraActiveRequest, String requestScope) {
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ ModelType type;
+ try {
+ type = ModelType.valueOf(requestScope);
+ instanceIdMap.put(type.name() + "InstanceId", type.getId(infraActiveRequest));
+ } catch (IllegalArgumentException e) {
+ logger.error("requestScope \"{}\" does not match a ModelType enum.", requestScope);
+ }
+ return instanceIdMap;
+ }
+
+ protected String getInstanceName(InfraActiveRequests infraActiveRequest, String requestScope,
+ InfraActiveRequests currentActiveRequest) throws ValidateException, RequestDbFailureException {
+ ModelType type;
+ String instanceName = "";
+ try {
+ type = ModelType.valueOf(requestScope);
+ instanceName = type.getName(infraActiveRequest);
+ } catch (IllegalArgumentException e) {
+ logger.error("requestScope \"{}\" does not match a ModelType enum.", requestScope);
+ ValidateException validateException = new ValidateException.Builder(
+ "requestScope: \"" + requestScope + "\" from request: " + infraActiveRequest.getRequestId()
+ + " does not match a ModelType enum.",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).build();
+ requestHandlerUtils.updateStatus(currentActiveRequest, Status.FAILED, validateException.getMessage());
+ throw validateException;
+ }
+ return instanceName;
+ }
+
+ protected void checkForInProgressRequest(InfraActiveRequests currentActiveRequest,
+ HashMap<String, String> instanceIdMap, String requestScope, String instanceName, Action action)
+ throws ApiException {
+ boolean inProgress = false;
+ InfraActiveRequests requestInProgress = requestHandlerUtils.duplicateCheck(action, instanceIdMap, instanceName,
+ requestScope, currentActiveRequest);
+ if (requestInProgress != null) {
+ inProgress = requestHandlerUtils.camundaHistoryCheck(requestInProgress, currentActiveRequest);
+ }
+ if (inProgress) {
+ requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveRequest, action, instanceIdMap, instanceName,
+ requestScope, requestInProgress);
+ }
+ }
+
+ protected void requestDbSave(InfraActiveRequests currentActiveRequest) throws RequestDbFailureException {
+ try {
+ requestsDbClient.save(currentActiveRequest);
+ } catch (Exception e) {
+ logger.error("Exception while saving request to requestDb", e);
+ 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();
+ }
+ }
+
+ protected RequestClientParameter setRequestClientParameter(RecipeLookupResult recipeLookupResult, String version,
+ InfraActiveRequests infraActiveRequest, InfraActiveRequests currentActiveRequest, String pnfCorrelationId,
+ Boolean aLaCarte, ServiceInstancesRequest sir) throws ApiException {
+ RequestClientParameter requestClientParameter = null;
+ Action action = Action.valueOf(infraActiveRequest.getRequestAction());
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+
+ Boolean isBaseVfModule = false;
+ if (requestHandlerUtils.getModelType(action, modelInfo).equals(ModelType.vfModule)) {
+ isBaseVfModule = requestHandlerUtils.getIsBaseVfModule(modelInfo, action, infraActiveRequest.getVnfType(),
+ msoRequest.getSDCServiceModelVersion(sir), currentActiveRequest);
+ }
+
+ try {
+ requestClientParameter =
+ new RequestClientParameter.Builder().setRequestId(currentActiveRequest.getRequestId())
+ .setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
+ .setRequestAction(infraActiveRequest.getRequestAction())
+ .setServiceInstanceId(infraActiveRequest.getServiceInstanceId())
+ .setPnfCorrelationId(pnfCorrelationId).setVnfId(infraActiveRequest.getVnfId())
+ .setVfModuleId(infraActiveRequest.getVfModuleId())
+ .setVolumeGroupId(infraActiveRequest.getVolumeGroupId())
+ .setNetworkId(infraActiveRequest.getNetworkId())
+ .setServiceType(infraActiveRequest.getServiceType())
+ .setVnfType(infraActiveRequest.getVnfType())
+ .setVfModuleType(msoRequest.getVfModuleType(sir, infraActiveRequest.getRequestScope(),
+ action, Integer.parseInt(version)))
+ .setNetworkType(infraActiveRequest.getNetworkType())
+ .setRequestDetails(requestHandlerUtils
+ .mapJSONtoMSOStyle(infraActiveRequest.getRequestBody(), sir, aLaCarte, action))
+ .setApiVersion(version).setALaCarte(aLaCarte)
+ .setRequestUri(currentActiveRequest.getRequestUrl())
+ .setInstanceGroupId(infraActiveRequest.getInstanceGroupId()).build();
+ } catch (IOException e) {
+ logger.error("IOException while generating requestClientParameter to send to BPMN", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new ValidateException.Builder(
+ "IOException while generating requestClientParameter to send to BPMN: " + e.getMessage(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
+ }
+ return requestClientParameter;
+ }
+}
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 931a1eb52b..9b72bdc608 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
@@ -23,12 +23,24 @@
package org.onap.so.apihandlerinfra;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import javax.transaction.Transactional;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.CommonConstants;
@@ -38,8 +50,10 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
-import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
+import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
+import org.onap.so.apihandlerinfra.infra.rest.validators.RequestValidatorListenerRunner;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Recipe;
@@ -74,29 +88,18 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-import javax.transaction.Transactional;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@Api(value = "/onap/so/infra/serviceInstantiation", description = "Infrastructure API Requests for Service Instances")
-public class ServiceInstances {
+public class ServiceInstances extends AbstractRestHandler {
private static Logger logger = LoggerFactory.getLogger(MsoRequest.class);
private static String NAME = "name";
@@ -108,6 +111,9 @@ public class ServiceInstances {
private Environment env;
@Autowired
+ private RestTemplate restTemplate;
+
+ @Autowired
private CatalogDbClient catalogDbClient;
@Autowired
@@ -119,6 +125,9 @@ public class ServiceInstances {
@Autowired
private RequestHandlerUtils requestHandlerUtils;
+ @Autowired
+ private RequestValidatorListenerRunner requestValidatorListenerRunner;
+
@POST
@Path("/{version:[vV][5-7]}/serviceInstances")
@Consumes(MediaType.APPLICATION_JSON)
@@ -203,7 +212,7 @@ public class ServiceInstances {
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
throws ApiException {
String requestId = requestHandlerUtils.getRequestId(requestContext);
- HashMap<String, String> instanceIdMap = new HashMap<String, String>();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
return serviceInstances(request, Action.unassignInstance, instanceIdMap, version, requestId,
requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
@@ -435,7 +444,6 @@ public class ServiceInstances {
requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
}
-
@DELETE
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@@ -584,7 +592,6 @@ public class ServiceInstances {
requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
}
-
@POST
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups")
@Consumes(MediaType.APPLICATION_JSON)
@@ -757,16 +764,45 @@ public class ServiceInstances {
requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
}
+ /**
+ * This method is used for POST a request to the BPEL client (BPMN).
+ *
+ * Convert the requestJson to ServiceInstanceRequest(sir), create the msoRequest object, check whether this request
+ * is already being processed in requestdb for duplicate check.
+ *
+ * Based on the alacarte flag, sir and msoRequest will do the recipe lookup from the service and servicerecipe table
+ * of catalogdb, and get the OrchestrationURI.
+ *
+ * If the present request is not the duplicate request then this request will be saved in the requestdb. and will
+ * POST a request to the BPMN engine at the OrchestrationURI fetched.
+ *
+ * @param requestJSON Json fetched as body in the API call
+ * @param action Type of action to be performed
+ * @param instanceIdMap Map of instance ids of service/vnf/vf/configuration etc..
+ * @param version Supported version of API
+ * @param requestId Unique id for the request
+ * @param requestUri
+ * @return response object
+ * @throws ApiException
+ */
public Response serviceInstances(String requestJSON, Actions action, HashMap<String, String> instanceIdMap,
String version, String requestId, String requestUri) throws ApiException {
- String serviceInstanceId = (instanceIdMap == null) ? null : instanceIdMap.get("serviceInstanceId");
+ return serviceInstances(requestJSON, action, instanceIdMap, version, requestId, requestUri, null);
+
+ }
+
+ public Response serviceInstances(String requestJSON, Actions action, HashMap<String, String> instanceIdMap,
+ String version, String requestId, String requestUri, HashMap<String, String> queryParams)
+ throws ApiException {
+ String serviceInstanceId;
Boolean aLaCarte = null;
- long startTime = System.currentTimeMillis();
- ServiceInstancesRequest sir = null;
+ ServiceInstancesRequest sir;
String apiVersion = version.substring(1);
- sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest,
- requestId, requestUri);
+ sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
+ action = handleReplaceInstance(action, sir);
+ requestValidatorListenerRunner.runValidations(requestUri, instanceIdMap, sir, queryParams);
+
String requestScope = requestHandlerUtils.deriveRequestScope(action, sir, requestUri);
InfraActiveRequests currentActiveReq =
msoRequest.createRequestObject(sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope);
@@ -797,16 +833,15 @@ public class ServiceInstances {
InfraActiveRequests dup = null;
boolean inProgress = false;
- dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, startTime, msoRequest, instanceName,
- requestScope, currentActiveReq);
+ dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, instanceName, requestScope, currentActiveReq);
if (dup != null) {
inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq);
}
if (dup != null && inProgress) {
- requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, startTime,
- msoRequest, instanceName, requestScope, dup);
+ requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, instanceName,
+ requestScope, dup);
}
ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
@@ -815,64 +850,20 @@ public class ServiceInstances {
referencesResponse.setRequestId(requestId);
serviceResponse.setRequestReferences(referencesResponse);
- Boolean isBaseVfModule = false;
-
RecipeLookupResult recipeLookupResult =
getServiceInstanceOrchestrationURI(sir, action, alaCarteFlag, currentActiveReq);
String serviceInstanceType = requestHandlerUtils.getServiceType(requestScope, sir, alaCarteFlag);
- ModelType modelType;
- ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
- if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
- modelType = ModelType.vnf;
- } else if (action == Action.addMembers || action == Action.removeMembers) {
- modelType = ModelType.instanceGroup;
- } else {
- modelType = modelInfo.getModelType();
- }
-
- if (modelType.equals(ModelType.vfModule)) {
-
-
- // Get VF Module-specific base module indicator
- VfModule vfm = null;
- String modelVersionId = modelInfo.getModelVersionId();
-
- if (modelVersionId != null) {
- vfm = catalogDbClient.getVfModuleByModelUUID(modelVersionId);
- } else if (modelInfo.getModelInvariantId() != null && modelInfo.getModelVersion() != null) {
- vfm = catalogDbClient.getVfModuleByModelInvariantUUIDAndModelVersion(modelInfo.getModelInvariantId(),
- modelInfo.getModelVersion());
- }
-
- if (vfm != null) {
- if (vfm.getIsBase()) {
- isBaseVfModule = true;
- }
- } else if (action == Action.createInstance || action == Action.updateInstance) {
- // There is no entry for this vfModuleType with this version, if specified, in VF_MODULE table in
- // Catalog DB.
- // This request cannot proceed
-
- String serviceVersionText = "";
- if (sdcServiceModelVersion != null && !sdcServiceModelVersion.isEmpty()) {
- serviceVersionText = " with version " + sdcServiceModelVersion;
- }
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ ModelType modelType = requestHandlerUtils.getModelType(action, modelInfo);
- 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, 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();
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, vfModuleException.getMessage());
+ Boolean isBaseVfModule = false;
- throw vfModuleException;
- }
+ if (modelType.equals(ModelType.vfModule)) {
+ isBaseVfModule = requestHandlerUtils.getIsBaseVfModule(modelInfo, action, vnfType, sdcServiceModelVersion,
+ currentActiveReq);
}
-
serviceInstanceId = requestHandlerUtils.setServiceInstanceId(requestScope, sir);
String vnfId = "";
String vfModuleId = "";
@@ -905,6 +896,7 @@ public class ServiceInstances {
try {
infraActiveRequestsClient.save(currentActiveReq);
} catch (Exception e) {
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -918,6 +910,7 @@ public class ServiceInstances {
aLaCarte = false;
}
+
RequestClientParameter requestClientParameter = null;
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
@@ -930,6 +923,7 @@ public class ServiceInstances {
.setApiVersion(apiVersion).setALaCarte(aLaCarte).setRequestUri(requestUri)
.setInstanceGroupId(instanceGroupId).build();
} catch (IOException e) {
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -941,11 +935,39 @@ public class ServiceInstances {
recipeLookupResult.getOrchestrationURI(), requestScope);
}
+ /**
+ * @param action
+ * @param sir
+ * @return
+ */
+ protected Actions handleReplaceInstance(Actions action, ServiceInstancesRequest sir) {
+ if (action != null && action.equals(Action.replaceInstance)
+ && sir.getRequestDetails().getRequestParameters().getRetainAssignments() != null
+ && sir.getRequestDetails().getRequestParameters().getRetainAssignments()) {
+ action = Action.replaceInstanceRetainAssignments;
+ }
+ return action;
+ }
+
+ /**
+ * This method deletes the Instance Groups.
+ *
+ * This method will check whether the request is not duplicate in requestdb. if its not then will save as a new
+ * request. And will send a POST request to BEPL client to delete the Insatnce Groups.
+ *
+ * @param action
+ * @param instanceIdMap
+ * @param version
+ * @param requestId
+ * @param requestUri
+ * @param requestContext
+ * @return
+ * @throws ApiException
+ */
public Response deleteInstanceGroups(Actions action, HashMap<String, String> instanceIdMap, String version,
String requestId, String requestUri, ContainerRequestContext requestContext) throws ApiException {
String instanceGroupId = instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID);
Boolean aLaCarte = true;
- long startTime = System.currentTimeMillis();
String apiVersion = version.substring(1);
ServiceInstancesRequest sir = new ServiceInstancesRequest();
sir.setInstanceGroupId(instanceGroupId);
@@ -968,8 +990,8 @@ public class ServiceInstances {
throw validateException;
}
- InfraActiveRequests dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, startTime, msoRequest, null,
- requestScope, currentActiveReq);
+ InfraActiveRequests dup =
+ requestHandlerUtils.duplicateCheck(action, instanceIdMap, null, requestScope, currentActiveReq);
boolean inProgress = false;
if (dup != null) {
@@ -977,8 +999,8 @@ public class ServiceInstances {
}
if (dup != null && inProgress) {
- requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, startTime,
- msoRequest, null, requestScope, dup);
+ requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, null, requestScope,
+ dup);
}
ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
@@ -995,6 +1017,7 @@ public class ServiceInstances {
try {
infraActiveRequestsClient.save(currentActiveReq);
} catch (Exception e) {
+ logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -1007,20 +1030,22 @@ public class ServiceInstances {
.setRequestAction(action.toString()).setApiVersion(apiVersion).setALaCarte(aLaCarte)
.setRequestUri(requestUri).setInstanceGroupId(instanceGroupId).build();
+
return requestHandlerUtils.postBPELRequest(currentActiveReq, requestClientParameter,
recipeLookupResult.getOrchestrationURI(), requestScope);
}
- private String getPnfCorrelationId(ServiceInstancesRequest sir) {
+ protected String getPnfCorrelationId(ServiceInstancesRequest sir) {
return Optional.of(sir).map(ServiceInstancesRequest::getRequestDetails)
.map(RequestDetails::getRequestParameters).map(parameters -> parameters.getUserParamValue("pnfId"))
.orElse("");
}
- private RecipeLookupResult getServiceInstanceOrchestrationURI(ServiceInstancesRequest sir, Actions action,
+ protected RecipeLookupResult getServiceInstanceOrchestrationURI(ServiceInstancesRequest sir, Actions action,
boolean alaCarteFlag, InfraActiveRequests currentActiveReq) throws ApiException {
RecipeLookupResult recipeLookupResult = null;
- // if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT recipe for the requested action
+ // if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT
+ // recipe for the requested action
ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
// Query MSO Catalog DB
@@ -1036,7 +1061,6 @@ public class ServiceInstances {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
ValidateException validateException =
new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
@@ -1055,7 +1079,6 @@ public class ServiceInstances {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
ValidateException validateException =
new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
@@ -1073,7 +1096,6 @@ public class ServiceInstances {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
ValidateException validateException =
new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
@@ -1090,7 +1112,6 @@ public class ServiceInstances {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
RecipeNotFoundException recipeNotFoundExceptionException =
new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.",
HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo)
@@ -1103,8 +1124,8 @@ public class ServiceInstances {
return recipeLookupResult;
}
- private RecipeLookupResult getServiceURI(ServiceInstancesRequest servInstReq, Actions action, boolean alaCarteFlag)
- throws IOException {
+ protected RecipeLookupResult getServiceURI(ServiceInstancesRequest servInstReq, Actions action,
+ boolean alaCarteFlag) throws IOException {
// SERVICE REQUEST
// Construct the default service name
// TODO need to make this a configurable property
@@ -1140,7 +1161,8 @@ public class ServiceInstances {
}
}
- // if an aLaCarte flag was sent in the request, throw an error if the recipe was not found
+ // if an aLaCarte flag was sent in the request, throw an error if the recipe was
+ // not found
RequestParameters reqParam = requestDetails.getRequestParameters();
if (reqParam != null && alaCarteFlag && recipe == null) {
return null;
@@ -1262,8 +1284,7 @@ public class ServiceInstances {
return mapFlatMapToNameValue(userParams);
}
- private Service serviceMapper(Map<String, Object> params)
- throws JsonProcessingException, IOException, JsonParseException, JsonMappingException {
+ private Service serviceMapper(Map<String, Object> params) throws IOException {
ObjectMapper obj = new ObjectMapper();
String input = obj.writeValueAsString(params.get("service"));
return obj.readValue(input, Service.class);
@@ -1300,7 +1321,7 @@ public class ServiceInstances {
instanceList = servInstReq.getRequestDetails().getRelatedInstanceList();
}
- Recipe recipe = null;
+ Recipe recipe;
String defaultSource = requestHandlerUtils.getDefaultModel(servInstReq);
String modelCustomizationId = modelInfo.getModelCustomizationId();
String modelCustomizationName = modelInfo.getModelCustomizationName();
@@ -1330,23 +1351,32 @@ public class ServiceInstances {
if (modelInfo.getModelType().equals(ModelType.vnf)) {
// a. For a vnf request (only create, no update currently):
- // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate catalog DB has record in
+ // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate
+ // catalog DB has record in
// vnf_resource_customization.model_customization_uuid.
- // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
+ // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is
+ // a pre-1702 ASDC model or
// pre-v3), then modelInfo.modelCustomizationName must have
// been provided (else create request should be rejected). APIH should use the
- // relatedInstance.modelInfo[service].modelVersionId** + modelInfo[vnf].modelCustomizationName
- // to “join�? service_to_resource_customizations with vnf_resource_customization to confirm a
+ // relatedInstance.modelInfo[service].modelVersionId** +
+ // modelInfo[vnf].modelCustomizationName
+ // to “join�? service_to_resource_customizations with
+ // vnf_resource_customization to confirm a
// vnf_resource_customization.model_customization_uuid record exists.
// **If relatedInstance.modelInfo[service].modelVersionId was not provided, use
- // relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to lookup modelVersionId
+ // relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to
+ // lookup modelVersionId
// (MODEL_UUID) in SERVICE table.
- // iii. Regardless of how the value was provided/obtained above, APIH must always populate
- // vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO generated
+ // iii. Regardless of how the value was provided/obtained above, APIH must
+ // always populate
+ // vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO
+ // generated
// during 1707 data migration if VID did not provide it originally on request.
- // iv. Note: continue to construct the “vnf-type�? value and pass to BPMN (must still be populated
+ // iv. Note: continue to construct the “vnf-type�? value and pass to BPMN
+ // (must still be populated
// in A&AI).
- // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to
+ // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use
+ // modelCustomizationId to
// look it up in our catalog to construct vnf-type value to pass to BPMN.
VnfResource vnfResource = null;
@@ -1477,14 +1507,13 @@ public class ServiceInstances {
throw new ValidationException("vfModuleCustomization");
} else if (vfModule == null && vfmc != null) {
vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in
- // VfModuleCustomization table
+ // VfModuleCustomization table
}
if (modelInfo.getModelVersionId() == null) {
modelInfo.setModelVersionId(vfModule.getModelUUID());
}
-
recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
vfModule.getModelUUID(), vnfComponentType, action.toString());
if (recipe == null) {
@@ -1547,7 +1576,6 @@ public class ServiceInstances {
return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
}
-
private RecipeLookupResult getNetworkUri(ServiceInstancesRequest sir, Actions action) throws ValidationException {
String defaultNetworkType = requestHandlerUtils.getDefaultModel(sir);
@@ -1587,19 +1615,15 @@ public class ServiceInstances {
return recipe != null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null;
}
-
private Response configurationRecipeLookup(String requestJSON, Action action, HashMap<String, String> instanceIdMap,
String version, String requestId, String requestUri) throws ApiException {
- String serviceInstanceId = (instanceIdMap == null) ? null : instanceIdMap.get("serviceInstanceId");
+ String serviceInstanceId;
Boolean aLaCarte = null;
String apiVersion = version.substring(1);
boolean inProgress = false;
+ ServiceInstancesRequest sir;
- long startTime = System.currentTimeMillis();
- ServiceInstancesRequest sir = null;
-
- sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, startTime, sir, msoRequest,
- requestId, requestUri);
+ sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
String requestScope = requestHandlerUtils.deriveRequestScope(action, sir, requestUri);
InfraActiveRequests currentActiveReq =
msoRequest.createRequestObject(sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope);
@@ -1613,16 +1637,15 @@ public class ServiceInstances {
InfraActiveRequests dup = null;
- dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, startTime, msoRequest, instanceName,
- requestScope, currentActiveReq);
+ dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, instanceName, requestScope, currentActiveReq);
if (dup != null) {
inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq);
}
if (instanceIdMap != null && dup != null && inProgress) {
- requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, startTime,
- msoRequest, instanceName, requestScope, dup);
+ requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, instanceName,
+ requestScope, dup);
}
ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
@@ -1630,7 +1653,6 @@ public class ServiceInstances {
referencesResponse.setRequestId(requestId);
serviceResponse.setRequestReferences(referencesResponse);
-
String orchestrationUri = env.getProperty(CommonConstants.ALACARTE_ORCHESTRATION);
String timeOut = env.getProperty(CommonConstants.ALACARTE_RECIPE_TIMEOUT);
@@ -1642,7 +1664,6 @@ public class ServiceInstances {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
ValidateException validateException = new ValidateException.Builder(error, HttpStatus.SC_NOT_FOUND,
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoSubsystems.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SoSubsystems.java
index fd0df1d2b0..5842531dc3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoSubsystems.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SoSubsystems.java
@@ -19,13 +19,18 @@
*/
package org.onap.so.apihandlerinfra;
-public enum MsoSubsystems {
- APIH("API Handler"), ASDC("ASDC Controller"), BPMN("BPMN Infra"), CATALOGDB("CatalogDb Adapter"), OPENSTACK(
- "Openstack Adapter"), REQUESTDB(
- "RequestDB Adapter"), REQUESTDBATT("RequestDB Adapter ATT Svc"), SDNC("SDNC Adapter");
+public enum SoSubsystems implements Subsystem {
+ APIH("API Handler"),
+ ASDC("ASDC Controller"),
+ BPMN("BPMN Infra"),
+ CATALOGDB("CatalogDb Adapter"),
+ OPENSTACK("Openstack Adapter"),
+ REQUESTDB("RequestDB Adapter"),
+ SDNC("SDNC Adapter");
+
private String subsystem;
- private MsoSubsystems(String subsystem) {
+ private SoSubsystems(String subsystem) {
this.subsystem = subsystem;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Subsystem.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Subsystem.java
new file mode 100644
index 0000000000..88626f3168
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Subsystem.java
@@ -0,0 +1,5 @@
+package org.onap.so.apihandlerinfra;
+
+public interface Subsystem {
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
index 7bd7f95286..3c4c90cc37 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
@@ -91,7 +91,7 @@ public class TasksHandler {
@QueryParam("originalRequestDate") String originalRequestDate,
@QueryParam("originalRequestorId") String originalRequestorId, @PathParam("version") String version)
throws ApiException {
- Response responseBack = null;
+
String apiVersion = version.substring(1);
// Prepare the query string to /task interface
@@ -159,60 +159,49 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.build();
+ throw new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
-
- ValidateException validateException =
- new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
}
TasksGetResponse trr = new TasksGetResponse();
List<TaskList> taskList = new ArrayList<>();
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- if (bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) {
- String respBody = respHandler.getResponseBody();
- if (respBody != null) {
- JSONArray data = new JSONArray(respBody);
+ String respBody = respHandler.getResponseBody();
+ if ((bpelStatus == HttpStatus.SC_NO_CONTENT || bpelStatus == HttpStatus.SC_ACCEPTED) && (null != respBody)) {
- for (int i = 0; i < data.length(); i++) {
- JSONObject taskEntry = data.getJSONObject(i);
- String id = taskEntry.getString("id");
- if (taskId != null && !taskId.equals(id)) {
- continue;
- }
- // Get variables info for each task ID
- TaskList taskListEntry = null;
- taskListEntry = getTaskInfo(id);
-
- taskList.add(taskListEntry);
+ JSONArray data = new JSONArray(respBody);
+ for (int i = 0; i < data.length(); i++) {
+ JSONObject taskEntry = data.getJSONObject(i);
+ String id = taskEntry.getString("id");
+ if (taskId != null && !taskId.equals(id)) {
+ continue;
}
- trr.setTaskList(taskList);
+ // Get variables info for each task ID
+ TaskList taskListEntry = null;
+ taskListEntry = getTaskInfo(id);
+
+ taskList.add(taskListEntry);
+
}
+ trr.setTaskList(taskList);
} else {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError)
.build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
- bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
String jsonResponse = null;
@@ -223,14 +212,10 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
.build();
+ throw new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
-
- ValidateException validateException =
- new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
}
return builder.buildResponse(HttpStatus.SC_ACCEPTED, "", jsonResponse, apiVersion);
@@ -250,10 +235,8 @@ public class TasksHandler {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
- BPMNFailureException validateException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
- throw validateException;
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY), HttpStatus.SC_BAD_GATEWAY,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
}
ResponseHandler respHandler = new ResponseHandler(getResponse, requestClient.getType());
int bpelStatus = respHandler.getStatus();
@@ -264,14 +247,10 @@ public class TasksHandler {
} else {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
ErrorCode.AvailabilityError).build();
+ throw new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
+ HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo)
+ .build();
-
-
- BPMNFailureException bpmnFailureException =
- new BPMNFailureException.Builder(String.valueOf(HttpStatus.SC_BAD_GATEWAY),
- HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
-
- throw bpmnFailureException;
}
} else {
@@ -279,20 +258,15 @@ public class TasksHandler {
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.build();
-
-
- BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(bpelStatus),
- bpelStatus, ErrorNumbers.SVC_NO_SERVER_RESOURCES).build();
-
-
- throw bpmnFailureException;
+ throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus,
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
}
return taskList;
}
- private TaskList buildTaskList(String taskId, String respBody) throws JSONException {
+ private TaskList buildTaskList(String taskId, String respBody) {
TaskList taskList = new TaskList();
JSONObject variables = new JSONObject(respBody);
@@ -317,7 +291,7 @@ public class TasksHandler {
return taskList;
}
- private String getOptVariableValue(JSONObject variables, String name) throws JSONException {
+ private String getOptVariableValue(JSONObject variables, String name) {
String variableEntry = variables.optString(name);
String value = "";
if (!variableEntry.isEmpty()) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java
index 97b80098e6..632f371af5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 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
@@ -39,8 +41,8 @@ public class WebSecurityConfigImpl extends WebSecurityConfig {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
- .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString())
- .and().httpBasic();
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+ .httpBasic();
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index bba8064f7c..b57bb5d1d8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2019 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
@@ -91,13 +93,13 @@ public class WorkflowSpecificationsHandler {
List<Workflow> workflows = catalogDbClient.findWorkflowByModelUUID(vnfModelVersionId);
List<Workflow> nativeWorkflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW);
- if (nativeWorkflows != null && nativeWorkflows.size() != 0) {
+ if (nativeWorkflows != null && !nativeWorkflows.isEmpty()) {
workflows.addAll(nativeWorkflows);
}
WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(workflows);
- String jsonResponse = null;
+ String jsonResponse;
try {
ObjectMapper mapper = new ObjectMapper();
jsonResponse = mapper.writeValueAsString(workflowSpecifications);
@@ -116,11 +118,11 @@ public class WorkflowSpecificationsHandler {
}
protected WorkflowSpecifications mapWorkflowsToWorkflowSpecifications(List<Workflow> workflows) {
- if (workflows == null || workflows.size() == 0) {
+ if (workflows == null || workflows.isEmpty()) {
return null;
}
WorkflowSpecifications workflowSpecifications = new WorkflowSpecifications();
- List<WorkflowSpecificationList> workflowSpecificationList = new ArrayList<WorkflowSpecificationList>();
+ List<WorkflowSpecificationList> workflowSpecificationList = new ArrayList<>();
for (Workflow workflow : workflows) {
WorkflowSpecificationList workflowSpecificationListItem = new WorkflowSpecificationList();
@@ -153,10 +155,10 @@ public class WorkflowSpecificationsHandler {
private List<ActivitySequence> buildActivitySequence(Workflow workflow) {
List<WorkflowActivitySpecSequence> workflowActivitySpecSequences = workflow.getWorkflowActivitySpecSequence();
- if (workflowActivitySpecSequences == null || workflowActivitySpecSequences.size() == 0) {
+ if (workflowActivitySpecSequences == null || workflowActivitySpecSequences.isEmpty()) {
return null;
}
- List<ActivitySequence> activitySequences = new ArrayList<ActivitySequence>();
+ List<ActivitySequence> activitySequences = new ArrayList<>();
for (WorkflowActivitySpecSequence workflowActivitySpecSequence : workflowActivitySpecSequences) {
if (workflowActivitySpecSequence != null) {
ActivitySpec activitySpec = workflowActivitySpecSequence.getActivitySpec();
@@ -174,17 +176,17 @@ public class WorkflowSpecificationsHandler {
private List<WorkflowInputParameter> buildWorkflowInputParameters(Workflow workflow) {
List<WorkflowActivitySpecSequence> workflowActivitySpecSequences = workflow.getWorkflowActivitySpecSequence();
- if (workflowActivitySpecSequences == null || workflowActivitySpecSequences.size() == 0) {
- return new ArrayList<WorkflowInputParameter>();
+ if (workflowActivitySpecSequences == null || workflowActivitySpecSequences.isEmpty()) {
+ return new ArrayList<>();
}
- Map<String, WorkflowInputParameter> workflowInputParameterMap = new HashMap<String, WorkflowInputParameter>();
+ Map<String, WorkflowInputParameter> workflowInputParameterMap = new HashMap<>();
for (WorkflowActivitySpecSequence workflowActivitySpecSequence : workflowActivitySpecSequences) {
if (workflowActivitySpecSequence != null) {
ActivitySpec activitySpec = workflowActivitySpecSequence.getActivitySpec();
if (activitySpec != null) {
List<ActivitySpecUserParameters> activitySpecUserParameters =
activitySpec.getActivitySpecUserParameters();
- if (activitySpecUserParameters != null && activitySpecUserParameters.size() != 0) {
+ if (activitySpecUserParameters != null && !activitySpecUserParameters.isEmpty()) {
for (ActivitySpecUserParameters activitySpecUserParameter : activitySpecUserParameters) {
UserParameters userParameter = activitySpecUserParameter.getUserParameters();
if (userParameter != null) {
@@ -199,7 +201,7 @@ public class WorkflowSpecificationsHandler {
}
if (workflowInputParameterMap.size() == 0) {
- return new ArrayList<WorkflowInputParameter>();
+ return new ArrayList<>();
}
List<WorkflowInputParameter> workflowInputParameterList =
workflowInputParameterMap.values().stream().collect(Collectors.toList());
@@ -220,7 +222,7 @@ public class WorkflowSpecificationsHandler {
private List<Validation> buildValidationList(UserParameters userParameter) {
List<Validation> validationList = null;
if (userParameter.getMaxLength() != null || userParameter.getAllowableChars() != null) {
- validationList = new ArrayList<Validation>();
+ validationList = new ArrayList<>();
Validation validation = new Validation();
if (userParameter.getMaxLength() != null) {
validation.setMaxLength(userParameter.getMaxLength().toString());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java
index 4d81695e55..0db63e7493 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/CatalogDBConfig.java
@@ -23,8 +23,8 @@ package org.onap.so.apihandlerinfra.configuration;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
@@ -32,10 +32,13 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jmx.export.MBeanExporter;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
@Configuration
@EnableTransactionManagement
@@ -44,11 +47,23 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Profile({"!test"})
public class CatalogDBConfig {
+ @Autowired(required = false)
+ private MBeanExporter mBeanExporter;
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource.hikari")
+ public HikariConfig catalogDbConfig() {
+ return new HikariConfig();
+ }
+
@Primary
@Bean(name = "dataSource")
- @ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
- return DataSourceBuilder.create().build();
+ if (mBeanExporter != null) {
+ mBeanExporter.addExcludedBean("dataSource");
+ }
+ HikariConfig hikariConfig = this.catalogDbConfig();
+ return new HikariDataSource(hikariConfig);
}
@Primary
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java
index 1bc54ffe7b..02cbf2f3bf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/configuration/RequestDBConfig.java
@@ -23,18 +23,21 @@ package org.onap.so.apihandlerinfra.configuration;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.jmx.export.MBeanExporter;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
@Configuration
@EnableTransactionManagement
@@ -43,13 +46,24 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@Profile({"!test"})
public class RequestDBConfig {
+ @Autowired(required = false)
+ private MBeanExporter mBeanExporter;
+
+ @Bean
+ @ConfigurationProperties(prefix = "request.datasource.hikari")
+ public HikariConfig requestDbConfig() {
+ return new HikariConfig();
+ }
+
@Bean(name = "requestDataSource")
- @ConfigurationProperties(prefix = "request.datasource")
public DataSource dataSource() {
- return DataSourceBuilder.create().build();
+ if (mBeanExporter != null) {
+ mBeanExporter.addExcludedBean("requestDataSource");
+ }
+ HikariConfig hikariConfig = this.requestDbConfig();
+ return new HikariDataSource(hikariConfig);
}
-
@Bean(name = "requestEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
@Qualifier("requestDataSource") DataSource dataSource) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java
index 77abbbfa9a..6e77ce84a6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java
@@ -21,7 +21,7 @@
package org.onap.so.apihandlerinfra.e2eserviceinstancebeans;
-import java.sql.Timestamp;
+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java
index f969674ed1..d6a99af8cd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EService.java
@@ -47,6 +47,9 @@ public class E2EService {
@JsonProperty("serviceType")
private String serviceType;
+ @JsonProperty("serviceId")
+ private String serviceId;
+
@JsonProperty("parameters")
private E2EParameters parameters;
@@ -109,6 +112,14 @@ public class E2EService {
this.serviceType = serviceType;
}
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+
public String getServiceUuid() {
return serviceUuid;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java
index f7fa01aeb0..4fc6181bf8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java
@@ -29,13 +29,7 @@ public class GetE2EServiceInstanceResponse {
protected OperationStatus operation;
- // public OperationStatus getOperationStatus() {
- // return operation;
- // }
- //
- // public void setOperationStatus(OperationStatus requestDB) {
- // this.operation = requestDB;
- // }
+
public OperationStatus getOperation() {
return operation;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java
index 44592ce2e4..ae462ebffa 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/ResourceRequest.java
@@ -39,6 +39,9 @@ public class ResourceRequest {
@JsonProperty("resourceCustomizationUuid")
private String resourceCustomizationUuid;
+ @JsonProperty("resourceIndex")
+ private String resourceIndex;
+
@JsonProperty("parameters")
private E2EParameters parameters;
@@ -98,4 +101,12 @@ public class ResourceRequest {
public void setParameters(E2EParameters parameters) {
this.parameters = parameters;
}
+
+ public String getResourceIndex() {
+ return resourceIndex;
+ }
+
+ public void setResourceIndex(String resourceIndex) {
+ this.resourceIndex = resourceIndex;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
new file mode 100644
index 0000000000..344e5438c9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -0,0 +1,85 @@
+package org.onap.so.apihandlerinfra.infra.rest;
+
+import java.util.Optional;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AAIDataRetrieval {
+
+ private static final String VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID = "VF Module Not Found In Inventory, VnfId: ";
+
+ private AAIResourcesClient aaiResourcesClient;
+
+ private static final Logger logger = LoggerFactory.getLogger(AAIDataRetrieval.class);
+
+ public ServiceInstance getServiceInstance(String serviceInstanceId) {
+ return this.getAaiResourcesClient()
+ .get(ServiceInstance.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId))
+ .orElseGet(() -> {
+ logger.debug("No Service Instance found in A&AI ServiceInstanceId: {}", serviceInstanceId);
+ return null;
+ });
+ }
+
+
+ public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
+ return this.getAaiResourcesClient()
+ .get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId))
+ .orElseGet(() -> {
+ logger.debug("No Vf Module found in A&AI VnfId: {}" + ", VfModuleId: {}", vnfId, vfModuleId);
+ return null;
+ });
+ }
+
+ public GenericVnf getGenericVnf(String vnfId) {
+ return this.getAaiResourcesClient()
+ .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ .orElseGet(() -> {
+ logger.debug("No Generic VNF found in A&AI VnfId: {}", vnfId);
+ return null;
+ });
+ }
+
+ public VolumeGroup getVolumeGroup(String vnfId, String volumeGroupId) throws AAIEntityNotFound {
+ AAIResultWrapper wrapper =
+ this.getAaiResourcesClient().get(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectType.VOLUME_GROUP, volumeGroupId));
+ Optional<VolumeGroup> volume = wrapper.asBean(VolumeGroup.class);
+ if (volume.isPresent()) {
+ return volume.get();
+ } else {
+ logger.debug("No VolumeGroup in A&AI found: {}", vnfId);
+ return null;
+ }
+ }
+
+ public L3Network getNetwork(String networkId) {
+ return this.getAaiResourcesClient()
+ .get(L3Network.class, AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId))
+ .orElseGet(() -> {
+ logger.debug("No Network found in A&AI NetworkId: {}", networkId);
+ return null;
+ });
+ }
+
+ protected AAIResourcesClient getAaiResourcesClient() {
+ if (aaiResourcesClient == null) {
+ aaiResourcesClient = new AAIResourcesClient();
+ }
+ return aaiResourcesClient;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
new file mode 100644
index 0000000000..ee2bb586cf
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilder.java
@@ -0,0 +1,410 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.constants.Status;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class BpmnRequestBuilder {
+
+ private static final String CLOUD_CONFIGURATION_COULD_NOT_BE_FOUND = "Cloud Configuration could not be found";
+
+ private static final String CLOUD_REGION_ID = "cloud-region-id";
+
+ private static final String CLOUD_OWNER = "cloud-owner";
+
+ private static final String TENANT_ID = "tenant-id";
+
+ private static final String GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID =
+ "Generic Vnf Not Found In Inventory, VnfId: ";
+
+ private static final String VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID = "VF Module Not Found In Inventory, VnfId: ";
+
+ private static final Logger logger = LoggerFactory.getLogger(BpmnRequestBuilder.class);
+
+ @Autowired
+ private RequestsDbClient infraActiveRequestsClient;
+
+ @Autowired
+ private AAIDataRetrieval aaiDataRet;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+
+ public ServiceInstancesRequest buildVFModuleDeleteRequest(String vnfId, String vfModuleId, ModelType modelType)
+ throws AAIEntityNotFound {
+ GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
+ if (vnf == null) {
+ throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
+ }
+ VfModule vfModule = aaiDataRet.getAAIVfModule(vnfId, vfModuleId);
+ if (vfModule == null) {
+ throw new AAIEntityNotFound(VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " vfModuleId: " + vfModuleId);
+ }
+ return createServiceInstancesRequest(vnf, vfModule, modelType);
+ }
+
+ public ServiceInstancesRequest buildVolumeGroupDeleteRequest(String vnfId, String volumeGroupId)
+ throws AAIEntityNotFound {
+ GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
+ if (vnf == null) {
+ throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
+ }
+ VolumeGroup volumeGroup = aaiDataRet.getVolumeGroup(vnfId, volumeGroupId);
+ if (volumeGroup == null) {
+ throw new AAIEntityNotFound(
+ VF_MODULE_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId + " volumeGroupId: " + volumeGroupId);
+ }
+ return createServiceInstancesRequest(vnf, volumeGroup);
+ }
+
+ public ServiceInstancesRequest buildServiceDeleteRequest(String serviceInstanceId) throws AAIEntityNotFound {
+ ServiceInstance serviceInstance = aaiDataRet.getServiceInstance(serviceInstanceId);
+ if (serviceInstance == null) {
+ throw new AAIEntityNotFound(
+ "ServiceInstance Not Found In Inventory, ServiceInstanceId: " + serviceInstanceId);
+ }
+ return createServiceInstancesRequest(serviceInstance);
+ }
+
+ public ServiceInstancesRequest buildVnfDeleteRequest(String vnfId) throws AAIEntityNotFound {
+ GenericVnf vnf = aaiDataRet.getGenericVnf(vnfId);
+ if (vnf == null) {
+ throw new AAIEntityNotFound(GENERIC_VNF_NOT_FOUND_IN_INVENTORY_VNF_ID + vnfId);
+ }
+ return createServiceInstancesRequest(vnf);
+ }
+
+ public ServiceInstancesRequest buildNetworkDeleteRequest(String networkId) throws AAIEntityNotFound {
+ L3Network network = aaiDataRet.getNetwork(networkId);
+ if (network == null) {
+ throw new AAIEntityNotFound("Network Not Found In Inventory, NetworkId: " + networkId);
+ }
+ return createServiceInstancesRequest(network);
+ }
+
+ protected ServiceInstancesRequest createServiceInstancesRequest(ServiceInstance serviceInstance) {
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = mapServiceRequestDetails(serviceInstance);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ protected ServiceInstancesRequest createServiceInstancesRequest(GenericVnf vnf) {
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = mapVnfRequestDetails(vnf);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ protected ServiceInstancesRequest createServiceInstancesRequest(GenericVnf vnf, VfModule vfModule,
+ ModelType modelType) {
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = mapRequestDetails(vnf, vfModule, modelType);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ protected ServiceInstancesRequest createServiceInstancesRequest(GenericVnf vnf, VolumeGroup volumeGroup) {
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = mapRequestDetails(vnf, volumeGroup);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ protected ServiceInstancesRequest createServiceInstancesRequest(L3Network network) {
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = mapNetworkRequestDetails(network);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ protected RequestDetails mapRequestDetails(GenericVnf vnf, VfModule vfModule, ModelType modelType) {
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setRequestInfo(createRequestInfo());
+ if (vfModule.getVfModuleName() != null) {
+ requestDetails.getRequestInfo().setInstanceName(vfModule.getVfModuleName());
+ }
+ requestDetails.setModelInfo(mapVfModuleModelInformation(vfModule, modelType));
+
+ requestDetails.setCloudConfiguration(mapCloudConfiguration(vnf, vfModule));
+ requestDetails.setRequestParameters(createRequestParameters());
+ return requestDetails;
+ }
+
+ protected RequestDetails mapRequestDetails(GenericVnf vnf, VolumeGroup volumeGroup) {
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setRequestInfo(createRequestInfo());
+ if (volumeGroup.getVolumeGroupName() != null) {
+ requestDetails.getRequestInfo().setInstanceName(volumeGroup.getVolumeGroupName());
+ }
+ requestDetails.setModelInfo(mapVolumeGroupModelInformation(volumeGroup));
+ requestDetails.setCloudConfiguration(mapCloudConfigurationVolume(vnf, volumeGroup));
+ requestDetails.setRequestParameters(createRequestParameters());
+ return requestDetails;
+ }
+
+ protected RequestDetails mapVnfRequestDetails(GenericVnf vnf) {
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setRequestInfo(createRequestInfo());
+ if (vnf.getVnfName() != null) {
+ requestDetails.getRequestInfo().setInstanceName(vnf.getVnfName());
+ }
+ requestDetails.setModelInfo(mapVnfModelInformation(vnf));
+ requestDetails.setRequestParameters(createRequestParameters());
+ return requestDetails;
+ }
+
+ protected RequestDetails mapServiceRequestDetails(ServiceInstance serviceInstance) {
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setRequestInfo(createRequestInfo());
+ if (serviceInstance.getServiceInstanceName() != null) {
+ requestDetails.getRequestInfo().setInstanceName(serviceInstance.getServiceInstanceName());
+ }
+ requestDetails.setModelInfo(mapServiceModelInformation(serviceInstance));
+ requestDetails.setRequestParameters(createRequestParameters());
+ return requestDetails;
+ }
+
+ protected RequestDetails mapNetworkRequestDetails(L3Network network) {
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setRequestInfo(createRequestInfo());
+ if (network.getNetworkName() != null) {
+ requestDetails.getRequestInfo().setInstanceName(network.getNetworkName());
+ }
+ requestDetails.setCloudConfiguration(mapCloudConfigurationNetwork(network));
+ requestDetails.setModelInfo(mapNetworkModelInformation(network));
+ requestDetails.setRequestParameters(createRequestParameters());
+ return requestDetails;
+ }
+
+ protected ModelInfo mapVfModuleModelInformation(VfModule vfModule, ModelType modelType) {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(vfModule.getModelCustomizationId());
+ modelInfo.setModelCustomizationUuid(vfModule.getModelCustomizationId());
+ modelInfo.setModelType(modelType);
+ return modelInfo;
+ }
+
+ protected ModelInfo mapVolumeGroupModelInformation(VolumeGroup volumeGroup) {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(volumeGroup.getModelCustomizationId());
+ modelInfo.setModelCustomizationUuid(volumeGroup.getModelCustomizationId());
+ modelInfo.setModelType(ModelType.volumeGroup);
+ return modelInfo;
+ }
+
+ protected ModelInfo mapServiceModelInformation(ServiceInstance serviceInstance) {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelVersionId(serviceInstance.getModelVersionId());
+ modelInfo.setModelType(ModelType.service);
+ return modelInfo;
+ }
+
+ protected ModelInfo mapVnfModelInformation(GenericVnf vnf) {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(vnf.getModelCustomizationId());
+ modelInfo.setModelCustomizationUuid(vnf.getModelCustomizationId());
+ modelInfo.setModelType(ModelType.vnf);
+ return modelInfo;
+ }
+
+ protected ModelInfo mapNetworkModelInformation(L3Network network) {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelType(ModelType.network);
+ modelInfo.setModelCustomizationId(network.getModelCustomizationId());
+ modelInfo.setModelCustomizationUuid(network.getModelCustomizationId());
+ return modelInfo;
+ }
+
+ public CloudConfiguration mapCloudConfiguration(GenericVnf vnf, VfModule vfModule) {
+ CloudConfiguration cloudConfig = new CloudConfiguration();
+ AAIResultWrapper wrapper = new AAIResultWrapper(vnf);
+ Optional<org.onap.so.client.aai.entities.Relationships> relationshipsOpt = wrapper.getRelationships();
+ String tenantId = null;
+ String cloudOwner = null;
+ String lcpRegionId = null;
+ if (relationshipsOpt.isPresent()) {
+ tenantId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+ .map(item -> item.getURIKeys().get(TENANT_ID)).orElse(null);
+ cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+ .map(item -> item.getURIKeys().get(CLOUD_OWNER)).orElse(null);
+ lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+ .map(item -> item.getURIKeys().get(CLOUD_REGION_ID)).orElse(null);
+ }
+
+ if (tenantId == null || cloudOwner == null || lcpRegionId == null) {
+ Map<String, String[]> filters = createQueryRequest("vfModuleId", vfModule.getVfModuleId());
+ Optional<ServiceInstancesRequest> request = findServiceInstanceRequest(filters);
+ if (request.isPresent()) {
+ if (request.get().getRequestDetails() != null
+ && request.get().getRequestDetails().getCloudConfiguration() != null) {
+ if (request.get().getRequestDetails().getCloudConfiguration().getTenantId() != null) {
+ tenantId = request.get().getRequestDetails().getCloudConfiguration().getTenantId();
+ }
+ if (request.get().getRequestDetails().getCloudConfiguration().getCloudOwner() != null) {
+ cloudOwner = request.get().getRequestDetails().getCloudConfiguration().getCloudOwner();
+ }
+ if (request.get().getRequestDetails().getCloudConfiguration().getLcpCloudRegionId() != null) {
+ lcpRegionId = request.get().getRequestDetails().getCloudConfiguration().getLcpCloudRegionId();
+ }
+ }
+ } else {
+ throw new CloudConfigurationNotFoundException(CLOUD_CONFIGURATION_COULD_NOT_BE_FOUND);
+ }
+ }
+ cloudConfig.setTenantId(tenantId);
+ cloudConfig.setCloudOwner(cloudOwner);
+ cloudConfig.setLcpCloudRegionId(lcpRegionId);
+ return cloudConfig;
+ }
+
+ public CloudConfiguration mapCloudConfigurationVolume(GenericVnf vnf, VolumeGroup volumeGroup) {
+ CloudConfiguration cloudConfig = new CloudConfiguration();
+ AAIResultWrapper wrapper = new AAIResultWrapper(vnf);
+ Optional<org.onap.so.client.aai.entities.Relationships> relationshipsOpt = wrapper.getRelationships();
+ String tenantId = null;
+ String cloudOwner = null;
+ String lcpRegionId = null;
+ if (relationshipsOpt.isPresent()) {
+ tenantId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+ .map(item -> item.getURIKeys().get(TENANT_ID)).orElse(null);
+ cloudOwner = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+ .map(item -> item.getURIKeys().get(CLOUD_OWNER)).orElse(null);
+ lcpRegionId = relationshipsOpt.get().getRelatedUris(AAIObjectType.TENANT).stream().findFirst()
+ .map(item -> item.getURIKeys().get(CLOUD_REGION_ID)).orElse(null);
+ }
+
+ if (tenantId == null || cloudOwner == null || lcpRegionId == null) {
+ Map<String, String[]> filters = createQueryRequest("volumeGroupId", volumeGroup.getVolumeGroupId());
+ Optional<ServiceInstancesRequest> request = findServiceInstanceRequest(filters);
+ if (request.isPresent()) {
+ tenantId = request.get().getRequestDetails().getCloudConfiguration().getTenantId();
+ cloudOwner = request.get().getRequestDetails().getCloudConfiguration().getCloudOwner();
+ lcpRegionId = request.get().getRequestDetails().getCloudConfiguration().getLcpCloudRegionId();
+ } else {
+ throw new CloudConfigurationNotFoundException(CLOUD_CONFIGURATION_COULD_NOT_BE_FOUND);
+ }
+ }
+ cloudConfig.setTenantId(tenantId);
+ cloudConfig.setCloudOwner(cloudOwner);
+ cloudConfig.setLcpCloudRegionId(lcpRegionId);
+ return cloudConfig;
+ }
+
+ public CloudConfiguration mapCloudConfigurationNetwork(L3Network network) {
+ CloudConfiguration cloudConfig = new CloudConfiguration();
+ String tenantId = null;
+ String cloudOwner = null;
+ String lcpRegionId = null;
+
+ Map<String, String[]> filters = createQueryRequest("networkId", network.getNetworkId());
+ Optional<ServiceInstancesRequest> request = findServiceInstanceRequest(filters);
+ if (request.isPresent()) {
+ if (request.get().getRequestDetails() != null
+ && request.get().getRequestDetails().getCloudConfiguration() != null) {
+ if (request.get().getRequestDetails().getCloudConfiguration().getTenantId() != null) {
+ tenantId = request.get().getRequestDetails().getCloudConfiguration().getTenantId();
+ }
+ if (request.get().getRequestDetails().getCloudConfiguration().getCloudOwner() != null) {
+ cloudOwner = request.get().getRequestDetails().getCloudConfiguration().getCloudOwner();
+ }
+ if (request.get().getRequestDetails().getCloudConfiguration().getLcpCloudRegionId() != null) {
+ lcpRegionId = request.get().getRequestDetails().getCloudConfiguration().getLcpCloudRegionId();
+ }
+ }
+ } else {
+ throw new CloudConfigurationNotFoundException(CLOUD_CONFIGURATION_COULD_NOT_BE_FOUND);
+ }
+
+ cloudConfig.setTenantId(tenantId);
+ cloudConfig.setCloudOwner(cloudOwner);
+ cloudConfig.setLcpCloudRegionId(lcpRegionId);
+ return cloudConfig;
+ }
+
+ public Optional<ServiceInstancesRequest> findServiceInstanceRequest(Map<String, String[]> filters) {
+ List<InfraActiveRequests> completeRequests = infraActiveRequestsClient.getRequest(filters);
+ InfraActiveRequests foundRequest = completeRequests.get(0);
+ ServiceInstancesRequest siRequest;
+ try {
+ siRequest = mapper.readValue(foundRequest.getRequestBody(), ServiceInstancesRequest.class);
+ return Optional.of(siRequest);
+ } catch (Exception e) {
+ logger.error("Could not read Create Instance Request", e);
+ }
+ return Optional.empty();
+ }
+
+ public Map<String, String[]> createQueryRequest(String name, String instanceId) {
+ Map<String, String[]> filters = new HashMap<>();
+ filters.put(name, new String[] {"EQ", instanceId});
+ filters.put("requestStatus", new String[] {"EQ", Status.COMPLETE.toString()});
+ filters.put("action", new String[] {"EQ", "createInstance"});
+ return filters;
+ }
+
+ public RequestInfo createRequestInfo() {
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setSuppressRollback(false);
+ requestInfo.setSource(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ requestInfo.setRequestorId(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ return requestInfo;
+ }
+
+ public RequestParameters createRequestParameters() {
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setaLaCarte(true);
+ requestParams.setTestApi("GR_API");
+ return requestParams;
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java
new file mode 100644
index 0000000000..ec3df21fdb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.apihandlerinfra.infra.rest;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandler.filters.ResponseUpdater;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.handler.NetworkRestHandler;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Component;
+import io.swagger.annotations.ApiOperation;
+
+@Component
+@Path("/onap/so/infra/serviceInstantiation")
+public class Network {
+
+ @Autowired
+ private NetworkRestHandler networkRestHandler;
+
+ @Autowired
+ private BpmnRequestBuilder requestBuilder;
+
+ @DELETE
+ @ResponseUpdater
+ @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Delete provided Network instance", response = Response.class)
+ @Transactional
+ public Response deleteNetworkInstance(@PathParam("version") String version,
+ @PathParam("serviceInstanceId") String serviceInstanceId,
+ @PathParam("networkInstanceId") String networkInstanceId, @Context ContainerRequestContext requestContext)
+ throws Exception {
+ InfraActiveRequests currentRequest = null;
+ String requestId = networkRestHandler.getRequestId(requestContext);
+ String requestorId = "Unknown";
+ String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
+ String requestURI = requestContext.getUriInfo().getAbsolutePath().toString();
+ currentRequest = networkRestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId,
+ networkInstanceId, requestorId, source, requestURI);
+ ServiceInstancesRequest request = requestBuilder.buildNetworkDeleteRequest(networkInstanceId);
+ networkRestHandler.saveInstanceName(request, currentRequest);
+ networkRestHandler.checkDuplicateRequest(serviceInstanceId, networkInstanceId,
+ request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
+ Recipe recipe = networkRestHandler.findNetworkRecipe(Action.deleteInstance.toString());
+ networkRestHandler.callWorkflowEngine(networkRestHandler.buildRequestParams(request,
+ networkRestHandler.getRequestUri(requestContext), requestId, serviceInstanceId, networkInstanceId),
+ recipe.getOrchestrationUri());
+ ServiceInstancesResponse response =
+ networkRestHandler.createResponse(networkInstanceId, requestId, requestContext);
+ return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java
new file mode 100644
index 0000000000..07e8092449
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.apihandlerinfra.infra.rest;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandler.filters.ResponseUpdater;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.handler.ServiceInstanceRestHandler;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Component;
+import io.swagger.annotations.ApiOperation;
+
+@Component
+@Path("/onap/so/infra/serviceInstantiation")
+public class ServiceInstance {
+
+ @Autowired
+ private ServiceInstanceRestHandler requestHandler;
+
+ @Autowired
+ private BpmnRequestBuilder requestBuilder;
+
+ @DELETE
+ @ResponseUpdater
+ @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Delete a Service instance", response = ServiceInstancesResponse.class)
+ @Transactional
+ public Response deleteServiceInstance(@PathParam("version") String version,
+ @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
+ throws Exception {
+ InfraActiveRequests currentRequest = null;
+ String requestId = requestHandler.getRequestId(requestContext);
+ String requestorId = "Unknown";
+ String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
+ String requestURI = requestContext.getUriInfo().getAbsolutePath().toString();
+ currentRequest = requestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, requestorId,
+ source, requestURI);
+ ServiceInstancesRequest request = requestBuilder.buildServiceDeleteRequest(serviceInstanceId);
+ requestHandler.saveInstanceName(request, currentRequest);
+ requestHandler.checkDuplicateRequest(serviceInstanceId,
+ request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
+ Recipe recipe = requestHandler.findServiceRecipe(request.getRequestDetails().getModelInfo().getModelUuid(),
+ Action.deleteInstance.toString());
+ requestHandler.callWorkflowEngine(requestHandler.buildRequestParams(request,
+ requestHandler.getRequestUri(requestContext), requestId, serviceInstanceId),
+ recipe.getOrchestrationUri());
+ ServiceInstancesResponse response = requestHandler.createResponse(serviceInstanceId, requestId, requestContext);
+ return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java
new file mode 100644
index 0000000000..1b9eb1f802
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.apihandlerinfra.infra.rest;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandler.filters.ResponseUpdater;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.handler.VFModuleRestHandler;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Component;
+import io.swagger.annotations.ApiOperation;
+
+@Component
+@Path("/onap/so/infra/serviceInstantiation")
+public class VfModules {
+
+ @Autowired
+ private VFModuleRestHandler restHandler;
+
+ @Autowired
+ private BpmnRequestBuilder requestBuilder;
+
+ @DELETE
+ @ResponseUpdater
+ @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class)
+ @Transactional
+ public Response deleteVfModuleInstance(@PathParam("version") String version,
+ @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId, @Context ContainerRequestContext requestContext)
+ throws Exception {
+ InfraActiveRequests currentRequest = null;
+
+ String requestId = restHandler.getRequestId(requestContext);
+ String requestorId = "Unknown";
+ String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
+ String requestURL = requestContext.getUriInfo().getAbsolutePath().toString();
+ currentRequest = restHandler.createInfraActiveRequestForDelete(requestId, vfmoduleInstanceId, serviceInstanceId,
+ vnfInstanceId, requestorId, source, requestURL);
+ ServiceInstancesRequest request =
+ requestBuilder.buildVFModuleDeleteRequest(vnfInstanceId, vfmoduleInstanceId, ModelType.vfModule);
+ restHandler.saveInstanceName(request, currentRequest);
+ restHandler.checkDuplicateRequest(serviceInstanceId, vnfInstanceId, vfmoduleInstanceId,
+ request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
+ Recipe recipe =
+ restHandler.findVfModuleRecipe(request.getRequestDetails().getModelInfo().getModelCustomizationId(),
+ ModelType.vfModule.toString(), Action.deleteInstance.toString());
+ restHandler
+ .callWorkflowEngine(restHandler.buildRequestParams(request, restHandler.getRequestUri(requestContext),
+ requestId, serviceInstanceId, vnfInstanceId, vfmoduleInstanceId), recipe.getOrchestrationUri());
+ ServiceInstancesResponse response = restHandler.createResponse(vfmoduleInstanceId, requestId, requestContext);
+ return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java
new file mode 100644
index 0000000000..a8ccdeecac
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.apihandlerinfra.infra.rest;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandler.filters.ResponseUpdater;
+import org.onap.so.apihandlerinfra.infra.rest.handler.VnfRestHandler;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Component;
+import io.swagger.annotations.ApiOperation;
+
+@Component
+@Path("/onap/so/infra/serviceInstantiation")
+public class Vnf {
+
+ @Autowired
+ private BpmnRequestBuilder requestBuilder;
+
+ @Autowired
+ private VnfRestHandler vnfRestHandler;
+
+ @DELETE
+ @ResponseUpdater
+ @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Delete a Vnf instance", response = ServiceInstancesResponse.class)
+ @Transactional
+ public Response deleteVnfInstance(@PathParam("version") String version,
+ @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
+ @Context ContainerRequestContext requestContext) throws Exception {
+ InfraActiveRequests currentRequest = null;
+ String requestId = vnfRestHandler.getRequestId(requestContext);
+ String requestorId = "Unknown";
+ String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
+ String requestURL = requestContext.getUriInfo().getAbsolutePath().toString();
+ currentRequest = vnfRestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, vnfInstanceId,
+ requestorId, source, requestURL);
+ ServiceInstancesRequest request = requestBuilder.buildVnfDeleteRequest(vnfInstanceId);
+ vnfRestHandler.saveInstanceName(request, currentRequest);
+ vnfRestHandler.checkDuplicateRequest(serviceInstanceId, vnfInstanceId,
+ request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
+ Recipe recipe = vnfRestHandler.findVnfModuleRecipe(
+ request.getRequestDetails().getModelInfo().getModelCustomizationId(), "vnf", "deleteInstance");
+ vnfRestHandler.callWorkflowEngine(vnfRestHandler.buildRequestParams(request,
+ vnfRestHandler.getRequestUri(requestContext), requestId, serviceInstanceId, vnfInstanceId),
+ recipe.getOrchestrationUri());
+ ServiceInstancesResponse response = vnfRestHandler.createResponse(vnfInstanceId, requestId, requestContext);
+ return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java
new file mode 100644
index 0000000000..d3e394d6d8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.apihandlerinfra.infra.rest;
+
+import javax.transaction.Transactional;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandler.filters.ResponseUpdater;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.infra.rest.handler.VFModuleRestHandler;
+import org.onap.so.apihandlerinfra.infra.rest.handler.VolumeRestHandler;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Component;
+import io.swagger.annotations.ApiOperation;
+
+@Component("VolumesV8")
+@Path("/onap/so/infra/serviceInstantiation")
+public class Volumes {
+
+ @Autowired
+ private BpmnRequestBuilder requestBuilder;
+
+ @Autowired
+ private VFModuleRestHandler vfModuleRestHandler;
+
+ @Autowired
+ private VolumeRestHandler volumeRestHandler;
+
+ @DELETE
+ @ResponseUpdater
+ @Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class)
+ @Transactional
+ public Response deleteVfModuleInstance(@PathParam("version") String version,
+ @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
+ @PathParam("volumeGroupInstanceId") String volumeGroupId, @Context ContainerRequestContext requestContext)
+ throws Exception {
+ InfraActiveRequests currentRequest = null;
+ String requestId = volumeRestHandler.getRequestId(requestContext);
+ String requestorId = "Unknown";
+ String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
+ String requestURL = requestContext.getUriInfo().getAbsolutePath().toString();
+ currentRequest = volumeRestHandler.createInfraActiveRequestForDelete(requestId, volumeGroupId,
+ serviceInstanceId, vnfInstanceId, requestorId, source, requestURL);
+ ServiceInstancesRequest request = requestBuilder.buildVolumeGroupDeleteRequest(vnfInstanceId, volumeGroupId);
+ volumeRestHandler.saveInstanceName(request, currentRequest);
+ volumeRestHandler.checkDuplicateRequest(serviceInstanceId, vnfInstanceId, volumeGroupId,
+ request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
+ Recipe recipe = vfModuleRestHandler.findVfModuleRecipe(
+ request.getRequestDetails().getModelInfo().getModelCustomizationId(), ModelType.volumeGroup.toString(),
+ Action.deleteInstance.toString());
+ volumeRestHandler
+ .callWorkflowEngine(
+ volumeRestHandler.buildRequestParams(request, volumeRestHandler.getRequestUri(requestContext),
+ requestId, serviceInstanceId, vnfInstanceId, volumeGroupId),
+ recipe.getOrchestrationUri());
+ ServiceInstancesResponse response = volumeRestHandler.createResponse(volumeGroupId, requestId, requestContext);
+ return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/AAIEntityNotFound.java
index 479d2e82bd..2153d9a628 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/ICryptoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/AAIEntityNotFound.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.common.util;
+package org.onap.so.apihandlerinfra.infra.rest.exception;
-public interface ICryptoHandler {
- public String getMsoAaiPassword();
+public class AAIEntityNotFound extends Exception {
- public String encryptMsoPassword(String plainPwd);
+ public AAIEntityNotFound(String errorMessage) {
+ super(errorMessage);
+ }
- public String decryptMsoPassword(String encryptedPwd);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/CloudConfigurationNotFoundException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/CloudConfigurationNotFoundException.java
new file mode 100644
index 0000000000..5135478a3e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/CloudConfigurationNotFoundException.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.exception;
+
+public class CloudConfigurationNotFoundException extends RuntimeException {
+
+ public CloudConfigurationNotFoundException(String errorMessage) {
+ super(errorMessage);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/NoRecipeException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/NoRecipeException.java
new file mode 100644
index 0000000000..db35b5c5cd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/NoRecipeException.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.exception;
+
+public class NoRecipeException extends Exception {
+
+ public NoRecipeException(String error) {
+ super(error);
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/RequestConflictedException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/RequestConflictedException.java
new file mode 100644
index 0000000000..35cb21945c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/RequestConflictedException.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.exception;
+
+public class RequestConflictedException extends RuntimeException {
+
+ public RequestConflictedException(String errorMessage) {
+ super(errorMessage);
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/WorkflowEngineConnectionException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/WorkflowEngineConnectionException.java
new file mode 100644
index 0000000000..f9206628a4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/WorkflowEngineConnectionException.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.exception;
+
+public class WorkflowEngineConnectionException extends Exception {
+
+ public WorkflowEngineConnectionException(String error, Throwable t) {
+ super(error, t);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/AAIEntityNotFoundMapper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/AAIEntityNotFoundMapper.java
new file mode 100644
index 0000000000..519578ce6c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/AAIEntityNotFoundMapper.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.exception.mapper;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Provider
+public class AAIEntityNotFoundMapper implements ExceptionMapper<AAIEntityNotFound> {
+
+ private static final Logger logger = LoggerFactory.getLogger(AAIEntityNotFoundMapper.class);
+
+ @Override
+ public Response toResponse(AAIEntityNotFound e) {
+ logger.error("AAIEntity Not Found", e);
+ RequestError error = new RequestError();
+ ServiceException value = new ServiceException();
+ value.setMessageId(ErrorNumbers.SVC_GENERAL_SERVICE_ERROR);
+ value.setText(e.getMessage());
+ error.setServiceException(value);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/CloudConfigurationNotFoundMapper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/CloudConfigurationNotFoundMapper.java
new file mode 100644
index 0000000000..24bf7434ee
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/CloudConfigurationNotFoundMapper.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.exception.mapper;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Provider
+public class CloudConfigurationNotFoundMapper implements ExceptionMapper<CloudConfigurationNotFoundException> {
+
+ private static final Logger logger = LoggerFactory.getLogger(CloudConfigurationNotFoundMapper.class);
+
+ @Override
+ public Response toResponse(CloudConfigurationNotFoundException e) {
+ logger.error("Cloud Configuration Not Found", e);
+ RequestError error = new RequestError();
+ ServiceException value = new ServiceException();
+ value.setMessageId(ErrorNumbers.SVC_GENERAL_SERVICE_ERROR);
+ value.setText(e.getMessage());
+ error.setServiceException(value);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/NoRecipeExceptionMapper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/NoRecipeExceptionMapper.java
new file mode 100644
index 0000000000..c807aa2597
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/NoRecipeExceptionMapper.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.exception.mapper;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Provider
+public class NoRecipeExceptionMapper implements ExceptionMapper<NoRecipeException> {
+
+ private static final Logger logger = LoggerFactory.getLogger(NoRecipeExceptionMapper.class);
+
+ @Override
+ public Response toResponse(NoRecipeException e) {
+ logger.error("No Recipe Found", e);
+ RequestError error = new RequestError();
+ ServiceException value = new ServiceException();
+ value.setMessageId(ErrorNumbers.SVC_GENERAL_SERVICE_ERROR);
+ value.setText(e.getMessage());
+ error.setServiceException(value);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/RequestConflictMapper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/RequestConflictMapper.java
new file mode 100644
index 0000000000..42d07c627b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/RequestConflictMapper.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.exception.mapper;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Provider
+public class RequestConflictMapper implements ExceptionMapper<RequestConflictedException> {
+
+ private static final Logger logger = LoggerFactory.getLogger(RequestConflictMapper.class);
+
+ @Override
+ public Response toResponse(RequestConflictedException e) {
+ logger.error("Request Conflict Error", e);
+ RequestError error = new RequestError();
+ ServiceException value = new ServiceException();
+ value.setMessageId(ErrorNumbers.SVC_GENERAL_SERVICE_ERROR);
+ value.setText(e.getMessage());
+ error.setServiceException(value);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/WorkflowEngineConnectionMapper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/WorkflowEngineConnectionMapper.java
new file mode 100644
index 0000000000..71e0dacd56
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/exception/mapper/WorkflowEngineConnectionMapper.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.exception.mapper;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Provider
+public class WorkflowEngineConnectionMapper implements ExceptionMapper<WorkflowEngineConnectionException> {
+
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowEngineConnectionMapper.class);
+
+ @Override
+ public Response toResponse(WorkflowEngineConnectionException e) {
+ logger.error("Workflow Engine Connection Error", e);
+ RequestError error = new RequestError();
+ ServiceException value = new ServiceException();
+ value.setMessageId(ErrorNumbers.SVC_GENERAL_SERVICE_ERROR);
+ value.setText(e.getMessage());
+ error.setServiceException(value);
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
new file mode 100644
index 0000000000..20e27a5265
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
@@ -0,0 +1,214 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+import java.io.IOException;
+import java.net.URL;
+import java.sql.Timestamp;
+import java.util.Map;
+import java.util.Optional;
+import javax.ws.rs.container.ContainerRequestContext;
+import org.apache.http.HttpStatus;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.RequestClient;
+import org.onap.so.apihandler.common.RequestClientFactory;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Actions;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.MsoRequest;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException;
+import org.onap.so.apihandlerinfra.infra.rest.exception.WorkflowEngineConnectionException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestReferences;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public abstract class AbstractRestHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(AbstractRestHandler.class);
+
+ public static final String CONFLICT_FAIL_MESSAGE = "Error: Locked instance - This %s (%s) "
+ + "already has a request being worked with a status of %s (RequestId - %s). The existing request must finish or be cleaned up before proceeding.";
+
+
+ @Autowired
+ protected CatalogDbClient catalogDbClient;
+
+ @Autowired
+ protected RequestsDbClient infraActiveRequestsClient;
+
+ @Autowired
+ protected RequestClientFactory reqClientFactory;
+
+ public String getRequestUri(ContainerRequestContext context) {
+ String requestUri = context.getUriInfo().getPath();
+ String httpUrl = MDC.get(LogConstants.URI_BASE).concat(requestUri);
+ MDC.put(LogConstants.HTTP_URL, httpUrl);
+ requestUri = requestUri.substring(requestUri.indexOf("/serviceInstantiation/") + 22);
+ return requestUri;
+ }
+
+ public String getRequestId(ContainerRequestContext requestContext) throws ValidateException {
+ String requestId = null;
+ if (requestContext.getProperty("requestId") != null) {
+ requestId = requestContext.getProperty("requestId").toString();
+ }
+ if (UUIDChecker.isValidUUID(requestId)) {
+ return requestId;
+ } else {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID",
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
+ }
+ }
+
+ public InfraActiveRequests duplicateCheck(Actions action, Map<String, String> instanceIdMap, long startTime,
+ MsoRequest msoRequest, String instanceName, String requestScope, InfraActiveRequests currentActiveReq)
+ throws ApiException {
+ return duplicateCheck(action, instanceIdMap, startTime, instanceName, requestScope, currentActiveReq);
+ }
+
+ public InfraActiveRequests duplicateCheck(Actions action, Map<String, String> instanceIdMap, long startTime,
+ String instanceName, String requestScope, InfraActiveRequests currentActiveReq) throws ApiException {
+ InfraActiveRequests dup = null;
+ try {
+ if (!(instanceName == null && "service".equals(requestScope) && (action == Action.createInstance
+ || action == Action.activateInstance || action == Action.assignInstance))) {
+ dup = infraActiveRequestsClient.checkInstanceNameDuplicate(instanceIdMap, instanceName, requestScope);
+ }
+ } catch (Exception e) {
+ 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());
+ throw requestDbFailureException;
+ }
+ return dup;
+ }
+
+ public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage)
+ throws RequestDbFailureException {
+ if ((aq != null) && ((status == Status.FAILED) || (status == Status.COMPLETE))) {
+
+ aq.setStatusMessage(errorMessage);
+ aq.setProgress(100L);
+ aq.setRequestStatus(status.toString());
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ aq.setEndTime(endTimeStamp);
+ try {
+ infraActiveRequestsClient.updateInfraActiveRequests(aq);
+ } catch (Exception e) {
+ logger.error("Error updating status", e);
+ }
+
+ }
+ }
+
+
+
+ public void callWorkflowEngine(RequestClientParameter requestClientParameter, String orchestrationUri)
+ throws WorkflowEngineConnectionException {
+ RequestClient requestClient = reqClientFactory.getRequestClient(orchestrationUri);
+ try {
+ requestClient.post(requestClientParameter);
+ } catch (IOException e) {
+ logger.error("Error Calling Workflow Engine", e);
+ throw new WorkflowEngineConnectionException("Error Calling Workflow Engine", e);
+ }
+ }
+
+ public Optional<URL> buildSelfLinkUrl(String url, String requestId) {
+ Optional<URL> selfLinkUrl = Optional.empty();
+ String version = "";
+ try {
+ URL aUrl = new URL(url);
+ String aPath = aUrl.getPath();
+ if (aPath.indexOf("/v") == -1) {
+ version = aPath.substring(aPath.indexOf("/V"), aPath.indexOf("/V") + 4);
+ } else {
+ version = aPath.substring(aPath.indexOf("/v"), aPath.indexOf("/v") + 4);
+ }
+ String selfLinkPath = Constants.ORCHESTRATION_REQUESTS_PATH.concat(version).concat(requestId);
+ selfLinkUrl = Optional.of(new URL(aUrl.getProtocol(), aUrl.getHost(), aUrl.getPort(), selfLinkPath));
+ } catch (Exception e) {
+ selfLinkUrl = Optional.empty(); // ignore
+ logger.error("Exception in buildSelfLinkUrl", e);
+ }
+ return selfLinkUrl;
+ }
+
+ /**
+ * @param instanceId
+ * @param requestId
+ * @param requestContext
+ */
+ public ServiceInstancesResponse createResponse(String instanceId, String requestId,
+ ContainerRequestContext requestContext) {
+ ServiceInstancesResponse response = new ServiceInstancesResponse();
+ RequestReferences requestReferences = new RequestReferences();
+ requestReferences.setInstanceId(instanceId);
+ requestReferences.setRequestId(requestId);
+ Optional<URL> optionalUrl = buildSelfLinkUrl(getRequestUri(requestContext), requestId);
+ if (optionalUrl.isPresent()) {
+ requestReferences.setRequestSelfLink(optionalUrl.get());
+ }
+ response.setRequestReferences(requestReferences);
+ return response;
+ }
+
+ public void checkDuplicateRequest(Map<String, String> instanceIdMap, ModelType modelType, String instanceName,
+ String requestId) throws RequestConflictedException {
+ InfraActiveRequests conflictedRequest =
+ infraActiveRequestsClient.checkInstanceNameDuplicate(instanceIdMap, instanceName, modelType.toString());
+ if (conflictedRequest != null && !conflictedRequest.getRequestId().equals(requestId)) {
+ throw new RequestConflictedException(String.format(CONFLICT_FAIL_MESSAGE, modelType.toString(),
+ instanceName, conflictedRequest.getRequestStatus(), conflictedRequest.getRequestId()));
+ }
+ }
+
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandler.java
new file mode 100644
index 0000000000..7b095fc9d0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandler.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.NetworkRecipe;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class NetworkRestHandler extends AbstractRestHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(NetworkRestHandler.class);
+
+ public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String serviceInstanceId,
+ String networkId, String requestorId, String source, String requestURL) {
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ InfraActiveRequests deleteRequest = new InfraActiveRequests();
+ deleteRequest.setRequestAction(Action.deleteInstance.toString());
+ deleteRequest.setAction(Action.deleteInstance.toString());
+ deleteRequest.setStartTime(startTimeStamp);
+ deleteRequest.setServiceInstanceId(serviceInstanceId);
+ deleteRequest.setNetworkId(networkId);
+ deleteRequest.setRequestId(requestId);
+ deleteRequest.setRequestorId(requestorId);
+ deleteRequest.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ deleteRequest.setSource(source);
+ deleteRequest.setRequestStatus(Status.IN_PROGRESS.toString());
+ deleteRequest.setRequestUrl(requestURL);
+ deleteRequest.setRequestScope(ModelType.network.toString());
+ deleteRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ return deleteRequest;
+ }
+
+ public InfraActiveRequests createInfraActiveRequestForDelete(String requestId, String serviceInstanceId,
+ String networkId, String requestorId, String source, String requestURL) {
+ InfraActiveRequests request = mapInfraActiveRequestForDelete(requestId, serviceInstanceId, networkId,
+ requestorId, source, requestURL);
+ infraActiveRequestsClient.save(request);
+ return request;
+ }
+
+ public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
+ String requestId, String serviceInstanceId, String networkId) throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+ return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
+ .setNetworkId(networkId).setALaCarte(true).setRequestDetails(mapper.writeValueAsString(request))
+ .setRequestAction(Action.deleteInstance.toString()).setRequestUri(requestURI).setApiVersion("v8")
+ .build();
+ }
+
+ public void saveInstanceName(ServiceInstancesRequest request, InfraActiveRequests currentRequest) {
+ try {
+ currentRequest.setNetworkName(request.getRequestDetails().getRequestInfo().getInstanceName());
+ infraActiveRequestsClient.updateInfraActiveRequests(currentRequest);
+ } catch (Exception e) {
+ logger.warn("Could not update instance name", e);
+ }
+ }
+
+ public void checkDuplicateRequest(String serviceInstanceId, String networkInstanceId, String instanceName,
+ String requestId) throws RequestConflictedException {
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("networkInstanceId", networkInstanceId);
+ checkDuplicateRequest(instanceIdMap, ModelType.network, instanceName, requestId);
+ }
+
+ public Recipe findNetworkRecipe(String action) throws NoRecipeException {
+ String modelName = "GR-API-DEFAULT";
+ NetworkRecipe recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action);
+
+ if (recipe == null) {
+ throw new NoRecipeException(String.format("Unable to locate default recipe for, Action: %s, Model Name: %s",
+ action, modelName));
+ }
+ return recipe;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandler.java
new file mode 100644
index 0000000000..afadf36157
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandler.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Recipe;
+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.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class ServiceInstanceRestHandler extends AbstractRestHandler {
+
+ private static final String DEFAULT_VF_MODULE_UUID = "d88da85c-d9e8-4f73-b837-3a72a431622b";
+
+ private static final Logger logger = LoggerFactory.getLogger(ServiceInstanceRestHandler.class);
+
+ public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String serviceInstanceId,
+ String requestorId, String source, String requestURL) {
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ InfraActiveRequests deleteRequest = new InfraActiveRequests();
+ deleteRequest.setRequestAction(Action.deleteInstance.toString());
+ deleteRequest.setAction(Action.deleteInstance.toString());
+ deleteRequest.setStartTime(startTimeStamp);
+ deleteRequest.setServiceInstanceId(serviceInstanceId);
+ deleteRequest.setRequestId(requestId);
+ deleteRequest.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ deleteRequest.setRequestorId(requestorId);
+ deleteRequest.setSource(source);
+ deleteRequest.setRequestStatus(Status.IN_PROGRESS.toString());
+ deleteRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ deleteRequest.setRequestUrl(requestURL);
+ deleteRequest.setRequestScope(ModelType.service.toString());
+ return deleteRequest;
+ }
+
+ public InfraActiveRequests createInfraActiveRequestForDelete(String requestId, String serviceInstanceId,
+ String requestorId, String source, String requestURL) {
+ InfraActiveRequests request =
+ mapInfraActiveRequestForDelete(requestId, serviceInstanceId, requestorId, source, requestURL);
+ infraActiveRequestsClient.save(request);
+ return request;
+ }
+
+ public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
+ String requestId, String serviceInstanceId) throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+ return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
+ .setALaCarte(true).setRequestDetails(mapper.writeValueAsString(request))
+ .setRequestAction(Action.deleteInstance.toString()).setRequestUri(requestURI).setApiVersion("v8")
+ .build();
+ }
+
+ public void saveInstanceName(ServiceInstancesRequest request, InfraActiveRequests currentRequest) {
+ try {
+ currentRequest.setServiceInstanceName(request.getRequestDetails().getRequestInfo().getInstanceName());
+ infraActiveRequestsClient.updateInfraActiveRequests(currentRequest);
+ } catch (Exception e) {
+ logger.warn("Could not update instance name", e);
+ }
+ }
+
+ public void checkDuplicateRequest(String serviceInstanceId, String instanceName, String requestId)
+ throws RequestConflictedException {
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ checkDuplicateRequest(instanceIdMap, ModelType.service, instanceName, requestId);
+ }
+
+ public Recipe findServiceRecipe(String modelUUID, String action) throws NoRecipeException {
+ ServiceRecipe recipe = catalogDbClient.findServiceRecipeByActionAndServiceModelUUID(action, modelUUID);
+ if (recipe == null) {
+ recipe = catalogDbClient.findServiceRecipeByActionAndServiceModelUUID(action, DEFAULT_VF_MODULE_UUID);
+ }
+ if (recipe == null) {
+ throw new NoRecipeException(String.format(
+ "Unable to locate custom or default recipe for, Action: %s, Model UUID: %s", action, modelUUID));
+ }
+ return recipe;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VFModuleRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VFModuleRestHandler.java
new file mode 100644
index 0000000000..0762803488
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VFModuleRestHandler.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class VFModuleRestHandler extends AbstractRestHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(VFModuleRestHandler.class);
+
+ public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String vfModuleId,
+ String serviceInstanceId, String vnfId, String requestorId, String source, String requestURL) {
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ InfraActiveRequests deleteRequest = new InfraActiveRequests();
+ deleteRequest.setRequestAction(Action.deleteInstance.toString());
+ deleteRequest.setAction(Action.deleteInstance.toString());
+ deleteRequest.setStartTime(startTimeStamp);
+ deleteRequest.setServiceInstanceId(serviceInstanceId);
+ deleteRequest.setVnfId(vnfId);
+ deleteRequest.setVfModuleId(vfModuleId);
+ deleteRequest.setRequestId(requestId);
+ deleteRequest.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ deleteRequest.setRequestorId(requestorId);
+ deleteRequest.setSource(source);
+ deleteRequest.setVfModuleId(vfModuleId);
+ deleteRequest.setRequestStatus(Status.IN_PROGRESS.toString());
+ deleteRequest.setRequestUrl(requestURL);
+ deleteRequest.setRequestScope(ModelType.vfModule.toString());
+ deleteRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ return deleteRequest;
+ }
+
+ public InfraActiveRequests createInfraActiveRequestForDelete(String requestId, String vfModuleId,
+ String serviceInstanceId, String vnfId, String requestorId, String source, String requestURL) {
+ InfraActiveRequests request = mapInfraActiveRequestForDelete(requestId, vfModuleId, serviceInstanceId, vnfId,
+ requestorId, source, requestURL);
+ infraActiveRequestsClient.save(request);
+ return request;
+ }
+
+ public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
+ String requestId, String serviceInstanceId, String vnfId, String vfModuleId)
+ throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+ return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
+ .setVnfId(vnfId).setVfModuleId(vfModuleId).setALaCarte(true)
+ .setRequestDetails(mapper.writeValueAsString(request))
+ .setRequestAction(Action.deleteInstance.toString()).setRequestUri(requestURI).setApiVersion("v8")
+ .build();
+ }
+
+ public void saveInstanceName(ServiceInstancesRequest request, InfraActiveRequests currentRequest) {
+ try {
+ currentRequest.setVfModuleName(request.getRequestDetails().getRequestInfo().getInstanceName());
+ infraActiveRequestsClient.updateInfraActiveRequests(currentRequest);
+ } catch (Exception e) {
+ logger.warn("Could not update instance name", e);
+ }
+ }
+
+ public void checkDuplicateRequest(String serviceInstanceId, String vnfInstanceId, String vfmoduleInstanceId,
+ String instanceName, String requestId) {
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId);
+ checkDuplicateRequest(instanceIdMap, ModelType.vfModule, instanceName, requestId);
+ }
+
+ public Recipe findVfModuleRecipe(String modelCustomizationId, String modelType, String action)
+ throws NoRecipeException {
+ VnfComponentsRecipe recipe =
+ catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ modelCustomizationId, modelType, action);
+ if (recipe == null) {
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ "GR-API-DEFAULT", modelType, action);
+ }
+ if (recipe == null) {
+ throw new NoRecipeException(String.format(
+ "Unable to locate custom or default recipe for ModelType: %s , Action: %s, CustomizationId: %s",
+ modelType, action, modelCustomizationId));
+ }
+ return recipe;
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
new file mode 100644
index 0000000000..e157d926f3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.VnfRecipe;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class VnfRestHandler extends AbstractRestHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(VnfRestHandler.class);
+
+ public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String serviceInstanceId, String vnfId,
+ String requestorId, String source, String requestURL) {
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ InfraActiveRequests deleteRequest = new InfraActiveRequests();
+ deleteRequest.setRequestAction(Action.deleteInstance.toString());
+ deleteRequest.setAction(Action.deleteInstance.toString());
+ deleteRequest.setStartTime(startTimeStamp);
+ deleteRequest.setServiceInstanceId(serviceInstanceId);
+ deleteRequest.setVnfId(vnfId);
+ deleteRequest.setRequestId(requestId);
+ deleteRequest.setRequestorId(requestorId);
+ deleteRequest.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ deleteRequest.setSource(source);
+ deleteRequest.setRequestStatus(Status.IN_PROGRESS.toString());
+ deleteRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ deleteRequest.setRequestScope(ModelType.vnf.toString());
+ deleteRequest.setRequestUrl(requestURL);
+ return deleteRequest;
+ }
+
+ public InfraActiveRequests createInfraActiveRequestForDelete(String requestId, String serviceInstanceId,
+ String vnfId, String requestorId, String source, String requestURL) {
+ InfraActiveRequests request =
+ mapInfraActiveRequestForDelete(requestId, serviceInstanceId, vnfId, requestorId, source, requestURL);
+ infraActiveRequestsClient.save(request);
+ return request;
+ }
+
+ public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
+ String requestId, String serviceInstanceId, String vnfId) throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+ return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
+ .setVnfId(vnfId).setALaCarte(true).setRequestDetails(mapper.writeValueAsString(request))
+ .setRequestAction(Action.deleteInstance.toString()).setRequestUri(requestURI).setApiVersion("v8")
+ .build();
+ }
+
+ public void saveInstanceName(ServiceInstancesRequest request, InfraActiveRequests currentRequest) {
+ try {
+ currentRequest.setVnfName(request.getRequestDetails().getRequestInfo().getInstanceName());
+ infraActiveRequestsClient.updateInfraActiveRequests(currentRequest);
+ } catch (Exception e) {
+ logger.warn("Could not update instance name", e);
+ }
+ }
+
+ public void checkDuplicateRequest(String serviceInstanceId, String vnfInstanceId, String instanceName,
+ String requestId) {
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ checkDuplicateRequest(instanceIdMap, ModelType.vnf, instanceName, requestId);
+ }
+
+ public Recipe findVnfModuleRecipe(String modelCustomizationId, String modelType, String action)
+ throws NoRecipeException {
+ VnfRecipe recipe = new VnfRecipe();
+ recipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ return recipe;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandler.java
new file mode 100644
index 0000000000..48a8aa2cd8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandler.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.constants.Status;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class VolumeRestHandler extends AbstractRestHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(VolumeRestHandler.class);
+
+ public InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String volumeGroupId,
+ String serviceInstanceId, String vnfId, String requestorId, String source, String requestURL) {
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ InfraActiveRequests deleteRequest = new InfraActiveRequests();
+ deleteRequest.setRequestAction(Action.deleteInstance.toString());
+ deleteRequest.setAction(Action.deleteInstance.toString());
+ deleteRequest.setStartTime(startTimeStamp);
+ deleteRequest.setServiceInstanceId(serviceInstanceId);
+ deleteRequest.setVnfId(vnfId);
+ deleteRequest.setVolumeGroupId(volumeGroupId);
+ deleteRequest.setRequestId(requestId);
+ deleteRequest.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ deleteRequest.setRequestorId(requestorId);
+ deleteRequest.setSource(source);
+ deleteRequest.setRequestStatus(Status.IN_PROGRESS.toString());
+ deleteRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ deleteRequest.setRequestScope(ModelType.volumeGroup.toString());
+ deleteRequest.setRequestUrl(requestURL);
+ return deleteRequest;
+ }
+
+ public InfraActiveRequests createInfraActiveRequestForDelete(String requestId, String volumeGroupId,
+ String serviceInstanceId, String vnfId, String requestorId, String source, String requestURL) {
+ InfraActiveRequests request = mapInfraActiveRequestForDelete(requestId, volumeGroupId, serviceInstanceId, vnfId,
+ requestorId, source, requestURL);
+ infraActiveRequestsClient.save(request);
+ return request;
+ }
+
+ public RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
+ String requestId, String serviceInstanceId, String vnfId, String volumeGroupId)
+ throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+ return new RequestClientParameter.Builder().setRequestId(requestId).setServiceInstanceId(serviceInstanceId)
+ .setVnfId(vnfId).setVolumeGroupId(volumeGroupId).setALaCarte(true)
+ .setRequestDetails(mapper.writeValueAsString(request))
+ .setRequestAction(Action.deleteInstance.toString()).setRequestUri(requestURI).setApiVersion("v8")
+ .build();
+ }
+
+ public void saveInstanceName(ServiceInstancesRequest request, InfraActiveRequests currentRequest) {
+ try {
+ currentRequest.setVolumeGroupName(request.getRequestDetails().getRequestInfo().getInstanceName());
+ infraActiveRequestsClient.updateInfraActiveRequests(currentRequest);
+ } catch (Exception e) {
+ logger.warn("Could not update instance name", e);
+ }
+ }
+
+ public void checkDuplicateRequest(String serviceInstanceId, String vnfInstanceId, String volumeGroupId,
+ String instanceName, String requestId) {
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("vnfInstanceId", vnfInstanceId);
+ instanceIdMap.put("volumeGroupInstanceId", volumeGroupId);
+ checkDuplicateRequest(instanceIdMap, ModelType.volumeGroup, instanceName, requestId);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
new file mode 100644
index 0000000000..4aa60152dd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.Map;
+import java.util.Optional;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+
+public interface RequestValidator {
+
+
+ /**
+ * Should this validator run for given request
+ *
+ * @return
+ */
+ public boolean shouldRunFor(String uri, ServiceInstancesRequest request);
+
+
+ public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams);
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
new file mode 100644
index 0000000000..d689c6b7a5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.validators;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import javax.annotation.PostConstruct;
+import org.javatuples.Pair;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.listener.ListenerRunner;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class RequestValidatorListenerRunner extends ListenerRunner {
+
+ private static Logger logger = LoggerFactory.getLogger(RequestValidatorListenerRunner.class);
+
+ protected List<RequestValidator> requestValidators;
+
+ @PostConstruct
+ protected void init() {
+ requestValidators = new ArrayList<>(
+ Optional.ofNullable(context.getBeansOfType(RequestValidator.class)).orElse(new HashMap<>()).values());
+ }
+
+ public boolean runValidations(String requestURI, Map<String, String> instanceIdMap, ServiceInstancesRequest request,
+ Map<String, String> queryParams) throws ApiException {
+ logger.info("Running local validations");
+ List<Pair<String, Optional<String>>> results =
+ runValidations(requestValidators, instanceIdMap, request, queryParams, requestURI);
+ if (!results.isEmpty()) {
+ throw new ValidateException("Failed Validations:\n"
+ + results.stream().map(item -> String.format("%s: %s", item.getValue0(), item.getValue1().get()))
+ .collect(Collectors.joining("\n")),
+ 400);
+ }
+
+ return true;
+ }
+
+ protected List<Pair<String, Optional<String>>> runValidations(List<? extends RequestValidator> validators,
+ Map<String, String> instanceIdMap, ServiceInstancesRequest request, Map<String, String> queryParams,
+ String requestURI) {
+
+ List<? extends RequestValidator> filtered =
+ filterListeners(validators, (item -> item.shouldRunFor(requestURI, request)));
+
+ List<Pair<String, Optional<String>>> results = new ArrayList<>();
+ filtered.forEach(item -> results
+ .add(new Pair<>(item.getClass().getName(), item.validate(instanceIdMap, request, queryParams))));
+
+ return results.stream().filter(item -> item.getValue1().isPresent()).collect(Collectors.toList());
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
index d79d73c036..d3fb7986ce 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
@@ -38,10 +38,10 @@ import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
@@ -50,6 +50,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestReferences;
import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantSyncResponse;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
@@ -125,7 +126,7 @@ public class CloudOrchestration {
private Response cloudOrchestration(String requestJSON, Action action, HashMap<String, String> instanceIdMap,
String version, String requestId) throws ApiException {
- logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
+ logger.info(LoggingAnchor.TWO, MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);
long startTime = System.currentTimeMillis();
CloudOrchestrationRequest cor = null;
tenantIsolationRequest.setRequestId(requestId);
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 be6d5b06ca..e9cd303c0b 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
@@ -88,11 +88,11 @@ public class CloudResourcesOrchestration {
public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId,
@PathParam("version") String version) throws ApiException {
TenantIsolationRequest msoRequest = new TenantIsolationRequest(requestId);
- InfraActiveRequests infraActiveRequest = null;
+ InfraActiveRequests infraActiveRequest;
- CloudOrchestrationRequest cor = null;
+ CloudOrchestrationRequest cor;
- logger.debug("requestId is: " + requestId);
+ logger.debug("requestId is: {}", requestId);
try {
ObjectMapper mapper = new ObjectMapper();
@@ -140,8 +140,8 @@ public class CloudResourcesOrchestration {
} else {
String status = infraActiveRequest.getRequestStatus();
- if (status.equalsIgnoreCase("IN_PROGRESS") || status.equalsIgnoreCase("PENDING")
- || status.equalsIgnoreCase("PENDING_MANUAL_TASK")) {
+ if ("IN_PROGRESS".equalsIgnoreCase(status) || "PENDING".equalsIgnoreCase(status)
+ || "PENDING_MANUAL_TASK".equalsIgnoreCase(status)) {
infraActiveRequest.setRequestStatus("UNLOCKED");
infraActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
infraActiveRequest.setRequestId(requestId);
@@ -181,8 +181,7 @@ public class CloudResourcesOrchestration {
String requestId = requestIdKey.get(0);
CloudOrchestrationResponse cloudOrchestrationGetResponse = new CloudOrchestrationResponse();
- TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest(requestId);
- InfraActiveRequests requestDB = null;
+ InfraActiveRequests requestDB;
try {
requestDB = requestDbClient.getInfraActiveRequestbyRequestId(requestId);
@@ -213,8 +212,8 @@ public class CloudResourcesOrchestration {
} else {
TenantIsolationRequest tenantIsolationRequest = new TenantIsolationRequest();
- List<InfraActiveRequests> activeRequests = null;
- CloudOrchestrationRequestList orchestrationList = null;
+ List<InfraActiveRequests> activeRequests;
+ CloudOrchestrationRequestList orchestrationList;
Map<String, String> orchestrationMap;
@@ -233,7 +232,7 @@ public class CloudResourcesOrchestration {
}
activeRequests = requestDbClient.getCloudOrchestrationFiltersFromInfraActive(orchestrationMap);
orchestrationList = new CloudOrchestrationRequestList();
- List<CloudOrchestrationResponse> requestLists = new ArrayList<CloudOrchestrationResponse>();
+ List<CloudOrchestrationResponse> requestLists = new ArrayList<>();
for (InfraActiveRequests infraActive : activeRequests) {
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 b2933df030..ef5abe9f74 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
@@ -75,8 +75,7 @@ public class ModelDistributionRequest {
@Transactional
public Response updateModelDistributionStatus(String requestJSON, @PathParam("version") String version,
@PathParam("distributionId") String distributionId) throws ApiException {
- long startTime = System.currentTimeMillis();
- Distribution distributionRequest = null;
+ Distribution distributionRequest;
try {
ObjectMapper mapper = new ObjectMapper();
@@ -138,15 +137,13 @@ public class ModelDistributionRequest {
se.setMessageId(messageId);
se.setText(text);
if (variables != null) {
- if (variables != null) {
- for (String variable : variables) {
- se.getVariables().add(variable);
- }
+ for (String variable : variables) {
+ se.getVariables().add(variable);
}
}
re.setServiceException(se);
- String requestErrorStr = null;
+ String requestErrorStr;
try {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_DEFAULT);
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 696616099f..6449b0bb75 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
@@ -30,7 +30,6 @@ import java.util.Map.Entry;
import javax.ws.rs.core.MultivaluedMap;
import org.apache.commons.lang3.StringUtils;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Manifest;
import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
@@ -42,11 +41,10 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters;
import org.onap.so.apihandlerinfra.tenantisolationbeans.ResourceType;
import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList;
import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
-import org.onap.so.logger.MessageEnum;
import org.onap.so.utils.UUIDChecker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -94,6 +92,7 @@ public class TenantIsolationRequest {
requestJSON = mapper.writeValueAsString(request.getRequestDetails());
} catch (JsonProcessingException e) {
+ logger.error("Exception in JSON processing", e);
throw new ValidationException("Parse ServiceInstanceRequest to JSON string", true);
}
@@ -327,6 +326,7 @@ public class TenantIsolationRequest {
orchestrationFilterParams.put(queryParam, value);
}
} catch (Exception e) {
+ logger.error("Exception in getOrchestrationFilters", e);
throw new ValidationException(e.getMessage(), true);
}
}
@@ -356,8 +356,7 @@ public class TenantIsolationRequest {
request.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
requestsDbClient.save(request);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.APIH_DB_UPDATE_EXC.toString(), e.getMessage(),
- ErrorCode.DataError.getValue(), "Exception when updating record in DB");
+ logger.error("Exception when updating record in DB", e);
logger.debug("Exception: ", e);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
index 8b3b91ae1a..6942d441e6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelper.java
@@ -34,15 +34,13 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class AAIClientHelper {
- private static Logger logger = LoggerFactory.getLogger(AAIClientHelper.class);
+
/**
* Get managing ECOMP Environment Info from A&AI
@@ -63,7 +61,7 @@ public class AAIClientHelper {
* Update managing ECOMP Environment Info from A&AI
*
* @param id = operationalEnvironmentId
- * @param AAIOperationalEnvironment object
+ * @param aaiRequest object
*/
public void updateAaiOperationalEnvironment(String id, OperationalEnvironment aaiRequest) {
@@ -75,7 +73,7 @@ public class AAIClientHelper {
public void updateAaiOperationalEnvironment(String operationalEnvironmentId, Map<String, String> payload)
- throws Exception {
+ throws AAIClientCallFailed {
try {
AAIResourceUri uri =
AAIUriFactory.createResourceUri(AAIObjectType.OPERATIONAL_ENVIRONMENT, operationalEnvironmentId);
@@ -90,7 +88,7 @@ public class AAIClientHelper {
/**
* Create an Operational Environment object in A&AI
*
- * @param AAIOperationalEnvironment object
+ * @param operationalEnvironment object
*/
public void createOperationalEnvironment(OperationalEnvironment operationalEnvironment) {
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 98b49d39d7..1e5958c540 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
@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
@Component
public class ActivateVnfDBHelper {
- private static Logger logger = LoggerFactory.getLogger(ActivateVnfDBHelper.class);
+
/**
* Insert record to OperationalEnvServiceModelStatus table
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
index b5ba9281a6..18ca6d3086 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
@@ -50,12 +50,19 @@ public class SDCClientHelper {
private static Logger logger = LoggerFactory.getLogger(SDCClientHelper.class);
private static final String SDC_CONTENT_TYPE = "application/json";
private static final String SDC_ACCEPT_TYPE = "application/json";
- private static String PARTIAL_SDC_URI = "/sdc/v1/catalog/services/";
+ private static final String PARTIAL_SDC_URI = "/sdc/v1/catalog/services/";
- private static String MESSAGE_UNDEFINED_ERROR = "Undefined Error Message!";
- private static String MESSAGE_UNEXPECTED_FORMAT = "Unexpected response format from SDC.";
+ private static final String MESSAGE_UNDEFINED_ERROR = "Undefined Error Message!";
+ private static final String MESSAGE_UNEXPECTED_FORMAT = "Unexpected response format from SDC.";
private final HttpClientFactory httpClientFactory = new HttpClientFactory();
+ private static final String STATUS_CODE = "statusCode";
+ private static final String MESSAGE = "message";
+ private static final String MESSAGE_ID = "messageId";
+ private static final String REQUEST_ERROR = "requestError";
+ private static final String SERVICE_EXCEPTION = "serviceException";
+ private static final String POLICY_EXCEPTION = "policyException";
+
@Value("${mso.sdc.endpoint}")
private String sdcEndpoint;
@Value("${mso.sdc.activate.userid}")
@@ -89,12 +96,11 @@ public class SDCClientHelper {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
.build();
- ValidateException validateException = new ValidateException.Builder(
+
+ throw new ValidateException.Builder(
" SDC credentials 'mso.sdc.client.auth' not setup in properties file!",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo)
.build();
-
- throw validateException;
}
URL url = new URL(urlString);
@@ -114,12 +120,12 @@ public class SDCClientHelper {
sdcResponseJsonObj = enhanceJsonResponse(new JSONObject(responseData), statusCode);
} catch (Exception ex) {
- logger.debug("calling SDC Exception message: {}", ex.getMessage());
+ logger.debug("calling SDC Exception message:", ex);
String errorMessage = " Encountered Error while calling SDC POST Activate. " + ex.getMessage();
logger.debug(errorMessage);
- sdcResponseJsonObj.put("statusCode", String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
- sdcResponseJsonObj.put("messageId", "");
- sdcResponseJsonObj.put("message", errorMessage);
+ sdcResponseJsonObj.put(STATUS_CODE, String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
+ sdcResponseJsonObj.put(MESSAGE_ID, "");
+ sdcResponseJsonObj.put(MESSAGE, errorMessage);
}
return sdcResponseJsonObj;
@@ -139,11 +145,9 @@ public class SDCClientHelper {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError)
.build();
- ValidateException validateException =
- new ValidateException.Builder("Bad request could not post payload", HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
- throw validateException;
+ throw new ValidateException.Builder("Bad request could not post payload", HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(ex).errorInfo(errorLoggerInfo).build();
}
}
@@ -154,7 +158,7 @@ public class SDCClientHelper {
* @param statusCode - int
* @return enhancedAsdcResponseJsonObj - JSONObject object
*/
- public JSONObject enhanceJsonResponse(JSONObject sdcResponseJsonObj, int statusCode) throws JSONException {
+ public JSONObject enhanceJsonResponse(JSONObject sdcResponseJsonObj, int statusCode) {
JSONObject enhancedAsdcResponseJsonObj = new JSONObject();
@@ -163,31 +167,31 @@ public class SDCClientHelper {
if (statusCode == Response.Status.ACCEPTED.getStatusCode()) { // Accepted
enhancedAsdcResponseJsonObj.put("distributionId", sdcResponseJsonObj.get("distributionId"));
- enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
- enhancedAsdcResponseJsonObj.put("messageId", "");
- enhancedAsdcResponseJsonObj.put("message", "Success");
+ enhancedAsdcResponseJsonObj.put(STATUS_CODE, Integer.toString(statusCode));
+ enhancedAsdcResponseJsonObj.put(MESSAGE_ID, "");
+ enhancedAsdcResponseJsonObj.put(MESSAGE, "Success");
} else { // error
- if (sdcResponseJsonObj.has("requestError")) {
- JSONObject requestErrorObj = sdcResponseJsonObj.getJSONObject("requestError");
- if (sdcResponseJsonObj.getJSONObject("requestError").has("serviceException")) {
- message = requestErrorObj.getJSONObject("serviceException").getString("text");
- messageId = requestErrorObj.getJSONObject("serviceException").getString("messageId");
+ if (sdcResponseJsonObj.has(REQUEST_ERROR)) {
+ JSONObject requestErrorObj = sdcResponseJsonObj.getJSONObject(REQUEST_ERROR);
+ if (sdcResponseJsonObj.getJSONObject(REQUEST_ERROR).has(SERVICE_EXCEPTION)) {
+ message = requestErrorObj.getJSONObject(SERVICE_EXCEPTION).getString("text");
+ messageId = requestErrorObj.getJSONObject(SERVICE_EXCEPTION).getString(MESSAGE_ID);
}
- if (sdcResponseJsonObj.getJSONObject("requestError").has("policyException")) {
- message = requestErrorObj.getJSONObject("policyException").getString("text");
- messageId = requestErrorObj.getJSONObject("policyException").getString("messageId");
+ if (sdcResponseJsonObj.getJSONObject(REQUEST_ERROR).has(POLICY_EXCEPTION)) {
+ message = requestErrorObj.getJSONObject(POLICY_EXCEPTION).getString("text");
+ messageId = requestErrorObj.getJSONObject(POLICY_EXCEPTION).getString(MESSAGE_ID);
}
- enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
- enhancedAsdcResponseJsonObj.put("messageId", messageId);
- enhancedAsdcResponseJsonObj.put("message", message);
+ enhancedAsdcResponseJsonObj.put(STATUS_CODE, Integer.toString(statusCode));
+ enhancedAsdcResponseJsonObj.put(MESSAGE_ID, messageId);
+ enhancedAsdcResponseJsonObj.put(MESSAGE, message);
} else {
// unexpected format
- enhancedAsdcResponseJsonObj.put("statusCode",
+ enhancedAsdcResponseJsonObj.put(STATUS_CODE,
String.valueOf(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
- enhancedAsdcResponseJsonObj.put("messageId", MESSAGE_UNDEFINED_ERROR);
- enhancedAsdcResponseJsonObj.put("message", MESSAGE_UNEXPECTED_FORMAT);
+ enhancedAsdcResponseJsonObj.put(MESSAGE_ID, MESSAGE_UNDEFINED_ERROR);
+ enhancedAsdcResponseJsonObj.put(MESSAGE, MESSAGE_UNEXPECTED_FORMAT);
}
}
return enhancedAsdcResponseJsonObj;
@@ -214,7 +218,7 @@ public class SDCClientHelper {
* @return String json
* @throws JSONException
*/
- public String buildJsonWorkloadContext(String workloadContext) throws JSONException {
+ public String buildJsonWorkloadContext(String workloadContext) {
return new JSONObject().put("workloadContext", workloadContext).toString();
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index 3005abaf9b..3226a0c313 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -61,16 +61,14 @@ public class ActivateVnfStatusOperationalEnvironment {
private OperationalEnvServiceModelStatus queryServiceModelResponse = null;
private boolean isOverallSuccess = false;
- private final int RETRY_COUNT_ZERO = 0;
- private final String ERROR_REASON_ABORTED = "ABORTED";
- private final String RECOVERY_ACTION_RETRY = "RETRY";
- private final String RECOVERY_ACTION_ABORT = "ABORT";
- private final String RECOVERY_ACTION_SKIP = "SKIP";
- private final String DISTRIBUTION_STATUS_OK = DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString();
- private final String DISTRIBUTION_STATUS_ERROR = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
- private final String DISTRIBUTION_STATUS_SENT = "SENT";
-
- private final String MESSAGE_UNDEFINED_ID = "Undefined Error Message!";
+ private static final int RETRY_COUNT_ZERO = 0;
+ private static final String ERROR_REASON_ABORTED = "ABORTED";
+ private static final String RECOVERY_ACTION_RETRY = "RETRY";
+ private static final String RECOVERY_ACTION_ABORT = "ABORT";
+ private static final String RECOVERY_ACTION_SKIP = "SKIP";
+ private static final String DISTRIBUTION_STATUS_OK = DistributionStatus.DISTRIBUTION_COMPLETE_OK.toString();
+ private static final String DISTRIBUTION_STATUS_ERROR = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
+ private static final String DISTRIBUTION_STATUS_SENT = "SENT";
@Autowired
private ActivateVnfDBHelper dbHelper;
@@ -130,6 +128,7 @@ public class ActivateVnfStatusOperationalEnvironment {
}
} catch (Exception e) {
+ logger.error("Exception in execute", e);
requestDb.updateInfraFailureCompletion(e.getMessage(), this.origRequestId,
this.queryServiceModelResponse.getVnfOperationalEnvId());
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
index fe81a07212..5eb4a67fa6 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
@@ -145,7 +145,7 @@ public class CreateVnfOperationalEnvironment {
throws TenantIsolationException {
List<ServiceEndPoint> endpointList = serviceEndPointList.getServiceEndPointList();
logger.debug("Number of service endpoints from GRM: {}", endpointList.size());
- List<ServiceEndPointRequest> serviceEndPointRequestList = new ArrayList<ServiceEndPointRequest>();
+ List<ServiceEndPointRequest> serviceEndPointRequestList = new ArrayList<>();
for (ServiceEndPoint serviceEndpoint : endpointList) {
serviceEndPointRequestList.add(buildServiceEndpoint(serviceEndpoint));
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java
index 4c66a3118e..c50f18c594 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/Manifest.java
@@ -34,7 +34,7 @@ public class Manifest implements Serializable {
private static final long serialVersionUID = -3460949513229380541L;
@JsonProperty("serviceModelList")
- private List<ServiceModelList> serviceModelList = new ArrayList<ServiceModelList>();
+ private List<ServiceModelList> serviceModelList = new ArrayList<>();
public List<ServiceModelList> getServiceModelList() {
return serviceModelList;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
index 907bc942eb..2cf01f9390 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
@@ -29,51 +29,59 @@ import org.onap.so.utils.UUIDChecker;
public class InstanceIdMapValidation implements ValidationRule {
+ private static final String Service_InstanceId = "serviceInstanceId";
+ private static final String Vnf_InstanceId = "vnfInstanceId";
+ private static final String vfModule_InstanceId = "vfModuleInstanceId";
+
+ private static final String volume_Group_InstanceId = "volumeGroupInstanceId";
+ private static final String Network_Instance_Id = "networkInstanceId";
+ private static final String Configuration_Instance_Id = "configurationInstanceId";
+
@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
HashMap<String, String> instanceIdMap = info.getInstanceIdMap();
ServiceInstancesRequest sir = info.getSir();
if (instanceIdMap != null) {
- if (instanceIdMap.get("serviceInstanceId") != null) {
- if (!UUIDChecker.isValidUUID(instanceIdMap.get("serviceInstanceId"))) {
- throw new ValidationException("serviceInstanceId");
+ if (instanceIdMap.get(Service_InstanceId) != null) {
+ if (!UUIDChecker.isValidUUID(instanceIdMap.get(Service_InstanceId))) {
+ throw new ValidationException(Service_InstanceId);
}
- sir.setServiceInstanceId(instanceIdMap.get("serviceInstanceId"));
+ sir.setServiceInstanceId(instanceIdMap.get(Service_InstanceId));
}
- if (instanceIdMap.get("vnfInstanceId") != null) {
- if (!UUIDChecker.isValidUUID(instanceIdMap.get("vnfInstanceId"))) {
- throw new ValidationException("vnfInstanceId");
+ if (instanceIdMap.get(Vnf_InstanceId) != null) {
+ if (!UUIDChecker.isValidUUID(instanceIdMap.get(Vnf_InstanceId))) {
+ throw new ValidationException(Vnf_InstanceId);
}
- sir.setVnfInstanceId(instanceIdMap.get("vnfInstanceId"));
+ sir.setVnfInstanceId(instanceIdMap.get(Vnf_InstanceId));
}
- if (instanceIdMap.get("vfModuleInstanceId") != null) {
- if (!UUIDChecker.isValidUUID(instanceIdMap.get("vfModuleInstanceId"))) {
- throw new ValidationException("vfModuleInstanceId");
+ if (instanceIdMap.get(vfModule_InstanceId) != null) {
+ if (!UUIDChecker.isValidUUID(instanceIdMap.get(vfModule_InstanceId))) {
+ throw new ValidationException(vfModule_InstanceId);
}
- sir.setVfModuleInstanceId(instanceIdMap.get("vfModuleInstanceId"));
+ sir.setVfModuleInstanceId(instanceIdMap.get(vfModule_InstanceId));
}
- if (instanceIdMap.get("volumeGroupInstanceId") != null) {
- if (!UUIDChecker.isValidUUID(instanceIdMap.get("volumeGroupInstanceId"))) {
- throw new ValidationException("volumeGroupInstanceId");
+ if (instanceIdMap.get(volume_Group_InstanceId) != null) {
+ if (!UUIDChecker.isValidUUID(instanceIdMap.get(volume_Group_InstanceId))) {
+ throw new ValidationException(volume_Group_InstanceId);
}
- sir.setVolumeGroupInstanceId(instanceIdMap.get("volumeGroupInstanceId"));
+ sir.setVolumeGroupInstanceId(instanceIdMap.get(volume_Group_InstanceId));
}
- if (instanceIdMap.get("networkInstanceId") != null) {
- if (!UUIDChecker.isValidUUID(instanceIdMap.get("networkInstanceId"))) {
- throw new ValidationException("networkInstanceId");
+ if (instanceIdMap.get(Network_Instance_Id) != null) {
+ if (!UUIDChecker.isValidUUID(instanceIdMap.get(Network_Instance_Id))) {
+ throw new ValidationException(Network_Instance_Id);
}
- sir.setNetworkInstanceId(instanceIdMap.get("networkInstanceId"));
+ sir.setNetworkInstanceId(instanceIdMap.get(Network_Instance_Id));
}
- if (instanceIdMap.get("configurationInstanceId") != null) {
- if (!UUIDChecker.isValidUUID(instanceIdMap.get("configurationInstanceId"))) {
- throw new ValidationException("configurationInstanceId");
+ if (instanceIdMap.get(Configuration_Instance_Id) != null) {
+ if (!UUIDChecker.isValidUUID(instanceIdMap.get(Configuration_Instance_Id))) {
+ throw new ValidationException(Configuration_Instance_Id);
}
- sir.setConfigurationId(instanceIdMap.get("configurationInstanceId"));
+ sir.setConfigurationId(instanceIdMap.get(Configuration_Instance_Id));
}
if (instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID) != null) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java
index c80e89e21d..20be2b5a8b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/PlatformLOBValidation.java
@@ -23,9 +23,9 @@ package org.onap.so.apihandlerinfra.validation;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Actions;
-import org.onap.so.apihandlerinfra.ModelType;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.serviceinstancebeans.LineOfBusiness;
+import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.Platform;
public class PlatformLOBValidation implements ValidationRule {
@@ -43,7 +43,8 @@ public class PlatformLOBValidation implements ValidationRule {
platform = info.getSir().getRequestDetails().getPlatform();
lineOfBusiness = info.getSir().getRequestDetails().getLineOfBusiness();
- if (reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.createInstance) {
+ if (reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action == Action.createInstance
+ && !info.getReqParameters().getEnforceValidNfValues()) {
if (reqVersion > 5 && platform == null) {
throw new ValidationException("platform");
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java
index 60e1274469..cebbd6389c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ProjectOwningEntityValidation.java
@@ -23,8 +23,8 @@ package org.onap.so.apihandlerinfra.validation;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Actions;
-import org.onap.so.apihandlerinfra.ModelType;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.OwningEntity;
import org.onap.so.serviceinstancebeans.Project;
@@ -41,10 +41,12 @@ public class ProjectOwningEntityValidation implements ValidationRule {
String requestScope = info.getRequestScope();
Actions action = info.getAction();
+
project = info.getSir().getRequestDetails().getProject();
owningEntity = info.getSir().getRequestDetails().getOwningEntity();
if (reqVersion >= 5 && requestScope.equalsIgnoreCase(ModelType.service.name())
- && action == Action.createInstance || action == Action.assignInstance) {
+ && !info.getReqParameters().getEnforceValidNfValues() && action == Action.createInstance
+ || action == Action.assignInstance) {
if (reqVersion > 5 && owningEntity == null) {
throw new ValidationException("owningEntity");
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
index b02bd95d97..3b87d91d3f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
@@ -119,12 +119,25 @@ public class RelatedInstancesValidation implements ValidationRule {
isRelatedServiceInstancePresent = true;
}
+ if (requestScope.equalsIgnoreCase(ModelType.service.name())) {
+ if (empty(relatedInstance.getInstanceName())
+ && ModelType.vpnBinding.equals(relatedInstanceModelInfo.getModelType())) {
+ throw new ValidationException("instanceName in relatedInstance for vpnBinding modelType", true);
+ }
+ if (empty(relatedInstance.getInstanceName())
+ && ModelType.network.equals(relatedInstanceModelInfo.getModelType())) {
+ throw new ValidationException("instanceName in relatedInstance for network modelType", true);
+ }
+ }
+
if (action != Action.deleteInstance
&& !requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString())) {
if (!(relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)
|| relatedInstanceModelInfo.getModelType().equals(ModelType.connectionPoint)
|| relatedInstanceModelInfo.getModelType().equals(ModelType.pnf)
- || relatedInstanceModelInfo.getModelType().equals(ModelType.networkInstanceGroup))) {
+ || relatedInstanceModelInfo.getModelType().equals(ModelType.networkInstanceGroup)
+ || relatedInstanceModelInfo.getModelType().equals(ModelType.network)
+ || relatedInstanceModelInfo.getModelType().equals(ModelType.vpnBinding))) {
if (empty(relatedInstanceModelInfo.getModelInvariantId())) {
throw new ValidationException("modelInvariantId in relatedInstance");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java
index 2236b09f2a..7a0a6fe633 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ObjectFactory.java
@@ -49,8 +49,7 @@ import javax.xml.namespace.QName;
public class ObjectFactory {
private final static QName _VnfParams_QNAME = new QName("http://org.onap/so/infra/vnf-request/v1", "vnf-params");
- private final static QName _NetworkParams_QNAME =
- new QName("http://org.onap/so/infra/vnf-request/v1", "network-params");
+
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml
deleted file mode 100644
index a39d28038c..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application-local.yaml
+++ /dev/null
@@ -1,179 +0,0 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-
-server:
- port: 8080
- tomcat:
- max-threads: 50
-ssl-enable: false
-
-apih-healthcheck-urn: /ecomp/mso/healthcheck,/ecomp/mso/homing/healthcheck,/ecomp/mso/infra/healthcheck,/asdc/healthcheck,/dbadapters/healthcheck,/ecomp/mso/catalog/v2/healthcheck
-jra-healthcheck-urn: /networks/rest/healthcheck,/adapters/rest/healthcheck,/vnfs/rest/healthcheck,/tenants/rest/healthcheck,/appc/rest/healthcheck,/workflows/messages/healthcheck
-camunda-healthcheck-urn: /mso/healthcheck
-
-apih-nodehealthcheck-urn: /ecomp/mso/infra/nodehealthcheck
-jra-nodehealthcheck-urn: /adapters/rest/nodehealthcheck
-camunda-nodehealthcheck-urn: /mso/nodehealthcheck
-
-
-
-mso:
- health:
- endpoints:
- catalogdb: http://localhost:8800
- sdnc: http://localhost:8400
- openstack: http://localhost:8300
- requestdb: http://localhost:8700
- bpmn: http://localhost:8200
- asdc: http://localhost:8400
- requestdbattsvc: http://localhost:8600
-
- adapters:
- requestDb:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- endpoint: http://localhost:8081
- logPath: logs
- site-name: mtanj
- catalog:
- db:
- spring:
- endpoint: "http://localhost:8080"
- db:
- auth: Basic YnBlbDptc28tZGItMTUwNyE=
- config:
- path: /src/main/resources/
- infra:
- default:
- alacarte:
- orchestrationUri: /mso/async/services/ALaCarteOrchestrator
- recipeTimeout: 180
- testApi: VNF_API
- service:
- macro:
- default:
- testApi: GR_API
- apih:
- homing:
- sdna:
- url: http://localhost:8089/
- password: 4E0BDC08EE8EDC0572ABBE9FD2D59B62DB725A00B8469E39393D6C86D64284C5D34A57D56F7B58C375316F
- camundaURL: http://localhost:8089/
- camundaAuth: E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE
- async:
- core-pool-size: 50
- max-pool-size: 50
- queue-capacity: 500
- sdc:
- client:
- auth: 97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF
- activate:
- instanceid: test
- userid: cs0008
- endpoint: http://localhost:28090
- msoKey: 07a7159d3bf51a0e53be7a8f89699be7
- tenant:
- isolation:
- retry:
- count: 3
- aai:
- endpoint: http://localhost:28090
- auth: 5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C
- grm:
- endpoint: http://localhost:28090
- username: gmruser
- password: test
- so:
- operational-environment:
- dmaap:
- username: testuser
- password: VjR5NDcxSzA=
- host: http://localhost:28090
- publisher:
- topic: com.att.ecomp.mso.operationalEnvironmentEvent
-
-# controls what actions the infra API (APIH) allows sent in on REST request
-vnf:
- v1:
- ApiAllowableActions:
- v2:
- ApiAllowableActions:
- v3:
- ApiAllowableActions:
-
-network:
- v1:
- ApiAllowableActions:
- v2:
- ApiAllowableActions:
- v3:
- ApiAllowableActions:
-
-volume:
- v1:
- ApiAllowableActions:
- v2:
- ApiAllowableActions:
- v3:
- ApiAllowableActions:
-
-# H2
-spring:
- datasource:
- url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
- username: sa
- password: sa
- driver-class-name: org.h2.Driver
- intialize: true
- h2:
- console:
- enabled: true
- path: /h2
-
- jpa:
- show-sql: true
- hibernate:
- dialect: org.hibernate.dialect.H2Dialect
- ddl-auto: validate
- naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
- enable_lazy_load_no_trans: true
- jersey:
- type: filter
- security:
- usercredentials:
- -
- username: sitecontrol
- password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu'
- role: SiteControl-Client
- -
- username: gui
- password: '$2a$12$9Y4daXavh.oX5fz6t/e7TuCdj7EKW5B5ibqq425fN3/xpp0/Fhyti'
- role: GUI-Client
- -
- username: infraportal
- password: '$2a$12$IpUEhQijWTNbq0fGYVkA9upZrDvdIK6QfblIaKAiwi0vBQRE.C6Ri'
- role: InfraPortal-Client
- -
- username: bpel
- password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
- role: BPEL-Client
- -
- username: mso_admin
- password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
- role: ACTUATOR
-request:
- datasource:
- url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
- username: sa
- password: sa
- driver-class-name: org.h2.Driver
- intialize: true
-
-#Actuator
-management:
- context-path: /manage
-
-org:
- onap:
- so:
- adapters:
- network:
- encryptionKey: aa3871669d893c7fb8abbcda31b88b4f
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
index 03934edf20..babefd9478 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
@@ -26,13 +26,20 @@ mso:
uri: /sobpmnengine/task
history:
uri: /sobpmnengine/history/process-instance?variables=mso-request-id_eq_
+ activity:
+ uri: /sobpmnengine/history/activity-instance?processInstanceId=
+ camundaURL: http://localhost:8089
+ camundaAuth: E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE
spring:
datasource:
- jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
+ hikari:
+ jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: catdb-pool
+ registerMbeans: true
jpa:
show-sql: true
hibernate:
@@ -42,14 +49,18 @@ spring:
enable-lazy-load-no-trans: true
jersey:
type: filter
+ main:
+ allow-bean-definition-overriding: true
request:
datasource:
- jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
- username: ${DB_USERNAME}
- password: ${DB_PASSWORD}
- driver-class-name: org.mariadb.jdbc.Driver
-
+ hikari:
+ jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ driver-class-name: org.mariadb.jdbc.Driver
+ pool-name: reqdb-pool
+ registerMbeans: true
#Actuator
management:
endpoints:
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java
deleted file mode 100644
index 276b438529..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.apihandler.filters;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.net.URI;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.core.UriInfo;
-import org.junit.Test;
-import org.onap.so.apihandlerinfra.BaseTest;
-
-
-
-public class RequestUriFilterTest extends BaseTest {
-
- @Test
- public void filterTest() throws IOException {
- RequestUriFilter URIFilter = new RequestUriFilter();
- URI baseURI = URI.create("http://localhost:58879/");
- String requestURI = "onap/so/infra/serviceInstances/v5";
-
- ContainerRequestContext mockContext = mock(ContainerRequestContext.class);
- UriInfo mockInfo = mock(UriInfo.class);
-
- when(mockContext.getUriInfo()).thenReturn(mockInfo);
- when(mockInfo.getBaseUri()).thenReturn(baseURI);
- when(mockInfo.getPath()).thenReturn(requestURI);
-
-
- URIFilter.filter(mockContext);
- assertEquals("http://localhost:58879/onap/so/infra/serviceInstantiation/v5/serviceInstances",
- URIFilter.getRequestUri());
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java
new file mode 100644
index 0000000000..830f38f98b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java
@@ -0,0 +1,340 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.camunda.bpm.engine.impl.persistence.entity.HistoricActivityInstanceEntity;
+import org.camunda.bpm.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.core.env.Environment;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.HttpStatusCodeException;
+import org.springframework.web.client.ResourceAccessException;
+import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class CamundaRequestHandlerTest {
+
+ @Mock
+ private RestTemplate restTemplate;
+
+ @Mock
+ private Environment env;
+
+ @InjectMocks
+ @Spy
+ private CamundaRequestHandler camundaRequestHandler;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private static final String REQUEST_ID = "eca3a1b1-43ab-457e-ab1c-367263d148b4";
+ private ResponseEntity<List<HistoricActivityInstanceEntity>> activityInstanceResponse = null;
+ private ResponseEntity<List<HistoricProcessInstanceEntity>> processInstanceResponse = null;
+ private List<HistoricActivityInstanceEntity> activityInstanceList = null;
+ private List<HistoricProcessInstanceEntity> processInstanceList = null;
+
+
+
+ @Before
+ public void setup() throws IOException {
+ ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ activityInstanceList = mapper.readValue(
+ new String(Files.readAllBytes(
+ Paths.get("src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json"))),
+ new TypeReference<List<HistoricActivityInstanceEntity>>() {});
+ processInstanceList = mapper.readValue(
+ new String(Files.readAllBytes(
+ Paths.get("src/test/resources/OrchestrationRequest/ProcessInstanceHistoryResponse.json"))),
+ new TypeReference<List<HistoricProcessInstanceEntity>>() {});
+ processInstanceResponse =
+ new ResponseEntity<List<HistoricProcessInstanceEntity>>(processInstanceList, HttpStatus.ACCEPTED);
+ activityInstanceResponse =
+ new ResponseEntity<List<HistoricActivityInstanceEntity>>(activityInstanceList, HttpStatus.ACCEPTED);
+
+ doReturn("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_").when(env)
+ .getProperty("mso.camunda.rest.history.uri");
+ doReturn("/sobpmnengine/history/activity-instance?processInstanceId=").when(env)
+ .getProperty("mso.camunda.rest.activity.uri");
+ doReturn("auth").when(env).getRequiredProperty("mso.camundaAuth");
+ doReturn("key").when(env).getRequiredProperty("mso.msoKey");
+ doReturn("http://localhost:8089").when(env).getProperty("mso.camundaURL");
+ }
+
+ public HttpHeaders setHeaders() {
+ HttpHeaders headers = new HttpHeaders();
+ List<org.springframework.http.MediaType> acceptableMediaTypes = new ArrayList<>();
+ acceptableMediaTypes.add(org.springframework.http.MediaType.APPLICATION_JSON);
+ headers.setAccept(acceptableMediaTypes);
+ headers.add(HttpHeaders.AUTHORIZATION, "auth");
+
+ return headers;
+ }
+
+ @Test
+ public void getActivityNameTest() {
+ String expectedActivityName = "Last task executed: BB to Execute";
+ String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
+
+ assertEquals(expectedActivityName, actualActivityName);
+ }
+
+ @Test
+ public void getActivityNameNullActivityNameTest() {
+ String expectedActivityName = "Task name is null.";
+ HistoricActivityInstanceEntity activityInstance = new HistoricActivityInstanceEntity();
+ List<HistoricActivityInstanceEntity> activityInstanceList = new ArrayList<>();
+ activityInstanceList.add(activityInstance);
+
+ String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
+
+ assertEquals(expectedActivityName, actualActivityName);
+ }
+
+ @Test
+ public void getActivityNameNullListTest() {
+ String expectedActivityName = "No results returned on activityInstance history lookup.";
+ List<HistoricActivityInstanceEntity> activityInstanceList = null;
+ String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
+
+ assertEquals(expectedActivityName, actualActivityName);
+ }
+
+ @Test
+ public void getActivityNameEmptyListTest() {
+ String expectedActivityName = "No results returned on activityInstance history lookup.";
+ List<HistoricActivityInstanceEntity> activityInstanceList = new ArrayList<>();
+ String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
+
+ assertEquals(expectedActivityName, actualActivityName);
+ }
+
+ @Test
+ public void getTaskNameTest() throws ContactCamundaException {
+ doReturn(processInstanceResponse).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
+ doReturn(activityInstanceResponse).when(camundaRequestHandler)
+ .getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b", REQUEST_ID);
+ doReturn("Last task executed: BB to Execute").when(camundaRequestHandler).getActivityName(activityInstanceList);
+ String expectedTaskName = "Last task executed: BB to Execute";
+
+ String actualTaskName = camundaRequestHandler.getTaskName(REQUEST_ID);
+
+ assertEquals(expectedTaskName, actualTaskName);
+ }
+
+ @Test
+ public void getTaskNameNullProcessInstanceListTest() throws ContactCamundaException {
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response = new ResponseEntity<>(null, HttpStatus.OK);
+ doReturn(response).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
+ String expected = "No processInstances returned for requestId: " + REQUEST_ID;
+
+ String actual = camundaRequestHandler.getTaskName(REQUEST_ID);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void getTaskNameNullProcessInstanceIdTest() throws ContactCamundaException {
+ HistoricProcessInstanceEntity processInstance = new HistoricProcessInstanceEntity();
+ List<HistoricProcessInstanceEntity> processInstanceList = new ArrayList<>();
+ processInstanceList.add(processInstance);
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response =
+ new ResponseEntity<>(processInstanceList, HttpStatus.OK);
+ doReturn(response).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
+ String expected = "No processInstanceId returned for requestId: " + REQUEST_ID;
+
+ String actual = camundaRequestHandler.getTaskName(REQUEST_ID);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void getTaskNameEmptyProcessInstanceListTest() throws ContactCamundaException {
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response =
+ new ResponseEntity<>(Collections.emptyList(), HttpStatus.OK);
+ doReturn(response).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
+ String expected = "No processInstances returned for requestId: " + REQUEST_ID;
+
+ String actual = camundaRequestHandler.getTaskName(REQUEST_ID);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void getTaskNameProcessInstanceLookupFailureTest() throws ContactCamundaException {
+ doThrow(HttpClientErrorException.class).when(camundaRequestHandler)
+ .getCamundaProcessInstanceHistory(REQUEST_ID);
+
+ thrown.expect(ContactCamundaException.class);
+ camundaRequestHandler.getTaskName(REQUEST_ID);
+ }
+
+ @Test
+ public void getCamundaActivityHistoryTest() throws ContactCamundaException {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl = "http://localhost:8089/sobpmnengine/history/activity-instance?processInstanceId="
+ + "c4c6b647-a26e-11e9-b144-0242ac14000b";
+ doReturn(activityInstanceResponse).when(restTemplate).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+ ResponseEntity<List<HistoricActivityInstanceEntity>> actualResponse =
+ camundaRequestHandler.getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b", REQUEST_ID);
+ assertEquals(activityInstanceResponse, actualResponse);
+ }
+
+ @Test
+ public void getCamundaActivityHistoryErrorTest() {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl = "http://localhost:8089/sobpmnengine/history/activity-instance?processInstanceId="
+ + "c4c6b647-a26e-11e9-b144-0242ac14000b";
+ doThrow(new ResourceAccessException("IOException")).when(restTemplate).exchange(targetUrl, HttpMethod.GET,
+ requestEntity, new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ try {
+ camundaRequestHandler.getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b", REQUEST_ID);
+ } catch (ContactCamundaException e) {
+ // Exception thrown after retries are completed
+ }
+
+ verify(restTemplate, times(4)).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
+ }
+
+ @Test
+ public void getCamundaProccesInstanceHistoryTest() {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl =
+ "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
+ doReturn(processInstanceResponse).when(restTemplate).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ ResponseEntity<List<HistoricProcessInstanceEntity>> actualResponse =
+ camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID);
+ assertEquals(processInstanceResponse, actualResponse);
+ }
+
+ @Test
+ public void getCamundaProccesInstanceHistoryRetryTest() {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl =
+ "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
+ doThrow(new ResourceAccessException("I/O error")).when(restTemplate).exchange(targetUrl, HttpMethod.GET,
+ requestEntity, new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ try {
+ camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID);
+ } catch (ResourceAccessException e) {
+ // Exception thrown after retries are completed
+ }
+ verify(restTemplate, times(4)).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ }
+
+ @Test
+ public void getCamundaProccesInstanceHistoryNoRetryTest() {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl =
+ "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
+ doThrow(HttpClientErrorException.class).when(restTemplate).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ try {
+ camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID);
+ } catch (HttpStatusCodeException e) {
+ // Exception thrown, no retries
+ }
+ verify(restTemplate, times(1)).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ }
+
+ @Test
+ public void getCamundaProccesInstanceHistoryFailThenSuccessTest() {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl =
+ "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
+ when(restTemplate.exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {}))
+ .thenThrow(new ResourceAccessException("I/O Exception")).thenReturn(processInstanceResponse);
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ ResponseEntity<List<HistoricProcessInstanceEntity>> actualResponse =
+ camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID);
+ assertEquals(processInstanceResponse, actualResponse);
+ verify(restTemplate, times(2)).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ }
+
+ @Test
+ public void setCamundaHeadersTest() {
+ String encryptedAuth = "015E7ACF706C6BBF85F2079378BDD2896E226E09D13DC2784BA309E27D59AB9FAD3A5E039DF0BB8408"; // user:password
+ String key = "07a7159d3bf51a0e53be7a8f89699be7";
+
+ HttpHeaders headers = camundaRequestHandler.setCamundaHeaders(encryptedAuth, key);
+ List<org.springframework.http.MediaType> acceptedType = headers.getAccept();
+
+ String expectedAcceptedType = "application/json";
+ assertEquals(expectedAcceptedType, acceptedType.get(0).toString());
+ String basicAuth = headers.getFirst(HttpHeaders.AUTHORIZATION);
+ String expectedBasicAuth = "Basic dXNlcjpwYXNzd29yZA==";
+
+ assertEquals(expectedBasicAuth, basicAuth);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java
index 928b488f6a..0291cfd2ea 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java
@@ -20,70 +20,67 @@
package org.onap.so.apihandlerinfra;
-import static org.junit.Assert.assertArrayEquals;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyObject;
+import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-import org.springframework.test.util.ReflectionTestUtils;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
import org.json.JSONException;
-import org.junit.Rule;
import org.junit.Test;
-import org.mockito.InjectMocks;
+import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
-import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnit;
-import org.mockito.junit.MockitoRule;
+import org.onap.so.apihandlerinfra.HealthCheckConfig.Endpoint;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.mock.mockito.SpyBean;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.JsonProcessingException;
+@RunWith(SpringRunner.class)
+@ContextConfiguration(classes = {GenericStringConverter.class, HealthCheckConverter.class},
+ initializers = {ConfigFileApplicationContextInitializer.class})
+@ActiveProfiles("test")
+@EnableConfigurationProperties({HealthCheckConfig.class})
public class GlobalHealthcheckHandlerTest {
- @Mock
- RestTemplate restTemplate;
+ @MockBean
+ private RestTemplate restTemplate;
- @Mock
- ContainerRequestContext requestContext;
+ @MockBean
+ private ContainerRequestContext requestContext;
- @InjectMocks
- @Spy
- GlobalHealthcheckHandler globalhealth;
-
- @Rule
- public MockitoRule mockitoRule = MockitoJUnit.rule();
+ @SpyBean
+ private GlobalHealthcheckHandler globalhealth;
@Test
public void testQuerySubsystemHealthNullResult() {
ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage");
- ReflectionTestUtils.setField(globalhealth, "endpointBpmn", "http://localhost:8080");
Mockito.when(restTemplate.exchange(ArgumentMatchers.any(URI.class), ArgumentMatchers.any(HttpMethod.class),
ArgumentMatchers.<HttpEntity<?>>any(), ArgumentMatchers.<Class<Object>>any())).thenReturn(null);
- String result = globalhealth.querySubsystemHealth(MsoSubsystems.BPMN);
- System.out.println(result);
- assertEquals(HealthcheckStatus.DOWN.toString(), result);
+ HealthCheckSubsystem result = globalhealth
+ .querySubsystemHealth(new Endpoint(SoSubsystems.BPMN, UriBuilder.fromPath("http://localhost").build()));
+ assertEquals(HealthCheckStatus.DOWN, result.getStatus());
}
@Test
public void testQuerySubsystemHealthNotNullResult() {
ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage");
- ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080");
SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse();
subSystemResponse.setStatus("UP");
@@ -92,20 +89,13 @@ public class GlobalHealthcheckHandlerTest {
Mockito.when(restTemplate.exchange(ArgumentMatchers.any(URI.class), ArgumentMatchers.any(HttpMethod.class),
ArgumentMatchers.<HttpEntity<?>>any(), ArgumentMatchers.<Class<Object>>any())).thenReturn(r);
- String result = globalhealth.querySubsystemHealth(MsoSubsystems.ASDC);
- System.out.println(result);
- assertEquals(HealthcheckStatus.UP.toString(), result);
+ HealthCheckSubsystem result = globalhealth
+ .querySubsystemHealth(new Endpoint(SoSubsystems.ASDC, UriBuilder.fromPath("http://localhost").build()));
+ assertEquals(HealthCheckStatus.UP, result.getStatus());
}
private Response globalHealthcheck(String status) {
ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage");
- ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080");
- ReflectionTestUtils.setField(globalhealth, "endpointSdnc", "http://localhost:8081");
- ReflectionTestUtils.setField(globalhealth, "endpointBpmn", "http://localhost:8082");
- ReflectionTestUtils.setField(globalhealth, "endpointCatalogdb", "http://localhost:8083");
- ReflectionTestUtils.setField(globalhealth, "endpointOpenstack", "http://localhost:8084");
- ReflectionTestUtils.setField(globalhealth, "endpointRequestdb", "http://localhost:8085");
- ReflectionTestUtils.setField(globalhealth, "endpointRequestdbAttsvc", "http://localhost:8086");
SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse();
@@ -116,70 +106,41 @@ public class GlobalHealthcheckHandlerTest {
Mockito.when(requestContext.getProperty(anyString())).thenReturn("1234567890");
Response response = globalhealth.globalHealthcheck(true, requestContext);
-
return response;
}
@Test
- public void globalHealthcheckAllUPTest() throws JSONException {
- Response response = globalHealthcheck("UP");
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
- HealthcheckResponse root;
- root = (HealthcheckResponse) response.getEntity();
- String apistatus = root.getApih();
- assertTrue(apistatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String bpmnstatus = root.getBpmn();
- assertTrue(bpmnstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String sdncstatus = root.getSdncAdapter();
- assertTrue(sdncstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
+ public void globalHealthcheckAllUPTest() throws JSONException, JsonProcessingException {
- String asdcstatus = root.getAsdcController();
- assertTrue(asdcstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
+ HealthCheckResponse expected = new HealthCheckResponse();
- String catastatus = root.getCatalogdbAdapter();
- assertTrue(catastatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String reqdbstatus = root.getRequestdbAdapter();
- assertTrue(reqdbstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String openstatus = root.getOpenstackAdapter();
- assertTrue(openstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
+ for (Subsystem system : SoSubsystems.values()) {
+ expected.getSubsystems().add(new HealthCheckSubsystem(system,
+ UriBuilder.fromUri("http://localhost").build(), HealthCheckStatus.UP));
+ }
+ expected.setMessage("HttpStatus: 200");
+ Response response = globalHealthcheck("UP");
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ HealthCheckResponse root;
+ root = (HealthCheckResponse) response.getEntity();
+ assertThat(root, sameBeanAs(expected).ignoring("subsystems.uri").ignoring("subsystems.subsystem"));
- String reqdbattstatus = root.getRequestdbAdapterAttsvc();
- assertTrue(reqdbattstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
}
@Test
public void globalHealthcheckAllDOWNTest() throws JSONException {
+ HealthCheckResponse expected = new HealthCheckResponse();
+
+ for (Subsystem system : SoSubsystems.values()) {
+ expected.getSubsystems().add(new HealthCheckSubsystem(system,
+ UriBuilder.fromUri("http://localhost").build(), HealthCheckStatus.DOWN));
+ }
+ expected.setMessage("HttpStatus: 200");
Response response = globalHealthcheck("DOWN");
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
- HealthcheckResponse root;
- root = (HealthcheckResponse) response.getEntity();
- String apistatus = root.getApih();
- assertTrue(apistatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
-
- String bpmnstatus = root.getBpmn();
- assertTrue(bpmnstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String sdncstatus = root.getSdncAdapter();
- assertTrue(sdncstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String asdcstatus = root.getAsdcController();
- assertTrue(asdcstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String catastatus = root.getCatalogdbAdapter();
- assertTrue(catastatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String reqdbstatus = root.getRequestdbAdapter();
- assertTrue(reqdbstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String openstatus = root.getOpenstackAdapter();
- assertTrue(openstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
-
- String reqdbattstatus = root.getRequestdbAdapterAttsvc();
- assertTrue(reqdbattstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString()));
+ HealthCheckResponse root;
+ root = (HealthCheckResponse) response.getEntity();
+ assertThat(root, sameBeanAs(expected).ignoring("subsystems.uri").ignoring("subsystems.subsystem"));
}
@Test
@@ -189,40 +150,15 @@ public class GlobalHealthcheckHandlerTest {
assertEquals(MediaType.APPLICATION_JSON, he.getHeaders().getContentType());
}
- @Test
- public void getEndpointUrlForSubsystemEnumTest() {
- ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage");
- ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080");
- ReflectionTestUtils.setField(globalhealth, "endpointSdnc", "http://localhost:8081");
- ReflectionTestUtils.setField(globalhealth, "endpointBpmn", "http://localhost:8082");
- ReflectionTestUtils.setField(globalhealth, "endpointCatalogdb", "http://localhost:8083");
- ReflectionTestUtils.setField(globalhealth, "endpointOpenstack", "http://localhost:8084");
- ReflectionTestUtils.setField(globalhealth, "endpointRequestdb", "http://localhost:8085");
- ReflectionTestUtils.setField(globalhealth, "endpointRequestdbAttsvc", "http://localhost:8086");
-
- String result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.ASDC);
- assertEquals("http://localhost:8080", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.SDNC);
- assertEquals("http://localhost:8081", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.BPMN);
- assertEquals("http://localhost:8082", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.CATALOGDB);
- assertEquals("http://localhost:8083", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.OPENSTACK);
- assertEquals("http://localhost:8084", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.REQUESTDB);
- assertEquals("http://localhost:8085", result);
- result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.REQUESTDBATT);
- assertEquals("http://localhost:8086", result);
- }
@Test
public void processResponseFromSubsystemTest() {
SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse();
subSystemResponse.setStatus("UP");
ResponseEntity<SubsystemHealthcheckResponse> r = new ResponseEntity<>(subSystemResponse, HttpStatus.OK);
- String result = globalhealth.processResponseFromSubsystem(r, MsoSubsystems.BPMN);
- assertEquals("UP", result);
+ Endpoint endpoint = new Endpoint(SoSubsystems.BPMN, UriBuilder.fromUri("http://localhost").build());
+ HealthCheckStatus result = globalhealth.processResponseFromSubsystem(r, endpoint);
+ assertEquals(HealthCheckStatus.UP, result);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
index c30b9dedf2..86bf8060a7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
@@ -24,13 +24,11 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.io.StringReader;
-import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
-import java.util.Optional;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.xml.parsers.DocumentBuilder;
@@ -46,13 +44,13 @@ import org.onap.so.exceptions.ValidationException;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import junitparams.JUnitParamsRunner;
import junitparams.Parameters;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
@RunWith(JUnitParamsRunner.class)
public class MsoRequestTest extends BaseTest {
@@ -83,6 +81,12 @@ public class MsoRequestTest extends BaseTest {
return input;
}
+ public String inputStreamVpnBonding(String JsonInput) throws IOException {
+ JsonInput = "src/test/resources/Validation" + JsonInput;
+ String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
+ return input;
+ }
+
// Tests for successful validation of incoming JSON requests through the parse method
@Test
@Parameters(method = "successParameters")
@@ -188,6 +192,8 @@ public class MsoRequestTest extends BaseTest {
instanceIdMapTest, Action.addRelationships, "5"},
{mapper.readValue(inputStream("/SuccessfulValidation/ServiceAssign.json"),
ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, "7"},
+ {mapper.readValue(inputStream("/RelatedInstances/ServiceInstanceVpnBondingService.json"),
+ ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, "7"},
{mapper.readValue(inputStream("/SuccessfulValidation/ServiceUnassign.json"),
ServiceInstancesRequest.class), instanceIdMapTest, Action.unassignInstance, "7"}});
}
@@ -546,6 +552,22 @@ public class MsoRequestTest extends BaseTest {
mapper.readValue(inputStream("/RelatedInstances/v6AddRelationshipsInstanceName.json"),
ServiceInstancesRequest.class),
instanceIdMapTest, Action.addRelationships, 6},
+ {"No valid modelType in relatedInstance is specified",
+ mapper.readValue(inputStreamVpnBonding("/VpnBondingValidation/NoModelType.json"),
+ ServiceInstancesRequest.class),
+ instanceIdMapTest, Action.createInstance, 7},
+ {"No valid instanceId in relatedInstance is specified",
+ mapper.readValue(inputStreamVpnBonding("/VpnBondingValidation/NoInstanceId.json"),
+ ServiceInstancesRequest.class),
+ instanceIdMapTest, Action.createInstance, 7},
+ {"No valid instanceName in relatedInstance for vpnBinding modelType is specified",
+ mapper.readValue(inputStreamVpnBonding("/VpnBondingValidation/NoInstanceNameVpnBinding.json"),
+ ServiceInstancesRequest.class),
+ instanceIdMapTest, Action.createInstance, 7},
+ {"No valid instanceName in relatedInstance for network modelType is specified",
+ mapper.readValue(inputStreamVpnBonding("/VpnBondingValidation/NoInstanceNameNetwork.json"),
+ ServiceInstancesRequest.class),
+ instanceIdMapTest, Action.createInstance, 7},
{"No valid modelCustomizationName or modelCustomizationId in relatedInstance of vnf is specified",
mapper.readValue(inputStream("/RelatedInstances/RelatedInstancesModelCustomizationId.json"),
ServiceInstancesRequest.class),
@@ -1038,20 +1060,5 @@ public class MsoRequestTest extends BaseTest {
assertNotNull(result);
}
- @Test
- public void buildSelfLinkUrlTest() throws Exception {
- // v - version
- String incomingUrl = "http://localhost:8080/onap/infra/so/serviceInstantiation/v7/serviceInstances";
- String expectedSelfLink = "http://localhost:8080/orchestrationRequests/v7/efce3167-5e45-4666-9d4d-22e23648e5d1";
- String requestId = "efce3167-5e45-4666-9d4d-22e23648e5d1";
- this.msoRequest = new MsoRequest();
- Optional<URL> actualSelfLinkUrl = msoRequest.buildSelfLinkUrl(incomingUrl, requestId);
- assertEquals(expectedSelfLink, actualSelfLinkUrl.get().toString());
- // V - Version
- String incomingUrlV = "http://localhost:8080/onap/infra/so/serviceInstantiation/V7/serviceInstances";
- String expectedSelfLinkV =
- "http://localhost:8080/orchestrationRequests/V7/efce3167-5e45-4666-9d4d-22e23648e5d1";
- Optional<URL> actualSelfLinkUrlV = msoRequest.buildSelfLinkUrl(incomingUrlV, requestId);
- assertEquals(expectedSelfLinkV, actualSelfLinkUrlV.get().toString());
- }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
index 321ea3ac7d..12f0ffcc11 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
@@ -26,6 +26,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -42,12 +43,13 @@ import java.util.Map;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
-import org.junit.Ignore;
+import org.junit.Before;
import org.junit.Test;
import org.onap.so.apihandler.common.ErrorNumbers;
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.serviceinstancebeans.CloudRequestData;
import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
import org.onap.so.serviceinstancebeans.Request;
@@ -92,6 +94,21 @@ public class OrchestrationRequestsTest extends BaseTest {
return list;
}
+ @Before
+ public void setup() throws IOException {
+ wireMockServer.stubFor(get(urlMatching("/sobpmnengine/history/process-instance.*")).willReturn(aResponse()
+ .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(
+ Paths.get("src/test/resources/OrchestrationRequest/ProcessInstanceHistoryResponse.json"))))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(
+ get(("/sobpmnengine/history/activity-instance?processInstanceId=c4c6b647-a26e-11e9-b144-0242ac14000b"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(Paths.get(
+ "src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json"))))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
@Test
public void testGetOrchestrationRequest() throws Exception {
setupTestGetOrchestrationRequest();
@@ -119,7 +136,7 @@ public class OrchestrationRequestsTest extends BaseTest {
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- assertEquals("00032ab7-na18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
+ assertEquals("00032ab7-1a18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
assertNotNull(response.getBody().getRequest().getFinishTime());
}
@@ -149,12 +166,22 @@ public class OrchestrationRequestsTest extends BaseTest {
}
@Test
- public void testGetOrchestrationRequestRequestDetails() throws Exception {
- setupTestGetOrchestrationRequestRequestDetails("00032ab7-3fb3-42e5-965d-8ea592502017", "COMPLETED");
+ public void testGetOrchestrationRequestWithOpenstackDetails() throws Exception {
+ setupTestGetOrchestrationRequestOpenstackDetails("00032ab7-3fb3-42e5-965d-8ea592502017", "COMPLETED");
// Test request with modelInfo request body
GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
Request request = ORCHESTRATION_LIST.getRequestList().get(0).getRequest();
+ List<CloudRequestData> cloudRequestData = new ArrayList<>();
+ CloudRequestData cloudData = new CloudRequestData();
+ cloudData.setCloudIdentifier("heatstackName/123123");
+ ObjectMapper mapper = new ObjectMapper();
+ Object reqData = mapper.readValue(
+ "{\r\n \"test\": \"00032ab7-3fb3-42e5-965d-8ea592502016\",\r\n \"test2\": \"deleteInstance\",\r\n \"test3\": \"COMPLETE\",\r\n \"test4\": \"Vf Module has been deleted successfully.\",\r\n \"test5\": 100\r\n}",
+ Object.class);
+ cloudData.setCloudRequest(reqData);
+ cloudRequestData.add(cloudData);
+ request.setCloudRequestData(cloudRequestData);
testResponse.setRequest(request);
String testRequestId = request.getRequestId();
@@ -163,13 +190,14 @@ public class OrchestrationRequestsTest extends BaseTest {
headers.set("Content-Type", MediaType.APPLICATION_JSON);
HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
- UriComponentsBuilder builder = UriComponentsBuilder
- .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(
+ "/onap/so/infra/orchestrationRequests/v7/" + testRequestId + "?includeCloudRequest=true"));
ResponseEntity<GetOrchestrationResponse> response =
restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
-
+ System.out.println("Response :" + response.getBody().toString());
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime")
.ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp"));
assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
@@ -194,6 +222,29 @@ public class OrchestrationRequestsTest extends BaseTest {
}
@Test
+ public void testGetOrchestrationRequestInvalidRequestID() throws Exception {
+ setupTestGetOrchestrationRequest();
+ // TEST INVALID REQUESTID
+ GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
+
+ Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
+ testResponse.setRequest(request);
+ String testRequestId = "00032ab7-pfb3-42e5-965d-8ea592502016";
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
+
+ ResponseEntity<GetOrchestrationResponse> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
+
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
+ }
+
+ @Test
public void testGetOrchestrationRequestFilter() throws Exception {
setupTestGetOrchestrationRequestFilter();
List<String> values = new ArrayList<>();
@@ -319,75 +370,11 @@ public class OrchestrationRequestsTest extends BaseTest {
"/onap/so/infra/orchestrationRequests/v7/" + "5ffbabd6-b793-4377-a1ab-082670fbc7ac" + "/unlock"));
response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
- // Cannot assert anything further here, already have a wiremock in place which ensures that the post was
+ // Cannot assert anything further here, already have a wiremock in place
+ // which ensures that the post was
// properly called to update.
}
- @Ignore // What is this testing?
- @Test
- public void testGetOrchestrationRequestRequestDetailsWhiteSpace() throws Exception {
- InfraActiveRequests requests = new InfraActiveRequests();
- requests.setAction("create");
- requests.setRequestBody(" ");
- requests.setRequestId("requestId");
- requests.setRequestScope("service");
- requests.setRequestType("createInstance");
- ObjectMapper mapper = new ObjectMapper();
- String json = mapper.writeValueAsString(requests);
-
- requestsDbClient.save(requests);
- HttpHeaders headers = new HttpHeaders();
- headers.set("Accept", MediaType.APPLICATION_JSON);
- headers.set("Content-Type", MediaType.APPLICATION_JSON);
- HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
-
- UriComponentsBuilder builder = UriComponentsBuilder
- .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/requestId"));
-
- ResponseEntity<GetOrchestrationResponse> response =
- restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
- assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
- assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
- assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- assertEquals("requestId", response.getHeaders().get("X-TransactionID").get(0));
- }
-
- @Ignore // What is this testing?
- @Test
- public void testGetOrchestrationRequestRequestDetailsAlaCarte() throws IOException {
- InfraActiveRequests requests = new InfraActiveRequests();
-
- String requestJSON = new String(
- Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/AlaCarteRequest.json")));
-
- requests.setAction("create");
- requests.setRequestBody(requestJSON);
- requests.setRequestId("requestId");
- requests.setRequestScope("service");
- requests.setRequestType("createInstance");
- // iar.save(requests);
- HttpHeaders headers = new HttpHeaders();
- headers.set("Accept", MediaType.APPLICATION_JSON);
- headers.set("Content-Type", MediaType.APPLICATION_JSON);
- HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
-
- UriComponentsBuilder builder = UriComponentsBuilder
- .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/requestId"));
-
- ResponseEntity<GetOrchestrationResponse> response =
- restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
- assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
- assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
- assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- assertEquals("requestId", response.getHeaders().get("X-TransactionID").get(0));
- }
-
@Test
public void mapRequestProcessingDataTest() throws JsonParseException, JsonMappingException, IOException {
RequestProcessingData entry = new RequestProcessingData();
@@ -423,14 +410,14 @@ public class OrchestrationRequestsTest extends BaseTest {
public void setupTestGetOrchestrationRequest() throws Exception {
// For testGetOrchestrationRequest
- wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018"))
+ wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-1a18-42e5-965d-8ea592502018"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(new String(Files.readAllBytes(
Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequest.json"))))
.withStatus(HttpStatus.SC_OK)));
wireMockServer
.stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
- .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
+ .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-1a18-42e5-965d-8ea592502018"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(new String(Files.readAllBytes(Paths
.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
@@ -439,14 +426,14 @@ public class OrchestrationRequestsTest extends BaseTest {
public void setupTestGetOrchestrationRequestInstanceGroup() throws Exception {
// For testGetOrchestrationRequest
- wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018"))
+ wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-1a18-42e5-965d-8ea592502018"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(new String(Files.readAllBytes(Paths.get(
"src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json"))))
.withStatus(HttpStatus.SC_OK)));
wireMockServer
.stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
- .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
+ .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-1a18-42e5-965d-8ea592502018"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(new String(Files.readAllBytes(Paths
.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
@@ -461,15 +448,20 @@ public class OrchestrationRequestsTest extends BaseTest {
.withStatus(HttpStatus.SC_OK)));
}
+ private void setupTestGetOrchestrationRequestOpenstackDetails(String requestId, String status) throws Exception {
+ wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse()
+ .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(Paths
+ .get("src/test/resources/OrchestrationRequest/getOrchestrationOpenstackRequestDetails.json"))))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
private void setupTestUnlockOrchestrationRequest(String requestId, String status) {
wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(requestId)))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(String.format(getResponseTemplate, requestId, status)).withStatus(HttpStatus.SC_OK)));
-
}
-
-
private void setupTestUnlockOrchestrationRequest_invalid_Json() {
wireMockServer.stubFor(get(urlPathEqualTo(getTestUrl(INVALID_REQUEST_ID))).willReturn(aResponse()
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_NOT_FOUND)));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
new file mode 100644
index 0000000000..627bbc631d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
@@ -0,0 +1,330 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import javax.ws.rs.core.Response;
+import org.apache.commons.lang.StringUtils;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.constants.OrchestrationRequestFormat;
+import org.onap.so.constants.Status;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.InstanceReferences;
+import org.onap.so.serviceinstancebeans.Request;
+import org.onap.so.serviceinstancebeans.RequestStatus;
+
+@RunWith(MockitoJUnitRunner.class)
+public class OrchestrationRequestsUnitTest {
+ @Mock
+ private RequestsDbClient requestDbClient;
+ @Mock
+ private MsoRequest msoRequest;
+ @Mock
+ private ResponseBuilder builder;
+ @Mock
+ private Response response;
+ @Mock
+ private CamundaRequestHandler camundaRequestHandler;
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+ @InjectMocks
+ private OrchestrationRequests orchestrationRequests;
+
+ private static final String REQUEST_ID = "7cb9aa56-dd31-41e5-828e-d93027d4ebba";
+ private static final String SERVICE_INSTANCE_ID = "7cb9aa56-dd31-41e5-828e-d93027d4ebbb";
+ private static final String ORIGINAL_REQUEST_ID = "8f2d38a6-7c20-465a-bd7e-075645f1394b";
+ private static final String SERVICE = "service";
+ private static final String EXT_SYSTEM_ERROR_SOURCE = "external system error source";
+ private static final String FLOW_STATUS = "FlowStatus";
+ private static final String RETRY_STATUS_MESSAGE = "RetryStatusMessage";
+ private static final String ROLLBACK_STATUS_MESSAGE = "RollbackStatusMessage";
+ private static final String TASK_INFORMATION = " TASK INFORMATION: Last task executed: Call SDNC";
+ private InfraActiveRequests iar;
+ boolean includeCloudRequest = false;
+ private static final String ROLLBACK_EXT_SYSTEM_ERROR_SOURCE = "SDNC";
+
+
+ @Before
+ public void setup() {
+ iar = new InfraActiveRequests();
+ iar.setRequestScope(SERVICE);
+ iar.setRequestId(REQUEST_ID);
+ iar.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ iar.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
+ iar.setRollbackExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
+ iar.setFlowStatus(FLOW_STATUS);
+ iar.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
+ iar.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
+ }
+
+ @Test
+ public void mapInfraActiveRequestToRequestWithOriginalRequestIdTest() throws ApiException {
+ doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
+ FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setOriginalRequestId(ORIGINAL_REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ iar.setOriginalRequestId(ORIGINAL_REQUEST_ID);
+
+ Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+ assertThat(result, sameBeanAs(expected));
+ }
+
+ @Test
+ public void mapInfraActiveRequestToRequestOriginalRequestIdNullTest() throws ApiException {
+ doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
+ FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+ assertThat(result, sameBeanAs(expected));
+ }
+
+ @Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestFalseTest() throws ApiException {
+ doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
+ FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ includeCloudRequest = false;
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestStatusDetailTest() throws ApiException {
+ doReturn(null).when(camundaRequestHandler).getTaskName(REQUEST_ID);
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
+ requestStatus.setRollbackExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setFlowStatus(FLOW_STATUS);
+ requestStatus.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
+ requestStatus.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ includeCloudRequest = false;
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.STATUSDETAIL.toString());
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestDetailTest() throws ApiException {
+ doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
+ FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ includeCloudRequest = false;
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestNoFlowStatusTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(
+ String.format("RETRY STATUS: %s ROLLBACK STATUS: %s", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ includeCloudRequest = false;
+ iar.setFlowStatus(null);
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestErrorMessageTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ iar.setExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
+ iar.setFlowStatus(null);
+ iar.setStatusMessage("Error retrieving cloud region from AAI");
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+
+ assertTrue(actual.getRequestStatus().getStatusMessage()
+ .contains("Error Source: " + ROLLBACK_EXT_SYSTEM_ERROR_SOURCE));
+ }
+
+ @Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestFlowStatusSuccessfulCompletionTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
+ "Successfully completed all Building Blocks", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ includeCloudRequest = false;
+ iar.setFlowStatus("Successfully completed all Building Blocks");
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestFlowStatusSuccessfulRollbackTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
+ "All Rollback flows have completed successfully", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ includeCloudRequest = false;
+ iar.setFlowStatus("All Rollback flows have completed successfully");
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void requestStatusExtSystemErrorSourceTest() {
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
+ assertThat(requestStatus.getExtSystemErrorSource(), is(equalTo(EXT_SYSTEM_ERROR_SOURCE)));
+ }
+
+ @Test
+ public void mapRequestStatusToRequestForFormatDetailTest() throws ApiException {
+ iar.setRequestStatus(Status.ABORTED.toString());
+ String result =
+ orchestrationRequests.mapRequestStatusToRequest(iar, OrchestrationRequestFormat.DETAIL.toString());
+
+ assertEquals(Status.ABORTED.toString(), result);
+ }
+
+ @Test
+ public void mapRequestStatusToRequestForFormatStatusDetailTest() throws ApiException {
+ iar.setRequestStatus(Status.ABORTED.toString());
+ String result = orchestrationRequests.mapRequestStatusToRequest(iar, "statusDetail");
+
+ assertEquals(Status.ABORTED.toString(), result);
+ }
+
+
+ @Test
+ public void mapRequestStatusToRequestForFormatEmptyStringTest() throws ApiException {
+ iar.setRequestStatus(Status.ABORTED.toString());
+ String result = orchestrationRequests.mapRequestStatusToRequest(iar, StringUtils.EMPTY);
+
+ assertEquals(Status.FAILED.toString(), result);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
index dc0cd473c2..e4532cd8d7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
@@ -27,6 +27,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
@@ -38,7 +39,6 @@ import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
-import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.MediaType;
import org.apache.http.HttpStatus;
import org.junit.Before;
@@ -50,6 +50,7 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestInfo;
import org.onap.so.serviceinstancebeans.RequestParameters;
@@ -76,6 +77,9 @@ public class RequestHandlerUtilsTest extends BaseTest {
@Autowired
private RequestHandlerUtils requestHandlerUtils;
+ @Autowired
+ private CamundaRequestHandler camundaRequestHandler;
+
@Value("${wiremock.server.port}")
private String wiremockPort;
@@ -147,6 +151,18 @@ public class RequestHandlerUtilsTest extends BaseTest {
}
+ @Test
+ public void test_mapJSONtoMSOStyleCustomWorkflowRequest() throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ String testRequest = inputStream("/CustomWorkflowRequest.json");
+ String resultString =
+ requestHandlerUtils.mapJSONtoMSOStyle(testRequest, null, true, Action.inPlaceSoftwareUpdate);
+ ServiceInstancesRequest sir = mapper.readValue(resultString, ServiceInstancesRequest.class);
+ assertEquals(sir.getRequestDetails().getCloudConfiguration().getTenantId(), "88a6ca3ee0394ade9403f075db23167e");
+ assertNotEquals(sir.getRequestDetails().getRequestParameters().getUserParams().size(), 0);
+ }
+
@Test
public void test_mapJSONtoMSOStyleUsePreload() throws IOException {
@@ -327,7 +343,7 @@ public class RequestHandlerUtilsTest extends BaseTest {
public void setCamundaHeadersTest() throws ContactCamundaException, RequestDbFailureException {
String encryptedAuth = "015E7ACF706C6BBF85F2079378BDD2896E226E09D13DC2784BA309E27D59AB9FAD3A5E039DF0BB8408"; // user:password
String key = "07a7159d3bf51a0e53be7a8f89699be7";
- HttpHeaders headers = requestHandlerUtils.setCamundaHeaders(encryptedAuth, key);
+ HttpHeaders headers = camundaRequestHandler.setCamundaHeaders(encryptedAuth, key);
List<org.springframework.http.MediaType> acceptedType = headers.getAccept();
String expectedAcceptedType = "application/json";
assertEquals(expectedAcceptedType, acceptedType.get(0).toString());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
new file mode 100644
index 0000000000..d4b0c3aad1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
@@ -0,0 +1,444 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.sql.Timestamp;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RequestHandlerUtilsUnitTest {
+
+ @Mock
+ private CatalogDbClient catDbClient;
+
+ @InjectMocks
+ @Spy
+ private RequestHandlerUtils requestHandler;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private static final String CURRENT_REQUEST_ID = "eca3a1b1-43ab-457e-ab1c-367263d148b4";
+ private static final String RESUMED_REQUEST_ID = "59c7247f-839f-4923-90c3-05faa3ab354d";
+ private static final String SERVICE_INSTANCE_ID = "00032ab7-na18-42e5-965d-8ea592502018";
+ private static final String SERVICE_INSTANCE_NAME = "serviceInstanceName";
+ private static final String VNF_ID = "00032ab7-na18-42e5-965d-8ea592502017";
+ private static final String VFMODULE_ID = "00032ab7-na18-42e5-965d-8ea592502016";
+ private static final String NETWORK_ID = "00032ab7-na18-42e5-965d-8ea592502015";
+ private static final String VOLUME_GROUP_ID = "00032ab7-na18-42e5-965d-8ea592502014";
+ private static final String VNF_NAME = "vnfName";
+ private static final String VFMODULE_NAME = "vfModuleName";
+ private static final String NETWORK_NAME = "networkName";
+ private static final String VOLUME_GROUP_NAME = "volumeGroupName";
+ private static final String MODEL_VERSION_ID = "883f4a7a-b5a5-44e0-8738-361c6413d24c";
+ private static final String MODEL_VERSION = "1.0";
+ private static final String MODEL_INVARIANT_ID = "d358b828-e7f8-4833-ac96-2782bed1a9a9";
+ private static final String MODEL_NAME = "modelName";
+ private final Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ private String requestUri =
+ "http:localhost:6746/onap/so/infra/orchestrationRequests/v7/00032ab7-na18-42e5-965d-8ea592502019/resume";
+ private InfraActiveRequests infraActiveRequest = new InfraActiveRequests();
+ private InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+ private InfraActiveRequests currentActiveRequestIARNull = new InfraActiveRequests();
+ private Action action = Action.createInstance;
+ private String vnfType = "vnfType";
+ private String sdcServiceModelVersion = "7";
+
+ public String getRequestBody(String request) throws IOException {
+ request = "src/test/resources/ResumeOrchestrationRequest" + request;
+ return new String(Files.readAllBytes(Paths.get(request)));
+ }
+
+ @Before
+ public void setup() throws IOException {
+ setInfraActiveRequest();
+ setCurrentActiveRequest();
+ setCurrentActiveRequestNullInfraActive();
+ }
+
+ private void setInfraActiveRequest() throws IOException {
+ infraActiveRequest.setTenantId("tenant-id");
+ infraActiveRequest.setRequestBody(getRequestBody("/RequestBody.json"));
+ infraActiveRequest.setAicCloudRegion("cloudRegion");
+ infraActiveRequest.setRequestScope("service");
+ infraActiveRequest.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ infraActiveRequest.setServiceInstanceName(SERVICE_INSTANCE_NAME);
+ infraActiveRequest.setRequestStatus(Status.IN_PROGRESS.toString());
+ infraActiveRequest.setRequestAction(Action.createInstance.toString());
+ infraActiveRequest.setServiceType("serviceType");
+ }
+
+ private void setCurrentActiveRequest() throws IOException {
+ currentActiveRequest.setRequestId(CURRENT_REQUEST_ID);
+ currentActiveRequest.setSource("VID");
+ currentActiveRequest.setStartTime(startTimeStamp);
+ currentActiveRequest.setTenantId("tenant-id");
+ currentActiveRequest.setRequestBody(getRequestBody("/RequestBodyNewRequestorId.json"));
+ currentActiveRequest.setAicCloudRegion("cloudRegion");
+ currentActiveRequest.setRequestScope("service");
+ currentActiveRequest.setRequestStatus(Status.IN_PROGRESS.toString());
+ currentActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ currentActiveRequest.setRequestAction(Action.createInstance.toString());
+ currentActiveRequest.setRequestUrl(requestUri);
+ currentActiveRequest.setRequestorId("yyyyyy");
+ currentActiveRequest.setProgress(new Long(5));
+ currentActiveRequest.setOriginalRequestId(RESUMED_REQUEST_ID);
+ }
+
+ private void setCurrentActiveRequestNullInfraActive() throws IOException {
+ currentActiveRequestIARNull.setRequestId(CURRENT_REQUEST_ID);
+ currentActiveRequestIARNull.setSource("VID");
+ currentActiveRequestIARNull.setStartTime(startTimeStamp);
+ currentActiveRequestIARNull.setRequestStatus(Status.IN_PROGRESS.toString());
+ currentActiveRequestIARNull.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ currentActiveRequestIARNull.setRequestUrl(requestUri);
+ currentActiveRequestIARNull.setRequestorId("xxxxxx");
+ currentActiveRequestIARNull.setProgress(new Long(5));
+ currentActiveRequestIARNull.setOriginalRequestId(RESUMED_REQUEST_ID);
+ }
+
+
+ @Test
+ public void createNewRecordCopyFromInfraActiveRequestTest() throws IOException, ApiException {
+ doNothing().when(requestHandler).setInstanceIdAndName(infraActiveRequest, currentActiveRequest);
+ doReturn(getRequestBody("/RequestBodyNewRequestorId.json")).when(requestHandler)
+ .updateRequestorIdInRequestBody(infraActiveRequest, "yyyyyy");
+ InfraActiveRequests result = requestHandler.createNewRecordCopyFromInfraActiveRequest(infraActiveRequest,
+ CURRENT_REQUEST_ID, startTimeStamp, "VID", requestUri, "yyyyyy", RESUMED_REQUEST_ID);
+ assertThat(currentActiveRequest, sameBeanAs(result));
+ }
+
+ @Test
+ public void createNewRecordCopyFromInfraActiveRequestNullIARTest() throws ApiException {
+ InfraActiveRequests result = requestHandler.createNewRecordCopyFromInfraActiveRequest(null, CURRENT_REQUEST_ID,
+ startTimeStamp, "VID", requestUri, "xxxxxx", RESUMED_REQUEST_ID);
+ assertThat(currentActiveRequestIARNull, sameBeanAs(result));
+ }
+
+ @Test
+ public void setInstanceIdAndNameServiceTest() throws ApiException {
+ InfraActiveRequests serviceRequest = new InfraActiveRequests();
+
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ expected.setServiceInstanceName(SERVICE_INSTANCE_NAME);
+
+ requestHandler.setInstanceIdAndName(infraActiveRequest, serviceRequest);
+ assertThat(serviceRequest, sameBeanAs(expected));
+ }
+
+ @Test
+ public void setInstanceIdAndNameServiceNullInstanceNameTest() throws ApiException {
+ InfraActiveRequests serviceRequest = new InfraActiveRequests();
+
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ request.setRequestScope(ModelType.service.toString());
+
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setServiceInstanceId(SERVICE_INSTANCE_ID);
+
+ requestHandler.setInstanceIdAndName(request, serviceRequest);
+ assertThat(serviceRequest, sameBeanAs(expected));
+ }
+
+ @Test
+ public void setInstanceIdAndNameServiceNullInstanceNameVfModuleTest() throws ApiException {
+ InfraActiveRequests vfModuleRequest = new InfraActiveRequests();
+ String errorMessage =
+ "vfModule for requestId: 59c7247f-839f-4923-90c3-05faa3ab354d being resumed does not have an instanceName.";
+ doNothing().when(requestHandler).updateStatus(vfModuleRequest, Status.FAILED, errorMessage);
+
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setServiceInstanceId(VFMODULE_ID);
+ request.setRequestScope(ModelType.vfModule.toString());
+ request.setRequestId(RESUMED_REQUEST_ID);
+
+ thrown.expect(ValidateException.class);
+ thrown.expectMessage(errorMessage);
+
+ requestHandler.setInstanceIdAndName(request, vfModuleRequest);
+ }
+
+ @Test
+ public void setInstanceIdAndNameRequestScopeNotValidTest() throws ApiException {
+ InfraActiveRequests originalServiceRequest = new InfraActiveRequests();
+ originalServiceRequest.setRequestScope("test");
+ InfraActiveRequests serviceRequest = new InfraActiveRequests();
+
+ InfraActiveRequests expected = new InfraActiveRequests();
+
+ requestHandler.setInstanceIdAndName(originalServiceRequest, serviceRequest);
+ assertThat(serviceRequest, sameBeanAs(expected));
+ }
+
+ @Test
+ public void setInstanceIdAndNameVnfTest() throws ApiException {
+ InfraActiveRequests vnfRequestOriginal = new InfraActiveRequests();
+ vnfRequestOriginal.setRequestScope("vnf");
+ vnfRequestOriginal.setVnfId(VNF_ID);
+ vnfRequestOriginal.setVnfName(VNF_NAME);
+ InfraActiveRequests vnfRequest = new InfraActiveRequests();
+
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setVnfId(VNF_ID);
+ expected.setVnfName(VNF_NAME);
+
+ requestHandler.setInstanceIdAndName(vnfRequestOriginal, vnfRequest);
+ assertThat(vnfRequest, sameBeanAs(expected));
+ }
+
+ @Test
+ public void setInstanceIdAndNameVfModuleTest() throws ApiException {
+ InfraActiveRequests vfModuleRequestOriginal = new InfraActiveRequests();
+ vfModuleRequestOriginal.setRequestScope("vfModule");
+ vfModuleRequestOriginal.setVfModuleId(VFMODULE_ID);
+ vfModuleRequestOriginal.setVfModuleName(VFMODULE_NAME);
+ InfraActiveRequests vfModuleRequest = new InfraActiveRequests();
+
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setVfModuleId(VFMODULE_ID);
+ expected.setVfModuleName(VFMODULE_NAME);
+
+ requestHandler.setInstanceIdAndName(vfModuleRequestOriginal, vfModuleRequest);
+ assertThat(vfModuleRequest, sameBeanAs(expected));
+ }
+
+ @Test
+ public void setInstanceIdAndNameNetworkTest() throws ApiException {
+ InfraActiveRequests networkRequestOriginal = new InfraActiveRequests();
+ networkRequestOriginal.setRequestScope("network");
+ networkRequestOriginal.setNetworkId(NETWORK_ID);
+ networkRequestOriginal.setNetworkName(NETWORK_NAME);
+ InfraActiveRequests networkRequest = new InfraActiveRequests();
+
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setNetworkId(NETWORK_ID);
+ expected.setNetworkName(NETWORK_NAME);
+
+ requestHandler.setInstanceIdAndName(networkRequestOriginal, networkRequest);
+ assertThat(networkRequest, sameBeanAs(expected));
+ }
+
+ @Test
+ public void setInstanceIdAndNameVolumeGroupTest() throws ApiException {
+ InfraActiveRequests volumeGroupRequestOriginal = new InfraActiveRequests();
+ volumeGroupRequestOriginal.setRequestScope("volumeGroup");
+ volumeGroupRequestOriginal.setVolumeGroupId(VOLUME_GROUP_ID);
+ volumeGroupRequestOriginal.setVolumeGroupName(VOLUME_GROUP_NAME);
+ InfraActiveRequests volumeGroupRequest = new InfraActiveRequests();
+
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setVolumeGroupId(VOLUME_GROUP_ID);
+ expected.setVolumeGroupName(VOLUME_GROUP_NAME);
+
+ requestHandler.setInstanceIdAndName(volumeGroupRequestOriginal, volumeGroupRequest);
+ assertThat(volumeGroupRequest, sameBeanAs(expected));
+ }
+
+ @Test
+ public void getIsBaseVfModuleTrueTest() throws ApiException {
+ VfModule vfModule = new VfModule();
+ vfModule.setIsBase(true);
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelVersionId(MODEL_VERSION_ID);
+
+ doReturn(vfModule).when(catDbClient).getVfModuleByModelUUID(MODEL_VERSION_ID);
+ Boolean expected = true;
+
+ Boolean result = requestHandler.getIsBaseVfModule(modelInfo, action, vnfType, sdcServiceModelVersion,
+ currentActiveRequest);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void getIsBaseVfModuleFalseTest() throws ApiException {
+ VfModule vfModule = new VfModule();
+ vfModule.setIsBase(false);
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelVersionId(MODEL_VERSION_ID);
+
+ doReturn(vfModule).when(catDbClient).getVfModuleByModelUUID(MODEL_VERSION_ID);
+ Boolean expected = false;
+
+ Boolean result = requestHandler.getIsBaseVfModule(modelInfo, action, vnfType, sdcServiceModelVersion,
+ currentActiveRequest);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void getIsBaseVfModuleNullTest() throws ApiException {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelVersionId(MODEL_VERSION_ID);
+ modelInfo.setModelName(MODEL_NAME);
+ String errorMessage =
+ "VnfType vnfType and VF Module Model Name modelName with version 7 not found in MSO Catalog DB";
+
+ doNothing().when(requestHandler).updateStatus(currentActiveRequest, Status.FAILED, errorMessage);
+ doReturn(null).when(catDbClient).getVfModuleByModelUUID(MODEL_VERSION_ID);
+
+ thrown.expect(VfModuleNotFoundException.class);
+ thrown.expectMessage(errorMessage);
+ requestHandler.getIsBaseVfModule(modelInfo, action, vnfType, sdcServiceModelVersion, currentActiveRequest);
+ }
+
+ @Test
+ public void getIsBaseVfModuleModelVersionIdNullTest() throws ApiException {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelInvariantId(MODEL_INVARIANT_ID);
+ modelInfo.setModelVersion(MODEL_VERSION);
+ modelInfo.setModelName(MODEL_NAME);
+ Boolean expected = false;
+
+ doReturn(null).when(catDbClient).getVfModuleByModelInvariantUUIDAndModelVersion(MODEL_INVARIANT_ID,
+ MODEL_VERSION);
+
+ Boolean result = requestHandler.getIsBaseVfModule(modelInfo, Action.deleteInstance, vnfType,
+ sdcServiceModelVersion, currentActiveRequest);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void getIsBaseVfModuleModelInfoNotSetTest() throws ApiException {
+ ModelInfo modelInfo = new ModelInfo();
+ Boolean expected = false;
+
+ Boolean result = requestHandler.getIsBaseVfModule(modelInfo, Action.deleteInstance, vnfType,
+ sdcServiceModelVersion, currentActiveRequest);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void getIsBaseVfModuleModelVersionNullTest() throws ApiException {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelInvariantId(MODEL_INVARIANT_ID);
+ modelInfo.setModelName(MODEL_NAME);
+ Boolean expected = false;
+
+ Boolean result = requestHandler.getIsBaseVfModule(modelInfo, Action.deleteInstance, vnfType,
+ sdcServiceModelVersion, currentActiveRequest);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void getIsBaseVfModuleModelVersionNullUpdateTest() throws ApiException {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelInvariantId(MODEL_INVARIANT_ID);
+ modelInfo.setModelName(MODEL_NAME);
+ String errorMessage = "VnfType vnfType and VF Module Model Name modelName not found in MSO Catalog DB";
+
+ doNothing().when(requestHandler).updateStatus(currentActiveRequest, Status.FAILED, errorMessage);
+
+ thrown.expect(VfModuleNotFoundException.class);
+ thrown.expectMessage(errorMessage);
+ requestHandler.getIsBaseVfModule(modelInfo, Action.updateInstance, vnfType, null, currentActiveRequest);
+ }
+
+ @Test
+ public void getIsBaseVfModulesdcModelVersionEmptyTest() throws ApiException {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelInvariantId(MODEL_INVARIANT_ID);
+ modelInfo.setModelName(MODEL_NAME);
+ String errorMessage = "VnfType vnfType and VF Module Model Name modelName not found in MSO Catalog DB";
+
+ doNothing().when(requestHandler).updateStatus(currentActiveRequest, Status.FAILED, errorMessage);
+
+ thrown.expect(VfModuleNotFoundException.class);
+ thrown.expectMessage(errorMessage);
+ requestHandler.getIsBaseVfModule(modelInfo, Action.updateInstance, vnfType, "", currentActiveRequest);
+ }
+
+ @Test
+ public void getModelTypeApplyUpdatedConfigTest() throws ApiException {
+ ModelType modelTypeExpected = ModelType.vnf;
+
+ ModelType modelTypeResult = requestHandler.getModelType(Action.applyUpdatedConfig, null);
+ assertEquals(modelTypeResult, modelTypeExpected);
+ }
+
+ @Test
+ public void getModelTypeInPlaceSoftwareUpdateTest() throws ApiException {
+ ModelType modelTypeExpected = ModelType.vnf;
+
+ ModelType modelTypeResult = requestHandler.getModelType(Action.inPlaceSoftwareUpdate, null);
+ assertEquals(modelTypeResult, modelTypeExpected);
+ }
+
+ @Test
+ public void getModelTypeAddMembersTest() throws ApiException {
+ ModelType modelTypeExpected = ModelType.instanceGroup;
+
+ ModelType modelTypeResult = requestHandler.getModelType(Action.addMembers, null);
+ assertEquals(modelTypeResult, modelTypeExpected);
+ }
+
+ @Test
+ public void getModelTypeRemoveMembersTest() throws ApiException {
+ ModelType modelTypeExpected = ModelType.instanceGroup;
+
+ ModelType modelTypeResult = requestHandler.getModelType(Action.removeMembers, null);
+ assertEquals(modelTypeResult, modelTypeExpected);
+ }
+
+ @Test
+ public void getModelTypeTest() throws ApiException {
+ ModelType modelTypeExpected = ModelType.service;
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelType(ModelType.service);
+
+ ModelType modelTypeResult = requestHandler.getModelType(Action.createInstance, modelInfo);
+ assertEquals(modelTypeResult, modelTypeExpected);
+ }
+
+ @Test
+ public void updateRequestorIdInRequestBodyTest() throws IOException {
+ String newRequestorId = "yyyyyy";
+ String expected = getRequestBody("/RequestBodyNewRequestorId.json");
+ String result = requestHandler.updateRequestorIdInRequestBody(infraActiveRequest, newRequestorId);
+ assertEquals(expected, result);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
new file mode 100644
index 0000000000..1e755419be
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
@@ -0,0 +1,483 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.nullable;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Response;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.constants.Status;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.web.client.HttpClientErrorException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.serviceinstancebeans.ModelType;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ResumeOrchestrationRequestTest {
+ @Mock
+ private RequestHandlerUtils requestHandler;
+
+ @Mock
+ private MsoRequest msoRequest;
+
+ @Mock
+ private ServiceInstances serviceInstances;
+
+ @Mock
+ private RequestsDbClient requestDbClient;
+
+ @InjectMocks
+ @Spy
+ private ResumeOrchestrationRequest resumeReq;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private static final String CURRENT_REQUEST_ID = "eca3a1b1-43ab-457e-ab1c-367263d148b4";
+ private static final String REQUEST_ID = "00032ab7-na18-42e5-965d-8ea592502019";
+ private static final String SERVICE_INSTANCE_ID = "00032ab7-na18-42e5-965d-8ea592502018";
+ private static final String VNF_ID = "00032ab7-na18-42e5-965d-8ea592502017";
+ private static final String VFMODULE_ID = "00032ab7-na18-42e5-965d-8ea592502016";
+ private static final String NETWORK_ID = "00032ab7-na18-42e5-965d-8ea592502015";
+ private static final String VOLUME_GROUP_ID = "00032ab7-na18-42e5-965d-8ea592502014";
+ private static final String SERVICE_INSTANCE_NAME = "serviceInstanceName";
+ private static final String VNF_NAME = "vnfName";
+ private static final String VFMODULE_NAME = "vfModuleName";
+ private static final String NETWORK_NAME = "networkName";
+ private static final String VOLUME_GROUP_NAME = "volumeGroupName";
+ private static final String SERVICE = "service";
+ private static final String VNF = "vnf";
+ private static final String VFMODULE = "vfModule";
+ private static final String NETWORK = "network";
+ private static final String VOLUME_GROUP = "volumeGroup";
+ private final Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ private final Action action = Action.createInstance;
+ private final Boolean aLaCarte = false;
+ private final String version = "7";
+ private final String requestUri =
+ "http:localhost:6746/onap/so/infra/orchestrationRequests/v7/00032ab7-na18-42e5-965d-8ea592502019/resume";
+ private final RecipeLookupResult lookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 80);
+ private RequestClientParameter requestClientParameter = null;
+ private RequestClientParameter requestClientParameterVfModule = null;
+ private ObjectMapper mapper = new ObjectMapper();
+ private InfraActiveRequests infraActiveRequest = new InfraActiveRequests();
+ private InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+ private InfraActiveRequests infraActiveRequestVfModule = new InfraActiveRequests();
+ private ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ private ServiceInstancesRequest sirNullALaCarte = new ServiceInstancesRequest();
+ private String requestBody = null;
+ private String requestBodyNullALaCarte = null;
+ private ContainerRequestContext requestContext = null;
+ private HashMap<String, String> instanceIdMap = new HashMap<>();
+ ModelInfo modelInfo;
+
+
+ @Before
+ public void setup() throws ValidateException, IOException {
+ // Setup general requestHandler mocks
+ when(requestHandler.getRequestUri(any(), anyString())).thenReturn(requestUri);
+
+ // Setup InfraActiveRequests
+ setInfraActiveRequest();
+ setCurrentActiveRequest();
+ setInfraActiveRequestVfModule();
+
+ requestBody = infraActiveRequest.getRequestBody();
+ sir = mapper.readValue(requestBody, ServiceInstancesRequest.class);
+ requestBodyNullALaCarte = getRequestBody("/ALaCarteNull.json");
+ sirNullALaCarte = mapper.readValue(requestBodyNullALaCarte, ServiceInstancesRequest.class);
+ setRequestClientParameter();
+ setRequestClientParameterVfModule();
+ instanceIdMap.put("serviceInstanceId", SERVICE_INSTANCE_ID);
+ modelInfo = sir.getRequestDetails().getModelInfo();
+ }
+
+ public String getRequestBody(String request) throws IOException {
+ request = "src/test/resources/ResumeOrchestrationRequest" + request;
+ return new String(Files.readAllBytes(Paths.get(request)));
+ }
+
+ private void setInfraActiveRequest() throws IOException {
+ infraActiveRequest.setTenantId("tenant-id");
+ infraActiveRequest.setRequestBody(getRequestBody("/RequestBody.json"));
+ infraActiveRequest.setAicCloudRegion("cloudRegion");
+ infraActiveRequest.setRequestScope(SERVICE);
+ infraActiveRequest.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ infraActiveRequest.setServiceInstanceName(SERVICE_INSTANCE_NAME);
+ infraActiveRequest.setRequestStatus(Status.IN_PROGRESS.toString());
+ infraActiveRequest.setRequestAction(Action.createInstance.toString());
+ infraActiveRequest.setServiceType("serviceType");
+ infraActiveRequest.setVnfId(VNF_ID);
+ infraActiveRequest.setVfModuleId(VFMODULE_ID);
+ infraActiveRequest.setNetworkId(NETWORK_ID);
+ infraActiveRequest.setVolumeGroupId(VOLUME_GROUP_ID);
+ infraActiveRequest.setVnfName(VNF_NAME);
+ infraActiveRequest.setVfModuleName(VFMODULE_NAME);
+ infraActiveRequest.setNetworkName(NETWORK_NAME);
+ infraActiveRequest.setVolumeGroupName(VOLUME_GROUP_NAME);
+ infraActiveRequest.setRequestId(REQUEST_ID);
+ }
+
+ private void setCurrentActiveRequest() throws IOException {
+ currentActiveRequest.setRequestId(CURRENT_REQUEST_ID);
+ currentActiveRequest.setSource("VID");
+ currentActiveRequest.setStartTime(startTimeStamp);
+ currentActiveRequest.setTenantId("tenant-id");
+ currentActiveRequest.setRequestBody(getRequestBody("/RequestBody.json"));
+ currentActiveRequest.setAicCloudRegion("cloudRegion");
+ currentActiveRequest.setRequestScope(SERVICE);
+ currentActiveRequest.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ currentActiveRequest.setServiceInstanceName(SERVICE_INSTANCE_NAME);
+ currentActiveRequest.setRequestStatus(Status.IN_PROGRESS.toString());
+ currentActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ currentActiveRequest.setRequestAction(Action.createInstance.toString());
+ currentActiveRequest.setRequestUrl(requestUri);
+ currentActiveRequest.setRequestorId("xxxxxx");
+ currentActiveRequest.setProgress(new Long(5));
+ }
+
+ private void setInfraActiveRequestVfModule() throws IOException {
+ infraActiveRequestVfModule.setRequestBody(getRequestBody("/RequestBody.json"));
+ infraActiveRequestVfModule.setRequestScope(VFMODULE);
+ infraActiveRequestVfModule.setRequestStatus(Status.IN_PROGRESS.toString());
+ infraActiveRequestVfModule.setRequestAction(Action.createInstance.toString());
+ infraActiveRequestVfModule.setVnfId(VNF_ID);
+ infraActiveRequestVfModule.setVfModuleId(VFMODULE_ID);
+ infraActiveRequestVfModule.setVnfName(VNF_NAME);
+ infraActiveRequestVfModule.setVfModuleName(VFMODULE_NAME);
+ }
+
+ private void setRequestClientParameter() {
+ requestClientParameter =
+ new RequestClientParameter.Builder().setRequestId(CURRENT_REQUEST_ID).setRecipeTimeout(80)
+ .setRequestAction(Action.createInstance.toString()).setServiceInstanceId(SERVICE_INSTANCE_ID)
+ .setPnfCorrelationId("pnfCorrelationId").setVnfId(VNF_ID).setVfModuleId(VFMODULE_ID)
+ .setVolumeGroupId(VOLUME_GROUP_ID).setNetworkId(NETWORK_ID).setServiceType("serviceType")
+ .setVnfType(null).setNetworkType(null).setRequestDetails(requestBody).setApiVersion(version)
+ .setALaCarte(aLaCarte).setRequestUri(requestUri).setInstanceGroupId(null).build();
+ }
+
+ private void setRequestClientParameterVfModule() {
+ requestClientParameterVfModule =
+ new RequestClientParameter.Builder().setRequestId(CURRENT_REQUEST_ID).setRecipeTimeout(80)
+ .setRequestAction(Action.createInstance.toString()).setPnfCorrelationId("pnfCorrelationId")
+ .setVnfId(VNF_ID).setVfModuleId(VFMODULE_ID).setRequestDetails(requestBody)
+ .setApiVersion(version).setALaCarte(aLaCarte).setRequestUri(requestUri).build();
+ }
+
+ @Test
+ public void resumeOrchestationRequestTest() throws Exception {
+ Response response = null;
+ when(requestDbClient.getInfraActiveRequestbyRequestId(REQUEST_ID)).thenReturn(infraActiveRequest);
+ doReturn(currentActiveRequest).when(requestHandler).createNewRecordCopyFromInfraActiveRequest(
+ any(InfraActiveRequests.class), nullable(String.class), any(Timestamp.class), nullable(String.class),
+ nullable(String.class), nullable(String.class), anyString());
+ doReturn(response).when(resumeReq).resumeRequest(any(InfraActiveRequests.class), any(InfraActiveRequests.class),
+ anyString(), nullable(String.class));
+
+ resumeReq.resumeOrchestrationRequest(REQUEST_ID, "v7", requestContext);
+
+ verify(resumeReq).resumeRequest(infraActiveRequest, currentActiveRequest, version, null);
+ }
+
+ @Test
+ public void resumeOrchestationRequestDbNullResultTest() throws Exception {
+ when(requestDbClient.getInfraActiveRequestbyRequestId("00032ab7-na18-42e5-965d-8ea592502018")).thenReturn(null);
+
+ thrown.expect(ValidateException.class);
+ thrown.expectMessage(
+ "Null response from requestDB when searching by requestId: 00032ab7-na18-42e5-965d-8ea592502018");
+ resumeReq.resumeOrchestrationRequest("00032ab7-na18-42e5-965d-8ea592502018", "v7", requestContext);
+ }
+
+ @Test
+ public void resumeOrchestationRequestDbErrorTest() throws Exception {
+ when(requestDbClient.getInfraActiveRequestbyRequestId("00032ab7-na18-42e5-965d-8ea592502018"))
+ .thenThrow(HttpClientErrorException.class);
+
+ thrown.expect(ValidateException.class);
+ thrown.expectMessage("Exception while performing requestDb lookup by requestId");
+ resumeReq.resumeOrchestrationRequest("00032ab7-na18-42e5-965d-8ea592502018", "v7", requestContext);
+ }
+
+ @Test
+ public void resumeRequestTest() throws ApiException, IOException {
+ Response response = null;
+ doReturn(instanceIdMap).when(resumeReq).setInstanceIdMap(infraActiveRequest, ModelType.service.toString());
+ doReturn(SERVICE_INSTANCE_NAME).when(resumeReq).getInstanceName(infraActiveRequest,
+ ModelType.service.toString(), currentActiveRequest);
+ when(requestHandler.convertJsonToServiceInstanceRequest(anyString(), any(Actions.class), anyString(),
+ anyString())).thenReturn(sir);
+ when(serviceInstances.getPnfCorrelationId(any(ServiceInstancesRequest.class))).thenReturn("pnfCorrelationId");
+ doReturn(lookupResult).when(serviceInstances).getServiceInstanceOrchestrationURI(sir, action, aLaCarte,
+ currentActiveRequest);
+ doReturn(requestClientParameter).when(resumeReq).setRequestClientParameter(lookupResult, version,
+ infraActiveRequest, currentActiveRequest, "pnfCorrelationId", aLaCarte, sir);
+ doNothing().when(resumeReq).requestDbSave(currentActiveRequest);
+ when(requestHandler.postBPELRequest(any(InfraActiveRequests.class), any(RequestClientParameter.class),
+ anyString(), anyString())).thenReturn(response);
+ doNothing().when(resumeReq).checkForInProgressRequest(currentActiveRequest, instanceIdMap, SERVICE,
+ SERVICE_INSTANCE_NAME, action);
+
+ resumeReq.resumeRequest(infraActiveRequest, currentActiveRequest, version,
+ "/onap/so/infra/orchestrationRequests/v7/requests/00032ab7-na18-42e5-965d-8ea592502018/resume");
+ verify(requestHandler).postBPELRequest(currentActiveRequest, requestClientParameter,
+ lookupResult.getOrchestrationURI(), infraActiveRequest.getRequestScope());
+ }
+
+ @Test
+ public void setRequestClientParameterTest() throws ApiException, IOException {
+ doReturn(ModelType.service).when(requestHandler).getModelType(action, modelInfo);
+ when(requestHandler.mapJSONtoMSOStyle(anyString(), any(ServiceInstancesRequest.class), anyBoolean(),
+ any(Action.class))).thenReturn(requestBody);
+ RequestClientParameter result = resumeReq.setRequestClientParameter(lookupResult, version, infraActiveRequest,
+ currentActiveRequest, "pnfCorrelationId", aLaCarte, sir);
+ assertThat(requestClientParameter, sameBeanAs(result));
+ }
+
+ @Test
+ public void setRequestClientParameterVfModuleTest() throws ApiException, IOException {
+ when(requestHandler.mapJSONtoMSOStyle(anyString(), any(ServiceInstancesRequest.class), anyBoolean(),
+ any(Action.class))).thenReturn(requestBody);
+ doReturn(ModelType.vfModule).when(requestHandler).getModelType(action, modelInfo);
+ RequestClientParameter result = resumeReq.setRequestClientParameter(lookupResult, version,
+ infraActiveRequestVfModule, currentActiveRequest, "pnfCorrelationId", aLaCarte, sir);
+ assertThat(requestClientParameterVfModule, sameBeanAs(result));
+ }
+
+ @Test
+ public void requestDbSaveTest() throws RequestDbFailureException {
+ doNothing().when(requestDbClient).save(currentActiveRequest);
+ resumeReq.requestDbSave(currentActiveRequest);
+ verify(requestDbClient).save(currentActiveRequest);
+ }
+
+ @Test
+ public void resumeRequestTestALaCarteNull() throws ApiException, IOException {
+ Response response = null;
+ doReturn(instanceIdMap).when(resumeReq).setInstanceIdMap(infraActiveRequest, ModelType.service.toString());
+ doReturn(SERVICE_INSTANCE_NAME).when(resumeReq).getInstanceName(infraActiveRequest,
+ ModelType.service.toString(), currentActiveRequest);
+ when(requestHandler.convertJsonToServiceInstanceRequest(anyString(), any(Actions.class), anyString(),
+ anyString())).thenReturn(sirNullALaCarte);
+ when(serviceInstances.getPnfCorrelationId(any(ServiceInstancesRequest.class))).thenReturn("pnfCorrelationId");
+ doReturn(false).when(msoRequest).getAlacarteFlag(sirNullALaCarte);
+ doReturn(lookupResult).when(serviceInstances).getServiceInstanceOrchestrationURI(sirNullALaCarte, action, false,
+ currentActiveRequest);
+ doReturn(requestClientParameter).when(resumeReq).setRequestClientParameter(lookupResult, version,
+ infraActiveRequest, currentActiveRequest, "pnfCorrelationId", aLaCarte, sirNullALaCarte);
+ doReturn(false).when(resumeReq).setALaCarteFlagIfNull(SERVICE, action);
+ doNothing().when(resumeReq).requestDbSave(currentActiveRequest);
+ when(requestHandler.postBPELRequest(any(InfraActiveRequests.class), any(RequestClientParameter.class),
+ anyString(), anyString())).thenReturn(response);
+ doNothing().when(resumeReq).checkForInProgressRequest(currentActiveRequest, instanceIdMap, SERVICE,
+ SERVICE_INSTANCE_NAME, action);
+
+ resumeReq.resumeRequest(infraActiveRequest, currentActiveRequest, version,
+ "/onap/so/infra/orchestrationRequests/v7/requests/00032ab7-na18-42e5-965d-8ea592502018/resume");
+ verify(requestHandler).postBPELRequest(currentActiveRequest, requestClientParameter,
+ lookupResult.getOrchestrationURI(), infraActiveRequest.getRequestScope());
+ }
+
+ @Test
+ public void setRequestClientParameterErrorTest() throws ApiException, IOException {
+ doReturn(ModelType.service).when(requestHandler).getModelType(action, modelInfo);
+ when(requestHandler.mapJSONtoMSOStyle(anyString(), any(ServiceInstancesRequest.class), anyBoolean(),
+ any(Action.class))).thenThrow(new IOException("IOException"));
+
+ thrown.expect(ValidateException.class);
+ thrown.expectMessage("IOException while generating requestClientParameter to send to BPMN: IOException");
+ resumeReq.setRequestClientParameter(lookupResult, version, infraActiveRequest, currentActiveRequest,
+ "pnfCorrelationId", aLaCarte, sir);
+ }
+
+ @Test
+ public void checkForInProgressRequest() throws ApiException {
+ doReturn(infraActiveRequest).when(requestHandler).duplicateCheck(action, instanceIdMap, SERVICE_INSTANCE_NAME,
+ SERVICE, currentActiveRequest);
+ doReturn(true).when(requestHandler).camundaHistoryCheck(infraActiveRequest, currentActiveRequest);
+ doThrow(DuplicateRequestException.class).when(requestHandler).buildErrorOnDuplicateRecord(currentActiveRequest,
+ action, instanceIdMap, SERVICE_INSTANCE_NAME, SERVICE, infraActiveRequest);
+
+ thrown.expect(DuplicateRequestException.class);
+ resumeReq.checkForInProgressRequest(currentActiveRequest, instanceIdMap, SERVICE, SERVICE_INSTANCE_NAME,
+ action);
+ }
+
+ @Test
+ public void checkForInProgressRequestNoInProgressRequests() throws ApiException {
+ doReturn(null).when(requestHandler).duplicateCheck(action, instanceIdMap, SERVICE_INSTANCE_NAME, SERVICE,
+ currentActiveRequest);
+
+ resumeReq.checkForInProgressRequest(currentActiveRequest, instanceIdMap, SERVICE, SERVICE_INSTANCE_NAME,
+ action);
+ verify(requestHandler).duplicateCheck(action, instanceIdMap, SERVICE_INSTANCE_NAME, SERVICE,
+ currentActiveRequest);
+ }
+
+ @Test
+ public void checkForInProgressRequestCamundaHistoryCheckReturnsNoInProgress() throws ApiException {
+ doReturn(infraActiveRequest).when(requestHandler).duplicateCheck(action, instanceIdMap, SERVICE_INSTANCE_NAME,
+ SERVICE, currentActiveRequest);
+ doReturn(false).when(requestHandler).camundaHistoryCheck(infraActiveRequest, currentActiveRequest);
+
+ resumeReq.checkForInProgressRequest(currentActiveRequest, instanceIdMap, SERVICE, SERVICE_INSTANCE_NAME,
+ action);
+ verify(requestHandler).duplicateCheck(action, instanceIdMap, SERVICE_INSTANCE_NAME, SERVICE,
+ currentActiveRequest);
+ verify(requestHandler).camundaHistoryCheck(infraActiveRequest, currentActiveRequest);
+ }
+
+ @Test
+ public void setInstanceIdMapServiceTest() {
+ HashMap<String, String> expected = new HashMap<>();
+ expected.put("serviceInstanceId", SERVICE_INSTANCE_ID);
+ HashMap<String, String> result = resumeReq.setInstanceIdMap(infraActiveRequest, SERVICE);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void setInstanceIdMapRequestScopeNotValidTest() {
+ HashMap<String, String> expected = new HashMap<>();
+ HashMap<String, String> result = resumeReq.setInstanceIdMap(infraActiveRequest, "test");
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void setInstanceIdMapVnfTest() {
+ HashMap<String, String> expected = new HashMap<>();
+ expected.put("vnfInstanceId", VNF_ID);
+ HashMap<String, String> result = resumeReq.setInstanceIdMap(infraActiveRequest, VNF);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void setInstanceIdMapVfModuleTest() {
+ HashMap<String, String> expected = new HashMap<>();
+ expected.put("vfModuleInstanceId", VFMODULE_ID);
+ HashMap<String, String> result = resumeReq.setInstanceIdMap(infraActiveRequest, VFMODULE);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void setInstanceIdMapNetworkTest() {
+ HashMap<String, String> expected = new HashMap<>();
+ expected.put("networkInstanceId", NETWORK_ID);
+ HashMap<String, String> result = resumeReq.setInstanceIdMap(infraActiveRequest, NETWORK);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void setInstanceIdMapVolumeGroupTest() {
+ HashMap<String, String> expected = new HashMap<>();
+ expected.put("volumeGroupInstanceId", VOLUME_GROUP_ID);
+ HashMap<String, String> result = resumeReq.setInstanceIdMap(infraActiveRequest, VOLUME_GROUP);
+ assertEquals(result, expected);
+ }
+
+ @Test
+ public void setInstanceNameServiceTest() throws ValidateException, RequestDbFailureException {
+ String result = resumeReq.getInstanceName(infraActiveRequest, SERVICE, currentActiveRequest);
+ assertEquals(result, SERVICE_INSTANCE_NAME);
+ }
+
+ @Test
+ public void setInstanceNameRequestScopeNotValidTest() throws ValidateException, RequestDbFailureException {
+ thrown.expect(ValidateException.class);
+ thrown.expectMessage(
+ "requestScope: \"test\" from request: 00032ab7-na18-42e5-965d-8ea592502019 does not match a ModelType enum.");
+
+ resumeReq.getInstanceName(infraActiveRequest, "test", currentActiveRequest);
+ }
+
+ @Test
+ public void setInstanceNameVnfTest() throws ValidateException, RequestDbFailureException {
+ String result = resumeReq.getInstanceName(infraActiveRequest, VNF, currentActiveRequest);
+ assertEquals(result, VNF_NAME);
+ }
+
+ @Test
+ public void setInstanceNameVfModuleTest() throws ValidateException, RequestDbFailureException {
+ String result = resumeReq.getInstanceName(infraActiveRequest, VFMODULE, currentActiveRequest);
+ assertEquals(result, VFMODULE_NAME);
+ }
+
+ @Test
+ public void setInstanceNameNetworkTest() throws ValidateException, RequestDbFailureException {
+ String result = resumeReq.getInstanceName(infraActiveRequest, NETWORK, currentActiveRequest);
+ assertEquals(result, NETWORK_NAME);
+ }
+
+ @Test
+ public void setInstanceNameVolumeGroupTest() throws ValidateException, RequestDbFailureException {
+ String result = resumeReq.getInstanceName(infraActiveRequest, VOLUME_GROUP, currentActiveRequest);
+ assertEquals(result, VOLUME_GROUP_NAME);
+ }
+
+ @Test
+ public void setALaCarteFlagIfNullTest() {
+ Boolean aLaCarteFlag = resumeReq.setALaCarteFlagIfNull(SERVICE, action);
+ assertEquals(aLaCarteFlag, false);
+ }
+
+ @Test
+ public void setALaCarteFlagIfNullVnfTest() {
+ Boolean aLaCarteFlag = resumeReq.setALaCarteFlagIfNull(VNF, action);
+ assertEquals(aLaCarteFlag, true);
+ }
+
+ @Test
+ public void setALaCarteFlagIfNullRecreateTest() {
+ Boolean aLaCarteFlag = resumeReq.setALaCarteFlagIfNull(VNF, Action.recreateInstance);
+ assertEquals(aLaCarteFlag, false);
+ }
+}
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 db6273dc4a..48a5343104 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,11 +28,14 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.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.HttpHeadersConstants.TRANSACTION_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;
@@ -41,7 +44,6 @@ 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;
import java.net.MalformedURLException;
@@ -57,12 +59,18 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
+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.HttpHeadersConstants;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.RequestInfo;
import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.RequestReferences;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@@ -75,7 +83,6 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.util.UriComponentsBuilder;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -84,7 +91,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.http.Fault;
import ch.qos.logback.classic.spi.ILoggingEvent;
-
public class ServiceInstancesTest extends BaseTest {
private final ObjectMapper mapper = new ObjectMapper();
@@ -93,6 +99,9 @@ public class ServiceInstancesTest extends BaseTest {
@Autowired
private ServiceInstances servInstances;
+ @Autowired
+ private RequestHandlerUtils requestHandlerUtils;
+
@Value("${wiremock.server.port}")
private String wiremockPort;
@@ -276,14 +285,13 @@ public class ServiceInstancesTest extends BaseTest {
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v5", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
- uri = servInstanceUriPrev7 + "v5";
+ uri = servInstanceuri + "v5";
ResponseEntity<String> response =
sendRequest(inputStream("/ServiceInstancePrev7.json"), uri, HttpMethod.POST, headers);
// then
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ assertEquals(404, response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
- assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
@@ -887,7 +895,7 @@ public class ServiceInstancesTest extends BaseTest {
ResponseEntity<String> response =
sendRequest(inputStream("/VnfWithServiceRelatedInstanceFail.json"), uri, HttpMethod.POST);
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
+ assertEquals(404, response.getStatusCode().value());
}
@Test
@@ -2239,14 +2247,12 @@ public class ServiceInstancesTest extends BaseTest {
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v5", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
- uri = servInstanceUriPrev7 + "v5";
+ uri = servInstanceuri + "v5";
ResponseEntity<String> response =
sendRequest(inputStream("/MacroServiceInstance.json"), uri, HttpMethod.POST, headers);
// then
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
- assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
+ assertEquals(404, response.getStatusCode().value());
}
@Test
@@ -2389,7 +2395,7 @@ public class ServiceInstancesTest extends BaseTest {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
assertEquals(
- "Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error",
+ "Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
}
@@ -2434,7 +2440,7 @@ public class ServiceInstancesTest extends BaseTest {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
assertEquals(
- "Unable to get process-instance history from Camunda for requestId: f0a35706-efc4-4e27-80ea-a995d7a2a40f due to error: org.springframework.web.client.HttpServerErrorException: 500 Server Error",
+ "Unable to get process-instance history from Camunda for requestId: f0a35706-efc4-4e27-80ea-a995d7a2a40f due to error: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
}
@@ -2451,7 +2457,7 @@ public class ServiceInstancesTest extends BaseTest {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
assertEquals(
- "Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error",
+ "Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
}
@@ -2483,7 +2489,7 @@ public class ServiceInstancesTest extends BaseTest {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
assertEquals(
- "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error",
+ "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
}
@@ -2503,7 +2509,7 @@ public class ServiceInstancesTest extends BaseTest {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
assertEquals(
- "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error",
+ "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
}
@@ -2520,7 +2526,7 @@ public class ServiceInstancesTest extends BaseTest {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
assertEquals(
- "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error",
+ "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
}
@@ -2748,5 +2754,182 @@ public class ServiceInstancesTest extends BaseTest {
"No valid modelCustomizationId for networkResourceCustomization lookup is specified");
}
+ @Test
+ public void setServiceTypeTestALaCarte() throws JsonProcessingException {
+ String requestScope = ModelType.service.toString();
+ Boolean aLaCarteFlag = true;
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setSource("VID");
+ requestDetails.setRequestInfo(requestInfo);
+ sir.setRequestDetails(requestDetails);
+ Service defaultService = new Service();
+ defaultService.setServiceType("testServiceTypeALaCarte");
+
+ wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+
+ String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
+ assertEquals(serviceType, "testServiceTypeALaCarte");
+ }
+
+ @Test
+ public void setServiceTypeTest() throws JsonProcessingException {
+ String requestScope = ModelType.service.toString();
+ Boolean aLaCarteFlag = false;
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelVersionId("0dd91181-49da-446b-b839-cd959a96f04a");
+ requestInfo.setSource("VID");
+ requestDetails.setModelInfo(modelInfo);
+ requestDetails.setRequestInfo(requestInfo);
+ sir.setRequestDetails(requestDetails);
+ Service defaultService = new Service();
+ defaultService.setServiceType("testServiceType");
+
+ wireMockServer.stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+
+ String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
+ assertEquals(serviceType, "testServiceType");
+ }
+
+ @Test
+ public void setServiceTypeTestDefault() throws JsonProcessingException {
+ String requestScope = ModelType.service.toString();
+ Boolean aLaCarteFlag = false;
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelVersionId("0dd91181-49da-446b-b839-cd959a96f04a");
+ requestInfo.setSource("VID");
+ requestDetails.setModelInfo(modelInfo);
+ requestDetails.setRequestInfo(requestInfo);
+ sir.setRequestDetails(requestDetails);
+ Service defaultService = new Service();
+ defaultService.setServiceType("testServiceType");
+
+ wireMockServer.stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+ wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+
+ String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
+ assertEquals(serviceType, "testServiceType");
+ }
+
+ @Test
+ public void setServiceTypeTestNetwork() throws JsonProcessingException {
+ String requestScope = ModelType.network.toString();
+ Boolean aLaCarteFlag = null;
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelName("networkModelName");
+ requestInfo.setSource("VID");
+ requestDetails.setModelInfo(modelInfo);
+ requestDetails.setRequestInfo(requestInfo);
+ sir.setRequestDetails(requestDetails);
+
+ String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
+ assertEquals(serviceType, "networkModelName");
+ }
+ @Test
+ public void setServiceInstanceIdInstanceGroupTest() throws JsonParseException, JsonMappingException, IOException {
+ String requestScope = "instanceGroup";
+ ServiceInstancesRequest sir =
+ mapper.readValue(inputStream("/CreateInstanceGroup.json"), ServiceInstancesRequest.class);
+ assertEquals("ddcbbf3d-f2c1-4ca0-8852-76a807285efc",
+ requestHandlerUtils.setServiceInstanceId(requestScope, sir));
+ }
+
+ @Test
+ public void setServiceInstanceIdTest() {
+ String requestScope = "vnf";
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ sir.setServiceInstanceId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
+ assertEquals("f0a35706-efc4-4e27-80ea-a995d7a2a40f",
+ requestHandlerUtils.setServiceInstanceId(requestScope, sir));
+ }
+
+ @Test
+ public void setServiceInstanceIdReturnNullTest() {
+ String requestScope = "vnf";
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ assertNull(requestHandlerUtils.setServiceInstanceId(requestScope, sir));
+ }
+
+ @Test
+ public void camundaHistoryCheckTest() throws ContactCamundaException, RequestDbFailureException {
+ wireMockServer.stubFor(get(
+ ("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/HistoryCheckResponse.json")
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ InfraActiveRequests duplicateRecord = new InfraActiveRequests();
+ duplicateRecord.setRequestId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
+ boolean inProgress = false;
+ inProgress = requestHandlerUtils.camundaHistoryCheck(duplicateRecord, null);
+ assertTrue(inProgress);
+ }
+
+ @Test
+ public void camundaHistoryCheckNoneFoundTest() throws ContactCamundaException, RequestDbFailureException {
+ wireMockServer.stubFor(get(
+ ("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody("[]").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ InfraActiveRequests duplicateRecord = new InfraActiveRequests();
+ duplicateRecord.setRequestId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
+ boolean inProgress = false;
+ inProgress = requestHandlerUtils.camundaHistoryCheck(duplicateRecord, null);
+ assertFalse(inProgress);
+ }
+
+ @Test
+ public void camundaHistoryCheckNotInProgressTest() throws ContactCamundaException, RequestDbFailureException {
+ wireMockServer.stubFor(get(
+ ("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/HistoryCheckResponseCompleted.json")
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ InfraActiveRequests duplicateRecord = new InfraActiveRequests();
+ duplicateRecord.setRequestId("f0a35706-efc4-4e27-80ea-a995d7a2a40f");
+ boolean inProgress = false;
+ inProgress = requestHandlerUtils.camundaHistoryCheck(duplicateRecord, null);
+ assertFalse(inProgress);
+ }
+
+ @Test
+ public void handleReplaceInstance_Test() throws JsonParseException, JsonMappingException, IOException {
+ String replaceVfModule = inputStream("/ReplaceVfModule.json");
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sir = mapper.readValue(replaceVfModule, ServiceInstancesRequest.class);
+ Actions action = servInstances.handleReplaceInstance(Action.replaceInstance, sir);
+ assertEquals(Action.replaceInstance, action);
+ }
+
+ @Test
+ public void handleReplaceInstance_retainAssignments_Test()
+ throws JsonParseException, JsonMappingException, IOException {
+ String replaceVfModule = inputStream("/ReplaceVfModuleRetainAssignments.json");
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sir = mapper.readValue(replaceVfModule, ServiceInstancesRequest.class);
+ Actions action = servInstances.handleReplaceInstance(Action.replaceInstance, sir);
+ assertEquals(Action.replaceInstanceRetainAssignments, action);
+ }
}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
new file mode 100644
index 0000000000..f73da49e0d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
@@ -0,0 +1,147 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import java.io.File;
+import java.util.Optional;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class BpmnRequestBuilderTest {
+
+ private static final String RESOURCE_PATH = "src/test/resources/__files/infra/";
+
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
+
+ @Mock
+ private AAIResourcesClient aaiResourcesClient;
+
+ @InjectMocks
+ private AAIDataRetrieval aaiData = spy(AAIDataRetrieval.class);
+
+ @Mock
+ private RequestsDbClient requestDBClient;
+
+ @InjectMocks
+ private BpmnRequestBuilder reqBuilder = spy(BpmnRequestBuilder.class);
+
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ private GraphInventoryCommonObjectMapperProvider provider = new GraphInventoryCommonObjectMapperProvider();
+
+ @Before
+ public void setup() {
+ // aaiData.setAaiResourcesClient(aaiResourcesClient);
+ }
+
+ @Test
+ public void test_buildServiceInstanceDeleteRequest() throws Exception {
+ ServiceInstance service =
+ provider.getMapper().readValue(new File(RESOURCE_PATH + "ServiceInstance.json"), ServiceInstance.class);
+
+ doReturn(service).when(aaiData).getServiceInstance("serviceId");
+ ServiceInstancesRequest expectedRequest = mapper
+ .readValue(new File(RESOURCE_PATH + "ExpectedServiceRequest.json"), ServiceInstancesRequest.class);
+ expectedRequest.getRequestDetails().getModelInfo().setModelId(null); // bad getter/setter setting multiple
+ // fields
+ ServiceInstancesRequest actualRequest = reqBuilder.buildServiceDeleteRequest("serviceId");
+ assertThat(actualRequest, sameBeanAs(expectedRequest));
+ }
+
+ @Test
+ public void test_buildVnfDeleteRequest() throws Exception {
+ GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
+
+ doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
+
+ ServiceInstancesRequest expectedRequest =
+ mapper.readValue(new File(RESOURCE_PATH + "ExpectedVnfRequest.json"), ServiceInstancesRequest.class);
+ ServiceInstancesRequest actualRequest = reqBuilder.buildVnfDeleteRequest("vnfId");
+ assertThat(actualRequest, sameBeanAs(expectedRequest));
+ }
+
+ @Test
+ public void test_buildVFModuleDeleteRequest() throws Exception {
+ GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
+
+ doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
+ VfModule vfModule = provider.getMapper().readValue(new File(RESOURCE_PATH + "VfModule.json"), VfModule.class);
+
+ doReturn(Optional.of(vfModule)).when(aaiResourcesClient).get(VfModule.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnfId", "vfModuleId"));
+
+ ServiceInstancesRequest expectedRequest = mapper
+ .readValue(new File(RESOURCE_PATH + "ExpectedVfModuleRequest.json"), ServiceInstancesRequest.class);
+ ServiceInstancesRequest actualRequest =
+ reqBuilder.buildVFModuleDeleteRequest("vnfId", "vfModuleId", ModelType.vfModule);
+ assertThat(actualRequest, sameBeanAs(expectedRequest));
+ }
+
+ @Test
+ public void test_buildVolumeGroupDeleteRequest() throws Exception {
+ GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
+
+ doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
+ VolumeGroup volumeGroup =
+ provider.getMapper().readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);
+ AAIResultWrapper wrapper = new AAIResultWrapper(volumeGroup);
+ doReturn(wrapper).when(aaiResourcesClient)
+ .get(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
+ .relatedTo(AAIObjectType.VOLUME_GROUP, "volumeGroupId"));
+
+ ServiceInstancesRequest expectedRequest = mapper
+ .readValue(new File(RESOURCE_PATH + "ExpectedVolumeGroupRequest.json"), ServiceInstancesRequest.class);
+ ServiceInstancesRequest actualRequest = reqBuilder.buildVolumeGroupDeleteRequest("vnfId", "volumeGroupId");
+ assertThat(actualRequest, sameBeanAs(expectedRequest));
+ }
+
+}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java
new file mode 100644
index 0000000000..d39192cdf0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.mockito.Mockito.doReturn;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Optional;
+import javax.ws.rs.container.ContainerRequestContext;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
+import org.onap.so.serviceinstancebeans.RequestReferences;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AbstractRestHandlerTest {
+
+ @Spy
+ AbstractRestHandler restHandler;
+
+ @Mock
+ ContainerRequestContext mockRequestContext;
+
+ @Test
+ public void test_createResponse() throws MalformedURLException {
+ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
+ RequestReferences requestReferences = new RequestReferences();
+ URL selfLinkURL = new URL("http://localhost:8080/v1");
+ requestReferences.setInstanceId("instanceId");
+ requestReferences.setRequestId("requestId");
+ requestReferences.setRequestSelfLink(selfLinkURL);
+ expectedResponse.setRequestReferences(requestReferences);
+
+ doReturn("http://localhost:8080/v1").when(restHandler).getRequestUri(mockRequestContext);
+ doReturn(Optional.of(selfLinkURL)).when(restHandler).buildSelfLinkUrl("http://localhost:8080/v1", "requestId");
+ ServiceInstancesResponse actualResponse =
+ restHandler.createResponse("instanceId", "requestId", mockRequestContext);
+ assertThat(actualResponse, sameBeanAs(expectedResponse));
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java
new file mode 100644
index 0000000000..59308215ac
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.eq;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.ws.rs.container.ContainerRequestContext;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.apihandlerinfra.infra.rest.handler.NetworkRestHandler;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class NetworkRestHandlerTest {
+
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
+ @InjectMocks
+ NetworkRestHandler restHandler;
+
+ @Mock
+ ContainerRequestContext mockRequestContext;
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @Mock
+ private RequestsDbClient infraActiveRequestsClient;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void test_checkDuplicateRequest() throws MalformedURLException, NoRecipeException {
+ ArgumentCaptor<HashMap> instanceIdCaptor = ArgumentCaptor.forClass(HashMap.class);
+ restHandler.checkDuplicateRequest("serviceInstanceId", "networkId", "instanceName", "requestId");
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).checkInstanceNameDuplicate(
+ instanceIdCaptor.capture(), eq("instanceName"), eq(ModelType.network.toString()));
+ Map actualMap = instanceIdCaptor.getValue();
+ assertEquals("ServiceInstanceID should exist in map", "serviceInstanceId", actualMap.get("serviceInstanceId"));
+ assertEquals("NetworkId should exit in map", "networkId", actualMap.get("networkInstanceId"));
+ }
+
+ @Test
+ public void test_saveInstanceName() throws MalformedURLException, NoRecipeException {
+ ServiceInstancesRequest request = createTestRequest();
+ InfraActiveRequests dbRequest = createDatabaseRecord();
+ restHandler.saveInstanceName(request, dbRequest);
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).updateInfraActiveRequests(dbRequest);
+ assertEquals("InstanceName Should Be Equal", "instanceName", dbRequest.getNetworkName());
+ }
+
+ @Test
+ public void test_buildRequestParams() throws Exception {
+ RequestClientParameter expected = new RequestClientParameter.Builder().setRequestId("requestId")
+ .setServiceInstanceId("serviceInstanceId").setNetworkId("networkId").setALaCarte(true)
+ .setRequestDetails(mapper.writeValueAsString(createTestRequest()))
+ .setRequestAction(Action.deleteInstance.toString())
+ .setRequestUri("http://localhost:8080/serviceInstances").setApiVersion("v8").build();
+ RequestClientParameter actual = restHandler.buildRequestParams(createTestRequest(),
+ "http://localhost:8080/serviceInstances", "requestId", "serviceInstanceId", "networkId");
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void test_createInfraActiveRequestForDelete() throws Exception {
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setRequestAction(Action.deleteInstance.toString());
+ expected.setAction(Action.deleteInstance.toString());
+ expected.setServiceInstanceId("serviceInstanceId");
+ expected.setNetworkId("networkId");
+ expected.setRequestId("requestId");
+ expected.setRequestorId("userId");
+ expected.setSource("VID");
+ expected.setRequestStatus(Status.IN_PROGRESS.toString());
+ expected.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ expected.setRequestScope(ModelType.network.toString());
+ expected.setRequestUrl("http://localhost:9090");
+ InfraActiveRequests actual = restHandler.createInfraActiveRequestForDelete("requestId", "serviceInstanceId",
+ "networkId", "userId", "VID", "http://localhost:9090");
+ assertThat(actual, sameBeanAs(expected).ignoring("startTime"));
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).save(actual);
+ }
+
+ private ServiceInstancesRequest createTestRequest() {
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setInstanceName("instanceName");
+ requestDetails.setRequestInfo(requestInfo);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ private InfraActiveRequests createDatabaseRecord() {
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ return request;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java
new file mode 100644
index 0000000000..c1e6347943
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java
@@ -0,0 +1,189 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.ws.rs.container.ContainerRequestContext;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.apihandlerinfra.infra.rest.exception.RequestConflictedException;
+import org.onap.so.apihandlerinfra.infra.rest.handler.ServiceInstanceRestHandler;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+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.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ServiceInstanceRestHandlerTest {
+
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
+ @InjectMocks
+ ServiceInstanceRestHandler restHandler;
+
+ @Mock
+ ContainerRequestContext mockRequestContext;
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @Mock
+ private RequestsDbClient infraActiveRequestsClient;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void test_find_service_recipe() throws MalformedURLException, NoRecipeException {
+ ServiceRecipe expected = new ServiceRecipe();
+ expected.setAction("createInstance");
+ doReturn(expected).when(catalogDbClient)
+ .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId");
+ Recipe actual = restHandler.findServiceRecipe("testModelId", Action.createInstance.toString());
+ assertThat(actual, sameBeanAs(expected));
+ Mockito.verify(catalogDbClient, Mockito.times(1))
+ .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId");
+ }
+
+ @Test
+ public void test_find_service_recipe_default_recipe() throws MalformedURLException, NoRecipeException {
+ ServiceRecipe expected = new ServiceRecipe();
+ expected.setAction("createInstance");
+ doReturn(null).when(catalogDbClient)
+ .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId");
+ doReturn(expected).when(catalogDbClient).findServiceRecipeByActionAndServiceModelUUID(
+ Action.createInstance.toString(), "d88da85c-d9e8-4f73-b837-3a72a431622b");
+ Recipe actual = restHandler.findServiceRecipe("testModelId", Action.createInstance.toString());
+ assertThat(actual, sameBeanAs(expected));
+ Mockito.verify(catalogDbClient, Mockito.times(1))
+ .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId");
+ Mockito.verify(catalogDbClient, Mockito.times(1)).findServiceRecipeByActionAndServiceModelUUID(
+ Action.createInstance.toString(), "d88da85c-d9e8-4f73-b837-3a72a431622b");
+ }
+
+ @Test
+ public void test_find_service_recipe_not_found() throws MalformedURLException, NoRecipeException {
+ ServiceRecipe expected = new ServiceRecipe();
+ expected.setAction("createInstance");
+ doReturn(null).when(catalogDbClient)
+ .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId");
+ doReturn(null).when(catalogDbClient).findServiceRecipeByActionAndServiceModelUUID(
+ Action.createInstance.toString(), "d88da85c-d9e8-4f73-b837-3a72a431622b");
+ exceptionRule.expect(NoRecipeException.class);
+ exceptionRule.expectMessage(
+ "Unable to locate custom or default recipe for, Action: createInstance, Model UUID: testModelId");
+ restHandler.findServiceRecipe("testModelId", Action.createInstance.toString());
+ }
+
+ @Test
+ public void test_checkDuplicateRequest()
+ throws MalformedURLException, NoRecipeException, RequestConflictedException {
+ ArgumentCaptor<HashMap> instanceIdCaptor = ArgumentCaptor.forClass(HashMap.class);
+ restHandler.checkDuplicateRequest("serviceInstanceId", "instanceName", "requestId");
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).checkInstanceNameDuplicate(
+ instanceIdCaptor.capture(), eq("instanceName"), eq(ModelType.service.toString()));
+ Map actualMap = instanceIdCaptor.getValue();
+ assertEquals("serviceInstanceId", actualMap.get("serviceInstanceId"));
+ }
+
+ @Test
+ public void test_saveInstanceName() throws MalformedURLException, NoRecipeException {
+ ServiceInstancesRequest request = createTestRequest();
+ InfraActiveRequests dbRequest = createDatabaseRecord();
+ restHandler.saveInstanceName(request, dbRequest);
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).updateInfraActiveRequests(dbRequest);
+ assertEquals("InstanceName Should Be Equal", "instanceName", dbRequest.getServiceInstanceName());
+ }
+
+ @Test
+ public void test_buildRequestParams() throws Exception {
+ RequestClientParameter expected =
+ new RequestClientParameter.Builder().setRequestId("requestId").setServiceInstanceId("serviceInstanceId")
+ .setALaCarte(true).setRequestDetails(mapper.writeValueAsString(createTestRequest()))
+ .setRequestAction(Action.deleteInstance.toString())
+ .setRequestUri("http://localhost:8080/serviceInstances").setApiVersion("v8").build();
+ RequestClientParameter actual = restHandler.buildRequestParams(createTestRequest(),
+ "http://localhost:8080/serviceInstances", "requestId", "serviceInstanceId");
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void test_createInfraActiveRequestForDelete() throws Exception {
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setRequestAction(Action.deleteInstance.toString());
+ expected.setAction(Action.deleteInstance.toString());
+ expected.setServiceInstanceId("serviceInstanceId");
+ expected.setRequestId("requestId");
+ expected.setRequestorId("userId");
+ expected.setSource("VID");
+ expected.setRequestStatus(Status.IN_PROGRESS.toString());
+ expected.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ expected.setRequestUrl("http://localhost:9090");
+ expected.setRequestScope(ModelType.service.toString());
+ InfraActiveRequests actual = restHandler.createInfraActiveRequestForDelete("requestId", "serviceInstanceId",
+ "userId", "VID", "http://localhost:9090");
+ assertThat(actual, sameBeanAs(expected).ignoring("startTime"));
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).save(actual);
+ }
+
+ private ServiceInstancesRequest createTestRequest() {
+
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setInstanceName("instanceName");
+ requestDetails.setRequestInfo(requestInfo);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ private InfraActiveRequests createDatabaseRecord() {
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ return request;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java
new file mode 100644
index 0000000000..7d146791fe
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java
@@ -0,0 +1,190 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.ws.rs.container.ContainerRequestContext;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.apihandlerinfra.infra.rest.handler.VFModuleRestHandler;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
+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.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class VfModuleRestHandlerTest {
+
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
+ @InjectMocks
+ VFModuleRestHandler restHandler;
+
+ @Mock
+ ContainerRequestContext mockRequestContext;
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @Mock
+ private RequestsDbClient infraActiveRequestsClient;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void test_find_vf_module_recipe() throws MalformedURLException, NoRecipeException {
+ VnfComponentsRecipe expected = new VnfComponentsRecipe();
+ expected.setAction("createInstance");
+ doReturn(expected).when(catalogDbClient)
+ .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction("testModelId",
+ ModelType.vfModule.toString(), Action.createInstance.toString());
+ Recipe actual = restHandler.findVfModuleRecipe("testModelId", ModelType.vfModule.toString(),
+ Action.createInstance.toString());
+ assertThat(actual, sameBeanAs(expected));
+ Mockito.verify(catalogDbClient, Mockito.times(1))
+ .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction("testModelId",
+ ModelType.vfModule.toString(), Action.createInstance.toString());
+ }
+
+ @Test
+ public void test_find_vf_module_recipe_default_recipe() throws MalformedURLException, NoRecipeException {
+ VnfComponentsRecipe expected = new VnfComponentsRecipe();
+ expected.setAction("createInstance");
+ doReturn(null).when(catalogDbClient).getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ "testModelId", ModelType.vfModule.toString(), Action.createInstance.toString());
+ doReturn(expected).when(catalogDbClient)
+ .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction("GR-API-DEFAULT",
+ ModelType.vfModule.toString(), Action.createInstance.toString());
+ Recipe actual = restHandler.findVfModuleRecipe("testModelId", ModelType.vfModule.toString(),
+ Action.createInstance.toString());
+ assertThat(actual, sameBeanAs(expected));
+ Mockito.verify(catalogDbClient, Mockito.times(1))
+ .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction("testModelId",
+ ModelType.vfModule.toString(), Action.createInstance.toString());
+ }
+
+ @Test
+ public void test_find_vf_module_recipe_not_found() throws MalformedURLException, NoRecipeException {
+ VnfComponentsRecipe expected = new VnfComponentsRecipe();
+ expected.setAction("createInstance");
+ exceptionRule.expect(NoRecipeException.class);
+ exceptionRule.expectMessage(
+ "Unable to locate custom or default recipe for ModelType: vfModule , Action: createInstance, CustomizationId: testModelId");
+ restHandler.findVfModuleRecipe("testModelId", ModelType.vfModule.toString(), Action.createInstance.toString());
+ }
+
+ @Test
+ public void test_checkDuplicateRequest() throws MalformedURLException, NoRecipeException {
+ ArgumentCaptor<HashMap> instanceIdCaptor = ArgumentCaptor.forClass(HashMap.class);
+ restHandler.checkDuplicateRequest("serviceInstanceId", "vnfId", "vfModuleId", "instanceName", "requestId");
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).checkInstanceNameDuplicate(
+ instanceIdCaptor.capture(), eq("instanceName"), eq(ModelType.vfModule.toString()));
+ Map actualMap = instanceIdCaptor.getValue();
+ assertEquals("ServiceInstanceID should exist in map", "serviceInstanceId", actualMap.get("serviceInstanceId"));
+ assertEquals("VnfId should exit in map", "vnfId", actualMap.get("vnfInstanceId"));
+ assertEquals("VFModuleId should exit in map", "vfModuleId", actualMap.get("vfModuleInstanceId"));
+ }
+
+ @Test
+ public void test_saveInstanceName() throws MalformedURLException, NoRecipeException {
+ ServiceInstancesRequest request = createTestRequest();
+ InfraActiveRequests dbRequest = createDatabaseRecord();
+ restHandler.saveInstanceName(request, dbRequest);
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).updateInfraActiveRequests(dbRequest);
+ assertEquals("InstanceName Should Be Equal", "instanceName", dbRequest.getVfModuleName());
+ }
+
+ @Test
+ public void test_buildRequestParams() throws Exception {
+ RequestClientParameter expected = new RequestClientParameter.Builder().setRequestId("requestId")
+ .setServiceInstanceId("serviceInstanceId").setVnfId("vnfId").setVfModuleId("vfModuleId")
+ .setALaCarte(true).setRequestDetails(mapper.writeValueAsString(createTestRequest()))
+ .setRequestAction(Action.deleteInstance.toString())
+ .setRequestUri("http://localhost:8080/serviceInstances").setApiVersion("v8").build();
+ RequestClientParameter actual = restHandler.buildRequestParams(createTestRequest(),
+ "http://localhost:8080/serviceInstances", "requestId", "serviceInstanceId", "vnfId", "vfModuleId");
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void test_createInfraActiveRequestForDelete() throws Exception {
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setRequestAction(Action.deleteInstance.toString());
+ expected.setAction(Action.deleteInstance.toString());
+ expected.setServiceInstanceId("serviceInstanceId");
+ expected.setVnfId("vnfId");
+ expected.setVfModuleId("vfModuleId");
+ expected.setRequestId("requestId");
+ expected.setRequestorId("userId");
+ expected.setSource("VID");
+ expected.setRequestStatus(Status.IN_PROGRESS.toString());
+ expected.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ expected.setRequestUrl("http://localhost:9090");
+ expected.setRequestScope(ModelType.vfModule.toString());
+ InfraActiveRequests actual = restHandler.createInfraActiveRequestForDelete("requestId", "vfModuleId",
+ "serviceInstanceId", "vnfId", "userId", "VID", "http://localhost:9090");
+ assertThat(actual, sameBeanAs(expected).ignoring("startTime"));
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).save(actual);
+ }
+
+ private ServiceInstancesRequest createTestRequest() {
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setInstanceName("instanceName");
+ requestDetails.setRequestInfo(requestInfo);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ private InfraActiveRequests createDatabaseRecord() {
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ return request;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java
new file mode 100644
index 0000000000..03725ec85b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java
@@ -0,0 +1,154 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.eq;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.ws.rs.container.ContainerRequestContext;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.apihandlerinfra.infra.rest.handler.VnfRestHandler;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+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.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfRestHandlerTest {
+
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
+ @InjectMocks
+ VnfRestHandler restHandler;
+
+ @Mock
+ ContainerRequestContext mockRequestContext;
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @Mock
+ private RequestsDbClient infraActiveRequestsClient;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void test_find_vnf_recipe() throws MalformedURLException, NoRecipeException {
+ ServiceRecipe expected = new ServiceRecipe();
+ expected.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ Recipe actual = restHandler.findVnfModuleRecipe("testModelId", ModelType.vnf.toString(),
+ Action.createInstance.toString());
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void test_checkDuplicateRequest() throws MalformedURLException, NoRecipeException {
+ ArgumentCaptor<HashMap> instanceIdCaptor = ArgumentCaptor.forClass(HashMap.class);
+ restHandler.checkDuplicateRequest("serviceInstanceId", "vnfId", "instanceName", "requestId");
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).checkInstanceNameDuplicate(
+ instanceIdCaptor.capture(), eq("instanceName"), eq(ModelType.vnf.toString()));
+ Map actualMap = instanceIdCaptor.getValue();
+ assertEquals("ServiceInstanceID should exist in map", "serviceInstanceId", actualMap.get("serviceInstanceId"));
+ assertEquals("VnfId should exit in map", "vnfId", actualMap.get("vnfInstanceId"));
+ }
+
+ @Test
+ public void test_saveInstanceName() throws MalformedURLException, NoRecipeException {
+ ServiceInstancesRequest request = createTestRequest();
+ InfraActiveRequests dbRequest = createDatabaseRecord();
+ restHandler.saveInstanceName(request, dbRequest);
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).updateInfraActiveRequests(dbRequest);
+ assertEquals("InstanceName Should Be Equal", "instanceName", dbRequest.getVnfName());
+ }
+
+ @Test
+ public void test_buildRequestParams() throws Exception {
+ RequestClientParameter expected = new RequestClientParameter.Builder().setRequestId("requestId")
+ .setServiceInstanceId("serviceInstanceId").setVnfId("vnfId").setALaCarte(true)
+ .setRequestDetails(mapper.writeValueAsString(createTestRequest()))
+ .setRequestAction(Action.deleteInstance.toString())
+ .setRequestUri("http://localhost:8080/serviceInstances").setApiVersion("v8").build();
+ RequestClientParameter actual = restHandler.buildRequestParams(createTestRequest(),
+ "http://localhost:8080/serviceInstances", "requestId", "serviceInstanceId", "vnfId");
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void test_createInfraActiveRequestForDelete() throws Exception {
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setRequestAction(Action.deleteInstance.toString());
+ expected.setAction(Action.deleteInstance.toString());
+ expected.setServiceInstanceId("serviceInstanceId");
+ expected.setVnfId("vnfId");
+ expected.setRequestId("requestId");
+ expected.setRequestorId("userId");
+ expected.setSource("VID");
+ expected.setRequestStatus(Status.IN_PROGRESS.toString());
+ expected.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ expected.setRequestUrl("http://localhost:9090");
+ expected.setRequestScope(ModelType.vnf.toString());
+ InfraActiveRequests actual = restHandler.createInfraActiveRequestForDelete("requestId", "serviceInstanceId",
+ "vnfId", "userId", "VID", "http://localhost:9090");
+ assertThat(actual, sameBeanAs(expected).ignoring("startTime"));
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).save(actual);
+ }
+
+ private ServiceInstancesRequest createTestRequest() {
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setInstanceName("instanceName");
+ requestDetails.setRequestInfo(requestInfo);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ private InfraActiveRequests createDatabaseRecord() {
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ return request;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java
new file mode 100644
index 0000000000..efa27743ef
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java
@@ -0,0 +1,145 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest.handler;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.eq;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.ws.rs.container.ContainerRequestContext;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandlerinfra.Action;
+import org.onap.so.apihandlerinfra.Constants;
+import org.onap.so.apihandlerinfra.infra.rest.exception.NoRecipeException;
+import org.onap.so.apihandlerinfra.infra.rest.handler.VolumeRestHandler;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class VolumeRestHandlerTest {
+
+ @Rule
+ public ExpectedException exceptionRule = ExpectedException.none();
+
+ @InjectMocks
+ VolumeRestHandler restHandler;
+
+ @Mock
+ ContainerRequestContext mockRequestContext;
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @Mock
+ private RequestsDbClient infraActiveRequestsClient;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void test_checkDuplicateRequest() throws MalformedURLException, NoRecipeException {
+ ArgumentCaptor<HashMap> instanceIdCaptor = ArgumentCaptor.forClass(HashMap.class);
+ restHandler.checkDuplicateRequest("serviceInstanceId", "vnfId", "volumeGroupId", "instanceName", "requestId");
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).checkInstanceNameDuplicate(
+ instanceIdCaptor.capture(), eq("instanceName"), eq(ModelType.volumeGroup.toString()));
+ Map actualMap = instanceIdCaptor.getValue();
+ assertEquals("ServiceInstanceID should exist in map", "serviceInstanceId", actualMap.get("serviceInstanceId"));
+ assertEquals("VnfId should exit in map", "vnfId", actualMap.get("vnfInstanceId"));
+ assertEquals("VolumeGroupId should exit in map", "volumeGroupId", actualMap.get("volumeGroupInstanceId"));
+ }
+
+ @Test
+ public void test_saveInstanceName() throws MalformedURLException, NoRecipeException {
+ ServiceInstancesRequest request = createTestRequest();
+ InfraActiveRequests dbRequest = createDatabaseRecord();
+ restHandler.saveInstanceName(request, dbRequest);
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).updateInfraActiveRequests(dbRequest);
+ assertEquals("InstanceName Should Be Equal", "instanceName", dbRequest.getVolumeGroupName());
+ }
+
+ @Test
+ public void test_buildRequestParams() throws Exception {
+ RequestClientParameter expected = new RequestClientParameter.Builder().setRequestId("requestId")
+ .setServiceInstanceId("serviceInstanceId").setVnfId("vnfId").setVolumeGroupId("volumeGroupId")
+ .setALaCarte(true).setRequestDetails(mapper.writeValueAsString(createTestRequest()))
+ .setRequestAction(Action.deleteInstance.toString())
+ .setRequestUri("http://localhost:8080/serviceInstances").setApiVersion("v8").build();
+ RequestClientParameter actual = restHandler.buildRequestParams(createTestRequest(),
+ "http://localhost:8080/serviceInstances", "requestId", "serviceInstanceId", "vnfId", "volumeGroupId");
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void test_createInfraActiveRequestForDelete() throws Exception {
+ InfraActiveRequests expected = new InfraActiveRequests();
+ expected.setRequestAction(Action.deleteInstance.toString());
+ expected.setAction(Action.deleteInstance.toString());
+ expected.setServiceInstanceId("serviceInstanceId");
+ expected.setVnfId("vnfId");
+ expected.setVolumeGroupId("volumeGroupId");
+ expected.setRequestId("requestId");
+ expected.setRequestorId("userId");
+ expected.setSource("VID");
+ expected.setRequestStatus(Status.IN_PROGRESS.toString());
+ expected.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ expected.setRequestScope(ModelType.volumeGroup.toString());
+ expected.setRequestUrl("http://localhost:9090");
+ InfraActiveRequests actual = restHandler.createInfraActiveRequestForDelete("requestId", "volumeGroupId",
+ "serviceInstanceId", "vnfId", "userId", "VID", "http://localhost:9090");
+ assertThat(actual, sameBeanAs(expected).ignoring("startTime"));
+ Mockito.verify(infraActiveRequestsClient, Mockito.times(1)).save(actual);
+ }
+
+ private ServiceInstancesRequest createTestRequest() {
+ ServiceInstancesRequest request = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setInstanceName("instanceName");
+ requestDetails.setRequestInfo(requestInfo);
+ request.setRequestDetails(requestDetails);
+ return request;
+ }
+
+ private InfraActiveRequests createDatabaseRecord() {
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId("requestId");
+ return request;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
index 9ae1e5b232..a74c11c08b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
@@ -35,9 +35,9 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.onap.so.apihandlerinfra.BaseTest;
-import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantIsolationRequest;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java
index 54da0baa92..93a19a9531 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java
@@ -25,15 +25,38 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.BaseTest;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import com.fasterxml.jackson.databind.ObjectMapper;
public class RelatedInstancesValidationTest extends BaseTest {
+ RelatedInstancesValidation validation = new RelatedInstancesValidation();
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ public ValidationInformation setupValidationInformation(String path) throws IOException {
+ String jsonInput = new String(Files.readAllBytes(Paths.get(path)));
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sir = mapper.readValue(jsonInput, ServiceInstancesRequest.class);
+ ValidationInformation info = new ValidationInformation(sir, null, Action.createInstance, 7, false,
+ sir.getRequestDetails().getRequestParameters());
+
+ info.setRequestScope("service");
+ sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+ sir.getRequestDetails().getModelInfo().setModelCustomizationName("name");
+
+ info.setRequestInfo(sir.getRequestDetails().getRequestInfo());
+ return info;
+ }
+
@Test
public void testCreateVnfNetworkInstanceGroup() throws IOException, ValidationException {
String requestJson = new String(Files.readAllBytes(
@@ -50,4 +73,64 @@ public class RelatedInstancesValidationTest extends BaseTest {
assertEquals(info.getVnfType(), "Test/name");
}
+
+ @Test
+ public void testCreateSIVpnBonding() throws IOException, ValidationException {
+ String requestJson = new String(Files.readAllBytes(
+ Paths.get("src/test/resources/MsoRequestTest/RelatedInstances/ServiceInstanceVpnBondingService.json")));
+ ObjectMapper mapper = new ObjectMapper();
+ ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class);
+ ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(),
+ Action.createInstance, 7, false, sir.getRequestDetails().getRequestParameters());
+ info.setRequestScope("service");
+ sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+ sir.getRequestDetails().getModelInfo().setModelCustomizationName("name");
+ RelatedInstancesValidation validation = new RelatedInstancesValidation();
+ validation.validate(info);
+ RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
+
+ assertEquals(info.getRequestScope(), "service");
+ assertEquals(instanceList[0].getRelatedInstance().getModelInfo().getModelType().toString(), "vpnBinding");
+ assertEquals(instanceList[1].getRelatedInstance().getModelInfo().getModelType().toString(), "network");
+ }
+
+ @Test
+ public void validateModelTypeExceptionTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage("No valid modelType in relatedInstance is specified");
+ validation.validate(
+ setupValidationInformation("src/test/resources/Validation/VpnBondingValidation/NoModelType.json"));
+ }
+
+ @Test
+ public void validateInstanceNameVpnBindingExceptionTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage("No valid instanceName in relatedInstance for vpnBinding modelType is specified");
+ validation.validate(setupValidationInformation(
+ "src/test/resources/Validation/VpnBondingValidation/NoInstanceNameVpnBinding.json"));
+ }
+
+ @Test
+ public void validateInstanceNameNetworkExceptionTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage("No valid instanceName in relatedInstance for network modelType is specified");
+ validation.validate(setupValidationInformation(
+ "src/test/resources/Validation/VpnBondingValidation/NoInstanceNameNetwork.json"));
+ }
+
+ @Test
+ public void validateInstanceIdExceptionTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage("No valid instanceId in relatedInstance is specified");
+ validation.validate(
+ setupValidationInformation("src/test/resources/Validation/VpnBondingValidation/NoInstanceId.json"));
+ }
+
+ @Test
+ public void validatemodelInvariantIdExceptionTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage("No valid modelInvariantId in relatedInstance is specified");
+ validation.validate(setupValidationInformation(
+ "src/test/resources/Validation/VpnBondingValidation/NoModelInvariantId.json"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/ServiceInstanceVpnBondingService.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/ServiceInstanceVpnBondingService.json
new file mode 100644
index 0000000000..573b7a3ebb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/ServiceInstanceVpnBondingService.json
@@ -0,0 +1,57 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21",
+ "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "test-mgr",
+ "lcpCloudRegionId": "abc1",
+ "tenantId": "19123c2924c648eb8e42a3c1f14b7682"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "TEST_123",
+ "subscriberName": "TEST_123"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "xxxxxx",
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "vpn-name",
+ "modelInfo": {
+ "modelType": "vpnBinding"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "network-name",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "subscriptionServiceType": "dev-service-type",
+ "aLaCarte": false
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json
new file mode 100644
index 0000000000..efd80f3347
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json
@@ -0,0 +1,48 @@
+[
+ {
+ "id":"Call_BBToExecute:c4f603e4-a26e-11e9-b144-0242ac14000b",
+ "parentActivityInstanceId":"c4c6b647-a26e-11e9-b144-0242ac14000b",
+ "activityId":"Call_BBToExecute",
+ "activityName":"BB to Execute",
+ "activityType":"callActivity",
+ "processDefinitionKey":"ExecuteBuildingBlock",
+ "processDefinitionId":"ExecuteBuildingBlock:1:a46566de-a26b-11e9-b144-0242ac14000b",
+ "processInstanceId":"c4c6b647-a26e-11e9-b144-0242ac14000b",
+ "executionId":"c4f603e3-a26e-11e9-b144-0242ac14000b",
+ "taskId":null,
+ "calledProcessInstanceId":"c4f603e6-a26e-11e9-b144-0242ac14000b",
+ "calledCaseInstanceId":null,
+ "assignee":null,
+ "startTime":"2019-07-09T17:27:04.607+0000",
+ "endTime":"2019-07-09T17:27:05.545+0000",
+ "durationInMillis":938,
+ "canceled":true,
+ "completeScope":false,
+ "tenantId":null,
+ "removalTime":null,
+ "rootProcessInstanceId":"c2fd4066-a26e-11e9-b144-0242ac14000b"
+ },
+ {
+ "id":"EndEvent_0mvmk3i:c59b1d39-a26e-11e9-b144-0242ac14000b",
+ "parentActivityInstanceId":"SubProcess_0tv8zda:c5852427-a26e-11e9-b144-0242ac14000b",
+ "activityId":"EndEvent_0mvmk3i",
+ "activityName":null,
+ "activityType":"noneEndEvent",
+ "processDefinitionKey":"ExecuteBuildingBlock",
+ "processDefinitionId":"ExecuteBuildingBlock:1:a46566de-a26b-11e9-b144-0242ac14000b",
+ "processInstanceId":"c4c6b647-a26e-11e9-b144-0242ac14000b",
+ "executionId":"c5852426-a26e-11e9-b144-0242ac14000b",
+ "taskId":null,
+ "calledProcessInstanceId":null,
+ "calledCaseInstanceId":null,
+ "assignee":null,
+ "startTime":"2019-07-09T17:27:05.689+0000",
+ "endTime":"2019-07-09T17:27:05.689+0000",
+ "durationInMillis":0,
+ "canceled":false,
+ "completeScope":true,
+ "tenantId":null,
+ "removalTime":null,
+ "rootProcessInstanceId":"c2fd4066-a26e-11e9-b144-0242ac14000b"
+ }
+ ] \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
index 3b2eca7ce2..96fed36d45 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
@@ -61,7 +61,7 @@
},
"requestStatus": {
"requestState": "COMPLETE",
- "statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. ROLLBACK STATUS: Rollback has been completed successfully.",
+ "statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. TASK INFORMATION: Last task executed: BB to Execute ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress": 100,
"timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
index 90089c0c7e..801841313a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
@@ -34,7 +34,7 @@
},
{
"request":{
- "requestId":"00032ab7-na18-42e5-965d-8ea592502018",
+ "requestId":"00032ab7-1a18-42e5-965d-8ea592502018",
"requestScope":"vfModule",
"requestType":"deleteInstance",
"requestDetails":{
@@ -58,7 +58,7 @@
},
"requestStatus":{
"requestState":"PENDING",
- "statusMessage":"FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
+ "statusMessage":"FLOW STATUS: Building blocks 1 of 3 completed. TASK INFORMATION: Last task executed: BB to Execute RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress":0,
"timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
@@ -298,7 +298,7 @@
},
{
"request":{
- "requestId":"00032ab7-na18-42e5-965d-8ea592502018",
+ "requestId":"00032ab7-1a18-42e5-965d-8ea592502018",
"requestScope":"instanceGroup",
"requestType":"addMembers",
"requestDetails":{
@@ -321,7 +321,7 @@
},
"requestStatus":{
"requestState":"PENDING",
- "statusMessage":"STATUS: Adding members. FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
+ "statusMessage":"STATUS: Adding members. FLOW STATUS: Building blocks 1 of 3 completed. TASK INFORMATION: Last task executed: BB to Execute RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress":0,
"timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/ProcessInstanceHistoryResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/ProcessInstanceHistoryResponse.json
new file mode 100644
index 0000000000..faa283463b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/ProcessInstanceHistoryResponse.json
@@ -0,0 +1,44 @@
+[
+ {
+ "id":"c2fd4066-a26e-11e9-b144-0242ac14000b",
+ "businessKey":"84eacc7b-b046-4333-9272-5e8513bdd4cc",
+ "processDefinitionId":"WorkflowActionBB:1:a461210d-a26b-11e9-b144-0242ac14000b",
+ "processDefinitionKey":"WorkflowActionBB",
+ "processDefinitionName":"WorkflowActionBB",
+ "processDefinitionVersion":1,
+ "startTime":"2019-07-09T17:27:01.299+0000",
+ "endTime":"2019-07-09T17:27:06.585+0000",
+ "removalTime":null,
+ "durationInMillis":5286,
+ "startUserId":null,
+ "startActivityId":"Start_WorkflowActionBB",
+ "deleteReason":null,
+ "rootProcessInstanceId":"c2fd4066-a26e-11e9-b144-0242ac14000b",
+ "superProcessInstanceId":null,
+ "superCaseInstanceId":null,
+ "caseInstanceId":null,
+ "tenantId":null,
+ "state":"COMPLETED"
+ },
+ {
+ "id":"c4c6b647-a26e-11e9-b144-0242ac14000b",
+ "businessKey":null,
+ "processDefinitionId":"ExecuteBuildingBlock:1:a46566de-a26b-11e9-b144-0242ac14000b",
+ "processDefinitionKey":"ExecuteBuildingBlock",
+ "processDefinitionName":"ExecuteBuildingBlock",
+ "processDefinitionVersion":1,
+ "startTime":"2019-07-09T17:27:04.298+0000",
+ "endTime":"2019-07-09T17:27:05.690+0000",
+ "removalTime":null,
+ "durationInMillis":1392,
+ "startUserId":null,
+ "startActivityId":"Start_ExecuteBuildingBlock",
+ "deleteReason":null,
+ "rootProcessInstanceId":"c2fd4066-a26e-11e9-b144-0242ac14000b",
+ "superProcessInstanceId":"c2fd4066-a26e-11e9-b144-0242ac14000b",
+ "superCaseInstanceId":null,
+ "caseInstanceId":null,
+ "tenantId":null,
+ "state":"COMPLETED"
+ }
+ ] \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationOpenstackRequestDetails.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationOpenstackRequestDetails.json
new file mode 100644
index 0000000000..41d7e4d706
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationOpenstackRequestDetails.json
@@ -0,0 +1,62 @@
+{
+ "clientRequestId": "00032ab7-3fb3-42e5-965d-8ea592502016",
+ "action": "deleteInstance",
+ "requestStatus": "COMPLETE",
+ "statusMessage": "Vf Module has been deleted successfully.",
+ "progress": 100,
+ "startTime": "2016-12-22T13:29:54.000+0000",
+ "endTime": "2016-12-22T13:30:28.000+0000",
+ "source": "VID",
+ "vnfId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005",
+ "vnfName": null,
+ "vnfType": null,
+ "serviceType": null,
+ "aicNodeClli": null,
+ "tenantId": "6accefef3cb442ff9e644d589fb04107",
+ "provStatus": null,
+ "vnfParams": null,
+ "vnfOutputs": null,
+ "requestBody": "{\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"test::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"n6\"}}",
+ "responseBody": null,
+ "lastModifiedBy": "BPMN",
+ "modifyTime": "2016-12-22T13:30:28.000+0000",
+ "requestType": null,
+ "volumeGroupId": null,
+ "volumeGroupName": null,
+ "vfModuleId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992",
+ "vfModuleName": null,
+ "vfModuleModelName": "test::base::module-0",
+ "aaiServiceId": null,
+ "aicCloudRegion": "n6",
+ "callBackUrl": null,
+ "correlator": null,
+ "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc",
+ "serviceInstanceName": null,
+ "requestScope": "vfModule",
+ "requestAction": "deleteInstance",
+ "networkId": null,
+ "networkName": null,
+ "networkType": null,
+ "requestorId": null,
+ "configurationId": null,
+ "configurationName": null,
+ "operationalEnvId": null,
+ "operationalEnvName": null,
+ "cloudApiRequests":[
+ {
+ "id": 1,
+ "cloudIdentifier": "heatstackName/123123",
+ "requestBody":"{\r\n \"test\": \"00032ab7-3fb3-42e5-965d-8ea592502016\",\r\n \"test2\": \"deleteInstance\",\r\n \"test3\": \"COMPLETE\",\r\n \"test4\": \"Vf Module has been deleted successfully.\",\r\n \"test5\": 100\r\n}",
+ "created": "2016-12-22T13:29:54.000+0000"
+ }
+ ],
+ "requestURI": "00032ab7-3fb3-42e5-965d-8ea592502017",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8087/infraActiveRequests/00032ab7-3fb3-42e5-965d-8ea592502017"
+ },
+ "infraActiveRequests": {
+ "href": "http://localhost:8087/infraActiveRequests/00032ab7-3fb3-42e5-965d-8ea592502017"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/ALaCarteNull.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/ALaCarteNull.json
new file mode 100644
index 0000000000..5da139e711
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/ALaCarteNull.json
@@ -0,0 +1,13 @@
+{
+ "requestDetails":{
+ "requestInfo":{
+ "source":"VID",
+ "requestorId":"xxxxxx",
+ "instanceName":"testService",
+ "productFamilyId":"test"
+ },
+ "requestParameters":{
+ "usePreload": "false"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBody.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBody.json
new file mode 100644
index 0000000000..d6406338a0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBody.json
@@ -0,0 +1,19 @@
+{
+ "requestDetails":{
+ "modelInfo":{
+ "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7965",
+ "modelVersion": "1.0",
+ "modelType":"service",
+ "modelName":"serviceModel"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "requestorId":"xxxxxx",
+ "instanceName":"testService",
+ "productFamilyId":"test"
+ },
+ "requestParameters":{
+ "aLaCarte":"false"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBodyNewRequestorId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBodyNewRequestorId.json
new file mode 100644
index 0000000000..740d4e2ec2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ResumeOrchestrationRequest/RequestBodyNewRequestorId.json
@@ -0,0 +1,19 @@
+{
+ "requestDetails":{
+ "modelInfo":{
+ "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7965",
+ "modelVersion": "1.0",
+ "modelType":"service",
+ "modelName":"serviceModel"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "requestorId":"yyyyyy",
+ "instanceName":"testService",
+ "productFamilyId":"test"
+ },
+ "requestParameters":{
+ "aLaCarte":"false"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json
new file mode 100644
index 0000000000..6c59ec5f1f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json
@@ -0,0 +1,21 @@
+{
+ "requestDetails": {
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": "xxxxxx",
+ "instanceName": "inPlaceSoftwareUpdateTest"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestParameters": {
+ "payload": "{\"request-parameters\":{\"host-ip-address\":\"10.10.10.10\"},\"configuration-parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}",
+ "userParams": [{
+ "name": "vnf-id",
+ "value": "4603ad6d-dbfb-4899-a8bd-bc1dd0d74914"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleRetainAssignments.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleRetainAssignments.json
new file mode 100644
index 0000000000..166f7ccce8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleRetainAssignments.json
@@ -0,0 +1,33 @@
+{
+ "requestDetails": {
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": "xxxxxx",
+ "instanceName": "testService60"
+ },
+ "requestParameters": {
+ "aLaCarte": true,
+ "autoBuildVfModules": false,
+ "retainAssignments": true,
+ "subscriptionServiceType": "test"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "modelInfo":{
+ "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7968",
+ "modelVersion":"2",
+ "modelVersionId":"78ca26d0-246d-11e7-93ae-92361f002671",
+ "modelType":"vfModule",
+ "modelName":"serviceModel",
+ "modelCustomizationId": "a7f1d08e-b02d-11e6-80f5-76304dec7eb7"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "MSO_1610_dev",
+ "subscriberName": "MSO_1610_dev"
+ }
+ }
+}
+
+ \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json
new file mode 100644
index 0000000000..a6aa3e1c25
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json
@@ -0,0 +1,33 @@
+{
+ "serviceInstanceId":"1882939",
+ "vnfInstanceId":"1882938",
+ "networkInstanceId":"1882937",
+ "volumeGroupInstanceId":"1882935",
+ "vfModuleInstanceId":"1882934",
+ "requestDetails": {
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": "xxxxxx",
+ "instanceName": "testService9"
+ },
+ "requestParameters": {
+ "aLaCarte": true,
+ "autoBuildVfModules": false,
+ "subscriptionServiceType": "test",
+ "disableOwningEntityProject": true
+ },
+ "modelInfo":{
+ "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7965",
+ "modelVersion":"1",
+ "modelVersionId":"10",
+ "modelType":"service",
+ "modelName":"serviceModel",
+ "modelInstanceName":"modelInstanceName",
+ "modelCustomizationId":"f7ce78bb-423b-11e7-93f8-0050569a796"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "someTestId",
+ "subscriberName": "someTestId"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceVpnBondingService.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceVpnBondingService.json
new file mode 100644
index 0000000000..573b7a3ebb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceVpnBondingService.json
@@ -0,0 +1,57 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21",
+ "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "test-mgr",
+ "lcpCloudRegionId": "abc1",
+ "tenantId": "19123c2924c648eb8e42a3c1f14b7682"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "TEST_123",
+ "subscriberName": "TEST_123"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "xxxxxx",
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "vpn-name",
+ "modelInfo": {
+ "modelType": "vpnBinding"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "network-name",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "subscriptionServiceType": "dev-service-type",
+ "aLaCarte": false
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceId.json
new file mode 100644
index 0000000000..97e480c8d8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceId.json
@@ -0,0 +1,56 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21",
+ "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "test-mgr",
+ "lcpCloudRegionId": "abc1",
+ "tenantId": "19123c2924c648eb8e42a3c1f14b7682"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "TEST_123",
+ "subscriberName": "TEST_123"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "xxxxxx",
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceName": "vpn-name",
+ "modelInfo": {
+ "modelType": "vpnBinding"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "network-name",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "subscriptionServiceType": "dev-service-type",
+ "aLaCarte": false
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceNameNetwork.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceNameNetwork.json
new file mode 100644
index 0000000000..f7ba4761b6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceNameNetwork.json
@@ -0,0 +1,56 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21",
+ "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "test-mgr",
+ "lcpCloudRegionId": "abc1",
+ "tenantId": "19123c2924c648eb8e42a3c1f14b7682"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "TEST_123",
+ "subscriberName": "TEST_123"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "xxxxxx",
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "vpn-name",
+ "modelInfo": {
+ "modelType": "vpnBinding"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "subscriptionServiceType": "dev-service-type",
+ "aLaCarte": false
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceNameVpnBinding.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceNameVpnBinding.json
new file mode 100644
index 0000000000..ac570b3830
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoInstanceNameVpnBinding.json
@@ -0,0 +1,56 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21",
+ "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "test-mgr",
+ "lcpCloudRegionId": "abc1",
+ "tenantId": "19123c2924c648eb8e42a3c1f14b7682"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "TEST_123",
+ "subscriberName": "TEST_123"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "xxxxxx",
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "modelInfo": {
+ "modelType": "vpnBinding"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "network-name",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "subscriptionServiceType": "dev-service-type",
+ "aLaCarte": false
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoModelInvariantId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoModelInvariantId.json
new file mode 100644
index 0000000000..ca02c5371a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoModelInvariantId.json
@@ -0,0 +1,57 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21",
+ "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "test-mgr",
+ "lcpCloudRegionId": "abc1",
+ "tenantId": "19123c2924c648eb8e42a3c1f14b7682"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "TEST_123",
+ "subscriberName": "TEST_123"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "xxxxxx",
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "vpn-name",
+ "modelInfo": {
+ "modelType": "vnf"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "network-name",
+ "modelInfo": {
+ "modelType": "service"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "subscriptionServiceType": "dev-service-type",
+ "aLaCarte": false
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoModelType.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoModelType.json
new file mode 100644
index 0000000000..1d46ce2ccd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/VpnBondingValidation/NoModelType.json
@@ -0,0 +1,56 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21",
+ "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb",
+ "modelName": "Test",
+ "modelVersion": "1.0"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "test-mgr",
+ "lcpCloudRegionId": "abc1",
+ "tenantId": "19123c2924c648eb8e42a3c1f14b7682"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "projectName"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "TEST_123",
+ "subscriberName": "TEST_123"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "xxxxxx",
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "vpn-name",
+ "modelInfo": {
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceName": "network-name",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "subscriptionServiceType": "dev-service-type",
+ "aLaCarte": false
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedServiceRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedServiceRequest.json
new file mode 100644
index 0000000000..3ad3d1efec
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedServiceRequest.json
@@ -0,0 +1,20 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelVersionId": "bad955c3-29b2-4a27-932e-28e942cc6480",
+ "modelUuid": "bad955c3-29b2-4a27-932e-28e942cc6480"
+ },
+ "requestInfo": {
+ "instanceName": "Robot_SI_For_VolumeGroup",
+ "suppressRollback": false
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "GR_API"
+ },
+ "instanceName": [],
+ "configurationParameters": []
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVfModuleRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVfModuleRequest.json
new file mode 100644
index 0000000000..9670c3b645
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVfModuleRequest.json
@@ -0,0 +1,25 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelCustomizationUuid": "074c64d0-7e13-4bcc-8bdb-ea922331102d",
+ "modelCustomizationId": "074c64d0-7e13-4bcc-8bdb-ea922331102d"
+ },
+ "requestInfo": {
+ "instanceName": "dummy_id",
+ "suppressRollback": false
+ },
+ "cloudConfiguration": {
+ "tenantId": "0422ffb57ba042c0800a29dc85ca70f8",
+ "cloudOwner": "cloudOwner",
+ "lcpCloudRegionId": "regionOne"
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "GR_API"
+ },
+ "instanceName": [],
+ "configurationParameters": []
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVnfRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVnfRequest.json
new file mode 100644
index 0000000000..59602f7ac2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVnfRequest.json
@@ -0,0 +1,20 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelCustomizationUuid": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade",
+ "modelCustomizationId": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade"
+ },
+ "requestInfo": {
+ "instanceName": "Robot_VNF_For_Volume_Group",
+ "suppressRollback": false
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "GR_API"
+ },
+ "instanceName": [],
+ "configurationParameters": []
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVolumeGroupRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVolumeGroupRequest.json
new file mode 100644
index 0000000000..ec7acf1e41
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ExpectedVolumeGroupRequest.json
@@ -0,0 +1,25 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "volumeGroup",
+ "modelCustomizationUuid": "e38906fa-717c-49b0-b391-e6ec12b50c4a",
+ "modelCustomizationId": "e38906fa-717c-49b0-b391-e6ec12b50c4a"
+ },
+ "requestInfo": {
+ "instanceName": "VolumeGroup",
+ "suppressRollback": false
+ },
+ "cloudConfiguration": {
+ "tenantId": "0422ffb57ba042c0800a29dc85ca70f8",
+ "cloudOwner": "cloudOwner",
+ "lcpCloudRegionId": "regionOne"
+ },
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true,
+ "testApi": "GR_API"
+ },
+ "instanceName": [],
+ "configurationParameters": []
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ServiceInstance.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ServiceInstance.json
new file mode 100644
index 0000000000..7d7a103123
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/ServiceInstance.json
@@ -0,0 +1,35 @@
+{
+ "service-instance-id": "e9fbfab4-d91c-4508-a429-2046c8751371",
+ "service-instance-name": "Robot_SI_For_VolumeGroup",
+ "environment-context": "General_Revenue-Bearing",
+ "model-invariant-id": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b",
+ "model-version-id": "bad955c3-29b2-4a27-932e-28e942cc6480",
+ "resource-version": "1560538276937",
+ "orchestration-status": "Active",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "project",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v15/business/projects/project/GR_API_OE_MSO_Test200",
+ "relationship-data": [
+ {
+ "relationship-key": "project.project-name",
+ "relationship-value": "GR_API_OE_MSO_Test200"
+ }
+ ]
+ },
+ {
+ "related-to": "owning-entity",
+ "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+ "related-link": "/aai/v15/business/owning-entities/owning-entity/c3f57fa8-ac7d-11e8-98d0-529269fb1459",
+ "relationship-data": [
+ {
+ "relationship-key": "owning-entity.owning-entity-id",
+ "relationship-value": "c3f57fa8-ac7d-11e8-98d0-529269fb1459"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VfModule.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VfModule.json
new file mode 100644
index 0000000000..cfd9eb3e3c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VfModule.json
@@ -0,0 +1,37 @@
+{
+ "vf-module-id": "b70060b7-0031-4065-9462-3cd5b753d2db",
+ "vf-module-name": "dummy_id",
+ "heat-stack-id": "dummy_id/stackId",
+ "orchestration-status": "Active",
+ "is-base-vf-module": true,
+ "automated-assignment": false,
+ "resource-version": "1560538368229",
+ "model-invariant-id": "f7a867f2-596b-4f4a-a128-421e825a6190",
+ "model-version-id": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46",
+ "model-customization-id": "074c64d0-7e13-4bcc-8bdb-ea922331102d",
+ "module-index": 0,
+ "selflink": "/sim/restconf/config/GENERIC-RESOURCE-API:services/service/e9fbfab4-d91c-4508-a429-2046c8751371/service-data/vnfs/vnf/829924cc-8932-4875-b0af-d7a02799da9a/vnf-data//vf-modules/vf-module/dummy_id/vf-module-data/vf-module-topology/",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "volume-group",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/volume-groups/volume-group/18b220c8-af84-4b82-a8c0-41bbea6328a6",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "regionOne"
+ },
+ {
+ "relationship-key": "volume-group.volume-group-id",
+ "relationship-value": "18b220c8-af84-4b82-a8c0-41bbea6328a6"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json
new file mode 100644
index 0000000000..0b03f56caa
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json
@@ -0,0 +1,131 @@
+{
+ "vnf-id": "829924cc-8932-4875-b0af-d7a02799da9a",
+ "vnf-name": "Robot_VNF_For_Volume_Group",
+ "vnf-type": "Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0",
+ "service-id": "06f76284-8710-11e6-ae22-56b6b6499611",
+ "prov-status": "PREPROV",
+ "orchestration-status": "Active",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1560538316260",
+ "model-invariant-id": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "model-version-id": "d326f424-2312-4dd6-b7fe-364fadbd1ef5",
+ "model-customization-id": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade",
+ "selflink": "/sim/restconf/config/GENERIC-RESOURCE-API:services/service/e9fbfab4-d91c-4508-a429-2046c8751371/service-data/vnfs/vnf/829924cc-8932-4875-b0af-d7a02799da9a/vnf-data/vnf-topology/",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v15/business/customers/customer/Robot_Test_Subscriber_ID/service-subscriptions/service-subscription/Robot_Test_Service_Type/service-instances/service-instance/e9fbfab4-d91c-4508-a429-2046c8751371",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "Robot_Test_Subscriber_ID"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "Robot_Test_Service_Type"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "e9fbfab4-d91c-4508-a429-2046c8751371"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "Robot_SI_For_VolumeGroup"
+ }
+ ]
+ },
+ {
+ "related-to": "platform",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v15/business/platforms/platform/vSAMP12_14-2XXX-Aug18-9001%20-%20Platform",
+ "relationship-data": [
+ {
+ "relationship-key": "platform.platform-name",
+ "relationship-value": "vSAMP12_14-2XXX-Aug18-9001 - Platform"
+ }
+ ]
+ },
+ {
+ "related-to": "line-of-business",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v15/business/lines-of-business/line-of-business/vSAMP12_14-2XXX-Aug18-9001%20-%20LOB",
+ "relationship-data": [
+ {
+ "relationship-key": "line-of-business.line-of-business-name",
+ "relationship-value": "vSAMP12_14-2XXX-Aug18-9001 - LOB"
+ }
+ ]
+ },
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+ "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "regionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "tenantName"
+ }
+ ]
+ },
+ {
+ "related-to": "volume-group",
+ "relationship-label": "org.onap.relationships.inventory.DependsOn",
+ "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/volume-groups/volume-group/volumeGroupId",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "regionOne"
+ },
+ {
+ "relationship-key": "volume-group.volume-group-id",
+ "relationship-value": "volumeGroupId"
+ }
+ ]
+ },
+ {
+ "related-to": "cloud-region",
+ "relationship-label": "org.onap.relationships.inventory.LocatedIn",
+ "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "regionOne"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "LCP"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VolumeGroup.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VolumeGroup.json
new file mode 100644
index 0000000000..328b82ed55
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VolumeGroup.json
@@ -0,0 +1,56 @@
+{
+ "volume-group-id": "5e6bca5b-8e14-4bdd-a419-820f68019b19",
+ "volume-group-name": "VolumeGroup",
+ "heat-stack-id": "VolumeGroup/stackId",
+ "vnf-type": "Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0",
+ "orchestration-status": "Active",
+ "model-customization-id": "e38906fa-717c-49b0-b391-e6ec12b50c4a",
+ "vf-module-model-customization-id": "e38906fa-717c-49b0-b391-e6ec12b50c4a",
+ "resource-version": "1560526466219",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.DependsOn",
+ "related-link": "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloudOwner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "regionOne"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "tenantName"
+ }
+ ]
+ },
+ {
+ "related-to": "generic-vnf",
+ "relationship-label": "org.onap.relationships.inventory.DependsOn",
+ "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/82035634-1878-4fd9-ab14-04b819bea24b",
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "82035634-1878-4fd9-ab14-04b819bea24b"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "Robot_VNF_For_Volume_Group"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
index 712fbf54ca..27e1ae90d2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
@@ -9,14 +9,20 @@ server:
mso:
health:
endpoints:
- catalogdb: http://localhost:${wiremock.server.port}
- requestdb: http://localhost:${wiremock.server.port}
- sdnc: http://localhost:${wiremock.server.port}
- openstack: http://localhost:${wiremock.server.port}
- bpmn: http://localhost:${wiremock.server.port}
- asdc: http://localhost:${wiremock.server.port}
- requestdbattsvc: http://localhost:${wiremock.server.port}
-
+ - subsystem: apih
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: asdc
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: bpmn
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: catalogdb
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: openstack
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: requestdb
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: sdnc
+ uri: http://localhost:${wiremock.server.port}
infra-requests:
archived:
period: 180
@@ -83,6 +89,8 @@ mso:
spring:
+ jersey:
+ type: filter
datasource:
jdbcUrl: jdbc:mariadb://localhost:3307/catalogdb
username: root
@@ -97,11 +105,10 @@ spring:
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
enable-lazy-load-no-trans: true
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
- jersey:
- type: filter
+
security:
usercredentials:
- -
+ -
username: test
password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
role: InfraPortal-Client
@@ -117,7 +124,13 @@ mariaDB4j:
port: 3307
databaseName: catalogdb
databaseName2: requestdb
-
+#Actuator
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
org:
onap:
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index bc9003f5d0..ee53e491a4 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
@@ -806,6 +806,9 @@ CREATE TABLE `service` (
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_ORDER` varchar(200) default NULL,
+ `OVERALL_DISTRIBUTION_STATUS` varchar(45),
+ `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL,
+ `NAMING_POLICY` varchar(200) DEFAULT NULL,
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -1108,6 +1111,8 @@ CREATE TABLE `vnf_resource_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
+ `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
@@ -1134,6 +1139,8 @@ CREATE TABLE `vnfc_customization` (
`MODEL_NAME` varchar(200) NOT NULL,
`TOSCA_NODE_TYPE` varchar(200) NOT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
+ `VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID` integer DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -1284,7 +1291,10 @@ CREATE TABLE `infra_active_requests` (
`CONFIGURATION_NAME` varchar(200) DEFAULT NULL,
`OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL,
`OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL,
- `REQUEST_URL` varchar(500) DEFAULT NULL,
+ `REQUEST_URL` varchar(500) DEFAULT NULL,
+ `ORIGINAL_REQUEST_ID` varchar(45) DEFAULT NULL,
+ `EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
+ `ROLLBACK_EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
PRIMARY KEY (`REQUEST_ID`),
UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d5ak` (`CLIENT_REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -1460,6 +1470,16 @@ create table if not exists model (
FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE IF NOT EXISTS `requestdb`.`cloud_api_requests` (
+`ID` INT(13) NOT NULL AUTO_INCREMENT,
+`REQUEST_BODY` LONGTEXT NOT NULL,
+`CLOUD_IDENTIFIER` VARCHAR(200) NULL,
+`SO_REQUEST_ID` VARCHAR(45) NOT NULL,
+`CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`ID`),
+INDEX `fk_cloud_api_requests__so_request_id_idx` (`SO_REQUEST_ID` ASC))
+ENGINE = InnoDB DEFAULT CHARSET=latin1;
+
CREATE TABLE IF NOT EXISTS `workflow` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ARTIFACT_UUID` varchar(200) NOT NULL,
@@ -1477,8 +1497,3 @@ CREATE TABLE IF NOT EXISTS `workflow` (
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_workflow` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`SOURCE`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-
-
-
-
diff --git a/mso-api-handlers/mso-requests-db-repositories/pom.xml b/mso-api-handlers/mso-requests-db-repositories/pom.xml
index f890dabedd..4dbf22cd87 100644
--- a/mso-api-handlers/mso-requests-db-repositories/pom.xml
+++ b/mso-api-handlers/mso-requests-db-repositories/pom.xml
@@ -30,7 +30,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
- <optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/configuration/ExposeEntityIdResourceConfiguration.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/configuration/ExposeEntityIdResourceConfiguration.java
new file mode 100644
index 0000000000..575e5ff347
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/configuration/ExposeEntityIdResourceConfiguration.java
@@ -0,0 +1,21 @@
+package org.onap.so.db.request.configuration;
+
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
+import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ExposeEntityIdResourceConfiguration extends RepositoryRestConfigurerAdapter {
+
+ /**
+ * Spring Data Rest hides the ID by default, in order to have it in the JSON you have to manually configure that for
+ * your entity
+ *
+ * @param config
+ */
+ @Override
+ public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
+ config.exposeIdsFor(RequestProcessingData.class);
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
index 8657892c34..8566afe9e1 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
@@ -20,12 +20,16 @@
package org.onap.so.db.request.data.repository;
+import java.util.List;
import org.onap.so.db.request.beans.ArchivedInfraRequests;
+import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-import org.springframework.stereotype.Repository;
@RepositoryRestResource(collectionResourceRel = "archivedInfraRequests", path = "archivedInfraRequests")
public interface ArchivedInfraRequestsRepository extends JpaRepository<ArchivedInfraRequests, String> {
+ List<InfraActiveRequests> findByActionAndRequestStatusAndVfModuleId(String action, String requestStatus,
+ String vfModuleId);
+
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
index 29be0ddc00..a14699827d 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java
@@ -37,6 +37,9 @@ public interface InfraActiveRequestsRepository
InfraActiveRequests findOneByRequestIdOrClientRequestIdAndRequestType(String requestId, String clientRequestId,
String requestType);
+ List<InfraActiveRequests> findByActionAndRequestStatusAndVfModuleId(String action, String requestStatus,
+ String vfModuleId);
+
InfraActiveRequests findOneByRequestId(String string);
InfraActiveRequests findOneByRequestBody(String requestBody);
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
index 47f8c6b50e..5a8e2e2f6c 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java
@@ -33,7 +33,7 @@ public interface InfraActiveRequestsRepositoryCustom {
public InfraActiveRequests getRequestFromInfraActive(String requestId);
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ public InfraActiveRequests checkInstanceNameDuplicate(Map<String, String> instanceIdMap, String instanceName,
String requestScope);
public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap);
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
index b3d57b0137..9cf71538b1 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -89,9 +89,11 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
protected static final String REQUEST_ID = "requestId";
protected static final String REQUESTOR_ID = "requestorId";
protected static final String ACTION = "action";
+ protected static final String OPENV = "operationalEnvironment";
private static final List<String> VALID_COLUMNS =
- Arrays.asList(REQUEST_ID, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, ACTION, REQUEST_STATUS);
+ Arrays.asList(REQUEST_ID, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, ACTION, REQUEST_STATUS,
+ VFMODULE_INSTANCE_ID, VNF_INSTANCE_ID, NETWORK_INSTANCE_ID, VOLUME_GROUP_INSTANCE_ID);
/*
@@ -115,14 +117,11 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
final long startTime = System.currentTimeMillis();
logger.debug("Execute query on infra active request table");
- List<InfraActiveRequests> results = new ArrayList<InfraActiveRequests>();
-
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
crit.where(cb.and(predicates.toArray(new Predicate[0])));
crit.orderBy(order);
- results = entityManager.createQuery(crit).getResultList();
- return results;
+ return entityManager.createQuery(crit).getResultList();
}
/*
@@ -150,7 +149,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
* java.lang.String, java.lang.String)
*/
@Override
- public InfraActiveRequests checkInstanceNameDuplicate(final HashMap<String, String> instanceIdMap,
+ public InfraActiveRequests checkInstanceNameDuplicate(final Map<String, String> instanceIdMap,
final String instanceName, final String requestScope) {
final List<Predicate> predicates = new LinkedList<>();
@@ -173,13 +172,13 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
predicates.add(cb.equal(tableRoot.get(NETWORK_INSTANCE_NAME), instanceName));
} else if (requestScope.equals("configuration")) {
predicates.add(cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_NAME), instanceName));
- } else if (requestScope.equals("operationalEnvironment")) {
+ } else if (requestScope.equals(OPENV)) {
predicates.add(cb.equal(tableRoot.get(OPERATIONAL_ENV_NAME), instanceName));
}
} else {
if (instanceIdMap != null) {
- if ("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null) {
+ if ("service".equals(requestScope) && instanceIdMap.get(SERVICE_INSTANCE_ID) != null) {
predicates
.add(cb.equal(tableRoot.get(SERVICE_INSTANCE_ID), instanceIdMap.get("serviceInstanceId")));
}
@@ -208,8 +207,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
instanceIdMap.get("configurationInstanceId")));
}
- if (requestScope.equals("operationalEnvironment")
- && instanceIdMap.get("operationalEnvironmentId") != null) {
+ if (requestScope.equals(OPENV) && instanceIdMap.get("operationalEnvironmentId") != null) {
predicates.add(
cb.equal(tableRoot.get(OPERATIONAL_ENV_ID), instanceIdMap.get("operationalEnvironmentId")));
}
@@ -336,7 +334,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
// as the same requestorId can also match on different API methods
final String resourceType = orchestrationMap.get("resourceType");
if (resourceType == null) {
- predicates.add(cb.equal(tableRoot.get("requestScope"), "operationalEnvironment"));
+ predicates.add(cb.equal(tableRoot.get("requestScope"), OPENV));
}
for (final Map.Entry<String, String> entry : orchestrationMap.entrySet()) {
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java
index b1abda3b6f..708171366d 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.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,5 +31,14 @@ public interface RequestProcessingDataRepository extends JpaRepository<RequestPr
RequestProcessingData findOneBySoRequestIdAndGroupingIdAndNameAndTag(@Param("SO_REQUEST_ID") String soRequestId,
@Param("GROUPING_ID") String groupingId, @Param("NAME") String name, @Param("TAG") String tag);
+ RequestProcessingData findOneBySoRequestIdAndGroupingIdAndName(@Param("SO_REQUEST_ID") String soRequestId,
+ @Param("GROUPING_ID") String groupingId, @Param("NAME") String name);
+
+ RequestProcessingData findOneBySoRequestIdAndName(@Param("SO_REQUEST_ID") String soRequestId,
+ @Param("NAME") String name);
+
List<RequestProcessingData> findBySoRequestIdOrderByGroupingIdDesc(@Param("SO_REQUEST_ID") String soRequestId);
+
+ List<RequestProcessingData> findByGroupingIdAndNameAndTag(@Param("GROUPING_ID") String groupingId,
+ @Param("NAME") String name, @Param("TAG") String tag);
}
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 2bd9936b3a..192e6d55b6 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
@@ -1,5 +1,5 @@
-create table ACTIVATE_OPERATIONAL_ENV_SERVICE_MODEL_DISTRIBUTION_STATUS (
+create table IF NOT EXISTS ACTIVATE_OPERATIONAL_ENV_SERVICE_MODEL_DISTRIBUTION_STATUS (
REQUEST_ID varchar(255) not null,
OPERATIONAL_ENV_ID varchar(255) not null,
SERVICE_MODEL_VERSION_ID varchar(255) not null,
@@ -13,7 +13,7 @@ create table ACTIVATE_OPERATIONAL_ENV_SERVICE_MODEL_DISTRIBUTION_STATUS (
primary key (REQUEST_ID,OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID)
);
-create table OPERATION_STATUS (
+create table IF NOT EXISTS OPERATION_STATUS (
SERVICE_ID varchar(255) not null,
OPERATION_ID varchar(255) not null,
SERVICE_NAME varchar(255),
@@ -46,7 +46,7 @@ INSERT INTO PUBLIC.OPERATION_STATUS(SERVICE_ID, OPERATION_ID, OPERATION_TYPE, US
primary key (SERVICE_ID,OPERATION_ID,RESOURCE_TEMPLATE_UUID)
);
-CREATE CACHED TABLE PUBLIC.INFRA_ACTIVE_REQUESTS(
+CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS(
REQUEST_ID VARCHAR NOT NULL SELECTIVITY 100,
CLIENT_REQUEST_ID VARCHAR SELECTIVITY 6,
ACTION VARCHAR SELECTIVITY 1,
@@ -96,7 +96,10 @@ CREATE CACHED TABLE PUBLIC.INFRA_ACTIVE_REQUESTS(
OPERATIONAL_ENV_NAME VARCHAR SELECTIVITY 1,
INSTANCE_GROUP_ID VARCHAR SELECTIVITY 1,
INSTANCE_GROUP_NAME VARCHAR SELECTIVITY 1,
- REQUEST_URL VARCHAR SELECTIVITY 1
+ REQUEST_URL VARCHAR SELECTIVITY 1,
+ ORIGINAL_REQUEST_ID VARCHAR SELECTIVITY 1,
+ EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1,
+ ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1
);
INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
@@ -168,6 +171,17 @@ CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS(
REQUEST_URL VARCHAR SELECTIVITY 1
);
+CREATE TABLE IF NOT EXISTS cloud_api_requests(
+`ID` INT(13) NOT NULL AUTO_INCREMENT,
+`REQUEST_BODY` LONGTEXT NOT NULL,
+`CLOUD_IDENTIFIER` VARCHAR(200) NULL,
+`SO_REQUEST_ID` VARCHAR(45) NOT NULL,
+`CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`ID`),
+CONSTRAINT fk_cloud_api_req_infra_requests
+ FOREIGN KEY (SO_REQUEST_ID)
+ REFERENCES infra_active_requests (REQUEST_ID));
+
CREATE CACHED TABLE PUBLIC.SITE_STATUS(
SITE_NAME VARCHAR NOT NULL,
STATUS VARCHAR,
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/CloudApiRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/CloudApiRequests.java
new file mode 100644
index 0000000000..690d0ffbaf
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/CloudApiRequests.java
@@ -0,0 +1,138 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.db.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+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.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.openpojo.business.annotation.BusinessKey;
+
+
+@Entity
+@JsonInclude(Include.NON_NULL)
+@Table(name = "cloud_api_requests")
+public class CloudApiRequests implements Serializable {
+
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4686890103198488984L;
+
+ @JsonIgnore
+ @Id
+ @BusinessKey
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "ID")
+ private Integer id;
+
+
+ @Column(name = "SO_REQUEST_ID")
+ private String requestId;
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ @Column(name = "CLOUD_IDENTIFIER")
+ private String cloudIdentifier;
+
+ @Column(name = "REQUEST_BODY", columnDefinition = "LONGTEXT")
+ private String requestBody;
+
+ @Column(name = "CREATE_TIME", insertable = false, updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created = null;
+
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof CloudApiRequests)) {
+ return false;
+ }
+ CloudApiRequests castOther = (CloudApiRequests) other;
+ return new EqualsBuilder().append(id, castOther.id).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(id).toHashCode();
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("id", id).append("cloudIdentifier", cloudIdentifier)
+ .append("requestBody", requestBody).append("created", created).toString();
+ }
+
+ @PrePersist
+ protected void createdAt() {
+ this.created = new Date();
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getCloudIdentifier() {
+ return cloudIdentifier;
+ }
+
+ public void setCloudIdentifier(String cloudIdentifier) {
+ this.cloudIdentifier = cloudIdentifier;
+ }
+
+
+ public String getRequestBody() {
+ return requestBody;
+ }
+
+ public void setRequestBody(String requestBody) {
+ this.requestBody = requestBody;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
index 37fbfd023c..d0a4aa2c5f 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
@@ -87,6 +87,9 @@ public class InfraActiveRequests extends InfraRequests {
.append("networkName", getNetworkName()).append("networkType", getNetworkType())
.append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
.append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
- .append("operationalEnvName", getOperationalEnvName()).append("requestUrl", getRequestUrl()).toString();
+ .append("operationalEnvName", getOperationalEnvName()).append("requestUrl", getRequestUrl())
+ .append("originalRequestId", getOriginalRequestId())
+ .append("extSystemErrorSource", getExtSystemErrorSource())
+ .append("rollbackExtSystemErrorSource", getRollbackExtSystemErrorSource()).toString();
}
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
index a1010a349c..05845dd058 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
@@ -22,11 +22,17 @@ package org.onap.so.db.request.beans;
import java.net.URI;
import java.sql.Timestamp;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import java.util.Objects;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
+import javax.persistence.FetchType;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
import javax.persistence.MappedSuperclass;
+import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Temporal;
@@ -34,6 +40,7 @@ import javax.persistence.TemporalType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.onap.so.requestsdb.TimestampXMLAdapter;
+import uk.co.blackpepper.bowman.annotation.LinkedResource;
import uk.co.blackpepper.bowman.annotation.ResourceId;
@MappedSuperclass
@@ -146,6 +153,16 @@ public abstract class InfraRequests implements java.io.Serializable {
private String instanceGroupName;
@Column(name = "REQUEST_URL", length = 500)
private String requestUrl;
+ @Column(name = "ORIGINAL_REQUEST_ID", length = 45)
+ private String originalRequestId;
+ @Column(name = "EXT_SYSTEM_ERROR_SOURCE", length = 80)
+ private String extSystemErrorSource;
+ @Column(name = "ROLLBACK_EXT_SYSTEM_ERROR_SOURCE", length = 80)
+ private String rollbackExtSystemErrorSource;
+
+ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+ @JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID", updatable = false)
+ private List<CloudApiRequests> cloudApiRequests = new ArrayList<>();
@ResourceId
public URI getRequestURI() {
@@ -458,6 +475,15 @@ public abstract class InfraRequests implements java.io.Serializable {
return requestAction;
}
+ @LinkedResource
+ public List<CloudApiRequests> getCloudApiRequests() {
+ return cloudApiRequests;
+ }
+
+ public void setCloudApiRequests(List<CloudApiRequests> cloudApiRequests) {
+ this.cloudApiRequests = cloudApiRequests;
+ }
+
public void setRequestAction(String requestAction) {
this.requestAction = requestAction;
}
@@ -550,6 +576,30 @@ public abstract class InfraRequests implements java.io.Serializable {
this.requestUrl = requestUrl;
}
+ public String getOriginalRequestId() {
+ return this.originalRequestId;
+ }
+
+ public void setOriginalRequestId(String originalRequestId) {
+ this.originalRequestId = originalRequestId;
+ }
+
+ public String getExtSystemErrorSource() {
+ return this.extSystemErrorSource;
+ }
+
+ public void setExtSystemErrorSource(String extSystemErrorSource) {
+ this.extSystemErrorSource = extSystemErrorSource;
+ }
+
+ public String getRollbackExtSystemErrorSource() {
+ return this.rollbackExtSystemErrorSource;
+ }
+
+ public void setRollbackExtSystemErrorSource(String rollbackExtSystemErrorSource) {
+ this.rollbackExtSystemErrorSource = rollbackExtSystemErrorSource;
+ }
+
@PrePersist
protected void onCreate() {
if (requestScope == null)
@@ -611,6 +661,8 @@ public abstract class InfraRequests implements java.io.Serializable {
.append("requestorId", getRequestorId()).append("configurationId", getConfigurationId())
.append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId())
.append("operationalEnvName", getOperationalEnvName()).append("instanceGroupId", getInstanceGroupId())
- .append("instanceGroupName", getInstanceGroupName()).append("requestUrl", getRequestUrl()).toString();
+ .append("instanceGroupName", getInstanceGroupName()).append("requestUrl", getRequestUrl())
+ .append("originalRequestId", originalRequestId).append("extSystemErrorSource", extSystemErrorSource)
+ .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).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 2a75c24c46..3c81555b99 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
@@ -86,6 +86,9 @@ public class RequestProcessingData implements Serializable {
@Temporal(TemporalType.TIMESTAMP)
private Date created = null;
+ @Column(name = "IS_DATA_INTERNAL")
+ private Boolean isDataInternal = true;
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof RequestProcessingData)) {
@@ -105,7 +108,7 @@ public class RequestProcessingData implements Serializable {
public String toString() {
return new ToStringBuilder(this).append("id", id).append("soRequestId", soRequestId)
.append("groupingId", groupingId).append("name", name).append("value", value).append("tag", tag)
- .toString();
+ .append("isDataInternal", isDataInternal).toString();
}
@PrePersist
@@ -164,4 +167,12 @@ public class RequestProcessingData implements Serializable {
public Date getCreated() {
return created;
}
+
+ public Boolean getIsDataInternal() {
+ return isDataInternal;
+ }
+
+ public void setIsDataInternal(Boolean isDataInternal) {
+ this.isDataInternal = isDataInternal;
+ }
}
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 f2ff6fac00..9be92ad93a 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,6 +26,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
import javax.annotation.PostConstruct;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
@@ -67,15 +69,19 @@ public class RequestsDbClient {
private static final String SERVICE_ID = "SERVICE_ID";
private static final String OPERATION_ID = "OPERATION_ID";
private static final String SO_REQUEST_ID = "SO_REQUEST_ID";
+ private static final String NAME = "NAME";
+ private static final String GROUPING_ID = "GROUPING_ID";
private static final String REQUEST_ID = "REQUEST_ID";
private static final String OPERATIONAL_ENVIRONMENT_ID = "OPERATIONAL_ENV_ID";
private static final String SERVICE_MODEL_VERSION_ID = "SERVICE_MODEL_VERSION_ID";
+ private static final String TAG = "TAG";
+ private static final String FLOW_EXECUTION_PATH = "flowExecutionPath";
+ private static final String BPMN_EXECUTION_DATA_TAG = "BPMNExecutionData";
-
- @Value("${mso.adapters.requestDb.endpoint}")
+ @Value("${mso.adapters.requestDb.endpoint:#{null}}")
protected String endpoint;
- @Value("${mso.adapters.requestDb.auth}")
+ @Value("${mso.adapters.requestDb.auth:#{null}}")
private String msoAdaptersAuth;
private String getOrchestrationFilterURI = "/infraActiveRequests/getOrchestrationFiltersFromInfraActive/";
@@ -94,6 +100,8 @@ public class RequestsDbClient {
private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId";
+ private String findOneByRequestId = "/infraActiveRequests/search/findOneByRequestId";
+
private String findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI =
"/findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestId";
@@ -104,9 +112,18 @@ public class RequestsDbClient {
private String requestProcessingDataURI = "/requestProcessingData";
- private final String findBySoRequestIdOrderByGroupingIdDesc =
+ private String getInfraActiveRequests = "/infraActiveRequests/v1/getInfraActiveRequests";
+
+ private static final String findBySoRequestIdAndGroupIdAndName =
+ "/requestProcessingData/search/findOneBySoRequestIdAndGroupingIdAndName";
+
+ private static final String findBySoRequestIdAndName = "/requestProcessingData/search/findOneBySoRequestIdAndName";
+
+ private static final String findBySoRequestIdOrderByGroupingIdDesc =
"/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc";
+ private static final String findByGroupingIdAndNameAndTag =
+ "/requestProcessingData/search/findByGroupingIdAndNameAndTag";
@Autowired
protected RestTemplate restTemplate;
@@ -123,12 +140,14 @@ public class RequestsDbClient {
cloudOrchestrationFiltersFromInfraActive = endpoint + cloudOrchestrationFiltersFromInfraActive;
findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_SEARCH + findOneByServiceIdAndOperationIdURI;
requestProcessingDataURI = endpoint + requestProcessingDataURI;
+ getInfraActiveRequests = endpoint + getInfraActiveRequests;
operationalEnvDistributionStatusURI = endpoint + operationalEnvDistributionStatusURI;
findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI =
endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH
+ findOneByOperationalEnvIdAndServiceModelVersionIdAndRequestIdURI;
findAllByOperationalEnvIdAndRequestIdURI =
endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI;
+ findOneByRequestId = endpoint + findOneByRequestId;
}
private ClientFactory getClientFactory() {
@@ -198,7 +217,7 @@ public class RequestsDbClient {
return restTemplate.exchange(uri, HttpMethod.GET, entity, InfraActiveRequests.class).getBody();
}
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName,
+ public InfraActiveRequests checkInstanceNameDuplicate(Map<String, String> instanceIdMap, String instanceName,
String requestScope) {
HttpHeaders headers = getHttpHeaders();
URI uri = getUri(checkInstanceNameDuplicate);
@@ -333,12 +352,62 @@ public class RequestsDbClient {
restTemplate.postForLocation(uri, entity);
}
+ public void updateRequestProcessingData(RequestProcessingData requestProcessingData) {
+ HttpHeaders headers = getHttpHeaders();
+ URI uri = getUri(requestProcessingDataURI + "/" + requestProcessingData.getId());
+ HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers);
+ restTemplate.put(uri, entity);
+ }
+
public List<RequestProcessingData> getRequestProcessingDataBySoRequestId(String soRequestId) {
return this
.getRequestProcessingData(getUri(UriBuilder.fromUri(endpoint + findBySoRequestIdOrderByGroupingIdDesc)
.queryParam(SO_REQUEST_ID, soRequestId).build().toString()));
}
+ public RequestProcessingData getRequestProcessingDataBySoRequestIdAndNameAndGrouping(String soRequestId,
+ String name, String groupingId) {
+ return getClientFactory().create(RequestProcessingData.class)
+ .get(getUri(UriBuilder.fromUri(endpoint + findBySoRequestIdAndGroupIdAndName)
+ .queryParam(SO_REQUEST_ID, soRequestId).queryParam(NAME, name)
+ .queryParam(GROUPING_ID, groupingId).build().toString()));
+ }
+
+ public List<RequestProcessingData> getRequestProcessingDataByGroupingIdAndNameAndTag(String groupingId, String name,
+ String tag) {
+ Iterable<RequestProcessingData> requestProcessingDataListIt =
+ getClientFactory().create(RequestProcessingData.class)
+ .getAll(getUri(UriBuilder.fromUri(endpoint + findByGroupingIdAndNameAndTag)
+ .queryParam(GROUPING_ID, groupingId).queryParam(NAME, name).queryParam(TAG, tag).build()
+ .toString()));
+
+ List<RequestProcessingData> requestProcessingDataList =
+ StreamSupport.stream(requestProcessingDataListIt.spliterator(), false).collect(Collectors.toList());
+
+ return requestProcessingDataList;
+ }
+
+ public RequestProcessingData getRequestProcessingDataBySoRequestIdAndName(String soRequestId, String name) {
+ return getClientFactory().create(RequestProcessingData.class)
+ .get(getUri(UriBuilder.fromUri(endpoint + findBySoRequestIdAndName)
+ .queryParam(SO_REQUEST_ID, soRequestId).queryParam(NAME, name).build().toString()));
+ }
+
+
+ public void persistProcessingData(String flowExecutionPath, String requestId) {
+
+ HttpHeaders headers = getHttpHeaders();
+ URI uri = getUri(requestProcessingDataURI);
+ RequestProcessingData rpd = new RequestProcessingData();
+ rpd.setName(FLOW_EXECUTION_PATH);
+ rpd.setSoRequestId(requestId);
+ rpd.setValue(flowExecutionPath);
+ rpd.setTag(BPMN_EXECUTION_DATA_TAG);
+
+ HttpEntity<RequestProcessingData> entity = new HttpEntity<>(rpd, headers);
+ restTemplate.postForLocation(uri, entity);
+ }
+
private List<RequestProcessingData> getRequestProcessingData(URI uri) {
Iterable<RequestProcessingData> requestProcessingDataIterator =
getClientFactory().create(RequestProcessingData.class).getAll(uri);
@@ -348,6 +417,31 @@ public class RequestsDbClient {
return requestProcessingDataList;
}
+ public InfraActiveRequests findOneByRequestId(String requestId) {
+ try {
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate.exchange(
+ getUri(UriBuilder.fromUri(findOneByRequestId).queryParam(REQUEST_ID, requestId).build().toString()),
+ HttpMethod.GET, entity, InfraActiveRequests.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ return null;
+ }
+ throw e;
+ }
+ }
+
+ // From and To are defaulted to ignore start/endtime on query to database
+ public List<InfraActiveRequests> getRequest(final Map<String, String[]> filters) {
+ String url = UriBuilder.fromUri(getUri(getInfraActiveRequests)).queryParam("from", "0")
+ .queryParam("to", "10000000000000").build().toString();
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<Map> entity = new HttpEntity<>(filters, headers);
+ return restTemplate
+ .exchange(url, HttpMethod.POST, entity, new ParameterizedTypeReference<List<InfraActiveRequests>>() {})
+ .getBody();
+ }
+
@Component
static class ClassURLMapper {
private static final Map<Class, String> classURLMap = new HashMap<>();
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
index 548bc25815..169d2353ec 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/controller/InstanceNameDuplicateCheckRequest.java
@@ -20,28 +20,28 @@
package org.onap.so.db.request.data.controller;
-import java.util.HashMap;
+import java.util.Map;
public class InstanceNameDuplicateCheckRequest {
- private HashMap<String, String> instanceIdMap;
+ private Map<String, String> instanceIdMap;
private String instanceName;
private String requestScope;
public InstanceNameDuplicateCheckRequest() {}
- public InstanceNameDuplicateCheckRequest(HashMap<String, String> instanceIdMap, String instanceName,
+ public InstanceNameDuplicateCheckRequest(Map<String, String> instanceIdMap, String instanceName,
String requestScope) {
this.instanceIdMap = instanceIdMap;
this.instanceName = instanceName;
this.requestScope = requestScope;
}
- public HashMap<String, String> getInstanceIdMap() {
+ public Map<String, String> getInstanceIdMap() {
return instanceIdMap;
}
- public void setInstanceIdMap(HashMap<String, String> instanceIdMap) {
+ public void setInstanceIdMap(Map<String, String> instanceIdMap) {
this.instanceIdMap = instanceIdMap;
}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java
new file mode 100644
index 0000000000..fdbc04acb4
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java
@@ -0,0 +1,35 @@
+package org.onap.so.db.request.client;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.Mockito.times;
+import java.net.URI;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.springframework.http.HttpEntity;
+import org.springframework.web.client.RestTemplate;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class RequestDbClientTest {
+
+ @InjectMocks
+ protected RequestsDbClient requestsDbClient;
+
+ @Mock
+ protected RestTemplate restTemplate;
+
+ @Test
+ public void updateRequestProcessingDataTest() {
+ RequestProcessingData requestProcessingData = new RequestProcessingData();
+ requestProcessingData.setId(1);
+ URI uri = URI.create("/requestProcessingData/1");
+ requestsDbClient.updateRequestProcessingData(requestProcessingData);
+ Mockito.verify(restTemplate, times(1)).put(eq(uri), isA(HttpEntity.class));
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/requestsdb/RequestsDBHelperTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/requestsdb/RequestsDBHelperTest.java
new file mode 100644
index 0000000000..b37ca0af63
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/requestsdb/RequestsDBHelperTest.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Samsung 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.requestsdb;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RequestsDBHelperTest {
+
+ @InjectMocks
+ private RequestsDBHelper requestsDBHelper;
+
+ @Mock
+ private RequestsDbClient requestsDbClient;
+
+ @Test
+ public void updateInfraSuccessCompletion() {
+
+ when(requestsDbClient.getInfraActiveRequestbyRequestId(any())).thenReturn(new InfraActiveRequests());
+
+ requestsDBHelper.updateInfraSuccessCompletion("messageText", "requestId", "operationalEnvId");
+
+ ArgumentCaptor<InfraActiveRequests> infraActiveRequests = ArgumentCaptor.forClass(InfraActiveRequests.class);
+
+ verify(requestsDbClient, times(1)).save(infraActiveRequests.capture());
+ assertEquals("COMPLETE", infraActiveRequests.getValue().getRequestStatus());
+ assertEquals("APIH", infraActiveRequests.getValue().getLastModifiedBy());
+ assertEquals(Long.valueOf(100), infraActiveRequests.getValue().getProgress());
+ assertEquals("SUCCESSFUL, operationalEnvironmentId - operationalEnvId; Success Message: messageText",
+ infraActiveRequests.getValue().getStatusMessage());
+ assertEquals("operationalEnvId", infraActiveRequests.getValue().getOperationalEnvId());
+ }
+
+ @Test
+ public void updateInfraFailureCompletion() {
+
+ when(requestsDbClient.getInfraActiveRequestbyRequestId(any())).thenReturn(new InfraActiveRequests());
+
+ requestsDBHelper.updateInfraFailureCompletion("messageText", "requestId", "operationalEnvId");
+
+ ArgumentCaptor<InfraActiveRequests> infraActiveRequests = ArgumentCaptor.forClass(InfraActiveRequests.class);
+ verify(requestsDbClient, times(1)).save(infraActiveRequests.capture());
+ assertEquals("FAILED", infraActiveRequests.getValue().getRequestStatus());
+ assertEquals("APIH", infraActiveRequests.getValue().getLastModifiedBy());
+ assertEquals(Long.valueOf(100), infraActiveRequests.getValue().getProgress());
+ assertEquals("FAILURE, operationalEnvironmentId - operationalEnvId; Error message: messageText",
+ infraActiveRequests.getValue().getStatusMessage());
+ assertEquals("operationalEnvId", infraActiveRequests.getValue().getOperationalEnvId());
+
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java
index b5da55c7d6..8f3f7a34b0 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java
@@ -1,8 +1,6 @@
package org.onap.so.db.catalog.beans;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -10,20 +8,12 @@ import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
-import javax.persistence.PrePersist;
import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.openpojo.business.annotation.BusinessKey;
-import org.hibernate.annotations.NotFound;
-import org.hibernate.annotations.NotFoundAction;
import uk.co.blackpepper.bowman.annotation.LinkedResource;
@Entity
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java
index 54e2144c81..f94b8155f8 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java
@@ -21,22 +21,17 @@
package org.onap.so.db.catalog.beans;
import java.io.Serializable;
-import java.util.List;
-import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
-import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import com.openpojo.business.annotation.BusinessKey;
@Entity
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java
index 1117648a7f..3be9e1f1e3 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java
@@ -22,7 +22,6 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.Date;
-import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -32,8 +31,6 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
-import javax.persistence.MapsId;
-import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
@@ -67,20 +64,21 @@ public class ConfigurationResourceCustomization implements Serializable {
private String modelInstanceName;
@Column(name = "CONFIGURATION_FUNCTION")
- private String nfFunction;
+ private String function;
@Column(name = "CONFIGURATION_TYPE")
- private String nfType;
+ private String type;
@Column(name = "CONFIGURATION_ROLE")
- private String nfRole;
+ private String role;
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date created;
- @Column(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
- private String serviceProxyResourceCustomizationUUID;
+ @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
+ private ServiceProxyResourceCustomization serviceProxyResourceCustomization;
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID")
@@ -123,40 +121,42 @@ public class ConfigurationResourceCustomization implements Serializable {
this.modelInstanceName = modelInstanceName;
}
- public String getNfFunction() {
- return nfFunction;
+ public String getFunction() {
+ return function;
}
- public void setNfFunction(String nfFunction) {
- this.nfFunction = nfFunction;
+ public void setFunction(String function) {
+ this.function = function;
}
- public String getNfType() {
- return nfType;
+ public String getType() {
+ return type;
}
- public void setNfType(String nfType) {
- this.nfType = nfType;
+ public void setType(String type) {
+ this.type = type;
}
- public String getNfRole() {
- return nfRole;
+ public String getRole() {
+ return role;
}
- public void setNfRole(String nfRole) {
- this.nfRole = nfRole;
+ public void setRole(String role) {
+ this.role = role;
}
public Date getCreated() {
return created;
}
- public String getServiceProxyResourceCustomizationUUID() {
- return serviceProxyResourceCustomizationUUID;
+ @LinkedResource
+ public ServiceProxyResourceCustomization getServiceProxyResourceCustomization() {
+ return serviceProxyResourceCustomization;
}
- public void setServiceProxyResourceCustomizationUUID(String serviceProxyResourceCustomizationUUID) {
- this.serviceProxyResourceCustomizationUUID = serviceProxyResourceCustomizationUUID;
+ public void setServiceProxyResourceCustomization(
+ ServiceProxyResourceCustomization serviceProxyResourceCustomization) {
+ this.serviceProxyResourceCustomization = serviceProxyResourceCustomization;
}
@@ -189,8 +189,8 @@ public class ConfigurationResourceCustomization implements Serializable {
@Override
public String toString() {
return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID)
- .append("modelInstanceName", modelInstanceName).append("nfFunction", nfFunction)
- .append("nfType", nfType).append("nfRole", nfRole).append("created", created)
+ .append("modelInstanceName", modelInstanceName).append("function", function).append("type", type)
+ .append("role", role).append("created", created)
// .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization)
.append("configResourceCustomization", configResourceCustomization)
.append("configurationResource", configurationResource).append("service", service).toString();
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 da3e391e11..7fb328fdb5 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
@@ -22,6 +22,7 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.Date;
+import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -100,7 +101,7 @@ public class CvnfcCustomization implements Serializable {
private VnfcCustomization vnfcCustomization;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cvnfcCustomization")
- private Set<CvnfcConfigurationCustomization> cvnfcConfigurationCustomization;
+ private List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomization;
@Override
public boolean equals(final Object other) {
@@ -142,12 +143,12 @@ public class CvnfcCustomization implements Serializable {
}
@LinkedResource
- public Set<CvnfcConfigurationCustomization> getCvnfcConfigurationCustomization() {
+ public List<CvnfcConfigurationCustomization> getCvnfcConfigurationCustomization() {
return cvnfcConfigurationCustomization;
}
public void setCvnfcConfigurationCustomization(
- Set<CvnfcConfigurationCustomization> cvnfcConfigurationCustomization) {
+ List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomization) {
this.cvnfcConfigurationCustomization = cvnfcConfigurationCustomization;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java
index 9287fbcf84..21b1550cb5 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java
@@ -44,33 +44,6 @@ import uk.co.blackpepper.bowman.annotation.LinkedResource;
public class NetworkResourceCustomization implements Serializable {
public static final long serialVersionUID = -1322322139926390329L;
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
- .append("modelInstanceName", modelInstanceName).append("created", created)
- .append("networkTechnology", networkTechnology).append("networkType", networkType)
- .append("networkScope", networkScope).append("networkRole", networkRole)
- .append("networkResource", networkResource).toString();
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof NetworkResourceCustomization)) {
- return false;
- }
- NetworkResourceCustomization castOther = (NetworkResourceCustomization) other;
- return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
- }
-
- public NetworkResourceCustomization() {
- super();
- }
-
@BusinessKey
@Id
@Column(name = "MODEL_CUSTOMIZATION_UUID")
@@ -102,6 +75,10 @@ public class NetworkResourceCustomization implements Serializable {
@JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID")
private NetworkResource networkResource = null;
+ public NetworkResourceCustomization() {
+ super();
+ }
+
@PrePersist
protected void onCreate() {
this.created = new Date();
@@ -175,4 +152,27 @@ public class NetworkResourceCustomization implements Serializable {
public void setResourceInput(String resourceInput) {
this.resourceInput = resourceInput;
}
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
+ .append("modelInstanceName", modelInstanceName).append("created", created)
+ .append("networkTechnology", networkTechnology).append("networkType", networkType)
+ .append("networkScope", networkScope).append("networkRole", networkRole)
+ .append("networkResource", networkResource).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof NetworkResourceCustomization)) {
+ return false;
+ }
+ NetworkResourceCustomization castOther = (NetworkResourceCustomization) other;
+ return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java
index cf8644eedc..b340fdea2b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java
@@ -22,9 +22,17 @@ package org.onap.so.db.catalog.beans;
// TODO find this file a new location?
public enum OrchestrationAction {
- ASSIGN("Assign"), UNASSIGN("Unassign"), ACTIVATE("Activate"), DEACTIVATE("Deactivate"), CHANGE_MODEL(
- "ChangeModel"), CREATE("Create"), DELETE("Delete"), UPDATE(
- "Update"), ADD_MEMBERS("AddMembers"), REMOVE_MEMBERS("RemoveMembers"), CUSTOM("Custom");
+ ASSIGN("Assign"),
+ UNASSIGN("Unassign"),
+ ACTIVATE("Activate"),
+ DEACTIVATE("Deactivate"),
+ CHANGE_MODEL("ChangeModel"),
+ CREATE("Create"),
+ DELETE("Delete"),
+ UPDATE("Update"),
+ ADD_MEMBERS("AddMembers"),
+ REMOVE_MEMBERS("RemoveMembers"),
+ CUSTOM("Custom");
private final String name;
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 e608bfed21..93e2992d3f 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
@@ -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,12 +21,18 @@
package org.onap.so.db.catalog.beans;
public enum OrchestrationStatus {
- ACTIVE("Active", "active"), ASSIGNED("Assigned", "assigned"), CREATED("Created", "created"), INVENTORIED(
- "Inventoried", "inventoried"), PENDING("Pending", "pending"), PENDING_ACTIVATION("PendingActivation",
- "pending.?activation"), PENDING_CREATE("PendingCreate", "pending.?create"), PENDING_DELETE(
- "PendingDelete", "pending.?delete"), PRECREATED("PreCreated",
- "pre.?created"), CONFIGASSIGNED("ConfigAssigned", "config.?assigned"), CONFIGURE(
- "Configure", "configure"), CONFIGURED("Configured", "configured");
+ ACTIVE("Active", "active"),
+ ASSIGNED("Assigned", "assigned"),
+ CREATED("Created", "created"),
+ INVENTORIED("Inventoried", "inventoried"),
+ PENDING("Pending", "pending"),
+ PENDING_ACTIVATION("PendingActivation", "pending.?activation"),
+ PENDING_CREATE("PendingCreate", "pending.?create"),
+ PENDING_DELETE("PendingDelete", "pending.?delete"),
+ PRECREATED("PreCreated", "pre.?created"),
+ CONFIGASSIGNED("ConfigAssigned", "config.?assigned"),
+ CONFIGURE("Configure", "configure"),
+ CONFIGURED("Configured", "configured");
private final String name;
private final String fuzzyMatcher;
@@ -43,7 +49,7 @@ public enum OrchestrationStatus {
/**
* case insensitive regular expression match to enum value
- *
+ *
* @param status
* @return
*/
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
index b41548ca99..4fd28c910e 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java
@@ -21,9 +21,15 @@
package org.onap.so.db.catalog.beans;
public enum ResourceType {
- SERVICE("Service"), VNF("Vnf"), VOLUME_GROUP("VolumeGroup"), VF_MODULE("VfModule"), NETWORK(
- "Network"), NETWORK_COLLECTION("NetworkCollection"), CONFIGURATION(
- "Configuration"), INSTANCE_GROUP("InstanceGroup"), NO_VALIDATE("NoValidate");
+ SERVICE("Service"),
+ VNF("Vnf"),
+ VOLUME_GROUP("VolumeGroup"),
+ VF_MODULE("VfModule"),
+ NETWORK("Network"),
+ NETWORK_COLLECTION("NetworkCollection"),
+ CONFIGURATION("Configuration"),
+ INSTANCE_GROUP("InstanceGroup"),
+ NO_VALIDATE("NoValidate");
private final String name;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
index ffcc8e9717..e591552ebf 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
@@ -25,11 +25,9 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
@@ -93,6 +91,9 @@ public class Service implements Serializable {
@Column(name = "RESOURCE_ORDER")
private String resourceOrder;
+ @Column(name = "OVERALL_DISTRIBUTION_STATUS")
+ private String distrobutionStatus;
+
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "network_resource_customization_to_service",
joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"),
@@ -135,6 +136,12 @@ public class Service implements Serializable {
@JoinColumn(name = "TOSCA_CSAR_ARTIFACT_UUID")
private ToscaCsar csar;
+ @Column(name = "NAMING_POLICY")
+ private String namingPolicy;
+
+ @Column(name = "ONAP_GENERATED_NAMING")
+ private Boolean onapGeneratedNaming;
+
@Override
public String toString() {
return new ToStringBuilder(this).append("modelName", modelName).append("description", description)
@@ -148,7 +155,7 @@ public class Service implements Serializable {
.append("serviceProxyCustomizations", serviceProxyCustomizations)
.append("configurationCustomizations", configurationCustomizations)
.append("pnfCustomizations", pnfCustomizations).append("recipes", recipes).append("csar", csar)
- .toString();
+ .append("namingPolicy", namingPolicy).append("onapGeneratedNaming", onapGeneratedNaming).toString();
}
@PrePersist
@@ -367,4 +374,29 @@ public class Service implements Serializable {
public void setResourceOrder(String resourceOrder) {
this.resourceOrder = resourceOrder;
}
+
+ public String getDistrobutionStatus() {
+ return distrobutionStatus;
+ }
+
+ public void setDistrobutionStatus(String distrobutionStatus) {
+ this.distrobutionStatus = distrobutionStatus;
+ }
+
+ public String getNamingPolicy() {
+ return namingPolicy;
+ }
+
+ public void setNamingPolicy(String namingPolicy) {
+ this.namingPolicy = namingPolicy;
+ }
+
+ public Boolean getOnapGeneratedNaming() {
+ return onapGeneratedNaming;
+ }
+
+ public void setOnapGeneratedNaming(Boolean onapGeneratedNaming) {
+ this.onapGeneratedNaming = onapGeneratedNaming;
+ }
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
index 5d9deb6c89..fb54449d5f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
@@ -38,9 +38,9 @@ import javax.persistence.TemporalType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import com.openpojo.business.annotation.BusinessKey;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
+import com.openpojo.business.annotation.BusinessKey;
import uk.co.blackpepper.bowman.annotation.LinkedResource;
@Entity
@@ -93,9 +93,6 @@ public class VnfResource implements Serializable {
@JoinColumn(name = "HEAT_TEMPLATE_ARTIFACT_UUID")
private HeatTemplate heatTemplates;
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResources")
- private List<VnfResourceCustomization> vnfResourceCustomizations;
-
@OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResource")
private List<VnfResourceWorkflow> vnfResourceWorkflow;
@@ -111,8 +108,7 @@ public class VnfResource implements Serializable {
.append("toscaNodeType", toscaNodeType).append("description", description)
.append("orchestrationMode", orchestrationMode).append("aicVersionMin", aicVersionMin)
.append("aicVersionMax", aicVersionMax).append("created", created)
- .append("heatTemplates", heatTemplates).append("vnfResourceCustomizations", vnfResourceCustomizations)
- .append("vnfResourceWorkflow", vnfResourceWorkflow).toString();
+ .append("heatTemplates", heatTemplates).append("vnfResourceWorkflow", vnfResourceWorkflow).toString();
}
@Override
@@ -230,17 +226,6 @@ public class VnfResource implements Serializable {
}
@LinkedResource
- public List<VnfResourceCustomization> getVnfResourceCustomizations() {
- if (vnfResourceCustomizations == null)
- vnfResourceCustomizations = new ArrayList<>();
- return vnfResourceCustomizations;
- }
-
- public void setVnfResourceCustomizations(List<VnfResourceCustomization> vnfResourceCustomizations) {
- this.vnfResourceCustomizations = vnfResourceCustomizations;
- }
-
- @LinkedResource
public HeatTemplate getHeatTemplates() {
return heatTemplates;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
index af99aa8c80..aec1c7fb22 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
@@ -23,9 +23,7 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -34,7 +32,6 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
@@ -121,6 +118,12 @@ public class VnfResourceCustomization implements Serializable {
@Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
private Boolean skipPostInstConf;
+ @Column(name = "VNFCINSTANCEGROUP_ORDER")
+ private String vnfcInstanceGroupOrder;
+
+ @Column(name = "NF_DATA_VALID")
+ private Boolean nfDataValid;
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof VnfResourceCustomization)) {
@@ -148,6 +151,7 @@ public class VnfResourceCustomization implements Serializable {
.append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
.append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources)
.append("vfModuleCustomizations", vfModuleCustomizations)
+ .append("vnfcInstanceGroupOrder", vnfcInstanceGroupOrder)
.append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString();
}
@@ -324,4 +328,22 @@ public class VnfResourceCustomization implements Serializable {
public void setSkipPostInstConf(Boolean skipPostInstConf) {
this.skipPostInstConf = skipPostInstConf;
}
+
+ public String getVnfcInstanceGroupOrder() {
+ return vnfcInstanceGroupOrder;
+ }
+
+ public void setVnfcInstanceGroupOrder(String vnfcInstanceGroupOrder) {
+ this.vnfcInstanceGroupOrder = vnfcInstanceGroupOrder;
+ }
+
+ public Boolean getNfDataValid() {
+ return nfDataValid;
+ }
+
+ public void setNfDataValid(Boolean nfDataValid) {
+ this.nfDataValid = nfDataValid;
+ }
+
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java
index f6ae503c61..413efaf12c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,23 +21,25 @@
package org.onap.so.db.catalog.beans;
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.openpojo.business.annotation.BusinessKey;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
@Entity
@Table(name = "vnfc_customization")
@@ -70,6 +73,9 @@ public class VnfcCustomization implements Serializable {
@Column(name = "DESCRIPTION")
private String description;
+ @Column(name = "RESOURCE_INPUT")
+ private String resourceInput;
+
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@Temporal(TemporalType.TIMESTAMP)
@@ -78,6 +84,10 @@ public class VnfcCustomization implements Serializable {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "vnfcCustomization")
private List<CvnfcCustomization> cvnfcCustomization;
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID")
+ private VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization;
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof VnfcCustomization)) {
@@ -186,4 +196,20 @@ public class VnfcCustomization implements Serializable {
public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
this.cvnfcCustomization = cvnfcCustomization;
}
+
+ public VnfcInstanceGroupCustomization getVnfcInstanceGroupCustomization() {
+ return vnfcInstanceGroupCustomization;
+ }
+
+ public void setVnfcInstanceGroupCustomization(VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization) {
+ this.vnfcInstanceGroupCustomization = vnfcInstanceGroupCustomization;
+ }
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java
index 695e5bbbb9..8a00ccd261 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.Date;
+import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -32,6 +34,7 @@ import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
@@ -66,6 +69,9 @@ public class VnfcInstanceGroupCustomization implements Serializable {
@JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID")
private InstanceGroup instanceGroup;
+ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "vnfcInstanceGroupCustomization")
+ private List<VnfcCustomization> vnfcCustomizations;
+
@Column(name = "FUNCTION")
private String function;
@@ -150,4 +156,12 @@ public class VnfcInstanceGroupCustomization implements Serializable {
public void setInstanceGroup(InstanceGroup instanceGroup) {
this.instanceGroup = instanceGroup;
}
+
+ public List<VnfcCustomization> getVnfcCustomizations() {
+ return vnfcCustomizations;
+ }
+
+ public void setVnfcCustomizations(List<VnfcCustomization> vnfcCustomizations) {
+ this.vnfcCustomizations = vnfcCustomizations;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
index a12edac8a0..39217c75fa 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java
@@ -63,6 +63,10 @@ public class RainyDayHandlerStatus implements Serializable {
private String errorCode;
@BusinessKey
+ @Column(name = "REG_EX_ERROR_MESSAGE")
+ private String errorMessage;
+
+ @BusinessKey
@Column(name = "WORK_STEP")
private String workStep;
@@ -73,12 +77,16 @@ public class RainyDayHandlerStatus implements Serializable {
@Column(name = "SECONDARY_POLICY")
private String secondaryPolicy;
+ @BusinessKey
+ @Column(name = "SERVICE_ROLE")
+ private String serviceRole;
+
@Override
public String toString() {
return new ToStringBuilder(this).append("id", id).append("flowName", flowName)
.append("serviceType", serviceType).append("vnfType", vnfType).append("errorCode", errorCode)
- .append("workStep", workStep).append("policy", policy).append("secondaryPolicy", secondaryPolicy)
- .toString();
+ .append("errorMessage", errorMessage).append("workStep", workStep).append("policy", policy)
+ .append("secondaryPolicy", secondaryPolicy).append("serviceRole", serviceRole).toString();
}
@Override
@@ -89,13 +97,14 @@ public class RainyDayHandlerStatus implements Serializable {
RainyDayHandlerStatus castOther = (RainyDayHandlerStatus) other;
return new EqualsBuilder().append(flowName, castOther.flowName).append(serviceType, castOther.serviceType)
.append(vnfType, castOther.vnfType).append(errorCode, castOther.errorCode)
- .append(workStep, castOther.workStep).append(policy, castOther.policy).isEquals();
+ .append(workStep, castOther.workStep).append(policy, castOther.policy)
+ .append(serviceRole, castOther.serviceRole).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(flowName).append(serviceType).append(vnfType).append(errorCode)
- .append(workStep).append(policy).toHashCode();
+ .append(workStep).append(policy).append(serviceRole).toHashCode();
}
public Integer getId() {
@@ -161,4 +170,21 @@ public class RainyDayHandlerStatus implements Serializable {
public void setSecondaryPolicy(String secondaryPolicy) {
this.secondaryPolicy = secondaryPolicy;
}
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index ab5fdb939c..23539b074d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -27,7 +27,9 @@ import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.persistence.EntityNotFoundException;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
+import org.apache.http.HttpStatus;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -67,12 +69,18 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.UriComponentsBuilder;
+import com.google.common.base.Strings;
import uk.co.blackpepper.bowman.Client;
import uk.co.blackpepper.bowman.ClientFactory;
import uk.co.blackpepper.bowman.Configuration;
@@ -84,7 +92,6 @@ public class CatalogDbClient {
private static final String CLOUD_SITE = "/cloudSite";
private static final String CLOUDIFY_MANAGER = "/cloudifyManager";
- private static final String CVNFC_CUSTOMZIATION = "/cvnfcCustomization";
private static final String RAINY_DAY_HANDLER_MACRO = "/rainy_day_handler_macro";
private static final String NORTHBOUND_REQUEST_REF_LOOKUP = "/northbound_request_ref_lookup";
private static final String NETWORK_RESOURCE_CUSTOMIZATION = "/networkResourceCustomization";
@@ -124,7 +131,6 @@ public class CatalogDbClient {
private static final String MODEL_NAME = "modelName";
private static final String MODEL_VERSION = "modelVersion";
private static final String MODEL_INVARIANT_UUID = "modelInvariantUUID";
- private static final String MODEL_INSTANCE_NAME = "modelInstanceName";
private static final String VNF_RESOURCE_MODEL_UUID = "vnfResourceModelUUID";
private static final String NF_ROLE = "nfRole";
private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUID";
@@ -137,6 +143,8 @@ public class CatalogDbClient {
private static final String IS_ALACARTE = "isALaCarte";
private static final String CLOUD_OWNER = "cloudOwner";
private static final String FLOW_NAME = "flowName";
+ private static final String ERROR_MESSAGE = "errorMessage";
+ private static final String SERVICE_ROLE = "serviceRole";
private static final String SERVICE_TYPE = "serviceType";
private static final String VNF_TYPE = "vnfType";
private static final String ERROR_CODE = "errorCode";
@@ -185,8 +193,8 @@ public class CatalogDbClient {
"/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner";
private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType =
"/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType";
- private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep =
- "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
+
+ private static final String findRainyDayHandler = "/findRainyDayHandler";
private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid";
@@ -198,10 +206,8 @@ public class CatalogDbClient {
private String serviceURI;
private String vfModuleURI;
private String vnfResourceURI;
- private String vfModuleCustomizationURI;
private String networkCollectionResourceCustomizationURI;
private String networkResourceCustomizationURI;
- private String vnfResourceCustomizationURI;
private String collectionNetworkResourceCustomizationURI;
private String instanceGroupURI;
private String cloudifyManagerURI;
@@ -260,8 +266,6 @@ public class CatalogDbClient {
private final Client<CloudifyManager> cloudifyManagerClient;
- private final Client<CvnfcCustomization> cvnfcCustomizationClient;
-
private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
private final Client<PnfResource> pnfResourceClient;
@@ -326,8 +330,6 @@ public class CatalogDbClient {
findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType =
endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH
+ findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType;
- findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH
- + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep;
findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion;
findPnfResourceCustomizationByModelUuid =
@@ -343,12 +345,9 @@ public class CatalogDbClient {
serviceURI = endpoint + SERVICE + URI_SEPARATOR;
vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR;
vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR;
- vfModuleCustomizationURI = endpoint + VFMODULE_CUSTOMIZATION + URI_SEPARATOR;
networkCollectionResourceCustomizationURI =
endpoint + NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
networkResourceCustomizationURI = endpoint + NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
- cvnfcResourceCustomizationURI = endpoint + CVNFC_CUSTOMZIATION + URI_SEPARATOR;
- vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
collectionNetworkResourceCustomizationURI =
endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
@@ -403,7 +402,6 @@ public class CatalogDbClient {
homingInstanceClient = clientFactory.create(HomingInstance.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
- cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
pnfResourceClient = clientFactory.create(PnfResource.class);
@@ -453,7 +451,6 @@ public class CatalogDbClient {
homingInstanceClient = clientFactory.create(HomingInstance.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
- cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class);
pnfResourceClient = clientFactory.create(PnfResource.class);
@@ -648,13 +645,17 @@ public class CatalogDbClient {
.queryParam(SERVICE_TYPE, serviceType).build().toString()));
}
- public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- String flowName, String serviceType, String vnfType, String errorCode, String workStep) {
+ public RainyDayHandlerStatus getRainyDayHandlerStatus(String flowName, String serviceType, String vnfType,
+ String errorCode, String workStep, String errorMessage, String serviceRole) {
+ logger.debug(
+ "Get Rainy Day Status - Flow Name {}, Service Type: {} , vnfType {} , errorCode {}, workStep {}, errorMessage {}",
+ flowName, serviceType, vnfType, errorCode, workStep, errorMessage);
return this.getSingleResource(rainyDayHandlerStatusClient,
- getUri(UriBuilder.fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep)
+ UriComponentsBuilder.fromUriString(endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findRainyDayHandler)
.queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
.queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
- .build().toString()));
+ .queryParam(ERROR_MESSAGE, errorMessage).queryParam(SERVICE_ROLE, serviceRole).build().encode()
+ .toUri());
}
public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action) {
@@ -663,6 +664,8 @@ public class CatalogDbClient {
.queryParam(SERVICE_MODEL_UUID, modelUUID).queryParam(ACTION, action).build().toString()));
}
+
+
public NetworkRecipe getFirstNetworkRecipeByModelNameAndAction(String modelName, String action) {
return this.getSingleResource(networkRecipeClient, UriBuilder.fromUri(findFirstByModelNameAndAction)
.queryParam(MODEL_NAME, modelName).queryParam(ACTION, action).build());
@@ -725,22 +728,20 @@ public class CatalogDbClient {
}
public VnfComponentsRecipe getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- String vfModuleModelUUID, String vnfComponentType, String action) {
+ String vfModuleModelUUID, String modelType, String action) {
return this.getSingleResource(vnfComponentsRecipeClient,
getUri(UriBuilder.fromUri(findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction)
- .queryParam(VF_MODULE_MODEL_UUID, vfModuleModelUUID)
- .queryParam(VNF_COMPONENT_TYPE, vnfComponentType).queryParam(ACTION, action).build()
- .toString()));
+ .queryParam(VF_MODULE_MODEL_UUID, vfModuleModelUUID).queryParam(VNF_COMPONENT_TYPE, modelType)
+ .queryParam(ACTION, action).build().toString()));
}
- public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType,
- String action) {
+ public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String modelType, String action) {
return this.getSingleResource(vnfComponentsRecipeClient,
getUri(UriBuilder.fromUri(findFirstVnfComponentsRecipeByVnfComponentTypeAndAction)
- .queryParam(VNF_COMPONENT_TYPE, vnfComponentType).queryParam(ACTION, action).build()
- .toString()));
+ .queryParam(VNF_COMPONENT_TYPE, modelType).queryParam(ACTION, action).build().toString()));
}
+
protected URI getUri(String template) {
return URI.create(template);
}
@@ -831,9 +832,14 @@ public class CatalogDbClient {
public VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID,
List<VnfResourceCustomization> vnfResourceCusts) {
- List<VnfResourceCustomization> filtered = vnfResourceCusts.stream()
- .filter(vnfCustRes -> vnfCustomizationUUID.equals(vnfCustRes.getModelCustomizationUUID()))
- .collect(Collectors.toList());
+ if (vnfCustomizationUUID == null) {
+ throw new EntityNotFoundException(
+ "a NULL UUID was provided in query to search for VnfResourceCustomization");
+ }
+ List<VnfResourceCustomization> filtered =
+ vnfResourceCusts.stream().filter(v -> v.getModelCustomizationUUID() != null)
+ .filter(vnfCustRes -> vnfCustomizationUUID.equals(vnfCustRes.getModelCustomizationUUID()))
+ .collect(Collectors.toList());
if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) {
return filtered.get(0);
} else
@@ -841,9 +847,12 @@ public class CatalogDbClient {
"Unable to find VnfResourceCustomization ModelCustomizationUUID:" + vnfCustomizationUUID);
}
- private VfModuleCustomization findVfModuleCustomizationInList(String vfModuleCustomizationUUID,
+ protected VfModuleCustomization findVfModuleCustomizationInList(String vfModuleCustomizationUUID,
List<VfModuleCustomization> vfModuleList) {
- List<VfModuleCustomization> filtered = vfModuleList.stream()
+ if (vfModuleCustomizationUUID == null) {
+ throw new EntityNotFoundException("a NULL UUID was provided in query to search for VfModuleCustomization");
+ }
+ List<VfModuleCustomization> filtered = vfModuleList.stream().filter(v -> v.getModelCustomizationUUID() != null)
.filter(vfModuleCust -> vfModuleCustomizationUUID.equals(vfModuleCust.getModelCustomizationUUID()))
.collect(Collectors.toList());
if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) {
@@ -853,9 +862,12 @@ public class CatalogDbClient {
"Unable to find VfModuleCustomization ModelCustomizationUUID:" + vfModuleCustomizationUUID);
}
- private CvnfcCustomization findCvnfcCustomizationInAList(String cvnfcCustomizationUuid,
+ protected CvnfcCustomization findCvnfcCustomizationInAList(String cvnfcCustomizationUuid,
List<CvnfcCustomization> cvnfcCustomList) {
- List<CvnfcCustomization> filtered = cvnfcCustomList.stream()
+ if (cvnfcCustomizationUuid == null) {
+ throw new EntityNotFoundException("a NULL UUID was provided in query to search for CvnfcCustomization");
+ }
+ List<CvnfcCustomization> filtered = cvnfcCustomList.stream().filter(c -> c.getModelCustomizationUUID() != null)
.filter(cvnfc -> cvnfcCustomizationUuid.equals(cvnfc.getModelCustomizationUUID()))
.collect(Collectors.toList());
if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) {
@@ -883,6 +895,90 @@ public class CatalogDbClient {
"Unable to find CvnfcConfigurationCustomization ModelCustomizationUUID:" + cvnfcCustomizationUuid);
}
+ public org.onap.so.rest.catalog.beans.Service getServiceModelInformation(String serviceModelUUID, String depth) {
+ if (Strings.isNullOrEmpty(serviceModelUUID)) {
+ throw new EntityNotFoundException("Service Model UUID passed as Null or Empty String");
+ }
+ try {
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate.exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/ecomp/mso/catalog/v1/services/" + serviceModelUUID)
+ .queryParam("depth", depth).build().encode().toString(),
+ HttpMethod.GET, entity, org.onap.so.rest.catalog.beans.Service.class).getBody();
+ } catch (HttpClientErrorException e) {
+ logger.warn("Entity Not found in DLP", e);
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find Service with ServiceModelUUID:" + serviceModelUUID);
+ }
+ throw e;
+ }
+ }
+
+ public List<org.onap.so.rest.catalog.beans.Service> getServices() {
+ try {
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate
+ .exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/ecomp/mso/catalog/v1/services").build()
+ .encode().toString(),
+ HttpMethod.GET, entity,
+ new ParameterizedTypeReference<List<org.onap.so.rest.catalog.beans.Service>>() {})
+ .getBody();
+ } catch (HttpClientErrorException e) {
+ logger.error("Error Calling catalog database", e);
+ throw e;
+ }
+ }
+
+ public org.onap.so.rest.catalog.beans.Vnf getVnfModelInformation(String serviceModelUUID,
+ String vnfCustomizationUUID, String depth) {
+ if (Strings.isNullOrEmpty(serviceModelUUID)) {
+ throw new EntityNotFoundException("Service Model UUID passed as Null or Empty String");
+ }
+ if (Strings.isNullOrEmpty(vnfCustomizationUUID)) {
+ throw new EntityNotFoundException("Vnf Customization UUID passed as Null or Empty String");
+ }
+ try {
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate
+ .exchange(
+ UriComponentsBuilder
+ .fromUriString(endpoint + "/ecomp/mso/catalog/v1/services/" + serviceModelUUID
+ + "/vnfs/" + vnfCustomizationUUID)
+ .queryParam("depth", depth).build().encode().toString(),
+ HttpMethod.GET, entity, org.onap.so.rest.catalog.beans.Vnf.class)
+ .getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException(
+ "Unable to find Vnf with Vnf Customization UUID:" + vnfCustomizationUUID);
+ }
+ throw e;
+ }
+ }
+
+ public void updateVnf(String serviceModelUUID, org.onap.so.rest.catalog.beans.Vnf vnf) {
+ if (vnf == null) {
+ throw new EntityNotFoundException("Vnf passed as null");
+ }
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<org.onap.so.rest.catalog.beans.Vnf> entity = new HttpEntity<>(vnf, headers);
+
+ restTemplate.exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/ecomp/mso/catalog/v1/services/" + serviceModelUUID
+ + "/vnfs/" + vnf.getModelCustomizationId()).build().encode().toString(),
+ HttpMethod.PUT, entity, org.onap.so.rest.catalog.beans.Vnf.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException(
+ "Unable to find Vnf with Vnf Customization UUID:" + vnf.getModelCustomizationId());
+ }
+ throw e;
+ }
+ }
+
+
public Workflow findWorkflowByArtifactUUID(String artifactUUID) {
return this.getSingleResource(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByArtifactUUID)
.queryParam(ARTIFACT_UUID, artifactUUID).build().toString()));
@@ -897,4 +993,26 @@ public class CatalogDbClient {
return this.getMultipleResources(workflowClient,
getUri(UriBuilder.fromUri(findWorkflowBySource).queryParam(SOURCE, source).build().toString()));
}
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ private HttpHeaders getHttpHeaders() {
+ HttpHeaders headers = new HttpHeaders();
+ headers.set(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
+ headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
+ headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
+ headers.set(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ return headers;
+ }
+
+ private HttpEntity<?> getHttpEntity() {
+ HttpHeaders headers = getHttpHeaders();
+ return new HttpEntity<>(headers);
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java
index 1e5a07350d..d974e88890 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java
@@ -20,6 +20,7 @@
package org.onap.so.db.catalog.data.repository;
+import java.util.List;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@@ -29,4 +30,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface CvnfcConfigurationCustomizationRepository
extends JpaRepository<CvnfcConfigurationCustomization, Integer> {
+ List<CvnfcConfigurationCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
index 2c61d91d6b..efe078bbfc 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
@@ -22,10 +22,21 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
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 = "rainy_day_handler_macro", path = "rainy_day_handler_macro")
public interface RainyDayHandlerStatusRepository extends JpaRepository<RainyDayHandlerStatus, Integer> {
- RainyDayHandlerStatus findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(String flowName,
- String serviceType, String vnfType, String errorCode, String workStep);
+
+ @Query(value = "SELECT * FROM rainy_day_handler_macro WHERE (FLOW_NAME = :flowName ) AND SERVICE_TYPE IN (:serviceType ,'*') "
+ + " AND VNF_TYPE IN ( :vnfType , '*') AND ERROR_CODE IN (:errorCode ,'*') AND WORK_STEP IN (:workStep , '*' ) "
+ + " AND ( :errorMessage REGEXP rainy_day_handler_macro.REG_EX_ERROR_MESSAGE OR REG_EX_ERROR_MESSAGE = '*') "
+ + " AND SERVICE_ROLE IN ( :serviceRole , '*') "
+ + " ORDER BY CASE WHEN :errorMessage REGEXP REG_EX_ERROR_MESSAGE THEN 0 WHEN ERROR_CODE != '*' THEN 1 WHEN VNF_TYPE != '*' THEN 2 WHEN SERVICE_TYPE != '*' THEN 3 WHEN SERVICE_ROLE != '*' THEN 4 ELSE 5 END LIMIT 1;",
+ nativeQuery = true)
+ RainyDayHandlerStatus findRainyDayHandler(@Param("flowName") String flowName,
+ @Param("serviceType") String serviceType, @Param("vnfType") String vnfType,
+ @Param("errorCode") String errorCode, @Param("workStep") String workStep,
+ @Param("errorMessage") String errorMessage, @Param("serviceRole") String serviceRole);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
index c107192060..b456beaeff 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
@@ -30,6 +30,8 @@ import java.util.List;
public interface ServiceRepository extends JpaRepository<Service, String> {
List<Service> findByModelName(String modelName);
+ List<Service> findByModelNameAndDistrobutionStatus(String modelName, String distrobutionStatus);
+
Service findOneByModelName(String modelName);
/**
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java
index a7610fec92..98db12c288 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java
@@ -90,8 +90,8 @@ public class MavenLikeVersioning implements Serializable {
public boolean isTheSameVersion(String versionToCompare) {
if (versionToCompare == null && this.version == null) {
return true;
- } else if (versionToCompare == null || versionToCompare.trim().equals("") || this.version == null
- || this.version.trim().equals("")) {
+ } else if (versionToCompare == null || "".equals(versionToCompare.trim()) || this.version == null
+ || "".equals(this.version.trim())) {
return false;
}
String[] currentVersionArray = this.version.split("\\.");
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java
new file mode 100644
index 0000000000..e22f366ddf
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Cvnfc.java
@@ -0,0 +1,136 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.catalog.beans;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class Cvnfc {
+
+ private String modelCustomizationId;
+ private String modelInstanceName;
+ private String modelVersionId;
+ private String modelInvariantId;
+ private String modelVersion;
+ private String modelName;
+ private String description;
+ private String nfcFunction;
+ private String nfcNamingCode;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ private Date created;
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getNfcFunction() {
+ return nfcFunction;
+ }
+
+ public void setNfcFunction(String nfcFunction) {
+ this.nfcFunction = nfcFunction;
+ }
+
+ public String getNfcNamingCode() {
+ return nfcNamingCode;
+ }
+
+ public void setNfcNamingCode(String nfcNamingCode) {
+ this.nfcNamingCode = nfcNamingCode;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelCustomizationId", modelCustomizationId)
+ .append("modelInstanceName", modelInstanceName).append("modelVersionId", modelVersionId)
+ .append("modelInvariantId", modelInvariantId).append("modelVersion", modelVersion)
+ .append("modelName", modelName).append("description", description).append("nfcFunction", nfcFunction)
+ .append("nfcNamingCode", nfcNamingCode).append("created", created).toString();
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java
new file mode 100644
index 0000000000..97f67a5438
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java
@@ -0,0 +1,160 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.text.DateFormat;
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import com.openpojo.business.annotation.BusinessKey;
+
+@Entity
+@Table(name = "heat_environment")
+public class HeatEnvironment implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305392L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "ARTIFACT_UUID")
+ private String artifactUuid;
+
+ @Column(name = "NAME")
+ private String name = null;
+
+ @Column(name = "DESCRIPTION")
+ private String description = null;
+
+ @Lob
+ @Column(name = "BODY", columnDefinition = "LONGTEXT")
+ private String environment = null;
+
+ @Column(name = "ARTIFACT_CHECKSUM")
+ private String artifactChecksum;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @BusinessKey
+ @Column(name = "VERSION")
+ private String version;
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof HeatEnvironment)) {
+ return false;
+ }
+ HeatEnvironment castOther = (HeatEnvironment) other;
+ return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).append(version, castOther.version)
+ .isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(artifactUuid).append(version).toHashCode();
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getArtifactUuid() {
+ return this.artifactUuid;
+ }
+
+ public void setArtifactUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getEnvironment() {
+ return this.environment;
+ }
+
+ public void setEnvironment(String environment) {
+ this.environment = environment;
+ }
+
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Artifact UUID=" + this.artifactUuid);
+ sb.append(", name=");
+ sb.append(name);
+ sb.append(", version=");
+ sb.append(version);
+ sb.append(", description=");
+ sb.append(this.description == null ? "null" : this.description);
+ sb.append(", body=");
+ sb.append(this.environment == null ? "null" : this.environment);
+ if (this.created != null) {
+ sb.append(",creationTimestamp=");
+ sb.append(DateFormat.getInstance().format(this.created));
+ }
+ return sb.toString();
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java
new file mode 100644
index 0000000000..94f61d30e3
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+public class HeatFile implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3280125018687060890L;
+
+ private String artifactUuid;
+
+ private String description = null;
+
+ private String fileName;
+
+ private String fileBody;
+
+ private Date created;
+
+ private String artifactChecksum;
+
+ private String version;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("artifactUuid", artifactUuid).append("description", description)
+ .append("fileName", fileName).append("fileBody", fileBody).append("created", created)
+ .append("artifactChecksum", artifactChecksum).toString();
+ }
+
+ public String getArtifactUuid() {
+ return this.artifactUuid;
+ }
+
+ public void setArtifactUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getFileName() {
+ return this.fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public String getFileBody() {
+ return this.fileBody;
+ }
+
+ public void setFileBody(String fileBody) {
+ this.fileBody = fileBody;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public String getAsdcUuid() {
+ return this.artifactUuid;
+ }
+
+ public void setAsdcUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ }
+
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java
new file mode 100644
index 0000000000..cb346e4167
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java
@@ -0,0 +1,147 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+public class HeatTemplate implements Serializable {
+
+
+ private String artifactUuid;
+
+ private String templateName;
+
+ private String templateBody = null;
+
+ private Integer timeoutMinutes;
+
+ private String version;
+
+ private String description;
+
+ private String artifactChecksum;
+
+ private Date created;
+
+ private Set<HeatTemplateParam> parameters;
+
+ private List<HeatTemplate> childTemplates;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("artifactUuid", artifactUuid).append("templateName", templateName)
+ .append("templateBody", templateBody).append("timeoutMinutes", timeoutMinutes)
+ .append("version", version).append("description", description)
+ .append("artifactChecksum", artifactChecksum).append("created", created)
+ .append("parameters", parameters).append("childTemplates", childTemplates).toString();
+ }
+
+ public List<HeatTemplate> getChildTemplates() {
+ if (childTemplates == null)
+ childTemplates = new ArrayList<>();
+ return childTemplates;
+ }
+
+ public void setChildTemplates(List<HeatTemplate> childTemplates) {
+ this.childTemplates = childTemplates;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getArtifactUuid() {
+ return this.artifactUuid;
+ }
+
+ public void setArtifactUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ }
+
+ public String getTemplateName() {
+ return templateName;
+ }
+
+ public void setTemplateName(String templateName) {
+ this.templateName = templateName;
+ }
+
+ public String getTemplateBody() {
+ return templateBody;
+ }
+
+ public void setTemplateBody(String templateBody) {
+ this.templateBody = templateBody;
+ }
+
+ public Integer getTimeoutMinutes() {
+ return timeoutMinutes;
+ }
+
+ public void setTimeoutMinutes(Integer timeout) {
+ this.timeoutMinutes = timeout;
+ }
+
+ public Set<HeatTemplateParam> getParameters() {
+ if (parameters == null)
+ parameters = new HashSet<>();
+ return parameters;
+ }
+
+ public void setParameters(Set<HeatTemplateParam> parameters) {
+ this.parameters = parameters;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getHeatTemplate() {
+ return this.templateBody;
+ }
+
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java
new file mode 100644
index 0000000000..a79ec962f8
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.catalog.beans;
+
+import java.io.Serializable;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+public class HeatTemplateParam implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8251042980747916191L;
+
+ private String paramName;
+
+ private Boolean required;
+
+ private String paramType;
+
+ private String paramAlias;
+
+ public String getParamName() {
+ return paramName;
+ }
+
+ public void setParamName(String paramName) {
+ this.paramName = paramName;
+ }
+
+ public Boolean isRequired() {
+ return required;
+ }
+
+ public void setRequired(Boolean required) {
+ this.required = required;
+ }
+
+ public String getParamAlias() {
+ return paramAlias;
+ }
+
+ public void setParamAlias(String paramAlias) {
+ this.paramAlias = paramAlias;
+ }
+
+ public String getParamType() {
+ return paramType;
+ }
+
+ public void setParamType(String paramType) {
+ this.paramType = paramType;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java
new file mode 100644
index 0000000000..11089046fd
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java
@@ -0,0 +1,167 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class Service implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305392L;
+
+ private String modelName;
+
+ private String description;
+
+ private String modelVersionId;
+
+ private String modelInvariantId;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ private Date created;
+
+ private String modelVersion;
+
+ private String serviceType;
+
+ private String serviceRole;
+
+ private String environmentContext;
+
+ private String workloadContext;
+
+ private String category;
+
+ private String distrobutionStatus;
+
+ private List<Vnf> vnf = new ArrayList<>();
+
+ public List<Vnf> getVnf() {
+ return vnf;
+ }
+
+ public void setVnf(List<Vnf> vnf) {
+ this.vnf = vnf;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getDistrobutionStatus() {
+ return distrobutionStatus;
+ }
+
+ public void setDistrobutionStatus(String distrobutionStatus) {
+ this.distrobutionStatus = distrobutionStatus;
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java
new file mode 100644
index 0000000000..f2a2c77aca
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java
@@ -0,0 +1,203 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.catalog.beans;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class VfModule {
+
+ // VfModule
+ private String modelVersionId;
+ private String modelInvariantId;
+ private String modelName;
+ private String modelVersion;
+ private String description;
+ private Boolean isBase;
+ private HeatTemplate heatTemplate;
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ private Date created;
+ private List<HeatFile> heatFile;
+
+ // Customization
+ private String modelCustomizationId;
+ private String label;
+ private Integer minInstances;
+ private Integer maxInstances;
+ private Integer initialCount;
+ private Integer availabilityZoneCount;
+ private HeatEnvironment heatEnv;
+ private Boolean isVolumeGroup;
+
+ private List<Cvnfc> vnfc = new ArrayList<>();
+
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Boolean getIsBase() {
+ return isBase;
+ }
+
+ public void setIsBase(Boolean isBase) {
+ this.isBase = isBase;
+ }
+
+ public HeatTemplate getHeatTemplate() {
+ return heatTemplate;
+ }
+
+ public void setHeatTemplate(HeatTemplate heatTemplate) {
+ this.heatTemplate = heatTemplate;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public List<HeatFile> getHeatFile() {
+ return heatFile;
+ }
+
+ public void setHeatFile(List<HeatFile> heatFile) {
+ this.heatFile = heatFile;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public Integer getMinInstances() {
+ return minInstances;
+ }
+
+ public void setMinInstances(Integer minInstances) {
+ this.minInstances = minInstances;
+ }
+
+ public Integer getMaxInstances() {
+ return maxInstances;
+ }
+
+ public void setMaxInstances(Integer maxInstances) {
+ this.maxInstances = maxInstances;
+ }
+
+ public Integer getInitialCount() {
+ return initialCount;
+ }
+
+ public void setInitialCount(Integer integer) {
+ this.initialCount = integer;
+ }
+
+ public Integer getAvailabilityZoneCount() {
+ return availabilityZoneCount;
+ }
+
+ public void setAvailabilityZoneCount(Integer availabilityZoneCount) {
+ this.availabilityZoneCount = availabilityZoneCount;
+ }
+
+ public HeatEnvironment getHeatEnv() {
+ return heatEnv;
+ }
+
+ public void setHeatEnv(HeatEnvironment heatEnv) {
+ this.heatEnv = heatEnv;
+ }
+
+ public Boolean getIsVolumeGroup() {
+ return isVolumeGroup;
+ }
+
+ public void setIsVolumeGroup(Boolean isVolumeGroup) {
+ this.isVolumeGroup = isVolumeGroup;
+ }
+
+ public List<Cvnfc> getVnfc() {
+ return vnfc;
+ }
+
+ public void setVnfc(List<Cvnfc> vnfc) {
+ this.vnfc = vnfc;
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java
new file mode 100644
index 0000000000..febf69baf1
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java
@@ -0,0 +1,237 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class Vnf implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2956199674955504834L;
+
+ private String modelName;
+ private String modelVersionId;
+ private String modelInvariantId;
+ private String modelVersion;
+ private String modelCustomizationId;
+ private String modelInstanceName;
+ private Integer minInstances;
+ private Integer maxInstances;
+ private Integer availabilityZoneMaxCount;
+ private String toscaNodeType;
+ private String nfFunction;
+ private String nfRole;
+ private String nfNamingCode;
+ private String nfType;
+ private String multiStageDesign;
+ private String orchestrationMode;
+ private String cloudVersionMin;
+ private String cloudVersionMax;
+ private String category;
+ private String subCategory;
+ private Boolean nfDataValid;
+ private List<VfModule> vfModule = new ArrayList<>();
+
+ public List<VfModule> getVfModule() {
+ return vfModule;
+ }
+
+ public void setVfModule(List<VfModule> vfModule) {
+ this.vfModule = vfModule;
+ }
+
+ public Integer getAvailabilityZoneMaxCount() {
+ return availabilityZoneMaxCount;
+ }
+
+ public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) {
+ this.availabilityZoneMaxCount = availabilityZoneMaxCount;
+ }
+
+ public Integer getMinInstances() {
+ return minInstances;
+ }
+
+ public void setMinInstances(Integer minInstances) {
+ this.minInstances = minInstances;
+ }
+
+ public Integer getMaxInstances() {
+ return maxInstances;
+ }
+
+ public void setMaxInstances(Integer maxInstances) {
+ this.maxInstances = maxInstances;
+ }
+
+ public String getCloudVersionMin() {
+ return cloudVersionMin;
+ }
+
+ public void setCloudVersionMin(String cloudVersionMin) {
+ this.cloudVersionMin = cloudVersionMin;
+ }
+
+ public String getCloudVersionMax() {
+ return cloudVersionMax;
+ }
+
+ public void setCloudVersionMax(String cloudVersionMax) {
+ this.cloudVersionMax = cloudVersionMax;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getSubCategory() {
+ return subCategory;
+ }
+
+ public void setSubCategory(String subCategory) {
+ this.subCategory = subCategory;
+ }
+
+ public String getOrchestrationMode() {
+ return orchestrationMode;
+ }
+
+ public void setOrchestrationMode(String orchestrationMode) {
+ this.orchestrationMode = orchestrationMode;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfRole() {
+ return nfRole;
+ }
+
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
+
+ public String getNfNamingCode() {
+ return nfNamingCode;
+ }
+
+ public void setNfNamingCode(String nfNamingCode) {
+ this.nfNamingCode = nfNamingCode;
+ }
+
+ public String getMultiStageDesign() {
+ return multiStageDesign;
+ }
+
+ public void setMultiStageDesign(String multiStepDesign) {
+ this.multiStageDesign = multiStepDesign;
+ }
+
+ public String getNfType() {
+ return nfType;
+ }
+
+ public void setNfType(String nfType) {
+ this.nfType = nfType;
+ }
+
+ public Boolean getNfDataValid() {
+ return nfDataValid;
+ }
+
+ public void setNfDataValid(Boolean nfDataValid) {
+ this.nfDataValid = nfDataValid;
+ }
+
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java
index 80e3d53c57..4010328ad9 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java
@@ -21,7 +21,9 @@
package org.onap.so.db.catalog.beans;
import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.junit.Test;
@@ -54,7 +56,7 @@ public class CvnfcCustomizationTest {
cvnfcCustomization.setNfcNamingCode(NFC_NAMING_CODE);
cvnfcCustomization.setToscaNodeType(TOSCA_NODE_TYPE);
cvnfcCustomization.setVfModuleCustomization(setupVfModuleCustomization());
- Set<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizationSet = new HashSet();
+ List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizationSet = new ArrayList();
cvnfcConfigurationCustomizationSet.add(setupCvnfcConfigurationCustomization());
cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizationSet);
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
new file mode 100644
index 0000000000..b82c17dc84
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -0,0 +1,174 @@
+/*-
+ * ============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.db.catalog.client;
+
+import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import javax.persistence.EntityNotFoundException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+
+public class CatalogDbClientTest {
+
+ private CatalogDbClient catalogDbClient;
+
+ @Before
+ public void init() {
+ catalogDbClient = new CatalogDbClient();
+ }
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public final void testFindVnfResourceCustomizationInListNullInList() {
+ thrown.expect(EntityNotFoundException.class);
+ String vnfCustomizationUUID = "a123";
+ VnfResourceCustomization vrc = new VnfResourceCustomization();
+ vrc.setModelCustomizationUUID("z789J");
+ VnfResourceCustomization vrc2 = new VnfResourceCustomization();
+ vrc2.setModelCustomizationUUID(null);
+ ArrayList<VnfResourceCustomization> vrcs = new ArrayList<VnfResourceCustomization>();
+ vrcs.add(vrc);
+ vrcs.add(vrc2);
+ catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vrcs);
+ }
+
+ @Test
+ public final void testFindVnfResourceCustomizationInListNullString() {
+ thrown.expect(EntityNotFoundException.class);
+ thrown.expectMessage("a NULL UUID was provided in query to search for VnfResourceCustomization");
+ String vnfCustomizationUUID = null;
+ VnfResourceCustomization vrc = new VnfResourceCustomization();
+ vrc.setModelCustomizationUUID("z789J");
+ VnfResourceCustomization vrc2 = new VnfResourceCustomization();
+ vrc2.setModelCustomizationUUID("a123");
+ ArrayList<VnfResourceCustomization> vrcs = new ArrayList<VnfResourceCustomization>();
+ vrcs.add(vrc);
+ vrcs.add(vrc2);
+ catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vrcs);
+ }
+
+ @Test
+ public final void testFindVnfResourceCustomizationInListNoNulls() {
+ String vnfCustomizationUUID = "a123";
+ VnfResourceCustomization vrc = new VnfResourceCustomization();
+ vrc.setModelCustomizationUUID("z789J");
+ VnfResourceCustomization vrc2 = new VnfResourceCustomization();
+ vrc2.setModelCustomizationUUID("a123");
+ ArrayList<VnfResourceCustomization> vrcs = new ArrayList<VnfResourceCustomization>();
+ vrcs.add(vrc);
+ vrcs.add(vrc2);
+ VnfResourceCustomization aVrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vrcs);
+ assertTrue(aVrc.getModelCustomizationUUID().equals("a123"));
+ }
+
+ @Test
+ public final void testFindVfModuleCustomizationInListNullInList() {
+ thrown.expect(EntityNotFoundException.class);
+ String vfModuleCustomizationUUID = "a123";
+ VfModuleCustomization vmc = new VfModuleCustomization();
+ vmc.setModelCustomizationUUID("z789J");
+ VfModuleCustomization vmc2 = new VfModuleCustomization();
+ vmc2.setModelCustomizationUUID(null);
+ ArrayList<VfModuleCustomization> vmcs = new ArrayList<VfModuleCustomization>();
+ vmcs.add(vmc);
+ vmcs.add(vmc2);
+ catalogDbClient.findVfModuleCustomizationInList(vfModuleCustomizationUUID, vmcs);
+ }
+
+ @Test
+ public final void testFindVfModuleCustomizationInListNullString() {
+ thrown.expect(EntityNotFoundException.class);
+ thrown.expectMessage("a NULL UUID was provided in query to search for VfModuleCustomization");
+ String vfModuleCustomizationUUID = null;
+ VfModuleCustomization vmc = new VfModuleCustomization();
+ vmc.setModelCustomizationUUID("z789J");
+ VfModuleCustomization vmc2 = new VfModuleCustomization();
+ vmc2.setModelCustomizationUUID("a123");
+ ArrayList<VfModuleCustomization> vmcs = new ArrayList<VfModuleCustomization>();
+ vmcs.add(vmc);
+ vmcs.add(vmc2);
+ catalogDbClient.findVfModuleCustomizationInList(vfModuleCustomizationUUID, vmcs);
+ }
+
+ @Test
+ public final void testFindVfModuleCustomizationInListNoNulls() {
+ String vfModuleCustomizationUUID = "a123";
+ VfModuleCustomization vmc = new VfModuleCustomization();
+ vmc.setModelCustomizationUUID("z789J");
+ VfModuleCustomization vmc2 = new VfModuleCustomization();
+ vmc2.setModelCustomizationUUID("a123");
+ ArrayList<VfModuleCustomization> vmcs = new ArrayList<VfModuleCustomization>();
+ vmcs.add(vmc);
+ vmcs.add(vmc2);
+ VfModuleCustomization aVmc = catalogDbClient.findVfModuleCustomizationInList(vfModuleCustomizationUUID, vmcs);
+ assertTrue(aVmc.getModelCustomizationUUID().equals("a123"));
+ }
+
+ @Test
+ public final void testFindCvnfcCustomizationInListNullInList() {
+ thrown.expect(EntityNotFoundException.class);
+ String cvnfcCustomizationUuid = "a123";
+ CvnfcCustomization cvnfc = new CvnfcCustomization();
+ cvnfc.setModelCustomizationUUID("z789J");
+ CvnfcCustomization cvnfc2 = new CvnfcCustomization();
+ cvnfc2.setModelCustomizationUUID(null);
+ ArrayList<CvnfcCustomization> cvnfcs = new ArrayList<CvnfcCustomization>();
+ cvnfcs.add(cvnfc);
+ cvnfcs.add(cvnfc2);
+ catalogDbClient.findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcs);
+ }
+
+ @Test
+ public final void testFindCvnfcCustomizationInListNullString() {
+ thrown.expect(EntityNotFoundException.class);
+ thrown.expectMessage("a NULL UUID was provided in query to search for CvnfcCustomization");
+ String cvnfcCustomizationUuid = null;
+ CvnfcCustomization cvnfc = new CvnfcCustomization();
+ cvnfc.setModelCustomizationUUID("z789J");
+ CvnfcCustomization cvnfc2 = new CvnfcCustomization();
+ cvnfc2.setModelCustomizationUUID("a123");
+ ArrayList<CvnfcCustomization> cvnfcs = new ArrayList<CvnfcCustomization>();
+ cvnfcs.add(cvnfc);
+ cvnfcs.add(cvnfc2);
+ catalogDbClient.findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcs);
+ }
+
+ @Test
+ public final void testFindCvnfcCustomizationInListNoNulls() {
+ String cvnfcCustomizationUuid = "a123";
+ CvnfcCustomization cvnfc = new CvnfcCustomization();
+ cvnfc.setModelCustomizationUUID("z789J");
+ CvnfcCustomization cvnfc2 = new CvnfcCustomization();
+ cvnfc2.setModelCustomizationUUID("a123");
+ ArrayList<CvnfcCustomization> cvnfcs = new ArrayList<CvnfcCustomization>();
+ cvnfcs.add(cvnfc);
+ cvnfcs.add(cvnfc2);
+ CvnfcCustomization aCvnfc = catalogDbClient.findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcs);
+ assertTrue(aCvnfc.getModelCustomizationUUID().equals("a123"));
+ }
+
+}
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 371a9c13e0..e8addc4aa8 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
@@ -74,7 +74,6 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
vnfResourceCustomizations.add(vnfResourceCustomization);
- vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
vnfResourceCustomization.setVnfResources(vnfResource);
@@ -123,7 +122,6 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
vnfResourceCustomizations.add(vnfResourceCustomization);
- vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
vnfResourceCustomization.setVnfResources(vnfResource);
@@ -177,7 +175,6 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
vnfResourceCustomizations.add(vnfResourceCustomization);
- vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
vnfResourceCustomization.setVnfResources(vnfResource);
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
index 612963d35b..8bf47e71d3 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
@@ -37,6 +37,7 @@ public class VnfcCustomizationRepositoryTest extends BaseTest {
private VnfcCustomizationRepository vnfcCustomizationRepository;
@Test
+ @Transactional
public void findAllTest() throws Exception {
List<VnfcCustomization> vnfcCustomizationList = vnfcCustomizationRepository.findAll();
Assert.assertFalse(CollectionUtils.isEmpty(vnfcCustomizationList));
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index f5e7d52ba4..7468f62ecb 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -803,6 +803,9 @@ CREATE TABLE `service` (
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_ORDER` varchar(200) default NULL,
+ `OVERALL_DISTRIBUTION_STATUS` varchar(45),
+ `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL,
+ `NAMING_POLICY` varchar(200) DEFAULT NULL,
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -1106,6 +1109,8 @@ CREATE TABLE `vnf_resource_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
+ `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
@@ -1132,6 +1137,8 @@ CREATE TABLE `vnfc_customization` (
`MODEL_NAME` varchar(200) NOT NULL,
`TOSCA_NODE_TYPE` varchar(200) NOT NULL,
`DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
+ `VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID` integer DEFAULT NULL,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index 88a5001f17..611e2d293d 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -64,7 +64,7 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
- <version>0.19.1</version>
+ <version>0.28.0</version>
<configuration>
<verbose>true</verbose>
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 cf50868ca5..c0b298e778 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
@@ -1,4 +1,4 @@
-FROM openjdk:8-jdk-alpine
+FROM docker.io/openjdk:8-jdk-alpine
ARG http_proxy
ARG https_proxy
diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
index 89482fdcda..e1de3317e7 100644
--- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
+++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
@@ -1,12 +1,12 @@
-<!-- ============LICENSE_START=======================================================
- ECOMP MSO ================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
- use this file except in compliance with the License. You may obtain a copy
- of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
+<!-- ============LICENSE_START=======================================================
+ ECOMP MSO ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ use this file except in compliance with the License. You may obtain a copy
+ of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. ============LICENSE_END========================================================= -->
<configuration scan="true" debug="false">
@@ -23,11 +23,11 @@
<property name="metricsLogName" value="metrics" />
<property name="auditLogName" value="audit" />
<property name="debugLogName" value="debug" />
-
+
<property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
<property name="errorPattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" />
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-500}|%X{ErrorDesc}|%msg%n" />
<property name="debugPattern"
value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}| %logger{50} - %msg%n" />
@@ -52,7 +52,7 @@
<appender name="Audit"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>EXIT</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
@@ -80,7 +80,7 @@
<appender name="Metric"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>INVOKE_RETURN</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
diff --git a/pom.xml b/pom.xml
index 5168141545..d5cd1f4a0b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
- <version>1.2.1</version>
+ <version>2.0.0</version>
<relativePath />
</parent>
<groupId>org.onap.so</groupId>
@@ -49,7 +49,7 @@
<sonar.cpd.exclusions>**/*</sonar.cpd.exclusions>
<jacoco.version>0.7.5.201505241946</jacoco.version>
<org.apache.maven.user-settings />
- <openstack.version>1.4.0</openstack.version>
+ <openstack.version>1.5.0-SNAPSHOT</openstack.version>
<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
<originalClassifier>original</originalClassifier>
<docker.skip>true</docker.skip>
@@ -66,10 +66,11 @@
<siteNexusPath>content/sites/site/org/onap/so/${project.version}/</siteNexusPath>
<cxf.version>3.2.6</cxf.version>
<jax.ws.rs>2.1</jax.ws.rs>
- <springboot.version>2.0.5.RELEASE</springboot.version>
+ <springboot.version>2.1.5.RELEASE</springboot.version>
<camunda.springboot.version>3.2.0</camunda.springboot.version>
<format.skipValidate>false</format.skipValidate>
<format.skipExecute>true</format.skipExecute>
+ <io.fabric8.version>4.1.0</io.fabric8.version>
</properties>
<distributionManagement>
<repository>
@@ -209,7 +210,7 @@
</resource>
</resources>
<plugins>
- <plugin>
+ <!-- <plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
@@ -219,7 +220,7 @@
<stagingProfileId>176c31dfe190a</stagingProfileId>
<serverId>ecomp-staging</serverId>
</configuration>
- </plugin>
+ </plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
@@ -443,6 +444,7 @@
<goals>
<goal>format</goal>
</goals>
+ <phase>process-sources</phase>
<configuration>
<skip>${format.skipExecute}</skip>
<configFile>${base-path}/project-configs/code-tools/onap-eclipse-format.xml</configFile>
@@ -453,6 +455,7 @@
<goals>
<goal>format</goal>
</goals>
+ <phase>process-sources</phase>
<configuration>
<skip>${format.skipExecute}</skip>
<sourceDirectory>${project.basedir}</sourceDirectory>
@@ -500,7 +503,7 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
- <version>3.5.33</version>
+ <version>${io.fabric8.version}</version>
<configuration>
<skip>${docker.skip}</skip>
<skipBuild>${docker.skip.build}</skipBuild>
@@ -508,12 +511,12 @@
<dockerHost>${docker.newHost}</dockerHost>
<!-- 1. Update address to your local docker VM. 2. Add IP to your NO_PROXY environment variable -->
<certPath>${docker.host.cert.path}</certPath>
- <!-- Add -Ddocker.host.cert.pat="path to your local certs directory"
- to maven build command -->
+ <!-- Add -Ddocker.host.cert.pat="path to your local certs directory" to maven build command -->
<pushRegistry>${dockerPushRepo}</pushRegistry>
<!-- Update .m2/settings.xml Add server id settings.dockerRepository, username, and password -->
<pullRegistry>${dockerPullRepo}</pullRegistry>
- <!-- If docker repo is not public. Update .m2/settings.xml Add server id settings.dockerRepository, username, and password -->
+ <!-- If docker repo is not public. Update .m2/settings.xml Add server id settings.dockerRepository, username,
+ and password -->
<images>
<image>
<alias>service</alias>
@@ -788,7 +791,7 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.10</version>
+ <version>1.12</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -844,18 +847,13 @@
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
- <version>5.1.4</version>
+ <version>5.2.4</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.19</version>
- </dependency>
</dependencies>
</dependencyManagement>
<profiles>
diff --git a/project-configs/code-tools/onap-eclipse-format.xml b/project-configs/code-tools/onap-eclipse-format.xml
index cd136171fa..093866afc5 100644
--- a/project-configs/code-tools/onap-eclipse-format.xml
+++ b/project-configs/code-tools/onap-eclipse-format.xml
@@ -30,7 +30,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="48"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
@@ -194,7 +194,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="48"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
@@ -310,4 +310,4 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
</profile>
-</profiles>
+</profiles> \ No newline at end of file
diff --git a/readme.md b/readme.md
index 449743493c..862ca1ee42 100644
--- a/readme.md
+++ b/readme.md
@@ -1,79 +1,102 @@
-# ONAP MSO
+# ONAP SO
----
----
# Introduction
-ONAP MSO is delivered with **2 Docker containers**, 1 hosting the **database** (MariaDB) and 1 hosting the **JBoss** application server running all ONAP MSO code.
+SO (Service Orchestrator) project is mostly composed of java & groovy code along with camunda BPMN code flow.
-Both containers runs on the same machine and can be started with **`docker-compose`**.
+SO consists of following sub-components:
+ - API Handler (*/mso-api-handlers*) set of REST services for incoming requests (northbound clients)
+ - BPMN Execution Engine (*/bpmn*) contains all business logic of service order execution and interact with AAI, SDNC, requestdb, catalogdb etc. Exposes rest interface for Api Handler
+ - Set of adapters (*/adapters*) adapters that interact with ONAP components (SDNC, VFC, Request DB, Catalog DB) or external components (VNFM, Openstack)
+ - Data Stores: Catalog DB (configuration is here */mso-catalog-db*) to store service and resource models, recipes and workflows
+ - SDC Client and Controller (*/asdc-controller) to receive updated models from SDC and populate Catalog DB
+ - SO Monitoring (*/so-monitoring) service to monitor BPMN workflow execution status
-# Compiling MSO
+# Compiling SO
-MSO can be compiled with `mvn clean install`. Integration tests are started with the following profile
-`-P with-integration-tests`
+SO can be compiled with `mvn clean install`. By default it executes:
+ - the standard unit tests
+ - the Spring integration tests
+ - javadoc and doclint creation
+ - BUT *does not build the docker images*
-**to be edited for rrelease**
-Docker containers are build with the following profile
-`-P docker -Ddocker.buildArg.chef_repo_branch_name=bugfix/external_adress -Ddocker.buildArg.chef_repo_git_username=git -Ddocker.buildArg.chef_repo_address=23.253.149.175/mso -Ddocker.buildArg.chef_repo_git_name=chef-repo`
+Integration tests are started with the following profile `-P with-integration-tests`
-# Getting the containers
+You can disable the integration tests by executing: `mvn clean install -DskipTests=true -Dmaven.test.skip=true`
-ONAP MSO containers are stored on [here](https://nexus3.onap.org:10002) for the releases, and [here](https://nexus3.onap.org:10003) for the snapshots
+You can disable the javadoc or doclint creation by executing `mvn clean install -Dmaven.javadoc.skip=true -Dadditionalparam=-Xdoclint:none`
-The following Docker images are the actual deployment images used for running MSO
+# Code Formatting
-| Name | Tag | Description |
-|-----------------|---------|-------------------------------------------------------------------------------------------------------------------------------|
-| onap/mso | 1.0.0 | Contains **JBoss** + **OpenJDK** + **MSO** components (BPMN engine and MSO API handlers and adapters) |
-| library/mariadb | 10.1.11 | **MariaDB** image from Docker.io, this image hosts the database and is preloaded with MSO schema and configuration at startup |
+Your build may fail if you don't follow Code Guidelines. In order to format files run `mvn process-sources -P format`
-# Starting MSO
+# Building Docker images
-### docker-compose
+You can build docker images by executing profile "docker": `mvn clean install -P docker`
-You can use `docker-compose` to start MSO.
-The file is as the root of the directory.
-See `Getting the containers` to pull the images
+If you want to build docker images with out executing test and javadoc, then run the below command `mvn clean install -U -DskipTests=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dadditionalparam=-Xdoclint:none -P docker`
-### Heat template
+# Getting the containers
-A heat template that can be used on RackSpace to spin up the MSO Host VM and run docker-compose is currently being built by the Demo Team.
+ONAP SO containers are stored on [here](https://nexus3.onap.org:10002) for the releases, and [here](https://nexus3.onap.org:10003) for the snapshots
-# Accessing MSO
+The following Docker images are the actual deployment images used for running SO
-MSO UIs are not really used for operating MSO, but they provide information on what is currently happening and get an insight on the components.
+| Name | Tag | Description |
+|-----------------|---------|-------------------------------------------------------------------------------------------------------------------------------|
+| onap/so/api-handler-infra | 1.4.4 | MSO Api handler for SO REST service entry point |
+| onap/so/bpmn-infra | 1.4.4 | BPMN-Infra contains business logic of execution flow |
+| onap/so/catalog-db-adapter | 1.4.4 | CatalogDB to interact with mariaDB catalogdb schema |
+| onap/so/openstack-adapter | 1.4.4 | Adapter to interact with Openstack as a VIM |
+| onap/so/request-db-adapter | 1.4.4 | RequestDB to interact with mariaDB requestdb schema |
+| onap/so/sdc-controller | 1.4.4 | SDC-controller to interact with SDC module |
+| onap/so/sdnc-adapter | 1.4.4 | SDNC Adapter to interacts with SDNC module |
+| onap/so/so-monitoring | 1.4.4 | SO Monitoring for monitoring the SO workflows |
+| onap/so/vfc-adapter | 1.4.4 | Adapter to interact with VFC module |
+| onap/so/vnfm-adapter | 1.4.4 | Adapter to interact with external VNFMs through SOL003 interface |
+| library/mariadb | 10.1.11 | MariaDB image from Docker.io, this image hosts the database and is preloaded with SO schema and configuration at startup |
+
+# Starting SO
-### MSO JBoss console
+### docker-compose
-JBoss Wildly provides administrative functions through the application [server console](https://docs.jboss.org/author/display/WFLY10/Admin+Guide#AdminGuide-Accessingthewebconsole].
+You can use docker-compose to start SO. For running docker-compose, you need to checkout docker-config project.
-Said console can be used to have a look at the status of MSO. It is providing details on deployed artifacts and gives a remote access to the main server log file
+docker-config code is located in a single git repository named *so/docker-config*
-The UI can be accessed trough http://containerHostName:9990/
+To start SO:
+ - `cd docker-config`
+ - set up DOCKER_HOST env variable with your specific host+port i.e. `export DOCKER_HOST=tcp://127.0.0.1:2375`
+ - run helper script `./deploy.sh` (OR `docker-compose up -d`)
-The configuration preloads a default user (admin) with the standard `placeholder` password.
+You can also run / restart independent docker, like to run bpmn-infra docker, use command `docker-compose up -d bpmn-infra`
-The configuration of JBoss should not be touched. But it is possible to look at the two following sections for insights on the MSO health :
+**NOTE**: container *onap/so/vnfm-adapter* is not started via docker-compose script
-![deployments or runtime](http://img11.hostingpics.net/pics/332403image2016112412225.png)
+### Heat template
-Deployments shows what is deployed and running on the application server, you should see the following once MSO is up and running (Actual names of the War files may differ but their numbers and general format should be the same)
+A heat template that can be used on RackSpace to spin up the SO Host VM and run docker-compose is currently being built by the Demo Team.
-***to be upload when rrelease***
+# Accessing SO
-Runtime can be used to have a look a the main server log files, see JVM status and parameters, environment settings etc,...
+SO UIs are not really used for operating SO, but they provide information on what is currently happening and get an insight on the components.
-![runtime monitor](http://img11.hostingpics.net/pics/244948image20161124123216.png)
+### Spring Boot Actuator Endpoints
-See the logging section below for more details about other logfiles (EELF framework)
+Some of SO components (Api Handler, SO monitoring) use Embedded Tomcat from Spring boot to run application.
+To monitor the app, Actuator endpoint can be used:
-### MSO Camunda Cockpit console
+ - /manage/health - Shows application health information
+ - /manage/info - Displays arbitrary application info
-MSO orchestration processes can be monitored with the [Camunda Engine cockpit UI](https://camunda.org/features/cockpit/). It gives an insight about the available processes, allows to trigger them manually and provides monitoring of the currently running processes
+### SO Camunda Cockpit console
-**IMPORTANT NOTE** : since ONAP MSO only uses Camunda Community version it is not possible to see history of running process as this is an Enterprise feature only.
+SO orchestration processes can be monitored with the [Camunda Engine cockpit UI](https://camunda.org/features/cockpit/). It gives an insight about the available processes, allows to trigger them manually and provides monitoring of the currently running processes
+
+**IMPORTANT NOTE** : since ONAP SO only uses Camunda Community version, which don't show history of running processes - SO-Monitoring component was developed for that purpose.
#### Accessing the Cockpit
@@ -86,15 +109,15 @@ It is also possible to trigger them from the UI if you know the parameters that
***screenshots to be uploaded when rrelease***
-### MSO APIs
+### SO APIs
-Most of the MSO features within ONAP MSO are triggered by using **RESTful interfaces**. MSO supports both **HTTP** and **HTTPS**, but is configured on this release with HTTP only using Basic Authentification.
+Most of the SO features within ONAP SO are triggered by using **RESTful interfaces**. SO supports both **HTTP** and **HTTPS**, but is configured on this release with HTTP only using Basic Authentification.
-The MSO APIs are configured to accept requests having a **basic auth. header** set with various **username and password** depending on which API is being triggered.
+The SO APIs are configured to accept requests having a **basic auth. header** set with various **username and password** depending on which API is being triggered.
-All API endpoints are exposed on port **8080**, it is possible to reach all MSO subsystems directly with the proper query (see more information below on how to test MSO functions)
+All API endpoints are exposed on port **8080**, it is possible to reach all SO subsystems directly with the proper query (see more information below on how to test SO functions)
-##### Main API endpoints in the first open source release
+##### Main API endpoints
- ***to be completed*** APIHandler health checks
- ***to be completed*** VID API
@@ -103,15 +126,15 @@ VID endpoint : http://vm1.mso.simpledemo.onap.org:8080/ecomp/mso/infra/serviceIn
The typical easy way to trigger these endpoints is to use a RESTful client or automation framework.
-# Configuration of MSO
+# Configuration of SO
-It is important to understand that the Docker containers are using a configuration file (JSON) in order to provision MSO basic configuration, in the above Jenkins Job, Jenkins pulls that JSON file from the MSO repository, any other mean to provide that JSON file (for specific environments) would also work.
+It is important to understand that the Docker containers are using a configuration file (JSON) in order to provision SO basic configuration, in the above Jenkins Job, Jenkins pulls that JSON file from the SO repository, any other mean to provide that JSON file (for specific environments) would also work.
-Once the deployment of the docker images is done, you will need to configure your installation to be able to interact with all the components that MSO needs.
+Once the deployment of the docker images is done, you will need to configure your installation to be able to interact with all the components that SO needs.
Change the environment file located here : **/shared/mso-docker.json** then run the following command `chef-solo -c /var/berks-cookbooks/chef-repo/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra]`
-**Important note:** The host mso is mapped automatically to c1.vm1.mso.simpledemo.onap.org in /etc/host of the docker image so you can keep mso:8080 when you want to mention the APIH, JRA or Camunda host.
+**Important note:** The host SO is mapped automatically to c1.vm1.mso.simpledemo.onap.org in /etc/host of the docker image so you can keep mso:8080 when you want to mention the APIH, JRA or Camunda host.
Here are the main parameters you could change:
@@ -126,29 +149,22 @@ Here are the main parameters you could change:
The credentials are defined in 2 places:
-- JBoss users credentials are defined in /opt/jboss/standalone/configuration/application-users.properties and are associated to the corresponding role in application-roles.properties (you should not change this file except if you add a new user)
-- In the environment. Replace the authorisation key in the file /shared/mso-docker.json and run the command to apply the configuration as explained above.
+- In the application.yaml in projects
+- application.yaml can be overriden in two places: in *so/docker-config* repository and directories *so/docker-config/volumes/so/config/so-monitoring/onapheat/override.yaml*
+- In *oom* repository (if intstallation is done via oom)
-You can encrypt the JBoss user with the following command `echo -n 'LOGIN:ApplicationRealm:PASSWORD' |openssl dgst -md5` and replace the line corresponding to this user in /opt/jboss/standalone/configuration/application-users.properties
+You can find default users there for specific so component.
+**Note** that these default users should be changed.
You can replace the authentication in the environment by the value returned by the following API `GET on http://c1.vm1.mso.simpledemo.onap.org:8080/asdc/properties/encrypt/{value}/{cryptKey}` where {value} is the string login:password and cryptKey (also defined in the environment) is the key to use to encrypt the credentials
-Exemple of credentials you could change:
-- BPELClient: if you change this credentials, you have to change it in JBoss users AND environment file (+ apply the new config) and be careful to set the same password. In the environment it is the parameter "adaptersPoAuth" under the section "mso-bpmn-urn-config". The cryptKey to use is 07a7159d3bf51a0e53be7a8f89699be7
-- BPMNClient: if you change this credentials, you have to change it in JBoss users AND environment file (+ apply the new config) and be careful to set the same password. In the environment it is the parameter "camundaAuth" under the sections "mso-api-handler-config" AND "mso-api-handler-infra-config". The cryptKey to use is
-aa3871669d893c7fb8abbcda31b88b4f
-
# Logging
-### JBoss
-
-MSO log files are located the [JBoss log](https://docs.jboss.org/author/display/WFLY8/Logging+Configuration) folder in the container.
-
### EELF
-EELF framework is used for **specific logs** (audit, metric and error logs). They are tracking inter component logs (request and response) and allow to follow a complete flow through the MSO subsystem
+EELF framework is used for **specific logs** (audit, metric and error logs). They are tracking inter component logs (request and response) and allow to follow a complete flow through the SO subsystem
-EELF logs are located at the following location on the MSO JBoss container :
+Logs are located at the following locations in SO containers :
- /var/log/ecomp/MSO (each module has its own folder)
@@ -156,27 +172,20 @@ The DEBUG mode is enabled by module and has to be re-enabled if the application
It can be enabled with a GET on the following APIs:
- Camunda (no authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/mso/logging/debug
-- APIH Infra (use any jboss user with role InfraPortal-Client for authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/ecomp/mso/infra/logging/debug
+- APIH Infra (use any user with role InfraPortal-Client for authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/ecomp/mso/infra/logging/debug
- ASDC (no authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/asdc/logging/debug
- DBAdapter (no authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/dbadapters/logging/debug
- Network adapter (no authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/networks/rest/logging/debug
-- SDNC adapter (use any jboss user with role MSO-Client for authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/adapters/rest/logging/debug
+- SDNC adapter (use any user with role MSO-Client for authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/adapters/rest/logging/debug
- VNF adapter (no authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/vnfs/rest/logging/debug
- Tenant adapter (no authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/tenants/rest/logging/debug
- APPC adapter (no authentication): http://c1.vm1.mso.simpledemo.onap.org:8080/appc/rest/logging/debug
-Default JBoss users:
-- with role CSI-Client: CSIClient/password1$
-- with role CSI-Client: InfraPortalClient/password1$
-- with role CSI-Client: MSOClient/password1$
-
-Note that these default users should be changed.
+# Testing SO Functionalities
-# Testing MSO Functionalities
+For this first release of SO, the queries to start the various VNFs should come first through API Handler.
-For this first release of MSO, the queries to start the various VNFs should come first through API Handler.
-
-To help with the testing we are providing here a sample [SoapUI](https://www.soapui.org/) project [file](add link when rrealease) with the main queries that VID should send to MSO
+To help with the testing we are providing here a sample [SoapUI](https://www.soapui.org/) project [file](add link when rrealease) with the main queries that VID should send to SO
### To simulate Loading of Artifacts & models (bypass ASDC)i
@@ -184,11 +193,11 @@ The MariaDB container can load up special SQL scripts that simulates the loading
Simply use the load ability embedded to run the 'preload SQL' script for vFirewall or vDNS
-### Once the HEAT artifacts are loaded into MSO
+### Once the HEAT artifacts are loaded into SO
-It is also possible to simulate queries to the PO (platform orchestrator) adapter of MSO (thus bypassing BPMN flows and API handler) to verify MSO interaction with Rackspace and verify the behavior of the Adapter (so that it loads HEAT and connect to Rackspace and instantiate elements)
+It is also possible to simulate queries to the PO (platform orchestrator) adapter of SO (thus bypassing BPMN flows and API handler) to verify SO interaction with Rackspace and verify the behavior of the Adapter (so that it loads HEAT and connect to Rackspace and instantiate elements)
-Below is a query used from FireFox RESTClient plugin to trigger MSO adapter directly (replace values accordingly)
+Below is a query used from FireFox RESTClient plugin to trigger SO adapter directly (replace values accordingly)
```
POST http://<containername>:8080/vnfs/rest/v1/vnfs/5259ba4a-cf0d-4791-9c60-9117faa5cdea/vf-modules
@@ -201,11 +210,5 @@ login/password BPELClient/password1$F
# Getting Help
-*** to be completed on rrelease ***
-
-mso@lists.onap.org
-
-MSO Javadoc and Maven site
-
-*** to be completed on rrelease ***
+Subscribe and post messages with SO tag in onap-discuss group at https://lists.onap.org/g/onap-discuss
diff --git a/so-monitoring/readme.md b/so-monitoring/readme.md
new file mode 100644
index 0000000000..d4b876c763
--- /dev/null
+++ b/so-monitoring/readme.md
@@ -0,0 +1,35 @@
+# SO Monitoring
+
+----
+
+## Introduction
+
+SO Monitoring provides multiple useful features:
+* Search/Filtering Menu
+* A graphical user interface
+* Workflow pathing
+* Subflow navigation
+* Access to the workflow variables
+
+## Compiling / Running
+
+Compiling is simple: `mvn clean install`
+Compilation may fail if your code is not formatted properly.
+
+## Components
+
+### so-monitoring-handler
+
+
+### so-monitoring-service
+
+Backend API for so-monitoring. Requires basic auth to access it.
+
+Default credentials:
+- with role GUI-Client: gui/password1$
+
+Note that these default users should be changed for production.
+
+### so-monitoring-ui
+
+UI for so-monitoring has a separate README.md - so-monitoring/so-monitoring-ui/src/main/frontend/README.md
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 9ef54272ef..4278a26a69 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
@@ -73,7 +73,7 @@ public class DatabaseServiceProviderImpl implements DatabaseServiceProvider {
.setServiceInstanceId(activeRequests.getServiceInstanceId())
.setNetworkId(activeRequests.getNetworkId()).setEndTime(activeRequests.getEndTime())
.setRequestStatus(activeRequests.getRequestStatus())
- .setServiceIstanceName(activeRequests.getServiceInstanceName())
+ .setServiceInstanceName(activeRequests.getServiceInstanceName())
.setServiceType(activeRequests.getServiceType()).setStartTime(activeRequests.getStartTime())
.build();
result.add(soInfraRequest);
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceIdDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceIdDetail.java
index 06a08f2027..0f34664935 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceIdDetail.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceIdDetail.java
@@ -34,7 +34,7 @@ public class ProcessInstanceIdDetail {
}
/**
- * @return the processInstancId
+ * @return the processInstanceId
*/
public String getProcessInstanceId() {
return processInstanceId;
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequest.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequest.java
index e16cd14598..53b928b88e 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequest.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequest.java
@@ -28,7 +28,7 @@ public class SoInfraRequest {
private final String requestId;
private final String serviceInstanceId;
- private final String serviceIstanceName;
+ private final String serviceInstanceName;
private final String networkId;
private final String requestStatus;
private final String serviceType;
@@ -38,7 +38,7 @@ public class SoInfraRequest {
public SoInfraRequest(final SoInfraRequestBuilder requestBuilder) {
this.requestId = requestBuilder.getRequestId();
this.serviceInstanceId = requestBuilder.getServiceInstanceId();
- this.serviceIstanceName = requestBuilder.getServiceIstanceName();
+ this.serviceInstanceName = requestBuilder.getServiceInstanceName();
this.networkId = requestBuilder.getNetworkId();
this.requestStatus = requestBuilder.getRequestStatus();
this.serviceType = requestBuilder.getServiceType();
@@ -61,10 +61,10 @@ public class SoInfraRequest {
}
/**
- * @return the serviceIstanceName
+ * @return the serviceInstanceName
*/
- public String getServiceIstanceName() {
- return serviceIstanceName;
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
}
/**
@@ -111,7 +111,7 @@ public class SoInfraRequest {
result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
result = prime * result + ((requestStatus == null) ? 0 : requestStatus.hashCode());
result = prime * result + ((serviceInstanceId == null) ? 0 : serviceInstanceId.hashCode());
- result = prime * result + ((serviceIstanceName == null) ? 0 : serviceIstanceName.hashCode());
+ result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode());
result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
return result;
@@ -122,7 +122,7 @@ public class SoInfraRequest {
if (obj instanceof SoInfraRequest) {
final SoInfraRequest other = (SoInfraRequest) obj;
return isEqual(requestId, other.requestId) && isEqual(serviceInstanceId, other.serviceInstanceId)
- && isEqual(serviceIstanceName, other.serviceIstanceName) && isEqual(networkId, other.networkId)
+ && isEqual(serviceInstanceName, other.serviceInstanceName) && isEqual(networkId, other.networkId)
&& isEqual(requestStatus, other.requestStatus) && isEqual(serviceType, other.serviceType)
&& isEqual(startTime, other.startTime) && isEqual(endTime, other.endTime);
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequestBuilder.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequestBuilder.java
index cdaf7641c8..235c481930 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequestBuilder.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequestBuilder.java
@@ -28,7 +28,7 @@ public class SoInfraRequestBuilder {
private String requestId;
private String serviceInstanceId;
- private String serviceIstanceName;
+ private String serviceInstanceName;
private String networkId;
private String requestStatus;
private String serviceType;
@@ -45,8 +45,8 @@ public class SoInfraRequestBuilder {
return this;
}
- public SoInfraRequestBuilder setServiceIstanceName(final String serviceIstanceName) {
- this.serviceIstanceName = serviceIstanceName;
+ public SoInfraRequestBuilder setServiceInstanceName(final String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
return this;
}
@@ -105,10 +105,10 @@ public class SoInfraRequestBuilder {
}
/**
- * @return the serviceIstanceName
+ * @return the serviceInstanceName
*/
- public String getServiceIstanceName() {
- return serviceIstanceName;
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
}
/**
diff --git a/so-monitoring/so-monitoring-service/pom.xml b/so-monitoring/so-monitoring-service/pom.xml
index ff70a77239..f5448aaf5c 100644
--- a/so-monitoring/so-monitoring-service/pom.xml
+++ b/so-monitoring/so-monitoring-service/pom.xml
@@ -64,6 +64,10 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ </dependency>
</dependencies>
<build>
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java
new file mode 100644
index 0000000000..3959631f94
--- /dev/null
+++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.monitoring.rest.api;
+
+import java.security.Principal;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class UserController {
+
+ @RequestMapping("/user")
+ public Principal user(Principal user) {
+ return user;
+ }
+}
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java
index cadd60b0d9..2b53ed8953 100644
--- a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java
+++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java
@@ -2,7 +2,9 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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,16 +23,15 @@ package org.onap.so.monitoring.rest.api;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author waqas.ikram@ericsson.com
*/
@Configuration
-public class WebApplicationConfig extends WebMvcConfigurerAdapter {
+public class WebApplicationConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
- super.addViewControllers(registry);
registry.addViewController("/details/**").setViewName("forward:/");
}
}
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java
new file mode 100644
index 0000000000..298f52bd35
--- /dev/null
+++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.monitoring.rest.api;
+
+import org.onap.so.security.WebSecurityConfig;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+
+@EnableWebSecurity
+@Configuration("att-security-config")
+@Order(2)
+public class WebSecurityConfigImpl extends WebSecurityConfig {
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.authorizeRequests().antMatchers("/actuator", "/actuator/*", "/login", "/", "/index.html", "/*.js",
+ "/*.js.map", "/favicon.png").permitAll().anyRequest().authenticated().and().httpBasic();
+ }
+}
diff --git a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml
index 8235c7480a..417febebf6 100644
--- a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml
+++ b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml
@@ -16,3 +16,12 @@ mso:
url: http://so-request-db-adapter.onap:8083/infraActiveRequests/
auth: Basic YnBlbDpwYXNzd29yZDEk
+spring:
+ main:
+ allow-bean-definition-overriding: true
+ security:
+ usercredentials:
+ -
+ username: gui
+ password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+ role: GUI-Client
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/README.md b/so-monitoring/so-monitoring-ui/src/main/frontend/README.md
index 329de0f833..65731cdc5d 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/README.md
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/README.md
@@ -6,6 +6,15 @@ This project was generated with [Angular CLI](https://github.com/angular/angular
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
+FYI: You may need to change environments.ts to hit to your backend: not so-monitoring:30224 but localhost:8088
+
+### Logging in
+
+Backend API for so-monitoring. Requires basic auth to access it.
+
+Default credentials:
+- with role GUI-Client: gui/password1$
+
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/package-lock.json b/so-monitoring/so-monitoring-ui/src/main/frontend/package-lock.json
index 78642155b4..da937fb46c 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/package-lock.json
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/package-lock.json
@@ -3839,12 +3839,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -3859,17 +3861,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -3986,7 +3991,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -3998,6 +4004,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -4012,6 +4019,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -4019,12 +4027,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@@ -4043,6 +4053,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -4123,7 +4134,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -4135,6 +4147,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -4256,6 +4269,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app-routing.module.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app-routing.module.ts
index 8a505d9e6b..03e77fc2d9 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app-routing.module.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app-routing.module.ts
@@ -1,46 +1,56 @@
-/**
-============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 { NgModule } from '@angular/core';
-import { Routes, RouterModule } from '@angular/router';
-import { HomeComponent } from './home/home.component';
-import { DetailsComponent } from './details/details.component';
-
-const routes: Routes = [
- {
- // Route to home page
- path: '',
- component: HomeComponent
- },
- {
- // Route to page to show individual process based on ID
- path: 'details/:id',
- component: DetailsComponent
- },
-];
-
-@NgModule({
- imports: [RouterModule.forRoot(routes, { onSameUrlNavigation: 'reload' })],
- exports: [RouterModule]
-})
-
-export class AppRoutingModule { }
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. 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.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+*/
+
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+import { HomeComponent } from './home/home.component';
+import { DetailsComponent } from './details/details.component';
+import {AuthGuard} from "./auth.guard";
+import {LoginComponent} from "./login/login.component";
+
+const routes: Routes = [
+ {
+ // Route to home page
+ path: '',
+ component: HomeComponent,
+ canActivate: [AuthGuard]
+ },
+ {
+ // Route to page to show individual process based on ID
+ path: 'details/:id',
+ component: DetailsComponent
+ },
+ {
+ // Route to login page
+ path: 'login',
+ component: LoginComponent
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forRoot(routes, { onSameUrlNavigation: 'reload' })],
+ exports: [RouterModule]
+})
+
+export class AppRoutingModule { }
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
index 23308639b6..71294bfffe 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
@@ -2,6 +2,8 @@
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. 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
@@ -28,7 +30,7 @@ import { AppComponent } from './app.component';
import { SidebarComponent } from './sidebar/sidebar.component';
import { TopbarComponent } from './topbar/topbar.component';
import { HomeComponent } from './home/home.component';
-import { HttpClientModule } from '@angular/common/http';
+import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { DetailsComponent } from './details/details.component';
import { ToastrNotificationService } from './toastr-notification-service.service';
@@ -37,6 +39,9 @@ import { MatFormFieldModule, MatInputModule, MatTableModule, MatTabsModule, MatS
import { NgxSpinnerModule } from 'ngx-spinner';
import { RouterModule, Routes } from '@angular/router';
import { APP_BASE_HREF } from '@angular/common';
+import { LoginComponent } from './login/login.component';
+import {BasicAuthInterceptor} from "./basic-auth.interceptor";
+import {ErrorInterceptor} from "./error.interceptor";
@NgModule({
declarations: [
@@ -44,7 +49,8 @@ import { APP_BASE_HREF } from '@angular/common';
SidebarComponent,
TopbarComponent,
HomeComponent,
- DetailsComponent
+ DetailsComponent,
+ LoginComponent
],
imports: [
BrowserModule,
@@ -64,12 +70,16 @@ import { APP_BASE_HREF } from '@angular/common';
RouterModule,
MatPaginatorModule,
MatSortModule,
- RouterModule.forRoot([])
+ RouterModule.forRoot([]),
+ ReactiveFormsModule
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
- providers: [ToastrNotificationService],
+ providers: [
+ { provide: HTTP_INTERCEPTORS, useClass: BasicAuthInterceptor, multi: true },
+ { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
+ ToastrNotificationService],
bootstrap: [AppComponent]
})
export class AppModule { }
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/auth.guard.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/auth.guard.ts
new file mode 100644
index 0000000000..f437a21710
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/auth.guard.ts
@@ -0,0 +1,46 @@
+/**
+ ============LICENSE_START=======================================================
+ Copyright (C) 2019 Samsung. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+
+ @authors: k.kazak@samsung.com
+ **/
+
+import { Injectable } from '@angular/core';
+import {CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router} from '@angular/router';
+import { Observable } from 'rxjs';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class AuthGuard implements CanActivate {
+
+ constructor(private router:Router) { }
+
+ canActivate(
+ next: ActivatedRouteSnapshot,
+ state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
+ if (localStorage.getItem('authdata')) {
+ // logged in
+ return true;
+ }
+
+ // not logged in
+ this.router.navigate(['/login'], { queryParams: {returnUrl: state.url}});
+ return false;
+ }
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/authentication.service.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/authentication.service.ts
new file mode 100644
index 0000000000..d7610eed0d
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/authentication.service.ts
@@ -0,0 +1,50 @@
+/**
+ ============LICENSE_START=======================================================
+ Copyright (C) 2019 Samsung. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+
+ @authors: k.kazak@samsung.com
+ **/
+
+import {Injectable} from '@angular/core';
+import {HttpClient} from "@angular/common/http";
+import {environment} from "../environments/environment";
+
+@Injectable({
+ providedIn: 'root'
+})
+export class AuthenticationService {
+
+ constructor(private http: HttpClient) {
+ }
+
+ login(username: string, password: string) {
+ // remove old data from storage
+ localStorage.removeItem('authdata');
+ // add to local storage
+ var authdata = window.btoa(username + ':' + password);
+ localStorage.setItem('authdata', authdata);
+
+ // make request
+ return this.http.get(environment.authBackendURL);
+ }
+
+ logout() {
+ // remove from local storage
+ localStorage.removeItem('authdata');
+ }
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/basic-auth.interceptor.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/basic-auth.interceptor.ts
new file mode 100644
index 0000000000..4990d05ecb
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/basic-auth.interceptor.ts
@@ -0,0 +1,43 @@
+/**
+ ============LICENSE_START=======================================================
+ Copyright (C) 2019 Samsung. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+
+ @authors: k.kazak@samsung.com
+ **/
+
+import { Injectable } from '@angular/core';
+import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
+import { Observable } from 'rxjs';
+
+@Injectable()
+export class BasicAuthInterceptor implements HttpInterceptor {
+ intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
+ //add authorization header with basic auth credentials if available
+ let auth = localStorage.getItem('authdata');
+ if (auth) {
+ const authReq = request.clone({
+ headers: request.headers.set('Authorization', 'Basic Z3VpOnBhc3N3b3JkMSQ=')
+ });
+
+ // send cloned request with header to the next handler.
+ return next.handle(authReq);
+ }
+
+ return next.handle(request);
+ }
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
index 0438aa3419..1718678fad 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.spec.ts
@@ -49,10 +49,10 @@ describe('DataService', () => {
expect(service).toBeTruthy();
})));
- // Test retrieveInstance function making POST call
- it('test retrieveInstance POST request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
+ // Test getBpmnInfraRequest function making POST call
+ it('test getBpmnInfraRequest POST request', async(inject([HttpTestingController, DataService, ToastrNotificationService],
(httpClient: HttpTestingController, service: DataService, toastr: ToastrNotificationService) => {
- service.retrieveInstance({}, 1, 2).subscribe(data => { });
+ service.getBpmnInfraRequest({}, 1, 2).subscribe(data => { });
var url = environment.soMonitoringBackendURL + 'v1/search?from=1&to=2';
const mockReq = httpClient.expectOne(url);
expect(mockReq.request.method).toEqual('POST');
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
index 2e8f4237f7..8dfae3da1e 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
@@ -1,95 +1,95 @@
-/**
-============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 { Injectable } from '@angular/core';
-import { HttpClient, HttpErrorResponse } from '@angular/common/http';
-import { Process } from './model/process.model';
-import { catchError } from 'rxjs/operators';
-import { Observable } from 'rxjs';
-import { ProcessInstanceId } from './model/processInstanceId.model';
-import { environment } from '../environments/environment';
-import { HttpResponse } from '@angular/common/http';
-import { PII } from './model/processInstance.model';
-import { HttpErrorHandlerService } from './http-error-handler.service';
-import { ACTINST } from './model/activityInstance.model';
-
-
-@Injectable({
- providedIn: 'root'
-})
-export class DataService {
-
- constructor(private http: HttpClient, private httpErrorHandlerService: HttpErrorHandlerService) { }
-
- // HTTP POST call to running Spring Boot application
- retrieveInstance(servInstId: {}, from: number, to: number) {
- var url = environment.soMonitoringBackendURL + 'v1/search?from=' + from + "&to=" + to;
- return this.http.post<Process[]>(url, servInstId)
- .pipe(
- catchError(this.httpErrorHandlerService.handleError("POST", url))
- );
- }
-
- // HTTP GET to return Process Instance using RequestID
- getProcessInstanceId(requestId): Observable<HttpResponse<ProcessInstanceId>> {
- var url = environment.soMonitoringBackendURL + 'process-instance-id/' + requestId;
- console.log(requestId);
- return this.http.get<ProcessInstanceId>(url, { observe: 'response' })
- .pipe(
- catchError(this.httpErrorHandlerService.handleError("GET", url))
- );
- }
-
- // HTTP GET to return Activity instancs using ProcessInstanceID
- getActivityInstance(processInstanceId): Promise<ACTINST[]> {
- var url = environment.soMonitoringBackendURL + 'activity-instance/' + processInstanceId;
- return this.http.get<ACTINST[]>(url)
- .pipe(
- catchError(this.httpErrorHandlerService.handleError("GET", url))
- ).toPromise();
- }
-
- // HTTP GET to return Activity Instance using ProcessInstanceID
- async getProcessInstance(processInstanceId): Promise<PII> {
- var url = environment.soMonitoringBackendURL + 'process-instance/' + processInstanceId;
- return await (this.http.get<PII>(url)
- .pipe(
- catchError(this.httpErrorHandlerService.handleError("GET", url))))
- .toPromise();
- }
-
- // HTTP GET to return Process Definition using processDefinitionId
- getProcessDefinition(processDefinitionId) {
- var url = environment.soMonitoringBackendURL + 'process-definition/' + processDefinitionId;
- return this.http.get(url).pipe(
- catchError(this.httpErrorHandlerService.handleError("GET", url))
- );
- }
-
- // HTTP GET to return Variable Instance using ProcessInstanceID
- getVariableInstance(processDefinitionId) {
- var url = environment.soMonitoringBackendURL + 'variable-instance/' + processDefinitionId;
- return this.http.get(url).pipe(
- catchError(this.httpErrorHandlerService.handleError("GET", url))
- );
- }
-}
+/**
+============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 { Injectable } from '@angular/core';
+import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
+import { BpmnInfraRequest } from './model/bpmnInfraRequest.model';
+import { catchError } from 'rxjs/operators';
+import { Observable } from 'rxjs';
+import { ProcessInstanceId } from './model/processInstanceId.model';
+import { environment } from '../environments/environment';
+import { HttpResponse } from '@angular/common/http';
+import { ProcessInstanceDetail } from './model/processInstance.model';
+import { HttpErrorHandlerService } from './http-error-handler.service';
+import { ActivityInstance } from './model/activityInstance.model';
+
+
+@Injectable({
+ providedIn: 'root'
+})
+export class DataService {
+
+ constructor(private http: HttpClient, private httpErrorHandlerService: HttpErrorHandlerService) { }
+
+ // HTTP POST call to running Spring Boot application
+ getBpmnInfraRequest(servInstId: {}, from: number, to: number): Observable<BpmnInfraRequest[]> {
+ var url = environment.soMonitoringBackendURL + 'v1/search?from=' + from + "&to=" + to;
+ return this.http.post<BpmnInfraRequest[]>(url, servInstId)
+ .pipe(
+ catchError(this.httpErrorHandlerService.handleError("POST", url))
+ );
+ }
+
+ // HTTP GET to return Process Instance using RequestID
+ getProcessInstanceId(requestId: string): Observable<HttpResponse<ProcessInstanceId>> {
+ var url = environment.soMonitoringBackendURL + 'process-instance-id/' + requestId;
+ console.log(requestId);
+ return this.http.get<ProcessInstanceId>(url, { observe: 'response' })
+ .pipe(
+ catchError(this.httpErrorHandlerService.handleError("GET", url))
+ );
+ }
+
+ // HTTP GET to return Activity instancs using ProcessInstanceID
+ getActivityInstance(processInstanceId: string): Promise<ActivityInstance[]> {
+ var url = environment.soMonitoringBackendURL + 'activity-instance/' + processInstanceId;
+ return this.http.get<ActivityInstance[]>(url)
+ .pipe(
+ catchError(this.httpErrorHandlerService.handleError("GET", url))
+ ).toPromise();
+ }
+
+ // HTTP GET to return Activity Instance using ProcessInstanceID
+ async getProcessInstance(processInstanceId: string): Promise<ProcessInstanceDetail> {
+ var url = environment.soMonitoringBackendURL + 'process-instance/' + processInstanceId;
+ return await (this.http.get<ProcessInstanceDetail>(url)
+ .pipe(
+ catchError(this.httpErrorHandlerService.handleError("GET", url))))
+ .toPromise();
+ }
+
+ // HTTP GET to return Process Definition using processDefinitionId
+ getProcessDefinition(processDefinitionId: string): Observable<Object> {
+ var url = environment.soMonitoringBackendURL + 'process-definition/' + processDefinitionId;
+ return this.http.get(url).pipe(
+ catchError(this.httpErrorHandlerService.handleError("GET", url))
+ );
+ }
+
+ // HTTP GET to return Variable Instance using ProcessInstanceID
+ getVariableInstance(processDefinitionId: string): Observable<Object> {
+ var url = environment.soMonitoringBackendURL + 'variable-instance/' + processDefinitionId;
+ return this.http.get(url).pipe(
+ catchError(this.httpErrorHandlerService.handleError("GET", url))
+ );
+ }
+}
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 8f2af84b0d..4ffacce782 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
@@ -35,10 +35,10 @@ 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 { ActivityInstance } from '../model/activityInstance.model';
+import { ProcessDefinitionDetail } from '../model/processDefinition.model';
+import { ProcessInstanceDetail } from '../model/processInstance.model';
+import { VariableInstance } from '../model/variableInstance.model';
import { ActivatedRoute } from '@angular/router';
import { Params } from '@angular/router';
@@ -49,7 +49,7 @@ class StubbedToastrNotificationService extends ToastrNotificationService {
error() {}
}
-const startActivity: ACTINST = {
+const startActivity: ActivityInstance = {
activityId: "StartEvent_1",
processInstanceId: "processInstanceId-val-1234",
calledProcessInstanceId: "",
@@ -60,7 +60,7 @@ const startActivity: ACTINST = {
startTime: ""
};
-const subProcessActivity: ACTINST = {
+const subProcessActivity: ActivityInstance = {
activityId: "CallActivity_14h26ae",
processInstanceId: "processInstanceId-val-1234",
calledProcessInstanceId: "1234",
@@ -71,7 +71,7 @@ const subProcessActivity: ACTINST = {
startTime: ""
};
-const processDefinition: PDI = {
+const processDefinition: ProcessDefinitionDetail = {
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\">" +
@@ -113,25 +113,25 @@ const processDefinition: PDI = {
"</bpmn:definitions>"
};
-const emptyProcessDefinition: PDI = {
+const emptyProcessDefinition: ProcessDefinitionDetail = {
processDefinitionId: "processDefinitionId-val",
processDefinitionXml: ""
};
-const processInstance: PII = {
- processInstancId: "processInstanceId-val-1234",
+const processInstance: ProcessInstanceDetail = {
+ processInstanceId: "processInstanceId-val-1234",
processDefinitionId: "1",
processDefinitionName: "test",
superProcessInstanceId: "1"
};
-const varInstanceObj: VarInstance = {
+const varInstanceObj: VariableInstance = {
name: 'ABC',
type: 'Object',
value: '{value: 1234}'
};
-const varInstanceStr: VarInstance = {
+const varInstanceStr: VariableInstance = {
name: 'NameStr',
type: 'String',
value: 'valOfStr'
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts
index 97bbbdad02..7106a87937 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts
@@ -1,176 +1,176 @@
-/**
-============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 { Component, OnInit } from '@angular/core';
-import { DataService } from '../data.service';
-import { ActivatedRoute, Router } from "@angular/router";
-import { Process } from '../model/process.model';
-import { ACTINST } from '../model/activityInstance.model';
-import { PII } from '../model/processInstance.model';
-import { PDI } from '../model/processDefinition.model';
-import { CommonModule } from '@angular/common';
-import Viewer from 'bpmn-js/lib/NavigatedViewer';
-import { ViewEncapsulation } from '@angular/core';
-import { MatTabsModule } from '@angular/material/tabs';
-import { VarInstance } from '../model/variableInstance.model';
-import { ToastrNotificationService } from '../toastr-notification-service.service';
-import { NgxSpinnerService } from 'ngx-spinner';
-
-@Component({
- selector: 'app-details',
- templateUrl: './details.component.html',
- styleUrls: ['./details.component.scss'],
- encapsulation: ViewEncapsulation.None
-})
-
-export class DetailsComponent implements OnInit {
- bpmnViewer: any;
-
- processInstanceID: string;
-
- processDefinitionID: string;
-
- processDefinitionName: string;
-
- activityInstance: ACTINST[];
-
- processInstance: PII;
-
- processDefinition: PDI;
-
- variableInstance: VarInstance[];
-
- displayedColumns = ['activityId', 'activityName', 'activityType', 'startTime', 'endTime', 'durationInMillis'];
-
- displayedColumnsVariable = ['name', 'type', 'value'];
-
- constructor(private route: ActivatedRoute, private data: DataService, private popup: ToastrNotificationService,
- private router: Router, private spinner: NgxSpinnerService) { }
-
- async getActInst(procInstId: string) {
- await this.data.getActivityInstance(procInstId).then(
- (data: ACTINST[]) => {
- this.activityInstance = data;
- console.log(data);
- }, error => {
- console.log(error);
- this.popup.error("Unable to get activity instance details for id: " + procInstId + " Error code:" + error.status);
- });
- }
-
- async getProcessDefinition(procDefId) {
- await this.data.getProcessDefinition(procDefId).subscribe(
- async (data: PDI) => {
- this.processDefinition = data;
- console.log(data);
- await this.displayCamundaflow(this.processDefinition.processDefinitionXml, this.activityInstance, this.router);
- }, error => {
- console.log(error);
- this.popup.error("Unable to get process definition for id: " + procDefId + " Error code:" + error.status);
- });
- }
-
- async getProcInstance(procInstId) {
- await this.data.getProcessInstance(procInstId).then(
- async (data: PII) => {
- this.processInstance = data;
- this.processDefinitionID = this.processInstance.processDefinitionId;
- this.processDefinitionName = this.processInstance.processDefinitionName;
- console.log("Process definition id: " + this.processDefinitionID);
- await this.getActInst(this.processInstanceID);
- await this.getProcessDefinition(this.processDefinitionID);
- }, error => {
- console.log(error);
- this.popup.error("Unable to get process instance for id: " + procInstId + " Error code:" + error.status);
- });
- }
-
- displayCamundaflow(bpmnXml, activities: ACTINST[], r: Router) {
- this.spinner.show();
-
- this.bpmnViewer.importXML(bpmnXml, (error) => {
- if (error) {
- console.error('Unable to load BPMN flow ', error);
- this.popup.error('Unable to load BPMN flow ');
- this.spinner.hide();
- } else {
- this.spinner.hide();
- let canvas = this.bpmnViewer.get('canvas');
- var eventBus = this.bpmnViewer.get('eventBus');
- eventBus.on('element.click', function(e) {
-
- activities.forEach(a => {
- if (a.activityId == e.element.id && a.calledProcessInstanceId !== null) {
- console.log("will drill down to : " + a.calledProcessInstanceId);
- r.navigate(['/details/' + a.calledProcessInstanceId]);
- this.spinner.show();
- }
- });
- });
- // zoom to fit full viewport
- canvas.zoom('fit-viewport');
- activities.forEach(a => {
- canvas.addMarker(a.activityId, 'highlight');
- });
- }
- });
- }
-
- getVarInst(procInstId) {
- this.data.getVariableInstance(procInstId).subscribe(
- (data: VarInstance[]) => {
- this.variableInstance = [];
- for (let i = 0; i < data.length; i++) {
- var value = data[i]['value'];
- var type = data[i]['type'];
- if ((type == 'Object') && !(value == null)) {
- try {
- data[i]['value'] = JSON.stringify(value, null, 2);
- }
- catch (error) {
- console.log("Unable to \nError Code: " + error);
- }
- }
- this.variableInstance[i] = data[i];
- }
- console.log(data);
- }, error => {
- console.log(error);
- this.popup.error("Unable to get Variable instances for id: " + procInstId + " Error code:" + error.status);
- });
- }
-
- async ngOnInit() {
- this.bpmnViewer = new Viewer({
- container: '.canvas'
- });
- this.route.params.subscribe(
- async params => {
- this.processInstanceID = params.id as string;
- console.log("Will GET Process instanc using id: " + this.processInstanceID);
- await this.getProcInstance(this.processInstanceID);
-
- this.getVarInst(this.processInstanceID);
- });
- }
-
-}
+/**
+============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 { Component, OnInit } from '@angular/core';
+import { DataService } from '../data.service';
+import { ActivatedRoute, Router } from "@angular/router";
+import { BpmnInfraRequest } from '../model/bpmnInfraRequest.model';
+import { ActivityInstance } from '../model/activityInstance.model';
+import { ProcessInstanceDetail } from '../model/processInstance.model';
+import { ProcessDefinitionDetail } from '../model/processDefinition.model';
+import { CommonModule } from '@angular/common';
+import Viewer from 'bpmn-js/lib/NavigatedViewer';
+import { ViewEncapsulation } from '@angular/core';
+import { MatTabsModule } from '@angular/material/tabs';
+import { VariableInstance } from '../model/variableInstance.model';
+import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { NgxSpinnerService } from 'ngx-spinner';
+
+@Component({
+ selector: 'app-details',
+ templateUrl: './details.component.html',
+ styleUrls: ['./details.component.scss'],
+ encapsulation: ViewEncapsulation.None
+})
+
+export class DetailsComponent implements OnInit {
+ bpmnViewer: any;
+
+ processInstanceID: string;
+
+ processDefinitionID: string;
+
+ processDefinitionName: string;
+
+ activityInstance: ActivityInstance[];
+
+ processInstance: ProcessInstanceDetail;
+
+ processDefinition: ProcessDefinitionDetail;
+
+ variableInstance: VariableInstance[];
+
+ displayedColumns = ['activityId', 'activityName', 'activityType', 'startTime', 'endTime', 'durationInMillis'];
+
+ displayedColumnsVariable = ['name', 'type', 'value'];
+
+ constructor(private route: ActivatedRoute, private data: DataService, private popup: ToastrNotificationService,
+ private router: Router, private spinner: NgxSpinnerService) { }
+
+ async getActivityInstance(procInstId: string) {
+ await this.data.getActivityInstance(procInstId).then(
+ (data: ActivityInstance[]) => {
+ this.activityInstance = data;
+ console.log(data);
+ }, error => {
+ console.log(error);
+ this.popup.error("Unable to get activity instance details for id: " + procInstId + " Error code:" + error.status);
+ });
+ }
+
+ async getProcessDefinition(procDefId: string) {
+ await this.data.getProcessDefinition(procDefId).subscribe(
+ async (data: ProcessDefinitionDetail) => {
+ this.processDefinition = data;
+ console.log(data);
+ await this.displayCamundaflow(this.processDefinition.processDefinitionXml, this.activityInstance, this.router);
+ }, error => {
+ console.log(error);
+ this.popup.error("Unable to get process definition for id: " + procDefId + " Error code:" + error.status);
+ });
+ }
+
+ async getProcInstance(procInstId: string) {
+ await this.data.getProcessInstance(procInstId).then(
+ async (data: ProcessInstanceDetail) => {
+ this.processInstance = data;
+ this.processDefinitionID = this.processInstance.processDefinitionId;
+ this.processDefinitionName = this.processInstance.processDefinitionName;
+ console.log("Process definition id: " + this.processDefinitionID);
+ await this.getActivityInstance(this.processInstanceID);
+ await this.getProcessDefinition(this.processDefinitionID);
+ }, error => {
+ console.log(error);
+ this.popup.error("Unable to get process instance for id: " + procInstId + " Error code:" + error.status);
+ });
+ }
+
+ displayCamundaflow(bpmnXml, activities: ActivityInstance[], r: Router) {
+ this.spinner.show();
+
+ this.bpmnViewer.importXML(bpmnXml, (error) => {
+ if (error) {
+ console.error('Unable to load BPMN flow ', error);
+ this.popup.error('Unable to load BPMN flow ');
+ this.spinner.hide();
+ } else {
+ this.spinner.hide();
+ var canvas = this.bpmnViewer.get('canvas');
+ var eventBus = this.bpmnViewer.get('eventBus');
+ eventBus.on('element.click', function(e) {
+
+ activities.forEach(a => {
+ if (a.activityId == e.element.id && a.calledProcessInstanceId !== null) {
+ console.log("will drill down to : " + a.calledProcessInstanceId);
+ r.navigate(['/details/' + a.calledProcessInstanceId]);
+ this.spinner.show();
+ }
+ });
+ });
+ // zoom to fit full viewport
+ canvas.zoom('fit-viewport');
+ activities.forEach(a => {
+ canvas.addMarker(a.activityId, 'highlight');
+ });
+ }
+ });
+ }
+
+ getVarInst(procInstId: string) {
+ this.data.getVariableInstance(procInstId).subscribe(
+ (data: VariableInstance[]) => {
+ this.variableInstance = [];
+ for (let i = 0; i < data.length; i++) {
+ var value = data[i]['value'];
+ var type = data[i]['type'];
+ if ((type == 'Object') && !(value == null)) {
+ try {
+ data[i]['value'] = JSON.stringify(value, null, 2);
+ }
+ catch (error) {
+ console.log("Unable to \nError Code: " + error);
+ }
+ }
+ this.variableInstance[i] = data[i];
+ }
+ console.log(data);
+ }, error => {
+ console.log(error);
+ this.popup.error("Unable to get Variable instances for id: " + procInstId + " Error code:" + error.status);
+ });
+ }
+
+ async ngOnInit() {
+ this.bpmnViewer = new Viewer({
+ container: '.canvas'
+ });
+ this.route.params.subscribe(
+ async params => {
+ this.processInstanceID = params.id as string;
+ console.log("Will GET BpmnInfraRequest instance using id: " + this.processInstanceID);
+ await this.getProcInstance(this.processInstanceID);
+
+ this.getVarInst(this.processInstanceID);
+ });
+ }
+
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/error.interceptor.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/error.interceptor.ts
new file mode 100644
index 0000000000..afe792c80f
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/error.interceptor.ts
@@ -0,0 +1,45 @@
+/**
+ ============LICENSE_START=======================================================
+ Copyright (C) 2019 Samsung. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+
+ @authors: k.kazak@samsung.com
+ **/
+
+import { Injectable } from '@angular/core';
+import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
+import { Observable, throwError } from 'rxjs';
+import { catchError } from 'rxjs/operators';
+import {AuthenticationService} from "./authentication.service";
+
+@Injectable()
+export class ErrorInterceptor implements HttpInterceptor {
+ constructor(private authenticationService: AuthenticationService) {}
+
+ intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
+ return next.handle(request).pipe(catchError(err => {
+ if (err.status === 401) {
+ // auto logout if 401 response returned from api
+ this.authenticationService.logout();
+ location.reload(true);
+ }
+
+ const error = err.error.message || err.statusText;
+ return throwError(error);
+ }))
+ }
+}
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 39fcdcb293..4fd8cc4c33 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
@@ -128,15 +128,15 @@ SPDX-License-Identifier: Apache-2.0
<mat-table [dataSource]="processData" matSort>
<ng-container matColumnDef="requestId">
<mat-header-cell *matHeaderCellDef mat-sort-header> Request Id </mat-header-cell>
- <mat-cell *matCellDef="let process"><a routerLink="" (click)="getProcessIsntanceId(process.requestId)">{{ process.requestId }}</a></mat-cell>
+ <mat-cell *matCellDef="let process"><a routerLink="" (click)="getProcessInstanceId(process.requestId)">{{ process.requestId }}</a></mat-cell>
</ng-container>
<ng-container matColumnDef="serviceInstanceId">
<mat-header-cell *matHeaderCellDef mat-sort-header> Instance Id </mat-header-cell>
<mat-cell *matCellDef="let process"> {{ process.serviceInstanceId }} </mat-cell>
</ng-container>
- <ng-container matColumnDef="serviceIstanceName">
+ <ng-container matColumnDef="serviceInstanceName">
<mat-header-cell *matHeaderCellDef mat-sort-header> Instance Name </mat-header-cell>
- <mat-cell *matCellDef="let process"> {{ process.serviceIstanceName }} </mat-cell>
+ <mat-cell *matCellDef="let process"> {{ process.serviceInstanceName }} </mat-cell>
</ng-container>
<ng-container matColumnDef="networkId">
<mat-header-cell *matHeaderCellDef mat-sort-header> Network Id </mat-header-cell>
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 cc11ebc05d..0da24ccf36 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
@@ -38,7 +38,7 @@ 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 { BpmnInfraRequest } from '../model/bpmnInfraRequest.model';
import { By } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ProcessInstanceId } from '../model/processInstanceId.model';
@@ -64,7 +64,7 @@ describe('HomeComponent', () => {
let fixture: ComponentFixture<HomeComponent>;
beforeEach(() => {
- spyDataService = jasmine.createSpyObj('DataService', ['retrieveInstance', 'getProcessInstanceId']);
+ spyDataService = jasmine.createSpyObj('DataService', ['getBpmnInfraRequest', 'getProcessInstanceId']);
TestBed.configureTestingModule({
providers: [
@@ -102,7 +102,7 @@ describe('HomeComponent', () => {
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');
+ component.getProcessInstanceId('e8a75940-4a32-11e9-8646-d663bd873d93');
fixture.whenStable().then(() => {
expect(router.navigate).toHaveBeenCalledWith(['/details/114e9ae4-4a32-11e9-8646-d663bd873d93']);
@@ -111,7 +111,7 @@ describe('HomeComponent', () => {
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');
+ component.getProcessInstanceId('e8a75940-4a32-11e9-8646-d663bd873d93');
});
it('should handle error when searchData.getSearchRequest returns an error', () => {
@@ -121,17 +121,17 @@ describe('HomeComponent', () => {
component.makeCall();
});
- it('should handle error when dataService.retrieveInstance returns an error', () => {
+ it('should handle error when dataService.getBpmnInfraRequest 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'));
+ spyDataService.getBpmnInfraRequest.and.callFake(() => {
+ return throwError(new Error('getBpmnInfraRequest error'));
});
component.makeCall();
});
it('should calculate statistics correctly', async(() => {
let requestStatusTypes: string[] = ["COMPLETE", "IN_PROGRESS", "FAILED", "PENDING", "UNLOCKED"];
- let processArr: Process[] = [];
+ let processArr: BpmnInfraRequest[] = [];
// create 5 processes, one of each requestStatusType, with default time.
requestStatusTypes.forEach((status) => {
@@ -142,7 +142,7 @@ describe('HomeComponent', () => {
// 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));
+ spyDataService.getBpmnInfraRequest.and.returnValue(of(processArr));
component.makeCall();
fixture.whenStable().then(() => {
@@ -172,7 +172,7 @@ describe('HomeComponent', () => {
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 };
+ function getProcess(requestIdVal: string, serviceInstanceIdVal: string, serviceInstanceNameVal: string, networkIdVal: string, requestStatusVal: string, serviceTypeVal: string, startTimeVal = "1", endTimeVal = "2"): BpmnInfraRequest {
+ return <BpmnInfraRequest>{ requestId: requestIdVal, serviceInstanceId: serviceInstanceIdVal, serviceInstanceName: serviceInstanceNameVal, networkId: networkIdVal, requestStatus: requestStatusVal, serviceType: serviceTypeVal, startTime: startTimeVal, endTime: endTimeVal };
}
});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts
index 25b75d707d..01e6899b44 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.ts
@@ -23,7 +23,7 @@ SPDX-License-Identifier: Apache-2.0
import { Component, OnInit, ViewChild, ElementRef, Input, ViewEncapsulation } from '@angular/core';
import { DataService } from '../data.service';
import { ActivatedRoute, Router } from "@angular/router";
-import { Process } from '../model/process.model';
+import { BpmnInfraRequest } from '../model/bpmnInfraRequest.model';
import { ProcessInstanceId } from '../model/processInstanceId.model';
import { ToastrNotificationService } from '../toastr-notification-service.service';
import { MatSelectModule } from '@angular/material/select';
@@ -42,7 +42,7 @@ import { Constants } from './home.constant';
encapsulation: ViewEncapsulation.None
})
-export class HomeComponent implements OnInit {
+export class HomeComponent {
totalVal = 0;
completeVal = 0;
@@ -65,7 +65,7 @@ export class HomeComponent implements OnInit {
searchData: SearchData;
startingDate: Date;
- processData: MatTableDataSource<Process>;
+ processData: MatTableDataSource<BpmnInfraRequest>;
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@@ -81,11 +81,11 @@ export class HomeComponent implements OnInit {
var search = this.searchData.getSearchRequest().subscribe((result: SearchRequest) => {
- this.data.retrieveInstance(result.getFilters(), result.getStartTimeInMilliseconds(), result.getEndTimeInMilliseconds())
- .subscribe((data: Process[]) => {
+ this.data.getBpmnInfraRequest(result.getFilters(), result.getStartTimeInMilliseconds(), result.getEndTimeInMilliseconds())
+ .subscribe((data: BpmnInfraRequest[]) => {
this.spinner.hide();
- var processData: Process[] = data;
- this.processData = new MatTableDataSource<Process>(processData);
+ var processData: BpmnInfraRequest[] = data;
+ this.processData = new MatTableDataSource<BpmnInfraRequest>(processData);
this.processData.sort = this.sort;
this.processData.paginator = this.paginator;
this.processData.paginator.firstPage();
@@ -122,7 +122,7 @@ export class HomeComponent implements OnInit {
});
}
- getProcessIsntanceId(requestId: string) {
+ getProcessInstanceId(requestId: string) {
this.spinner.show();
var response = this.data.getProcessInstanceId(requestId).subscribe((data) => {
@@ -137,6 +137,4 @@ export class HomeComponent implements OnInit {
}
});
}
-
- ngOnInit() { }
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.constant.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.constant.ts
index 23ef63ff1e..72c98af3ce 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.constant.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.constant.ts
@@ -35,7 +35,7 @@ export class Constants {
"36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55",
"56", "57", "58", "59"];
- public static DISPLAYED_COLUMNS = ['requestId', 'serviceInstanceId', 'serviceIstanceName', 'networkId', 'requestStatus', 'serviceType', 'startTime', 'endTime'];
+ public static DISPLAYED_COLUMNS = ['requestId', 'serviceInstanceId', 'serviceInstanceName', 'networkId', 'requestStatus', 'serviceType', 'startTime', 'endTime'];
public static DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100];
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.html
new file mode 100644
index 0000000000..107e1da04a
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.html
@@ -0,0 +1,43 @@
+<!--
+============LICENSE_START=======================================================
+Copyright (C) 2019 Samsung. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: k.kazak@samsung.com
+-->
+<h2>Login</h2>
+<form [formGroup]="loginForm" (ngSubmit)="onSubmit()">
+ <div class="form-group">
+ <label for="username">Username</label>
+ <input type="text" formControlName="username" class="form-control" [ngClass]="{ 'is-invalid': submitted && f.username.errors }" />
+ <div *ngIf="submitted && f.username.errors" class="invalid-feedback">
+ <div *ngIf="f.username.errors.required">Username is required</div>
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="password">Password</label>
+ <input type="password" formControlName="password" class="form-control" [ngClass]="{ 'is-invalid': submitted && f.password.errors }" />
+ <div *ngIf="submitted && f.password.errors" class="invalid-feedback">
+ <div *ngIf="f.password.errors.required">Password is required</div>
+ </div>
+ </div>
+ <div class="form-group">
+ <button [disabled]="loading" class="btn btn-primary">Login</button>
+ <img *ngIf="loading" src="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==" />
+ </div>
+ <div *ngIf="error" class="alert alert-danger">{{error}}</div>
+</form>
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.spec.ts
new file mode 100644
index 0000000000..8cf379d04f
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.spec.ts
@@ -0,0 +1,108 @@
+/**
+ ============LICENSE_START=======================================================
+ Copyright (C) 2019 Samsung. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+
+ @authors: k.kazak@samsung.com
+ **/
+
+import {async, ComponentFixture, inject, TestBed} from '@angular/core/testing';
+
+import {LoginComponent} from './login.component';
+import {AuthenticationService} from "../authentication.service";
+import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core";
+import {FormsModule, ReactiveFormsModule} from '@angular/forms';
+import {RouterTestingModule} from "@angular/router/testing";
+import {ActivatedRoute, Router, RouterModule} from "@angular/router";
+
+describe('LoginComponent', () => {
+ // Create SPY Object for Jasmine tests to mock DataService
+ let spyDataService: jasmine.SpyObj<AuthenticationService>;
+ let component: LoginComponent;
+ let fixture: ComponentFixture<LoginComponent>;
+ let router: Router;
+
+ beforeEach(async(() => {
+ spyDataService = jasmine.createSpyObj('AuthenticationService', ['login', 'logout']);
+
+ TestBed.configureTestingModule({
+ providers: [LoginComponent,
+ {provide: AuthenticationService, useValue: spyDataService},
+ {provide: ActivatedRoute, useValue: { snapshot: {queryParams: { returnUrl: 'test'}}}}
+ ],
+ imports: [RouterTestingModule, ReactiveFormsModule, FormsModule, RouterModule.forRoot([])],
+ declarations: [LoginComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
+ });
+
+ fixture = TestBed.createComponent(LoginComponent);
+ component = fixture.componentInstance;
+ router = TestBed.get(Router);
+ }));
+
+
+ it('should create', inject([LoginComponent],
+ (component: LoginComponent) => {
+ expect(component).toBeTruthy();
+ }));
+
+ it('should logout and route to test directory', inject([LoginComponent],
+ (component: LoginComponent) => {
+ component.ngOnInit();
+ expect(component.returnUrl).toBe('test');
+ }));
+
+ it('should logout and route to root directory', inject([LoginComponent],
+ (component: LoginComponent) => {
+ router.initialNavigation();
+ component.ngOnInit();
+ expect(component.returnUrl).toBe('test');
+ }));
+
+ it('should submit without success', inject([LoginComponent],
+ (component: LoginComponent) => {
+ component.ngOnInit();
+ expect(component.loginForm.valid).toBe(false);
+ component.onSubmit();
+ expect(component.submitted).toBe(true);
+ }));
+
+ it('should submit without success', inject([LoginComponent],
+ (component: LoginComponent) => {
+ component.ngOnInit();
+ expect(component.loginForm.valid).toBe(false);
+ spyDataService.login.and.returnValue(Promise.resolve());
+
+ let compiled = fixture.debugElement.nativeElement;
+ let username = compiled.querySelector('input[type="text"]');
+ let password = compiled.querySelector('input[type="password"]');
+
+ fixture.detectChanges();
+
+ // Change value
+ username.value = 'test';
+ password.value = 'password';
+
+ // dispatch input event
+ dispatchEvent(new Event('input'));
+
+ component.onSubmit();
+ expect(component.submitted).toBe(true);
+ }));
+});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts
new file mode 100644
index 0000000000..4a3f4e6b0f
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts
@@ -0,0 +1,81 @@
+/**
+ ============LICENSE_START=======================================================
+ Copyright (C) 2019 Samsung. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+
+ @authors: k.kazak@samsung.com
+ **/
+
+import { Component, OnInit } from '@angular/core';
+import {FormBuilder, FormGroup, Validators, ReactiveFormsModule} from "@angular/forms";
+import {ActivatedRoute, Router} from "@angular/router";
+import {AuthenticationService} from "../authentication.service";
+import {first} from "rxjs/internal/operators";
+
+@Component({
+ selector: 'app-login',
+ templateUrl: './login.component.html',
+ styleUrls: []
+})
+export class LoginComponent implements OnInit {
+
+ loginForm: FormGroup;
+ loading = false;
+ submitted = false;
+ returnUrl: string;
+ error = '';
+
+ constructor(private formBuilder: FormBuilder,
+ private route: ActivatedRoute,
+ private router: Router,
+ private authenticationService: AuthenticationService) { }
+
+ ngOnInit() {
+ this.loginForm = this.formBuilder.group({
+ username: ['', Validators.required],
+ password: ['', Validators.required]
+ });
+
+ // logout
+ this.authenticationService.logout();
+
+ this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
+ }
+
+ // convenience getter for easy access to form fields
+ get f() { return this.loginForm.controls; }
+
+ onSubmit() {
+ this.submitted = true;
+
+ // stop here if form is invalid
+ if (this.loginForm.invalid) {
+ return;
+ }
+
+ this.loading = true;
+ this.authenticationService.login(this.f.username.value, this.f.password.value)
+ .subscribe(
+ next => {
+ this.router.navigate([this.returnUrl]);
+ },
+ error => {
+ this.error = error;
+ this.loading = false;
+ });
+ }
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/activityInstance.model.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/activityInstance.model.ts
index de5e98367f..86831f25a7 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/activityInstance.model.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/activityInstance.model.ts
@@ -1,32 +1,32 @@
-/**
-============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
-*/
-
-export interface ACTINST {
- activityId: string;
- activityName: string;
- activityType: string;
- processInstanceId: string;
- calledProcessInstanceId: string;
- startTime: string;
- endTime: string;
- durationInMillis: string;
-}
+/**
+============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
+*/
+
+export interface ActivityInstance {
+ activityId: string;
+ activityName: string;
+ activityType: string;
+ processInstanceId: string;
+ calledProcessInstanceId: string;
+ startTime: string;
+ endTime: string;
+ durationInMillis: string;
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/process.model.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/bpmnInfraRequest.model.ts
index 245981884a..e25b06f4ac 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/process.model.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/bpmnInfraRequest.model.ts
@@ -1,32 +1,32 @@
-/**
-============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
-*/
-
-export interface Process {
- requestId: string;
- serviceInstanceId: string;
- serviceIstanceName: string;
- networkId: string;
- requestStatus: string;
- serviceType: string;
- startTime: string;
- endTime: string;
-}
+/**
+============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
+*/
+
+export interface BpmnInfraRequest {
+ requestId: string;
+ serviceInstanceId: string;
+ serviceInstanceName: string;
+ networkId: string;
+ requestStatus: string;
+ serviceType: string;
+ startTime: string;
+ endTime: string;
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processDefinition.model.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processDefinition.model.ts
index 73eab7051b..c9ce7feb3b 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processDefinition.model.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processDefinition.model.ts
@@ -1,26 +1,26 @@
-/**
-============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
-*/
-
-export interface PDI {
- processDefinitionId: string;
- processDefinitionXml: string;
-}
+/**
+============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
+*/
+
+export interface ProcessDefinitionDetail {
+ processDefinitionId: string;
+ processDefinitionXml: string;
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processInstance.model.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processInstance.model.ts
index b1338bbeae..2187436ae7 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processInstance.model.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/processInstance.model.ts
@@ -1,28 +1,28 @@
-/**
-============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
-*/
-
-export interface PII {
- processInstancId: string;
- processDefinitionId: string;
- processDefinitionName: string;
- superProcessInstanceId: string;
-}
+/**
+============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
+*/
+
+export interface ProcessInstanceDetail {
+ processInstanceId: string;
+ processDefinitionId: string;
+ processDefinitionName: string;
+ superProcessInstanceId: string;
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.ts
index 4552590041..a948eb7cfe 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.ts
@@ -1,105 +1,107 @@
-import { ToastrNotificationService } from "../toastr-notification-service.service";
-
-/**
-============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 { Observable, throwError, of } from 'rxjs';
-import { SearchRequest } from "./SearchRequest.model";
-export class SearchData {
-
- public selectedValueSII = "EQ";
- public selectedValueRI = "EQ";
- public selectedValueSN = "EQ";
- public selectedValueSTATUS = "ALL";
-
- private now = Date.now();
- // Minus 1 hour from current time for start date
- public startDate = new Date(this.now - (1 * 60 * 60 * 1000));
- public selectedStartHour = this.getNumberAsString(this.startDate.getHours());
- public selectedStartMinute = this.getNumberAsString(this.startDate.getMinutes());
-
- public endDate = new Date(this.now);
- public selectedEndHour = this.getNumberAsString(this.endDate.getHours());
- public selectedEndMinute = this.getNumberAsString(this.endDate.getMinutes());
-
-
- public serviceInstanceId: string;
- public requestId: string;
- public serviceInstanceName: string;
-
- private startTimeInMilliseconds: number;
- private endTimeInMilliseconds: number;
-
- constructor() {
- }
-
- public getSearchRequest(): Observable<SearchRequest> {
- var searchFields = {};
- if ((!this.startDate || this.startDate === null) || (!this.endDate || this.endDate === null)) {
- console.error("Found either start time or end time null or undefined");
- return throwError("Found end or start date empty, Please enter start and end date");
- }
-
- this.startDate.setHours(parseInt(this.selectedStartHour));
- this.startDate.setMinutes(parseInt(this.selectedStartMinute));
-
- this.endDate.setHours(parseInt(this.selectedEndHour));
- this.endDate.setMinutes(parseInt(this.selectedEndMinute));
-
- this.startTimeInMilliseconds = this.startDate.getTime();
- this.endTimeInMilliseconds = this.endDate.getTime();
-
- if (this.startTimeInMilliseconds > this.endTimeInMilliseconds) {
- console.error("End time: " + this.endDate + " can not be greater then start time: " + this.startDate);
- return throwError("End time: " + this.endDate + " can not be greater then start time: " + this.startDate);
- }
-
-
- if (!this.isEmpty(this.selectedValueSII) && !this.isEmpty(this.serviceInstanceId)) {
- searchFields["serviceInstanceId"] = [this.selectedValueSII, this.serviceInstanceId]
- }
- if (!this.isEmpty(this.selectedValueRI) && !this.isEmpty(this.requestId)) {
- searchFields["requestId"] = [this.selectedValueRI, this.requestId]
- }
- if (!this.isEmpty(this.selectedValueSN) && !this.isEmpty(this.serviceInstanceName)) {
- searchFields["serviceInstanceName"] = [this.selectedValueSN, this.serviceInstanceName]
- }
-
- if (!this.isEmpty(this.selectedValueSTATUS) && this.selectedValueSTATUS !== "ALL") {
- searchFields["requestStatus"] = ["EQ", this.selectedValueSTATUS]
- }
-
- return of(new SearchRequest(searchFields, this.startTimeInMilliseconds, this.endTimeInMilliseconds));
- }
-
- private isEmpty(str) {
- return (!str || 0 === str.length);
- }
-
- private getNumberAsString(num: number) {
- if (num <= 9) {
- return "0" + num;
- }
- return "" + num;
- }
-
-}
+import { ToastrNotificationService } from "../toastr-notification-service.service";
+
+/**
+============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 { Observable, throwError, of } from 'rxjs';
+import { SearchRequest } from "./SearchRequest.model";
+import { Input } from "@angular/core";
+
+export class SearchData {
+
+ @Input() selectedValueSII = "EQ";
+ @Input() selectedValueRI = "EQ";
+ @Input() selectedValueSN = "EQ";
+ @Input() selectedValueSTATUS = "ALL";
+
+ private now = Date.now();
+ // Minus 1 hour from current time for start date
+ @Input() startDate = new Date(this.now - (1 * 60 * 60 * 1000));
+ @Input() selectedStartHour = this.getNumberAsString(this.startDate.getHours());
+ @Input() selectedStartMinute = this.getNumberAsString(this.startDate.getMinutes());
+
+ @Input() endDate = new Date(this.now);
+ @Input() selectedEndHour = this.getNumberAsString(this.endDate.getHours());
+ @Input() selectedEndMinute = this.getNumberAsString(this.endDate.getMinutes());
+
+
+ @Input() serviceInstanceId: string;
+ @Input() requestId: string;
+ @Input() serviceInstanceName: string;
+
+ private startTimeInMilliseconds: number;
+ private endTimeInMilliseconds: number;
+
+ constructor() {
+ }
+
+ public getSearchRequest(): Observable<SearchRequest> {
+ var searchFields = {};
+ if ((!this.startDate || this.startDate === null) || (!this.endDate || this.endDate === null)) {
+ console.error("Found either start time or end time null or undefined");
+ return throwError("Found end or start date empty, Please enter start and end date");
+ }
+
+ this.startDate.setHours(parseInt(this.selectedStartHour));
+ this.startDate.setMinutes(parseInt(this.selectedStartMinute));
+
+ this.endDate.setHours(parseInt(this.selectedEndHour));
+ this.endDate.setMinutes(parseInt(this.selectedEndMinute));
+
+ this.startTimeInMilliseconds = this.startDate.getTime();
+ this.endTimeInMilliseconds = this.endDate.getTime();
+
+ if (this.startTimeInMilliseconds > this.endTimeInMilliseconds) {
+ console.error("End time: " + this.endDate + " can not be greater then start time: " + this.startDate);
+ return throwError("End time: " + this.endDate + " can not be greater then start time: " + this.startDate);
+ }
+
+
+ if (!this.isEmpty(this.selectedValueSII) && !this.isEmpty(this.serviceInstanceId)) {
+ searchFields["serviceInstanceId"] = [this.selectedValueSII, this.serviceInstanceId]
+ }
+ if (!this.isEmpty(this.selectedValueRI) && !this.isEmpty(this.requestId)) {
+ searchFields["requestId"] = [this.selectedValueRI, this.requestId]
+ }
+ if (!this.isEmpty(this.selectedValueSN) && !this.isEmpty(this.serviceInstanceName)) {
+ searchFields["serviceInstanceName"] = [this.selectedValueSN, this.serviceInstanceName]
+ }
+
+ if (!this.isEmpty(this.selectedValueSTATUS) && this.selectedValueSTATUS !== "ALL") {
+ searchFields["requestStatus"] = ["EQ", this.selectedValueSTATUS]
+ }
+
+ return of(new SearchRequest(searchFields, this.startTimeInMilliseconds, this.endTimeInMilliseconds));
+ }
+
+ private isEmpty(str) {
+ return (!str || 0 === str.length);
+ }
+
+ private getNumberAsString(num: number) {
+ if (num <= 9) {
+ return "0" + num;
+ }
+ return "" + num;
+ }
+
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/variableInstance.model.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/variableInstance.model.ts
index 4b9dec0aa4..a4a3a357ba 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/variableInstance.model.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/variableInstance.model.ts
@@ -1,27 +1,27 @@
-/**
-============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
-*/
-
-export interface VarInstance {
- name: string;
- value: string;
- type: string;
-}
+/**
+============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
+*/
+
+export interface VariableInstance {
+ name: string;
+ value: string;
+ type: string;
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.html
index e8b54d7ae3..1c623518c7 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.html
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.html
@@ -1,29 +1,34 @@
-<!--
-============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
--->
-
-<nav>
- <ul>
- <li>
- <a routerLink="/">Home</a>
- </li>
- </ul>
-</nav>
+<!--
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. 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.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+-->
+
+<nav>
+ <ul>
+ <li>
+ <a routerLink="/">Home</a>
+ </li>
+ <li>
+ <a routerLink="/login">Logout</a>
+ </li>
+ </ul>
+</nav>
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.ts
index 19985e79a3..e032bab637 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.ts
@@ -1,40 +1,39 @@
-/**
-============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 { Component, OnInit } from '@angular/core';
-import { Router, NavigationEnd } from '@angular/router';
-
-@Component({
- selector: 'app-sidebar',
- templateUrl: './sidebar.component.html',
- styleUrls: ['./sidebar.component.scss']
-})
-
-export class SidebarComponent implements OnInit {
-
- currentUrl: string;
-
- constructor(private router: Router) {
- router.events.subscribe((_: NavigationEnd) => this.currentUrl = _.url);
- }
- ngOnInit() { }
-}
+/**
+============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 { Component, OnInit } from '@angular/core';
+import { Router, NavigationEnd } from '@angular/router';
+
+@Component({
+ selector: 'app-sidebar',
+ templateUrl: './sidebar.component.html',
+ styleUrls: ['./sidebar.component.scss']
+})
+
+export class SidebarComponent {
+
+ currentUrl: string;
+
+ constructor(private router: Router) {
+ router.events.subscribe((_: NavigationEnd) => this.currentUrl = _.url);
+ }
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.ts
index 1fdd258282..2e6c90864d 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/topbar/topbar.component.ts
@@ -1,36 +1,35 @@
-/**
-============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 { Component, OnInit } from '@angular/core';
-
-@Component({
- selector: 'app-topbar',
- templateUrl: './topbar.component.html',
- styleUrls: ['./topbar.component.scss']
-})
-
-export class TopbarComponent implements OnInit {
-
- constructor() { }
-
- ngOnInit() { }
-}
+/**
+============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 { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-topbar',
+ templateUrl: './topbar.component.html',
+ styleUrls: ['./topbar.component.scss']
+})
+
+export class TopbarComponent {
+
+ constructor() { }
+
+}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/environments/environment.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/environments/environment.ts
index f0c63fe582..484a156fa9 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/environments/environment.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/environments/environment.ts
@@ -2,6 +2,8 @@
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. 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
@@ -24,5 +26,6 @@ SPDX-License-Identifier: Apache-2.0
export const environment = {
production: false,
- soMonitoringBackendURL: 'http://so-monitoring:30224/so/monitoring/'
+ soMonitoringBackendURL: 'http://so-monitoring:30224/so/monitoring/',
+ authBackendURL: 'http://so-monitoring:30224/user'
};
diff --git a/version.properties b/version.properties
index 28c09b9d6c..f78f30b18d 100644
--- a/version.properties
+++ b/version.properties
@@ -3,8 +3,8 @@
# because they are used in Jenkins, whose plug-in doesn't support
major=1
-minor=4
-patch=4
+minor=5
+patch=1
base_version=${major}.${minor}.${patch}
diff --git a/vnfm-simulator/vnfm-service/pom.xml b/vnfm-simulator/vnfm-service/pom.xml
index 380381f53b..1e3244bae4 100644
--- a/vnfm-simulator/vnfm-service/pom.xml
+++ b/vnfm-simulator/vnfm-service/pom.xml
@@ -1,149 +1,171 @@
-<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.vnfm</groupId>
- <artifactId>vnfm-simulator</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <artifactId>vnfm-service</artifactId>
- <name>${project.artifactId}</name>
+<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.vnfm</groupId>
+ <artifactId>vnfm-simulator</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>vnfm-service</artifactId>
+ <name>${project.artifactId}</name>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <java.version>1.8</java.version>
- <okhttp-version>2.7.5</okhttp-version>
- <gson-version>2.8.1</gson-version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnfm-adapter-ext-clients</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jaxrs</artifactId>
- <version>1.5.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.directory.studio</groupId>
- <artifactId>org.apache.commons.io</artifactId>
- <version>2.4</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>1.1.1</version>
- </dependency>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <java.version>1.8</java.version>
+ <okhttp-version>2.7.5</okhttp-version>
+ <gson-version>2.8.1</gson-version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter-ext-clients</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-devtools</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security.oauth</groupId>
+ <artifactId>spring-security-oauth2</artifactId>
+ <version>2.3.6.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jaxrs</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>org.apache.commons.io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1.1</version>
+ </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>2.6.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>2.6.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.9.8</version>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- </dependency>
- <!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.9.3</version>
- </dependency>
- <dependency>
- <groupId>org.modelmapper</groupId>
- <artifactId>modelmapper</artifactId>
- <version>2.3.0</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okio</groupId>
- <artifactId>okio</artifactId>
- <version>1.13.0</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>okhttp</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${gson-version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <version>${springboot.version}</version>
- <configuration>
- <mainClass>org.onap.svnfm.simulator.config.SvnfmApplication</mainClass>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>2.6.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>2.6.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.9.8</version>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ </dependency>
+ <!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.9.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.modelmapper</groupId>
+ <artifactId>modelmapper</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okio</groupId>
+ <artifactId>okio</artifactId>
+ <version>1.13.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>${gson-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${springboot.version}</version>
+ <configuration>
+ <mainClass>org.onap.svnfm.simulator.config.SvnfmApplication</mainClass>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <excludes>
+ <exclude>**/*.p12</exclude>
+ <exclude>**/*.jks</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*.p12</include>
+ <include>**/*.jks</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
</project>
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
index 91b79754a5..a1abb05f07 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
@@ -1,9 +1,9 @@
package org.onap.svnfm.simulator.config;
-import java.net.InetAddress;
import java.util.Arrays;
import org.onap.svnfm.simulator.constants.Constant;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.cache.Cache;
@@ -19,6 +19,12 @@ public class ApplicationConfig implements ApplicationRunner {
private static final String PORT = "local.server.port";
+ @Value("${server.dns.name:so-vnfm-simulator.onap}")
+ private String serverDnsName;
+
+ @Value("${server.request.grant.auth:oauth}")
+ private String grantAuth;
+
@Autowired
private Environment environment;
@@ -26,17 +32,21 @@ public class ApplicationConfig implements ApplicationRunner {
@Override
public void run(final ApplicationArguments args) throws Exception {
- baseUrl = "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + environment.getProperty(PORT);
+ baseUrl = "https://" + serverDnsName + ":" + environment.getProperty(PORT);
}
public String getBaseUrl() {
return baseUrl;
}
+ public String getGrantAuth() {
+ return grantAuth;
+ }
+
@Bean
public CacheManager cacheManager() {
- Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE);
- SimpleCacheManager manager = new SimpleCacheManager();
+ final Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE);
+ final SimpleCacheManager manager = new SimpleCacheManager();
manager.setCaches(Arrays.asList(inlineResponse201));
return manager;
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java
index 9c3a02d4e6..2140b57488 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/controller/SvnfmController.java
@@ -26,7 +26,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.svnfm.simulator.constants.Constant;
import org.onap.svnfm.simulator.repository.VnfmCacheRepository;
@@ -101,13 +100,12 @@ public class SvnfmController {
* @throws InterruptedException
*/
@PostMapping(value = "/vnf_instances/{vnfInstanceId}/instantiate")
- public ResponseEntity<Void> instantiateVnf(@PathVariable("vnfInstanceId") final String vnfId,
- @RequestBody final InstantiateVnfRequest instantiateVNFRequest) {
- LOGGER.info("Start instantiateVNFRequest {} ", instantiateVNFRequest);
+ public ResponseEntity<Void> instantiateVnf(@PathVariable("vnfInstanceId") final String vnfId) {
+ LOGGER.info("Start instantiateVNFRequest for vnf id {} ", vnfId);
final HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
- headers.add(HttpHeaders.LOCATION, svnfmService.instantiateVnf(vnfId, instantiateVNFRequest));
+ headers.add(HttpHeaders.LOCATION, svnfmService.instantiateVnf(vnfId));
return new ResponseEntity<>(headers, HttpStatus.ACCEPTED);
}
@@ -168,6 +166,6 @@ public class SvnfmController {
final HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
- return new ResponseEntity<>(response, headers, HttpStatus.OK);
+ return new ResponseEntity<>(response, headers, HttpStatus.CREATED);
}
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java
index 153970b053..9a3cd95bec 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java
@@ -22,7 +22,8 @@
package org.onap.svnfm.simulator.notifications;
-import org.onap.svnfm.simulator.services.SvnfmService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
@@ -31,16 +32,16 @@ import org.onap.svnfm.simulator.services.SvnfmService;
*/
public class VnfInstantiationNotification implements Runnable {
- SvnfmService svnfmService = new SvnfmService();
+ private static final Logger logger = LoggerFactory.getLogger(VnfInstantiationNotification.class);
@Override
public void run() {
try {
Thread.sleep(10000);
} catch (final InterruptedException e) {
- e.printStackTrace();
+ logger.error("Error occured while simulating instantiation ", e);
Thread.currentThread().interrupt();
}
- System.out.println("Instantiation process finished");
+ logger.info("Instantiation process finished");
}
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java
index ff299ce12e..39de3444db 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java
@@ -22,6 +22,9 @@
package org.onap.svnfm.simulator.notifications;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
* @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
@@ -29,15 +32,17 @@ package org.onap.svnfm.simulator.notifications;
*/
public class VnfmAdapterCreationNotification implements Runnable {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterCreationNotification.class);
+
@Override
public void run() {
try {
Thread.sleep(10000);
} catch (final InterruptedException e) {
- e.printStackTrace();
+ logger.error("Error occured while simulating creation ", e);
Thread.currentThread().interrupt();
}
- System.out.println("Call to VNFM Adapter-Create");
+ logger.info("Call to VNFM Adapter-Create");
}
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java
index f7a8eaa2dd..af6064fd6a 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java
@@ -22,6 +22,9 @@
package org.onap.svnfm.simulator.notifications;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
* @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
@@ -29,15 +32,17 @@ package org.onap.svnfm.simulator.notifications;
*/
public class VnfmAdapterDeletionNotification implements Runnable {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterDeletionNotification.class);
+
@Override
public void run() {
try {
Thread.sleep(10000);
} catch (final InterruptedException e) {
- e.printStackTrace();
+ logger.error("Error occured while simulating deletion ", e);
Thread.currentThread().interrupt();
}
- System.out.println("Call to VNFM Adapter-Delete");
+ logger.info("Call to VNFM Adapter-Delete");
}
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java
new file mode 100644
index 0000000000..5d2c310635
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java
@@ -0,0 +1,28 @@
+package org.onap.svnfm.simulator.oauth;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
+
+@Configuration
+@EnableAuthorizationServer
+@Profile("oauth-authentication")
+/**
+ * Configures the authorization server for oauth token based authentication when the spring profile
+ * "oauth-authentication" is active
+ */
+public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
+
+ private static final int ONE_DAY = 60 * 60 * 24;
+
+ @Override
+ public void configure(final ClientDetailsServiceConfigurer clients) throws Exception {
+ clients.inMemory().withClient("vnfmadapter")
+ .secret("$2a$10$dHzTlqSBcm8hdO52LBvnX./zNTvUzzJy.lZrc4bCBL5gkln0wX6T6")
+ .authorizedGrantTypes("client_credentials").scopes("write").accessTokenValiditySeconds(ONE_DAY)
+ .refreshTokenValiditySeconds(ONE_DAY);
+ }
+
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java
new file mode 100644
index 0000000000..d6eda28eb6
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.svnfm.simulator.oauth;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.util.ArrayList;
+import java.util.Collection;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.GsonHttpMessageConverter;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+/**
+ * Configures message converter
+ */
+@Configuration
+public class JsonSerializerConfiguration {
+
+ @Bean
+ public HttpMessageConverters customConverters() {
+ final Collection<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
+
+ final Gson gson = new GsonBuilder()
+ .registerTypeHierarchyAdapter(OAuth2AccessToken.class, new OAuth2AccessTokenAdapter()).create();
+ final GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter(gson);
+ messageConverters.add(gsonHttpMessageConverter);
+ return new HttpMessageConverters(true, messageConverters);
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java
new file mode 100644
index 0000000000..7bccffa2e0
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java
@@ -0,0 +1,31 @@
+package org.onap.svnfm.simulator.oauth;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import java.lang.reflect.Type;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+public class OAuth2AccessTokenAdapter implements JsonSerializer<OAuth2AccessToken> {
+
+ @Override
+ public JsonElement serialize(final OAuth2AccessToken src, final Type typeOfSrc,
+ final JsonSerializationContext context) {
+ final JsonObject obj = new JsonObject();
+ obj.addProperty(OAuth2AccessToken.ACCESS_TOKEN, src.getValue());
+ obj.addProperty(OAuth2AccessToken.TOKEN_TYPE, src.getTokenType());
+ if (src.getRefreshToken() != null) {
+ obj.addProperty(OAuth2AccessToken.REFRESH_TOKEN, src.getRefreshToken().getValue());
+ }
+ obj.addProperty(OAuth2AccessToken.EXPIRES_IN, src.getExpiresIn());
+ final JsonArray scopeObj = new JsonArray();
+ for (final String scope : src.getScope()) {
+ scopeObj.add(scope);
+ }
+ obj.add(OAuth2AccessToken.SCOPE, scopeObj);
+
+ return obj;
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java
new file mode 100644
index 0000000000..18fb1a9461
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.svnfm.simulator.oauth;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+
+@Configuration
+@EnableResourceServer
+@Profile("oauth-authentication")
+/**
+ * Enforces oauth token based authentication when the spring profile "oauth-authentication" is active
+ */
+public class OAuth2ResourceServer extends ResourceServerConfigurerAdapter {
+
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
index 1e31ab2fdb..6e9478bdeb 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java
@@ -1,9 +1,24 @@
package org.onap.svnfm.simulator.services;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
import javax.ws.rs.core.MediaType;
import org.apache.commons.codec.binary.Base64;
import org.modelmapper.ModelMapper;
@@ -28,16 +43,24 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperatio
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsOauth2ClientCredentials;
import org.onap.svnfm.simulator.config.ApplicationConfig;
import org.onap.svnfm.simulator.model.VnfOperation;
import org.onap.svnfm.simulator.model.Vnfds;
import org.onap.svnfm.simulator.repository.VnfOperationRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
public abstract class OperationProgressor implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(OperationProgressor.class);
+ private static final String CERTIFICATE_TO_TRUST = "so-vnfm-adapter.crt.pem";
+
+ private Resource keyStoreResource = new ClassPathResource("so-vnfm-simulator.p12");
+ private String keyStorePassword = "7Em3&j4.19xYiMelhD5?xbQ.";
+
protected final VnfOperation operation;
protected final SvnfmService svnfmService;
private final VnfOperationRepository vnfOperationRepository;
@@ -61,14 +84,43 @@ public abstract class OperationProgressor implements Runnable {
String callBackUrl = subscriptionService.getSubscriptions().iterator().next().getCallbackUri();
callBackUrl = callBackUrl.substring(0, callBackUrl.indexOf("/lcn/"));
apiClient.setBasePath(callBackUrl);
+ apiClient.setKeyManagers(getKeyManagers());
+ apiClient.setSslCaCert(getCertificateToTrust());
notificationClient = new DefaultApi(apiClient);
final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient grantApiClient =
new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient();
grantApiClient.setBasePath(callBackUrl);
+ grantApiClient.setKeyManagers(getKeyManagers());
+ grantApiClient.setSslCaCert(getCertificateToTrust());
grantClient = new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api.DefaultApi(grantApiClient);
}
+ private InputStream getCertificateToTrust() {
+ try {
+ return new ClassPathResource(CERTIFICATE_TO_TRUST).getInputStream();
+ } catch (final IOException exception) {
+ LOGGER.error("Error reading certificate to trust, https calls to VNFM adapter will fail", exception);
+ return null;
+ }
+ }
+
+ private KeyManager[] getKeyManagers() {
+ KeyStore keystore;
+ try {
+ keystore = KeyStore.getInstance("pkcs12");
+ keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
+ KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
+ keyManagerFactory.init(keystore, keyStorePassword.toCharArray());
+ return keyManagerFactory.getKeyManagers();
+ } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException
+ | UnrecoverableKeyException exception) {
+ LOGGER.error("Error reading certificate, https calls using two way TLS to VNFM adapter will fail",
+ exception);
+ return new KeyManager[0];
+ }
+ }
+
@Override
public void run() {
try {
@@ -107,6 +159,8 @@ public abstract class OperationProgressor implements Runnable {
Thread.sleep(milliSeconds);
} catch (final InterruptedException e) {
operation.setOperationState(InlineResponse200.OperationStateEnum.FAILED);
+ // Restore interrupted state
+ Thread.currentThread().interrupt();
}
}
@@ -169,11 +223,15 @@ public abstract class OperationProgressor implements Runnable {
final String auth =
subscriptionAuthentication.getUserName() + ":" + subscriptionAuthentication.getPassword();
final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
- final String authHeader = "Basic " + new String(encodedAuth);
+ String authHeader = "Basic " + new String(encodedAuth);
+
notificationClient.lcnVnfLcmOperationOccurrenceNotificationPostWithHttpInfo(notification,
MediaType.APPLICATION_JSON, authHeader);
} catch (final ApiException exception) {
LOGGER.error("Error sending notification: " + notification, exception);
+ LOGGER.error("Response code: {}, body: {}, basePath: {}", exception.getCode(), exception.getResponseBody(),
+ notificationClient.getApiClient().getBasePath());
+
}
}
@@ -214,8 +272,17 @@ public abstract class OperationProgressor implements Runnable {
private InlineResponse201 sendGrantRequest(final GrantRequest grantRequest) {
LOGGER.info("Sending grant request: {}", grantRequest);
try {
+
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials subscriptionAuthentication =
+ subscriptionService.getSubscriptions().iterator().next().getAuthentication()
+ .getParamsOauth2ClientCredentials();
+
+ final String authHeader = applicationConfig.getGrantAuth().equals("oauth")
+ ? "Bearer " + getToken(notificationClient.getApiClient(), subscriptionAuthentication)
+ : null;
+
final ApiResponse<InlineResponse201> response = grantClient.grantsPostWithHttpInfo(grantRequest,
- MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, "Basic dm5mbTpwYXNzd29yZDEk");
+ MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, authHeader);
LOGGER.info("Grant Response: {}", response);
return response.getData();
} catch (final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiException exception) {
@@ -236,4 +303,46 @@ public abstract class OperationProgressor implements Runnable {
return applicationConfig.getBaseUrl() + "/vnflcm/v1";
}
+ private String getToken(final ApiClient apiClient,
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthClientCredentials) {
+ final String basePath = apiClient.getBasePath().substring(0, apiClient.getBasePath().indexOf("/so/"));
+ final String tokenUrl = basePath + "/oauth/token?grant_type=client_credentials";
+
+ try {
+ URL url = new URL(tokenUrl);
+ HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
+ connection.setRequestMethod("POST");
+ final String authorizationHeader = getAuthorizationHeader(oauthClientCredentials);
+ connection.addRequestProperty("Authorization", authorizationHeader);
+
+ connection.connect();
+
+ return getResponse(connection).get("access_token").getAsString();
+
+ } catch (IOException exception) {
+ LOGGER.error("Error getting token", exception);
+ return null;
+ }
+ }
+
+ private String getAuthorizationHeader(
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials oauthClientCredentials) {
+ final String auth = oauthClientCredentials.getClientId() + ":" + oauthClientCredentials.getClientPassword();
+ final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.UTF_8));
+ return "Basic " + new String(encodedAuth);
+ }
+
+ private JsonObject getResponse(HttpsURLConnection connection) throws IOException {
+ BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ String line, data = "";
+ while ((line = in.readLine()) != null) {
+ data += line;
+ }
+ in.close();
+ connection.getInputStream().close();
+
+ JsonObject jsonObject = new JsonParser().parse(data).getAsJsonObject();
+ return jsonObject;
+ }
+
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java
index 21bb00dba7..95043d35ed 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/SvnfmService.java
@@ -32,7 +32,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.svnfm.simulator.config.ApplicationConfig;
import org.onap.svnfm.simulator.constants.Constant;
@@ -60,36 +59,31 @@ import org.springframework.stereotype.Service;
@Service
public class SvnfmService {
- @Autowired
- VnfmRepository vnfmRepository;
-
- @Autowired
- VnfOperationRepository vnfOperationRepository;
-
- @Autowired
+ private VnfmRepository vnfmRepository;
+ private VnfOperationRepository vnfOperationRepository;
private VnfmHelper vnfmHelper;
-
- @Autowired
- ApplicationConfig applicationConfig;
-
- @Autowired
- CacheManager cacheManager;
-
- @Autowired
- Vnfds vnfds;
-
- @Autowired
- SubscriptionService subscriptionService;
+ private ApplicationConfig applicationConfig;
+ private CacheManager cacheManager;
+ private Vnfds vnfds;
+ private SubscriptionService subscriptionService;
private final ExecutorService executor = Executors.newCachedThreadPool();
private static final Logger LOGGER = LoggerFactory.getLogger(SvnfmService.class);
- /**
- *
- * @param createVNFRequest
- * @return inlineResponse201
- */
+ @Autowired
+ public SvnfmService(VnfmRepository vnfmRepository, VnfOperationRepository vnfOperationRepository,
+ VnfmHelper vnfmHelper, ApplicationConfig applicationConfig, CacheManager cacheManager, Vnfds vnfds,
+ SubscriptionService subscriptionService) {
+ this.vnfmRepository = vnfmRepository;
+ this.vnfOperationRepository = vnfOperationRepository;
+ this.vnfmHelper = vnfmHelper;
+ this.applicationConfig = applicationConfig;
+ this.cacheManager = cacheManager;
+ this.vnfds = vnfds;
+ this.subscriptionService = subscriptionService;
+ }
+
public InlineResponse201 createVnf(final CreateVnfRequest createVNFRequest, final String id) {
InlineResponse201 inlineResponse201 = null;
try {
@@ -106,24 +100,16 @@ public class SvnfmService {
}
@CachePut(value = Constant.IN_LINE_RESPONSE_201_CACHE, key = "#id")
- public InlineResponse201 updateVnf(final InstantiationStateEnum instantiationState,
+ public void updateVnf(final InstantiationStateEnum instantiationState,
final InlineResponse201InstantiatedVnfInfo instantiatedVnfInfo, final String id,
final List<InlineResponse201VimConnectionInfo> vimConnectionInfo) {
final InlineResponse201 vnf = getVnf(id);
vnf.setInstantiatedVnfInfo(instantiatedVnfInfo);
vnf.setInstantiationState(instantiationState);
vnf.setVimConnectionInfo(vimConnectionInfo);
- return vnf;
}
- /**
- *
- * @param vnfId
- * @param instantiateVNFRequest
- * @param operationId
- * @throws InterruptedException
- */
- public String instantiateVnf(final String vnfId, final InstantiateVnfRequest instantiateVNFRequest) {
+ public String instantiateVnf(final String vnfId) {
final VnfOperation vnfOperation = buildVnfOperation(InlineResponse200.OperationEnum.INSTANTIATE, vnfId);
vnfOperationRepository.save(vnfOperation);
executor.submit(new InstantiateOperationProgressor(vnfOperation, this, vnfOperationRepository,
@@ -131,13 +117,7 @@ public class SvnfmService {
return vnfOperation.getId();
}
- /**
- * vnfOperationRepository
- *
- * @param vnfId
- * @param instantiateOperationId
- */
- public VnfOperation buildVnfOperation(final InlineResponse200.OperationEnum operation, final String vnfId) {
+ private VnfOperation buildVnfOperation(final InlineResponse200.OperationEnum operation, final String vnfId) {
final VnfOperation vnfOperation = new VnfOperation();
vnfOperation.setId(UUID.randomUUID().toString());
vnfOperation.setOperation(operation);
@@ -146,11 +126,6 @@ public class SvnfmService {
return vnfOperation;
}
- /**
- *
- * @param operationId
- * @throws InterruptedException
- */
public InlineResponse200 getOperationStatus(final String operationId) {
LOGGER.info("Getting operation status with id: {}", operationId);
final Thread instantiationNotification = new Thread(new VnfInstantiationNotification());
@@ -165,14 +140,13 @@ public class SvnfmService {
return null;
}
- /**
- *
- * @param vnfId
- * @return inlineResponse201
- */
public InlineResponse201 getVnf(final String vnfId) {
final Cache ca = cacheManager.getCache(Constant.IN_LINE_RESPONSE_201_CACHE);
+ if (ca == null)
+ return null;
final SimpleValueWrapper wrapper = (SimpleValueWrapper) ca.get(vnfId);
+ if (wrapper == null)
+ return null;
final InlineResponse201 inlineResponse201 = (InlineResponse201) wrapper.get();
if (inlineResponse201 != null) {
LOGGER.info("Cache Read Successful");
@@ -181,10 +155,6 @@ public class SvnfmService {
return null;
}
- /**
- * @param vnfId
- * @return
- */
public String terminateVnf(final String vnfId) {
final VnfOperation vnfOperation = buildVnfOperation(InlineResponse200.OperationEnum.TERMINATE, vnfId);
vnfOperationRepository.save(vnfOperation);
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java
index 60b251c4d4..8f1e299fec 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/VnfmHelper.java
@@ -43,9 +43,13 @@ import org.springframework.stereotype.Component;
@Component
public class VnfmHelper {
- @Autowired
private ApplicationConfig applicationConfig;
+ @Autowired
+ public VnfmHelper(ApplicationConfig applicationConfig) {
+ this.applicationConfig = applicationConfig;
+ }
+
/**
*
* @param createVNFRequest
diff --git a/vnfm-simulator/vnfm-service/src/main/resources/application.yaml b/vnfm-simulator/vnfm-service/src/main/resources/application.yaml
index 2ef302ce25..ea8105d891 100644
--- a/vnfm-simulator/vnfm-service/src/main/resources/application.yaml
+++ b/vnfm-simulator/vnfm-service/src/main/resources/application.yaml
@@ -34,6 +34,11 @@ server:
port: 9093
tomcat:
max-threads: 50
+ ssl:
+ key-alias: so@so.onap.org
+ key--store-password: '7Em3&j4.19xYiMelhD5?xbQ.'
+ key-store: classpath:so-vnfm-simulator.p12
+ key-store-type: PKCS12
vnfds:
vnfdlist:
@@ -56,4 +61,4 @@ vnfds:
- vnfcid: VNFC4
resourceTemplateId: vnfd2_vnfc4
vduId: vnfd2_vduForVnfc4
- type: COMPUTE \ No newline at end of file
+ type: COMPUTE
diff --git a/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem
new file mode 100644
index 0000000000..3c899e3bf5
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem
@@ -0,0 +1,30 @@
+Bag Attributes
+ friendlyName: so@so.onap.org
+ localKeyID: 54 69 6D 65 20 31 35 36 33 34 36 33 36 32 39 35 38 33
+subject=/CN=so-vnfm-adapter/emailAddress=/OU=so@so.onap.org/OU=OSAAF/O=ONAP/C=US
+issuer=/C=US/O=ONAP/OU=OSAAF/CN=intermediateCA_9
+-----BEGIN CERTIFICATE-----
+MIIEITCCAwmgAwIBAgIILuAnLLineoYwDQYJKoZIhvcNAQELBQAwRzELMAkGA1UE
+BhMCVVMxDTALBgNVBAoMBE9OQVAxDjAMBgNVBAsMBU9TQUFGMRkwFwYDVQQDDBBp
+bnRlcm1lZGlhdGVDQV85MB4XDTE5MDcxODE1MjcwOVoXDTIwMDcxODE1MjcwOVow
+cDEYMBYGA1UEAwwPc28tdm5mbS1hZGFwdGVyMQ8wDQYJKoZIhvcNAQkBFgAxFzAV
+BgNVBAsMDnNvQHNvLm9uYXAub3JnMQ4wDAYDVQQLDAVPU0FBRjENMAsGA1UECgwE
+T05BUDELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
+AQCu2NbWjFiZ5Tz5P7daCD6mqJqSWV3f+gkM2VC/UYM/43hd/2ILJbbtsv4uzS/P
+GXl3UIKBjb7zRiDCvLNMFsHCZ9/gIonG1z737S42LCrdVKq/KQ59yIOPrxYmLyiQ
+Xy81ChX77b2KvKPPeF+K/wnh5fLwlcJ18geeCoWGaMK0C/i6J/uUb9z+Ef0Nmtau
+NdXAuUnERCKMra+3kFxZwaRC/gSCy+/s6EQdeaGNiijg03AmrUx9XjrJjHbYMDVo
+OKSxtv0E4fxbfmTpHaKCuN4eg+0nEXw/eiIEuSHJuh3KKv7wRoP/hG/Tdog7x60M
+SD+hdNjCbFP6yAyMPfoxVnjHAgMBAAGjgecwgeQwCQYDVR0TBAIwADAOBgNVHQ8B
+Af8EBAMCBeAwIAYDVR0lAQH/BBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMFQGA1Ud
+IwRNMEuAFIH3mVsQuciM3vNSXupOaaBDPqzdoTCkLjAsMQ4wDAYDVQQLDAVPU0FB
+RjENMAsGA1UECgwET05BUDELMAkGA1UEBhMCVVOCAQcwHQYDVR0OBBYEFFLrO3T4
+QybeDQ28mHgC/xT5f03qMDAGA1UdEQQpMCeCD3NvLXZuZm0tYWRhcHRlcoIUc28t
+dm5mbS1hZGFwdGVyLm9uYXAwDQYJKoZIhvcNAQELBQADggEBACe+JaVIjTku/QNp
+XoQCNN+sllSZmEHTLmYfpSzY5BY2AeJsgTYqFtAhtp6uQf8Jr993CyEyeJ4if2Z9
+J5NWoJKmY1+a63UphB1mg4sNSCuDxvbxPjtrFkOx/DiB1XEUdoifS9IQSDIIuhaD
+YP6sih1TBOh/2ityCe51Mu1J9/wgb24rlYouVtEyQeIai4dqngFHeQHeNXOnGN0z
+osEcKSYa0C+ZOAomBMT58C2aDz9vyI8YPuzwVSDKndmXUgvrkkVnxk3qJRtghDQc
+RV+4SeZg8s4+5DxKL4AL15IAaAPMJHi+MRtfm7qNzqCEl5sAEzO7S4oVHeWLNFV8
+a9PHErg=
+-----END CERTIFICATE-----
diff --git a/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-simulator.p12 b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-simulator.p12
new file mode 100644
index 0000000000..7ac02855bc
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-simulator.p12
Binary files differ
diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java
new file mode 100644
index 0000000000..46030e94d3
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java
@@ -0,0 +1,158 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.svnfm.simulator.services;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201AddResources;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.svnfm.simulator.config.ApplicationConfig;
+import org.onap.svnfm.simulator.model.VnfOperation;
+import org.onap.svnfm.simulator.model.Vnfds;
+import org.onap.svnfm.simulator.model.Vnfds.Vnfc;
+import org.onap.svnfm.simulator.model.Vnfds.Vnfd;
+
+public class InstantiateOperatorProgressorTest {
+
+ private static final String VNF_ID = "vnfTestId";
+ private static final String CALLBACK_URI = "/lcn/uritest";
+ private static final String VNFC_TYPE = "COMPUTE";
+ private static final String RESOURCE_TEMPLATE_ID = "resTempIdTest";
+ private static final String VDU_ID = "vduIdTest";
+ private static final String VNF_INSTANCE_ID = "vnfInstanceId";
+ private static final String VNFC_ID = "vnfcIdTest";
+ private static final String RESOURCE_DEFINITION_ID = "resDefTestId";
+ private static final String VIM_CONNECTION_ID = "vimConnTestId";
+
+ private SvnfmService svnfmServiceMock;
+
+ private InstantiateOperationProgressor testedObject;
+
+ @Before
+ public void setup() {
+ svnfmServiceMock = mock(SvnfmService.class);
+ VnfOperation vnfOperation = new VnfOperation();
+ vnfOperation.setVnfInstanceId(VNF_INSTANCE_ID);
+ testedObject = new InstantiateOperationProgressor(vnfOperation, svnfmServiceMock, null, new ApplicationConfig(),
+ createVnfds(), createSubscriptionService());
+ }
+
+ @Test
+ public void getAddResources_vnfIdFound() {
+ List<GrantsAddResources> result = testedObject.getAddResources(VNF_ID);
+ assertThat(result).hasSize(1);
+ GrantsAddResources grantsAddResourceResult = result.get(0);
+ assertThat(grantsAddResourceResult.getType()).hasToString(VNFC_TYPE);
+ assertThat(grantsAddResourceResult.getResourceTemplateId()).isEqualTo(RESOURCE_TEMPLATE_ID);
+ assertThat(grantsAddResourceResult.getVduId()).isEqualTo(VDU_ID);
+ }
+
+ @Test
+ public void getAddResources_vnfIdNotFound() {
+ List<GrantsAddResources> result = testedObject.getAddResources("otherVnfId");
+ assertThat(result).isEmpty();
+ }
+
+ @Test
+ public void handleGrantResponse_VnfdObjectsAvailable() {
+ when(svnfmServiceMock.getVnf(VNF_INSTANCE_ID)).thenReturn(createInlineResponse201());
+
+ InlineResponse201VimConnections inlineResponse201VimConnections = new InlineResponse201VimConnections();
+ List<InlineResponse201VimConnections> listOfVimConnection = new ArrayList<>();
+ listOfVimConnection.add(inlineResponse201VimConnections);
+
+ InlineResponse201AddResources inlineResponse201AddResources = new InlineResponse201AddResources();
+ inlineResponse201AddResources.setResourceDefinitionId(RESOURCE_DEFINITION_ID);
+ inlineResponse201AddResources.setVimConnectionId(VIM_CONNECTION_ID);
+ List<InlineResponse201AddResources> listOfResources = new ArrayList<>();
+ listOfResources.add(inlineResponse201AddResources);
+
+ InlineResponse201 inlineResponse201 = new InlineResponse201();
+ inlineResponse201.setVimConnections(listOfVimConnection);
+ inlineResponse201.setAddResources(listOfResources);
+ List<InlineResponse201InstantiatedVnfInfoVnfcResourceInfo> resultList =
+ testedObject.handleGrantResponse(inlineResponse201);
+
+ assertThat(resultList).hasSize(1);
+ InlineResponse201InstantiatedVnfInfoVnfcResourceInfo resultObject = resultList.get(0);
+ assertThat(resultObject.getId()).isEqualTo(VNFC_ID);
+ assertThat(resultObject.getVduId()).isEqualTo(VDU_ID);
+ assertThat(resultObject.getComputeResource().getVimConnectionId()).isEqualTo(VIM_CONNECTION_ID);
+ }
+
+ @Test
+ public void getVnfcChangeType_enumAdded() {
+ assertThat(testedObject.getVnfcChangeType().getValue()).isEqualTo("ADDED");
+ }
+
+ @Test
+ public void getRemoveResourcesShouldReturnEmptyList() {
+ assertThat(testedObject.getRemoveResources("anyVnfId")).isEmpty();
+ }
+
+ private Vnfds createVnfds() {
+ Vnfd vnfd = new Vnfd();
+ vnfd.setVnfdId(VNF_ID);
+ List<Vnfc> vnfcList = new ArrayList<>();
+ vnfcList.add(createVnfc());
+ vnfd.setVnfcList(vnfcList);
+ List<Vnfd> vnfdList = new ArrayList<>();
+ vnfdList.add(vnfd);
+
+ Vnfds vnfds = new Vnfds();
+ vnfds.setVnfdList(vnfdList);
+ return vnfds;
+ }
+
+ private Vnfc createVnfc() {
+ Vnfc vnfc = new Vnfc();
+ vnfc.setVnfcId(VNFC_ID);
+ vnfc.setType(VNFC_TYPE);
+ vnfc.setResourceTemplateId(RESOURCE_TEMPLATE_ID);
+ vnfc.setVduId(VDU_ID);
+ vnfc.setGrantResourceId(RESOURCE_DEFINITION_ID);
+ return vnfc;
+ }
+
+ private SubscriptionService createSubscriptionService() {
+ SubscriptionService subscriptionService = new SubscriptionService();
+ LccnSubscriptionRequest lccnSubscriptionRequest = new LccnSubscriptionRequest();
+ lccnSubscriptionRequest.setCallbackUri(CALLBACK_URI);
+ subscriptionService.registerSubscription(lccnSubscriptionRequest);
+ return subscriptionService;
+ }
+
+ private org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201 createInlineResponse201() {
+ org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201 inlineResponse201 =
+ new org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201();
+ inlineResponse201.setVnfdId(VNF_ID);
+ return inlineResponse201;
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java
new file mode 100644
index 0000000000..ed77775421
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.svnfm.simulator.services;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.svnfm.simulator.config.ApplicationConfig;
+import org.onap.svnfm.simulator.constants.Constant;
+import org.onap.svnfm.simulator.model.Vnfds;
+import org.onap.svnfm.simulator.repository.VnfOperationRepository;
+import org.onap.svnfm.simulator.repository.VnfmRepository;
+import org.springframework.cache.Cache;
+import org.springframework.cache.CacheManager;
+import org.springframework.cache.support.SimpleValueWrapper;
+
+public class SvnfmServiceTest {
+
+ private SvnfmService testedObject;
+ private CacheManager cacheManagerMock;
+
+ @Before
+ public void setup() {
+ VnfmRepository vnfmRepositoryMock = mock(VnfmRepository.class);
+ VnfOperationRepository vnfOperationRepositoryMock = mock(VnfOperationRepository.class);
+ VnfmHelper vnfmHelperMock = mock(VnfmHelper.class);
+ ApplicationConfig applicationConfigMock = mock(ApplicationConfig.class);
+ cacheManagerMock = mock(CacheManager.class);
+ Vnfds vnfdsMock = mock(Vnfds.class);
+ SubscriptionService subscriptionServiceMock = mock(SubscriptionService.class);
+
+ testedObject = new SvnfmService(vnfmRepositoryMock, vnfOperationRepositoryMock, vnfmHelperMock,
+ applicationConfigMock, cacheManagerMock, vnfdsMock, subscriptionServiceMock);
+ }
+
+ @Test
+ public void getVnfSuccessful() {
+ // given
+ String vnfId = "vnfId";
+ String vnfInstanceName = "testVnf";
+ Cache cacheMock = mock(Cache.class);
+ SimpleValueWrapper simpleValueWrapperMock = mock(SimpleValueWrapper.class);
+ when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(cacheMock);
+ when(cacheMock.get(vnfId)).thenReturn(simpleValueWrapperMock);
+ when(simpleValueWrapperMock.get()).thenReturn(prepareInlineResponse(vnfId, vnfInstanceName));
+ // when
+ InlineResponse201 result = testedObject.getVnf(vnfId);
+ // then
+ assertThat(result.getVnfdId()).isEqualTo(vnfId);
+ assertThat(result.getVnfInstanceName()).isEqualTo(vnfInstanceName);
+ }
+
+ @Test
+ public void getVnf_ifCacheNullThenReturnNull() {
+ // given
+ when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(null);
+ // then
+ assertThat(testedObject.getVnf("any")).isNull();
+ }
+
+ @Test
+ public void getVnf_ifWrapperNullThenReturnNull() {
+ // given
+ String vnfId = "vnfId";
+ Cache cacheMock = mock(Cache.class);
+ when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(cacheMock);
+ when(cacheMock.get(vnfId)).thenReturn(null);
+ // then
+ assertThat(testedObject.getVnf(vnfId)).isNull();
+ }
+
+ @Test
+ public void getVnf_ifResultIsNullThenReturnNull() {
+ // when
+ String vnfId = "vnfId";
+ Cache cacheMock = mock(Cache.class);
+ SimpleValueWrapper simpleValueWrapperMock = mock(SimpleValueWrapper.class);
+ when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(cacheMock);
+ when(cacheMock.get(vnfId)).thenReturn(simpleValueWrapperMock);
+ when(simpleValueWrapperMock.get()).thenReturn(null);
+ // then
+ assertThat(testedObject.getVnf(vnfId)).isNull();
+ }
+
+ private InlineResponse201 prepareInlineResponse(String vnfId, String vnfInstanceName) {
+ InlineResponse201 response201 = new InlineResponse201();
+ response201.setVnfdId(vnfId);
+ response201.vnfInstanceName(vnfInstanceName);
+ return response201;
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/VnfmHelperTest.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/VnfmHelperTest.java
new file mode 100644
index 0000000000..2b9598e54f
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/VnfmHelperTest.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.svnfm.simulator.services;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201LinksSelf;
+import org.onap.svnfm.simulator.config.ApplicationConfig;
+import org.onap.svnfm.simulator.constants.Constant;
+import org.onap.svnfm.simulator.model.VnfInstance;
+
+public class VnfmHelperTest {
+
+ private static final String VNF_INSTANCE_ID = "vnfInstanceTestId";
+ private static final String VNFD_ID = "vnfdTestId";
+ private static final String VNF_INSTANCE_NAME = "vnfInsNameTest";
+ private static final String VNF_INSTANCE_DESCRIPTION = "vnfInstTestDescr";
+ private static final String APPLICATION_CONFIG_BASE_URL = "appConfUrl";
+ private VnfmHelper testedObject;
+ private ApplicationConfig applicationConfigMock;
+
+ @Before
+ public void setup() {
+ applicationConfigMock = mock(ApplicationConfig.class);
+ testedObject = new VnfmHelper(applicationConfigMock);
+ }
+
+ @Test
+ public void createVnfInstance() {
+ // when
+ VnfInstance result = testedObject.createVnfInstance(createVnfRequest(), VNF_INSTANCE_ID);
+ // then
+ assertThat(result.getId()).isEqualTo(VNF_INSTANCE_ID);
+ assertThat(result.getVnfdId()).isEqualTo(VNFD_ID);
+ assertThat(result.getVnfInstanceName()).isEqualTo(VNF_INSTANCE_NAME);
+ assertThat(result.getVnfInstanceDescription()).isEqualTo(VNF_INSTANCE_DESCRIPTION);
+ assertThat(result.getVnfProvider()).isEqualTo(Constant.VNF_PROVIDER);
+ assertThat(result.getVnfProductName()).isEqualTo(Constant.VNF_PROVIDER_NAME);
+ }
+
+ @Test
+ public void getInlineResponse201() throws Exception {
+ // given
+ when(applicationConfigMock.getBaseUrl()).thenReturn(APPLICATION_CONFIG_BASE_URL);
+ // when
+ InlineResponse201 result = testedObject.getInlineResponse201(prepareVnfInstance());
+ // then
+ assertThat(result.getVnfdVersion()).isEqualTo(Constant.VNFD_VERSION);
+ assertThat(result.getVnfSoftwareVersion()).isEqualTo(Constant.VNF_SOFTWARE_VERSION);
+ assertThat(result.getInstantiationState()).isEqualByComparingTo(InstantiationStateEnum.NOT_INSTANTIATED);
+ verifyAdditionalPropertyInlineResponse201(result);
+ }
+
+ private CreateVnfRequest createVnfRequest() {
+ CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+ createVnfRequest.setVnfdId(VNFD_ID);
+ createVnfRequest.setVnfInstanceName(VNF_INSTANCE_NAME);
+ createVnfRequest.setVnfInstanceDescription(VNF_INSTANCE_DESCRIPTION);
+ return createVnfRequest;
+ }
+
+ private VnfInstance prepareVnfInstance() {
+ VnfInstance vnfInstance = new VnfInstance();
+ vnfInstance.setId(VNF_INSTANCE_ID);
+ return vnfInstance;
+ }
+
+ private void verifyAdditionalPropertyInlineResponse201(InlineResponse201 result) {
+ InlineResponse201LinksSelf expectedVnfInstancesLinksSelf = new InlineResponse201LinksSelf();
+ expectedVnfInstancesLinksSelf
+ .setHref(APPLICATION_CONFIG_BASE_URL + "/vnflcm/v1/vnf_instances/" + VNF_INSTANCE_ID);
+ assertThat(result.getLinks().getSelf()).isEqualTo(expectedVnfInstancesLinksSelf);
+
+ InlineResponse201LinksSelf expectedVnfInstancesLinksSelfInstantiate = new InlineResponse201LinksSelf();
+ expectedVnfInstancesLinksSelfInstantiate.setHref(
+ (APPLICATION_CONFIG_BASE_URL + "/vnflcm/v1/vnf_instances/" + VNF_INSTANCE_ID + "/instantiate"));
+ assertThat(result.getLinks().getInstantiate()).isEqualTo(expectedVnfInstancesLinksSelfInstantiate);
+ }
+
+}