aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java108
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java11
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java9
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java28
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql23
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5.1__AddServiceArtifact.sql17
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.5__AddCloudOwner.sql13
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.6__Update_Service_Function.sql4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java70
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java13
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java22
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java34
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql1
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.2__Fix_Invalid_Request_Status.sql4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java147
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java50
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java7
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml50
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml53
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java132
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java9
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java49
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java13
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java6
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java13
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java31
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java6
-rw-r--r--adapters/so-appc-orchestrator/pom.xml2
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java21
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java9
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java33
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java24
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java5
-rw-r--r--asdc-controller/src/test/resources/schema.sql13
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml106
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoServiceInstance.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java208
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java330
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java74
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java4
-rw-r--r--bpmn/pom.xml2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn67
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java54
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml98
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy25
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy824
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy124
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn221
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn230
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn3
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java18
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java284
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java133
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java166
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java31
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java3
-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.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java156
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json13
-rw-r--r--common/pom.xml4
-rw-r--r--common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java11
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java3
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClient.java8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java7
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java74
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java78
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java16
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java9
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java9
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIVersion.java11
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java29
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java9
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java60
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java68
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java98
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java51
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java24
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java23
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java19
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java21
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java27
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java18
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java9
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java3
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java135
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java45
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java (renamed from common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java)34
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java10
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java64
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java19
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java33
-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/Node.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java7
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java7
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java17
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/__.java13
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java39
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java16
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java26
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java237
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java77
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java239
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java13
-rw-r--r--common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java11
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java8
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java11
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java107
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java4
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIURITest.java4
-rw-r--r--common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java59
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java3
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java2
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java18
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java49
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java12
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java2
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java4
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java45
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java84
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java53
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/AAI.json132
-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.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/UnknownProperty.json1
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java15
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java101
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java26
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java5
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java (renamed from mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java)17
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java15
-rw-r--r--mso-catalog-db/src/test/resources/data.sql2
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql2
-rw-r--r--packages/docker/pom.xml24
-rw-r--r--releases/1.6.0.yaml33
-rw-r--r--version.properties2
211 files changed, 4669 insertions, 2834 deletions
diff --git a/.gitignore b/.gitignore
index 8eeea7a8cc..79d2c94622 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,8 @@ target
**/.buildpath
**/.factorypath
**/.springBeans
+**/.project
+**/.classpath
.idea
.checkstyle
.DS_Store
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 0a3c6acd84..50ebcc66ee 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
@@ -198,7 +198,9 @@ public class MsoCommonUtils {
// Generate an alarm for 5XX and higher errors.
if (re.getStatus() >= 500) {
-
+ logger.error("{} {} OpenStackResponseException with response code {} on {}: ",
+ MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), re.getStatus(), context,
+ e);
}
} else if (e instanceof OpenStackConnectException) {
OpenStackConnectException ce = (OpenStackConnectException) e;
@@ -281,7 +283,9 @@ public class MsoCommonUtils {
// Generate an alarm for 5XX and higher errors.
if (re.getStatus() >= 500) {
-
+ logger.error("{} {} OpenStackBaseException with response code {} on {}: ",
+ MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), re.getStatus(), context,
+ e);
}
} else if (e instanceof OpenStackConnectException) {
OpenStackConnectException ce = (OpenStackConnectException) e;
@@ -334,32 +338,6 @@ public class MsoCommonUtils {
protected CreateStackParam createStackParam(String stackName, String heatTemplate, Map<String, ?> stackInputs,
int timeoutMinutes, String environment, Map<String, Object> files, Map<String, Object> heatFiles) {
- // Create local variables checking to see if we have an environment, nested, get_files
- // Could later add some checks to see if it's valid.
- boolean haveEnvtVariable = true;
- if (environment == null || "".equalsIgnoreCase(environment.trim())) {
- haveEnvtVariable = false;
- logger.debug("createStackParam called with no environment variable");
- } else {
- logger.debug("createStackParam called with an environment variable: {}", environment);
- }
-
- boolean haveFiles = true;
- if (files == null || files.isEmpty()) {
- haveFiles = false;
- logger.debug("createStackParam called with no files / child template ids");
- } else {
- logger.debug("createStackParam called with {} files / child template ids", files.size());
- }
-
- boolean haveHeatFiles = true;
- if (heatFiles == null || heatFiles.isEmpty()) {
- haveHeatFiles = false;
- logger.debug("createStackParam called with no heatFiles");
- } else {
- logger.debug("createStackParam called with {} heatFiles", heatFiles.size());
- }
-
// force entire stackInput object to generic Map<String, Object> for openstack compatibility
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> normalized = new HashMap<>();
@@ -370,6 +348,28 @@ public class MsoCommonUtils {
logger.debug("could not map json", e1);
}
+ CreateStackParam stack =
+ createStack(stackName, heatTemplate, timeoutMinutes, environment, files, heatFiles, normalized);
+
+ // 1802 - attempt to add better formatted printout of request to openstack
+ try {
+ Map<String, Object> inputs = new HashMap<>();
+ for (Entry<String, ?> entry : stackInputs.entrySet()) {
+ if (entry.getValue() != null) {
+ inputs.put(entry.getKey(), entry.getValue());
+ }
+ }
+ logger.debug("stack request: {}", stack);
+ } catch (Exception e) {
+ // that's okay - this is a nice-to-have
+ logger.debug("(had an issue printing nicely formatted request to debuglog) {}", e);
+ }
+
+ return stack;
+ }
+
+ private CreateStackParam createStack(String stackName, String heatTemplate, int timeoutMinutes, String environment,
+ Map<String, Object> files, Map<String, Object> heatFiles, Map<String, Object> normalized) {
// Build up the stack to create
// Disable auto-rollback, because error reason is lost. Always rollback in the code.
CreateStackParam stack = new CreateStackParam();
@@ -379,13 +379,13 @@ public class MsoCommonUtils {
stack.setTemplate(heatTemplate);
stack.setDisableRollback(true);
// TJM New for PO Adapter - add envt variable
- if (haveEnvtVariable) {
+ if (isEnvVariablePresent(environment)) {
logger.debug("Found an environment variable - value: {}", environment);
stack.setEnvironment(environment);
}
// Now handle nested templates or get_files - have to combine if we have both
// as they're both treated as "files:" on the stack.
- if (haveFiles && haveHeatFiles) {
+ if (isFilesPresent(files) && isHeatFilesPresent(heatFiles)) {
// Let's do this here - not in the bean
logger.debug("Found files AND heatFiles - combine and add!");
Map<String, Object> combinedFiles = new HashMap<>();
@@ -398,32 +398,50 @@ public class MsoCommonUtils {
stack.setFiles(combinedFiles);
} else {
// Handle if we only have one or neither:
- if (haveFiles) {
+ if (isFilesPresent(files)) {
logger.debug("Found files - adding to stack");
stack.setFiles(files);
}
- if (haveHeatFiles) {
+ if (isHeatFilesPresent(heatFiles)) {
logger.debug("Found heatFiles - adding to stack");
// the setFiles was modified to handle adding the entries
stack.setFiles(heatFiles);
}
}
+ return stack;
+ }
- // 1802 - attempt to add better formatted printout of request to openstack
- try {
- Map<String, Object> inputs = new HashMap<>();
- for (Entry<String, ?> entry : stackInputs.entrySet()) {
- if (entry.getValue() != null) {
- inputs.put(entry.getKey(), entry.getValue());
- }
- }
- logger.debug("stack request: {}", stack.toString());
- } catch (Exception e) {
- // that's okay - this is a nice-to-have
- logger.debug("(had an issue printing nicely formatted request to debuglog) {}", e.getMessage());
+ private boolean isEnvVariablePresent(String environment) {
+ boolean haveEnvVariable = true;
+ if (environment == null || "".equalsIgnoreCase(environment.trim())) {
+ haveEnvVariable = false;
+ logger.debug("createStackParam called with no environment variable");
+ } else {
+ logger.debug("createStackParam called with an environment variable: {}", environment);
}
+ return haveEnvVariable;
+ }
- return stack;
+ private boolean isFilesPresent(Map<String, Object> files) {
+ boolean haveFile = true;
+ if (files == null || files.isEmpty()) {
+ haveFile = false;
+ logger.debug("createStackParam called with no files / child template ids");
+ } else {
+ logger.debug("createStackParam called with {} files / child template ids", files.size());
+ }
+ return haveFile;
+ }
+
+ private boolean isHeatFilesPresent(Map<String, Object> heatFiles) {
+ boolean haveHeatFile = true;
+ if (heatFiles == null || heatFiles.isEmpty()) {
+ haveHeatFile = false;
+ logger.debug("createStackParam called with no heatFiles");
+ } else {
+ logger.debug("createStackParam called with {} heatFiles", heatFiles.size());
+ }
+ return haveHeatFile;
}
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 8207c7c589..97ba7828c0 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
@@ -33,6 +33,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.PluginAction;
@@ -45,14 +46,11 @@ 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.authentication.KeystoneAuthHolder;
-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.request.beans.CloudApiRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.CreateStackRequest;
import org.onap.so.openstack.beans.HeatStatus;
@@ -70,6 +68,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Strings;
@@ -1191,7 +1190,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
InfraActiveRequests request = new InfraActiveRequests();
request.setRequestId(requestId);
request.setResourceStatusMessage(resourceStatusMessage);
- requestDBClient.patchInfraActiveRequests(request);
+ try {
+ requestDBClient.patchInfraActiveRequests(request);
+ } catch (HttpClientErrorException e) {
+ logger.warn("Unable to update active request resource status");
+ }
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
index 6c1c81c6ef..195ada37f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
@@ -24,8 +24,11 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.util.CollectionUtils;
import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
@XmlRootElement(name = "serviceInfo")
@@ -45,8 +48,10 @@ public class QueryServiceInfo extends CatalogQuery {
this.serviceInfo = new ServiceInfo();
}
- public QueryServiceInfo(ServiceInfo serviceInfo) {
- this.serviceInfo = serviceInfo;
+ public QueryServiceInfo(List<ServiceInfo> serviceInfos) {
+ if (!CollectionUtils.isEmpty(serviceInfos)) {
+ this.serviceInfo = serviceInfos.get(0);
+ }
}
public ServiceInfo getServiceInfo() {
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
index d5aa472c8d..305d52a997 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
@@ -94,7 +94,7 @@ public class QueryServiceMacroHolder extends CatalogQuery {
subitem = new QueryAllottedResourceCustomization(service.getAllottedCustomizations()).JSON2(true, true);
valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t"));
- subitem = new QueryServiceInfo(serviceMacroHolder.getServiceInfo()).JSON2(true, true);
+ subitem = new QueryServiceInfo(service.getServiceInfos()).JSON2(true, true);
valueMap.put("_SERVICEINFO_", subitem.replaceAll(LINE_BEGINNING, "\t"));
subitem = new QueryServiceProxyCustomization(service.getServiceProxyCustomizations()).JSON2(true, true);
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 f2e0762a79..98abf15645 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
@@ -46,32 +46,8 @@ import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceMacroHolder;
import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceNetworks;
import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs;
import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule;
-import org.onap.so.db.catalog.beans.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;
-import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ToscaCsar;
-import org.onap.so.db.catalog.beans.VfModule;
-import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.VnfRecipe;
-import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
-import org.onap.so.db.catalog.data.repository.ArRecipeRepository;
-import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
-import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
-import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
-import org.onap.so.db.catalog.data.repository.ServiceRepository;
-import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
-import org.onap.so.db.catalog.data.repository.VFModuleRepository;
-import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.VnfRecipeRepository;
-import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
+import org.onap.so.db.catalog.beans.*;
+import org.onap.so.db.catalog.data.repository.*;
import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 e5daf24d6c..b70d409cd8 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
@@ -30,7 +30,8 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'),
('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'),
('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'DEFAULT', '*'),
-('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*');
+('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*'),
+('VNF-Config-Update', 'applyUpdatedConfig', 'Vnf', true, true, '7','7', 'DEFAULT', '*');
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
@@ -198,9 +199,16 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL
('VNF-InPlaceUpdate', '15', 'VNFResumeTrafficActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
('VNF-InPlaceUpdate', '16', 'VNFUnlockActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
('VNF-InPlaceUpdate', '17', 'VNFUnsetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
-('VNF-InPlaceUpdate', '18', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT'));
-
-
+('VNF-InPlaceUpdate', '18', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-InPlaceUpdate' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '1', 'VNFCheckPserversLockedFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '2', 'VNFCheckInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '3', 'VNFSetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '4', 'VNFSetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '5', 'VNFHealthCheckActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '6', 'VNFConfigModifyActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '7', 'VNFHealthCheckActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '8', 'VNFUnsetInMaintFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')),
+('VNF-Config-Update', '9', 'VNFUnsetClosedLoopDisabledFlagActivity', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT'));
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY)
VALUES
@@ -860,7 +868,8 @@ VALUES
('VNFUpgradePostCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
('VNFUpgradePreCheckActivity', 'NO_VALIDATE', 'CUSTOM'),
('VNFUpgradeSoftwareActivity', 'NO_VALIDATE', 'CUSTOM'),
-('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM');
+('VnfInPlaceSoftwareUpdate', 'NO_VALIDATE', 'CUSTOM'),
+('VNFConfigModifyActivity', 'NO_VALIDATE', 'CUSTOM');
UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE IS NULL;
@@ -881,6 +890,10 @@ UPDATE vnf_recipe
SET ORCHESTRATION_URI = '/mso/async/services/WorkflowActionBB'
WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'inPlaceSoftwareUpdate';
+UPDATE vnf_recipe
+SET ORCHESTRATION_URI = '/mso/async/services/WorkflowActionBB'
+WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'applyUpdatedConfig';
+
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE)
VALUES
('VNFCheckPserversLockedFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5.1__AddServiceArtifact.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5.1__AddServiceArtifact.sql
new file mode 100644
index 0000000000..60a9482707
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5.1__AddServiceArtifact.sql
@@ -0,0 +1,17 @@
+use catalogdb;
+
+
+ALTER TABLE `service_info`
+ ADD COLUMN IF NOT EXISTS SERVICE_MODEL_UUID varchar (200)
+ NOT NULL;
+
+
+ALTER TABLE `service_artifact` DROP FOREIGN KEY `fk_service_artifact_service_info1`;
+
+ALTER TABLE `service_info`
+ ADD CONSTRAINT `fk_service_info_service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE;
+
+ALTER TABLE `service_artifact`
+ ADD CONSTRAINT `fk_service_artifact_service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE;
+
+DROP TABLE IF EXISTS `service_to_service_info`;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.5__AddCloudOwner.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.5__AddCloudOwner.sql
new file mode 100644
index 0000000000..92502e2696
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.5__AddCloudOwner.sql
@@ -0,0 +1,13 @@
+use catalogdb;
+
+
+ALTER TABLE cloud_sites
+ ADD COLUMN IF NOT EXISTS CLOUD_OWNER varchar(255);
+
+
+CREATE TABLE IF NOT EXISTS `network_technology_reference` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `NETWORK_TECHNOLOGY` varchar(200) NOT NULL ,
+ `CLOUD_OWNER` varchar(200) NOT NULL,
+ PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.6__Update_Service_Function.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.6__Update_Service_Function.sql
new file mode 100644
index 0000000000..51be8be664
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.6__Update_Service_Function.sql
@@ -0,0 +1,4 @@
+use catalogdb;
+
+ALTER TABLE service
+ ADD COLUMN IF NOT EXISTS service_function varchar(200) DEFAULT NULL; \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
index 35008b6120..585e001f1a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
@@ -24,9 +24,13 @@ import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.onap.aai.domain.yang.LInterface;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
@@ -53,11 +57,12 @@ public class AuditVServer extends AbstractAudit {
public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) {
AAIObjectAuditList auditList = new AAIObjectAuditList();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
.queryParam("vf-module-name", vfModuleName);
- if (getAaiClient().get(uri).getRelationships().isPresent()) {
+ Optional<AAIResultWrapper> wrapper = getAaiClient().getFirstWrapper(VfModules.class, VfModule.class, uri);
+ if (wrapper.isPresent() && wrapper.get().getRelationships().isPresent()) {
List<AAIResourceUri> relatedVservers =
- getAaiClient().get(uri).getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
+ wrapper.get().getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
if (!relatedVservers.isEmpty()) {
relatedVservers.forEach(vserverUri -> {
Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
index 780480507b..6cf42e1433 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
@@ -56,7 +56,6 @@ public class CloudRegionRestV1 {
private CloudRestImpl cloudRestImpl;
@POST
- @Path("{cloud-region-id}/{cloud-owner}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
@ApiOperation(value = "CreateCloudRegion", response = Response.class,
@@ -65,9 +64,8 @@ public class CloudRegionRestV1 {
@ApiResponse(code = 500, message = "Create Cloud Region has failed")})
public Response createCloudRegion(
@ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
- @ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
@ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
- cloudRestImpl.createCloudRegion(cloudSite, cloudOwner);
+ cloudRestImpl.createCloudRegion(cloudSite);
return Response.status(HttpStatus.SC_CREATED).build();
}
@@ -96,7 +94,7 @@ public class CloudRegionRestV1 {
@ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
@ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
@ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
- cloudRestImpl.updateCloudRegion(cloudSite, cloudOwner);
+ cloudRestImpl.updateCloudRegion(cloudSite);
return Response.status(HttpStatus.SC_OK).build();
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
index 4cde8655ae..380f42fa69 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
@@ -1,13 +1,21 @@
package org.onap.so.adapters.cloudregion;
+import java.util.List;
import java.util.Optional;
import org.onap.aai.domain.yang.CloudRegion;
+import org.onap.aai.domain.yang.Complex;
+import org.onap.aai.domain.yang.NetworkTechnologies;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.NetworkTechnologyReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository;
+import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,14 +29,17 @@ public class CloudRestImpl {
private AAIResourcesClient aaiClient;
@Autowired
+ private NetworkTechnologyReferenceRepository ctrRepo;
+
+ @Autowired
private CatalogDbClient catalogDBClient;
- public void createCloudRegion(CloudSite cloudSite, String cloudOwner) throws CloudException {
+ public void createCloudRegion(CloudSite cloudSite) throws CloudException {
createRegionInCatalogDb(cloudSite);
- createCloudRegionInAAI(cloudSite, cloudOwner);
+ createCloudRegionInAAI(cloudSite);
}
- public void updateCloudRegion(CloudSite cloudSite, String cloudOwner) throws CloudException {
+ public void updateCloudRegion(CloudSite cloudSite) throws CloudException {
updateRegionInCatalogDb(cloudSite);
}
@@ -50,18 +61,49 @@ public class CloudRestImpl {
}
}
- protected void createCloudRegionInAAI(CloudSite cloudSite, String cloudOwner) {
+ protected void createCloudRegionInAAI(CloudSite cloudSite) {
try {
- CloudRegion cloudRegion = mapCloudRegion(cloudSite, cloudOwner);
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ CloudRegion cloudRegion = mapCloudRegion(cloudSite);
+ Optional<Complex> complex = retrieveComplex(cloudSite);
+ if (complex.isPresent()) {
+ cloudRegion.setComplexName(complex.get().getComplexName());
+ }
+ AAIResourceUri cloudRegionURI = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
cloudRegion.getCloudOwner(), cloudRegion.getCloudRegionId());
- getAaiClient().createIfNotExists(uri, Optional.of(cloudRegion));
+ getAaiClient().createIfNotExists(cloudRegionURI, Optional.of(cloudRegion));
+ if (complex.isPresent()) {
+ AAIResourceUri complexURI = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, cloudSite.getClli());
+ getAaiClient().connect(cloudRegionURI, complexURI);
+ }
+ createCloudRegionNetworkTechnologyRelationship(cloudSite, cloudRegionURI);
} catch (Exception e) {
logger.error("Error creating cloud region in AAI", e);
throw new CloudException("Error creating cloud region in AAI: " + e.getMessage(), e);
}
}
+ protected void createCloudRegionNetworkTechnologyRelationship(CloudSite cloudSite, AAIResourceUri cloudRegionURI) {
+ List<NetworkTechnologyReference> listOfNetworkTech = ctrRepo.findAllByCloudOwner(cloudSite.getCloudOwner());
+ listOfNetworkTech.stream().forEach(tech -> linkCloudAndTechnology(tech.getNetworkTechnology(), cloudRegionURI));
+ }
+
+ protected Optional<Complex> retrieveComplex(CloudSite cloudSite) {
+ AAIResourceUri complexURI = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, cloudSite.getClli());
+ return getAaiClient().get(Complex.class, complexURI);
+ }
+
+ protected void linkCloudAndTechnology(String networkTechnologyName, AAIResourceUri cloudRegionURI) {
+ AAIPluralResourceUri technologyPluralUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_TECHNOLOGY)
+ .queryParam("network-technology-name", networkTechnologyName);
+ Optional<NetworkTechnologies> networkTechnology =
+ getAaiClient().get(NetworkTechnologies.class, technologyPluralUri);
+ if (networkTechnology.isPresent()) {
+ AAIResourceUri networkTechnologyURI = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_TECHNOLOGY,
+ networkTechnology.get().getNetworkTechnology().get(0).getNetworkTechnologyId());
+ getAaiClient().connect(cloudRegionURI, networkTechnologyURI);
+ }
+ }
+
protected void createRegionInCatalogDb(CloudSite cloudSite) throws CloudException {
try {
CloudSite existingCloudSite = catalogDBClient.getCloudSite(cloudSite.getRegionId());
@@ -74,16 +116,22 @@ public class CloudRestImpl {
}
}
- protected CloudRegion mapCloudRegion(CloudSite cloudSite, String cloudOwner) {
+ protected CloudRegion mapCloudRegion(CloudSite cloudSite) {
CloudRegion region = new CloudRegion();
- region.setCloudOwner(cloudOwner);
+ region.setCloudOwner(cloudSite.getCloudOwner());
region.setCloudRegionId(cloudSite.getRegionId());
region.setCloudRegionVersion(cloudSite.getCloudVersion());
region.setOwnerDefinedType("cLCP");
+ region.setCloudType("openstack");
+ MavenLikeVersioning cloudVersion = new MavenLikeVersioning();
+ cloudVersion.setVersion(cloudSite.getCloudVersion());
+ if (cloudVersion.isMoreRecentThan("3.0")) {
+ region.setCloudZone(cloudSite.getRegionId().substring(0, cloudSite.getRegionId().length() - 1));
+ } else {
+ region.setCloudZone(cloudSite.getRegionId());
+ }
region.setOrchestrationDisabled(false);
- region.setComplexName("NA");
region.setInMaint(false);
- region.setCloudType("openstack");
return region;
}
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 257374fdb2..4728effdca 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
@@ -97,7 +97,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NETWORK_CREATED_STATUS_MESSAGE =
"The new network was successfully created in the cloud";
private static final String NETWORK_NOT_EXIST_STATUS_MESSAGE =
- "The network as not found, thus no network was deleted in the cloud via this request";
+ "The network was not found, thus no network was deleted in the cloud via this request";
private static final String NETWORK_DELETED_STATUS_MESSAGE = "The network was successfully deleted in the cloud";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
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 32e88d8cad..f495015261 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
@@ -33,6 +33,7 @@ import java.util.Optional;
import javax.jws.WebService;
import javax.xml.ws.Holder;
import org.apache.commons.collections.CollectionUtils;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
import org.onap.so.client.aai.AAIResourcesClient;
@@ -53,7 +54,6 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.heatbridge.HeatBridgeApi;
import org.onap.so.heatbridge.HeatBridgeException;
import org.onap.so.heatbridge.HeatBridgeImpl;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
@@ -104,8 +104,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
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";
@@ -113,7 +111,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
"The vf module was found to already exist, thus no new vf module was created in the cloud via this request";
private static final String VF_CREATED_STATUS_MESSAGE = "The new vf module was successfully created in the cloud";
private static final String VF_NOT_EXIST_STATUS_MESSAGE =
- "The vf module was not, thus no vf module was deleted in the cloud via this request";
+ "The vf module was not found, thus no vf module was deleted in the cloud via this request";
private static final String VF_DELETED_STATUS_MESSAGE = "The vf module was successfully deleted in the cloud";
@Autowired
@@ -1052,9 +1050,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
heatStack = msoHeatUtils.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null,
template, goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists);
-
- msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
- heatStack.isOperationPerformed() ? VF_EXIST_STATUS_MESSAGE : VF_CREATED_STATUS_MESSAGE);
+ if (msoRequest.getRequestId() != null) {
+ msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
+ heatStack.isOperationPerformed() ? VF_CREATED_STATUS_MESSAGE : VF_EXIST_STATUS_MESSAGE);
+ }
} else {
throw new MsoHeatNotFoundException();
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
index 3d9a128318..8e71ec46b0 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
@@ -22,17 +22,12 @@ package org.onap.so.adapters.audit;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashSet;
-import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.stream.Stream;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -43,9 +38,8 @@ import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
-import org.onap.aai.domain.yang.Relationship;
-import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
@@ -60,8 +54,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.woorea.openstack.heat.model.Resource;
-import com.woorea.openstack.heat.model.Resources;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AuditVServerTest extends AuditVServer {
@@ -399,9 +391,9 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
- doReturn(wrapper).when(aaiResourcesMock)
- .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
- .queryParam("vf-module-name", "vfModuleName"));
+ doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
+ "vfModuleName"));
Optional<AAIObjectAuditList> auditList =
auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
@@ -417,9 +409,9 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver());
- doReturn(wrapper).when(aaiResourcesMock)
- .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
- .queryParam("vf-module-name", "vfModuleName"));
+ doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
+ "vfModuleName"));
doReturn(vserverWrapper).when(aaiResourcesMock).get(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
"cloud-owner", "cloud-region-id", "tenant-id", "VUSCHGA1"));
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
index 9c62c286ac..2df56ede10 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
@@ -23,6 +23,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository;
@RunWith(MockitoJUnitRunner.class)
@@ -38,6 +39,9 @@ public class CloudRegionRestImplTest {
@Mock
private AAIResourcesClient aaiResClientMock;
+ @Mock
+ private NetworkTechnologyReferenceRepository ntRepoMock;
+
private CloudSite cloudSite = new CloudSite();
private CloudRegion testCloudRegion = new CloudRegion();
@@ -46,30 +50,52 @@ public class CloudRegionRestImplTest {
public void setup() {
cloudSite.setCloudVersion("1.0");
cloudSite.setRegionId("region1");
+ cloudSite.setCloudOwner("bob");
Mockito.doReturn(aaiResClientMock).when(cloudRestImpl).getAaiClient();
testCloudRegion.setCloudOwner("bob");
testCloudRegion.setCloudRegionId("region1");
testCloudRegion.setCloudRegionVersion("1.0");
testCloudRegion.setInMaint(false);
testCloudRegion.setOrchestrationDisabled(false);
- testCloudRegion.setComplexName("NA");
testCloudRegion.setCloudRegionVersion("1.0");
testCloudRegion.setOwnerDefinedType("cLCP");
testCloudRegion.setCloudType("openstack");
+ testCloudRegion.setCloudZone("region1");
}
@Test
public void mapCloudRegionTest() {
- CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite, "bob");
+ CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite);
assertThat(mappedRegion, sameBeanAs(testCloudRegion));
}
+
+ @Test
+ public void mapCloudRegionVersionGreaterThan3Test() {
+ CloudSite cloudSite2 = new CloudSite();
+ cloudSite2.setCloudVersion("3.0.1");
+ cloudSite2.setRegionId("region1");
+ cloudSite2.setCloudOwner("bob");
+
+ CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite2);
+ CloudRegion testRegion2 = new CloudRegion();
+ testRegion2.setCloudOwner("bob");
+ testRegion2.setCloudRegionId("region1");
+ testRegion2.setCloudRegionVersion("3.0.1");
+ testRegion2.setInMaint(false);
+ testRegion2.setOrchestrationDisabled(false);
+ testRegion2.setOwnerDefinedType("cLCP");
+ testRegion2.setCloudType("openstack");
+ testRegion2.setCloudZone("region");
+ assertThat(mappedRegion, sameBeanAs(testRegion2));
+ }
+
@Test
public void createCloudRegionTest() {
when(catalogDbClientMock.getCloudSite("region1")).thenReturn(null);
when(catalogDbClientMock.postCloudSite(cloudSite)).thenReturn(cloudSite);
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "bob", "region1");
- cloudRestImpl.createCloudRegion(cloudSite, "bob");
+ cloudRestImpl.createCloudRegion(cloudSite);
ArgumentCaptor<AAIResourceUri> actualURI = ArgumentCaptor.forClass(AAIResourceUri.class);
ArgumentCaptor<Optional<Object>> actualCloudRegion = ArgumentCaptor.forClass(Optional.class);
verify(catalogDbClientMock, times(1)).getCloudSite("region1");
@@ -82,7 +108,7 @@ public class CloudRegionRestImplTest {
@Test
public void updateCloudRegionTest() {
when(catalogDbClientMock.updateCloudSite(cloudSite)).thenReturn(cloudSite);
- cloudRestImpl.updateCloudRegion(cloudSite, "bob");
+ cloudRestImpl.updateCloudRegion(cloudSite);
verify(catalogDbClientMock, times(1)).updateCloudSite(cloudSite);
}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index 6b791e789c..3357fec109 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -801,6 +801,7 @@ CREATE TABLE `service` (
`TOSCA_CSAR_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
`SERVICE_TYPE` varchar(200) DEFAULT NULL,
`SERVICE_ROLE` varchar(200) DEFAULT NULL,
+ `SERVICE_FUNCTION` varchar(200) DEFAULT NULL,
`ENVIRONMENT_CONTEXT` varchar(200) DEFAULT NULL,
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.2__Fix_Invalid_Request_Status.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.2__Fix_Invalid_Request_Status.sql
new file mode 100644
index 0000000000..9fee716326
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.2__Fix_Invalid_Request_Status.sql
@@ -0,0 +1,4 @@
+USE `requestdb`;
+
+UPDATE infra_active_requests SET request_status='COMPLETE' where request_status = 'COMPLETED';
+UPDATE archived_infra_requests SET request_status='COMPLETE' where request_status = 'COMPLETED'; \ No newline at end of file
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 431e9db87b..ea24a0ce3e 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
@@ -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.
@@ -27,6 +27,8 @@ package org.onap.so.adapters.sdnc.sdncrest;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
+import java.util.Arrays;
+import java.util.List;
import javax.xml.XMLConstants;
import javax.xml.bind.DatatypeConverter;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -71,7 +73,6 @@ import org.springframework.core.env.Environment;
public abstract class SDNCConnector {
private static final Logger logger = LoggerFactory.getLogger(SDNCConnector.class);
- private static final String MSO_INTERNAL_ERROR = "MsoInternalError";
private static final String XPATH_EXCEPTION = "XPath Exception";
@Autowired
private Environment env;
@@ -84,32 +85,10 @@ public abstract class SDNCConnector {
HttpResponse httpResponse = null;
try {
- int timeout = Integer.parseInt(rt.getTimeout());
-
- RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
- .setConnectionRequestTimeout(timeout).build();
HttpClient client = HttpClientBuilder.create().build();
- if ("POST".equals(rt.getReqMethod())) {
- HttpPost httpPost = new HttpPost(rt.getSdncUrl());
- httpPost.setConfig(requestConfig);
- httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_XML));
- method = httpPost;
- } else if ("PUT".equals(rt.getReqMethod())) {
- HttpPut httpPut = new HttpPut(rt.getSdncUrl());
- httpPut.setConfig(requestConfig);
- httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_XML));
- method = httpPut;
- } else if ("GET".equals(rt.getReqMethod())) {
- HttpGet httpGet = new HttpGet(rt.getSdncUrl());
- httpGet.setConfig(requestConfig);
- method = httpGet;
- } else if ("DELETE".equals(rt.getReqMethod())) {
- HttpDelete httpDelete = new HttpDelete(rt.getSdncUrl());
- httpDelete.setConfig(requestConfig);
- method = httpDelete;
- }
+ method = getHttpRequestMethod(content, rt);
String userCredentials = CryptoUtils.decrypt(env.getProperty(Constants.SDNC_AUTH_PROP),
@@ -122,8 +101,6 @@ public abstract class SDNCConnector {
logger.debug("method is NULL:");
}
-
-
httpResponse = client.execute(method);
String responseContent = null;
@@ -141,7 +118,7 @@ public abstract class SDNCConnector {
String errMsg = "SDNC returned " + statusCode + " " + statusMessage;
String errors = analyzeErrors(responseContent);
- if (errors != null) {
+ if (errors != null && !errors.isEmpty()) {
errMsg += " " + errors;
}
@@ -192,6 +169,36 @@ public abstract class SDNCConnector {
}
}
+ private HttpRequestBase getHttpRequestMethod(String content, TypedRequestTunables rt) {
+
+ int timeout = Integer.parseInt(rt.getTimeout());
+ HttpRequestBase method = null;
+
+ RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
+ .setConnectionRequestTimeout(timeout).build();
+
+ if ("POST".equals(rt.getReqMethod())) {
+ HttpPost httpPost = new HttpPost(rt.getSdncUrl());
+ httpPost.setConfig(requestConfig);
+ httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_XML));
+ method = httpPost;
+ } else if ("PUT".equals(rt.getReqMethod())) {
+ HttpPut httpPut = new HttpPut(rt.getSdncUrl());
+ httpPut.setConfig(requestConfig);
+ httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_XML));
+ method = httpPut;
+ } else if ("GET".equals(rt.getReqMethod())) {
+ HttpGet httpGet = new HttpGet(rt.getSdncUrl());
+ httpGet.setConfig(requestConfig);
+ method = httpGet;
+ } else if ("DELETE".equals(rt.getReqMethod())) {
+ HttpDelete httpDelete = new HttpDelete(rt.getSdncUrl());
+ httpDelete.setConfig(requestConfig);
+ method = httpDelete;
+ }
+ return method;
+ }
+
protected void logError(String errMsg) {
logger.error(LoggingAnchor.FOUR, MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), errMsg);
@@ -205,7 +212,7 @@ public abstract class SDNCConnector {
/**
* Generates a response object from content received from SDNC. The response object may be a success response object
* or an error response object. This method must be overridden by the subclass to return the correct object type.
- *
+ *
* @param statusCode the response status code from SDNC (e.g. 200)
* @param statusMessage the response status message from SDNC (e.g. "OK")
* @param responseContent the body of the response from SDNC (possibly null)
@@ -218,7 +225,7 @@ public abstract class SDNCConnector {
/**
* Generates an error response object. This method must be overridden by the subclass to return the correct object
* type.
- *
+ *
* @param statusCode the response status code (from SDNC, or internally generated)
* @param errMsg the error message (normally a verbose explanation of the error)
* @param rt request tunables
@@ -229,17 +236,17 @@ public abstract class SDNCConnector {
/**
* Called by the send() method to analyze errors that may be encoded in the content of non-2XX responses. By
* default, this method tries to parse the content as a restconf error.
- *
+ *
* <pre>
* xmlns = "urn:ietf:params:xml:ns:yang:ietf-restconf"
* </pre>
- *
+ *
* If an error (or errors) can be obtained from the content, then the result is a string in this format:
- *
+ *
* <pre>
* [error-type:TYPE, error-tag:TAG, error-message:MESSAGE] ...
* </pre>
- *
+ *
* If no error could be obtained from the content, then the result is null.
* <p>
* The subclass can override this method to provide another implementation.
@@ -262,7 +269,7 @@ public abstract class SDNCConnector {
// </error>
// </errors>
- StringBuilder output = null;
+ String output = null;
try {
XPathFactory xpathFactory = XPathFactory.newInstance();
@@ -274,55 +281,47 @@ public abstract class SDNCConnector {
InputSource source = new InputSource(new StringReader(content));
Document doc = documentBuilderFactory.newDocumentBuilder().parse(source);
NodeList errors = (NodeList) xpath.evaluate("errors/error", doc, XPathConstants.NODESET);
+ StringBuilder errorDetails = getErrorDetails(xpath, errors);
+ if (errorDetails != null) {
+ output = errorDetails.toString();
+ }
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
+ }
- for (int i = 0; i < errors.getLength(); i++) {
- Element error = (Element) errors.item(i);
+ return output;
+ }
- String info = "";
+ private StringBuilder getErrorDetails(XPath xpath, NodeList errors) {
- try {
- String errorType = xpath.evaluate("error-type", error);
- info += "error-type:" + errorType;
- } catch (XPathExpressionException e) {
- logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
- error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
- }
+ StringBuilder output = null;
- try {
- String errorTag = xpath.evaluate("error-tag", error);
- if (!info.isEmpty()) {
- info += ", ";
- }
- info += "error-tag:" + errorTag;
- } catch (XPathExpressionException e) {
- logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
- error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
- }
+ for (int i = 0; i < errors.getLength(); i++) {
+ Element error = (Element) errors.item(i);
+
+ StringBuilder info = new StringBuilder();
+ List<String> errorAttributesList = Arrays.asList("error-type", "error-tag", "error-message");
+
+ for (String errorAttrib : errorAttributesList) {
try {
- String errorMessage = xpath.evaluate("error-message", error);
- if (!info.isEmpty()) {
- info += ", ";
- }
- info += "error-message:" + errorMessage;
- } catch (Exception e) {
- logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
+ String errorAttribValue = xpath.evaluate(errorAttrib, error);
+ info.append(errorAttrib).append(":").append(errorAttribValue);
+ } catch (XPathExpressionException e) {
+ logger.error(LoggingAnchor.SIX, MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), errorAttrib,
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
+ }
- if (!info.isEmpty()) {
- if (output == null) {
- output = new StringBuilder("[" + info + "]");
- } else {
- output.append(" [").append(info).append("]");
- }
+ if (!info.toString().isEmpty()) {
+ if (output == null) {
+ output = new StringBuilder("[" + info + "]");
+ } else {
+ output.append(" [").append(info).append("]");
}
}
- } catch (Exception e) {
- logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
- ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
}
-
- return output.toString();
+ return output;
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
index 6f76ea1eab..9dd95c6713 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.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.
@@ -59,9 +59,6 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
TypedRequestTunables rt) {
try {
return parseResponseContent(responseContent);
- } catch (ParseException e) {
- logger.error("Error occured:", e);
- return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
} catch (Exception e) {
logger.error("Error occured:", e);
return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
@@ -79,10 +76,10 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
* response code contained in the content. For 2XX response codes, an SDNCServiceResponse is returned. Otherwise, an
* SDNCServiceError is returned. If the content cannot be parsed, or if the content does not contain all required
* elements, a parse exception is thrown. This method performs no logging or alarming.
- *
+ *
* @throws ParseException on error
*/
- public static SDNCResponseCommon parseResponseContent(String responseContent)
+ public SDNCResponseCommon parseResponseContent(String responseContent)
throws ParseException, ParserConfigurationException, SAXException, IOException {
// Note: this document builder is not namespace-aware, so namespaces are ignored.
@@ -119,16 +116,24 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
List<Element> responseParameters = new ArrayList<>();
for (Element child : SDNCAdapterUtils.childElements(configurationResponseCommon)) {
- if ("response-code".equals(child.getNodeName())) {
- responseCode = child.getTextContent();
- } else if ("response-message".equals(child.getNodeName())) {
- responseMessage = child.getTextContent();
- } else if ("svc-request-id".equals(child.getNodeName())) {
- svcRequestId = child.getTextContent();
- } else if ("ack-final-indicator".equals(child.getNodeName())) {
- ackFinalIndicator = child.getTextContent();
- } else if ("response-parameters".equals(child.getNodeName())) {
- responseParameters.add(child);
+
+ switch (child.getNodeName()) {
+ case "response-code":
+ responseCode = child.getTextContent();
+ break;
+ case "response-message":
+ responseMessage = child.getTextContent();
+ break;
+ case "svc-request-id":
+ svcRequestId = child.getTextContent();
+ break;
+ case "ack-final-indicator":
+ ackFinalIndicator = child.getTextContent();
+ break;
+ case "response-parameters":
+ responseParameters.add(child);
+ break;
+ default:
}
}
@@ -167,8 +172,15 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
return new SDNCServiceError(svcRequestId, responseCode, responseMessage, ackFinalIndicator);
}
- // Create a success response object.
+ return createSDNCServiceResponse(responseCode, responseMessage, svcRequestId, ackFinalIndicator,
+ responseParameters);
+
+ }
+
+ private SDNCServiceResponse createSDNCServiceResponse(String responseCode, String responseMessage,
+ String svcRequestId, String ackFinalIndicator, List<Element> responseParameters) throws ParseException {
+ // Create a success response object.
SDNCServiceResponse response =
new SDNCServiceResponse(svcRequestId, responseCode, responseMessage, ackFinalIndicator);
@@ -201,8 +213,6 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
response.addParam(tagName, tagValue);
}
-
return response;
-
}
}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java
index 9911cae677..9adc6c52f5 100644
--- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.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,7 +31,8 @@ public class SDNCServiceRequestConnectorTest {
public void parseResponseContentTest() throws Exception {
String content = FileUtil.readResourceFile("SdncServiceResponse.xml");
- SDNCResponseCommon responseCommon = SDNCServiceRequestConnector.parseResponseContent(content);
+ SDNCServiceRequestConnector sdncServiceRequestConnector = new SDNCServiceRequestConnector();
+ SDNCResponseCommon responseCommon = sdncServiceRequestConnector.parseResponseContent(content);
assertNotNull(responseCommon);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
index bb322eb1d8..54f05859d9 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
@@ -91,7 +91,57 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.basedir}/target/generated-sources/etsicatalog/notification/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-packagemanagement/notification/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/vnfmadapter/src/gen/java/main</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[2.2.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<dependencies>
<dependency>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
index a643aaa5b8..ab524ca808 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
@@ -132,7 +132,60 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.basedir}/target/generated-sources/etsicatalog/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-packagemanagement/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-grant/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-lcn/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-lcm/src/gen/java/main</source>
+
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[2.2.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<dependencies>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json
index 3c5ec49b80..35a8c2bd3d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json
@@ -5,7 +5,7 @@
"description": "\n\nThe `swagger-ui` view can be found [here](/api/catalog/v1/swagger).\nThe `ReDoc` view can be found [here](/api/catalog/v1/redoc).\nThe swagger YAML document can be found [here](/api/catalog/v1/swagger.yaml).\nThe swagger JSON document can be found [here](/api/catalog/v1/swagger.json).",
"version": "v1"
},
- "host": "127.0.0.1:8000",
+ "host": "127.0.0.1:8806",
"schemes": ["http"],
"basePath": "/",
"consumes": ["application/json"],
@@ -2641,7 +2641,7 @@
"inputs": {
"title": "Inputs",
"description": "Inputs",
- "type": "string"
+ "type": "object"
}
}
},
@@ -2652,7 +2652,7 @@
"model": {
"title": "Model",
"description": "Model",
- "type": "string"
+ "type": "object"
}
}
},
@@ -2825,7 +2825,7 @@
"required": ["callbackUri"],
"type": "object",
"properties": {
- "filters": {
+ "filter": {
"$ref": "#/definitions/PkgmNotificationsFilter"
},
"callbackUri": {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
index f32a9b0fa9..caefe71993 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
@@ -55,7 +55,7 @@ public class PkgmSubscriptionRequestConverter implements
new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest();
etsiCatalogManagerSubscriptionRequest
- .setFilters(getPkgmNotificationsFilter(pkgmSubscriptionRequest.getFilter()));
+ .setFilter(getPkgmNotificationsFilter(pkgmSubscriptionRequest.getFilter()));
return etsiCatalogManagerSubscriptionRequest;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
index 6840dd388b..860dfbbe9c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
@@ -20,16 +20,41 @@
package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.util.concurrent.TimeUnit;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.adapters.vnfmadapter.extclients.AbstractServiceProviderConfiguration;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpClientConnectionConfiguration;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
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;
/**
@@ -41,16 +66,105 @@ import org.springframework.web.client.RestTemplate;
@Configuration
public class EtsiCatalogServiceProviderConfiguration extends AbstractServiceProviderConfiguration {
- @Bean(name = "etsiCatalogServiceProvider")
- public HttpRestServiceProvider httpRestServiceProvider(
- @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate) {
- return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider());
+ public static final String ETSI_CATALOG_REST_TEMPLATE_BEAN = "etsiCatalogRestTemplate";
+
+ public static final String ETSI_CATALOG_SERVICE_PROVIDER_BEAN = "etsiCatalogServiceProvider";
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProviderConfiguration.class);
+
+ private final HttpClientConnectionConfiguration clientConnectionConfiguration;
+
+ @Value("${etsi-catalog-manager.http.client.ssl.trust-store:#{null}}")
+ private Resource trustStore;
+ @Value("${etsi-catalog-manager.http.client.ssl.trust-store-password:#{null}}")
+ private String trustStorePassword;
+
+ @Autowired
+ public EtsiCatalogServiceProviderConfiguration(
+ final HttpClientConnectionConfiguration clientConnectionConfiguration) {
+ this.clientConnectionConfiguration = clientConnectionConfiguration;
+ }
+
+ @Bean
+ @Qualifier(ETSI_CATALOG_REST_TEMPLATE_BEAN)
+ public RestTemplate etsiCatalogRestTemplate() {
+ final RestTemplate restTemplate = new RestTemplate();
+ restTemplate.getInterceptors().add(new SOSpringClientFilter());
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
+ return restTemplate;
}
- private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
- final HttpHeadersProvider httpHeadersProvider) {
+ @Bean
+ @Qualifier(ETSI_CATALOG_SERVICE_PROVIDER_BEAN)
+ public HttpRestServiceProvider etsiCatalogHttpRestServiceProvider(
+ @Qualifier(ETSI_CATALOG_REST_TEMPLATE_BEAN) final RestTemplate restTemplate) {
setGsonMessageConverter(restTemplate);
- return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
+
+ final HttpClientBuilder httpClientBuilder = getHttpClientBuilder();
+ if (trustStore != null) {
+ try {
+ LOGGER.debug("Setting up HttpComponentsClientHttpRequestFactory with SSL Context");
+ LOGGER.debug("Setting client trust-store: {}", trustStore.getURL());
+ LOGGER.debug("Creating SSLConnectionSocketFactory with AllowAllHostsVerifier ... ");
+ final SSLContext sslContext = new SSLContextBuilder()
+ .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build();
+ final SSLConnectionSocketFactory sslConnectionSocketFactory =
+ new SSLConnectionSocketFactory(sslContext, AllowAllHostsVerifier.INSTANCE);
+ httpClientBuilder.setSSLSocketFactory(sslConnectionSocketFactory);
+ final Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder
+ .<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.INSTANCE)
+ .register("https", sslConnectionSocketFactory).build();
+
+ httpClientBuilder.setConnectionManager(getConnectionManager(socketFactoryRegistry));
+ } catch (final KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
+ | IOException exception) {
+ LOGGER.error("Error reading truststore, TLS connection will fail.", exception);
+ }
+
+ } else {
+ LOGGER.debug("Setting connection manager without SSL ConnectionSocketFactory ...");
+ httpClientBuilder.setConnectionManager(getConnectionManager());
+ }
+
+ final HttpComponentsClientHttpRequestFactory factory =
+ new HttpComponentsClientHttpRequestFactory(httpClientBuilder.build());
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
+
+ return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider().getHttpHeaders());
+ }
+
+ private PoolingHttpClientConnectionManager getConnectionManager(
+ final Registry<ConnectionSocketFactory> socketFactoryRegistry) {
+ return new PoolingHttpClientConnectionManager(socketFactoryRegistry, null, null, null,
+ clientConnectionConfiguration.getTimeToLiveInMins(), TimeUnit.MINUTES);
+ }
+
+ private PoolingHttpClientConnectionManager getConnectionManager() {
+ return new PoolingHttpClientConnectionManager(clientConnectionConfiguration.getTimeToLiveInMins(),
+ TimeUnit.MINUTES);
+ }
+
+ private HttpClientBuilder getHttpClientBuilder() {
+ return HttpClientBuilder.create().setMaxConnPerRoute(clientConnectionConfiguration.getMaxConnectionsPerRoute())
+ .setMaxConnTotal(clientConnectionConfiguration.getMaxConnections())
+ .setDefaultRequestConfig(getRequestConfig());
+ }
+
+ private RequestConfig getRequestConfig() {
+ return RequestConfig.custom().setSocketTimeout(clientConnectionConfiguration.getSocketTimeOutInMiliSeconds())
+ .setConnectTimeout(clientConnectionConfiguration.getConnectionTimeOutInMilliSeconds()).build();
+ }
+
+ private static final class AllowAllHostsVerifier implements HostnameVerifier {
+
+ private static final AllowAllHostsVerifier INSTANCE = new AllowAllHostsVerifier();
+
+ @Override
+ public boolean verify(final String hostname, final SSLSession session) {
+ LOGGER.debug("Skipping hostname verification ...");
+ return true;
+ }
+
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
index 30d084629c..cae413ce10 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
@@ -20,6 +20,7 @@
package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+import static org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_SERVICE_PROVIDER_BEAN;
import java.util.Optional;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
@@ -53,14 +54,14 @@ import org.springframework.stereotype.Service;
public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvider {
private static final Logger logger = LoggerFactory.getLogger(EtsiCatalogServiceProviderImpl.class);
- @Qualifier("etsiCatalogServiceProvider")
private final HttpRestServiceProvider httpServiceProvider;
private final EtsiCatalogUrlProvider etsiCatalogUrlProvider;
private final ConversionService conversionService;
@Autowired
public EtsiCatalogServiceProviderImpl(final EtsiCatalogUrlProvider etsiCatalogUrlProvider,
- final HttpRestServiceProvider httpServiceProvider, final ConversionService conversionService) {
+ @Qualifier(ETSI_CATALOG_SERVICE_PROVIDER_BEAN) final HttpRestServiceProvider httpServiceProvider,
+ final ConversionService conversionService) {
this.etsiCatalogUrlProvider = etsiCatalogUrlProvider;
this.httpServiceProvider = httpServiceProvider;
this.conversionService = conversionService;
@@ -118,8 +119,10 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
if (inlineResponse2001 != null) {
responses[index] = inlineResponse2001;
}
+ } else {
+ logger.error("Unable to find Converter for response class: {}",
+ vnfPackages[index].getClass());
}
- logger.error("Unable to find Converter for response class: {}", vnfPackages[index].getClass());
}
return Optional.of(responses);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
new file mode 100644
index 0000000000..9ed17e4379
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import org.onap.so.adapters.vnfmadapter.extclients.AbstractServiceProviderConfiguration;
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Configuration
+public class VnfmHttpServiceProviderConfiguration extends AbstractServiceProviderConfiguration {
+ public static final String VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN = "vnfmAdapterHttpServiceProvider";
+
+ @Bean
+ @Qualifier(VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN)
+ public HttpRestServiceProvider vnfmAdapterHttpRestServiceProvider(
+ @Autowired @Qualifier(CONFIGURABLE_REST_TEMPLATE) RestTemplate restTemplate) {
+ setGsonMessageConverter(restTemplate);
+ return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider().getHttpHeaders());
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java
index 86ca59cffe..d6b7ae7201 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java
@@ -19,16 +19,13 @@
*/
package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmHttpServiceProviderConfiguration.VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN;
import java.nio.charset.StandardCharsets;
import org.apache.commons.codec.binary.Base64;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
-import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.web.client.RestTemplate;
/**
* A base class that can be extended by classes for providing notification services. Provides common methods that will
@@ -40,12 +37,10 @@ import org.springframework.web.client.RestTemplate;
public abstract class AbstractNotificationServiceProvider {
@Autowired
- @Qualifier(CONFIGURABLE_REST_TEMPLATE)
- private RestTemplate restTemplate;
+ @Qualifier(VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN)
+ private HttpRestServiceProvider httpRestServiceProvider;
- protected HttpRestServiceProvider getHttpRestServiceProvider(final HttpHeadersProvider httpHeadersProvider) {
- final HttpRestServiceProvider httpRestServiceProvider =
- new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
+ protected HttpRestServiceProvider getHttpRestServiceProvider() {
return httpRestServiceProvider;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java
index 6f9d94e9de..cf0cdb085a 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java
@@ -47,10 +47,10 @@ public class BasicAuthNotificationServiceProvider extends AbstractNotificationSe
final HttpHeadersProvider httpHeadersProvider =
getBasicHttpHeadersProviderWithBasicAuth(subscriptionsAuthentication.getParamsBasic().getUserName(),
subscriptionsAuthentication.getParamsBasic().getPassword());
- final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider(httpHeadersProvider);
+ final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider();
- final ResponseEntity<Void> responseEntity =
- httpRestServiceProvider.postHttpRequest(notification, callbackUri, Void.class);
+ final ResponseEntity<Void> responseEntity = httpRestServiceProvider.postHttpRequest(notification, callbackUri,
+ httpHeadersProvider.getHttpHeaders(), Void.class);
if (responseEntity.getStatusCode().is2xxSuccessful()) {
logger.info("Notification sent successfully.");
return true;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java
index 496fb083cf..c065203cd8 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java
@@ -48,13 +48,14 @@ public class OAuthNotificationServiceProvider extends AbstractNotificationServic
final String token = getAccessToken(subscriptionsAuthentication);
if (token == null) {
+ logger.error("Failed to get access token");
return false;
}
final HttpHeadersProvider httpHeadersProvider = getHttpHeadersProvider(token);
- final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider(httpHeadersProvider);
- final ResponseEntity<Void> responseEntity =
- httpRestServiceProvider.postHttpRequest(notification, callbackUri, Void.class);
+ final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider();
+ final ResponseEntity<Void> responseEntity = httpRestServiceProvider.postHttpRequest(notification, callbackUri,
+ httpHeadersProvider.getHttpHeaders(), Void.class);
if (responseEntity.getStatusCode().is2xxSuccessful()) {
logger.info("Notification sent successfully.");
return true;
@@ -83,9 +84,9 @@ public class OAuthNotificationServiceProvider extends AbstractNotificationServic
subscriptionsAuthentication.getParamsOauth2ClientCredentials().getClientId(),
subscriptionsAuthentication.getParamsOauth2ClientCredentials().getClientPassword());
- final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider(httpHeadersProvider);
- final ResponseEntity<OAuthTokenResponse> responseEntity =
- httpRestServiceProvider.postHttpRequest(null, tokenEndpoint, OAuthTokenResponse.class);
+ final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider();
+ final ResponseEntity<OAuthTokenResponse> responseEntity = httpRestServiceProvider.postHttpRequest(null,
+ tokenEndpoint, httpHeadersProvider.getHttpHeaders(), OAuthTokenResponse.class);
if (responseEntity.getStatusCode().is2xxSuccessful()) {
if (responseEntity.getBody() != null) {
logger.info("Returning Access Token.");
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
index 322251e753..29afa8c549 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
@@ -278,7 +278,7 @@ public class EtsiSubscriptionNotificationControllerTest {
mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andExpect(jsonPath("$.id").value(NOTIFICATION_ID))
.andExpect(jsonPath("$.notificationType").value(
- VnfPackageChangeNotification.NotificationTypeEnum.VNFPACKAGECHANGENOTIFICATION.toString()))
+ VnfPackageChangeNotification.NotificationTypeEnum.VNFPACKAGECHANGENOTIFICATION.getValue()))
.andExpect(jsonPath("$.subscriptionId").value(SUBSCRIPTION_ID))
.andExpect(jsonPath("$.timeStamp").value(TIMESTAMP.toString()))
.andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID.toString()))
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
index c5194cf27e..31e612a812 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
@@ -74,11 +74,11 @@ public class Sol003PackageManagementControllerTest {
private int port;
@Autowired
- @Qualifier(CONFIGURABLE_REST_TEMPLATE)
- private RestTemplate testRestTemplate;
+ @Qualifier(ETSI_CATALOG_REST_TEMPLATE_BEAN)
+ private RestTemplate restTemplate;
@Autowired
- private TestRestTemplate restTemplate;
+ private TestRestTemplate testRestTemplate;
private static final String VNF_PACKAGE_ID = "myVnfPackageId";
private static final String ARTIFACT_PATH = "myArtifactPath";
@@ -104,8 +104,7 @@ public class Sol003PackageManagementControllerTest {
@Before
public void setUp() {
- final MockRestServiceServer.MockRestServiceServerBuilder builder =
- MockRestServiceServer.bindTo(testRestTemplate);
+ final MockRestServiceServer.MockRestServiceServerBuilder builder = MockRestServiceServer.bindTo(restTemplate);
builder.ignoreExpectOrder(true);
mockRestServer = builder.build();
basicHttpHeadersProvider = new BasicHttpHeadersProvider();
@@ -123,7 +122,7 @@ public class Sol003PackageManagementControllerTest {
+ VNF_PACKAGE_ID + "/package_content";
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
final ResponseEntity<byte[]> responseEntity =
- restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
+ testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
assertEquals(byte[].class, responseEntity.getBody().getClass());
assertArrayEquals(responseEntity.getBody(), responseArray);
@@ -164,7 +163,7 @@ public class Sol003PackageManagementControllerTest {
final ResponseEntity<ProblemDetails> responseEntity =
- restTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class);
+ testRestTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class);
assertTrue(responseEntity.getBody() instanceof ProblemDetails);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
@@ -226,7 +225,7 @@ public class Sol003PackageManagementControllerTest {
+ VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH;
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
final ResponseEntity<byte[]> responseEntity =
- restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
+ testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
assertEquals(byte[].class, responseEntity.getBody().getClass());
assertArrayEquals(responseEntity.getBody(), responseArray);
@@ -267,7 +266,7 @@ public class Sol003PackageManagementControllerTest {
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
final ResponseEntity<ProblemDetails> responseEntity =
- restTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class);
+ testRestTemplate.exchange(testURL, HttpMethod.GET, request, ProblemDetails.class);
assertNotNull(responseEntity.getBody());
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
@@ -331,7 +330,7 @@ public class Sol003PackageManagementControllerTest {
final String testURL = localhostUrl + port + VNFPKGM_BASE_URL;
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
- final ResponseEntity<InlineResponse2001[]> responseEntity = restTemplate.withBasicAuth("test", "test")
+ final ResponseEntity<InlineResponse2001[]> responseEntity = testRestTemplate.withBasicAuth("test", "test")
.exchange(testURL, HttpMethod.GET, request, InlineResponse2001[].class);
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
@@ -412,7 +411,7 @@ public class Sol003PackageManagementControllerTest {
final String testURL = localhostUrl + port + VNFPKGM_BASE_URL + "/" + VNF_PACKAGE_ID;
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
- final ResponseEntity<InlineResponse2001> responseEntity = restTemplate.withBasicAuth("test", "test")
+ final ResponseEntity<InlineResponse2001> responseEntity = testRestTemplate.withBasicAuth("test", "test")
.exchange(testURL, HttpMethod.GET, request, InlineResponse2001.class);
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
@@ -484,7 +483,8 @@ public class Sol003PackageManagementControllerTest {
+ VNF_PACKAGE_ID + "\" \n" + "endpoint.", problemDetails.getDetail());
}
- // The below test method is here to improve code coverage and provide a foundation for writing future tests
+ // The below test method is here to improve code coverage and provide a foundation for writing
+ // future tests
@Test
public void testGetPackageVnfd_ValidArray_Success() {
final byte[] responseArray = buildByteArrayWithRandomData(10);
@@ -497,7 +497,7 @@ public class Sol003PackageManagementControllerTest {
"http://localhost:" + port + PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages/" + VNF_PACKAGE_ID + "/vnfd";
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
final ResponseEntity<byte[]> responseEntity =
- restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
+ testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, byte[].class);
assertEquals(byte[].class, responseEntity.getBody().getClass());
assertArrayEquals(responseEntity.getBody(), responseArray);
@@ -592,7 +592,7 @@ public class Sol003PackageManagementControllerTest {
private ResponseEntity<ProblemDetails> sendHttpRequest(final String url) {
final String testURL = localhostUrl + port + VNFPKGM_BASE_URL + "/" + url;
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
- return restTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request,
+ return testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request,
ProblemDetails.class);
}
@@ -652,4 +652,5 @@ public class Sol003PackageManagementControllerTest {
final VNFPKGMLinkSerializer vnfpkgmLinkSerializer = new VNFPKGMLinkSerializer().self(uriLink);
return vnfpkgmLinkSerializer;
}
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
index 9016cad528..c269af8e68 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
@@ -28,7 +28,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
-import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
@@ -102,7 +102,7 @@ public class Sol003PackageManagementSubscriptionControllerTest {
private static final String LOCALHOST_URL = "http://localhost:";
@Autowired
- @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ @Qualifier(ETSI_CATALOG_REST_TEMPLATE_BEAN)
private RestTemplate restTemplate;
private MockRestServiceServer mockRestServiceServer;
@Autowired
@@ -324,7 +324,7 @@ public class Sol003PackageManagementSubscriptionControllerTest {
private org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest getEtsiCatalogPkgmSubscriptionRequest() {
return new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest()
- .filters(new PkgmNotificationsFilter()
+ .filter(new PkgmNotificationsFilter()
.addNotificationTypesItem(
PkgmNotificationsFilter.NotificationTypesEnum.VNFPACKAGEONBOARDINGNOTIFICATION)
.addVnfdIdItem("VNFDID").addVnfPkgIdItem("VNFPKGID")
diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml
index e8e5808eca..66dcc4dd30 100644
--- a/adapters/so-appc-orchestrator/pom.xml
+++ b/adapters/so-appc-orchestrator/pom.xml
@@ -14,7 +14,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
- <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
+ <appc.client.version>1.7.1-SNAPSHOT</appc.client.version>
</properties>
<name>so-appc-orchestrator</name>
<description>MSO APPC-C Orchestrator</description>
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
index b065e9a0c3..e5321067ac 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/beans/ConfigurationParameters.java
@@ -1,5 +1,10 @@
package org.onap.so.adapters.appc.orchestrator.client.beans;
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -14,6 +19,8 @@ public class ConfigurationParameters {
private String nodeList;
@JsonProperty("file_parameter_content")
private String fileParameterContent;
+ @JsonIgnore
+ private Map<String, String> additionalProperties = new HashMap<>();
@JsonProperty("vnf_name")
@@ -50,4 +57,18 @@ public class ConfigurationParameters {
this.fileParameterContent = fileParameterContent;
}
+ @JsonAnyGetter
+ public Map<String, String> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, String value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ public void setAdditionalProperties(Map<String, String> map) {
+ this.additionalProperties = map;
+ }
+
}
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
index a174ccb05a..99d6b4dc12 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -32,10 +32,10 @@ public class ApplicationControllerTaskImpl {
Optional<String> vserverId = Optional.empty();
Parameters parameters = new Parameters();
ConfigurationParameters configParams = new ConfigurationParameters();
+ RequestParameters requestParams = new RequestParameters();
switch (request.getAction()) {
case HealthCheck:
- RequestParameters requestParams = new RequestParameters();
requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
parameters.setRequestParameters(requestParams);
payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
@@ -75,6 +75,12 @@ public class ApplicationControllerTaskImpl {
payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
break;
case ConfigModify:
+ requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
+ configParams.setAdditionalProperties(request.getConfigParams());
+ parameters.setRequestParameters(requestParams);
+ parameters.setConfigurationParameters(configParams);
+ payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+ break;
case ConfigScaleOut:
break;
case UpgradePreCheck:
@@ -97,6 +103,7 @@ public class ApplicationControllerTaskImpl {
vserverId = Optional
.of(request.getApplicationControllerVnf().getApplicationControllerVm().getVserverId());
}
+ break;
default:
// errorMessage = "Unable to idenify Action request for AppCClient";
break;
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
index 640e2dbd6e..973430c37e 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
@@ -1,5 +1,7 @@
package org.onap.so.adapters.appc.orchestrator.service;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
@@ -50,6 +52,10 @@ public class ApplicationControllerTaskImplTest {
request.setNewSoftwareVersion("2.0");
request.setExistingSoftwareVersion("1.0");
request.setOperationsTimeout("30");
+ Map<String, String> reqConfigParams = new HashMap<>();
+ reqConfigParams.put("name1", "value1");
+ reqConfigParams.put("name2", "value2");
+ request.setConfigParams(reqConfigParams);
ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf();
applicationControllerVnf.setVnfHostIpAddress("100.100");
applicationControllerVnf.setVnfId("testVnfId");
@@ -228,6 +234,33 @@ public class ApplicationControllerTaskImplTest {
}
@Test
+ public void testExcute_configModify() throws JsonProcessingException, ApplicationControllerOrchestratorException {
+ request.setAction(Action.ConfigModify);
+
+ Parameters parameters = new Parameters();
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setHostIpAddress(request.getApplicationControllerVnf().getVnfHostIpAddress());
+ parameters.setRequestParameters(requestParams);
+ ConfigurationParameters configParams = new ConfigurationParameters();
+ Map<String, String> configParamMap = new HashMap<>();
+ configParamMap.put("name1", "value1");
+ configParamMap.put("name2", "value2");
+ configParams.setAdditionalProperties(configParamMap);
+ parameters.setConfigurationParameters(configParams);
+ Optional<String> payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
+
+ Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
+ request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
+ listener)).thenReturn(new Status());
+
+ Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
+
+ Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
+ request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
+ listener);
+ }
+
+ @Test
public void testListener() throws Exception {
request.setAction(Action.QuiesceTraffic);
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
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 423c1a7ed6..f524b96fa9 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
@@ -216,9 +216,6 @@ public class ToscaResourceInstaller {
protected PnfCustomizationRepository pnfCustomizationRepository;
@Autowired
- protected ServiceInfoRepository serviceInfoRepository;
-
- @Autowired
protected WorkflowResource workflowResource;
@Autowired
@@ -393,7 +390,7 @@ public class ToscaResourceInstaller {
createToscaCsar(toscaResourceStruct);
createService(toscaResourceStruct, vfResourceStruct);
Service service = toscaResourceStruct.getCatalogService();
- ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service);
+ createServiceInfo(toscaResourceStruct, service);
List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct,
EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
@@ -423,9 +420,8 @@ public class ToscaResourceInstaller {
processServiceProxyAndConfiguration(toscaResourceStruct, service);
logger.info("Saving Service: {} ", service.getModelName());
- ServiceInfo serviceResult = serviceInfoRepository.save(serviceInfo);
- Service resultService = serviceResult.getService();
- correlateConfigCustomResources(resultService);
+ service = serviceRepo.save(service);
+ correlateConfigCustomResources(service);
workflowResource.processWorkflows(vfResourceStructure);
@@ -1381,6 +1377,7 @@ public class ToscaResourceInstaller {
service.setServiceType(serviceMetadata.getValue("serviceType"));
service.setServiceRole(serviceMetadata.getValue("serviceRole"));
+ service.setServiceFunction(serviceMetadata.getValue("serviceFunction"));
service.setCategory(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
service.setDescription(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
@@ -2902,9 +2899,9 @@ public class ToscaResourceInstaller {
createToscaCsar(toscaResourceStruct);
createService(toscaResourceStruct, vfResourceStruct);
Service service = toscaResourceStruct.getCatalogService();
- ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service);
+ createServiceInfo(toscaResourceStruct, service);
createServiceArtifact(service, vfResourceStruct, artifactContent);
- serviceInfoRepository.save(serviceInfo);
+ serviceRepo.save(service);
}
private void createServiceArtifact(Service service, VfResourceStructure vfResourceStruct, String artifactContent) {
@@ -2927,16 +2924,19 @@ public class ToscaResourceInstaller {
service.setServiceArtifactList(serviceArtifactList);
}
- private ServiceInfo createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) {
+ private void createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) {
+ List<ServiceInfo> serviceInfos = new ArrayList<>();
+
ServiceInfo serviceInfo = new ServiceInfo();
String serviceInput = getServiceInput(toscaResourceStruct);
serviceInfo.setServiceInput(serviceInput);
String serviceProperties = getServiceProperties(toscaResourceStruct);
serviceInfo.setServiceProperties(serviceProperties);
-
serviceInfo.setService(service);
- return serviceInfo;
+ serviceInfos.add(serviceInfo);
+
+ service.setServiceInfos(serviceInfos);
}
private String getServiceProperties(ToscaResourceStructure toscaResourceStruct) {
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 b8a2d01b49..e4882119ab 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
@@ -343,7 +343,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
doReturn(resourceCustomizationUUID).when(metadata).getValue("vfModuleModelCustomizationUUID");
ServiceRepository serviceRepo = spy(ServiceRepository.class);
- ServiceInfoRepository serviceInfoRepo = spy(ServiceInfoRepository.class);
VnfResourceRepository vnfRepo = spy(VnfResourceRepository.class);
doReturn(null).when(vnfRepo).findResourceByModelUUID(uuid);
@@ -354,7 +353,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
WorkflowResource workflowResource = spy(WorkflowResource.class);
ReflectionTestUtils.setField(toscaInstaller, "serviceRepo", serviceRepo);
- ReflectionTestUtils.setField(toscaInstaller, "serviceInfoRepository", serviceInfoRepo);
ReflectionTestUtils.setField(toscaInstaller, "vnfRepo", vnfRepo);
ReflectionTestUtils.setField(toscaInstaller, "vfModuleRepo", vfModuleRepo);
ReflectionTestUtils.setField(toscaInstaller, "instanceGroupRepo", instanceGroupRepo);
@@ -425,10 +423,7 @@ public class ToscaResourceInstallerTest extends BaseTest {
assertNotNull(service);
service.setModelVersion("1.0");
- ServiceInfo serviceInfo = new ServiceInfo();
- serviceInfo.setService(service);
doReturn(service).when(serviceRepo).save(service);
- doReturn(serviceInfo).when(serviceInfoRepo).save(any(ServiceInfo.class));
WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository =
spy(WatchdogComponentDistributionStatusRepository.class);
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index d051d1a56c..f94f74da97 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -804,6 +804,7 @@ CREATE TABLE `service` (
`TOSCA_CSAR_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
`SERVICE_TYPE` varchar(200) DEFAULT NULL,
`SERVICE_ROLE` varchar(200) DEFAULT NULL,
+ `SERVICE_FUNCTION` varchar(200) DEFAULT NULL,
`ENVIRONMENT_CONTEXT` varchar(200) DEFAULT NULL,
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
@@ -1382,7 +1383,9 @@ CREATE TABLE IF NOT EXISTS `service_info` (
`ID` int (11) AUTO_INCREMENT,
`SERVICE_INPUT` varchar (5000),
`SERVICE_PROPERTIES` varchar (5000),
- PRIMARY KEY (`ID`)
+ `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ CONSTRAINT `fk_service_info_service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `service_artifact`(
@@ -1399,14 +1402,6 @@ CREATE TABLE IF NOT EXISTS `service_artifact`(
CONSTRAINT `fk_service_artifact_service_info1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE IF NOT EXISTS `service_to_service_info` (
- `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
- `SERVICE_INFO_ID` INT (11) NOT NULL,
- PRIMARY KEY (`SERVICE_MODEL_UUID`,`SERVICE_INFO_ID`),
- CONSTRAINT `fk_service_to_service_info__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `fk_service_to_service_info__service_info1` FOREIGN KEY (`SERVICE_INFO_ID`) REFERENCES `service_info` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
-)ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
--------START Request DB SCHEMA --------
CREATE DATABASE requestdb;
USE requestdb;
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index c817874fb6..5d9c1a3acd 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -21,18 +22,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <executions>
- <execution>
- <id>test-compile</id>
- <phase>compile</phase>
- <goals>
- <goal>testCompile</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
+ <version>3.8.0</version>
+ <configuration>
+ <compilerId>groovy-eclipse-compiler</compilerId>
+ </configuration>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <version>3.6.0-03</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-batch</artifactId>
+ <version>2.4.19-01</version>
+ </dependency>
+ </dependencies>
</plugin>
<plugin>
@@ -60,64 +66,6 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.8</version>
- <configuration>
- <additionalProjectnatures>
- <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
- </additionalProjectnatures>
- <sourceIncludes>
- <sourceInclude>**/*.groovy</sourceInclude>
- </sourceIncludes>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>compile</id>
- <phase>compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${basedir}/src/main/groovy" />
- <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
- <classpath refid="maven.compile.classpath" />
- </taskdef>
- <mkdir dir="${project.build.outputDirectory}" />
- <groovyc destdir="${project.build.outputDirectory}" srcdir="${basedir}/src/main/groovy/"
- listfiles="true">
- <classpath refid="maven.compile.classpath" />
- </groovyc>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>test-compile</id>
- <phase>test-compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${basedir}/src/test/groovy" />
- <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
- <classpath refid="maven.test.classpath" />
- </taskdef>
- <mkdir dir="${project.build.testOutputDirectory}" />
- <groovyc destdir="${project.build.testOutputDirectory}" srcdir="${basedir}/src/test/groovy/"
- listfiles="true">
- <classpath refid="maven.test.classpath" />
- </groovyc>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
@@ -161,8 +109,8 @@
</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>
@@ -173,14 +121,14 @@
<pluginExecution>
<pluginExecutionFilter>
<groupId>
- org.apache.maven.plugins
- </groupId>
+ org.apache.maven.plugins
+ </groupId>
<artifactId>
- maven-antrun-plugin
- </artifactId>
+ maven-antrun-plugin
+ </artifactId>
<versionRange>
- [1.3,)
- </versionRange>
+ [1.3,)
+ </versionRange>
<goals>
<goal>run</goal>
</goals>
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 48a8e60095..a86e1de772 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
@@ -89,7 +89,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
}
infraRequest.setLastModifiedBy("BPMN")
infraRequest.setStatusMessage(statusMessage)
- infraRequest.setRequestStatus("COMPLETED")
+ infraRequest.setRequestStatus("COMPLETE")
infraRequest.setProgress(100)
if(utils.nodeExists(xml, "vnfId")){
@@ -104,7 +104,8 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
infraRequest.setVfModuleId(utils.getNodeText(xml, "vfModuleId"))
}else if(utils.nodeExists(xml, "volumeGroupId")){
infraRequest.setVolumeGroupId(utils.getNodeText(xml, "volumeGroupId"))
-
+ }else if(utils.nodeExists(xml, "pnfName")){
+ infraRequest.setPnfName(utils.getNodeText(xml, "pnfName"))
}
dbClient.updateInfraActiveRequests(infraRequest, UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth"), UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint"))
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 b43a153acb..c0124cfd50 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,10 +22,10 @@
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
+import org.onap.aai.domain.yang.GenericVnfs
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
@@ -34,6 +34,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.db.catalog.beans.OrchestrationStatus
import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -151,15 +152,13 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
AAIResourceUri uri
def vnfId = execution.getVariable("CAAIVfMod_vnfId")
def vnfName = execution.getVariable("CAAIVfMod_vnfName")
+ Optional<GenericVnf> genericVnfOp
if (vnfId == null || vnfId.isEmpty()) {
- uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF)
- uri.queryParam("vnf-name", vnfName)
+ genericVnfOp = getAAIClient().getFirst(GenericVnfs.class, GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE))
} else {
- uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ genericVnfOp = getAAIClient().get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
}
- uri.depth(Depth.ONE)
try {
- Optional<GenericVnf> genericVnfOp = getAAIClient().get(GenericVnf.class, uri)
if(genericVnfOp.isPresent()){
execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", 200)
execution.setVariable("CAAIVfMod_queryGenericVnfResponse", genericVnfOp.get())
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 bc330eeafd..b554d7a9ba 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
@@ -35,6 +35,8 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
private String serviceType;
@JsonProperty("service-role")
private String serviceRole;
+ @JsonProperty("service-function")
+ private String serviceFunction;
@JsonProperty("environment-context")
private String environmentContext;
@JsonProperty("workload-context")
@@ -77,6 +79,14 @@ public class ModelInfoServiceInstance extends ModelInfoMetadata implements Seria
this.serviceRole = serviceRole;
}
+ public String getServiceFunction() {
+ return serviceFunction;
+ }
+
+ public void setServiceFunction(String serviceFunction) {
+ this.serviceFunction = serviceFunction;
+ }
+
public String getEnvironmentContext() {
return environmentContext;
}
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 e004e10cf0..85f5f1f728 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
@@ -52,6 +52,7 @@ 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.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
@@ -314,68 +315,24 @@ public class BBInputSetupUtils {
.depth(Depth.TWO)).orElse(null);
}
- protected org.onap.aai.domain.yang.ServiceInstances getAAIServiceInstancesByName(String serviceInstanceName,
- Customer customer) {
-
- return injectionHelper.getAaiClient()
- .get(org.onap.aai.domain.yang.ServiceInstances.class,
- AAIUriFactory
- .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
- customer.getServiceSubscription().getServiceType())
- .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO))
- .orElseGet(() -> {
- logger.debug("No Service Instance matched by name");
- return null;
- });
- }
-
public org.onap.aai.domain.yang.ServiceInstance getAAIServiceInstanceByName(String serviceInstanceName,
Customer customer) throws Exception {
- org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
- org.onap.aai.domain.yang.ServiceInstances aaiServiceInstances = null;
- aaiServiceInstances = getAAIServiceInstancesByName(serviceInstanceName, customer);
-
- if (aaiServiceInstances == null) {
- return null;
- } else if (aaiServiceInstances.getServiceInstance().size() > 1) {
- throw new Exception("Multiple Service Instances Returned");
- } else {
- aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0);
- }
- return aaiServiceInstance;
- }
-
- protected ServiceInstances getAAIServiceInstancesByName(String globalCustomerId, String serviceType,
- String serviceInstanceName) {
+ Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstance =
+ injectionHelper.getAaiClient()
+ .getOne(ServiceInstances.class, org.onap.aai.domain.yang.ServiceInstance.class, AAIUriFactory
+ .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
+ customer.getServiceSubscription().getServiceType())
+ .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO));
- return injectionHelper.getAaiClient()
- .get(ServiceInstances.class,
- AAIUriFactory
- .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType)
- .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO))
- .orElseGet(() -> {
- logger.debug("No Service Instance matched by name");
- return null;
- });
+ return aaiServiceInstance.orElse(null);
}
public Optional<ServiceInstance> getAAIServiceInstanceByName(String globalCustomerId, String serviceType,
- String serviceInstanceName) throws MultipleObjectsFoundException {
- ServiceInstance aaiServiceInstance = null;
- ServiceInstances aaiServiceInstances = null;
- aaiServiceInstances = getAAIServiceInstancesByName(globalCustomerId, serviceType, serviceInstanceName);
+ String serviceInstanceName) {
- if (aaiServiceInstances == null) {
- return Optional.empty();
- } else if (aaiServiceInstances.getServiceInstance().size() > 1) {
- String message = String.format(
- "Multiple service instances found for customer-id: %s, service-type: %s and service-instance-name: %s.",
- globalCustomerId, serviceType, serviceInstanceName);
- throw new MultipleObjectsFoundException(message);
- } else {
- aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0);
- }
- return Optional.of(aaiServiceInstance);
+ return injectionHelper.getAaiClient().getOne(ServiceInstances.class, ServiceInstance.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType)
+ .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO));
}
public org.onap.so.db.catalog.beans.InstanceGroup getCatalogInstanceGroup(String modelUUID) {
@@ -434,8 +391,8 @@ public class BBInputSetupUtils {
public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId)
throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId);
- uri.relatedTo(AAIObjectPlurals.SERVICE_INSTANCE);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)
+ .relatedTo(AAIObjectPlurals.SERVICE_INSTANCE);
Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri);
ServiceInstance serviceInstance = null;
if (!serviceInstances.isPresent()) {
@@ -457,8 +414,8 @@ public class BBInputSetupUtils {
public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName)
throws MultipleObjectsFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
- uri.relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri);
L3Network network = null;
if (!networks.isPresent()) {
@@ -477,100 +434,36 @@ public class BBInputSetupUtils {
}
}
- public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName)
- throws MultipleObjectsFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
- uri.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
- Optional<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri);
- GenericVnf vnf = null;
- if (!vnfs.isPresent()) {
- logger.debug("No Vnfs matched by name");
- return Optional.empty();
- } else {
- if (vnfs.get().getGenericVnf().size() > 1) {
- String message = String.format("Multiple vnfs found for service-instance-id: %s and vnf-name: %s.",
- serviceInstanceId, vnfName);
- throw new MultipleObjectsFoundException(message);
- } else {
- vnf = vnfs.get().getGenericVnf().get(0);
- }
- return Optional.of(vnf);
- }
+ public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName) {
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
+ return injectionHelper.getAaiClient().getOne(GenericVnfs.class, GenericVnf.class, uri);
+
}
- public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName)
- throws MultipleObjectsFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
- Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.debug("No VolumeGroups matched by name");
- return Optional.empty();
- } else {
- if (volumeGroups.get().getVolumeGroup().size() > 1) {
- String message = String.format("Multiple volume-groups found for vnf-id: %s and volume-group-name: %s.",
- vnfId, volumeGroupName);
- throw new MultipleObjectsFoundException(message);
- } else {
- volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- }
- return Optional.of(volumeGroup);
- }
+ public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName) {
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
+ return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
}
public Optional<VolumeGroup> getRelatedVolumeGroupByIdFromVnf(String vnfId, String volumeGroupId) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-id", volumeGroupId);
- Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.debug("No VolumeGroups matched by id");
- return Optional.empty();
- } else {
- volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- return Optional.of(volumeGroup);
- }
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-id", volumeGroupId);
+ return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
}
public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId,
- String volumeGroupName) throws MultipleObjectsFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
- uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
- Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.debug("No VolumeGroups matched by name");
- return Optional.empty();
- } else {
- if (volumeGroups.get().getVolumeGroup().size() > 1) {
- String message = String.format(
- "Multiple voulme-groups found for vnf-id: %s, vf-module-id: %s and volume-group-name: %s.",
- vnfId, vfModuleId, volumeGroupName);
- throw new MultipleObjectsFoundException(message);
- } else {
- volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- }
- return Optional.of(volumeGroup);
- }
+ String volumeGroupName) throws Exception {
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
+ return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
}
public Optional<VolumeGroup> getRelatedVolumeGroupFromVfModule(String vnfId, String vfModuleId) throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
- uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP);
- Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.debug("VfModule does not have a volume group attached");
- return Optional.empty();
- } else {
- if (volumeGroups.get().getVolumeGroup().size() > 1) {
- throw new Exception("Multiple VolumeGroups Returned");
- } else {
- volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- }
- return Optional.of(volumeGroup);
- }
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+ return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
}
public Optional<org.onap.aai.domain.yang.VpnBinding> getAICVpnBindingFromNetwork(
@@ -598,26 +491,26 @@ public class BBInputSetupUtils {
public boolean existsAAINetworksGloballyByName(String networkName) {
- AAIResourceUri l3networkUri =
+ AAIPluralResourceUri l3networkUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
return aaiRC.exists(l3networkUri);
}
public boolean existsAAIVfModuleGloballyByName(String vfModuleName) {
- AAIResourceUri vfModuleUri =
+ AAIPluralResourceUri vfModuleUri =
AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", vfModuleName);
return injectionHelper.getAaiClient().exists(vfModuleUri);
}
public boolean existsAAIConfigurationGloballyByName(String configurationName) {
- AAIResourceUri configUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ AAIPluralResourceUri configUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
.queryParam("configuration-name", configurationName);
return injectionHelper.getAaiClient().exists(configUri);
}
public boolean existsAAIVolumeGroupGloballyByName(String volumeGroupName) {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", volumeGroupName);
return injectionHelper.getAaiClient().exists(volumeGroupUri);
}
@@ -634,24 +527,9 @@ public class BBInputSetupUtils {
}
public Optional<Configuration> getRelatedConfigurationByNameFromServiceInstance(String serviceInstanceId,
- String configurationName) throws MultipleObjectsFoundException {
- 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) {
- String message = String.format(
- "Multiple configurations found for service-instance-d: %s and configuration-name: %s.",
- serviceInstanceId, configurationName);
- throw new MultipleObjectsFoundException(message);
- } else {
- configuration = configurations.get().getConfiguration().get(0);
- }
- return Optional.of(configuration);
- }
+ String configurationName) {
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.CONFIGURATION).queryParam("configuration-name", configurationName);
+ return injectionHelper.getAaiClient().getOne(Configurations.class, Configuration.class, uri);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java
index 0f17c547b5..333bf80d6c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java
@@ -48,8 +48,6 @@ public class SDNCLcmClientBuilder {
try {
String path = sdncLcmProperties.getPath() + operation;
pathUri = new URI(path);
- logger.debug("SDNC host: " + sdncLcmProperties.getHost());
- logger.debug("SDNC API path: " + pathUri.getPath());
} catch (Exception e) {
String msg = "Error API path syntax: ";
logger.error(msg, e);
@@ -57,9 +55,7 @@ public class SDNCLcmClientBuilder {
}
try {
- SDNCLcmRestClient sdncLcmRestClient = new SDNCLcmRestClient(sdncLcmProperties, pathUri);
- logger.debug("Create SDNCLcmRestClient success");
- return sdncLcmRestClient;
+ return new SDNCLcmRestClient(sdncLcmProperties, pathUri);
} catch (Exception e) {
String msg = "Create SDNCLcmRestClient failure: ";
logger.error(msg, e);
@@ -69,9 +65,7 @@ public class SDNCLcmClientBuilder {
public SDNCLcmDmaapClient newSDNCLcmDmaapClient() throws SDNCLcmClientBuilderException {
try {
- SDNCLcmDmaapClient sdncLcmDmaapClient = new SDNCLcmDmaapClient(sdncLcmProperties);
- logger.debug("Create SDNCLcmDmaapClient success");
- return sdncLcmDmaapClient;
+ return new SDNCLcmDmaapClient(sdncLcmProperties);
} catch (Exception e) {
String msg = "Create SDNCLcmDmaapClient failure: ";
logger.error(msg, e);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java
index bf1229a310..4ea6850e47 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java
@@ -26,7 +26,7 @@ import org.onap.so.client.sdnc.lcm.beans.*;
public class SDNCLcmMessageBuilder {
- public static LcmFlags getSDNCFlags() {
+ public static LcmFlags buildLcmFlags() {
LcmFlags lcmFlags = new LcmFlags();
lcmFlags.setMode(SDNCConstants.LCM_FLAGS_MODE_NORMAL);
@@ -43,7 +43,7 @@ public class SDNCLcmMessageBuilder {
lcmCommonHeader.setOriginatorId(SDNCConstants.SYSTEM_NAME);
lcmCommonHeader.setRequestId(requestId);
lcmCommonHeader.setSubRequestId(subRequestId);
- lcmCommonHeader.setFlags(getSDNCFlags());
+ lcmCommonHeader.setFlags(buildLcmFlags());
lcmCommonHeader.setTimestamp(Instant.now().toString());
return lcmCommonHeader;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java
index 36527ec887..55e0ea3e5d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java
@@ -35,7 +35,7 @@ public class LcmFlags {
private String force;
@JsonProperty("ttl")
- private int ttl;
+ private Integer ttl;
public String getMode() {
return mode;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java
index 8a2a142792..3bbafcaaa4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java
@@ -29,16 +29,16 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
public class LcmStatus {
@JsonProperty(value = "code", required = true)
- private int code;
+ private Integer code;
@JsonProperty(value = "message", required = true)
private String message;
- public int getCode() {
+ public Integer getCode() {
return code;
}
- public void setCode(int value) {
+ public void setCode(Integer value) {
this.code = value;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java
index 1a3529d7c4..05de9b1c90 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java
@@ -32,7 +32,7 @@ public class SwToBeDownloadedElement {
private String swLocation;
@JsonProperty(value = "swFileSize")
- private long swFileSize;
+ private Long swFileSize;
@JsonProperty(value = "swFileCompression")
private String swFileCompression;
@@ -48,11 +48,11 @@ public class SwToBeDownloadedElement {
this.swLocation = value;
}
- public long getSwFileSize() {
+ public Long getSwFileSize() {
return swFileSize;
}
- public void setSwFileSize(long value) {
+ public void setSwFileSize(Long value) {
this.swFileSize = value;
}
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 525307a5df..59b34c4074 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
@@ -37,6 +37,7 @@ 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.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
@@ -118,8 +119,8 @@ abstract class MsoGroovyTest {
}
protected Optional<GenericVnf> mockAAIGenericVnfByName(String vnfName){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
+ AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
+ AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnf.json");
when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf)
when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf)
@@ -134,8 +135,8 @@ abstract class MsoGroovyTest {
}
protected void mockAAIGenericVnfByNameNotFound(String vnfName){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
+ AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
+ AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty())
when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty())
}
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 fcc59c3340..64e1b40739 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
@@ -74,6 +74,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceF
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
@@ -317,38 +318,14 @@ public class BBInputSetupUtilsTest {
ServiceInstances serviceInstances = new ServiceInstances();
serviceInstances.getServiceInstance().add(expectedServiceInstance);
- doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class),
- isA(AAIResourceUri.class));
-
- assertThat(bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer),
- sameBeanAs(serviceInstances.getServiceInstance().get(0)));
- }
-
- @Test
- public void getAAIServiceInstanceByNameExceptionTest() throws Exception {
- final String serviceInstanceName = "serviceInstanceName";
-
- expectedException.expect(Exception.class);
- expectedException.expectMessage("Multiple Service Instances Returned");
-
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("serviceInstanceId");
-
- ServiceSubscription serviceSubscription = new ServiceSubscription();
- serviceSubscription.setServiceType("serviceType");
-
- Customer customer = new Customer();
- customer.setGlobalCustomerId("globalCustomerId");
- customer.setServiceSubscription(serviceSubscription);
-
- ServiceInstances serviceInstances = new ServiceInstances();
- serviceInstances.getServiceInstance().add(serviceInstance);
- serviceInstances.getServiceInstance().add(serviceInstance);
-
- doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class),
- isA(AAIResourceUri.class));
-
+ AAIPluralResourceUri expectedUri = AAIUriFactory
+ .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
+ customer.getServiceSubscription().getServiceType())
+ .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO);
bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer);
+
+ verify(MOCK_aaiResourcesClient, times(1)).getOne(org.onap.aai.domain.yang.ServiceInstances.class,
+ org.onap.aai.domain.yang.ServiceInstance.class, expectedUri);
}
@Test
@@ -360,30 +337,6 @@ public class BBInputSetupUtilsTest {
}
@Test
- public void getOptionalAAIServiceInstanceByNameExceptionTest() throws Exception {
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(containsString(
- "Multiple service instances found for customer-id: globalCustomerId, service-type: serviceType and service-instance-name: serviceInstanceId."));
-
- final String globalCustomerId = "globalCustomerId";
- final String serviceType = "serviceType";
- final String serviceInstanceId = "serviceInstanceId";
-
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId(serviceInstanceId);
- serviceInstance.setServiceType(serviceType);
-
- ServiceInstances serviceInstances = new ServiceInstances();
- serviceInstances.getServiceInstance().add(serviceInstance);
- serviceInstances.getServiceInstance().add(serviceInstance);
-
- doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class),
- isA(AAIResourceUri.class));
-
- bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, serviceInstanceId);
- }
-
- @Test
public void getOptionalAAIServiceInstanceByNameNullTest() throws Exception {
Optional<ServiceInstance> actual = bbInputSetupUtils.getAAIServiceInstanceByName("", "", "");
@@ -487,8 +440,7 @@ public class BBInputSetupUtilsTest {
network.setNetworkId(networkId);
network.setNetworkName(networkName);
expected.get().getL3Network().add(network);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class));
+ doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIPluralResourceUri.class));
Optional<L3Network> actual =
bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(networkId, networkName);
@@ -499,31 +451,17 @@ public class BBInputSetupUtilsTest {
}
@Test
- public void getRelatedNetworkByNameFromServiceInstanceMultipleNetworksExceptionTest() throws Exception {
- final String serviceInstanceId = "serviceInstanceId";
- final String networkName = "networkName";
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(
- String.format("Multiple networks found for service-instance-id: %s and network-name: %s.",
- serviceInstanceId, networkName));
-
- L3Network network = new L3Network();
- network.setNetworkId("id123");
- network.setNetworkName("name123");
-
- L3Networks l3Networks = new L3Networks();
- l3Networks.getL3Network().add(network);
- l3Networks.getL3Network().add(network);
- Optional<L3Networks> optNetworks = Optional.of(l3Networks);
+ public void getRelatedNetworkByNameFromServiceInstanceNotFoundTest() throws Exception {
+ String serviceInstanceId = "serviceInstanceId";
+ String networkName = "networkName";
- doReturn(optNetworks).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class),
+ any(AAIPluralResourceUri.class));
- bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName);
- }
+ Optional<L3Network> actualNetwork =
+ bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName);
- @Test
- public void getRelatedNetworkByNameFromServiceInstanceNotFoundTest() throws Exception {
- assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance("", ""));
+ assertEquals(Optional.empty(), actualNetwork);
}
@Test
@@ -534,7 +472,8 @@ public class BBInputSetupUtilsTest {
serviceInstance.setServiceInstanceName("serviceInstanceName");
expected.get().getServiceInstance().add(serviceInstance);
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class));
+ doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class),
+ any(AAIPluralResourceUri.class));
Optional<ServiceInstance> actual = this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
assertTrue(actual.isPresent());
@@ -546,9 +485,6 @@ public class BBInputSetupUtilsTest {
public void getRelatedServiceInstanceFromInstanceGroupMultipleExceptionTest() throws Exception {
final String instanceGroupId = "ig-001";
expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(
- String.format("Mulitple service instances were found for instance-group-id: %s.", instanceGroupId));
-
Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
ServiceInstance si1 = Mockito.mock(ServiceInstance.class);
ServiceInstance si2 = Mockito.mock(ServiceInstance.class);
@@ -556,60 +492,35 @@ public class BBInputSetupUtilsTest {
serviceInstances.get().getServiceInstance().add(si2);
doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class),
- any(AAIResourceUri.class));
- bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
+ any(AAIPluralResourceUri.class));
+ this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
}
@Test
public void getRelatedServiceInstanceFromInstanceGroupNotFoundExceptionTest() throws Exception {
expectedException.expect(NoServiceInstanceFoundException.class);
- expectedException.expectMessage("No ServiceInstances Returned");
-
Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class),
- any(AAIResourceUri.class));
- bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
+ any(AAIPluralResourceUri.class));
+ this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
}
@Test
public void getRelatedVnfByNameFromServiceInstanceTest() throws Exception {
final String vnfId = "id123";
final String vnfName = "name123";
-
- Optional<GenericVnfs> expected = Optional.of(new GenericVnfs());
+ final String serviceInstanceId = "service-instance-id123";
GenericVnf vnf = new GenericVnf();
vnf.setVnfId(vnfId);
vnf.setVnfName(vnfName);
- expected.get().getGenericVnf().add(vnf);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class));
- Optional<GenericVnf> actual = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(vnfId, vnfName);
-
+ doReturn(Optional.of(vnf)).when(MOCK_aaiResourcesClient).getOne(GenericVnfs.class, GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName));
+ Optional<GenericVnf> actual =
+ this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName);
assertTrue(actual.isPresent());
- assertEquals(expected.get().getGenericVnf().get(0).getVnfId(), actual.get().getVnfId());
- }
-
- @Test
- public void getRelatedVnfByNameFromServiceInstanceMultipleVnfsExceptionTest() throws Exception {
- final String serviceInstanceId = "serviceInstanceId";
- final String vnfName = "vnfName";
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(String.format(
- "Multiple vnfs found for service-instance-id: %s and vnf-name: %s.", serviceInstanceId, vnfName));
-
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("id123");
- vnf.setVnfName("name123");
-
- GenericVnfs vnfs = new GenericVnfs();
- vnfs.getGenericVnf().add(vnf);
- vnfs.getGenericVnf().add(vnf);
-
- Optional<GenericVnfs> optVnfs = Optional.of(vnfs);
- doReturn(optVnfs).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class));
-
- bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName);
+ assertEquals(vnf.getVnfId(), actual.get().getVnfId());
}
@Test
@@ -617,69 +528,56 @@ public class BBInputSetupUtilsTest {
final String serviceInstanceId = "serviceInstanceId";
final String vnfName = "vnfName";
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(GenericVnfs.class), eq(GenericVnf.class),
+ any(AAIPluralResourceUri.class));
+
assertEquals(Optional.empty(),
bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName));
}
@Test
public void getRelatedVolumeGroupByNameFromVnfTest() throws Exception {
- final String vnfId = "id123";
- final String vnfName = "name123";
-
- Optional<VolumeGroups> expected = Optional.of(new VolumeGroups());
+ final String vnfId = "vnf-id123";
+ final String volumeGroupId = "id123";
+ final String volumeGroupName = "volume-group-name123";
VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId(vnfId);
- volumeGroup.setVolumeGroupName(vnfName);
- expected.get().getVolumeGroup().add(volumeGroup);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
- Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, vnfName);
-
- assertTrue(actual.isPresent());
- assertEquals(expected.get().getVolumeGroup().get(0).getVolumeGroupId(), actual.get().getVolumeGroupId());
+ volumeGroup.setVolumeGroupId(volumeGroupId);
+ volumeGroup.setVolumeGroupName(volumeGroupName);
+ doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName));
+ Optional<VolumeGroup> actual =
+ this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
+ assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId());
}
@Test
- public void getRelatedVolumeGroupByNameFromVnfMultipleVolumeGroupsExceptionTest() throws Exception {
- final String vnfId = "vnfId";
- final String volumeGroupName = "volumeGroupName";
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(String.format(
- "Multiple volume-groups found for vnf-id: %s and volume-group-name: %s.", vnfId, volumeGroupName));
-
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId("id123");
- volumeGroup.setVolumeGroupName("name123");
+ public void getRelatedVolumeGroupByNameFromVnfNotFoundTest() throws Exception {
+ String vnfId = "vnfId";
+ String volumeGroupName = "volumeGroupName";
- VolumeGroups volumeGroups = new VolumeGroups();
- volumeGroups.getVolumeGroup().add(volumeGroup);
- volumeGroups.getVolumeGroup().add(volumeGroup);
- Optional<VolumeGroups> optVolumeGroups = Optional.of(volumeGroups);
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(VolumeGroups.class), eq(VolumeGroup.class),
+ any(AAIPluralResourceUri.class));
- doReturn(optVolumeGroups).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
+ Optional<VolumeGroup> actualVolumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
- bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
- }
-
- @Test
- public void getRelatedVolumeGroupByNameFromVnfNotFoundTest() throws Exception {
- assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf("", ""));
+ assertEquals(Optional.empty(), actualVolumeGroup);
}
@Test
public void getRelatedVolumeGroupByNameFromVfModuleTest() throws Exception {
- Optional<VolumeGroups> expected = Optional.of(new VolumeGroups());
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("id123");
volumeGroup.setVolumeGroupName("name123");
- expected.get().getVolumeGroup().add(volumeGroup);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
- Optional<VolumeGroup> actual =
- this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123", "name123");
-
+ doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123")
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP)
+ .queryParam("volume-group-name", "volume-group-name123"));
+ Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("vnf-id123",
+ "vf-module-id123", "volume-group-name123");
assertTrue(actual.isPresent());
- assertEquals(expected.get().getVolumeGroup().get(0).getVolumeGroupId(), actual.get().getVolumeGroupId());
+ assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId());
}
@Test
@@ -707,51 +605,41 @@ public class BBInputSetupUtilsTest {
final String vnfId = "vnfId";
final String volumeGroupId = "volumeGroupId";
- assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(VolumeGroups.class), eq(VolumeGroup.class),
+ any(AAIPluralResourceUri.class));
+
+ Optional<VolumeGroup> actualVolumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId);
+
+ assertEquals(Optional.empty(), actualVolumeGroup);
}
@Test
public void getRelatedVolumeGroupFromVfModuleTest() throws Exception {
- Optional<VolumeGroups> expected = Optional.of(new VolumeGroups());
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("id123");
- expected.get().getVolumeGroup().add(volumeGroup);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
- Optional<VolumeGroup> actual = bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("id123", "id123");
-
+ doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123")
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP));
+ Optional<VolumeGroup> actual =
+ this.bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("vnf-id123", "vf-module-id123");
assertTrue(actual.isPresent());
- assertEquals(expected.get().getVolumeGroup().get(0).getVolumeGroupId(), actual.get().getVolumeGroupId());
+ assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId());
}
@Test
- public void getRelatedVolumeGroupByNameFromVfModuleMultipleVolumeGroupsExceptionTest() throws Exception {
- final String vnfId = "vnfId";
- final String vfModuleId = "vfModuleId";
- final String volumeGroupName = "volumeGroupName";
-
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(String.format(
- "Multiple voulme-groups found for vnf-id: %s, vf-module-id: %s and volume-group-name: %s.", vnfId,
- vfModuleId, volumeGroupName));
-
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId("id123");
- volumeGroup.setVolumeGroupName("name123");
-
- VolumeGroups volumeGroups = new VolumeGroups();
- volumeGroups.getVolumeGroup().add(volumeGroup);
- volumeGroups.getVolumeGroup().add(volumeGroup);
+ public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception {
+ String vnfId = "vnfId";
+ String volumeGroupId = "volumeGroupId";
+ String volumeGroupName = "volumeGroupName";
- Optional<VolumeGroups> optVolumeGroups = Optional.of(volumeGroups);
- doReturn(optVolumeGroups).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(VolumeGroups.class), eq(VolumeGroup.class),
+ any(AAIPluralResourceUri.class));
- bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, vfModuleId, volumeGroupName);
- }
+ Optional<VolumeGroup> actualVolumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName);
- @Test
- public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception {
- assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("", "", ""));
+ assertEquals(Optional.empty(), actualVolumeGroup);
}
@Test
@@ -780,46 +668,28 @@ public class BBInputSetupUtilsTest {
}
@Test
- public void getRelatedConfigurationByNameFromServiceInstanceExceptionTest() throws Exception {
- Configuration configuration = new Configuration();
- configuration.setConfigurationId("id123");
-
- Configurations configurations = new Configurations();
- configurations.getConfiguration().add(configuration);
- configurations.getConfiguration().add(configuration);
-
- Optional<Configurations> optConfigurations = Optional.of(configurations);
-
- doReturn(optConfigurations).when(MOCK_aaiResourcesClient).get(eq(Configurations.class),
- any(AAIResourceUri.class));
-
- expectedException.expect(MultipleObjectsFoundException.class);
- this.bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("id123", "name123");
- }
-
- @Test
public void getRelatedConfigurationByNameFromServiceInstanceNotFoundTest() throws Exception {
assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("", ""));
}
@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");
-
+ doReturn(Optional.of(configuration)).when(MOCK_aaiResourcesClient).getOne(Configurations.class,
+ Configuration.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "service-instance-id123")
+ .relatedTo(AAIObjectPlurals.CONFIGURATION)
+ .queryParam("configuration-name", "configuration-name123"));
+ Optional<Configuration> actual = this.bbInputSetupUtils
+ .getRelatedConfigurationByNameFromServiceInstance("service-instance-id123", "configuration-name123");
assertTrue(actual.isPresent());
- assertEquals(expected.get().getConfiguration().get(0).getConfigurationId(), actual.get().getConfigurationId());
+ assertEquals(configuration.getConfigurationId(), actual.get().getConfigurationId());
}
@Test
public void existsAAIVfModuleGloballyByNameTest() {
- AAIResourceUri expectedUri =
+ AAIPluralResourceUri expectedUri =
AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", "testVfModule");
bbInputSetupUtils.existsAAIVfModuleGloballyByName("testVfModule");
@@ -828,7 +698,7 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAIConfigurationGloballyByNameTest() {
- AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ AAIPluralResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
.queryParam("configuration-name", "testConfig");
bbInputSetupUtils.existsAAIConfigurationGloballyByName("testConfig");
@@ -837,7 +707,7 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAINetworksGloballyByNameTest() {
- AAIResourceUri expectedUri =
+ AAIPluralResourceUri expectedUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "testNetwork");
bbInputSetupUtils.existsAAINetworksGloballyByName("testNetwork");
@@ -846,7 +716,7 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAIVolumeGroupGloballyByNameTest() {
- AAIResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", "testVoumeGroup");
bbInputSetupUtils.existsAAIVolumeGroupGloballyByName("testVoumeGroup");
@@ -860,7 +730,7 @@ public class BBInputSetupUtilsTest {
bbInputSetupUtils.updateInfraActiveRequestVnfId(infraActiveRequests, vnfId);
- assertEquals(infraActiveRequests.getVnfId(), vnfId);
+ assertEquals(vnfId, infraActiveRequests.getVnfId());
}
@Test
@@ -870,7 +740,7 @@ public class BBInputSetupUtilsTest {
bbInputSetupUtils.updateInfraActiveRequestVfModuleId(infraActiveRequests, vfModuleId);
- assertEquals(infraActiveRequests.getVfModuleId(), vfModuleId);
+ assertEquals(vfModuleId, infraActiveRequests.getVfModuleId());
}
@Test
@@ -880,7 +750,7 @@ public class BBInputSetupUtilsTest {
bbInputSetupUtils.updateInfraActiveRequestVolumeGroupId(infraActiveRequests, volumeGroupId);
- assertEquals(infraActiveRequests.getVolumeGroupId(), volumeGroupId);
+ assertEquals(volumeGroupId, infraActiveRequests.getVolumeGroupId());
}
@Test
@@ -890,7 +760,7 @@ public class BBInputSetupUtilsTest {
bbInputSetupUtils.updateInfraActiveRequestNetworkId(infraActiveRequests, networkId);
- assertEquals(infraActiveRequests.getNetworkId(), networkId);
+ assertEquals(networkId, infraActiveRequests.getNetworkId());
}
@Test
@@ -921,14 +791,14 @@ public class BBInputSetupUtilsTest {
mapper.readValue(new File(RESOURCE_PATH + "aaiL3NetworkInputWithSubnets.json"), L3Network.class);
Optional<VpnBinding> actual = bbInputSetupUtils.getAICVpnBindingFromNetwork(l3Network);
- assertEquals(actual, Optional.empty());
+ assertEquals(Optional.empty(), actual);
}
@Test
public void getAAIServiceInstancesGloballyByName_noAAIResourceTest() {
final String serviceInstanceName = "serviceInstanceName";
- doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIPluralResourceUri.class));
ServiceInstances actualServiceInstances =
bbInputSetupUtils.getAAIServiceInstancesGloballyByName(serviceInstanceName);
@@ -939,7 +809,7 @@ public class BBInputSetupUtilsTest {
public void getAAIVnfsGloballyByName_noAAIResourceTest() {
final String vnfName = "vnfName";
- doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIPluralResourceUri.class));
GenericVnfs actualGenericVnfs = bbInputSetupUtils.getAAIVnfsGloballyByName(vnfName);
assertNull(actualGenericVnfs);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java
index f9fa679790..b99d45ae52 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java
@@ -37,7 +37,7 @@ public class DownloadNESwPayloadTest extends LcmBasePayloadTest {
SwToBeDownloadedElement swToBeDownloadedElement = new SwToBeDownloadedElement();
swToBeDownloadedElement.setSwLocation("http://192.168.1.20/test.zip");
- swToBeDownloadedElement.setSwFileSize(123456);
+ swToBeDownloadedElement.setSwFileSize(123456L);
swToBeDownloadedElement.setSwFileCompression("ZIP");
swToBeDownloadedElement.setSwFileFormat("binary");
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 3632d187c9..70c78472ba 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
@@ -23,10 +23,6 @@
package org.onap.so.bpmn.core.domain;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@@ -35,6 +31,10 @@ import org.onap.so.bpmn.core.json.DecomposeJsonUtil;
import org.onap.so.bpmn.core.json.JsonDecomposingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
@@ -71,6 +71,10 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
private List<AllottedResource> allottedResources;
@JsonProperty("configResource")
private List<ConfigResource> configResources;
+ @JsonProperty("serviceInfo")
+ private ServiceInfo serviceInfo;
+ @JsonProperty("serviceProxy")
+ private List<ServiceProxy> serviceProxy;
public ServiceDecomposition() {
super();
@@ -85,6 +89,8 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.serviceRole = serviceDecomposition.getServiceRole();
this.serviceType = serviceDecomposition.getServiceType();
this.configResources = serviceDecomposition.getConfigResources();
+ this.serviceProxy = serviceDecomposition.getServiceProxy();
+ this.serviceInfo = serviceDecomposition.getServiceInfo();
}
/**
@@ -109,11 +115,13 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.project = serviceDecomposition.getProject();
this.owningEntity = serviceDecomposition.getOwningEntity();
+ this.serviceProxy = serviceDecomposition.getServiceProxy();
+ this.serviceInfo = serviceDecomposition.getServiceInfo();
}
/**
* Constructor taking a Service Decomposition JSON serialization
- *
+ *
* @param catalogRestOutput
* @param serviceInstanceId
*/
@@ -128,7 +136,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
* Return just the service model portion of the Service Decomposition as a Java object. The service model object
* should support retrieval as JSON string that is formatted correctly for sending serviceModelInfo to Building
* Blocks.
- *
+ *
* @return
*/
public ModelInfo getModelInfo() {
@@ -235,6 +243,22 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.sdncVersion = sdncVersion;
}
+ public ServiceInfo getServiceInfo() {
+ return serviceInfo;
+ }
+
+ public void setServiceInfo(ServiceInfo serviceInfo) {
+ this.serviceInfo = serviceInfo;
+ }
+
+ public List<ServiceProxy> getServiceProxy() {
+ return serviceProxy;
+ }
+
+ public void setServiceProxy(List<ServiceProxy> serviceProxy) {
+ this.serviceProxy = serviceProxy;
+ }
+
// *****
// *****
@@ -243,7 +267,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* This method returns one combined list of Resources of All Types
- *
+ *
* @return
*/
@JsonIgnore
@@ -275,7 +299,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all Network Resource structures (i.e. the serialized NetworkDecomposition objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -285,7 +309,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all VnfResource structures (i.e. the serialized VnfResource objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -295,7 +319,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all Allotted Resource structures (i.e. the serialized AllottedResource objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -305,7 +329,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Returns a JSON list of all Config Resource structures (i.e. the serialized ConfigResource objects).
- *
+ *
* @return
*/
@JsonIgnore
@@ -328,7 +352,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
// Methods to add Resource to the list
/**
* Add VNF resource to the list
- *
+ *
* @param vnfResource
*/
public void addVnfResource(Resource vnfResource) {
@@ -340,7 +364,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add Network resource to the list
- *
+ *
* @param networkResource
*/
public void addNetworkResource(Resource networkResource) {
@@ -352,7 +376,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add Allotted resource to the list
- *
+ *
* @param allottedResource
*/
public void addAllottedResource(Resource allottedResource) {
@@ -364,7 +388,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add Config resource to the list
- *
+ *
* @param allottedResource
*/
public void addConfigResource(Resource configResource) {
@@ -378,7 +402,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
* Add resource to the list Given a ResourceDecomposition (subclass) object, add it to the Service Decomposition (in
* the appropriate category, e.g. as a VNF, Network, or Allotted Resource). As dependencies are not currently
* supported, add it to the end of any ordered lists.
- *
+ *
* @param resource
*/
public void addResource(Resource resource) {
@@ -403,7 +427,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param jsonResource
*/
public void addVnfResource(String jsonResource) throws JsonDecomposingException {
@@ -414,7 +438,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param jsonResource
*/
public void addNetworkResource(String jsonResource) throws JsonDecomposingException {
@@ -425,7 +449,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param Resource
*/
public void addAllottedResource(String jsonResource) throws JsonDecomposingException {
@@ -436,7 +460,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Add resource to the list
- *
+ *
* @param Resource
*/
public void addConfigResource(String jsonResource) throws JsonDecomposingException {
@@ -449,7 +473,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
* Given a ResourceDecomposition (subclass) object, locate it in the Service Decomposition by its unique ID, and
* replace the current version with the new one. This method should support concurrency control via an
* auto-incrementing field in the ResourceDecomposition class.
- *
+ *
* @param newResource
* @return TRUE if replacement was a success
*/
@@ -474,7 +498,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Given a ResourceDecomposition as a JSON string, locate it in the Service Decomposition by its unique ID, and
* replace the current version with the new one.
- *
+ *
* @param jsonString
* @return
*/
@@ -485,7 +509,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Given a resource object ID, locate it in the Service Decomposition by its unique ID, and delete it.
- *
+ *
* @param resource
* @return TRUE if delete was a success
*/
@@ -503,7 +527,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Generic method to get List of Resource objects based on input resource's resourceType
- *
+ *
* @param resource
* @return List matching the resourceType of resource
*/
@@ -530,7 +554,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
/**
* Generic method to set List of ResourceDecomposition objects
- *
+ *
* @param resources
* @return
*/
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 29fc4e93fc..506088eb15 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,16 +24,16 @@ 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;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.repository.DeploymentBuilder;
+import org.onap.logging.filter.spring.MDCTaskDecorator;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.db.catalog.beans.Workflow;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.logging.filter.spring.MDCTaskDecorator;;
+import org.onap.so.logger.LoggingAnchor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/bpmn/pom.xml b/bpmn/pom.xml
index 6b81bab4df..e680cb025c 100644
--- a/bpmn/pom.xml
+++ b/bpmn/pom.xml
@@ -25,7 +25,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sdnc.northbound.version>1.5.2</sdnc.northbound.version>
- <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
+ <appc.client.version>1.7.1-SNAPSHOT</appc.client.version>
</properties>
<modules>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn
new file mode 100644
index 0000000000..d77b1cebb1
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFConfigModifyActivity.bpmn
@@ -0,0 +1,67 @@
+<?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="VNFConfigModifyActivity" name="VNFConfigModifyActivity" isExecutable="true">
+ <bpmn:startEvent id="Start_VNFConfigModifyActivity" name="Start">
+ <bpmn:outgoing>SequenceFlow_0d87xrn</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="ConfigModify" name="VNF Config Modify&#10;" camunda:type="external" camunda:topic="AppcService">
+ <bpmn:incoming>SequenceFlow_05oatn2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1pg83wr</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0d87xrn" sourceRef="Start_VNFConfigModifyActivity" targetRef="PreProcessActivity" />
+ <bpmn:endEvent id="End_VNFConfigModifyActivity" name="End">
+ <bpmn:incoming>SequenceFlow_1pg83wr</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1pg83wr" sourceRef="ConfigModify" targetRef="End_VNFConfigModifyActivity" />
+ <bpmn:serviceTask id="PreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcOrchestratorPreProcessor.buildAppcTaskRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),&#34;ConfigModify&#34;)}">
+ <bpmn:incoming>SequenceFlow_0d87xrn</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05oatn2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05oatn2" sourceRef="PreProcessActivity" targetRef="ConfigModify" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFConfigModifyActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_VNFConfigModifyActivity">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="179" y="138" width="25" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1q3bjtz_di" bpmnElement="ConfigModify">
+ <dc:Bounds x="532" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0d87xrn_di" bpmnElement="SequenceFlow_0d87xrn">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="257" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="257" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="304" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="272" y="114" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_15t8iwk_di" bpmnElement="End_VNFConfigModifyActivity">
+ <dc:Bounds x="756" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="764" y="142" width="20" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1pg83wr_di" bpmnElement="SequenceFlow_1pg83wr">
+ <di:waypoint xsi:type="dc:Point" x="632" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="756" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="694" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0h60lbz_di" bpmnElement="PreProcessActivity">
+ <dc:Bounds x="308" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05oatn2_di" bpmnElement="SequenceFlow_05oatn2">
+ <di:waypoint xsi:type="dc:Point" x="408" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="532" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="470" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java
new file mode 100644
index 0000000000..99ee8d9fcb
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFConfigModifyActivityTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+import java.util.List;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.externaltask.LockedExternalTask;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFConfigModifyActivityTest extends BaseBPMNTest {
+ @Test
+ public void sunnyDayVNFConfigModifyActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables);
+ assertThat(pi).isNotNull();
+ processExternalTasks(pi, "ConfigModify");
+ assertThat(pi).isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity",
+ "ConfigModify", "End_VNFConfigModifyActivity");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFConfigModifyActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcOrchestratorPreProcessor)
+ .buildAppcTaskRequest(any(BuildingBlockExecution.class), any(String.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFConfigModifyActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_VNFConfigModifyActivity", "PreProcessActivity")
+ .hasNotPassed("ConfigModify", "End_VNFConfigModifyActivity");
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 0df3fbe704..1a4e9c6ee8 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -18,51 +18,6 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.8</version>
- <configuration>
- <additionalProjectnatures>
- <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
- </additionalProjectnatures>
- <sourceIncludes>
- <sourceInclude>**/*.groovy</sourceInclude>
- </sourceIncludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.5</version>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.gmaven.runtime</groupId>
- <artifactId>gmaven-runtime-2.0</artifactId>
- <version>1.5</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>${groovy.version}</version>
- </dependency>
- </dependencies>
- <configuration>
- <debug>false</debug>
- <verbose>true</verbose>
- <stacktrace>true</stacktrace>
- <defaultScriptExtension>.groovy</defaultScriptExtension>
- <providerSelection>2.0</providerSelection>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>testCompile</goal>
- <goal>compile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
@@ -77,41 +32,30 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <compilerId>groovy-eclipse-compiler</compilerId>
+ </configuration>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <version>3.6.0-03</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-batch</artifactId>
+ <version>2.4.19-01</version>
+ </dependency>
+ </dependencies>
+ </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. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.apache.maven.plugins
- </groupId>
- <artifactId>
- maven-antrun-plugin
- </artifactId>
- <versionRange>
- [1.3,)
- </versionRange>
- <goals>
- <goal>run</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
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 8b9726c2b7..7d1bc4c779 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
@@ -127,11 +127,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String key = iterator.next()
HashMap<String, String> hashMap = new HashMap()
hashMap.put("name", key)
- if(jsonObject.get(key)==null){
- hashMap.put("value", "")
- }else{
- hashMap.put("value", jsonObject.get(key))
- }
+ hashMap.put("value", jsonObject.get(key))
paramList.add(hashMap)
}
Map<String, List<Map<String, Object>>> paramMap = new HashMap()
@@ -260,6 +256,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
break
+ case ~/[\w\s\W]*UNI[\w\s\W]*/ :
+ def resourceInput = resourceInputObj.getResourceParameters()
+ String incomingRequest = resourceInputObj.getRequestsInputs()
+ String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters")
+ String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
+ JSONObject inputParameters = new JSONObject(requestInputs)
+ String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.service-name", inputParameters.get("name"))
+ resourceInputObj.setResourceParameters(uResourceInput)
+ execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
+ break
+
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]*/ :
@@ -363,7 +370,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<sdncadapter:MsoAction>opticalservice</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
- <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <request-id>${msoUtils.xmlEscape(serviceInstanceId)}</request-id>
<global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
<service-type>${msoUtils.xmlEscape(serviceType)}</service-type>
<notification-url>sdncCallback</notification-url>
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 61b1250522..cdc242dbd8 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
@@ -221,6 +221,30 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
switch (modelType) {
case "VNF":
+ if(modelName.contains("UNI") && "MDONS_OTN".equals(serviceType)){
+ String serviceInstanceName = resourceInputObj.getResourceInstanceName()
+ 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>optical-service-delete</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>opticalservice</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-id>${msoUtils.xmlEscape(serviceInstanceId)}</request-id>
+ <payload>
+ <param>
+ <name>service-name</name>
+ <value>${msoUtils.xmlEscape(serviceInstanceName)}</value>
+ </param>
+ </payload>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+ } else{
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">
@@ -275,6 +299,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
</vnf-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
+ }
break
case "GROUP" :
//When a new resource creation request reaches SO, the parent resources information needs to be provided
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
index 22c8a11fae..5c8ece88fe 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
@@ -41,6 +41,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.aai.entities.AAIResultWrapper
@@ -379,7 +380,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String networkName = utils.getNodeText(networkInputs, "network-name")
AAIResourcesClient client = new AAIResourcesClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName)
L3Networks networks = client.get(uri, NotFoundException.class).asBean(L3Networks.class).get()
L3Network network = networks.getL3Network().get(0)
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 64d9827c7c..78b8e2d8a7 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
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.infrastructure.scripts;
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.OwningEntity
@@ -44,7 +43,6 @@ import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
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.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -293,7 +291,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map
logger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId)
- AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId)
if(!getAAIClient().exists(uri)){
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
index ae239d9e68..5a955e65f5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
@@ -1,7 +1,6 @@
package org.onap.so.bpmn.infrastructure.scripts
-import org.onap.so.bpmn.core.domain.AllottedResource
import org.onap.aai.domain.yang.AllottedResource
import static org.apache.commons.lang3.StringUtils.*;
@@ -27,7 +26,6 @@ import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
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.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
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 c12d3553d5..1a3df6ff4e 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,24 +22,21 @@
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.logging.filter.base.ErrorCode
-
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
-
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONArray
import org.json.JSONObject
import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.logging.filter.base.ErrorCode
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.NetworkUtils
@@ -53,28 +50,27 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.DecomposeJsonUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
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.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
import org.onap.so.db.catalog.beans.HomingInstance
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-
-import org.onap.logging.filter.base.ONAPComponents;
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.NamedNodeMap
import org.w3c.dom.Node
import org.w3c.dom.NodeList
import org.xml.sax.InputSource
-
import com.fasterxml.jackson.databind.ObjectMapper
@@ -307,7 +303,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
try{
- AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
AAIResourcesClient aaiRC = new AAIResourcesClient()
AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI)
Map<String, Object> aaiJson = aaiRW.asMap()
@@ -778,7 +774,7 @@ public class DoCreateVfModule extends VfModuleBase {
def vfModuleName = execution.getVariable('DCVFM_vfModuleName')
AaiUtil aaiUriUtil = new AaiUtil(this)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName)
String endPoint = aaiUriUtil.createAaiUri(uri)
HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI)
@@ -1927,7 +1923,7 @@ public class DoCreateVfModule extends VfModuleBase {
String fqdn = fqdnList[i]
// Query AAI for this network policy FQDN
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", fqdn)
AAIResourcesClient resourceClient = new AAIResourcesClient()
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 573282dafd..a77f6f0628 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
@@ -36,6 +36,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.logging.filter.base.ErrorCode
@@ -507,7 +508,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
try {
// Query AAI for this network policy FQDN
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", fqdn)
Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
index a233a0a02e..7f2a3e4245 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
@@ -32,6 +32,7 @@ import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
@@ -132,7 +133,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor
volumeGroupName = testVolumeGroupName
}
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
try {
Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class, uri)
if (volumeGroups.isPresent()) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
index b2006c45d7..fafe97b0eb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+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.GenericVnf
@@ -45,14 +46,12 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import javax.ws.rs.NotFoundException
-
class DoCreateVfModuleVolumeV2 extends VfModuleBase {
private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeV2.class);
- String prefix='DCVFMODVOLV2_'
- JsonUtils jsonUtil = new JsonUtils()
- private ExceptionUtil exceptionUtil = new ExceptionUtil()
+ String prefix='DCVFMODVOLV2_'
+ JsonUtils jsonUtil = new JsonUtils()
+ private ExceptionUtil exceptionUtil = new ExceptionUtil()
/**
@@ -66,330 +65,327 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) {
- execution.setVariable("prefix",prefix)
- execution.setVariable(prefix+'SuccessIndicator', false)
- execution.setVariable(prefix+'isPONR', false)
-
- displayInput(execution, isDebugLogEnabled)
- setRollbackData(execution, isDebugLogEnabled)
- setRollbackEnabled(execution, isDebugLogEnabled)
-
-
- def tenantId = execution.getVariable("tenantId")
- if (tenantId == null) {
- String cloudConfiguration = execution.getVariable("cloudConfiguration")
- tenantId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.tenantId")
- execution.setVariable("tenantId", tenantId)
- }
-
- def cloudSiteId = execution.getVariable("lcpCloudRegionId")
- if (cloudSiteId == null) {
- String cloudConfiguration = execution.getVariable("cloudConfiguration")
- cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId")
- def cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.cloudOwner")
- execution.setVariable("lcpCloudRegionId", cloudSiteId)
- execution.setVariable("cloudOwner", cloudOwner)
- }
-
- // Extract attributes from modelInfo
- String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
-
- //modelCustomizationUuid
- def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
- execution.setVariable("modelCustomizationId", modelCustomizationUuid)
- logger.debug("modelCustomizationId: " + modelCustomizationUuid)
-
- //modelName
- def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
- execution.setVariable("modelName", modelName)
- logger.debug("modelName: " + modelName)
-
- // The following is used on the get Generic Service Instance call
- execution.setVariable('GENGS_type', 'service-instance')
- }
-
-
- /**
- * Display input variables
- * @param execution
- * @param isDebugLogEnabled
- */
- public void displayInput(DelegateExecution execution, isDebugLogEnabled) {
- def input = ['mso-request-id', 'msoRequestId', 'isDebugLogEnabled', 'disableRollback', 'failIfExists', 'serviceInstanceId',
- 'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion',
- 'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams']
-
- logger.debug('Begin input: ')
- input.each {
- logger.debug(it + ': ' + execution.getVariable(it))
- }
- logger.debug('End input.')
- }
-
-
- /**
- * Define and set rollbackdata object
- * @param execution
- * @param isDebugEnabled
- */
- public void setRollbackData(DelegateExecution execution, isDebugEnabled) {
- def rollbackData = execution.getVariable("rollbackData")
- if (rollbackData == null) {
- rollbackData = new RollbackData()
- }
- def volumeGroupName = execution.getVariable('volumeGroupName')
- rollbackData.put("DCVFMODULEVOL", "volumeGroupName", volumeGroupName)
- execution.setVariable("rollbackData", rollbackData)
- }
-
-
- /**
- * Gets the service instance uri from aai
- */
- public void getServiceInstance(DelegateExecution execution) {
- try {
- String serviceInstanceId = execution.getVariable('serviceInstanceId')
-
- AAIResourcesClient resourceClient = new AAIResourcesClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-
- if(!resourceClient.exists(uri)){
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
- }
-
- }catch(BpmnError e) {
- throw e
- }catch (Exception ex){
- String msg = "Exception in getServiceInstance. " + ex.getMessage()
- logger.debug(msg)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, msg)
- }
- }
-
- /**
- * Get cloud region
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) {
-
- def cloudRegion = execution.getVariable("lcpCloudRegionId")
- logger.debug('Request cloud region is: ' + cloudRegion)
-
- AaiUtil aaiUtil = new AaiUtil(this)
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
- def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
-
- cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
-
- def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion)
- if ((aaiCloudRegion != "ERROR")) {
- execution.setVariable("lcpCloudRegionId", aaiCloudRegion)
- logger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion)
- } else {
- String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
- logger.debug(errorMessage)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
- }
-
- def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
- if ((poCloudRegion != "ERROR")) {
- execution.setVariable("poLcpCloudRegionId", poCloudRegion)
- logger.debug("AIC Cloud Region for PO: " + poCloudRegion)
- } else {
- String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
- logger.debug(errorMessage)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
- }
-
- def rollbackData = execution.getVariable("rollbackData")
- rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudRegion)
- }
-
-
- /**
- * Query AAI volume group by name
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
-
- def volumeGroupName = execution.getVariable('volumeGroupName')
- def cloudRegion = execution.getVariable('lcpCloudRegionId')
-
- try {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
- Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
- if(volumeGroups.isPresent()){
- VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- execution.setVariable(prefix+'AaiReturnCode', 200)
- execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
- logger.debug("Volume Group Name $volumeGroupName exists in AAI.")
- }else{
- execution.setVariable(prefix+'AaiReturnCode', 404)
- exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Volume Group Name $volumeGroupName does not exist in AAI.")
- }
- }catch(BpmnError error){
- throw error
- }catch(Exception e){
- execution.setVariable(prefix+'AaiReturnCode', 500)
- exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Exception in get volume group by name: " + e.getMessage())
- }
- }
-
-
- /**
- * Create a WorkflowException
- * @param execution
- * @param isDebugEnabled
- */
- public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage) {
- logger.debug(errorMessage)
- (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage)
- }
-
-
- /**
- * Create a WorkflowException
- * @param execution
- * @param isDebugEnabled
- */
- public void handleError(DelegateExecution execution, isDebugEnabled) {
- WorkflowException we = execution.getVariable('WorkflowException')
- if (we == null) {
- (new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!")
- }
- throw new BpmnError("MSOWorkflowException")
- }
-
-
- /**
- * Create volume group in AAI
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
-
- def vnfId = execution.getVariable('vnfId')
- def volumeGroupId = execution.getVariable('volumeGroupId')
- def volumeName = execution.getVariable("volumeGroupName")
- def modelCustomizationId = execution.getVariable("modelCustomizationId")
- def vnfType = execution.getVariable("vnfType")
- def tenantId = execution.getVariable("tenantId")
- def cloudRegion = execution.getVariable('lcpCloudRegionId')
- def cloudOwner = execution.getVariable('cloudOwner')
-
- def testGroupId = execution.getVariable('test-volume-group-id')
- if (testGroupId != null && testGroupId.trim() != '') {
- logger.debug("test volumeGroupId is present: " + testGroupId)
- volumeGroupId = testGroupId
- execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
- }
-
- VolumeGroup volumeGroup = new VolumeGroup()
- volumeGroup.setVolumeGroupId(volumeGroupId)
- volumeGroup.setVolumeGroupName(volumeName)
- volumeGroup.setVnfType(vnfType)
- volumeGroup.setOrchestrationStatus(OrchestrationStatus.PENDING.toString())
- volumeGroup.setModelCustomizationId(modelCustomizationId)
-
- logger.debug("volumeGroupId to be used: " + volumeGroupId)
-
- AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
- AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId)
- AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- try {
- getAAIClient().create(volumeGroupUri, volumeGroup)
- getAAIClient().connect(volumeGroupUri, vnfUri)
- getAAIClient().connect(volumeGroupUri, tenantUri)
- execution.setVariable("queriedVolumeGroupId", volumeGroupId)
- RollbackData rollbackData = execution.getVariable("rollbackData")
- rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true")
- } catch (NotFoundException ignored) {
- execution.setVariable(prefix + "isErrorMessageException", true)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to create volume group in AAI. Response code: 404")
- } catch (Exception ex) {
- execution.setVariable(prefix + "isErrorMessageException", true)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, ex.getMessage())
- }
- }
-
- /**
- * Prepare VNF adapter create request XML
- * @param execution
- */
- public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) {
-
- GenericVnf aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse')
- def vnfId = aaiGenericVnfResponse.getVnfId()
- def vnfName = aaiGenericVnfResponse.getVnfName()
- def vnfType = aaiGenericVnfResponse.getVnfType()
-
- def requestId = execution.getVariable('msoRequestId')
- def serviceId = execution.getVariable('serviceInstanceId')
- def cloudSiteId = execution.getVariable('poLcpCloudRegionId')
- def tenantId = execution.getVariable('tenantId')
- def volumeGroupId = execution.getVariable('volumeGroupId')
- def volumeGroupnName = execution.getVariable('volumeGroupName')
-
- def vnfVersion = execution.getVariable("asdcServiceModelVersion")
- def vnfModuleType = execution.getVariable("modelName")
-
- def modelCustomizationId = execution.getVariable("modelCustomizationId")
-
- // for testing
- logger.debug("volumeGroupId: " + volumeGroupId)
- def testGroupId = execution.getVariable('test-volume-group-id')
- if (testGroupId != null && testGroupId.trim() != '') {
- logger.debug("test volumeGroupId is present: " + testGroupId)
- volumeGroupId = testGroupId
- execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
- }
- logger.debug("volumeGroupId to be used: " + volumeGroupId)
-
- // volume group parameters
-
- String volumeGroupParams = ''
- StringBuilder sbParams = new StringBuilder()
- Map<String, String> paramsMap = execution.getVariable("vfModuleInputParams")
- for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
- String paramsXml
- String paramName = entry.getKey()
- String paramValue = entry.getValue()
- paramsXml =
- """ <entry>
+ execution.setVariable("prefix",prefix)
+ execution.setVariable(prefix+'SuccessIndicator', false)
+ execution.setVariable(prefix+'isPONR', false)
+
+ displayInput(execution, isDebugLogEnabled)
+ setRollbackData(execution, isDebugLogEnabled)
+ setRollbackEnabled(execution, isDebugLogEnabled)
+
+
+ def tenantId = execution.getVariable("tenantId")
+ if (tenantId == null) {
+ String cloudConfiguration = execution.getVariable("cloudConfiguration")
+ tenantId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.tenantId")
+ execution.setVariable("tenantId", tenantId)
+ }
+
+ def cloudSiteId = execution.getVariable("lcpCloudRegionId")
+ if (cloudSiteId == null) {
+ String cloudConfiguration = execution.getVariable("cloudConfiguration")
+ cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId")
+ def cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.cloudOwner")
+ execution.setVariable("lcpCloudRegionId", cloudSiteId)
+ execution.setVariable("cloudOwner", cloudOwner)
+ }
+
+ // Extract attributes from modelInfo
+ String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
+
+ //modelCustomizationUuid
+ def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
+ execution.setVariable("modelCustomizationId", modelCustomizationUuid)
+ logger.debug("modelCustomizationId: " + modelCustomizationUuid)
+
+ //modelName
+ def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
+ execution.setVariable("modelName", modelName)
+ logger.debug("modelName: " + modelName)
+
+ // The following is used on the get Generic Service Instance call
+ execution.setVariable('GENGS_type', 'service-instance')
+ }
+
+
+ /**
+ * Display input variables
+ * @param execution
+ * @param isDebugLogEnabled
+ */
+ public void displayInput(DelegateExecution execution, isDebugLogEnabled) {
+ def input = ['mso-request-id', 'msoRequestId', 'isDebugLogEnabled', 'disableRollback', 'failIfExists', 'serviceInstanceId', 'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion', 'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams']
+
+ logger.debug('Begin input: ')
+ input.each {
+ logger.debug(it + ': ' + execution.getVariable(it))
+ }
+ logger.debug('End input.')
+ }
+
+
+ /**
+ * Define and set rollbackdata object
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void setRollbackData(DelegateExecution execution, isDebugEnabled) {
+ def rollbackData = execution.getVariable("rollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData()
+ }
+ def volumeGroupName = execution.getVariable('volumeGroupName')
+ rollbackData.put("DCVFMODULEVOL", "volumeGroupName", volumeGroupName)
+ execution.setVariable("rollbackData", rollbackData)
+ }
+
+
+ /**
+ * Gets the service instance uri from aai
+ */
+ public void getServiceInstance(DelegateExecution execution) {
+ try {
+ String serviceInstanceId = execution.getVariable('serviceInstanceId')
+
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+
+ if(!resourceClient.exists(uri)){
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
+ }
+ }catch(BpmnError e) {
+ throw e
+ }catch (Exception ex){
+ String msg = "Exception in getServiceInstance. " + ex.getMessage()
+ logger.debug(msg)
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ /**
+ * Get cloud region
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) {
+
+ def cloudRegion = execution.getVariable("lcpCloudRegionId")
+ logger.debug('Request cloud region is: ' + cloudRegion)
+
+ AaiUtil aaiUtil = new AaiUtil(this)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
+
+ cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
+
+ def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion)
+ if ((aaiCloudRegion != "ERROR")) {
+ execution.setVariable("lcpCloudRegionId", aaiCloudRegion)
+ logger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion)
+ } else {
+ String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
+ logger.debug(errorMessage)
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
+ }
+
+ def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
+ if ((poCloudRegion != "ERROR")) {
+ execution.setVariable("poLcpCloudRegionId", poCloudRegion)
+ logger.debug("AIC Cloud Region for PO: " + poCloudRegion)
+ } else {
+ String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
+ logger.debug(errorMessage)
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
+ }
+
+ def rollbackData = execution.getVariable("rollbackData")
+ rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudRegion)
+ }
+
+
+ /**
+ * Query AAI volume group by name
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
+
+ def volumeGroupName = execution.getVariable('volumeGroupName')
+ def cloudRegion = execution.getVariable('lcpCloudRegionId')
+
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
+ Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
+ if(volumeGroups.isPresent()){
+ VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
+ execution.setVariable(prefix+'AaiReturnCode', 200)
+ execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
+ logger.debug("Volume Group Name $volumeGroupName exists in AAI.")
+ }else{
+ execution.setVariable(prefix+'AaiReturnCode', 404)
+ exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Volume Group Name $volumeGroupName does not exist in AAI.")
+ }
+ }catch(BpmnError error){
+ throw error
+ }catch(Exception e){
+ execution.setVariable(prefix+'AaiReturnCode', 500)
+ exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Exception in get volume group by name: " + e.getMessage())
+ }
+ }
+
+
+ /**
+ * Create a WorkflowException
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage) {
+ logger.debug(errorMessage)
+ (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage)
+ }
+
+
+ /**
+ * Create a WorkflowException
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void handleError(DelegateExecution execution, isDebugEnabled) {
+ WorkflowException we = execution.getVariable('WorkflowException')
+ if (we == null) {
+ (new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!")
+ }
+ throw new BpmnError("MSOWorkflowException")
+ }
+
+
+ /**
+ * Create volume group in AAI
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
+
+ def vnfId = execution.getVariable('vnfId')
+ def volumeGroupId = execution.getVariable('volumeGroupId')
+ def volumeName = execution.getVariable("volumeGroupName")
+ def modelCustomizationId = execution.getVariable("modelCustomizationId")
+ def vnfType = execution.getVariable("vnfType")
+ def tenantId = execution.getVariable("tenantId")
+ def cloudRegion = execution.getVariable('lcpCloudRegionId')
+ def cloudOwner = execution.getVariable('cloudOwner')
+
+ def testGroupId = execution.getVariable('test-volume-group-id')
+ if (testGroupId != null && testGroupId.trim() != '') {
+ logger.debug("test volumeGroupId is present: " + testGroupId)
+ volumeGroupId = testGroupId
+ execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
+ }
+
+ VolumeGroup volumeGroup = new VolumeGroup()
+ volumeGroup.setVolumeGroupId(volumeGroupId)
+ volumeGroup.setVolumeGroupName(volumeName)
+ volumeGroup.setVnfType(vnfType)
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.PENDING.toString())
+ volumeGroup.setModelCustomizationId(modelCustomizationId)
+
+ logger.debug("volumeGroupId to be used: " + volumeGroupId)
+
+ AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
+ AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId)
+ AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ try {
+ getAAIClient().create(volumeGroupUri, volumeGroup)
+ getAAIClient().connect(volumeGroupUri, vnfUri)
+ getAAIClient().connect(volumeGroupUri, tenantUri)
+ execution.setVariable("queriedVolumeGroupId", volumeGroupId)
+ RollbackData rollbackData = execution.getVariable("rollbackData")
+ rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true")
+ } catch (NotFoundException ignored) {
+ execution.setVariable(prefix + "isErrorMessageException", true)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to create volume group in AAI. Response code: 404")
+ } catch (Exception ex) {
+ execution.setVariable(prefix + "isErrorMessageException", true)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, ex.getMessage())
+ }
+ }
+
+ /**
+ * Prepare VNF adapter create request XML
+ * @param execution
+ */
+ public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) {
+
+ GenericVnf aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse')
+ def vnfId = aaiGenericVnfResponse.getVnfId()
+ def vnfName = aaiGenericVnfResponse.getVnfName()
+ def vnfType = aaiGenericVnfResponse.getVnfType()
+
+ def requestId = execution.getVariable('msoRequestId')
+ def serviceId = execution.getVariable('serviceInstanceId')
+ def cloudSiteId = execution.getVariable('poLcpCloudRegionId')
+ def tenantId = execution.getVariable('tenantId')
+ def volumeGroupId = execution.getVariable('volumeGroupId')
+ def volumeGroupnName = execution.getVariable('volumeGroupName')
+
+ def vnfVersion = execution.getVariable("asdcServiceModelVersion")
+ def vnfModuleType = execution.getVariable("modelName")
+
+ def modelCustomizationId = execution.getVariable("modelCustomizationId")
+
+ // for testing
+ logger.debug("volumeGroupId: " + volumeGroupId)
+ def testGroupId = execution.getVariable('test-volume-group-id')
+ if (testGroupId != null && testGroupId.trim() != '') {
+ logger.debug("test volumeGroupId is present: " + testGroupId)
+ volumeGroupId = testGroupId
+ execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
+ }
+ logger.debug("volumeGroupId to be used: " + volumeGroupId)
+
+ // volume group parameters
+
+ String volumeGroupParams = ''
+ StringBuilder sbParams = new StringBuilder()
+ Map<String, String> paramsMap = execution.getVariable("vfModuleInputParams")
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String paramsXml
+ String paramName = entry.getKey()
+ String paramValue = entry.getValue()
+ paramsXml =
+ """ <entry>
<key>${MsoUtils.xmlEscape(paramName)}</key>
<value>${MsoUtils.xmlEscape(paramValue)}</value>
</entry>
"""
- sbParams.append(paramsXml)
- }
+ sbParams.append(paramsXml)
+ }
- volumeGroupParams = sbParams.toString()
- logger.debug("volumeGroupParams: "+ volumeGroupParams)
+ volumeGroupParams = sbParams.toString()
+ logger.debug("volumeGroupParams: "+ volumeGroupParams)
- def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure")
- logger.debug("backoutOnFailure: "+ backoutOnFailure)
+ def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure")
+ logger.debug("backoutOnFailure: "+ backoutOnFailure)
- def failIfExists = execution.getVariable("failIfExists")
- if(failIfExists == null) {
- failIfExists = 'true'
- }
+ def failIfExists = execution.getVariable("failIfExists")
+ if(failIfExists == null) {
+ failIfExists = 'true'
+ }
- String messageId = UUID.randomUUID()
- logger.debug("messageId to be used is generated: " + messageId)
+ String messageId = UUID.randomUUID()
+ logger.debug("messageId to be used is generated: " + messageId)
- def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
- def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
- if ('true'.equals(useQualifiedHostName)) {
- notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
- }
- logger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl)
+ def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
+ def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
+ if ('true'.equals(useQualifiedHostName)) {
+ notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
+ }
+ logger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl)
- // build request
- String vnfSubCreateWorkflowRequest =
- """
+ // build request
+ String vnfSubCreateWorkflowRequest =
+ """
<createVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
@@ -432,23 +428,23 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
</createVolumeGroupRequest>
"""
- String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest)
- logger.debug(vnfSubCreateWorkflowRequestAsString)
- logger.debug(vnfSubCreateWorkflowRequestAsString)
- execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString)
+ String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest)
+ logger.debug(vnfSubCreateWorkflowRequestAsString)
+ logger.debug(vnfSubCreateWorkflowRequestAsString)
+ execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString)
- // build rollback request for use later if needed
- String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl)
+ // build rollback request for use later if needed
+ String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl)
- logger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest)
+ logger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest)
- String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest)
- execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString)
- }
+ String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest)
+ execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString)
+ }
- public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) {
+ public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) {
- String request = """
+ String request = """
<rollbackVolumeGroupRequest>
<volumeGroupRollback>
<volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
@@ -467,88 +463,88 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
</rollbackVolumeGroupRequest>
"""
- return request
- }
-
- public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) {
- String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId)
- return newRequest
- }
-
- /**
- * Validate VNF adapter response
- * @param execution
- */
- public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) {
- def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator')
- logger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess)
- if(vnfSuccess==true) {
- String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
- String heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
- String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest")
- String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID)
- logger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest)
- RollbackData rollbackData = execution.getVariable("rollbackData")
- rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest)
- rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true")
- }
- }
-
-
- /**
- * Update voulume group in AAI
- * @TODO: Can we re-use the create method??
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) {
- String volumeGroupId = execution.getVariable("queriedVolumeGroupId")
- String modelCustomizationId = execution.getVariable("modelCustomizationId")
- String cloudRegion = execution.getVariable("lcpCloudRegionId")
- String cloudOwner = execution.getVariable('cloudOwner')
- String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
- def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
-
- execution.setVariable(prefix+"heatStackId", heatStackID)
-
- VolumeGroup volumeGroup = new VolumeGroup()
- volumeGroup.setHeatStackId(heatStackID)
- volumeGroup.setModelCustomizationId(modelCustomizationId)
- try {
- getAAIClient().update(uri, volumeGroup)
- execution.setVariable(prefix+"isPONR", true)
- }catch(NotFoundException ignored){
- execution.setVariable(prefix+"isErrorMessageException", true)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to update volume group in AAI. Response code: 404")
- }catch(BpmnError error){
- throw error
- }catch(Exception e){
- execution.setVariable(prefix+"isErrorMessageException", true)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Adapter Query Failed. "+ e.getMessage())
- }
- }
-
-
- /**
- * Query AAI Generic VNF
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) {
-
- def vnfId = execution.getVariable('vnfId')
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- try {
- Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri)
- if (genericVnf.isPresent()) {
- execution.setVariable(prefix + 'AAIQueryGenericVfnResponse', genericVnf.get())
- } else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.')
- }
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Exception in get generic VNF: " + e.getMessage())
- }
- }
+ return request
+ }
+
+ public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) {
+ String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId)
+ return newRequest
+ }
+
+ /**
+ * Validate VNF adapter response
+ * @param execution
+ */
+ public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) {
+ def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator')
+ logger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess)
+ if(vnfSuccess==true) {
+ String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
+ String heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
+ String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest")
+ String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID)
+ logger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest)
+ RollbackData rollbackData = execution.getVariable("rollbackData")
+ rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest)
+ rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true")
+ }
+ }
+
+
+ /**
+ * Update voulume group in AAI
+ * @TODO: Can we re-use the create method??
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) {
+ String volumeGroupId = execution.getVariable("queriedVolumeGroupId")
+ String modelCustomizationId = execution.getVariable("modelCustomizationId")
+ String cloudRegion = execution.getVariable("lcpCloudRegionId")
+ String cloudOwner = execution.getVariable('cloudOwner')
+ String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
+ def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
+
+ execution.setVariable(prefix+"heatStackId", heatStackID)
+
+ VolumeGroup volumeGroup = new VolumeGroup()
+ volumeGroup.setHeatStackId(heatStackID)
+ volumeGroup.setModelCustomizationId(modelCustomizationId)
+ try {
+ getAAIClient().update(uri, volumeGroup)
+ execution.setVariable(prefix+"isPONR", true)
+ }catch(NotFoundException ignored){
+ execution.setVariable(prefix+"isErrorMessageException", true)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to update volume group in AAI. Response code: 404")
+ }catch(BpmnError error){
+ throw error
+ }catch(Exception e){
+ execution.setVariable(prefix+"isErrorMessageException", true)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Adapter Query Failed. "+ e.getMessage())
+ }
+ }
+
+
+ /**
+ * Query AAI Generic VNF
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) {
+
+ def vnfId = execution.getVariable('vnfId')
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ try {
+ Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri)
+ if (genericVnf.isPresent()) {
+ execution.setVariable(prefix + 'AAIQueryGenericVfnResponse', genericVnf.get())
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.')
+ }
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Exception in get generic VNF: " + 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 a24bc4411e..35af3d34d6 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
@@ -450,6 +450,16 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo())
List<Resource> deleteResourceList = serviceDecomposition.getServiceResources()
+ if (serviceDecomposition.getServiceType().equals("MDONS_OTN")){
+ for (Resource resource : deleteResourceList) {
+ String serviceName = execution.getVariable("serviceInstanceName")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ resource.setResourceId(serviceInstanceId)
+ resource.setResourceInstanceName(serviceName)
+ def delMap = new ImmutablePair(resource, null)
+ deleteRealResourceList.add(delMap)
+ }
+ } else{
String serviceRelationShip = execution.getVariable("serviceRelationShip")
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
@@ -492,6 +502,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
}
}
+ }
// only delete real existing resources
execution.setVariable("deleteResourceList", deleteRealResourceList)
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 511f461844..002e283790 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
@@ -41,6 +41,7 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
@@ -489,7 +490,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
for (i in 0..fqdnCount-1) {
String fqdn = fqdnList[i]
// Query AAI for this network policy FQDN
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", fqdn)
try {
Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
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 9c8bd156a9..34a210364a 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
@@ -43,6 +43,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
@@ -513,7 +514,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
// Query AAI for this network policy FQDN
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", fqdn)
try {
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 854584fea9..ff63bc945b 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,10 +22,10 @@
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
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
@@ -37,15 +37,14 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils;
-import org.onap.so.client.graphinventory.entities.uri.Depth
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.AAIUri
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
-import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -274,7 +273,7 @@ public class DoUpdateVfModule extends VfModuleBase {
}
try{
- AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
AAIResourcesClient aaiRC = new AAIResourcesClient()
AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI)
Map<String, Object> aaiJson = aaiRW.asMap()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy
new file mode 100644
index 0000000000..8e7a4f727d
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/PNFSoftwareUpgrade.groovy
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.workflow.context.WorkflowContext
+import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder
+import org.onap.so.bpmn.core.WorkflowException
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*
+
+class PNFSoftwareUpgrade extends AbstractServiceTaskProcessor {
+ private static final Logger logger = LoggerFactory.getLogger(PNFSoftwareUpgrade.class)
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ String prefix = "PnfSwUpgrade_"
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ }
+
+ void sendResponse(DelegateExecution execution) {
+ def requestId = execution.getVariable(REQUEST_ID)
+ def instanceId = execution.getVariable(PNF_CORRELATION_ID)
+ logger.debug("Send response for requestId: {}, instanceId: {}", requestId, instanceId)
+
+ String response = """{"requestReferences":{"requestId":"${requestId}", "instanceId":"${instanceId}"}}""".trim()
+ sendWorkflowResponse(execution, 200, response)
+ }
+
+ static WorkflowContext getWorkflowContext(DelegateExecution execution) {
+ String requestId = execution.getVariable(REQUEST_ID)
+ return WorkflowContextHolder.getInstance().getWorkflowContext(requestId)
+ }
+
+ void prepareCompletion(DelegateExecution execution) {
+ try {
+ String requestId = execution.getVariable(REQUEST_ID)
+ logger.debug("Prepare Completion of PNF Software Upgrade for requestId: {}", requestId)
+
+ String msoCompletionRequest =
+ """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:ns="http://org.onap/so/request/types/v1">
+ <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>UPDATE</action>
+ <source>VID</source>
+ </request-info>
+ <aetgt:status-message>PNF has been upgraded successfully.</aetgt:status-message>
+ <aetgt:mso-bpel-name>PNF_SOFTWARE_UPGRADE</aetgt:mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+ String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+ execution.setVariable(prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest)
+
+ logger.debug("CompleteMsoProcessRequest of PNF Software Upgrade - " + "\n" + xmlMsoCompletionRequest)
+ } catch (Exception e) {
+ String msg = "Prepare Completion error for PNF software upgrade - " + e.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ void prepareFalloutHandler(DelegateExecution execution) {
+ WorkflowContext workflowContext = getWorkflowContext(execution)
+ if (workflowContext == null) {
+ logger.debug("Error occurred before sending response to API handler, and send it now")
+ sendResponse(execution)
+ }
+
+ try {
+ String requestId = execution.getVariable(REQUEST_ID)
+ logger.debug("Prepare FalloutHandler of PNF Software Upgrade for requestId: {}", requestId)
+
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ String errorCode = String.valueOf(workflowException.getErrorCode())
+ String errorMessage = workflowException.getErrorMessage()
+ String falloutHandlerRequest =
+ """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:ns="http://org.onap/so/request/types/v1">
+ <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>UPDATE</action>
+ <source>VID</source>
+ </request-info>
+ <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorCode)}</aetgt:ErrorCode>
+ </aetgt:WorkflowException>
+ </aetgt:FalloutHandlerRequest>"""
+ String xmlFalloutHandlerRequest = utils.formatXml(falloutHandlerRequest)
+
+ execution.setVariable(prefix + "FalloutHandlerRequest", xmlFalloutHandlerRequest)
+
+ logger.debug("FalloutHandlerRequest of PNF Software Upgrade - " + "\n" + xmlFalloutHandlerRequest)
+ } catch (Exception e) {
+ String msg = "Prepare FalloutHandler error for PNF software upgrade - " + e.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
index e423ecc83c..980128c848 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
@@ -30,6 +30,7 @@ import org.onap.appc.client.lcm.model.Action
import org.onap.appc.client.lcm.model.ActionIdentifiers
import org.onap.appc.client.lcm.model.Flags
import org.onap.appc.client.lcm.model.Status
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -42,11 +43,9 @@ import org.onap.so.client.aai.*
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.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.appc.ApplicationControllerClient
import org.onap.so.client.appc.ApplicationControllerSupport
-import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -218,7 +217,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
logger.debug("cloudRegionId is: {}", cloudRegionId)
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
// Check if this VNF exists
if (!client.exists(genericVnfUri)) {
logger.debug("VNF with vnfId {} does not exist in A&AI", vnfId)
@@ -436,7 +435,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
def vnfId = execution.getVariable("vnfId")
logger.debug("vnfId is: {}", vnfId)
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
AAIResultWrapper aaiRW = client.get(genericVnfUri)
Map<String, Object> result = aaiRW.asMap()
boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -488,7 +487,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
Map<String, Boolean> request = new HashMap<>()
request.put("is-closed-loop-disabled", setDisabled)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
index d11f4c19eb..70b7ec102b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
@@ -21,22 +21,22 @@
package org.onap.so.bpmn.infrastructure.scripts
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.appc.client.lcm.model.Action
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.*
import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIUri
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
public class VnfConfigUpdate extends VnfCmBase {
private static final Logger logger = LoggerFactory.getLogger( VnfConfigUpdate.class)
@@ -360,7 +360,7 @@ public class VnfConfigUpdate extends VnfCmBase {
def vnfId = execution.getVariable("vnfId")
logger.debug("vnfId is: {}", vnfId)
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
AAIResultWrapper aaiRW = client.get(genericVnfUri)
Map<String, Object> result = aaiRW.asMap()
boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -412,7 +412,7 @@ public class VnfConfigUpdate extends VnfCmBase {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
Map<String, Boolean> request = new HashMap<>()
request.put("is-closed-loop-disabled", setDisabled)
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 34215a11aa..c5f117b35f 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,28 +21,28 @@
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
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.appc.client.lcm.model.Action
import org.onap.appc.client.lcm.model.ActionIdentifiers
import org.onap.appc.client.lcm.model.Flags
import org.onap.appc.client.lcm.model.Status
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.*
import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIUri
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.appc.ApplicationControllerClient
import org.onap.so.client.appc.ApplicationControllerSupport
-import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
public class VnfInPlaceUpdate extends VnfCmBase {
private static final Logger logger = LoggerFactory.getLogger(VnfInPlaceUpdate.class)
@@ -380,7 +380,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
def vnfId = execution.getVariable("vnfId")
logger.debug("vnfId is: " + vnfId)
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
AAIResultWrapper aaiRW = client.get(genericVnfUri)
Map<String, Object> result = aaiRW.asMap()
boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -431,7 +431,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
Map<String, Boolean> request = new HashMap<>()
request.put("is-closed-loop-disabled", setDisabled)
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 68abcea07c..a4f7766c15 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,7 +22,8 @@
package org.onap.so.bpmn.vcpe.scripts
-import org.onap.so.logger.LoggingAnchor
+import static org.apache.commons.lang3.StringUtils.isBlank
+import javax.ws.rs.core.UriBuilder
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.AllottedResource
@@ -36,15 +37,11 @@ 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.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import javax.ws.rs.NotFoundException
-import javax.ws.rs.core.UriBuilder
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
/**
* This groovy class supports the <class>DoCreateAllottedResourceBRG.bpmn</class> process.
*
@@ -235,11 +232,10 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
- try {
//just to make sure the serviceInstance exists
- uri.build()
+ if (resourceClient.exists(uri)) {
execution.setVariable("PSI_resourceLink", uri)
- } catch (NotFoundException e) {
+ } else {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
index f7b0c662db..fb61da6412 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
@@ -30,7 +30,7 @@ public class AAIServiceInstance {
String environmentContext;
String workloadContext;
- public class AAIServiceInstanceBuilder {
+ public static class AAIServiceInstanceBuilder {
private String serviceInstanceName;
private String serviceType;
private String serviceRole;
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 109f45e6eb..c63edc93c7 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
@@ -22,12 +22,8 @@
package org.onap.so.bpmn.infrastructure.workflow.service;
-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;
@@ -40,14 +36,12 @@ import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
-import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
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.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;
@@ -69,6 +63,7 @@ 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.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.logging.filter.base.ErrorCode;
@@ -76,6 +71,9 @@ import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.util.UriUtils;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
public class ServicePluginFactory {
@@ -451,7 +449,7 @@ public class ServicePluginFactory {
public Map getTPsfromAAI(String serviceName) {
Map<String, Object> tpInfo = new HashMap<>();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
AAIResourcesClient client = new AAIResourcesClient();
Optional<LogicalLinks> result = client.get(LogicalLinks.class, uri);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
index dd18049b5f..7107d15602 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
@@ -45,6 +45,7 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException
@@ -168,7 +169,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
fqdnList.add("test")
when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
NetworkPolicies networkPolicies = new NetworkPolicies();
NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -198,7 +199,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
fqdnList.add("test")
when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
NetworkPolicies networkPolicies = new NetworkPolicies();
NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -228,7 +229,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
fqdnList.add("test")
when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
NetworkPolicies networkPolicies = new NetworkPolicies();
NetworkPolicy networkPolicy = new NetworkPolicy();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy
index 5c68cc7fc1..8941a24ebc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy
@@ -27,6 +27,7 @@ import org.onap.aai.domain.yang.VolumeGroup
import org.onap.aai.domain.yang.VolumeGroups;
import org.onap.so.bpmn.common.scripts.MsoGroovyTest
import org.onap.so.client.aai.AAIObjectPlurals
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
@@ -50,7 +51,7 @@ public class DoCreateVfModuleVolumeRollbackTest extends MsoGroovyTest {
String cloudRegionId = "cloudRegionId"
when(mockExecution.getVariable("DCVFMODVOLRBK_volumeGroupName")).thenReturn(volumeGroupName)
when(mockExecution.getVariable("DCVFMODVOLRBK_lcpCloudRegionId")).thenReturn(cloudRegionId)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegionId).queryParam("volume-group-name", volumeGroupName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegionId).queryParam("volume-group-name", volumeGroupName)
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId")
VolumeGroups groups = new VolumeGroups();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
index ddb1fbade4..22414b770e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
@@ -40,6 +40,7 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
@@ -160,7 +161,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
String lcpCloudRegionId = "lcpCloudRegionId"
when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName)
when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
VolumeGroups volumeGroups = new VolumeGroups();
VolumeGroup volumeGroup = new VolumeGroup()
volumeGroup.setVolumeGroupId("volumeGroupId")
@@ -176,7 +177,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
String lcpCloudRegionId = "lcpCloudRegionId"
when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName)
when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
when(client.get(VolumeGroup.class,uri)).thenReturn(Optional.empty())
thrown.expect(BpmnError.class)
doCreateVfModuleVolumeV2.callRESTQueryAAIVolGrpName(mockExecution,null)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
index f356845a1e..a8d07b696c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
@@ -44,6 +44,7 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
@@ -105,7 +106,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest {
List fqdnList = new ArrayList()
fqdnList.add("test")
when(mockExecution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
NetworkPolicies networkPolicies = new NetworkPolicies();
NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -127,7 +128,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest {
List fqdnList = new ArrayList()
fqdnList.add("test")
when(mockExecution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.empty())
deleteVfModuleFromVnf.deleteNetworkPoliciesFromAAI(mockExecution)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy
index b56e108faf..815b3a389c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy
@@ -47,6 +47,7 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
@@ -104,7 +105,7 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{
NetworkPolicy networkPolicy = new NetworkPolicy()
networkPolicy.setNetworkPolicyId("NP1")
networkPolicies.getNetworkPolicy().add(networkPolicy)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
doDeleteVfModule.deleteNetworkPoliciesFromAAI(mockExecution)
@@ -120,7 +121,7 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{
NetworkPolicy networkPolicy = new NetworkPolicy()
networkPolicy.setNetworkPolicyId("NP1")
networkPolicies.getNetworkPolicy().add(networkPolicy)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "NP1")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
index 289d97108f..05b0db5d25 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
@@ -33,8 +33,6 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn
index 24ca7104a7..5d523194bb 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn
@@ -1,15 +1,15 @@
<?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: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0">
<bpmn:process id="PNFSWUPDownload" name="PNFSWUPDownload" isExecutable="true">
<bpmn:startEvent id="download_StartEvent" name="Start Flow">
<bpmn:outgoing>SequenceFlow_1fdclh0</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="ServiceTask_1mpt2eq" name="NF Download Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}">
<bpmn:incoming>SequenceFlow_1fdclh0</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_12155q6</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0kusy70</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:endEvent id="download_EndEvent" name="End">
- <bpmn:incoming>SequenceFlow_1d2rfyx</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0mjjdia</bpmn:incoming>
<bpmn:terminateEventDefinition id="TerminateEventDefinition_1kiurmf" />
</bpmn:endEvent>
<bpmn:exclusiveGateway id="ExclusiveGateway_1ja7grm" default="SequenceFlow_078xmlz">
@@ -32,8 +32,8 @@
</bpmn:endEvent>
<bpmn:exclusiveGateway id="ExclusiveGateway_08lusga" default="SequenceFlow_1gawssm">
<bpmn:incoming>SequenceFlow_1kaikh5</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1d2rfyx</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_1gawssm</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1d2rfyx</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:endEvent id="EndEvent_11hee4g">
<bpmn:incoming>SequenceFlow_1gawssm</bpmn:incoming>
@@ -73,10 +73,7 @@
<bpmn:outgoing>SequenceFlow_1ccldpp</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1fdclh0" sourceRef="download_StartEvent" targetRef="ServiceTask_1mpt2eq" />
- <bpmn:sequenceFlow id="SequenceFlow_12155q6" sourceRef="ServiceTask_1mpt2eq" targetRef="ServiceTask_1nl90ao" />
- <bpmn:sequenceFlow id="SequenceFlow_1d2rfyx" name="Success" sourceRef="ExclusiveGateway_08lusga" targetRef="download_EndEvent">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_12155q6" sourceRef="ScriptTask_1ankfw8" targetRef="ServiceTask_1nl90ao" />
<bpmn:sequenceFlow id="SequenceFlow_0o6b6a8" sourceRef="ServiceTask_0yavde3" targetRef="ExclusiveGateway_1ja7grm" />
<bpmn:sequenceFlow id="SequenceFlow_078xmlz" name="Failure" sourceRef="ExclusiveGateway_1ja7grm" targetRef="EndEvent_1j64ij1" />
<bpmn:sequenceFlow id="SequenceFlow_1ccldpp" sourceRef="ServiceTask_1nl90ao" targetRef="ExclusiveGateway_1rj84ne" />
@@ -89,113 +86,229 @@
<bpmn:sequenceFlow id="SequenceFlow_0qznt4u" name="Success" sourceRef="ExclusiveGateway_1ja7grm" targetRef="ServiceTask_1wxo7xz">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
+ <bpmn:subProcess id="SubProcess_02e59i3" name="Subprocess for FalloutHandler" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_0uftj43" name="Catch All Errors">
+ <bpmn:outgoing>SequenceFlow_0swi04u</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_061iekb" />
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_1yzq4u7" name="Prepare FalloutHandler" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0swi04u</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ppn4a8</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0ikcgtm" name="Call FalloutHandler" calledElement="FalloutHandler">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_FalloutHandlerRequest" target="FalloutHandlerRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1ppn4a8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ahmdun</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_1xtb63b" name="End">
+ <bpmn:incoming>SequenceFlow_1ahmdun</bpmn:incoming>
+ <bpmn:terminateEventDefinition id="TerminateEventDefinition_1vngo0e" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1ahmdun" sourceRef="CallActivity_0ikcgtm" targetRef="EndEvent_1xtb63b" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ppn4a8" sourceRef="ScriptTask_1yzq4u7" targetRef="CallActivity_0ikcgtm" />
+ <bpmn:sequenceFlow id="SequenceFlow_0swi04u" sourceRef="StartEvent_0uftj43" targetRef="ScriptTask_1yzq4u7" />
+ </bpmn:subProcess>
+ <bpmn:scriptTask id="ScriptTask_1ankfw8" name="Send Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0kusy70</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12155q6</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.sendResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0kusy70" sourceRef="ServiceTask_1mpt2eq" targetRef="ScriptTask_1ankfw8" />
+ <bpmn:scriptTask id="ScriptTask_17f7m2t" name="Prepare Completion" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1d2rfyx</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_183s0wo</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0tq2dug" name="Complete Process" calledElement="CompleteMsoProcess">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_183s0wo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0mjjdia</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_183s0wo" sourceRef="ScriptTask_17f7m2t" targetRef="CallActivity_0tq2dug" />
+ <bpmn:sequenceFlow id="SequenceFlow_1d2rfyx" name="Success" sourceRef="ExclusiveGateway_08lusga" targetRef="ScriptTask_17f7m2t">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0mjjdia" sourceRef="CallActivity_0tq2dug" targetRef="download_EndEvent" />
</bpmn:process>
<bpmn:error id="Error_1q14dnd" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSWUPDownload">
<bpmndi:BPMNShape id="StartEvent_1k8gssq_di" bpmnElement="download_StartEvent">
- <dc:Bounds x="162" y="102" width="36" height="36" />
+ <dc:Bounds x="172" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="157" y="145" width="50" height="14" />
+ <dc:Bounds x="167" y="146" width="50" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1mpt2eq_di" bpmnElement="ServiceTask_1mpt2eq">
- <dc:Bounds x="280" y="80" width="100" height="80" />
+ <dc:Bounds x="270" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1e4dq7w_di" bpmnElement="download_EndEvent">
- <dc:Bounds x="1312" y="102" width="36" height="36" />
+ <dc:Bounds x="512" y="463" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1321" y="145" width="20" height="14" />
+ <dc:Bounds x="522" y="506" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1ja7grm_di" bpmnElement="ExclusiveGateway_1ja7grm" isMarkerVisible="true">
- <dc:Bounds x="895" y="95" width="50" height="50" />
+ <dc:Bounds x="615" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1j64ij1_di" bpmnElement="EndEvent_1j64ij1">
- <dc:Bounds x="902" y="252" width="36" height="36" />
+ <dc:Bounds x="622" y="344" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1rj84ne_di" bpmnElement="ExclusiveGateway_1rj84ne" isMarkerVisible="true">
- <dc:Bounds x="635" y="95" width="50" height="50" />
+ <dc:Bounds x="355" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1ubpef4_di" bpmnElement="EndEvent_1ubpef4">
- <dc:Bounds x="642" y="252" width="36" height="36" />
+ <dc:Bounds x="362" y="344" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_08lusga_di" bpmnElement="ExclusiveGateway_08lusga" isMarkerVisible="true">
- <dc:Bounds x="1155" y="95" width="50" height="50" />
+ <dc:Bounds x="875" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_11hee4g_di" bpmnElement="EndEvent_11hee4g">
- <dc:Bounds x="1162" y="252" width="36" height="36" />
+ <dc:Bounds x="882" y="344" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0yavde3_di" bpmnElement="ServiceTask_0yavde3">
- <dc:Bounds x="760" y="80" width="100" height="80" />
+ <dc:Bounds x="480" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1wxo7xz_di" bpmnElement="ServiceTask_1wxo7xz">
- <dc:Bounds x="1000" y="80" width="100" height="80" />
+ <dc:Bounds x="720" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1nl90ao_di" bpmnElement="ServiceTask_1nl90ao">
- <dc:Bounds x="480" y="80" width="100" height="80" />
+ <dc:Bounds x="200" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1fdclh0_di" bpmnElement="SequenceFlow_1fdclh0">
- <di:waypoint x="198" y="120" />
- <di:waypoint x="280" y="120" />
+ <di:waypoint x="208" y="121" />
+ <di:waypoint x="270" y="121" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_12155q6_di" bpmnElement="SequenceFlow_12155q6">
- <di:waypoint x="380" y="120" />
- <di:waypoint x="480" y="120" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx">
- <di:waypoint x="1205" y="120" />
- <di:waypoint x="1312" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1214" y="102" width="43" height="14" />
- </bpmndi:BPMNLabel>
+ <di:waypoint x="540" y="121" />
+ <di:waypoint x="570" y="121" />
+ <di:waypoint x="570" y="190" />
+ <di:waypoint x="160" y="190" />
+ <di:waypoint x="160" y="260" />
+ <di:waypoint x="200" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0o6b6a8_di" bpmnElement="SequenceFlow_0o6b6a8">
- <di:waypoint x="860" y="120" />
- <di:waypoint x="895" y="120" />
+ <di:waypoint x="580" y="260" />
+ <di:waypoint x="615" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_078xmlz_di" bpmnElement="SequenceFlow_078xmlz">
- <di:waypoint x="920" y="145" />
- <di:waypoint x="920" y="252" />
+ <di:waypoint x="640" y="285" />
+ <di:waypoint x="640" y="344" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="918" y="217" width="34" height="14" />
+ <dc:Bounds x="650" y="291" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ccldpp_di" bpmnElement="SequenceFlow_1ccldpp">
- <di:waypoint x="580" y="120" />
- <di:waypoint x="635" y="120" />
+ <di:waypoint x="300" y="260" />
+ <di:waypoint x="355" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0s6i4o9_di" bpmnElement="SequenceFlow_0s6i4o9">
- <di:waypoint x="685" y="120" />
- <di:waypoint x="760" y="120" />
+ <di:waypoint x="405" y="260" />
+ <di:waypoint x="480" y="260" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="678" y="102" width="43" height="14" />
+ <dc:Bounds x="398" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tfbzn1_di" bpmnElement="SequenceFlow_1tfbzn1">
- <di:waypoint x="660" y="145" />
- <di:waypoint x="660" y="252" />
+ <di:waypoint x="380" y="285" />
+ <di:waypoint x="380" y="344" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="658" y="217" width="34" height="14" />
+ <dc:Bounds x="384" y="292" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1kaikh5_di" bpmnElement="SequenceFlow_1kaikh5">
- <di:waypoint x="1100" y="120" />
- <di:waypoint x="1155" y="120" />
+ <di:waypoint x="820" y="260" />
+ <di:waypoint x="875" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1gawssm_di" bpmnElement="SequenceFlow_1gawssm">
- <di:waypoint x="1180" y="145" />
- <di:waypoint x="1180" y="252" />
+ <di:waypoint x="900" y="285" />
+ <di:waypoint x="900" y="344" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1178" y="172" width="34" height="14" />
+ <dc:Bounds x="912" y="290" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0qznt4u_di" bpmnElement="SequenceFlow_0qznt4u">
- <di:waypoint x="945" y="120" />
- <di:waypoint x="1000" y="120" />
+ <di:waypoint x="665" y="260" />
+ <di:waypoint x="720" y="260" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="671" y="242" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_02e59i3_di" bpmnElement="SubProcess_02e59i3" isExpanded="true">
+ <dc:Bounds x="190" y="580" width="650" height="190" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0uftj43_di" bpmnElement="StartEvent_0uftj43">
+ <dc:Bounds x="262" y="662" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="242" y="703" width="76" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1yzq4u7_di" bpmnElement="ScriptTask_1yzq4u7">
+ <dc:Bounds x="360" y="640" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0ikcgtm_di" bpmnElement="CallActivity_0ikcgtm">
+ <dc:Bounds x="530" y="640" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1xtb63b_di" bpmnElement="EndEvent_1xtb63b">
+ <dc:Bounds x="702" y="662" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="951" y="102" width="43" height="14" />
+ <dc:Bounds x="712" y="705" width="18" height="14" />
</bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ahmdun_di" bpmnElement="SequenceFlow_1ahmdun">
+ <di:waypoint x="630" y="680" />
+ <di:waypoint x="702" y="680" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ppn4a8_di" bpmnElement="SequenceFlow_1ppn4a8">
+ <di:waypoint x="460" y="680" />
+ <di:waypoint x="530" y="680" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0swi04u_di" bpmnElement="SequenceFlow_0swi04u">
+ <di:waypoint x="298" y="680" />
+ <di:waypoint x="360" y="680" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1ankfw8_di" bpmnElement="ScriptTask_1ankfw8">
+ <dc:Bounds x="440" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kusy70_di" bpmnElement="SequenceFlow_0kusy70">
+ <di:waypoint x="370" y="121" />
+ <di:waypoint x="440" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_17f7m2t_di" bpmnElement="ScriptTask_17f7m2t">
+ <dc:Bounds x="202" y="441" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0tq2dug_di" bpmnElement="CallActivity_0tq2dug">
+ <dc:Bounds x="355" y="441" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_183s0wo_di" bpmnElement="SequenceFlow_183s0wo">
+ <di:waypoint x="302" y="481" />
+ <di:waypoint x="355" y="481" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx">
+ <di:waypoint x="925" y="260" />
+ <di:waypoint x="970" y="260" />
+ <di:waypoint x="970" y="410" />
+ <di:waypoint x="160" y="410" />
+ <di:waypoint x="160" y="481" />
+ <di:waypoint x="202" y="481" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="938" y="242" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mjjdia_di" bpmnElement="SequenceFlow_0mjjdia">
+ <di:waypoint x="455" y="481" />
+ <di:waypoint x="512" y="481" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn
index 8d59dac8ac..4ff0af4549 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0">
<bpmn:process id="PNFSoftwareUpgrade" name="PNFSoftwareUpgrade" isExecutable="true">
<bpmn:startEvent id="softwareUpgrade_startEvent" name="Start Flow">
<bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing>
@@ -8,9 +8,9 @@
<bpmn:incoming>SequenceFlow_1ng4b6l</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_12ejx4m</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7n" targetRef="ServiceTask_0slpahe" />
+ <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7n" targetRef="ScriptTask_10klpg8" />
<bpmn:endEvent id="softwareUpgrade_endEvent" name="End">
- <bpmn:incoming>SequenceFlow_1atiydu</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0tle5zb</bpmn:incoming>
<bpmn:terminateEventDefinition />
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1ng4b6l" sourceRef="softwareUpgrade_startEvent" targetRef="ServiceTask_042uz7n" />
@@ -60,7 +60,7 @@
<bpmn:sequenceFlow id="SequenceFlow_1eljvek" name="Success" sourceRef="ExclusiveGateway_0v3l3wv" targetRef="ServiceTask_02lxf48">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_1atiydu" name="Success" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="softwareUpgrade_endEvent">
+ <bpmn:sequenceFlow id="SequenceFlow_1atiydu" name="Success" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="ScriptTask_1igtc83">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0eiif6e" name="Success" sourceRef="ExclusiveGateway_0ch3fef" targetRef="ServiceTask_1jo8vn7">
@@ -110,7 +110,7 @@
<camunda:inputParameter name="mode">async</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0ks3p41</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0j26xlx</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0j26xlx" sourceRef="ServiceTask_0slpahe" targetRef="ExclusiveGateway_0x6h0ni" />
@@ -119,9 +119,59 @@
<bpmn:outgoing>SequenceFlow_084orr1</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_084orr1" sourceRef="ServiceTask_1jo8vn7" targetRef="ServiceTask_0y2uysu" />
+ <bpmn:scriptTask id="ScriptTask_10klpg8" name="Send Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ks3p41</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.sendResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0ks3p41" sourceRef="ScriptTask_10klpg8" targetRef="ServiceTask_0slpahe" />
+ <bpmn:scriptTask id="ScriptTask_1igtc83" name="Prepare Completion" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1atiydu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ipc3nt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.prepareCompletion(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0ipc3nt" sourceRef="ScriptTask_1igtc83" targetRef="CallActivity_0o1mi8u" />
+ <bpmn:callActivity id="CallActivity_0o1mi8u" name="Complete Process" calledElement="CompleteMsoProcess">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0ipc3nt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0tle5zb</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_0tle5zb" sourceRef="CallActivity_0o1mi8u" targetRef="softwareUpgrade_endEvent" />
+ <bpmn:subProcess id="SubProcess_02p6q4s" name="Subprocess for FalloutHandler" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_149ecdm" name="Catch All Errors">
+ <bpmn:outgoing>SequenceFlow_05haut5</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1" />
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_0gov132" name="Prepare FalloutHandler" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_05haut5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_09y0mpc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_00psvtk" name="Call FalloutHandler" calledElement="FalloutHandler">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_FalloutHandlerRequest" target="FalloutHandlerRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_09y0mpc</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1tcjlty</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_1vq2glg" name="End">
+ <bpmn:incoming>SequenceFlow_1tcjlty</bpmn:incoming>
+ <bpmn:terminateEventDefinition id="TerminateEventDefinition_0994ojb" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_05haut5" sourceRef="StartEvent_149ecdm" targetRef="ScriptTask_0gov132" />
+ <bpmn:sequenceFlow id="SequenceFlow_09y0mpc" sourceRef="ScriptTask_0gov132" targetRef="CallActivity_00psvtk" />
+ <bpmn:sequenceFlow id="SequenceFlow_1tcjlty" sourceRef="CallActivity_00psvtk" targetRef="EndEvent_1vq2glg" />
+ </bpmn:subProcess>
</bpmn:process>
<bpmn:error id="Error_12cpov5" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
- <bpmn:error id="Error_0nmskzh" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSoftwareUpgrade">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="softwareUpgrade_startEvent">
@@ -131,142 +181,204 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_042uz7n_di" bpmnElement="ServiceTask_042uz7n">
- <dc:Bounds x="280" y="80" width="100" height="80" />
+ <dc:Bounds x="270" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m">
- <di:waypoint x="380" y="120" />
- <di:waypoint x="480" y="120" />
+ <di:waypoint x="370" y="120" />
+ <di:waypoint x="440" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1w3jv30_di" bpmnElement="softwareUpgrade_endEvent">
- <dc:Bounds x="1662" y="102" width="36" height="36" />
+ <dc:Bounds x="532" y="462" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1671" y="145" width="20" height="14" />
+ <dc:Bounds x="542" y="505" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l">
<di:waypoint x="198" y="120" />
- <di:waypoint x="280" y="120" />
+ <di:waypoint x="270" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0v3l3wv_di" bpmnElement="ExclusiveGateway_0v3l3wv" isMarkerVisible="true">
- <dc:Bounds x="895" y="95" width="50" height="50" />
+ <dc:Bounds x="615" y="235" width="50" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1040" y="65" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0bnbfds_di" bpmnElement="EndEvent_0bnbfds">
- <dc:Bounds x="902" y="252" width="36" height="36" />
+ <dc:Bounds x="622" y="342" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1044" y="295" width="34" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0x6h0ni_di" bpmnElement="ExclusiveGateway_0x6h0ni" isMarkerVisible="true">
- <dc:Bounds x="635" y="95" width="50" height="50" />
+ <dc:Bounds x="355" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1nsmyr5_di" bpmnElement="SequenceFlow_1nsmyr5">
- <di:waypoint x="685" y="120" />
- <di:waypoint x="760" y="120" />
+ <di:waypoint x="405" y="260" />
+ <di:waypoint x="460" y="260" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="678" y="102" width="43" height="14" />
+ <dc:Bounds x="408" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_180lm4y_di" bpmnElement="EndEvent_180lm4y">
- <dc:Bounds x="642" y="252" width="36" height="36" />
+ <dc:Bounds x="362" y="342" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91">
- <di:waypoint x="660" y="145" />
- <di:waypoint x="660" y="252" />
+ <di:waypoint x="380" y="285" />
+ <di:waypoint x="380" y="342" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="658" y="217" width="34" height="14" />
+ <dc:Bounds x="384" y="293" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1lr7vgu_di" bpmnElement="SequenceFlow_1lr7vgu">
- <di:waypoint x="920" y="145" />
- <di:waypoint x="920" y="252" />
+ <di:waypoint x="640" y="285" />
+ <di:waypoint x="640" y="342" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="918" y="217" width="34" height="14" />
+ <dc:Bounds x="644" y="293" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0ch3fef_di" bpmnElement="ExclusiveGateway_0ch3fef" isMarkerVisible="true">
- <dc:Bounds x="1125" y="95" width="50" height="50" />
+ <dc:Bounds x="845" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1ms4wdz_di" bpmnElement="EndEvent_1ms4wdz">
- <dc:Bounds x="1132" y="252" width="36" height="36" />
+ <dc:Bounds x="852" y="342" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0dqnb6c_di" bpmnElement="SequenceFlow_0dqnb6c">
- <di:waypoint x="1150" y="145" />
- <di:waypoint x="1150" y="252" />
+ <di:waypoint x="870" y="285" />
+ <di:waypoint x="870" y="342" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1148" y="230" width="34" height="14" />
+ <dc:Bounds x="874" y="293" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_1ny9b1z_di" bpmnElement="ExclusiveGateway_1ny9b1z" isMarkerVisible="true">
- <dc:Bounds x="1505" y="95" width="50" height="50" />
+ <dc:Bounds x="1225" y="235" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0l6n6x5_di" bpmnElement="EndEvent_0l6n6x5">
- <dc:Bounds x="1512" y="252" width="36" height="36" />
+ <dc:Bounds x="1232" y="342" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1p0axph_di" bpmnElement="SequenceFlow_1p0axph">
- <di:waypoint x="1530" y="145" />
- <di:waypoint x="1530" y="252" />
+ <di:waypoint x="1250" y="285" />
+ <di:waypoint x="1250" y="342" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1528" y="172" width="34" height="14" />
+ <dc:Bounds x="1254" y="293" width="32" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1eljvek_di" bpmnElement="SequenceFlow_1eljvek">
- <di:waypoint x="945" y="120" />
- <di:waypoint x="1010" y="120" />
+ <di:waypoint x="665" y="260" />
+ <di:waypoint x="720" y="260" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="938" y="102" width="43" height="14" />
+ <dc:Bounds x="668" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atiydu_di" bpmnElement="SequenceFlow_1atiydu">
- <di:waypoint x="1555" y="120" />
- <di:waypoint x="1662" y="120" />
+ <di:waypoint x="1275" y="260" />
+ <di:waypoint x="1320" y="260" />
+ <di:waypoint x="1320" y="410" />
+ <di:waypoint x="180" y="410" />
+ <di:waypoint x="180" y="480" />
+ <di:waypoint x="220" y="480" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1564" y="102" width="43" height="14" />
+ <dc:Bounds x="1277" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0eiif6e_di" bpmnElement="SequenceFlow_0eiif6e">
- <di:waypoint x="1175" y="120" />
- <di:waypoint x="1210" y="120" />
+ <di:waypoint x="895" y="260" />
+ <di:waypoint x="950" y="260" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1169" y="102" width="43" height="14" />
+ <dc:Bounds x="898" y="242" width="43" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0x5cje8_di" bpmnElement="ServiceTask_0x5cje8">
- <dc:Bounds x="760" y="80" width="100" height="80" />
+ <dc:Bounds x="460" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0cchgih_di" bpmnElement="SequenceFlow_0cchgih">
- <di:waypoint x="860" y="120" />
- <di:waypoint x="895" y="120" />
+ <di:waypoint x="560" y="260" />
+ <di:waypoint x="615" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_02lxf48_di" bpmnElement="ServiceTask_02lxf48">
- <dc:Bounds x="1010" y="80" width="100" height="80" />
+ <dc:Bounds x="720" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_015y785_di" bpmnElement="SequenceFlow_015y785">
- <di:waypoint x="1110" y="120" />
- <di:waypoint x="1125" y="120" />
+ <di:waypoint x="820" y="260" />
+ <di:waypoint x="845" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0y2uysu_di" bpmnElement="ServiceTask_0y2uysu">
- <dc:Bounds x="1370" y="80" width="100" height="80" />
+ <dc:Bounds x="1090" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0g3qcd0_di" bpmnElement="SequenceFlow_0g3qcd0">
- <di:waypoint x="1470" y="120" />
- <di:waypoint x="1505" y="120" />
+ <di:waypoint x="1190" y="260" />
+ <di:waypoint x="1225" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0slpahe_di" bpmnElement="ServiceTask_0slpahe">
- <dc:Bounds x="480" y="80" width="100" height="80" />
+ <dc:Bounds x="220" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx">
- <di:waypoint x="580" y="120" />
- <di:waypoint x="635" y="120" />
+ <di:waypoint x="320" y="260" />
+ <di:waypoint x="355" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1jo8vn7_di" bpmnElement="ServiceTask_1jo8vn7">
- <dc:Bounds x="1210" y="80" width="100" height="80" />
+ <dc:Bounds x="950" y="220" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_084orr1_di" bpmnElement="SequenceFlow_084orr1">
- <di:waypoint x="1310" y="120" />
- <di:waypoint x="1370" y="120" />
+ <di:waypoint x="1050" y="260" />
+ <di:waypoint x="1090" y="260" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_10klpg8_di" bpmnElement="ScriptTask_10klpg8">
+ <dc:Bounds x="440" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ks3p41_di" bpmnElement="SequenceFlow_0ks3p41">
+ <di:waypoint x="540" y="120" />
+ <di:waypoint x="570" y="120" />
+ <di:waypoint x="570" y="190" />
+ <di:waypoint x="180" y="190" />
+ <di:waypoint x="180" y="260" />
+ <di:waypoint x="220" y="260" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1igtc83_di" bpmnElement="ScriptTask_1igtc83">
+ <dc:Bounds x="220" y="440" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ipc3nt_di" bpmnElement="SequenceFlow_0ipc3nt">
+ <di:waypoint x="320" y="480" />
+ <di:waypoint x="380" y="480" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_0o1mi8u_di" bpmnElement="CallActivity_0o1mi8u">
+ <dc:Bounds x="380" y="440" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0tle5zb_di" bpmnElement="SequenceFlow_0tle5zb">
+ <di:waypoint x="480" y="480" />
+ <di:waypoint x="532" y="480" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0gov132_di" bpmnElement="ScriptTask_0gov132">
+ <dc:Bounds x="540" y="630" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_00psvtk_di" bpmnElement="CallActivity_00psvtk">
+ <dc:Bounds x="710" y="630" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1vq2glg_di" bpmnElement="EndEvent_1vq2glg">
+ <dc:Bounds x="882" y="652" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="892" y="695" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_09y0mpc_di" bpmnElement="SequenceFlow_09y0mpc">
+ <di:waypoint x="640" y="670" />
+ <di:waypoint x="710" y="670" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tcjlty_di" bpmnElement="SequenceFlow_1tcjlty">
+ <di:waypoint x="810" y="670" />
+ <di:waypoint x="882" y="670" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1r4h504_di" bpmnElement="StartEvent_149ecdm">
+ <dc:Bounds x="442" y="652" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="422" y="693" width="76" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_02p6q4s_di" bpmnElement="SubProcess_02p6q4s" isExpanded="true">
+ <dc:Bounds x="370" y="570" width="650" height="190" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05haut5_di" bpmnElement="SequenceFlow_05haut5">
+ <di:waypoint x="478" y="670" />
+ <di:waypoint x="540" y="670" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
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 1149cc9ea9..85fe3b4b29 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
@@ -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="3.1.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
<bpmn:process id="DoDeleteE2EServiceInstance" name="All Resources Deleted" isExecutable="true">
<bpmn:startEvent id="StartEvent_0212h2r" name="Start Flow">
<bpmn:outgoing>SequenceFlow_0vz7cd9</bpmn:outgoing>
@@ -131,6 +131,7 @@ dcsi.postDecomposeService(execution)</bpmn:script>
<camunda:in source="operationType" target="operationType" />
<camunda:in source="operationId" target="operationId" />
<camunda:in source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1j08ko3</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1cevtpy</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
index a9bf4352bf..2993ed6724 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,6 +61,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
private static final String TEST_PROCESSINSTANCE_KEY = "PNFSoftwareUpgrade";
private static final AAIVersion VERSION = AAIVersion.LATEST;
private static final Map<String, Object> executionVariables = new HashMap();
+ private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5";
private final String[] actionNames = new String[4];
private String requestObject;
private String responseObject;
@@ -80,6 +82,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
responseObject = FileUtil.readResourceFile("response/" + getClass().getSimpleName() + ".json");
executionVariables.put("bpmnRequest", requestObject);
+ executionVariables.put("requestId", REQUEST_ID);
/**
* This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}.
@@ -99,6 +102,7 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
public void workflow_validInput_expectedOutput() throws InterruptedException {
mockCatalogDb();
+ mockRequestDb();
mockAai();
final String msoRequestId = UUID.randomUUID().toString();
@@ -118,9 +122,9 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
// Layout is to reflect the bpmn visual layout
assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n",
- "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv",
- "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z",
- "softwareUpgrade_endEvent");
+ "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8",
+ "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu",
+ "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent");
List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
assertThat(detailedMessages.size() == 4);
@@ -202,6 +206,14 @@ public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
}
+ private void mockRequestDb() {
+ /**
+ * Update Request DB
+ */
+ wireMockServer.stubFor(put(urlEqualTo("/infraActiveRequests/" + REQUEST_ID)));
+
+ }
+
/**
* Mock the catalobdb rest interface.
*/
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index 14081960e6..47415240f9 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -78,7 +78,55 @@
<generateSupportingFiles>false</generateSupportingFiles>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.basedir}/target/generated-sources/src/gen/java/main</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[2.2.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<dependencyManagement>
<dependencies>
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 bbdcbf7ae3..a8eb791484 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
@@ -53,7 +53,7 @@ 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.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
@@ -690,7 +690,7 @@ public class AAICreateTasks {
if (fqdnCount > 0) {
for (int i = 0; i < fqdnCount; i++) {
String fqdn = fqdnList[i];
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy =
aaiNetworkResources.getNetworkPolicy(uri);
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 15f8c5e4ef..04f47e0306 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
@@ -39,7 +39,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
@@ -279,7 +279,7 @@ public class AAIDeleteTasks {
if (fqdnCount > 0) {
for (int i = 0; i < fqdnCount; i++) {
String fqdn = fqdnList[i];
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
uri.queryParam(networkPolicyFqdnParam, fqdn);
Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
if (oNetPolicies.isPresent()) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 33b60a9ed3..b6ab9d0ce6 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
@@ -45,9 +45,7 @@ import java.util.Map;
@Component
public class AAIUpdateTasks {
private static final Logger logger = LoggerFactory.getLogger(AAIUpdateTasks.class);
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
+
@Autowired
private AAIServiceInstanceResources aaiServiceInstanceResources;
@Autowired
@@ -128,68 +126,27 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of VolumeGroup to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedVolumeGroup(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- volumeGroup.setHeatStackId("");
- aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
- OrchestrationStatus.ASSIGNED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVolumeGroup", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVolumeGroup(execution, OrchestrationStatus.ASSIGNED);
}
/**
* BPMN access method to update status of VolumeGroup to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActiveVolumeGroup(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
- OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVolumeGroup", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVolumeGroup(execution, OrchestrationStatus.ACTIVE);
}
/**
* BPMN access method to update status of VolumeGroup to Created in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusCreatedVolumeGroup(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
- OrchestrationStatus.CREATED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVolumeGroup", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVolumeGroup(execution, OrchestrationStatus.CREATED);
}
/**
* BPMN access method to update HeatStackId and VolumeGroup in AAI
- *
- * @param execution
*/
public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
try {
@@ -211,87 +168,36 @@ public class AAIUpdateTasks {
/**
* 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);
- vfModule.setHeatStackId("");
- 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);
- }
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.ASSIGNED);
}
/**
* 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);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusPendingActivationVfModule", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.PENDING_ACTIVATION);
}
/**
- * BPMN access method to update status of VfModule to AssignedOrPendingActivation in AAI
- *
- * @param execution
+ * BPMN access method to update status of VfModule to Created in AAI
*/
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- vfModule.setHeatStackId("");
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (vnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
- if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- } else {
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
- }
- } catch (Exception ex) {
- logger.error(
- "Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedOrPendingActivationVfModule",
- ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.CREATED);
}
/**
- * BPMN access method to update status of VfModule to Created in AAI
- *
- * @param execution
+ * BPMN access method to update status of VfModule to Active in AAI
*/
- 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);
- }
+ public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
+ execution.setVariable("aaiActivateVfModuleRollback", false);
+ updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.ACTIVE);
+ execution.setVariable("aaiActivateVfModuleRollback", true);
}
/**
* BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule
- *
- * @param execution
*/
public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeactivateVfModuleRollback", false);
@@ -308,9 +214,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Assigned in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusAssignedNetwork(BuildingBlockExecution execution) {
updateNetwork(execution, OrchestrationStatus.ASSIGNED);
@@ -318,9 +221,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Active in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
updateNetwork(execution, OrchestrationStatus.ACTIVE);
@@ -328,9 +228,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Created in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
updateNetwork(execution, OrchestrationStatus.CREATED);
@@ -365,9 +262,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network Collection to Active in AAI
- *
- * @param execution
- * @throws BBObjectNotFoundException
*/
public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) {
execution.setVariable("aaiNetworkCollectionActivateRollback", false);
@@ -388,27 +282,7 @@ public class AAIUpdateTasks {
}
/**
- * BPMN access method to update status of VfModule to Active in AAI
- *
- * @param execution
- */
- public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
- execution.setVariable("aaiActivateVfModuleRollback", false);
- try {
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
- execution.setVariable("aaiActivateVfModuleRollback", true);
- } catch (Exception ex) {
- 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 {
@@ -428,9 +302,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network after it was created in cloud
- *
- * @param execution
- * @throws Exception
*/
public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
execution.setVariable("aaiNetworkActivateRollback", false);
@@ -472,9 +343,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network after it was updated in cloud
- *
- * @param execution
- * @throws Exception
*/
public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
@@ -502,8 +370,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network Object
- *
- * @param execution
*/
public void updateObjectNetwork(BuildingBlockExecution execution) {
try {
@@ -517,8 +383,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ServiceInstance
- *
- * @param execution
*/
public void updateServiceInstance(BuildingBlockExecution execution) {
try {
@@ -533,8 +397,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update Vnf Object
- *
- * @param execution
*/
public void updateObjectVnf(BuildingBlockExecution execution) {
try {
@@ -548,8 +410,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of VfModuleRollback as true
- *
- * @param execution
*/
public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeleteVfModuleRollback", false);
@@ -557,9 +417,6 @@ public class AAIUpdateTasks {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
vfModule.setHeatStackId("");
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
-
- VfModule copiedVfModule = vfModule.shallowCopyId();
- copiedVfModule.setHeatStackId("");
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiDeleteVfModuleRollback", true);
} catch (Exception ex) {
@@ -570,8 +427,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update Model of VfModule
- *
- * @param execution
*/
public void updateModelVfModule(BuildingBlockExecution execution) {
try {
@@ -586,8 +441,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of FabricConfiguration to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) {
try {
@@ -602,8 +455,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of FabricConfiguration to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
try {
@@ -618,8 +469,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of FabricConfiguration to deactive in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
try {
@@ -635,8 +484,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update Ipv4OamAddress of Vnf
- *
- * @param execution
*/
public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
try {
@@ -658,8 +505,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ManagementV6Address of Vnf
- *
- * @param execution
*/
public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
try {
@@ -681,8 +526,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ContrailServiceInstanceFqdn of VfModule
- *
- * @param execution
*/
public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
try {
@@ -701,8 +544,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of Vnf to ConfigAssigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
try {
@@ -716,79 +557,16 @@ public class AAIUpdateTasks {
/**
* 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);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURE);
}
/**
* 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);
- }
- }
-
- /**
- * BPMN access method to update status of VNF/VF-Module based on SO scope and action.
- *
- * @param execution - BuildingBlockExecution
- * @param scope - SO scope (vnf/vfModule)
- * @param action - action (configAssign/configDeploy/configUndeploy etc..)
- */
- public void updateOrchestrationStatusForCds(BuildingBlockExecution execution, String scope, String action) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- OrchestrationStatus status = getOrchestrationStatus(action);
- switch (scope) {
- case "vnf":
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, status);
- break;
- case "vfModule":
- VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status);
- break;
- default:
- throw new IllegalArgumentException(
- "Invalid scope to update orchestration status for CDS : " + action);
- }
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusForCds", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
- private OrchestrationStatus getOrchestrationStatus(String action) {
- /**
- * At this state, OrcherstationStatus enum associated with configAssign and configDeploy. I am not sure which is
- * the correct approach. 1. Are we going to map each specific action to OrchestrationStauts ? 2. We will have
- * only one generic status for all actions ?
- */
-
- switch (action) {
- case "configAssign":
- return OrchestrationStatus.ASSIGNED;
- case "configDeploy":
- return OrchestrationStatus.CONFIGURED;
- default:
- throw new IllegalArgumentException("Invalid action to set Orchestration status: " + action);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURED);
}
private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) {
@@ -824,4 +602,34 @@ public class AAIUpdateTasks {
}
}
+ private void updateOrchestrationStatusForVolumeGroup(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ if (status.equals(OrchestrationStatus.ASSIGNED)) {
+ volumeGroup.setHeatStackId("");
+ }
+ aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup,
+ execution.getGeneralBuildingBlock().getCloudRegion(), status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for "
+ + "volume group", status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private void updateOrchestrationStatusForVfModule(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ if (status.equals(OrchestrationStatus.ASSIGNED)) {
+ vfModule.setHeatStackId("");
+ }
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status);
+ } catch (Exception ex) {
+ logger.error(
+ "Exception occurred in AAIUpdateTasks during update orchestration status to {} for " + "vf module",
+ status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
index 9697246b03..9c55d0a922 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
@@ -1,7 +1,9 @@
package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
@@ -29,6 +31,8 @@ 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;
@Component
public class AppcOrchestratorPreProcessor {
@@ -84,8 +88,16 @@ public class AppcOrchestratorPreProcessor {
appcTaskRequest.setNewSoftwareVersion(newSoftwareVersion);
String operationsTimeout = JsonUtils.getJsonValue(payload, "operations_timeout");
appcTaskRequest.setOperationsTimeout(operationsTimeout);
- }
+ Map<String, String> configMap = new HashMap<>();
+ ObjectMapper objectMapper = new ObjectMapper();
+ String configParamsStr = JsonUtils.getJsonValue(payload, "configuration_parameters");
+ if (configParamsStr != null) {
+ configMap =
+ objectMapper.readValue(configParamsStr, new TypeReference<HashMap<String, String>>() {});
+ }
+ appcTaskRequest.setConfigParams(configMap);
+ }
ControllerSelectionReference controllerSelectionReference = catalogDbClient
.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
String controllerType = null;
@@ -229,8 +241,13 @@ public class AppcOrchestratorPreProcessor {
.isEmpty()) {
errorMessage = "APPC action Snapshot is missing vserverId parameter. ";
}
- break;
}
+ break;
+ case ConfigModify:
+ if (appcTaskRequest.getConfigParams().isEmpty() || appcTaskRequest.getConfigParams() == null) {
+ errorMessage = "APPC action ConfigModify is missing Configuration parameters. ";
+ }
+ break;
default:
break;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
index ed865e058f..ea3405d423 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix
- * Modifications Copyright (C) 2020 Huawei
+ * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,10 +26,11 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Component;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants;
import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.client.sdnc.common.SDNCConstants;
import org.onap.so.client.sdnc.lcm.*;
import org.onap.so.client.sdnc.lcm.beans.*;
@@ -60,26 +61,20 @@ public class SdncControllerDE extends LcmControllerDE {
logger.debug("Running activity for id: {}, name: {}", execution.getCurrentActivityId(),
execution.getCurrentActivityName());
- boolean result;
try {
LcmInput lcmInput = buildLcmInput(execution);
- if (lcmInput != null) {
- result = sendLcmRequest(execution, lcmInput);
- } else {
- logger.error("Build LCM Input error");
- result = false;
- }
- } catch (Exception e) {
- logger.error("Call SDNC LCM Client failure: ", e);
- result = false;
- }
+ sendLcmRequest(execution, lcmInput);
- if (result) {
execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Success");
- } else {
+ } catch (Exception e) {
execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Failure");
+
+ exceptionUtil.buildAndThrowWorkflowException(execution, SDNC_DELEGATE_EXECUTION_ERROR_CODE, e);
}
+ logger.debug("Finish activity for id: {}, name: {}", execution.getCurrentActivityId(),
+ execution.getCurrentActivityName());
+
return 0;
}
@@ -88,49 +83,57 @@ public class SdncControllerDE extends LcmControllerDE {
return SDNC_DELEGATE_EXECUTION_ERROR_CODE;
}
- private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) {
+ private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) throws BadResponseException {
SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder();
SDNCLcmRestClient sdncLcmRestClient;
try {
sdncLcmRestClient = sdncLcmClientBuilder.newSDNCLcmRestClient(operation);
} catch (SDNCLcmClientBuilderException e) {
logger.error("Create SDNCLcmRestClient error: ", e);
- return null;
+ throw new BadResponseException("Can not send request to SDNC.");
}
- return sdncLcmRestClient.sendRequest(lcmInput);
+ LcmOutput lcmOutput;
+ try {
+ lcmOutput = sdncLcmRestClient.sendRequest(lcmInput);
+ } catch (Exception e) {
+ logger.error("SDNCLcmRestClient sends request failure: ", e);
+ throw new BadResponseException("Send request to SDNC failure.");
+ }
+ return lcmOutput;
}
private LcmOutput selectLcmOutputFromDmaapResponses(List<LcmDmaapResponse> lcmDmaapResponses, LcmInput lcmInput) {
- String expectedCorrelationId =
- lcmInput.getCommonHeader().getRequestId() + "-" + lcmInput.getCommonHeader().getSubRequestId();
+ String requestId = lcmInput.getCommonHeader().getRequestId();
+ String subRequestId = lcmInput.getCommonHeader().getSubRequestId();
for (LcmDmaapResponse lcmDmaapResponse : lcmDmaapResponses) {
- String correlationId = lcmDmaapResponse.getCorrelationId();
- if (expectedCorrelationId.equals(correlationId)) {
- return lcmDmaapResponse.getBody().getOutput();
+ LcmOutput lcmOutput = lcmDmaapResponse.getBody().getOutput();
+ if (requestId.equals(lcmOutput.getCommonHeader().getRequestId())
+ && subRequestId.equals(lcmOutput.getCommonHeader().getSubRequestId())) {
+ return lcmOutput;
}
}
return null;
}
- private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) {
+ private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) throws BadResponseException {
SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder();
SDNCLcmDmaapClient sdncLcmDmaapClient;
try {
sdncLcmDmaapClient = sdncLcmClientBuilder.newSDNCLcmDmaapClient();
} catch (SDNCLcmClientBuilderException e) {
logger.error("Create SDNCLcmDmaapClient error: ", e);
- return null;
+ throw new BadResponseException("Can not send request to SDNC.");
}
LcmDmaapRequest lcmDmaapRequest = SDNCLcmMessageBuilder.buildLcmDmaapRequest(operation, lcmInput);
try {
sdncLcmDmaapClient.sendRequest(lcmDmaapRequest);
} catch (Exception e) {
- logger.error("SDNCLcmDmaapClient sends request error: ", e);
- return null;
+ logger.error("SDNCLcmDmaapClient sends request failure: ", e);
+ throw new BadResponseException("Send request to SDNC failure.");
}
long timeout = sdncLcmClientBuilder.getSDNCLcmProperties().getActionTimeout();
@@ -146,8 +149,9 @@ public class SdncControllerDE extends LcmControllerDE {
long stopTime = System.currentTimeMillis();
if ((stopTime - startTime) > timeout) {
- logger.error("Timeout for SDNC LCM action {}", lcmInput.getAction());
- return null;
+ String msg = "Timeout for SDNC LCM action " + lcmInput.getAction();
+ logger.error(msg);
+ throw new BadResponseException(msg);
}
}
}
@@ -158,7 +162,15 @@ public class SdncControllerDE extends LcmControllerDE {
return lcmAction.replaceAll(regex, replacement).toLowerCase();
}
- private LcmInput buildLcmInput(DelegateExecution execution) throws JsonProcessingException {
+ private String convertToSting(Object msgObject) throws PayloadGenerationException {
+ try {
+ return SDNCLcmPayloadBuilder.convertToSting(msgObject);
+ } catch (JsonProcessingException e) {
+ throw new PayloadGenerationException(e.getMessage());
+ }
+ }
+
+ private LcmInput buildLcmInput(DelegateExecution execution) throws PayloadGenerationException {
String requestId = String.valueOf(execution.getVariable(REQUEST_ID));
String requestAction = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION));
String pnfName = String.valueOf(execution.getVariable(PNF_CORRELATION_ID));
@@ -176,78 +188,67 @@ public class SdncControllerDE extends LcmControllerDE {
UpgradePreCheckPayload upgradePreCheckPayload;
upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload);
+ lcmPayload = convertToSting(upgradePreCheckPayload);
break;
case SoPropertyConstants.ACTION_DOWNLOAD_N_E_SW:
lcmAction = SDNCLcmActionConstants.DOWNLOAD_N_E_SW;
DownloadNESwPayload downloadNESwPayload;
downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload);
+ lcmPayload = convertToSting(downloadNESwPayload);
break;
case SoPropertyConstants.ACTION_ACTIVATE_N_E_SW:
lcmAction = SDNCLcmActionConstants.ACTIVATE_N_E_SW;
ActivateNESwPayload activateNESwPayload;
activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload);
+ lcmPayload = convertToSting(activateNESwPayload);
break;
case SoPropertyConstants.ACTION_POST_CHECK:
lcmAction = SDNCLcmActionConstants.UPGRADE_POST_CHECK;
UpgradePostCheckPayload upgradePostCheckPayload;
upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution);
- lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload);
+ lcmPayload = convertToSting(upgradePostCheckPayload);
break;
default:
- logger.error("Unsupported SO Action: " + requestAction);
- return null;
+ String msg = "Unsupported SO Action: " + requestAction;
+ logger.error(msg);
+ throw new PayloadGenerationException(msg);
}
- logger.debug("SDNC LCM payload for {}: {}", lcmAction, lcmPayload);
-
String subRequestId = UUID.randomUUID().toString();
LcmInput lcmInput =
SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, lcmAction, lcmPayload);
ObjectMapper mapper = new ObjectMapper();
- String lcmInputMsg = mapper.writeValueAsString(lcmInput);
- logger.debug("SDNC input message:\n" + lcmInputMsg);
+ try {
+ String lcmInputMsg = mapper.writeValueAsString(lcmInput);
+ logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg);
+ } catch (JsonProcessingException e) {
+ throw new PayloadGenerationException(e.getMessage());
+ }
return lcmInput;
}
- private boolean parseLcmOutput(LcmOutput lcmOutput, String lcmAction) {
- if (lcmOutput == null) {
- logger.error("Call SDNC LCM API failure");
- return false;
- }
-
+ private void parseLcmOutput(LcmOutput lcmOutput, String lcmAction) throws BadResponseException {
LcmStatus lcmStatus = lcmOutput.getStatus();
+ int lcmStatusCode = lcmStatus.getCode();
+ String outputPayload = lcmOutput.getPayload();
- if (lcmStatus.getCode() == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) {
- logger.debug("Call SDNC LCM API success: " + lcmStatus.getMessage());
+ if (lcmStatusCode == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) {
+ logger.debug("Call SDNC LCM API for {} success, code: {}, message: {}, payload: {}", lcmAction,
+ lcmStatusCode, lcmStatus.getMessage(), outputPayload);
} else {
- logger.error("Call SDNC LCM API failure: " + lcmStatus.getMessage());
- }
-
- String outputPayload = lcmOutput.getPayload();
- logger.debug("SDNC LCM action: {}, result: {}", lcmAction, outputPayload);
- if (outputPayload != null) {
- String result = JsonUtils.getJsonValue(outputPayload, "result");
- if ("Success".equals(result)) {
- logger.debug("Run SDNC LCM action {} success", lcmAction);
- return true;
- } else {
- String reason = JsonUtils.getJsonValue(outputPayload, "reason");
- logger.error("Run SDNC LCM action {} failure, reason: {}", lcmAction, reason);
- }
+ String msg = String.format("Call SDNC LCM API for %s failure, code: %d, message: %s, payload: %s",
+ lcmAction, lcmStatusCode, lcmStatus.getMessage(), outputPayload);
+ logger.error(msg);
+ throw new BadResponseException(msg);
}
-
- return false;
}
- private boolean sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) {
+ private void sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) throws BadResponseException {
String actionMode = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION_MODE));
String lcmOperation = toLowerHyphen(lcmInput.getAction());
@@ -258,6 +259,6 @@ public class SdncControllerDE extends LcmControllerDE {
lcmOutput = sendSyncRequest(lcmOperation, lcmInput);
}
- return parseLcmOutput(lcmOutput, lcmInput.getAction());
+ parseLcmOutput(lcmOutput, lcmInput.getAction());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
new file mode 100644
index 0000000000..a1e513fd47
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
@@ -0,0 +1,166 @@
+/*
+ * ============LICENSE_START======================================================= Copyright (C) 2020 Nokia. All rights
+ * reserved. ================================================================================ Licensed under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import com.google.gson.JsonObject;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.cds.PayloadConstants;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.UUID;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION;
+import static org.onap.so.client.cds.PayloadConstants.RESOLUTION_KEY;
+import static org.onap.so.client.cds.PayloadConstants.REQUEST;
+import static org.onap.so.client.cds.PayloadConstants.SEPARATOR;
+import static org.onap.so.client.cds.PayloadConstants.PROPERTIES;
+
+@Component
+public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<BuildingBlockExecution> {
+
+ private static final Logger logger = LoggerFactory.getLogger(GenericPnfCDSControllerRunnableBB.class);
+ private static final String EXECUTION_OBJECT = "executionObject";
+ private static final String ORIGINATOR_ID = "SO";
+ private static final String BUILDING_BLOCK = "buildingBlock";
+ private static final String DEFAULT_SYNC_MODE = "sync";
+ private static final String MSO_REQUEST_ID = "msoRequestId";
+
+ private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils;
+ private ExtractPojosForBB extractPojosForBB;
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ public GenericPnfCDSControllerRunnableBB(AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils,
+ ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) {
+ this.abstractCDSProcessingBBUtils = abstractCDSProcessingBBUtils;
+ this.extractPojosForBB = extractPojosForBB;
+ this.exceptionBuilder = exceptionBuilder;
+ }
+
+ @Override
+ public Boolean understand(ControllerContext<BuildingBlockExecution> controllerContext) {
+ return PayloadConstants.CDS_ACTOR.equalsIgnoreCase(controllerContext.getControllerActor())
+ && PayloadConstants.PNF_SCOPE.equalsIgnoreCase(controllerContext.getControllerScope());
+ }
+
+ @Override
+ public Boolean ready(ControllerContext<BuildingBlockExecution> controllerContext) {
+ return true;
+ }
+
+ @Override
+ public void prepare(ControllerContext<BuildingBlockExecution> controllerContext) {
+ BuildingBlockExecution buildingBlockExecution = controllerContext.getExecution();
+ final AbstractCDSPropertiesBean abstractCDSPropertiesBean =
+ prepareAndSetCdsPropertyBean(buildingBlockExecution);
+
+ buildingBlockExecution.setVariable(EXECUTION_OBJECT, abstractCDSPropertiesBean);
+ }
+
+ @Override
+ public void run(ControllerContext<BuildingBlockExecution> controllerContext) {
+ BuildingBlockExecution buildingBlockExecution = controllerContext.getExecution();
+ abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(buildingBlockExecution);
+ abstractCDSProcessingBBUtils.sendRequestToCDSClient(buildingBlockExecution);
+ }
+
+ private AbstractCDSPropertiesBean prepareAndSetCdsPropertyBean(BuildingBlockExecution buildingBlockExecution) {
+ final AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+ final String action = getAction(buildingBlockExecution);
+
+ if (action == null) {
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, "Action is null!",
+ ONAPComponents.SO);
+ }
+
+ abstractCDSPropertiesBean.setRequestObject(this.buildRequestPayload(action, buildingBlockExecution));
+ abstractCDSPropertiesBean.setBlueprintName(buildingBlockExecution.getVariable(PRC_BLUEPRINT_NAME));
+ abstractCDSPropertiesBean.setBlueprintVersion(buildingBlockExecution.getVariable(PRC_BLUEPRINT_VERSION));
+ abstractCDSPropertiesBean.setRequestId(buildingBlockExecution.getVariable(MSO_REQUEST_ID));
+ abstractCDSPropertiesBean.setOriginatorId(ORIGINATOR_ID);
+ abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
+ abstractCDSPropertiesBean.setActionName(action);
+ abstractCDSPropertiesBean.setMode(DEFAULT_SYNC_MODE);
+ return abstractCDSPropertiesBean;
+ }
+
+ private String buildRequestPayload(String action, BuildingBlockExecution execution) {
+ final JsonObject pnfObject = new JsonObject();
+ String resolutionKey = null;
+ try {
+ final Pnf pnf = getPnf(execution);
+ final ServiceInstance serviceInstance = getServiceInstance(execution);
+ resolutionKey = pnf.getPnfName();
+
+ setExecutionVariable("service-instance-id", serviceInstance.getServiceInstanceId(), pnfObject);
+ setExecutionVariable("service-model-uuid", serviceInstance.getModelInfoServiceInstance().getModelUuid(),
+ pnfObject);
+ setExecutionVariable("pnf-id", pnf.getPnfId(), pnfObject);
+ setExecutionVariable("pnf-name", resolutionKey, pnfObject);
+ setExecutionVariable("pnf-customization-uuid", pnf.getModelInfoPnf().getModelCustomizationUuid(),
+ pnfObject);
+
+ } catch (BBObjectNotFoundException exception) {
+ logger.error("An exception occurred when creating payload for CDS request", exception);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, exception);
+ }
+ final JsonObject cdsPropertyObject = new JsonObject();
+ cdsPropertyObject.addProperty(RESOLUTION_KEY, resolutionKey);
+ cdsPropertyObject.add(action + SEPARATOR + PROPERTIES, pnfObject);
+
+ return buildRequestJsonObject(cdsPropertyObject, action);
+ }
+
+ private String buildRequestJsonObject(JsonObject cdsPropertyObject, String action) {
+ String requestBasedOnAction = action.concat(SEPARATOR).concat(REQUEST);
+ JsonObject requestObject = new JsonObject();
+ requestObject.add(requestBasedOnAction, cdsPropertyObject);
+ return requestObject.toString();
+ }
+
+ private void setExecutionVariable(String jsonProperty, String executionProperty, JsonObject pnfObject) {
+ if (executionProperty != null) {
+ pnfObject.addProperty(jsonProperty, executionProperty);
+ }
+ }
+
+ private String getAction(BuildingBlockExecution buildingBlockExecution) {
+ ExecuteBuildingBlock executeBuildingBlock = buildingBlockExecution.getVariable(BUILDING_BLOCK);
+ return executeBuildingBlock.getBuildingBlock().getBpmnAction();
+ }
+
+ private Pnf getPnf(BuildingBlockExecution buildingBlockExecution) throws BBObjectNotFoundException {
+ return extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.PNF);
+ }
+
+ private ServiceInstance getServiceInstance(BuildingBlockExecution buildingBlockExecution)
+ throws BBObjectNotFoundException {
+ return extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java
index d5423b2ff7..aa74074cf6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java
@@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
-import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
import org.onap.so.client.cds.GeneratePayloadForCds;
import org.onap.so.client.cds.PayloadConstants;
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 d9f5e65ba3..cdba6e0e2f 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
@@ -173,7 +173,7 @@ public class ManualHandlingTasks {
taskVariables.put(TASK_VARIABLE_DESCRIPTION, description);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
- taskService.setVariables(taskId, taskVariables);
+ taskService.setVariablesLocal(taskId, taskVariables);
logger.debug("successfully created fallout task: " + taskId);
} catch (BpmnError e) {
logger.debug(BPMN_EXCEPTION + e.getMessage());
@@ -223,7 +223,7 @@ public class ManualHandlingTasks {
taskVariables.put(TASK_VARIABLE_VALID_RESPONSES, validResponses);
TaskService taskService = execution.getProcessEngineServices().getTaskService();
- taskService.setVariables(taskId, taskVariables);
+ taskService.setVariablesLocal(taskId, taskVariables);
logger.debug("successfully created pause task: " + taskId);
} catch (BpmnError e) {
logger.debug(BPMN_EXCEPTION + e.getMessage());
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 f8a4d910f4..eead1761ea 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
@@ -169,12 +169,7 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- 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 createInstanceAction = "createInstance";
@@ -183,40 +178,34 @@ public class WorkflowAction {
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<>();
List<Resource> resourceList = new ArrayList<>();
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
+ execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
try {
- ObjectMapper mapper = new ObjectMapper();
- execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
- ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
+ ServiceInstancesRequest sIRequest =
+ new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- boolean suppressRollback = false;
- try {
- suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
- } catch (Exception ex) {
- logger.warn("Exception in getSuppressRollback", ex);
- suppressRollback = false;
- }
- execution.setVariable("suppressRollback", suppressRollback);
- boolean isResume = false;
- if (isUriResume(uri)) {
- isResume = true;
- if (!aLaCarte) {
- logger.debug("replacing URI {}", uri);
- uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
- logger.debug("for RESUME with original value {}", uri);
- }
+ execution.setVariable("suppressRollback", requestDetails.getRequestInfo().getSuppressRollback());
+ String uri = (String) execution.getVariable(BBConstants.G_URI);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+ boolean isResume = isUriResume(uri);
+ if (!aLaCarte && isResume) {
+ 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 = "";
+ final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction)
&& sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
@@ -230,7 +219,7 @@ public class WorkflowAction {
}
execution.setVariable("resourceId", resourceId);
execution.setVariable("resourceType", resourceType);
-
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) {
flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
if (flowsToExecute == null) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index 9de8e184f2..614401d32a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -22,18 +22,33 @@
package org.onap.so.client.aai.mapper;
-import org.modelmapper.ModelMapper;
-import org.modelmapper.PropertyMap;
-import org.onap.aai.domain.yang.RouteTargets;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
-import org.springframework.stereotype.Component;
import java.util.List;
import org.modelmapper.Converter;
+import org.modelmapper.ModelMapper;
+import org.modelmapper.PropertyMap;
import org.modelmapper.spi.MappingContext;
+import org.onap.aai.domain.yang.RouteTargets;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget;
import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.springframework.stereotype.Component;
@Component
public class AAIObjectMapper {
@@ -46,6 +61,7 @@ public class AAIObjectMapper {
protected void configure() {
map().setServiceType(source.getModelInfoServiceInstance().getServiceType());
map().setServiceRole(source.getModelInfoServiceInstance().getServiceRole());
+ map().setServiceFunction(source.getModelInfoServiceInstance().getServiceFunction());
map().setModelInvariantId(source.getModelInfoServiceInstance().getModelInvariantUuid());
map().setModelVersionId(source.getModelInfoServiceInstance().getModelUuid());
map().setEnvironmentContext(source.getModelInfoServiceInstance().getEnvironmentContext());
@@ -178,6 +194,7 @@ public class AAIObjectMapper {
private Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets> convertSubnets =
new Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets>() {
+ @Override
public org.onap.aai.domain.yang.Subnets convert(
MappingContext<List<Subnet>, org.onap.aai.domain.yang.Subnets> context) {
return mapToAAISubNets(context.getSource());
@@ -186,6 +203,7 @@ public class AAIObjectMapper {
private Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> convertCtagAssignments =
new Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments>() {
+ @Override
public org.onap.aai.domain.yang.CtagAssignments convert(
MappingContext<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> context) {
return mapToAAICtagAssignmentList(context.getSource());
@@ -194,6 +212,7 @@ public class AAIObjectMapper {
private Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> convertSegmentationAssignments =
new Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments>() {
+ @Override
public org.onap.aai.domain.yang.SegmentationAssignments convert(
MappingContext<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> context) {
return mapToAAISegmentationAssignmentList(context.getSource());
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 8b939940fa..47be2f5bd6 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,7 +24,6 @@ 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;
@@ -239,10 +238,4 @@ public class AAIConfigurationResources {
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/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
index 296d052315..12c1d5572f 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
@@ -28,6 +28,7 @@ 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.AAIPluralResourceUri;
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;
@@ -87,7 +88,7 @@ public class AAIInstanceGroupResources {
}
public boolean checkInstanceGroupNameInUse(String instanceGroupName) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri 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 3af65815a6..f040627155 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
@@ -38,6 +38,8 @@ 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;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -103,11 +105,11 @@ public class AAINetworkResources {
return injectionHelper.getAaiClient().get(netBindingUri.depth(Depth.TWO)).asBean(VpnBinding.class);
}
- public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
+ public Optional<NetworkPolicy> getNetworkPolicy(AAIBaseResourceUri netPolicyUri) {
return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
}
- public Optional<NetworkPolicies> getNetworkPolicies(AAIResourceUri netPoliciesUri) {
+ public Optional<NetworkPolicies> getNetworkPolicies(AAIBaseResourceUri netPoliciesUri) {
return injectionHelper.getAaiClient().get(netPoliciesUri).asBean(NetworkPolicies.class);
}
@@ -227,7 +229,7 @@ public class AAINetworkResources {
}
public boolean checkNetworkNameInUse(String networkName) {
- AAIResourceUri uri =
+ AAIPluralResourceUri 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 9b104f3250..0879e24bfb 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
@@ -35,6 +35,7 @@ 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.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -115,7 +116,7 @@ public class AAIServiceInstanceResources {
}
public boolean existsOwningEntityName(String owningEntityName) {
- AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
+ AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
.queryParam("owning-entity-name", owningEntityName);
AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
return aaiRC.exists(owningEntityUri);
@@ -123,7 +124,7 @@ public class AAIServiceInstanceResources {
public org.onap.aai.domain.yang.OwningEntity getOwningEntityByName(String owningEntityName)
throws AAIEntityNotFoundException {
- AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
+ AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
.queryParam("owning-entity-name", owningEntityName);
AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
Optional<OwningEntities> owningEntities = aaiRC.get(OwningEntities.class, owningEntityUri);
@@ -178,7 +179,7 @@ public class AAIServiceInstanceResources {
}
public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) {
- AAIResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri 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 4d1a6dce38..f750cf2453 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,7 +23,6 @@
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;
@@ -31,13 +30,11 @@ 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.AAIPluralResourceUri;
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;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -114,9 +111,9 @@ public class AAIVfModuleResources {
public boolean checkNameInUse(VfModule vfModule) {
boolean nameInUse = false;
- AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
.queryParam("vf-module-name", vfModule.getVfModuleName());
- AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
if (injectionHelper.getAaiClient().exists(vfModuleUriWithCustomization)) {
// assume it's a resume case and return false
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 7ad74a6d86..cd0a584218 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
@@ -36,6 +36,7 @@ import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
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;
@@ -159,7 +160,7 @@ public class AAIVnfResources {
}
public boolean checkNameInUse(String vnfName) {
- AAIResourceUri vnfUri =
+ AAIPluralResourceUri vnfUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
return injectionHelper.getAaiClient().exists(vnfUri);
}
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 b9e4aeb888..152dd0dad2 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
@@ -28,12 +28,11 @@ 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.AAIPluralResourceUri;
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;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -96,7 +95,7 @@ public class AAIVolumeGroupResources {
}
public boolean checkNameInUse(VolumeGroup volumeGroup) {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri 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 168d370521..4cdb5adfd4 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
@@ -27,6 +27,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
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.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -55,7 +56,7 @@ public class AAIVpnBindingResources {
* @return
*/
public Optional<VpnBindings> getVpnBindingByCustomerVpnId(String customerVpnId) {
- AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING)
+ AAIPluralResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING)
.queryParam("customer-vpn-id", customerVpnId);
return injectionHelper.getAaiClient().get(VpnBindings.class, aaiVpnBindingsResourceUri);
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 a8f47fc763..6f96331e7f 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
@@ -64,6 +64,7 @@ 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.AAIBaseResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -586,7 +587,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
execution.setVariable("heatStackId", "testHeatStackId");
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
NetworkPolicy networkPolicy = new NetworkPolicy();
- doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+ doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIBaseResourceUri.class));
doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class));
aaiCreateTasks.createNetworkPolicies(execution);
verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
index 855d935ae1..41589af067 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -40,7 +40,6 @@ import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.onap.aai.domain.yang.NetworkPolicies;
-import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -53,7 +52,7 @@ 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.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
@@ -223,7 +222,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
NetworkPolicies networkPolicies1 = aaiResultWrapper1.asBean(NetworkPolicies.class).get();
doReturn(Optional.of(networkPolicies0), Optional.of(networkPolicies1)).when(aaiNetworkResources)
- .getNetworkPolicies(any(AAIResourceUri.class));
+ .getNetworkPolicies(any(AAIBaseResourceUri.class));
doNothing().when(aaiNetworkResources).deleteNetworkPolicy(any(String.class));
aaiDeleteTasks.deleteNetworkPolicies(execution);
verify(aaiNetworkResources, times(2)).deleteNetworkPolicy(stringCaptor.capture());
@@ -235,7 +234,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
public void deleteNetworkPolicyNeedToDeleteNoneTest() throws Exception {
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
Optional<NetworkPolicies> networkPolicies = Optional.empty();
- doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIResourceUri.class));
+ doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIBaseResourceUri.class));
aaiDeleteTasks.deleteNetworkPolicies(execution);
verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index e26009a1de..e5b003a437 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
@@ -40,7 +40,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
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.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import java.util.HashMap;
@@ -258,60 +257,6 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
}
@Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleNoMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("false");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleMultiStageButNotAlacarteTest()
- throws Exception {
- execution.setVariable("aLaCarte", false);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleWithMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleExceptionTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
- genericVnf, OrchestrationStatus.ASSIGNED);
-
- expectedException.expect(BpmnError.class);
-
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- }
-
- @Test
public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CREATED);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
index c78b652bd0..ea1f7b47ad 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
@@ -45,6 +45,7 @@ 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.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
@@ -163,4 +164,46 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
genericVnf.setIpv4OamAddress("127.0.0.1");
return genericVnf;
}
+
+ @Test
+ public void buildAppcTaskRequestConfigModifyTest() throws Exception {
+ final String expectedRequestJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "appcTaskRequestConfigModify.json")));
+ ApplicationControllerTaskRequest expectedTaskRequest =
+ mapper.readValue(expectedRequestJson, ApplicationControllerTaskRequest.class);
+ execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "-TEST");
+ fillRequiredAppcExecutionFieldsConfigModify();
+ GenericVnf genericVnf = getTestGenericVnf();
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ mockReferenceResponseForConfigModify();
+ execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("VF-MODULE-ID");
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ appcOrchestratorPreProcessor.buildAppcTaskRequest(execution, "ConfigModify");
+ ApplicationControllerTaskRequest actualTaskRequest = execution.getVariable("appcOrchestratorRequest");
+ assertThat(actualTaskRequest, sameBeanAs(expectedTaskRequest));
+ }
+
+ private void fillRequiredAppcExecutionFieldsConfigModify() {
+ RequestContext context = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setPayload(
+ "{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}");
+ context.setRequestParameters(requestParameters);
+ context.setMsoRequestId("TEST-MSO-ID");
+ execution.setVariable("aicIdentity", "AIC-TEST");
+ execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
+ execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
+ execution.setVariable("identityUrl", "IDENTITY-URL-TEST");
+ execution.getGeneralBuildingBlock().setRequestContext(context);
+ }
+
+ private void mockReferenceResponseForConfigModify() {
+ ControllerSelectionReference reference = new ControllerSelectionReference();
+ reference.setControllerName("APPC");
+ when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(eq("TEST-VNF-TYPE"),
+ eq(Action.ConfigModify.toString()))).thenReturn(reference);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
new file mode 100644
index 0000000000..d6a28cba25
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
@@ -0,0 +1,156 @@
+/*
+ * ============LICENSE_START======================================================= Copyright (C) 2020 Nokia. All rights
+ * reserved. ================================================================================ Licensed under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
+import org.json.JSONObject;
+import org.junit.Before;
+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.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+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.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.EXECUTION_OBJECT;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION;
+import static org.onap.so.client.cds.PayloadConstants.SCOPE;
+
+@RunWith(MockitoJUnitRunner.class)
+public class GenericPnfCDSControllerRunnableBBTest {
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+
+ @InjectMocks
+ private GenericPnfCDSControllerRunnableBB genericPnfCDSControllerRunnableBB;
+
+ private ControllerContext<BuildingBlockExecution> controllerContext;
+ private BuildingBlockExecution execution;
+
+ private final static String blueprintName = "blueprint_name";
+ private final static String blueprintVersion = "blueprint_version";
+ private final static String msoRequestId = "mso_request_id";
+ private final static String pnfID = "5df8b6de-2083-11e7-93ae-92361f002671";
+ private final static String serviceInstanceID = "test_service_id";
+ private final static String pnfName = "PNFDemo";
+ private final static String serviceModelUUID = "6bc0b04d-1873-4721-b53d-6615225b2a28";
+ private final static String pnfCustomizationUUID = "9acb3a83-8a52-412c-9a45-901764938144";
+ private final static String action = "action";
+
+ @Before
+ public void setUp() {
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+
+ buildingBlock.setBpmnAction(action);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+
+ execution = new DelegateExecutionImpl(new ExecutionImpl());
+ execution.setVariable("buildingBlock", executeBuildingBlock);
+ execution.setVariable(PRC_BLUEPRINT_NAME, blueprintName);
+ execution.setVariable(PRC_BLUEPRINT_VERSION, blueprintVersion);
+ execution.setVariable(MSO_REQUEST_ID, msoRequestId);
+ execution.setVariable(SCOPE, "scope");
+
+ controllerContext = new ControllerContext<>();
+ controllerContext.setExecution(execution);
+ }
+
+ @Test
+ public void understandTest() {
+ // given
+ controllerContext.setControllerScope("pnf");
+ controllerContext.setControllerActor("cds");
+
+ // when, then
+ assertTrue(genericPnfCDSControllerRunnableBB.understand(controllerContext));
+ }
+
+ @Test
+ public void readyTest() {
+ // when, then
+ assertTrue(genericPnfCDSControllerRunnableBB.ready(controllerContext));
+ }
+
+ @Test
+ public void prepareTest() throws BBObjectNotFoundException {
+ // given
+ prepareData();
+
+ // when
+ genericPnfCDSControllerRunnableBB.prepare(controllerContext);
+
+ // then
+ final AbstractCDSPropertiesBean abstractCDSPropertiesBean = execution.getVariable(EXECUTION_OBJECT);
+ final JSONObject actionProperties = new JSONObject(abstractCDSPropertiesBean.getRequestObject())
+ .getJSONObject("action-request").getJSONObject("action-properties");
+
+ assertThat(abstractCDSPropertiesBean).isNotNull();
+ assertThat(abstractCDSPropertiesBean.getRequestObject()).isNotNull();
+ assertThat(abstractCDSPropertiesBean.getRequestObject()).isInstanceOf(String.class);
+
+ assertEquals(blueprintName, abstractCDSPropertiesBean.getBlueprintName());
+ assertEquals(blueprintVersion, abstractCDSPropertiesBean.getBlueprintVersion());
+ assertEquals(msoRequestId, abstractCDSPropertiesBean.getRequestId());
+ assertEquals(action, abstractCDSPropertiesBean.getActionName());
+ assertEquals("sync", abstractCDSPropertiesBean.getMode());
+ assertEquals("SO", abstractCDSPropertiesBean.getOriginatorId());
+
+ assertEquals(pnfID, actionProperties.get("pnf-id"));
+ assertEquals(serviceInstanceID, actionProperties.get("service-instance-id"));
+ assertEquals(serviceModelUUID, actionProperties.get("service-model-uuid"));
+ assertEquals(pnfName, actionProperties.get("pnf-name"));
+ assertEquals(pnfCustomizationUUID, actionProperties.get("pnf-customization-uuid"));
+ }
+
+ private void prepareData() throws BBObjectNotFoundException {
+ Pnf pnf = new Pnf();
+ ServiceInstance serviceInstance = new ServiceInstance();
+
+ pnf.setPnfName(pnfName);
+ pnf.setPnfId(pnfID);
+ ModelInfoPnf modelInfoPnf = new ModelInfoPnf();
+ modelInfoPnf.setModelCustomizationUuid(pnfCustomizationUUID);
+ pnf.setModelInfoPnf(modelInfoPnf);
+
+ serviceInstance.setServiceInstanceId(serviceInstanceID);
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelUuid(serviceModelUUID);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.PNF))).thenReturn(pnf);
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java
index 583e139edd..ae5f4370e6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java
@@ -20,7 +20,6 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
-import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
@@ -33,9 +32,6 @@ import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
import org.onap.so.client.cds.GeneratePayloadForCds;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
-import org.onap.so.client.exception.ExceptionBuilder;
-import org.skyscreamer.jsonassert.JSONAssert;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import java.util.Arrays;
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 b6dcd96534..e3bbd11cc4 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
@@ -100,7 +100,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
when(processEngineServices.getTaskService()).thenReturn(taskService);
manualHandlingTasks.setFalloutTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class));
}
@Test
@@ -110,7 +110,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
when(processEngineServices.getTaskService()).thenReturn(taskService);
manualHandlingTasks.setPauseTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index dc64e4ee48..1e58a83f0a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -138,6 +138,7 @@ public class AAIObjectMapperTest {
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setServiceType("SITYPE");
modelInfoServiceInstance.setServiceRole("SIROLE");
+ modelInfoServiceInstance.setServiceFunction("SIFUNCTION");
modelInfoServiceInstance.setModelInvariantUuid("MIUUID");
modelInfoServiceInstance.setModelUuid("MUUID");
modelInfoServiceInstance.setEnvironmentContext("EC");
@@ -163,6 +164,8 @@ public class AAIObjectMapperTest {
serviceInstance.getModelInfoServiceInstance().getEnvironmentContext());
assertEquals(AAIServiceInstance.getWorkloadContext(),
serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
+ assertEquals(AAIServiceInstance.getServiceFunction(),
+ serviceInstance.getModelInfoServiceInstance().getServiceFunction());
}
@Test
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 9855c8587a..8b08afdb44 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
@@ -20,8 +20,6 @@
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;
@@ -37,8 +35,8 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
@@ -46,7 +44,6 @@ 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;
@@ -54,7 +51,6 @@ 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;
-import org.onap.so.bpmn.common.data.TestDataSetup;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -242,22 +238,4 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
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 cb5683d9d8..0995af058e 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
@@ -20,11 +20,10 @@
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.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
@@ -37,8 +36,8 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -46,10 +45,10 @@ 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;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
-import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@@ -136,7 +135,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
.queryParam("instance-group-name", "instanceGroupName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
@@ -145,7 +144,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
.queryParam("instance-group-name", "instanceGroupName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
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 b6161d7669..e744e7d0df 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
@@ -61,6 +61,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -203,11 +204,11 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty();
- AAIResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
- doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIPluralResourceUri.class));
oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri);
- verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIPluralResourceUri.class));
if (oNetPolicies.isPresent()) {
org.onap.aai.domain.yang.NetworkPolicies networkPolicies = oNetPolicies.get();
assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicies.class).get(),
@@ -428,7 +429,7 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIResourceUri uri =
+ AAIPluralResourceUri uri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
@@ -437,7 +438,7 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIResourceUri uri =
+ AAIPluralResourceUri uri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
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 ea98ee0169..d2a1f77922 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
@@ -24,8 +24,8 @@ 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.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
@@ -39,8 +39,8 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
@@ -48,6 +48,7 @@ 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.AAIPluralResourceUri;
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;
@@ -194,7 +195,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseTrueTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri 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);
@@ -203,7 +204,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseFalseTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri 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);
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 9e3bc4f552..7bae50a0a9 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
@@ -38,14 +38,15 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
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.AAIPluralResourceUri;
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;
@@ -162,9 +163,9 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() throws Exception {
- AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
.queryParam("vf-module-name", vfModule.getVfModuleName());
- AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ AAIPluralResourceUri 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));
@@ -174,9 +175,9 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseIsResumeTest() throws Exception {
- AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
.queryParam("vf-module-name", vfModule.getVfModuleName());
- AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
boolean nameInUse = aaiVfModuleResources.checkNameInUse(vfModule);
@@ -185,9 +186,9 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() throws Exception {
- AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
.queryParam("vf-module-name", vfModule.getVfModuleName());
- AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ AAIPluralResourceUri 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));
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 425b595686..b1bacb8add 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
@@ -43,8 +43,8 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
@@ -56,6 +56,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
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;
@@ -243,7 +244,7 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIResourceUri vnfUri =
+ AAIPluralResourceUri vnfUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
@@ -252,7 +253,7 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIResourceUri vnfUri =
+ AAIPluralResourceUri vnfUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
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 5772cab995..31a0e34a26 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
@@ -37,14 +37,14 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
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.AAIPluralResourceUri;
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;
@@ -155,7 +155,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
@@ -164,7 +164,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
index 0cbdee396f..2688b33e51 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
@@ -37,6 +37,7 @@ import org.onap.aai.domain.yang.VpnBindings;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -90,12 +91,12 @@ public class AAIVpnBindingResourcesTest extends BaseTaskTest {
@Test
public void getVpnBindingByCustomerVpnIdTest() {
- when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class), isA(AAIResourceUri.class)))
+ when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class), isA(AAIPluralResourceUri.class)))
.thenReturn(Optional.of(new VpnBindings()));
Optional<VpnBindings> vpnBindings = aaiVpnBindingResources.getVpnBindingByCustomerVpnId("testCustomerVpnId");
assertNotNull(vpnBindings.get());
verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.VpnBindings.class),
- isA(AAIResourceUri.class));
+ isA(AAIPluralResourceUri.class));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
new file mode 100644
index 0000000000..040c680d1c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
@@ -0,0 +1,13 @@
+{
+ "ApplicationControllerTaskRequest": {
+ "controllerType": "APPC",
+ "action": "ConfigModify",
+ "identityUrl": "IDENTITY-URL-TEST",
+ "applicationControllerVnf": {
+ "vnfId": "TEST-VNF-ID",
+ "vnfName": "TEST-VNF-NAME",
+ "vnfHostIpAddress": "127.0.0.1"
+ },
+ "configParams": {"name1":"value1", "name2":"value2"}
+}
+}
diff --git a/common/pom.xml b/common/pom.xml
index 02d2f35545..d373d620cd 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -16,7 +16,7 @@
<protobuf.version>3.6.1</protobuf.version>
<grpc.netty.version>4.1.30.Final</grpc.netty.version>
<ccsdk.version>0.4.2</ccsdk.version>
- <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
+ <appc.client.version>1.7.1-SNAPSHOT</appc.client.version>
</properties>
<dependencies>
@@ -59,7 +59,7 @@
<dependency>
<groupId>org.onap.aai.schema-service</groupId>
<artifactId>aai-schema</artifactId>
- <version>1.6.4-SNAPSHOT</version>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
diff --git a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
index 3811b52551..c240957ae9 100644
--- a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
+++ b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
@@ -1,6 +1,8 @@
package org.onap.so.appc.orchestrator.service.beans;
import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf;
@@ -18,6 +20,15 @@ public class ApplicationControllerTaskRequest implements Serializable {
private String existingSoftwareVersion;
private String newSoftwareVersion;
private ApplicationControllerVnf applicationControllerVnf;
+ private Map<String, String> configParams = new HashMap<String, String>();
+
+ public Map<String, String> getConfigParams() {
+ return configParams;
+ }
+
+ public void setConfigParams(Map<String, String> configParams) {
+ this.configParams = configParams;
+ }
public Action getAction() {
return action;
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 077ba24c2b..30389de742 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -188,8 +188,7 @@ public abstract class RestClient {
client.register(new PayloadLoggingClientFilter(this.getMaxPayloadSize()));
}
CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider();
- client.register(new JacksonJsonProvider(provider.getMapper()));
-
+ client.register(provider).register(new JacksonJsonProvider(provider.getMapper()));
metricLogClientFilter = new SOMetricLogClientFilter();
mdcSetup.setTargetEntity(getTargetEntity());
client.register(metricLogClientFilter);
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 a1e0d7c102..d376d85a83 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.entities.uri.GraphInventoryUri;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,14 +45,15 @@ public class AAIClient extends GraphInventoryClient {
}
@Override
- protected URI constructPath(GraphInventoryUri uri) {
+ protected URI constructPath(URI uri) {
- return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.build().toString()).build();
+ return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.toString()).build();
}
@Override
- public RestClient createClient(GraphInventoryUri uri) {
+ protected RestClient createClient(URI uri) {
try {
+
return new AAIRestClient(getRestProperties(), constructPath(uri));
} catch (GraphInventoryUriComputationException | NotFoundException e) {
logger.debug("failed to construct A&AI uri", e);
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java
new file mode 100644
index 0000000000..dab3cda32b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java
@@ -0,0 +1,7 @@
+package org.onap.so.client.aai;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+
+public interface AAIObjectBase extends GraphInventoryObjectBase {
+
+}
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 e42a2a2383..d14a4bedc3 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
@@ -25,63 +25,64 @@ import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
import org.onap.so.constants.Defaults;
import com.google.common.base.CaseFormat;
-public class AAIObjectPlurals implements GraphInventoryObjectPlurals, Serializable {
+public class AAIObjectPlurals implements AAIObjectBase, GraphInventoryObjectPlurals, Serializable {
private static final long serialVersionUID = 5312713297525740746L;
public static final AAIObjectPlurals CUSTOMER =
- new AAIObjectPlurals(AAINamespaceConstants.BUSINESS, "/customers", "customer");
+ new AAIObjectPlurals(AAIObjectType.CUSTOMER, AAINamespaceConstants.BUSINESS, "/customers");
public static final AAIObjectPlurals GENERIC_VNF =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnf");
+ new AAIObjectPlurals(AAIObjectType.GENERIC_VNF, AAINamespaceConstants.NETWORK, "/generic-vnfs");
public static final AAIObjectPlurals PORT_GROUP =
- new AAIObjectPlurals(AAIObjectType.VCE.uriTemplate(), "/port-groups", "port-group");
+ new AAIObjectPlurals(AAIObjectType.PORT_GROUP, AAIObjectType.VCE.uriTemplate(), "/port-groups");
public static final AAIObjectPlurals PSERVER =
- new AAIObjectPlurals(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers", "pserver");
+ new AAIObjectPlurals(AAIObjectType.PSERVER, AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
public static final AAIObjectPlurals P_INTERFACE =
- new AAIObjectPlurals(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces", "p-interface");
+ new AAIObjectPlurals(AAIObjectType.P_INTERFACE, AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces");
public static final AAIObjectPlurals L3_NETWORK =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/l3-networks", "l3-network");
+ new AAIObjectPlurals(AAIObjectType.L3_NETWORK, AAINamespaceConstants.NETWORK, "/l3-networks");
public static final AAIObjectPlurals NETWORK_POLICY =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/network-policies", "network-policy");
+ new AAIObjectPlurals(AAIObjectType.NETWORK_POLICY, AAINamespaceConstants.NETWORK, "/network-policies");
public static final AAIObjectPlurals VPN_BINDING =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/vpn-bindings", "vpn-binding");
- public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(
- AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions", "service-subscription");
- public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(
- AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances", "service-instance");
+ new AAIObjectPlurals(AAIObjectType.VPN_BINDING, AAINamespaceConstants.NETWORK, "/vpn-bindings");
+ public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(AAIObjectType.SERVICE_SUBSCRIPTION,
+ AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions");
+ public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(AAIObjectType.SERVICE_INSTANCE,
+ AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances");
public static final AAIObjectPlurals OWNING_ENTITY =
- new AAIObjectPlurals(AAINamespaceConstants.BUSINESS, "/owning-entities", "owning-entity");
- public static final AAIObjectPlurals VOLUME_GROUP =
- new AAIObjectPlurals(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups", "volume-group");
- public static final AAIObjectPlurals AVAILIBILITY_ZONE =
- new AAIObjectPlurals(AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones", "availability-zone");
+ new AAIObjectPlurals(AAIObjectType.OWNING_ENTITY, AAINamespaceConstants.BUSINESS, "/owning-entities");
+ public static final AAIObjectPlurals VOLUME_GROUP = new AAIObjectPlurals(AAIObjectType.VOLUME_GROUP,
+ AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups");
+ public static final AAIObjectPlurals AVAILIBILITY_ZONE = new AAIObjectPlurals(AAIObjectType.AVAILIBILITY_ZONE,
+ AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones");
public static final AAIObjectPlurals VF_MODULE =
- new AAIObjectPlurals(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules", "vf-module");
+ new AAIObjectPlurals(AAIObjectType.VF_MODULE, AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules");
public static final AAIObjectPlurals CONFIGURATION =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/configurations", "configuration");
+ new AAIObjectPlurals(AAIObjectType.CONFIGURATION, AAINamespaceConstants.NETWORK, "/configurations");
public static final AAIObjectPlurals DEFAULT_TENANT =
- new AAIObjectPlurals(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/"
- + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants", "default-tenant");
- public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(
- AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies", "network-technology");
+ new AAIObjectPlurals(AAIObjectType.DEFAULT_TENANT, AAINamespaceConstants.CLOUD_INFRASTRUCTURE
+ + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants");
+ public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(AAIObjectType.NETWORK_TECHNOLOGY,
+ AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies");
public static final AAIObjectPlurals LOGICAL_LINK =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/logical-links", "logical-link");
+ new AAIObjectPlurals(AAIObjectType.LOGICAL_LINK, AAINamespaceConstants.NETWORK, "/logical-links");
public static final AAIObjectPlurals L_INTERFACE =
- new AAIObjectPlurals(AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces", "l-interface");
+ new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces");
public static final AAIObjectPlurals SUB_L_INTERFACE =
- new AAIObjectPlurals(AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces", "l-interface");
+ new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces");
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");
+ new AAIObjectPlurals(AAIObjectType.INSTANCE_GROUP, AAINamespaceConstants.NETWORK, "/instance-groups");
+ public static final AAIObjectPlurals PNF =
+ new AAIObjectPlurals(AAIObjectType.PNF, AAINamespaceConstants.NETWORK, "/pnfs");
private final String uriTemplate;
private final String partialUri;
- private final String name;
+ private final AAIObjectType type;
- protected AAIObjectPlurals(String parentUri, String partialUri, String name) {
+ protected AAIObjectPlurals(AAIObjectType type, String parentUri, String partialUri) {
this.uriTemplate = parentUri + partialUri;
this.partialUri = partialUri;
- this.name = name;
+ this.type = type;
}
@Override
@@ -100,12 +101,17 @@ public class AAIObjectPlurals implements GraphInventoryObjectPlurals, Serializab
}
@Override
+ public AAIObjectType getType() {
+ return this.type;
+ }
+
+ @Override
public String typeName() {
- return this.typeName(CaseFormat.LOWER_HYPHEN);
+ return this.getType().typeName();
}
@Override
public String typeName(CaseFormat format) {
- return CaseFormat.LOWER_HYPHEN.to(format, this.name);
+ return this.getType().typeName(format);
}
}
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 7de60181a6..c9b69cd9e4 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
@@ -22,7 +22,58 @@ package org.onap.so.client.aai;
import com.google.common.base.CaseFormat;
import org.onap.aai.annotations.Metadata;
-import org.onap.aai.domain.yang.*;
+import org.onap.aai.domain.yang.AggregateRoute;
+import org.onap.aai.domain.yang.AllottedResource;
+import org.onap.aai.domain.yang.AvailabilityZone;
+import org.onap.aai.domain.yang.CloudRegion;
+import org.onap.aai.domain.yang.Collection;
+import org.onap.aai.domain.yang.CommunicationServiceProfile;
+import org.onap.aai.domain.yang.Complex;
+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.EsrVnfm;
+import org.onap.aai.domain.yang.ExtAaiNetwork;
+import org.onap.aai.domain.yang.Flavor;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Image;
+import org.onap.aai.domain.yang.InstanceGroup;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.LInterface;
+import org.onap.aai.domain.yang.LineOfBusiness;
+import org.onap.aai.domain.yang.LogicalLink;
+import org.onap.aai.domain.yang.ModelVer;
+import org.onap.aai.domain.yang.NetworkPolicy;
+import org.onap.aai.domain.yang.NetworkTechnology;
+import org.onap.aai.domain.yang.OperationalEnvironment;
+import org.onap.aai.domain.yang.OwningEntity;
+import org.onap.aai.domain.yang.PInterface;
+import org.onap.aai.domain.yang.PhysicalLink;
+import org.onap.aai.domain.yang.Platform;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.aai.domain.yang.PortGroup;
+import org.onap.aai.domain.yang.Project;
+import org.onap.aai.domain.yang.Pserver;
+import org.onap.aai.domain.yang.RouteTableReference;
+import org.onap.aai.domain.yang.Service;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.ServiceProfile;
+import org.onap.aai.domain.yang.ServiceSubscription;
+import org.onap.aai.domain.yang.SliceProfile;
+import org.onap.aai.domain.yang.SpPartner;
+import org.onap.aai.domain.yang.SriovPf;
+import org.onap.aai.domain.yang.Subnet;
+import org.onap.aai.domain.yang.Tenant;
+import org.onap.aai.domain.yang.TunnelXconnect;
+import org.onap.aai.domain.yang.Vce;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VlanTag;
+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;
@@ -36,7 +87,7 @@ import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
-public class AAIObjectType implements GraphInventoryObjectType, Serializable {
+public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, Serializable {
private static final long serialVersionUID = -2877184776691514600L;
private static Map<String, AAIObjectType> map = new HashMap<>();
@@ -109,6 +160,8 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), PInterface.class);
public static final AAIObjectType SRIOV_PF =
new AAIObjectType(AAIObjectType.P_INTERFACE.uriTemplate(), SriovPf.class);
+ public static final AAIObjectType LOGICAL_LINK =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, LogicalLink.class);
public static final AAIObjectType PHYSICAL_LINK =
new AAIObjectType(AAINamespaceConstants.NETWORK, PhysicalLink.class);
public static final AAIObjectType INSTANCE_GROUP =
@@ -135,7 +188,15 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class);
public static final AAIObjectType FLAVOR =
new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class);
- public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown");
+ public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown") {
+
+ private static final long serialVersionUID = 9208984071038447607L;
+
+ @Override
+ public boolean passThrough() {
+ return true;
+ }
+ };
public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl");
public static final AAIObjectType VNFM = new AAIObjectType(
AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list/esr-vnfm/{vnfm-id}", EsrVnfm.class);
@@ -147,6 +208,8 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
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);
+ public static final AAIObjectType AVAILIBILITY_ZONE =
+ new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), AvailabilityZone.class);
public static final AAIObjectType THIRDPARTY_SDNC_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM,
"/esr-thirdparty-sdnc-list", "thirdparty-sdnc-list");
public static final AAIObjectType THIRDPARTY_SDNC_SYSTEM_INFO_LIST =
@@ -180,12 +243,13 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
new Reflections(new ConfigurationBuilder().setUrls(packages).setScanners(new SubTypesScanner()));
Set<Class<? extends AAIObjectType>> resources = r.getSubTypesOf(AAIObjectType.class);
- try {
- for (Class<? extends AAIObjectType> customTypeClass : resources) {
- AAIObjectType customType;
+
+ for (Class<? extends AAIObjectType> customTypeClass : resources) {
+ AAIObjectType customType;
+ try {
customType = customTypeClass.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
}
- } catch (InstantiationException | IllegalAccessException e) {
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
index a89bea6975..8e334de396 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
@@ -24,13 +24,14 @@ import java.util.Optional;
import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.graphinventory.GraphInventoryResourcesClient;
import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
-import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
public class AAIResourcesClient extends
- GraphInventoryResourcesClient<AAIResourcesClient, AAIResourceUri, AAIEdgeLabel, AAIResultWrapper, AAITransactionalClient, AAISingleTransactionClient> {
+ GraphInventoryResourcesClient<AAIResourcesClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIPluralResourceUri, AAIEdgeLabel, AAIResultWrapper, AAITransactionalClient, AAISingleTransactionClient> {
private AAIClient aaiClient;
@@ -55,6 +56,11 @@ public class AAIResourcesClient extends
}
@Override
+ public AAIResultWrapper createWrapper(Object obj) {
+ return new AAIResultWrapper(obj);
+ }
+
+ @Override
public AAITransactionalClient beginTransaction() {
return new AAITransactionalClient(this, aaiClient);
}
@@ -65,17 +71,17 @@ public class AAIResourcesClient extends
}
@Override
- protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
+ protected Relationship buildRelationship(AAIResourceUri uri) {
return super.buildRelationship(uri, Optional.empty());
}
@Override
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
+ protected Relationship buildRelationship(AAIResourceUri uri, GraphInventoryEdgeLabel label) {
return super.buildRelationship(uri, Optional.of(label));
}
@Override
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
+ protected Relationship buildRelationship(AAIResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
return super.buildRelationship(uri, label);
}
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 3f9715bdef..b1d29f445b 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
@@ -32,6 +32,7 @@ import org.onap.so.client.aai.entities.singletransaction.OperationBodyRequest;
import org.onap.so.client.aai.entities.singletransaction.OperationBodyResponse;
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest;
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
@@ -40,8 +41,8 @@ import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Joiner;
-public class AAISingleTransactionClient
- extends GraphInventoryTransactionClient<AAISingleTransactionClient, AAIResourceUri, AAIEdgeLabel> {
+public class AAISingleTransactionClient extends
+ GraphInventoryTransactionClient<AAISingleTransactionClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> {
private final SingleTransactionRequest request;
private AAIResourcesClient resourcesClient;
@@ -137,12 +138,12 @@ public class AAISingleTransactionClient
}
@Override
- protected <T> Optional<T> get(GenericType<T> genericType, AAIResourceUri clone) {
+ protected <T> Optional<T> get(GenericType<T> genericType, AAIBaseResourceUri<?, ?> clone) {
return resourcesClient.get(genericType, clone);
}
@Override
- protected boolean exists(AAIResourceUri uri) {
+ protected boolean exists(AAIBaseResourceUri<?, ?> uri) {
return resourcesClient.exists(uri);
}
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 e621566e5a..7b7dccc999 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
@@ -35,6 +35,7 @@ import org.onap.so.client.aai.entities.AAIError;
import org.onap.so.client.aai.entities.bulkprocess.OperationBody;
import org.onap.so.client.aai.entities.bulkprocess.Transaction;
import org.onap.so.client.aai.entities.bulkprocess.Transactions;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
@@ -45,8 +46,8 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Joiner;
-public class AAITransactionalClient
- extends GraphInventoryTransactionClient<AAITransactionalClient, AAIResourceUri, AAIEdgeLabel> {
+public class AAITransactionalClient extends
+ GraphInventoryTransactionClient<AAITransactionalClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> {
private final Transactions transactions;
private Transaction currentTransaction;
@@ -189,12 +190,12 @@ public class AAITransactionalClient
}
@Override
- protected <T> Optional<T> get(GenericType<T> genericType, AAIResourceUri clone) {
+ protected <T> Optional<T> get(GenericType<T> genericType, AAIBaseResourceUri<?, ?> clone) {
return resourcesClient.get(genericType, clone);
}
@Override
- protected boolean exists(AAIResourceUri uri) {
+ protected boolean exists(AAIBaseResourceUri<?, ?> uri) {
return resourcesClient.exists(uri);
}
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 4f06b787f7..42887884db 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
@@ -23,7 +23,16 @@ package org.onap.so.client.aai;
import org.onap.so.client.graphinventory.GraphInventoryVersion;
public enum AAIVersion implements GraphInventoryVersion {
- V13("v13"), V14("v14"), V15("v15"), V16("v16"), V17("v17"), V18("v18"), V19("v19");
+ V10("V10"),
+ V11("V11"),
+ V12("V12"),
+ V13("v13"),
+ V14("v14"),
+ V15("v15"),
+ V16("v16"),
+ V17("v17"),
+ V18("v18"),
+ V19("v19");
public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
private final String value;
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java
new file mode 100644
index 0000000000..67f858a2bf
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java
@@ -0,0 +1,29 @@
+/*-
+ * ============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.client.aai.entities.uri;
+
+import org.onap.so.client.aai.AAIObjectBase;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+
+public interface AAIBaseResourceUri<T extends AAIBaseResourceUri<?, ?>, OT extends AAIObjectBase>
+ extends AAIUri<T, OT>, GraphInventoryResourceUri<T, OT> {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java
new file mode 100644
index 0000000000..2cec021c95
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java
@@ -0,0 +1,9 @@
+package org.onap.so.client.aai.entities.uri;
+
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri;
+
+public interface AAIPluralResourceUri extends AAIBaseResourceUri<AAIPluralResourceUri, AAIObjectPlurals>,
+ GraphInventoryPluralResourceUri<AAIPluralResourceUri, AAIObjectPlurals> {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
index 70dfd581e8..e93d52889a 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
@@ -1,64 +1,10 @@
-/*-
- * ============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.client.aai.entities.uri;
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.entities.uri.Depth;
-import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
-
-public interface AAIResourceUri extends AAIUri, GraphInventoryResourceUri {
-
- public AAIResourceUri relationshipAPI();
-
- public AAIResourceUri relatedTo(AAIObjectPlurals plural);
-
- public AAIResourceUri relatedTo(AAIObjectType type, String... values);
-
- public AAIResourceUri resourceVersion(String version);
-
- public AAIResourceUri format(Format format);
-
- @Override
- public AAIResourceUri depth(Depth depth);
-
- @Override
- public AAIResourceUri nodesOnly(boolean nodesOnly);
-
- @Override
- public AAIResourceUri queryParam(String name, String... values);
-
- @Override
- public AAIResourceUri replaceQueryParam(String name, String... values);
-
- @Override
- public AAIResourceUri resultIndex(int index);
-
- @Override
- public AAIResourceUri resultSize(int size);
+import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
- @Override
- public AAIResourceUri limit(int size);
+public interface AAIResourceUri extends AAIBaseResourceUri<AAIResourceUri, AAIObjectType>,
+ GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals> {
- @Override
- public AAIResourceUri clone();
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java
new file mode 100644
index 0000000000..9ab45a8aa9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.client.aai.entities.uri;
+
+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.entities.uri.SimplePluralUri;
+
+public class AAISimplePluralUri
+ extends SimplePluralUri<AAIPluralResourceUri, AAIResourceUri, AAIObjectPlurals, AAIObjectType>
+ implements AAIPluralResourceUri {
+
+ private static final long serialVersionUID = -6397024057188453229L;
+
+ protected AAISimplePluralUri(AAIObjectPlurals type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ }
+
+ protected AAISimplePluralUri(AAIObjectPlurals type) {
+ super(type);
+ }
+
+ protected AAISimplePluralUri(AAIObjectPlurals type, Object... values) {
+ super(type, values);
+ }
+
+ protected AAISimplePluralUri(AAIObjectPlurals type, AAIResourceUri uri) {
+ super(type, uri);
+ }
+
+ protected AAISimplePluralUri(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+ super(parentUri, childType);
+ }
+
+ protected AAISimplePluralUri(AAISimplePluralUri copy) {
+ super(copy);
+ }
+
+ @Override
+ public AAISimplePluralUri clone() {
+ return new AAISimplePluralUri(this);
+ }
+
+ @Override
+ public AAIObjectPlurals getObjectType() {
+ return this.pluralType;
+ }
+
+}
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 1fe9da984f..49dab59fc1 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,15 +21,13 @@
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.entities.uri.Depth;
import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
-public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
+public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals>
+ implements AAIResourceUri {
private static final long serialVersionUID = -6397024057188453229L;
@@ -46,102 +44,30 @@ public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
super(type, builder, values);
}
- protected AAISimpleUri(AAIObjectPlurals type, UriBuilder builder, Object... values) {
- super(type, builder, values);
- }
-
- protected AAISimpleUri(AAIObjectPlurals type) {
- super(type);
- }
-
- protected AAISimpleUri(AAIObjectPlurals type, Object... values) {
- super(type, values);
- }
-
protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) {
super(parentUri, childType, childValues);
}
- protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectPlurals childType) {
- super(parentUri, childType);
- }
-
- @Override
- public AAISimpleUri relationshipAPI() {
- return (AAISimpleUri) super.relationshipAPI();
- }
-
- @Override
- public AAISimpleUri relatedTo(AAIObjectPlurals plural) {
- return (AAISimpleUri) super.relatedTo(plural);
- }
-
- @Override
- public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
- return (AAISimpleUri) super.relatedTo(type, values);
- }
-
- @Override
- public AAISimpleUri resourceVersion(String version) {
- return (AAISimpleUri) super.resourceVersion(version);
- }
-
- @Override
- public AAISimpleUri queryParam(String name, String... values) {
- return (AAISimpleUri) super.queryParam(name, values);
- }
-
- @Override
- public AAISimpleUri replaceQueryParam(String name, String... values) {
- return (AAISimpleUri) super.replaceQueryParam(name, values);
- }
-
- @Override
- public AAISimpleUri resultIndex(int index) {
- return (AAISimpleUri) super.resultIndex(index);
- }
-
- @Override
- public AAISimpleUri resultSize(int size) {
- return (AAISimpleUri) super.resultSize(size);
- }
-
- @Override
- public AAISimpleUri limit(int size) {
- return (AAISimpleUri) super.limit(size);
+ // copy constructor
+ protected AAISimpleUri(AAISimpleUri copy) {
+ super(copy);
}
@Override
public AAISimpleUri clone() {
- if (this.type != null) {
- return new AAISimpleUri((AAIObjectType) this.type, this.internalURI.clone(), values);
- } else {
- return new AAISimpleUri((AAIObjectPlurals) this.pluralType, this.internalURI.clone(), values);
- }
- }
-
- @Override
- public AAIObjectType getObjectType() {
- return (AAIObjectType) this.type;
+ return new AAISimpleUri(this);
}
@Override
- public AAISimpleUri depth(Depth depth) {
- return (AAISimpleUri) super.depth(depth);
- }
-
- @Override
- public AAISimpleUri nodesOnly(boolean nodesOnly) {
- return (AAISimpleUri) super.nodesOnly(nodesOnly);
+ public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
+ this.internalURI = internalURI.path(relatedTo);
+ return new AAISimpleUri(this, type, values);
}
@Override
- public AAISimpleUri format(Format format) {
- return (AAISimpleUri) super.format(format);
+ public AAISimplePluralUri relatedTo(AAIObjectPlurals plural) {
+ this.internalURI.path(relatedTo);
+ return new AAISimplePluralUri(this, plural);
}
- @Override
- protected Pattern getPrefixPattern() {
- return Pattern.compile("/aai/v\\d+");
- }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java
index 6a4c90a6ee..8101643b78 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java
@@ -20,52 +20,13 @@
package org.onap.so.client.aai.entities.uri;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
+import java.util.regex.Pattern;
+import org.onap.so.client.aai.AAIObjectBase;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
-public interface AAIUri extends GraphInventoryUri {
+public interface AAIUri<T extends AAIUri<?, ?>, OP extends AAIObjectBase> extends GraphInventoryUri<T, OP> {
- /**
- * By default A&AI enforces a depth of 1. Some objects can be told to retrieve objects nested beneath them by
- * increasing this number.
- *
- * You can use 0 to restrict the returned information to only the object you requested You can use all to retrieve
- * all nested objects (this should only be used if you really need a massive amount of information and are caching
- * the retrieval)
- *
- * @param depth
- * @return
- */
- @Override
- public AAIUri depth(Depth depth);
-
- /**
- * Makes client only return object fields, no relationships
- *
- * @return
- */
- @Override
- public AAIUri nodesOnly(boolean nodesOnly);
-
- @Override
- public AAIUri queryParam(String name, String... values);
-
- @Override
- public AAIUri replaceQueryParam(String name, String... values);
-
- @Override
- public AAIUri resultIndex(int index);
-
- @Override
- public AAIUri resultSize(int size);
-
- @Override
- public AAIUri limit(int size);
-
- @Override
- public AAIUri clone();
-
- @Override
- public AAIObjectType getObjectType();
+ public default Pattern getPrefixPattern() {
+ return Pattern.compile("/aai/v\\d+");
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
index 406ff09952..bdd3921851 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
@@ -47,13 +47,13 @@ public class AAIUriFactory {
}
}
- public static AAIResourceUri createNodesUri(AAIObjectType type, Object... values) {
- return new NodesUri(type, values);
+ public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
+ return new NodesSingleUri(type, values);
}
- public static AAIResourceUri createNodesUri(AAIObjectPlurals type) {
- return new NodesUri(type);
+ public static NodesPluralUri createNodesUri(AAIObjectPlurals type) {
+ return new NodesPluralUri(type);
}
@@ -64,7 +64,7 @@ public class AAIUriFactory {
* @param uri
* @return
*/
- public static AAIResourceUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
+ public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
return new AAISimpleUri(type, uri);
}
@@ -77,15 +77,15 @@ public class AAIUriFactory {
* @param childValues
* @return
*/
- public static AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
+ public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
Object... childValues) {
return new AAISimpleUri(parentUri, childType, childValues);
}
- public static AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+ public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
- return new AAISimpleUri(parentUri, childType);
+ return new AAISimplePluralUri(parentUri, childType);
}
/**
@@ -94,9 +94,9 @@ public class AAIUriFactory {
* @param type
* @return
*/
- public static AAIResourceUri createResourceUri(AAIObjectPlurals type) {
+ public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type) {
- return new AAISimpleUri(type);
+ return new AAISimplePluralUri(type);
}
@@ -106,9 +106,9 @@ public class AAIUriFactory {
* @param type
* @return
*/
- public static AAIResourceUri createResourceUri(AAIObjectPlurals type, Object... values) {
+ public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type, Object... values) {
- return new AAISimpleUri(type, values);
+ return new AAISimplePluralUri(type, values);
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
index 37d21b375e..a0f1962706 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
@@ -111,8 +111,24 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri
try {
if (this.values.length == 1) {
String uri = getObjectById(this.values[0]);
- Map<String, String> map = getURIKeys(uri);
- return super.build(map.values().toArray(values));
+ Map<String, String> map = super.getURIKeys(uri);
+ this.values = map.values().toArray(values);
+ return super.build(values);
+ }
+ } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
+ throw new GraphInventoryUriComputationException(e);
+ }
+ return super.build();
+ }
+
+ @Override
+ public URI locateAndBuild() {
+ try {
+ if (this.values.length == 1) {
+ String uri = getObjectById(this.values[0]);
+ Map<String, String> map = super.getURIKeys(uri);
+ this.values = map.values().toArray(values);
+ return super.build(values);
}
} catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
throw new GraphInventoryUriComputationException(e);
@@ -155,7 +171,4 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri
}
}
-
- @Override
- public abstract URI buildNoNetwork();
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java
new file mode 100644
index 0000000000..8545fc96fb
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java
@@ -0,0 +1,19 @@
+package org.onap.so.client.aai.entities.uri;
+
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+
+public class NodesPluralUri extends AAISimplePluralUri implements NodesUri {
+
+ private static final long serialVersionUID = -6743170679667245998L;
+
+ protected NodesPluralUri(AAIObjectPlurals type) {
+ super(type);
+ }
+
+ @Override
+ public String getTemplate(GraphInventoryObjectBase type) {
+ return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java
new file mode 100644
index 0000000000..7274b1f3b9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java
@@ -0,0 +1,21 @@
+package org.onap.so.client.aai.entities.uri;
+
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+
+public class NodesSingleUri extends AAISimpleUri implements NodesUri {
+
+ private static final long serialVersionUID = 2721165364903444248L;
+
+ protected NodesSingleUri(AAIObjectType type, Object... values) {
+ super(type, values);
+ }
+
+
+ @Override
+ public String getTemplate(GraphInventoryObjectBase type) {
+ return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
index 4b4b5d92a2..6e5fa77f76 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
@@ -20,32 +20,7 @@
package org.onap.so.client.aai.entities.uri;
-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.GraphInventoryObjectPlurals;
-import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+public interface NodesUri {
-public class NodesUri extends AAISimpleUri {
- private static final long serialVersionUID = 8818689895730182042L;
-
- protected NodesUri(AAIObjectType type, Object... values) {
- super(type, values);
- }
-
- protected NodesUri(AAIObjectPlurals type) {
- super(type);
- }
-
-
- @Override
- protected String getTemplate(GraphInventoryObjectType type) {
- return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
- }
-
- @Override
- protected String getTemplate(GraphInventoryObjectPlurals type) {
- return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
- }
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
index 98d48ec3a8..09efb5a48d 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
@@ -25,6 +25,7 @@ import org.onap.so.client.RestClient;
import org.onap.so.client.RestProperties;
import org.onap.so.client.RestPropertiesLoader;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
+import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
public abstract class GraphInventoryClient {
@@ -36,9 +37,22 @@ public abstract class GraphInventoryClient {
this.props = props;
}
- protected abstract URI constructPath(GraphInventoryUri uri);
+ protected abstract URI constructPath(URI uri);
+
+ protected abstract RestClient createClient(URI uri);
+
+ public RestClient createClient(GraphInventoryUri uri) {
+ final URI result;
+ if (uri instanceof HttpAwareUri) {
+ result = ((HttpAwareUri) uri).locateAndBuild();
+ } else {
+ result = uri.build();
+ }
+
+ return createClient(result);
+
+ }
- public abstract RestClient createClient(GraphInventoryUri uri);
public <T extends RestProperties> T getRestProperties() {
if (props == null) {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java
new file mode 100644
index 0000000000..72de833884
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java
@@ -0,0 +1,9 @@
+package org.onap.so.client.graphinventory;
+
+public interface GraphInventoryObjectBase
+ extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+
+ public default boolean passThrough() {
+ return false;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
index 42f4733e47..84604a76cf 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
@@ -20,7 +20,8 @@
package org.onap.so.client.graphinventory;
-public interface GraphInventoryObjectPlurals
- extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+public interface GraphInventoryObjectPlurals extends GraphInventoryObjectBase {
+
+ public GraphInventoryObjectType getType();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
index c11a08e867..d09a83a644 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
@@ -20,7 +20,6 @@
package org.onap.so.client.graphinventory;
-public interface GraphInventoryObjectType
- extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+public interface GraphInventoryObjectType extends GraphInventoryObjectBase {
}
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 c7cdb2ff58..f446e5ac4c 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
@@ -21,6 +21,11 @@
package org.onap.so.client.graphinventory;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.ws.rs.NotFoundException;
@@ -32,9 +37,13 @@ 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.GraphInventoryPluralResourceUri;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
+import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryMultipleItemsException;
-public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
+public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PluralUri extends GraphInventoryPluralResourceUri<?, ?>, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
protected GraphInventoryClient client;
@@ -49,7 +58,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public void create(Uri uri, Object obj) {
+ public void create(SingleUri uri, Object obj) {
RestClient giRC = client.createClient(uri);
giRC.put(obj);
}
@@ -60,7 +69,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public void createEmpty(Uri uri) {
+ public void createEmpty(SingleUri uri) {
RestClient giRC = client.createClient(uri);
giRC.put("");
}
@@ -72,7 +81,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @return
*/
public boolean exists(Uri uri) {
- GraphInventoryResourceUri forceMinimal = uri.clone();
+ GraphInventoryResourceUri<?, ?> forceMinimal = (Uri) uri.clone();
forceMinimal.format(Format.COUNT);
forceMinimal.limit(1);
try {
@@ -91,8 +100,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uriB
* @return
*/
- public void connect(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public void connect(SingleUri uriA, SingleUri uriB) {
+ GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
RestClient giRC = client.createClient(uriAClone.relationshipAPI());
giRC.put(this.buildRelationship(uriB));
}
@@ -105,8 +114,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param edge label
* @return
*/
- public void connect(Uri uriA, Uri uriB, EdgeLabel label) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public void connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) {
+ GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
RestClient giRC = client.createClient(uriAClone.relationshipAPI());
giRC.put(this.buildRelationship(uriB, label));
}
@@ -118,8 +127,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uriB
* @return
*/
- public void disconnect(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public void disconnect(SingleUri uriA, SingleUri uriB) {
+ GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
RestClient giRC = client.createClient(uriAClone.relationshipAPI());
giRC.delete(this.buildRelationship(uriB));
}
@@ -130,8 +139,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public void delete(Uri uri) {
- GraphInventoryResourceUri clone = uri.clone();
+ public void delete(SingleUri uri) {
+ GraphInventorySingleResourceUri<?, ?, ?, ?> clone = (SingleUri) uri.clone();
RestClient giRC = client.createClient(clone);
Map<String, Object> result = giRC.get(new GenericType<Map<String, Object>>() {}).orElseThrow(
() -> new NotFoundException(clone.build() + " does not exist in " + client.getGraphDBName()));
@@ -145,7 +154,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public void update(Uri uri, Object obj) {
+ public void update(SingleUri uri, Object obj) {
RestClient giRC = client.createClient(uri);
giRC.patch(obj);
}
@@ -206,6 +215,88 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
}
}
+ public <T, R> Optional<R> getOne(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+ Optional<List<R>> result = unwrapPlural(pluralClass, resultClass, uri);
+
+ if (result.isPresent()) {
+ if (result.get().size() == 1) {
+ return Optional.of(result.get().get(0));
+ } else {
+ throw new GraphInventoryMultipleItemsException(result.get().size(), uri);
+ }
+ }
+
+ return Optional.empty();
+ }
+
+ public <T, R> Optional<R> getFirst(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+ Optional<List<R>> result = unwrapPlural(pluralClass, resultClass, uri);
+
+ if (result.isPresent() && !result.get().isEmpty()) {
+ return Optional.of(result.get().get(0));
+ }
+
+ return Optional.empty();
+ }
+
+ public <T, R> Optional<Wrapper> getFirstWrapper(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+
+ Optional<R> result = getFirst(pluralClass, resultClass, uri);
+ if (result.isPresent()) {
+ return Optional.of(this.createWrapper(result.get()));
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ public <T, R> Optional<Wrapper> getOneWrapper(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+
+ Optional<R> result = getOne(pluralClass, resultClass, uri);
+ if (result.isPresent()) {
+ return Optional.of(this.createWrapper(result.get()));
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ protected <T, R> Optional<List<R>> unwrapPlural(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+ try {
+ PluralUri clone = (PluralUri) uri.clone().limit(1);
+ Optional<T> obj = client.createClient(clone).get(pluralClass);
+ if (obj.isPresent()) {
+ Optional<Method> listMethod = Arrays.stream(obj.get().getClass().getMethods()).filter(method -> {
+
+ Type returnType = method.getGenericReturnType();
+ if (returnType instanceof ParameterizedType) {
+ Type[] types = ((ParameterizedType) returnType).getActualTypeArguments();
+ if (types != null && types[0] instanceof Class) {
+ Class<?> listClass = (Class<?>) types[0];
+ return resultClass.equals(listClass);
+ }
+ }
+
+ return false;
+ }).findFirst();
+ if (listMethod.isPresent()) {
+ try {
+ return Optional.of((List<R>) listMethod.get().invoke(obj.get()));
+
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ return Optional.empty();
+
+ } catch (NotFoundException e) {
+ if (this.getRestProperties().mapNotFoundToEmpty()) {
+ return Optional.empty();
+ } else {
+ throw e;
+ }
+ }
+ }
+
/**
* Retrieves an object from GraphInventory wrapped in a helper class which offer additional features
*
@@ -269,8 +360,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public Self createIfNotExists(Uri uri, Optional<Object> obj) {
- if (!this.exists(uri)) {
+ public Self createIfNotExists(SingleUri uri, Optional<Object> obj) {
+ if (!this.exists((Uri) uri)) {
if (obj.isPresent()) {
this.create(uri, obj.get());
} else {
@@ -281,17 +372,21 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
return (Self) this;
}
- protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
+ protected Relationship buildRelationship(SingleUri uri) {
return buildRelationship(uri, Optional.empty());
}
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
+ protected Relationship buildRelationship(SingleUri uri, GraphInventoryEdgeLabel label) {
return buildRelationship(uri, Optional.of(label));
}
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
+ protected Relationship buildRelationship(SingleUri uri, Optional<GraphInventoryEdgeLabel> label) {
final Relationship result = new Relationship();
- result.setRelatedLink(uri.build().toString());
+ if (uri instanceof HttpAwareUri) {
+ result.setRelatedLink(((HttpAwareUri) uri).locateAndBuild().toString());
+ } else {
+ result.setRelatedLink(uri.build().toString());
+ }
if (label.isPresent()) {
result.setRelationshipLabel(label.get().toString());
}
@@ -300,6 +395,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
public abstract Wrapper createWrapper(String json);
+ public abstract Wrapper createWrapper(Object json);
+
/**
* Starts a transaction which encloses multiple GraphInventory mutations
*
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 45ac1f741d..3469d73599 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
@@ -29,11 +29,12 @@ import javax.ws.rs.core.GenericType;
import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
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> {
+public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, EdgeLabel extends GraphInventoryEdgeLabel> {
protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class);
@@ -50,7 +51,7 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uri
* @return
*/
- public Self create(Uri uri, Object obj) {
+ public Self create(SingleUri uri, Object obj) {
this.put(uri.build().toString(), obj);
incrementActionAmount();
return (Self) this;
@@ -62,7 +63,7 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uri
* @return
*/
- public Self createEmpty(Uri uri) {
+ public Self createEmpty(SingleUri uri) {
this.put(uri.build().toString(), new HashMap<String, String>());
incrementActionAmount();
return (Self) this;
@@ -75,8 +76,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uri
* @return
*/
- public Self createIfNotExists(Uri uri, Optional<Object> obj) {
- if (!this.exists(uri)) {
+ public Self createIfNotExists(SingleUri uri, Optional<Object> obj) {
+ if (!this.exists((Uri) uri)) {
if (obj.isPresent()) {
this.create(uri, obj.get());
} else {
@@ -94,8 +95,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uriB
* @return
*/
- public Self connect(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public Self connect(SingleUri uriA, SingleUri uriB) {
+ GraphInventorySingleResourceUri uriAClone = uriA.clone();
this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB));
incrementActionAmount();
return (Self) this;
@@ -108,8 +109,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uris
* @return
*/
- public Self connect(Uri uriA, List<Uri> uris) {
- for (Uri uri : uris) {
+ public Self connect(SingleUri uriA, List<SingleUri> uris) {
+ for (SingleUri uri : uris) {
this.connect(uriA, uri);
}
return (Self) this;
@@ -122,8 +123,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uris
* @return
*/
- public Self connect(Uri uriA, Uri uriB, EdgeLabel label) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public Self connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) {
+ GraphInventorySingleResourceUri uriAClone = uriA.clone();
this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB, label));
return (Self) this;
}
@@ -135,8 +136,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uris
* @return
*/
- public Self connect(Uri uriA, List<Uri> uris, EdgeLabel label) {
- for (Uri uri : uris) {
+ public Self connect(SingleUri uriA, List<SingleUri> uris, EdgeLabel label) {
+ for (SingleUri uri : uris) {
this.connect(uriA, uri, label);
}
return (Self) this;
@@ -149,8 +150,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uriB
* @return
*/
- public Self disconnect(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public Self disconnect(SingleUri uriA, SingleUri uriB) {
+ GraphInventorySingleResourceUri uriAClone = uriA.clone();
this.delete(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB));
incrementActionAmount();
return (Self) this;
@@ -163,8 +164,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uris
* @return
*/
- public Self disconnect(Uri uriA, List<Uri> uris) {
- for (Uri uri : uris) {
+ public Self disconnect(SingleUri uriA, List<SingleUri> uris) {
+ for (SingleUri uri : uris) {
this.disconnect(uriA, uri);
}
return (Self) this;
@@ -176,8 +177,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uri
* @return
*/
- public Self delete(Uri uri) {
- Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri.clone())
+ public Self delete(SingleUri uri) {
+ Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri)
.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());
@@ -223,15 +224,15 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
*/
public abstract void execute() throws BulkProcessFailed;
- private Relationship buildRelationship(Uri uri) {
+ private Relationship buildRelationship(SingleUri uri) {
return buildRelationship(uri, Optional.empty());
}
- private Relationship buildRelationship(Uri uri, EdgeLabel label) {
+ private Relationship buildRelationship(SingleUri uri, EdgeLabel label) {
return buildRelationship(uri, Optional.of(label));
}
- private Relationship buildRelationship(Uri uri, Optional<EdgeLabel> label) {
+ private Relationship buildRelationship(SingleUri uri, Optional<EdgeLabel> label) {
final Relationship result = new Relationship();
result.setRelatedLink(uri.build().toString());
if (label.isPresent()) {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java
index 7ee5bd328e..5802e9c4e8 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeBase.java
@@ -26,41 +26,51 @@ import java.util.List;
import org.onap.so.client.aai.entities.QueryStep;
import org.onap.so.client.graphinventory.GraphInventoryObjectName;
-public class DSLNode implements QueryStep {
+public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep {
- private final String nodeName;
- private final List<DSLNodeKey> nodeKeys;
- private final StringBuilder query = new StringBuilder();
- private boolean output = false;
+ protected final String nodeName;
+ protected final List<DSLNodeKey> nodeKeys;
+ protected final StringBuilder query;
+ protected boolean output = false;
- public DSLNode() {
+ public DSLNodeBase() {
this.nodeName = "";
this.nodeKeys = new ArrayList<>();
+ this.query = new StringBuilder();
}
- public DSLNode(GraphInventoryObjectName name) {
+ public DSLNodeBase(GraphInventoryObjectName name) {
this.nodeName = name.typeName();
this.nodeKeys = new ArrayList<>();
+ this.query = new StringBuilder();
query.append(nodeName);
}
- public DSLNode(GraphInventoryObjectName name, DSLNodeKey... key) {
+ public DSLNodeBase(GraphInventoryObjectName name, DSLNodeKey... key) {
this.nodeName = name.typeName();
this.nodeKeys = Arrays.asList(key);
+ this.query = new StringBuilder();
query.append(nodeName);
}
- public DSLNode output() {
+ public DSLNodeBase(DSLNodeBase<?> copy) {
+ this.nodeName = copy.nodeName;
+ this.nodeKeys = copy.nodeKeys;
+ this.query = new StringBuilder(copy.query);
+ this.output = copy.output;
+ }
+
+ public DSLOutputNode output() {
this.output = true;
- return this;
+ return new DSLOutputNode(this);
}
- public DSLNode and(DSLNodeKey... key) {
+ public T and(DSLNodeKey... key) {
this.nodeKeys.addAll(Arrays.asList(key));
- return this;
+ return (T) this;
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java
new file mode 100644
index 0000000000..d799795650
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLOutputNode.java
@@ -0,0 +1,8 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class DSLOutputNode extends DSLNodeBase<DSLOutputNode> implements Output {
+
+ public DSLOutputNode(DSLNodeBase<?> copy) {
+ super(copy);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java
index 3056c9ca80..1fa79a714c 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQuery.java
@@ -31,17 +31,11 @@ public class DSLQuery {
}
- public DSLQuery(String dsl) {
- this.dsl = dsl;
+ public DSLQuery(DSLTraversal<? extends Output> dsl) {
+ this.dsl = dsl.get();
}
public String getDsl() {
return dsl;
}
-
- public void setDsl(String dsl) {
- this.dsl = dsl;
- }
-
-
}
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 540472a88d..7ff6e2ed22 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
@@ -27,35 +27,31 @@ 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;
-
-public class DSLQueryBuilder<S, E> implements QueryStep {
+public class DSLQueryBuilder<S, E> {
private List<QueryStep> steps = new ArrayList<>();
private String suffix = "";
- private static final Logger logger = LoggerFactory.getLogger(DSLQueryBuilder.class);
- public DSLQueryBuilder() {
+ protected DSLQueryBuilder() {
}
- public DSLQueryBuilder(DSLNode node) {
+ protected DSLQueryBuilder(QueryStep node) {
steps.add(node);
}
- public DSLQueryBuilder<S, DSLNode> node(DSLNode node) {
+ public <T> DSLQueryBuilder<S, DSLNodeBase<?>> node(DSLNodeBase<?> node) {
steps.add(node);
- return (DSLQueryBuilder<S, DSLNode>) this;
+ return (DSLQueryBuilder<S, DSLNodeBase<?>>) this;
}
- public DSLQueryBuilder<S, E> output() {
+ public DSLQueryBuilder<S, Node> output() {
Object obj = steps.get(steps.size() - 1);
- if (obj instanceof DSLNode) {
- ((DSLNode) steps.get(steps.size() - 1)).output();
+ if (obj instanceof DSLNodeBase) {
+ ((DSLNodeBase) steps.get(steps.size() - 1)).output();
} else if (obj.getClass().getName().contains("$$Lambda$")) {
// process lambda expressions
for (Field f : obj.getClass().getDeclaredFields()) {
@@ -63,27 +59,28 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
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();
+ if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNodeBase) {
+ ((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)).output();
}
} catch (IllegalArgumentException | IllegalAccessException e) {
- logger.error("Exception occured", e);
}
f.setAccessible(false);
break;
}
}
- return this;
+ return (DSLQueryBuilder<S, Node>) this;
}
- public <E2> DSLQueryBuilder<S, E2> union(final DSLQueryBuilder<?, E2>... union) {
+ @SafeVarargs
+ public final <E2> DSLQueryBuilder<S, E2> union(final DSLQueryBuilder<?, E2>... union) {
List<DSLQueryBuilder<?, ?>> unions = Arrays.asList(union);
steps.add(() -> {
StringBuilder query = new StringBuilder();
- query.append("> [ ").append(
- Joiner.on(", ").join(unions.stream().map(item -> item.build()).collect(Collectors.toList())))
+ query.append("> [ ")
+ .append(Joiner.on(", ")
+ .join(unions.stream().map(item -> item.compile()).collect(Collectors.toList())))
.append(" ]");
return query.toString();
});
@@ -95,7 +92,7 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
steps.add(() -> {
StringBuilder query = new StringBuilder();
- query.append(where.build()).append(")");
+ query.append(where.compile()).append(")");
String result = query.toString();
if (!result.startsWith(">")) {
result = "> " + result;
@@ -105,22 +102,22 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
return this;
}
- public DSLQueryBuilder<S, E> to(DSLQueryBuilder<?, ?> to) {
+ public <E2> DSLQueryBuilder<S, E2> to(DSLQueryBuilder<?, E2> to) {
steps.add(() -> {
StringBuilder query = new StringBuilder();
- query.append("> ").append(to.build());
+ query.append("> ").append(to.compile());
return query.toString();
});
- return this;
+ return (DSLQueryBuilder<S, E2>) this;
}
public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name) {
- return to(__.node(name));
+ return (DSLQueryBuilder<S, E>) to(__.node(name));
}
public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name, DSLNodeKey... key) {
- return to(__.node(name, key));
+ return (DSLQueryBuilder<S, E>) to(__.node(name, key));
}
public DSLQueryBuilder<S, E> limit(int limit) {
@@ -128,24 +125,19 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
return this;
}
- @Override
- public String build() {
- return compile();
+ public DSLTraversal<E> build() {
+ return new DSLTraversal<>(compile());
}
@Override
public String toString() {
- return build();
+ return build().get();
}
@Override
public boolean equals(Object o) {
if (o != null) {
- if (o instanceof QueryStep) {
- return ((QueryStep) o).build().equals(this.build());
- } else if (o instanceof String) {
- return o.equals(this.build());
- }
+ return o.toString().equals(toString());
}
return false;
}
@@ -153,11 +145,11 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
@Override
public int hashCode() {
- return build().hashCode();
+ return compile().hashCode();
}
private String compile() {
- return Joiner.on(" ").join(steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix;
+ return String.join(" ", steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix;
}
protected QueryStep getFirst() {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java
new file mode 100644
index 0000000000..fb0772726f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLStartNode.java
@@ -0,0 +1,19 @@
+package org.onap.so.client.graphinventory.entities;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectName;
+
+public class DSLStartNode extends DSLNodeBase<DSLStartNode> implements Start {
+
+
+ public DSLStartNode() {
+ super();
+ }
+
+ public DSLStartNode(GraphInventoryObjectName name) {
+ super(name);
+ }
+
+ public DSLStartNode(GraphInventoryObjectName name, DSLNodeKey... key) {
+ super(name, key);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java
new file mode 100644
index 0000000000..40f80463b2
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLTraversal.java
@@ -0,0 +1,33 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class DSLTraversal<T> {
+
+ private final String traversal;
+
+ protected DSLTraversal(String traversal) {
+ this.traversal = traversal;
+ }
+
+ public String get() {
+ return traversal;
+ }
+
+ @Override
+ public String toString() {
+ return traversal;
+ }
+
+ @Override
+ public int hashCode() {
+ return traversal.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o != null) {
+ return this.toString().equals(o);
+ }
+ return false;
+ }
+
+}
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 6703416832..6e7b9c9f08 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
@@ -30,12 +30,12 @@ import java.util.function.Predicate;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.client.graphinventory.GraphInventoryObjectName;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
-import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
import org.onap.so.jsonpath.JsonPathUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper, Uri extends GraphInventoryResourceUri, Type extends GraphInventoryObjectType> {
+public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper<?>, Uri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, Type extends GraphInventoryObjectType> {
protected final ObjectMapper mapper;
protected Map<String, Object> map;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java
new file mode 100644
index 0000000000..cdaae7d91f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Node.java
@@ -0,0 +1,5 @@
+package org.onap.so.client.graphinventory.entities;
+
+public interface Node extends Output {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java
new file mode 100644
index 0000000000..06b8b65984
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Output.java
@@ -0,0 +1,7 @@
+package org.onap.so.client.graphinventory.entities;
+
+import org.onap.so.client.aai.entities.QueryStep;
+
+public interface Output extends QueryStep {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java
new file mode 100644
index 0000000000..c649e36eca
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Start.java
@@ -0,0 +1,7 @@
+package org.onap.so.client.graphinventory.entities;
+
+import org.onap.so.client.aai.entities.QueryStep;
+
+public interface Start extends QueryStep {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java
new file mode 100644
index 0000000000..0af29f78e6
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/TraversalBuilder.java
@@ -0,0 +1,17 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class TraversalBuilder {
+
+
+ private TraversalBuilder() {
+
+ }
+
+ public static DSLQueryBuilder<Start, Start> fragment(Start node) {
+ return new DSLQueryBuilder<>(node);
+ }
+
+ public static DSLQueryBuilder<Output, Output> traversal(Output node) {
+ return new DSLQueryBuilder<>(node);
+ }
+}
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 87d4d84cac..ca0bd9e00d 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
@@ -32,24 +32,25 @@ public class __ {
return new DSLQueryBuilder<>();
}
- public static <A> DSLQueryBuilder<A, A> start(DSLNode node) {
+ public static <A> DSLQueryBuilder<A, A> start(Start node) {
return new DSLQueryBuilder<>(node);
}
- public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name) {
+ public static DSLQueryBuilder<DSLStartNode, DSLStartNode> node(GraphInventoryObjectName name) {
- return __.<DSLNode>start(new DSLNode(name));
+ return __.<DSLStartNode>start(new DSLStartNode(name));
}
- public static DSLQueryBuilder<DSLNode, DSLNode> node(GraphInventoryObjectName name, DSLNodeKey... key) {
- return __.<DSLNode>start(new DSLNode(name, key));
+ public static DSLQueryBuilder<DSLStartNode, DSLStartNode> node(GraphInventoryObjectName name, DSLNodeKey... key) {
+ return __.<DSLStartNode>start(new DSLStartNode(name, key));
}
public static DSLNodeKey key(String keyName, Object... value) {
return new DSLNodeKey(keyName, value);
}
- public static <A, B> DSLQueryBuilder<A, B> union(final DSLQueryBuilder<?, B>... traversal) {
+ @SafeVarargs
+ public static final <A, B> DSLQueryBuilder<A, B> union(final DSLQueryBuilder<?, B>... traversal) {
return __.<A>identity().union(traversal);
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java
new file mode 100644
index 0000000000..aa09702be8
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java
@@ -0,0 +1,8 @@
+package org.onap.so.client.graphinventory.entities.uri;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+
+public interface GraphInventoryPluralResourceUri<T extends GraphInventoryResourceUri<?, ?>, OT extends GraphInventoryObjectBase>
+ extends GraphInventoryResourceUri<T, OT> {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
index c579a285d2..64933863d5 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
@@ -21,42 +21,11 @@
package org.onap.so.client.graphinventory.entities.uri;
import org.onap.so.client.graphinventory.Format;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
-import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
-public interface GraphInventoryResourceUri extends GraphInventoryUri {
- public GraphInventoryResourceUri relationshipAPI();
+public interface GraphInventoryResourceUri<T extends GraphInventoryResourceUri<?, ?>, OT extends GraphInventoryObjectBase>
+ extends GraphInventoryUri<T, OT> {
- public GraphInventoryResourceUri relatedTo(GraphInventoryObjectPlurals plural);
+ public T format(Format format);
- public GraphInventoryResourceUri relatedTo(GraphInventoryObjectType type, String... values);
-
- public GraphInventoryResourceUri resourceVersion(String version);
-
- public GraphInventoryResourceUri format(Format format);
-
- @Override
- public GraphInventoryResourceUri depth(Depth depth);
-
- @Override
- public GraphInventoryResourceUri nodesOnly(boolean nodesOnly);
-
- @Override
- public GraphInventoryResourceUri queryParam(String name, String... values);
-
- @Override
- public GraphInventoryResourceUri replaceQueryParam(String name, String... values);
-
- @Override
- public GraphInventoryResourceUri resultIndex(int index);
-
- @Override
- public GraphInventoryResourceUri resultSize(int size);
-
- @Override
- public GraphInventoryResourceUri limit(int size);
-
- @Override
- public GraphInventoryResourceUri clone();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java
new file mode 100644
index 0000000000..e45ff14a5e
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java
@@ -0,0 +1,16 @@
+package org.onap.so.client.graphinventory.entities.uri;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, P extends GraphInventoryPluralResourceUri<?, ?>, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals>
+ extends GraphInventoryResourceUri<T, SingleObject> {
+
+ public T resourceVersion(String version);
+
+ public T relationshipAPI();
+
+ public P relatedTo(PluralObject plural);
+
+ public T relatedTo(SingleObject type, String... values);
+}
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 6b48ad44ef..e3fda2fa23 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
@@ -20,11 +20,15 @@
package org.onap.so.client.graphinventory.entities.uri;
+import java.io.Serializable;
import java.net.URI;
import java.util.Map;
+import java.util.regex.Pattern;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
-public interface GraphInventoryUri {
+public interface GraphInventoryUri<T extends GraphInventoryUri<?, ?>, OT extends GraphInventoryObjectBase>
+ extends Serializable {
public URI build();
@@ -39,26 +43,26 @@ public interface GraphInventoryUri {
* @param depth
* @return
*/
- public GraphInventoryUri depth(Depth depth);
+ public T depth(Depth depth);
/**
* Makes client only return object fields, no relationships
*
* @return
*/
- public GraphInventoryUri nodesOnly(boolean nodesOnly);
+ public T nodesOnly(boolean nodesOnly);
- public GraphInventoryUri queryParam(String name, String... values);
+ public T queryParam(String name, String... values);
- public GraphInventoryUri replaceQueryParam(String name, String... values);
+ public T replaceQueryParam(String name, String... values);
- public GraphInventoryUri resultIndex(int index);
+ public T resultIndex(int index);
- public GraphInventoryUri resultSize(int size);
+ public T resultSize(int size);
- public GraphInventoryUri limit(int size);
+ public T limit(int size);
- public GraphInventoryUri clone();
+ public T clone();
/**
* returns all key values of the URI as a map. Key names can be found in {@link GraphInventoryObjectType}
@@ -67,9 +71,11 @@ public interface GraphInventoryUri {
*/
public Map<String, String> getURIKeys();
- public GraphInventoryObjectType getObjectType();
+ public OT getObjectType();
public boolean equals(Object o);
public int hashCode();
+
+ public Pattern getPrefixPattern();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
index fcfde74b33..1ee3d57b6c 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
@@ -21,9 +21,12 @@
package org.onap.so.client.graphinventory.entities.uri;
import java.net.URI;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-public interface HttpAwareUri {
+public interface HttpAwareUri extends AAIResourceUri {
public URI buildNoNetwork();
+
+ public URI locateAndBuild();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java
new file mode 100644
index 0000000000..fc1a008466
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java
@@ -0,0 +1,237 @@
+package org.onap.so.client.graphinventory.entities.uri;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.URI;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.ws.rs.core.UriBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser;
+import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl;
+import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
+import org.springframework.web.util.UriUtils;
+
+public abstract class SimpleBaseUri<T extends GraphInventoryResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, S extends GraphInventoryObjectBase>
+ implements GraphInventoryResourceUri<T, S> {
+
+ private static final long serialVersionUID = -1011069933894179423L;
+ protected transient UriBuilder internalURI;
+ protected static final String relationshipAPI = "/relationship-list/relationship";
+ protected static final String relatedTo = "/related-to";
+ protected Object[] values;
+ protected final S type;
+ protected final Parent parentUri;
+ protected final Map<String, Set<String>> queryParams = new HashMap<>();
+
+ protected SimpleBaseUri(S type, Object... values) {
+ this.type = type;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values = values;
+ this.parentUri = null;
+ validateValuesSize(this.getTemplate(type), values);
+ }
+
+ protected SimpleBaseUri(S type, URI uri) {
+ if (!type.passThrough()) {
+ this.type = type;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values =
+ this.getURIKeys(uri.getRawPath().replaceAll(getPrefixPattern().toString(), "")).values().toArray();
+ this.parentUri = null;
+ } else {
+ this.type = type;
+ this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), ""));
+ this.values = new Object[0];
+ this.parentUri = null;
+ }
+
+ }
+
+ protected SimpleBaseUri(S type, UriBuilder builder, Object... values) {
+ this.internalURI = builder;
+ this.values = values;
+ this.type = type;
+ this.parentUri = null;
+
+ }
+
+ protected SimpleBaseUri(Parent parentUri, S childType, Object... childValues) {
+ this.type = childType;
+ this.internalURI = UriBuilder.fromUri(type.partialUri());
+ this.values = childValues;
+ this.parentUri = parentUri;
+
+ validateValuesSize(childType.partialUri(), values);
+ }
+
+ protected SimpleBaseUri(SimpleBaseUri<T, Parent, S> copy) {
+ this.type = copy.type;
+ this.internalURI = copy.internalURI.clone();
+ this.values = copy.values.clone();
+ if (copy.parentUri != null) {
+ this.parentUri = (Parent) copy.parentUri.clone();
+ } else {
+ this.parentUri = null;
+ }
+ }
+
+ protected void setInternalURI(UriBuilder builder) {
+ this.internalURI = builder;
+ }
+
+ @Override
+ public T queryParam(String name, String... values) {
+ this.internalURI = internalURI.queryParam(name, values);
+ if (queryParams.containsKey(name)) {
+ queryParams.get(name).addAll(Arrays.asList(values));
+ } else {
+ queryParams.put(name, Stream.of(values).collect(Collectors.toSet()));
+ }
+ return (T) this;
+ }
+
+ @Override
+ public T replaceQueryParam(String name, String... values) {
+ this.internalURI = internalURI.replaceQueryParam(name, values);
+ queryParams.put(name, Stream.of(values).collect(Collectors.toSet()));
+ return (T) this;
+ }
+
+ @Override
+ public T resultIndex(int index) {
+ this.internalURI = internalURI.replaceQueryParam("resultIndex", index);
+ return (T) this;
+ }
+
+ @Override
+ public T resultSize(int size) {
+ this.internalURI = internalURI.replaceQueryParam("resultSize", size);
+ return (T) this;
+ }
+
+ @Override
+ public T limit(int size) {
+ this.resultIndex(0).resultSize(size);
+ return (T) this;
+ }
+
+ @Override
+ public URI build() {
+ return build(this.values);
+ }
+
+ protected URI build(Object... values) {
+
+ // This is a workaround because resteasy does not encode URIs correctly
+ final String[] encoded = new String[values.length];
+ for (int i = 0; i < values.length; i++) {
+ encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString());
+ }
+ if (this.parentUri != null) {
+ return UriBuilder
+ .fromUri(this.parentUri.build().toString() + internalURI.buildFromEncoded(encoded).toString())
+ .build();
+ } else {
+ return internalURI.buildFromEncoded(encoded);
+ }
+ }
+
+ @Override
+ public Map<String, String> getURIKeys() {
+ return this.getURIKeys(this.build().toString());
+ }
+
+ protected Map<String, String> getURIKeys(String uri) {
+ UriParser parser;
+ if (!("".equals(this.getTemplate(type)))) {
+ parser = new UriParserSpringImpl(this.getTemplate(type));
+ } else {
+ return new HashMap<>();
+ }
+
+
+ return parser.parse(uri);
+ }
+
+ @Override
+ public abstract T clone();
+
+ @Override
+ public S getObjectType() {
+ return this.type;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o != null) {
+ return this.toString().equals(o.toString());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(this.toString()).toHashCode();
+ }
+
+
+ @Override
+ public T depth(Depth depth) {
+ this.internalURI.replaceQueryParam("depth", depth.toString());
+ return (T) this;
+ }
+
+ @Override
+ public T nodesOnly(boolean nodesOnly) {
+ if (nodesOnly) {
+ this.internalURI.replaceQueryParam("nodes-only", "");
+ }
+ return (T) this;
+ }
+
+ @Override
+ public T format(Format format) {
+ this.internalURI.replaceQueryParam("format", format);
+ return (T) this;
+ }
+
+ public void validateValuesSize(String template, Object... values) {
+ UriParser parser = new UriParserSpringImpl(template);
+ Set<String> variables = parser.getVariables();
+ if (variables.size() != values.length) {
+ throw new IncorrectNumberOfUriKeys(String.format("Expected %s variables: %s", variables.size(), variables));
+ }
+ }
+
+ protected String getTemplate(GraphInventoryObjectBase type) {
+ return type.uriTemplate();
+ }
+
+ private void writeObject(ObjectOutputStream oos) throws IOException {
+ oos.defaultWriteObject();
+ oos.writeUTF(this.internalURI.toTemplate());
+ }
+
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ String uri = ois.readUTF();
+ this.setInternalURI(UriBuilder.fromUri(uri));
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(null, ToStringStyle.NO_CLASS_NAME_STYLE).append("type", type)
+ .append("parentUri", parentUri).append("values", values).append("queryParams", queryParams).toString();
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java
new file mode 100644
index 0000000000..c0b6d573c1
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.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.client.graphinventory.entities.uri;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public abstract class SimplePluralUri<T extends GraphInventoryPluralResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType>
+ extends SimpleBaseUri<T, Parent, PT> implements GraphInventoryPluralResourceUri<T, PT>, Serializable {
+
+ private static final long serialVersionUID = -337701171277616439L;
+
+ protected final PT pluralType;
+
+ protected SimplePluralUri(PT type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ this.pluralType = type;
+ }
+
+ protected SimplePluralUri(PT type) {
+ super(type, new Object[0]);
+ this.pluralType = type;
+ }
+
+ protected SimplePluralUri(PT type, Object... values) {
+ super(type, values);
+ this.pluralType = type;
+ }
+
+ protected SimplePluralUri(Parent parentUri, PT childType) {
+ super(parentUri, childType, new Object[0]);
+ this.pluralType = childType;
+ }
+
+ public SimplePluralUri(SimplePluralUri<T, Parent, PT, OT> copy) {
+ super(copy);
+ this.pluralType = copy.pluralType;
+ }
+
+ protected void setInternalURI(UriBuilder builder) {
+ this.internalURI = builder;
+ }
+
+ private void writeObject(ObjectOutputStream oos) throws IOException {
+ oos.defaultWriteObject();
+ oos.writeUTF(this.internalURI.toTemplate());
+ }
+
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ String uri = ois.readUTF();
+ this.setInternalURI(UriBuilder.fromUri(uri));
+ }
+}
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 ffe47c5c51..aff7392efe 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
@@ -23,254 +23,50 @@ package org.onap.so.client.graphinventory.entities.uri;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.Serializable;
import java.net.URI;
-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;
import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
-import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser;
-import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl;
-import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
-import org.springframework.web.util.UriUtils;
-public class SimpleUri implements GraphInventoryResourceUri, Serializable {
+public abstract class SimpleUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryPluralResourceUri<?, ?>, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals>
+ extends SimpleBaseUri<T, T, S> implements GraphInventorySingleResourceUri<T, PT, S, P> {
private static final long serialVersionUID = -337701171277616439L;
-
- protected transient UriBuilder internalURI;
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;
-
- protected SimpleUri(GraphInventoryObjectType type, Object... values) {
- this.type = type;
- this.pluralType = null;
- this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
- this.values = values;
- validateValuesSize(this.getTemplate(type), values);
- }
-
- protected SimpleUri(GraphInventoryObjectType type, URI uri) {
- this.type = type;
- this.pluralType = null;
- this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), ""));
- this.values = new Object[0];
- }
- protected SimpleUri(GraphInventoryObjectType type, UriBuilder builder, Object... values) {
- this.internalURI = builder;
- this.values = values;
- this.type = type;
- this.pluralType = null;
+ protected SimpleUri(S type, Object... values) {
+ super(type, values);
}
- protected SimpleUri(GraphInventoryObjectPlurals type, UriBuilder builder, Object... values) {
- this.internalURI = builder;
- this.values = values;
- this.type = null;
- this.pluralType = type;
- }
+ protected SimpleUri(S type, URI uri) {
+ super(type, uri);
- protected SimpleUri(GraphInventoryObjectPlurals type) {
- this.type = null;
- this.pluralType = type;
- this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
- this.values = new Object[0];
}
- protected SimpleUri(GraphInventoryObjectPlurals type, Object... values) {
- this.type = null;
- this.pluralType = type;
- this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
- this.values = values;
- validateValuesSize(this.getTemplate(type), values);
- }
+ protected SimpleUri(S type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
- protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectType childType,
- Object... childValues) {
- this.type = childType;
- this.pluralType = null;
- this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri());
- this.values = childValues;
- validateValuesSize(childType.partialUri(), values);
}
- protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectPlurals childType) {
- this.type = null;
- this.pluralType = childType;
- this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri());
- this.values = new Object[0];
+ protected SimpleUri(T parentUri, S childType, Object... childValues) {
+ super(parentUri, childType, childValues);
}
- protected void setInternalURI(UriBuilder builder) {
- this.internalURI = builder;
+ protected SimpleUri(SimpleBaseUri<T, T, S> copy) {
+ super(copy);
}
@Override
- public SimpleUri relationshipAPI() {
- this.internalURI = internalURI.path(relationshipAPI);
- return this;
- }
-
- @Override
- public SimpleUri relatedTo(GraphInventoryObjectPlurals plural) {
-
- this.internalURI = internalURI.path(relatedTo).path(plural.partialUri());
- return this;
- }
-
- @Override
- public SimpleUri relatedTo(GraphInventoryObjectType type, String... values) {
- this.internalURI =
- internalURI.path(relatedTo).path(UriBuilder.fromPath(type.partialUri()).build(values).toString());
- return this;
- }
-
- @Override
- public SimpleUri resourceVersion(String version) {
+ public T resourceVersion(String version) {
this.internalURI = internalURI.replaceQueryParam("resource-version", version);
- return this;
- }
-
- @Override
- public SimpleUri queryParam(String name, String... values) {
- this.internalURI = internalURI.queryParam(name, values);
- return this;
- }
-
- @Override
- public SimpleUri replaceQueryParam(String name, String... values) {
- this.internalURI = internalURI.replaceQueryParam(name, values);
- return this;
- }
-
- @Override
- public SimpleUri resultIndex(int index) {
- this.internalURI = internalURI.replaceQueryParam("resultIndex", index);
- return this;
- }
-
- @Override
- public SimpleUri resultSize(int size) {
- this.internalURI = internalURI.replaceQueryParam("resultSize", size);
- return this;
- }
-
- @Override
- public SimpleUri limit(int size) {
- return this.resultIndex(0).resultSize(size);
- }
-
- @Override
- public URI build() {
- 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];
- for (int i = 0; i < values.length; i++) {
- encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString());
- }
- return internalURI.buildFromEncoded(encoded);
- }
-
- @Override
- public Map<String, String> getURIKeys() {
- return this.getURIKeys(this.build().toString());
- }
-
- protected Map<String, String> getURIKeys(String uri) {
- UriParser parser;
- if (this.type != null) {
- if (!("".equals(this.getTemplate(type)))) {
- parser = new UriParserSpringImpl(this.getTemplate(type));
- } else {
- return new HashMap<>();
- }
- } else {
- parser = new UriParserSpringImpl(this.getTemplate(pluralType));
- }
-
-
- return parser.parse(uri);
- }
-
- @Override
- public SimpleUri clone() {
- if (this.type != null) {
- return new SimpleUri(this.type, this.internalURI.clone(), values);
- } else {
- return new SimpleUri(this.pluralType, this.internalURI.clone(), values);
- }
- }
-
- @Override
- public GraphInventoryObjectType getObjectType() {
- return this.type;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof GraphInventoryUri) {
- return this.build().equals(((GraphInventoryUri) o).build());
- }
- return false;
+ return (T) this;
}
@Override
- public int hashCode() {
- return new HashCodeBuilder().append(this.build()).toHashCode();
- }
-
-
- @Override
- public SimpleUri depth(Depth depth) {
- this.internalURI.replaceQueryParam("depth", depth.toString());
- return this;
- }
-
- @Override
- public SimpleUri nodesOnly(boolean nodesOnly) {
- if (nodesOnly) {
- this.internalURI.replaceQueryParam("nodes-only", "");
- }
- return this;
- }
-
- @Override
- public SimpleUri format(Format format) {
- this.internalURI.replaceQueryParam("format", format);
- return this;
- }
-
- public void validateValuesSize(String template, Object... values) {
- UriParser parser = new UriParserSpringImpl(template);
- Set<String> variables = parser.getVariables();
- if (variables.size() != values.length) {
- throw new IncorrectNumberOfUriKeys(String.format("Expected %s variables: %s", variables.size(), variables));
- }
- }
-
- protected String getTemplate(GraphInventoryObjectType type) {
- return type.uriTemplate();
- }
-
- protected String getTemplate(GraphInventoryObjectPlurals type) {
- return type.uriTemplate();
+ public T relationshipAPI() {
+ this.internalURI = internalURI.path(relationshipAPI);
+ return (T) this;
}
private void writeObject(ObjectOutputStream oos) throws IOException {
@@ -283,4 +79,5 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
String uri = ois.readUTF();
this.setInternalURI(UriBuilder.fromUri(uri));
}
+
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java
new file mode 100644
index 0000000000..d3c17ce9e9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java
@@ -0,0 +1,13 @@
+package org.onap.so.client.graphinventory.exceptions;
+
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri;
+
+public class GraphInventoryMultipleItemsException extends RuntimeException {
+
+ private static final long serialVersionUID = -1596266941681036917L;
+
+ public GraphInventoryMultipleItemsException(int size, GraphInventoryPluralResourceUri uri) {
+ super(String.format("Found %s objects at %s when we only expected to find one.", size, uri.build()));
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
index c55370f7dc..334e0f7231 100644
--- a/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
@@ -20,13 +20,16 @@
package org.onap.so.client.policy;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-public class CommonObjectMapperProvider {
+@Provider
+public class CommonObjectMapperProvider implements ContextResolver<ObjectMapper> {
protected ObjectMapper mapper;
@@ -43,4 +46,10 @@ public class CommonObjectMapperProvider {
public ObjectMapper getMapper() {
return mapper;
}
+
+ @Override
+ public ObjectMapper getContext(Class<?> type) {
+
+ return mapper;
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
index 8f449c21f3..20a6678386 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
@@ -22,7 +22,7 @@ package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
public class AAIObjectTypeTest {
@@ -56,14 +56,14 @@ public class AAIObjectTypeTest {
@Test
public void instanceGroupObjectTypeTest() {
final String id = "test1";
- AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, id);
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, id);
assertEquals("/network/instance-groups/instance-group/test1", aaiUri.build().toString());
}
@Test
public void collectionObjectTypeTest() {
final String id = "test1";
- AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id);
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id);
assertEquals("/network/collections/collection/test1", aaiUri.build().toString());
}
@@ -85,7 +85,7 @@ public class AAIObjectTypeTest {
@Test
public void networkPolicyObjectTypeTest() {
final String id = "test1";
- AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, id);
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, id);
assertEquals("/network/network-policies/network-policy/test1", aaiUri.build().toString());
}
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
index 5b2bff277d..c70f16eb83 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
@@ -48,7 +48,6 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.CustomQuery;
import org.onap.so.client.aai.entities.Results;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.Format;
import org.onap.so.client.graphinventory.GraphInventoryClient;
@@ -83,10 +82,10 @@ public class AAIQueryClientTest {
Format format = Format.SIMPLE;
CustomQuery query = new CustomQuery(uris);
- doReturn(restClient).when(client).createClient(isA(AAIUri.class));
+ doReturn(restClient).when(client).createClient(isA(AAIResourceUri.class));
aaiQueryClient.query(format, query);
- verify(client, times(1)).createClient(
- AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", format.toString()));
+ verify(client, times(1))
+ .createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).format(format));
verify(restClient, times(1)).put(query, String.class);
}
@@ -99,7 +98,7 @@ public class AAIQueryClientTest {
aaiQueryClient.nodesOnly();
aaiQueryClient.subgraph(subgraph);
- AAIUri aaiUri = spy(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
+ AAIResourceUri aaiUri = spy(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
doReturn(aaiUri).when(aaiUri).clone();
aaiQueryClient.setupQueryParams(aaiUri);
@@ -133,7 +132,7 @@ public class AAIQueryClientTest {
@Test
public void querySingleTypeTest() throws IOException {
- when(client.createClient(isA(AAIUri.class))).thenReturn(restClient);
+ when(client.createClient(isA(AAIResourceUri.class))).thenReturn(restClient);
when(restClient.put(any(Object.class), any(GenericType.class))).thenReturn(
mapper.readValue(getJson("pathed-result.json"), new TypeReference<Results<Map<String, Object>>>() {}));
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index 94d14684c7..a7fd6e904e 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -31,8 +31,12 @@ import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMoc
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import java.util.Optional;
import javax.ws.rs.BadRequestException;
import org.junit.Before;
import org.junit.Rule;
@@ -42,12 +46,17 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Relationship;
+import org.onap.so.client.RestClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryMultipleItemsException;
import com.github.tomakehurst.wiremock.admin.NotFoundException;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
@@ -198,4 +207,102 @@ public class AAIResourcesClientTest {
}
+ @Test
+ public void testGetOne() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
+
+ Optional<GenericVnf> result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
+
+ assertEquals("my-vnf-id", result.get().getVnfId());
+ }
+
+ @Test
+ public void testGetOneMultipleResults() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnf vnf2 = new GenericVnf();
+ vnf.setVnfId("my-vnf-id2");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ vnfs.getGenericVnf().add(vnf2);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
+
+ thrown.expect(GraphInventoryMultipleItemsException.class);
+ aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
+ }
+
+ @Test
+ public void testGetFirstMultipleResults() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnf vnf2 = new GenericVnf();
+ vnf2.setVnfId("my-vnf-id2");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ vnfs.getGenericVnf().add(vnf2);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
+
+ Optional<GenericVnf> result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri);
+
+ assertEquals("my-vnf-id", result.get().getVnfId());
+ }
+
+ @Test
+ public void testGetOneNoResults() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty());
+
+ Optional<GenericVnf> result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
+
+ assertFalse(result.isPresent());
+ }
+
+ @Test
+ public void testGetFirstNoResults() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty());
+
+ Optional<GenericVnf> result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri);
+
+ assertFalse(result.isPresent());
+ }
+
+ @Test
+ public void testGetFirstWrongPluralClass() {
+ GenericVnf vnf = new GenericVnf();
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnf.class)).thenReturn(Optional.of(vnf));
+
+ Optional<GenericVnf> result = aaiClient.getFirst(GenericVnf.class, GenericVnf.class, uri);
+
+ assertFalse(result.isPresent());
+ }
+
}
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 305cdf59cc..cbcb60513b 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
@@ -95,7 +95,7 @@ public class AAITransactionalClientTest {
@Test
public void testConnect() throws IOException {
- List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>();
+ List<AAIResourceUri> uris = new ArrayList<>();
uris.add(uriB);
Map<String, Object> map = new HashMap<>();
@@ -117,7 +117,7 @@ public class AAITransactionalClientTest {
@Test
public void testDisconnect() throws IOException {
- List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>();
+ List<AAIResourceUri> uris = new ArrayList<>();
uris.add(uriB);
AAITransactionalClient transactions = aaiClient.beginTransaction().disconnect(uriA, uris);
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIURITest.java b/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
index 556b4429d4..8971f91602 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
@@ -23,7 +23,7 @@ package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import javax.ws.rs.core.UriBuilder;
import org.junit.Test;
-import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
public class AAIURITest {
@@ -33,7 +33,7 @@ public class AAIURITest {
@Test
public void verifyTemplateReplacement() {
final String id = "test1";
- AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id);
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id);
String manualReplace = AAIObjectType.CONFIGURATION.toString().replaceAll("\\{configuration-id\\}", id);
assertEquals("uri template replaced", aaiUri.build(), UriBuilder.fromPath(manualReplace).build());
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 fb45652d53..1a1a7d124e 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
@@ -23,17 +23,19 @@ package org.onap.so.client.aai;
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.DSLStartNode;
+import org.onap.so.client.graphinventory.entities.Output;
+import org.onap.so.client.graphinventory.entities.Start;
+import org.onap.so.client.graphinventory.entities.TraversalBuilder;
import org.onap.so.client.graphinventory.entities.__;
public class DSLQueryBuilderTest {
-
@Test
public void whereTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.CLOUD_REGION,
+ DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION,
__.key("cloud-owner", "att-nc"), __.key("cloud-region-id", "test")));
builder.to(__.node(AAIObjectType.VLAN_TAG))
@@ -42,13 +44,13 @@ public class DSLQueryBuilderTest {
assertEquals("cloud-region('cloud-owner', 'att-nc')('cloud-region-id', 'test') > "
+ "vlan-tag (> owning-entity('owning-entity-name', 'name')) > " + "vlan-tag*('vlan-id-outer', '108')",
- builder.build());
+ builder.build().get());
}
@Test
public void unionTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
__.node(AAIObjectType.VSERVER)
@@ -56,53 +58,53 @@ public class DSLQueryBuilderTest {
assertEquals(
"generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
- builder.build());
+ builder.build().get());
}
@Test
public void whereUnionTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
builder.where(__.union(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")),
__.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")))));
assertEquals("generic-vnf*('vnf-id', 'vnfId') (> [ pserver('hostname', 'hostname1'), "
- + "vserver > pserver('hostname', 'hostname1') ])", builder.build());
+ + "vserver > pserver('hostname', 'hostname1') ])", builder.build().get());
}
@Test
public void notNullTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(
- new DSLNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "", "null").not()).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder.traversal(
+ new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "", "null").not()).output());
- assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build());
+ assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build().get());
}
@Test
public void shortCutToTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')",
- builder.build());
+ builder.build().get());
}
@Test
public void limitTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
builder.to(AAIObjectType.P_INTERFACE).limit(2).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id') LIMIT 2",
- builder.build());
+ builder.build().get());
}
@Test
public void equalsTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
assertTrue(
@@ -110,10 +112,9 @@ public class DSLQueryBuilderTest {
assertTrue(builder.equals(builder));
}
-
@Test
public void mixedTypeTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.CLOUD_REGION,
+ DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(new DSLStartNode(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(
@@ -122,19 +123,19 @@ public class DSLQueryBuilderTest {
@Test
public void outputOnNodeLambdasTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId")));
+ DSLQueryBuilder<Start, Start> builder = TraversalBuilder
+ .fragment(new DSLStartNode(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());
+ builder.build().get());
}
@Test
public void skipOutputOnUnionTest() {
- DSLQueryBuilder<DSLNode, DSLNode> builder =
- new DSLQueryBuilder<>(new DSLNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
__.node(AAIObjectType.VSERVER)
@@ -143,6 +144,6 @@ public class DSLQueryBuilderTest {
assertEquals(
"generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
- builder.build());
+ builder.build().get());
}
}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java b/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
index ec7c6434a7..039bbb3614 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
@@ -43,15 +43,12 @@ public class RelationshipsTest {
Relationships relationships = wrapper.getRelationships().get();
List<AAIResourceUri> test = relationships.getRelatedUris(AAIObjectType.VCE);
-
- System.out.println(test.get(0).build());
List<AAIResourceUri> uris = Arrays.asList(
AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"),
AAIUriFactory.createResourceUri(AAIObjectType.VCE, "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"),
AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a2935fa9-b743-49f4-9813-a127f13c4e93"),
AAIUriFactory.createResourceUri(AAIObjectType.VCE, "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4"));
-
assertTrue(uris.containsAll(test) && test.containsAll(uris));
}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java
index d26ff8d507..0249bea794 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java
@@ -33,7 +33,7 @@ public class AAISimpleUriFromParentUriTest {
AAIResourceUri parentUri =
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "key1", "key2", "key3");
- AAIUri uri = new AAISimpleUri(parentUri, AAIObjectType.ALLOTTED_RESOURCE, "key4");
+ AAIResourceUri uri = new AAISimpleUri(parentUri, AAIObjectType.ALLOTTED_RESOURCE, "key4");
assertEquals("path appended",
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4",
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
index ab1529d3ba..6bf67ffce8 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals;
import javax.ws.rs.core.UriBuilder;
import org.junit.Test;
import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
public class AAISimpleUriFromUriTest {
@@ -33,7 +32,7 @@ public class AAISimpleUriFromUriTest {
@Test
public void removeHost() {
- AAIUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
UriBuilder
.fromUri("https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053")
.build());
@@ -46,7 +45,7 @@ public class AAISimpleUriFromUriTest {
@Test
public void noChange() {
- AAIUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build());
assertEquals("no change", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString());
@@ -56,11 +55,22 @@ public class AAISimpleUriFromUriTest {
@Test
public void encodingPreserved() {
- AAIUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
assertEquals("encoding preserved", "/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053",
uri.build().toString());
}
+
+ @Test
+ public void beforeBuildEquality() {
+
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.VCE,
+ UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
+
+ AAIResourceUri uri2 = new AAISimpleUri(AAIObjectType.VCE, "a9f ec18e-1ea3-40e4-a6c0-a89b3de07053");
+ assertEquals("are equal", uri2, uri);
+
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
index 4e9d5aa8e8..6c1b3d69a2 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
@@ -20,14 +20,10 @@
package org.onap.so.client.aai.entities.uri;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.collection.IsEmptyCollection.empty;
-import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -36,7 +32,6 @@ import org.junit.Test;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
public class AAISimpleUriTest {
@@ -44,34 +39,52 @@ public class AAISimpleUriTest {
@Test
public void relatedToTestPlural() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
- uri.relatedTo(AAIObjectPlurals.PSERVER);
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER);
String uriOutput = uri.build().toString();
- assertEquals(true, uriOutput.contains("related-to"));
+ assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput);
}
@Test
public void relatedToTestSingular() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
- uri.relatedTo(AAIObjectType.PSERVER, "test2");
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
+ .relatedTo(AAIObjectType.PSERVER, "test2");
String uriOutput = uri.build().toString();
- assertEquals(true, uriOutput.contains("related-to"));
+ assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput);
}
@Test
public void cloneTestSingular() {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
AAIResourceUri cloned = uri.clone();
- Map<String, String> keys = cloned.getURIKeys();
- assertThat(keys.values(), contains("test1"));
+ assertEquals("/network/generic-vnfs/generic-vnf/test1", cloned.build().toString());
+
+ cloned.limit(2);
+
+ assertNotEquals(uri.build().toString(), cloned.build().toString());
}
@Test
public void cloneTestPlural() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
- AAIResourceUri cloned = uri.clone();
- Map<String, String> keys = cloned.getURIKeys();
- assertThat(keys.values(), empty());
+ AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ AAISimplePluralUri cloned = uri.clone();
+ assertEquals("/network/generic-vnfs", cloned.build().toString());
+ }
+
+ @Test
+ public void cloneTestWithRelatedTo() {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
+ .relatedTo(AAIObjectType.PSERVER, "test2");
+ String uriOutput = uri.clone().build().toString();
+ assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput);
+ }
+
+ @Test
+ public void cloneTestPluralWithRelatedTo() {
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER);
+ String uriOutput = uri.clone().build().toString();
+ assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput);
}
@Test
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
index 9b4f5dafb5..8a203f6439 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
@@ -24,14 +24,13 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
public class AAIUriFactoryTest {
@Test
public void testCreateResourceUri() {
- AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
assertEquals(expected, uri.build().toString());
@@ -40,7 +39,7 @@ public class AAIUriFactoryTest {
@Test
public void testCreateNodesUri() {
- AAIUri uri = AAIUriFactory.createNodesUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+ AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
String expected = "/nodes/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
assertEquals(expected, uri.build().toString());
@@ -49,8 +48,8 @@ public class AAIUriFactoryTest {
@Test
public void testCreateResourceFromExistingURI() {
- AAIUri uri = new AAISimpleUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
- AAIUri uri2 = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.GENERIC_VNF, uri.build());
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+ AAIResourceUri uri2 = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.GENERIC_VNF, uri.build());
String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
assertEquals(expected, uri2.build().toString());
@@ -59,7 +58,8 @@ public class AAIUriFactoryTest {
@Test
public void testCreateResourceURIForPluralsWithValues() {
- AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, "customerId", "serviceType");
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, "customerId", "serviceType");
String expected =
"/business/customers/customer/customerId/service-subscriptions/service-subscription/serviceType/service-instances";
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
index 4be6753894..a92a7c3c1a 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
@@ -44,7 +44,7 @@ public class AllottedResourceLookupUriTest {
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4")
.when(spy).getObjectById(any(Object.class));
- final URI result = spy.build();
+ final URI result = spy.locateAndBuild();
final URI expected = UriBuilder.fromPath(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4")
.build();
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
index 86ee08c4e6..3fbbc7c110 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
@@ -21,8 +21,6 @@
package org.onap.so.client.aai.entities.uri;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -48,7 +46,7 @@ public class IncorrectNumberOfUriKeysTest {
public void verifyIncorrectNumberOfKeysPlural() {
thrown.expect(IncorrectNumberOfUriKeys.class);
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, "my-cloud-owner");
+ AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, "my-cloud-owner");
}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
index 9bef35e3b5..71d65b6f45 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
@@ -56,11 +56,11 @@ import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.client.aai.AAIClient;
-import org.onap.so.client.aai.AAIObjectType;
+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.defaultproperties.DefaultAAIPropertiesImpl;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException;
@@ -111,7 +111,7 @@ public class ServiceInstanceUriTest {
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
.when(spy).getObjectById(any(Object.class));
- final URI result = spy.build();
+ final URI result = spy.locateAndBuild();
final URI expected = UriBuilder.fromPath(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
.build();
@@ -129,7 +129,7 @@ public class ServiceInstanceUriTest {
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
.when(spy).getObjectById(any(Object.class));
- final URI result = spy.resourceVersion("1234").build();
+ final URI result = ((HttpAwareUri) spy.resourceVersion("1234")).locateAndBuild();
final URI expected = UriBuilder.fromUri(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234")
.build();
@@ -147,7 +147,7 @@ public class ServiceInstanceUriTest {
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space")
.when(spy).getObjectById(any(Object.class));
- final URI result = spy.build();
+ final URI result = spy.locateAndBuild();
final URI expected = UriBuilder.fromUri(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space")
.build();
@@ -175,9 +175,8 @@ public class ServiceInstanceUriTest {
ServiceInstanceUri spy = spy(instance);
String uri =
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
- doReturn(uri).when(spy).getObjectById(any(Object.class));
doReturn(Optional.of(uri)).when(spy).getCachedValue();
- final URI result = spy.resourceVersion("1234").clone().build();
+ final URI result = ((HttpAwareUri) spy.resourceVersion("1234").clone()).locateAndBuild();
final URI expected = UriBuilder.fromUri(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234")
.build();
@@ -210,7 +209,7 @@ public class ServiceInstanceUriTest {
when(wrapper.getJson()).thenReturn(content);
when(spy.getResourcesClient()).thenReturn(mockResourcesClient);
exception.expect(GraphInventoryUriComputationException.class);
- spy.build();
+ spy.locateAndBuild();
}
@@ -233,7 +232,7 @@ public class ServiceInstanceUriTest {
.stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")).willReturn(
aResponse().withStatus(404).withHeader("Content-Type", "application/json").withBodyFile("")));
exception.expect(NotFoundException.class);
- spy.build();
+ spy.locateAndBuild();
}
@Test
@@ -250,7 +249,7 @@ public class ServiceInstanceUriTest {
ArgumentMatchers.<Class<NotFoundException>>any())).thenReturn(wrapper);
when(wrapper.getJson()).thenReturn(content);
when(spy.getResourcesClient()).thenReturn(mockResourcesClient);
- spy.build();
+ spy.locateAndBuild();
instance = spy.clone();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -271,6 +270,32 @@ public class ServiceInstanceUriTest {
// use the cached value do not call out to external system
verify(spy2, times(0)).getResourcesClient();
+ }
+
+ @Test
+ public void relatedToTest() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+ ServiceInstanceUri spy = spy(instance);
+ doReturn(
+ "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
+ .when(spy).getObjectById(any(Object.class));
+
+ final URI result = spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name").build();
+ final URI expected = UriBuilder.fromUri(
+ "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/related-to/generic-vnfs?vnf-name=my-vnf-name")
+ .build();
+ assertEquals("result is equal", expected, result);
+ }
+
+ @Test
+ public void relatedToEqualityTestBeforeBuildTest()
+ throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+ ServiceInstanceUri spy = spy(instance);
+
+ final AAIPluralResourceUri result =
+ spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name");
+ assertEquals("result is equal", result, result);
}
}
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 0afc272b0a..168f82bdf3 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
@@ -23,9 +23,7 @@ package org.onap.so.apihandlerinfra;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
-import javax.servlet.ServletConfig;
import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Context;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletProperties;
import org.onap.logging.filter.base.Constants;
@@ -96,6 +94,7 @@ public class JerseyConfiguration extends ResourceConfig {
// 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);
+
register(ModelDistributionRequest.class);
property(ServletProperties.FILTER_FORWARD_ON_404, true);
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 33c2ac80be..c43a050500 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
@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import javax.transaction.Transactional;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -73,6 +74,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
@@ -105,6 +107,9 @@ public class OrchestrationRequests {
@Autowired
private CamundaRequestHandler camundaRequestHandler;
+ @Autowired
+ private Environment env;
+
@GET
@Path("/{version:[vV][4-8]}/{requestId}")
@Operation(description = "Find Orchestrated Requests for a given requestId", responses = @ApiResponse(
@@ -436,12 +441,14 @@ public class OrchestrationRequests {
String retryStatusMessage = iar.getRetryStatusMessage();
String taskName = null;
- if (format == null || !format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLENOTASKINFO.toString())) {
- 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 (daysSinceRequest(iar) <= camundaCleanupInterval()) {
+ if (format == null || !format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLENOTASKINFO.toString())) {
+ 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;
+ }
}
}
}
@@ -594,4 +601,20 @@ public class OrchestrationRequests {
}
return infraActiveRequest;
}
+
+ protected long daysSinceRequest(InfraActiveRequests request) {
+ long startTime = request.getStartTime().getTime();
+ long now = System.currentTimeMillis();
+
+ return TimeUnit.MILLISECONDS.toDays(now - startTime);
+ }
+
+ protected int camundaCleanupInterval() {
+ String cleanupInterval = env.getProperty("mso.camundaCleanupInterval");
+ int days = 30;
+ if (cleanupInterval != null) {
+ days = Integer.parseInt(cleanupInterval);
+ }
+ return days;
+ }
}
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 baa7af77a5..b46690f2a7 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
@@ -30,6 +30,7 @@ mso:
uri: /sobpmnengine/history/activity-instance
camundaURL: http://localhost:8089
camundaAuth: E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE
+ camundaCleanupInterval: 30
spring:
datasource:
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.java
new file mode 100644
index 0000000000..e6409fab87
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/AAIDeserializeTest.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.apihandlerinfra;
+
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import javax.ws.rs.core.MediaType;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.aai.domain.yang.Tenant;
+import org.onap.so.client.aai.AAIVersion;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpHeaders;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class AAIDeserializeTest extends BaseTest {
+
+ private final ObjectMapper mapper = new ObjectMapper();
+
+ @Autowired
+ private MsoRequest msoReq;
+
+ @Value("${wiremock.server.port}")
+ private String wiremockPort;
+
+ @Before
+ public void beforeClass() {
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ }
+
+ public String inputStream(String JsonInput) throws IOException {
+ JsonInput = "src/test/resources/MsoRequestTest" + JsonInput;
+ return new String(Files.readAllBytes(Paths.get(JsonInput)));
+ }
+
+ @Test
+ public void doNotFailOnUnknownPropertiesTest() throws JsonParseException, JsonMappingException, IOException {
+ wireMockServer.stubFor(get(("/aai/" + AAIVersion.LATEST
+ + "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/mdt1/tenants/tenant/88a6ca3ee0394ade9403f075db23167e"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("aai/UnknownProperty.json")
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ ServiceInstancesRequest sir = mapper.readValue(inputStream("/AAI.json"), ServiceInstancesRequest.class);
+ String tenantId = "88a6ca3ee0394ade9403f075db23167e";
+ String tenantNameFromAAI = "testTenantName";
+ String cloudOwner = "cloudOwner";
+ sir.getRequestDetails().getCloudConfiguration().setCloudOwner(cloudOwner);
+ Tenant tenant = new Tenant();
+ tenant.setTenantId(tenantId);
+ tenant.setTenantName(tenantNameFromAAI);
+ String tenantName = msoReq.getTenantNameFromAAI(sir);
+ assertEquals(tenantNameFromAAI, tenantName);
+ }
+
+}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
index 4631b53bc0..3db2b2d96d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
@@ -29,6 +29,11 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringUtils;
import org.junit.Before;
@@ -41,6 +46,7 @@ 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.apihandlerinfra.exceptions.ContactCamundaException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.constants.OrchestrationRequestFormat;
import org.onap.so.constants.Status;
@@ -49,6 +55,7 @@ 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;
+import org.springframework.core.env.Environment;
@RunWith(MockitoJUnitRunner.class)
public class OrchestrationRequestsUnitTest {
@@ -62,6 +69,8 @@ public class OrchestrationRequestsUnitTest {
private Response response;
@Mock
private CamundaRequestHandler camundaRequestHandler;
+ @Mock
+ private Environment env;
@Rule
public ExpectedException thrown = ExpectedException.none();
@InjectMocks
@@ -79,6 +88,7 @@ public class OrchestrationRequestsUnitTest {
private InfraActiveRequests iar;
boolean includeCloudRequest = false;
private static final String ROLLBACK_EXT_SYSTEM_ERROR_SOURCE = "SDNC";
+ private Timestamp startTime = new Timestamp(System.currentTimeMillis());
@Before
@@ -93,6 +103,7 @@ public class OrchestrationRequestsUnitTest {
iar.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
iar.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
iar.setResourceStatusMessage("The vf module already exist");
+ iar.setStartTime(startTime);
}
@Test
@@ -113,6 +124,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
iar.setOriginalRequestId(ORIGINAL_REQUEST_ID);
@@ -138,6 +150,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
OrchestrationRequestFormat.DETAIL.toString(), "v7");
@@ -161,6 +174,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
@@ -187,6 +201,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
@@ -214,6 +229,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
@@ -236,6 +252,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
@@ -259,6 +276,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
@@ -283,6 +301,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
@@ -306,6 +325,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
iar.setFlowStatus(null);
@@ -348,6 +368,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
iar.setFlowStatus("Successfully completed all Building Blocks");
@@ -374,6 +395,7 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
iar.setFlowStatus("All Rollback flows have completed successfully");
@@ -431,4 +453,35 @@ public class OrchestrationRequestsUnitTest {
assertFalse(required);
}
+ @Test
+ public void taskNameLookup() throws ContactCamundaException {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setRequestId("70debc2a-d6bc-4795-87ba-38a94d9b0b99");
+ Instant startInstant = Instant.now().minus(1, ChronoUnit.DAYS);
+ req.setStartTime(Timestamp.from(startInstant));
+ when(env.getProperty("mso.camundaCleanupInterval")).thenReturn(null);
+ when(camundaRequestHandler.getTaskName("70debc2a-d6bc-4795-87ba-38a94d9b0b99")).thenReturn("taskName");
+
+ RequestStatus requestStatus = new RequestStatus();
+ req.setFlowStatus("Building blocks 1 of 3 completed.");
+
+ orchestrationRequests.mapRequestStatusAndExtSysErrSrcToRequest(req, requestStatus, null, "v7");
+ assertEquals("FLOW STATUS: Building blocks 1 of 3 completed. TASK INFORMATION: taskName",
+ requestStatus.getStatusMessage());
+ }
+
+ @Test
+ public void noCamundaLookupAfterInterval() throws ContactCamundaException {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setRequestId("70debc2a-d6bc-4795-87ba-38a94d9b0b99");
+ Instant startInstant = Instant.now().minus(36, ChronoUnit.DAYS);
+ req.setStartTime(Timestamp.from(startInstant));
+ when(env.getProperty("mso.camundaCleanupInterval")).thenReturn("35");
+
+ RequestStatus requestStatus = new RequestStatus();
+ req.setFlowStatus("Building blocks 1 of 3 completed.");
+
+ orchestrationRequests.mapRequestStatusAndExtSysErrSrcToRequest(req, requestStatus, null, "v7");
+ assertEquals("FLOW STATUS: Building blocks 1 of 3 completed.", requestStatus.getStatusMessage());
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/AAI.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/AAI.json
new file mode 100644
index 0000000000..455d73a13b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/AAI.json
@@ -0,0 +1,132 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "model-name",
+ "modelVersion": "10"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "project": {
+ "projectName": "{some project name}"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "{some subscriber id}"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "xxxxxx"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "type",
+ "aLaCarte": false,
+ "userParams": [
+ {
+ "service": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "model-name",
+ "modelVersion": "10"
+ },
+ "instanceParams": [],
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelCustomizationName": "model-name 0",
+ "modelName": "model-name",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "platform": {
+ "platformName": "someValue"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "someValue"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceParams": [
+ {
+ "instanceName": "someVnfInstanceName"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "name._base__BV..module-0",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
+ },
+ "instanceParams": [
+ {
+ "vmx_int_net_len": "24",
+ "asn": "someValue"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "name._vRE_BV..module-1",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
+ "modelType": "vfModule"
+ },
+ "instanceParams": [
+ {
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vre_a_volume_size_0": "100"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "name._vRE_BV..module-1",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
+ },
+ "instanceParams": [
+ {
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vre_a_volume_size_0": "50"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "name.BV..module-2",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
+ },
+ "instanceParams": [
+ {
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vmx_vpfe_int_ip_0": "192.168.0.16"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+}
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 96fed36d45..3b2eca7ce2 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. TASK INFORMATION: Last task executed: BB to Execute ROLLBACK STATUS: Rollback has been completed successfully.",
+ "statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. 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 801841313a..baddb21617 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
@@ -58,7 +58,7 @@
},
"requestStatus":{
"requestState":"PENDING",
- "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.",
+ "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.",
"percentProgress":0,
"timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
@@ -321,7 +321,7 @@
},
"requestStatus":{
"requestState":"PENDING",
- "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.",
+ "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.",
"percentProgress":0,
"timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/UnknownProperty.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/UnknownProperty.json
new file mode 100644
index 0000000000..e606f8aa30
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/UnknownProperty.json
@@ -0,0 +1 @@
+{"tenant-id":"78491aac74be4fab9873db114774b475","tenant-name":"testTenantName", "test":"test", "parent-id": "25239", "tenant-context":"Development","resource-version":"1581690782612"} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
index deaa2a3221..0d7fe7d38f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java
@@ -93,6 +93,11 @@ public class CloudSite {
@Column(name = "CLOUDIFY_ID")
private String cloudifyId;
+ @JsonProperty("cloud_owner")
+ @BusinessKey
+ @Column(name = "CLOUD_OWNER")
+ private String cloudOwner;
+
// Derived property (set by CloudConfig loader based on identityServiceId)
@BusinessKey
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@@ -266,12 +271,20 @@ public class CloudSite {
this.identityServiceId = identityServiceId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId())
.append("identityServiceId", getIdentityServiceId()).append("cloudVersion", getCloudVersion())
.append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform())
- .append("orchestrator", getOrchestrator()).toString();
+ .append("orchestrator", getOrchestrator()).append("cloud-owner", getCloudOwner()).toString();
}
@Override
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java
new file mode 100644
index 0000000000..1f19dcc1dd
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 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.beans;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+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 com.openpojo.business.annotation.BusinessKey;
+
+@Entity
+@Table(name = "network_technology_reference")
+public class NetworkTechnologyReference implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name = "ID", nullable = false, updatable = false)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
+
+ @BusinessKey
+ @Column(name = "cloud_owner")
+ private String cloudOwner;
+
+ @BusinessKey
+ @Column(name = "network_technology")
+ private String networkTechnology;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("id", id).append("cloudOwner", cloudOwner)
+ .append("networkTechnology", networkTechnology).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof NetworkTechnologyReference)) {
+ return false;
+ }
+ NetworkTechnologyReference castOther = (NetworkTechnologyReference) other;
+ return new EqualsBuilder().append(cloudOwner, castOther.cloudOwner)
+ .append(networkTechnology, castOther.networkTechnology).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(cloudOwner).append(networkTechnology).toHashCode();
+ }
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ public String getNetworkTechnology() {
+ return networkTechnology;
+ }
+
+ public void setNetworkTechnology(String networkTechnology) {
+ this.networkTechnology = networkTechnology;
+ }
+
+
+
+}
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 0d7a6dbd1f..8222b72d8f 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
@@ -79,6 +79,9 @@ public class Service implements Serializable {
@Column(name = "SERVICE_ROLE")
private String serviceRole;
+ @Column(name = "SERVICE_FUNCTION")
+ private String serviceFunction;
+
@Column(name = "ENVIRONMENT_CONTEXT")
private String environmentContext;
@@ -139,6 +142,9 @@ public class Service implements Serializable {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "service")
private List<ServiceArtifact> serviceArtifactList;
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "service")
+ private List<ServiceInfo> serviceInfos;
+
@Column(name = "NAMING_POLICY")
private String namingPolicy;
@@ -385,6 +391,17 @@ public class Service implements Serializable {
this.serviceArtifactList = serviceArtifactList;
}
+ public List<ServiceInfo> getServiceInfos() {
+ if (serviceInfos == null) {
+ serviceInfos = new ArrayList<>();
+ }
+ return serviceInfos;
+ }
+
+ public void setServiceInfos(List<ServiceInfo> serviceInfos) {
+ this.serviceInfos = serviceInfos;
+ }
+
public String getWorkloadContext() {
return this.workloadContext;
}
@@ -456,4 +473,13 @@ public class Service implements Serializable {
public void setControllerActor(String controllerActor) {
this.controllerActor = controllerActor;
}
+
+ public String getServiceFunction() {
+ return serviceFunction;
+ }
+
+ public void setServiceFunction(String serviceFunction) {
+ this.serviceFunction = serviceFunction;
+ }
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java
index f9c95767f6..d11a112c80 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java
@@ -45,9 +45,8 @@ public class ServiceInfo implements Serializable {
@Column(name = "SERVICE_PROPERTIES")
private String serviceProperties;
- @OneToOne(cascade = CascadeType.ALL)
- @JoinTable(name = "service_to_service_info", joinColumns = @JoinColumn(name = "SERVICE_INFO_ID"),
- inverseJoinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"))
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "SERVICE_MODEL_UUID")
private Service service;
public Integer getId() {
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java
index e3a4ca264e..0b7065490b 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * Copyright (C) 2019 Tech Mahindra
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in 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,14 +20,13 @@
package org.onap.so.db.catalog.data.repository;
-import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ServiceInfo;
+
+import java.util.List;
+import org.onap.so.db.catalog.beans.NetworkTechnologyReference;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-@RepositoryRestResource(collectionResourceRel = "serviceInfo", path = "serviceInfo")
-public interface ServiceInfoRepository extends JpaRepository<ServiceInfo, Integer> {
- ServiceInfo findByService(Service service);
+public interface NetworkTechnologyReferenceRepository extends JpaRepository<NetworkTechnologyReference, Integer> {
+ List<NetworkTechnologyReference> findAllByCloudOwner(String cloudOwner);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java
index ec4e922c8f..65cbb5253e 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java
@@ -39,7 +39,6 @@ public class ServiceMacroHolder implements Serializable {
private ArrayList<AllottedResourceCustomization> allottedResourceCustomizations;
private ArrayList<VnfResourceCustomization> vnfResourceCustomizations;
private ArrayList<ServiceProxyResourceCustomization> serviceProxyResourceCustomizations;
- private ServiceInfo serviceInfo;
public ServiceMacroHolder() {
@@ -50,7 +49,6 @@ public class ServiceMacroHolder implements Serializable {
this.allottedResourceCustomizations = new ArrayList<>();
this.vnfResourceCustomizations = new ArrayList<>();
this.serviceProxyResourceCustomizations = new ArrayList<>();
- this.serviceInfo = null;
}
public ServiceMacroHolder(Service service) {
@@ -66,14 +64,6 @@ public class ServiceMacroHolder implements Serializable {
this.service = service;
}
- public ServiceInfo getServiceInfo() {
- return serviceInfo;
- }
-
- public void setServiceInfo(ServiceInfo serviceInfo) {
- this.serviceInfo = serviceInfo;
- }
-
public void setVnfResources(ArrayList<VnfResource> vnfResources) {
this.vnfResources = vnfResources;
}
@@ -165,11 +155,6 @@ public class ServiceMacroHolder implements Serializable {
} else {
sb.append("service: null");
}
- if (this.serviceInfo != null) {
- sb.append("serviceInfo: " + this.serviceInfo.toString());
- } else {
- sb.append("serviceInfo: null");
- }
if (this.vnfResourceCustomizations != null && this.vnfResourceCustomizations.size() > 0) {
int i = 0;
sb.append("VnfResources: ");
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index 0852aa026d..b38d4d9376 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -683,7 +683,7 @@ INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `
INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `PROJECT_DOMAIN_NAME`, `USER_DOMAIN_NAME`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, NULL, 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33');
-INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`, `SUPPORT_FABRIC`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28', 1);
+INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`, `SUPPORT_FABRIC`,`CLOUD_OWNER`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28', 1,'cloudOwner');
INSERT INTO `controller_selection_reference` (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`) VALUES
('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'ConfigScaleOut'),
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 6573def570..0d49903e51 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -121,6 +121,7 @@ CREATE TABLE `cloud_sites` (
`CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`SUPPORT_FABRIC` bit(1) NOT NULL DEFAULT 1,
+ `CLOUD_OWNER` varchar(225) NOT NULL,
PRIMARY KEY (`ID`),
KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`),
CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`)
@@ -802,6 +803,7 @@ CREATE TABLE `service` (
`TOSCA_CSAR_ARTIFACT_UUID` varchar(200) DEFAULT NULL,
`SERVICE_TYPE` varchar(200) DEFAULT NULL,
`SERVICE_ROLE` varchar(200) DEFAULT NULL,
+ `SERVICE_FUNCTION` varchar(200) DEFAULT NULL,
`ENVIRONMENT_CONTEXT` varchar(200) DEFAULT NULL,
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index b231dedf91..3a9ec375da 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -42,20 +42,20 @@
</goals>
<configuration>
<source>
- println 'Project version: ' + project.properties['so.project.version'];
- def versionArray;
- if ( project.properties['so.project.version'] != null ) {
- versionArray = project.properties['so.project.version'].split('-');
- }
+ println 'Project version: ' + project.properties['so.project.version'];
+ def versionArray;
+ if ( project.properties['so.project.version'] != null ) {
+ versionArray = project.properties['so.project.version'].split('-');
+ }
- if ( project.properties['so.project.version'].endsWith("-SNAPSHOT") ) {
- project.properties['project.docker.latesttag.version']=versionArray[0] + "-SNAPSHOT-latest";
- } else {
- project.properties['project.docker.latesttag.version']=versionArray[0] + "-STAGING-latest";
- }
+ if ( project.properties['so.project.version'].endsWith("-SNAPSHOT") ) {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + "-SNAPSHOT-latest";
+ } else {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + "-STAGING-latest";
+ }
- println 'New tag for docker: ' + project.properties['project.docker.latesttag.version'];
- </source>
+ println 'New tag for docker: ' + project.properties['project.docker.latesttag.version'];
+ </source>
</configuration>
</execution>
</executions>
diff --git a/releases/1.6.0.yaml b/releases/1.6.0.yaml
new file mode 100644
index 0000000000..8e1e371e5b
--- /dev/null
+++ b/releases/1.6.0.yaml
@@ -0,0 +1,33 @@
+---
+distribution_type: 'container'
+container_release_tag: '1.6.0'
+project: 'so'
+log_dir: 'so-maven-docker-stage-elalto/2/'
+ref: '3c1f70e434b23e8bda331837c1e4ed8506f0166d'
+containers:
+ - name: 'so/vnfm-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/catalog-db-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/request-db-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/openstack-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/sdnc-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/vfc-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/sdc-controller'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/bpmn-infra'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/so-monitoring'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/api-handler-infra'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/so-appc-orchestrator'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/nssmf-adapter'
+ version: '1.6.0-20200326T0421'
+ - name: 'so/ve-vnfm-adapter'
+ version: '1.6.0-20200326T0421' \ No newline at end of file
diff --git a/version.properties b/version.properties
index a0756adf2b..922c4fa961 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=1
minor=6
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}