diff options
author | Benjamin, Max <max.benjamin@att.com> | 2020-05-07 10:13:24 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-05-07 10:13:25 -0400 |
commit | db7f984c6b4a7a381a336b26bfea5a32691a00fb (patch) | |
tree | f8fc9cbef38d0136b7d92c03443fee62b5a58b90 /bpmn | |
parent | 5e67cc099f6bcade2f12bf9220bdf3682f2d06c1 (diff) |
uri params now available in info object
uri params now available in info object
make sure uri keys are retrieved via constants
Issue-ID: SO-2908
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ieb701c2705ecdb2365d557bc51e4f604d92ec680
Diffstat (limited to 'bpmn')
18 files changed, 203 insertions, 209 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index 83be39c264..f5cf541076 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -22,7 +22,6 @@ package org.onap.so.bpmn.common.scripts -import org.onap.so.logger.LoggingAnchor import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup @@ -31,8 +30,10 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.Relationships import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import org.onap.so.constants.Defaults +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.logging.filter.base.ErrorCode +import org.onap.so.constants.Defaults +import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -71,7 +72,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ if(relationships.isPresent()){ List<AAIResourceUri> tenantUris = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT) for (AAIResourceUri tenantURI: tenantUris){ - volumeGroupTenantId = tenantURI.getURIKeys().get("tenant-id") + volumeGroupTenantId = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) } } //Determine if Tenant Ids match diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 0fd38badad..bfa77212c4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -34,14 +34,36 @@ import java.util.UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.javatuples.Pair; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; -import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; @@ -52,12 +74,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException; -import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; @@ -1044,7 +1060,8 @@ public class BBInputSetup implements JavaDelegate { protected ServiceSubscription getServiceSubscriptionFromURI(String resourceId, Customer customer) { Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); - String subscriptionServiceType = uriKeys.get("service-type"); + String subscriptionServiceType = + uriKeys.get(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType); org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI = bbInputSetupUtils.getAAIServiceSubscription(customer.getGlobalCustomerId(), subscriptionServiceType); if (serviceSubscriptionAAI != null) { @@ -1056,7 +1073,7 @@ public class BBInputSetup implements JavaDelegate { protected Customer getCustomerFromURI(String resourceId) { Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); - String globalCustomerId = uriKeys.get("global-customer-id"); + String globalCustomerId = uriKeys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId); org.onap.aai.domain.yang.Customer customerAAI = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); if (customerAAI != null) { return mapperLayer.mapAAICustomer(customerAAI); @@ -1085,8 +1102,9 @@ public class BBInputSetup implements JavaDelegate { if (customer == null) { Map<String, String> uriKeys = bbInputSetupUtils .getURIKeysFromServiceInstance(parameter.getServiceInstance().getServiceInstanceId()); - String globalCustomerId = uriKeys.get("global-customer-id"); - String subscriptionServiceType = uriKeys.get("service-type"); + String globalCustomerId = uriKeys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId); + String subscriptionServiceType = + uriKeys.get(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType); customer = mapCustomer(globalCustomerId, subscriptionServiceType); } outputBB.setServiceInstance(parameter.getServiceInstance()); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index b327847c11..458919c48e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -58,6 +58,12 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -94,11 +100,6 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException; -import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; @@ -944,8 +945,8 @@ public class BBInputSetupTest { cloudRegion.setTenantId("tenantId"); Map<String, String> uriKeys = new HashMap<>(); - uriKeys.put("global-customer-id", "global-customer-id"); - uriKeys.put("service-type", "service-type"); + uriKeys.put(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId, "global-customer-id"); + uriKeys.put(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType, "service-type"); Customer customer = new Customer(); ServiceSubscription serviceSubscription = new ServiceSubscription(); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index bc118791a3..005f0f3c6b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -22,10 +22,16 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.onap.so.logger.LoggingAnchor +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.VolumeGroup +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.logging.filter.base.ErrorCode import org.onap.so.bpmn.common.scripts.AaiUtil; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.onap.so.bpmn.common.scripts.ExceptionUtil; @@ -33,19 +39,13 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.VidUtils; import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.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 import groovy.json.JsonSlurper -import javax.ws.rs.NotFoundException - /** * This groovy class supports the <class>DeleteVfModuleVolume.bpmn</class> process. */ @@ -285,7 +285,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { if(wrapper.getRelationships().isPresent()) { List<AAIResourceUri> tenantURIList = wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.TENANT) if(!tenantURIList.isEmpty()){ - return tenantURIList.get(0).getURIKeys().get("tenant-id") + return tenantURIList.get(0).getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) } } return null 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 00242b27f6..22e5819068 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 @@ -22,12 +22,27 @@ package org.onap.so.bpmn.infrastructure.scripts; -import javax.ws.rs.core.UriBuilder -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory +import javax.ws.rs.NotFoundException import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.L3Network +import org.onap.aai.domain.yang.L3Networks +import org.onap.aai.domain.yang.NetworkPolicy +import org.onap.aai.domain.yang.RouteTableReference +import org.onap.aai.domain.yang.RouteTarget +import org.onap.aai.domain.yang.Subnet +import org.onap.aai.domain.yang.VpnBinding +import org.onap.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -38,38 +53,10 @@ import org.onap.so.bpmn.common.scripts.VidUtils 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.aaiclient.client.aai.AAIObjectPlurals -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.aai.entities.Relationships -import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.springframework.web.util.UriUtils -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.NamedNodeMap -import org.w3c.dom.Node -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource -import org.onap.aai.domain.yang.VpnBinding -import org.onap.aai.domain.yang.L3Network -import org.onap.aai.domain.yang.L3Networks -import org.onap.aai.domain.yang.NetworkPolicy -import org.onap.aai.domain.yang.RouteTableReference -import org.onap.aai.domain.yang.RouteTarget -import org.onap.aai.domain.yang.Subnet -import com.fasterxml.jackson.jaxrs.util.EndpointAsBeanProperty - -import javax.ws.rs.NotFoundException - import groovy.json.* -import groovy.xml.XmlUtil /** * This groovy class supports the <class>DoCreateNetworkInstance.bpmn</class> process. @@ -354,8 +341,8 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai") }else{ Map<String, String> keys = uri.getURIKeys() - execution.setVariable("serviceType", keys.get("service-type")) - execution.setVariable("subscriberName", keys.get("global-customer-id")) + execution.setVariable("serviceType", keys.get(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType)) + execution.setVariable("subscriberName", keys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId)) } }catch(BpmnError e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index 9a584224ff..488f2d85ac 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -22,14 +22,15 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.onap.so.logger.LoggingAnchor -import org.onap.so.db.catalog.beans.HomingInstance -import org.onap.logging.filter.base.ErrorCode - import static org.apache.commons.lang3.StringUtils.* - import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +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 @@ -41,13 +42,11 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.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.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory /** * This class supports the DoCreateVnf building block subflow @@ -286,8 +285,8 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { if(resourceClient.exists(uri)){ Map<String, String> keys = uri.getURIKeys() - execution.setVariable("globalCustomerId", keys.get("global-customer-id")) - execution.setVariable("serviceType", keys.get("service-type")) + execution.setVariable("globalCustomerId", keys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId)) + execution.setVariable("serviceType", keys.get(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType)) execution.setVariable("GENGS_siResourceLink", uri.build().toString()) }else{ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index 51be632f47..bee9ad260b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -22,10 +22,19 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.onap.so.logger.LoggingAnchor +import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.L3Network +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth +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.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -38,23 +47,13 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.aai.entities.Relationships -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.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 - import org.springframework.web.util.UriUtils -import org.onap.logging.filter.base.ONAPComponents; - import groovy.json.JsonOutput -import javax.ws.rs.core.Response public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { private static final Logger logger = LoggerFactory.getLogger( DoDeleteNetworkInstance.class); @@ -276,7 +275,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { List<AAIResourceUri> tenantURIList = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT) for(AAIResourceUri tenantURI: tenantURIList){ if(execution.getVariable(Prefix + "tenantId") == null) { - String tenantId = tenantURI.getURIKeys().get("tenant-id") + String tenantId = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) execution.setVariable(Prefix + "tenantId", tenantId) logger.debug(" Get AAI getTenantId() : " + tenantId) } @@ -284,7 +283,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { List<AAIResourceUri> cloudRegionURIList = relationships.get().getRelatedAAIUris(AAIObjectType.CLOUD_REGION) for(AAIResourceUri tenantURI: cloudRegionURIList){ if(execution.getVariable(Prefix + "lcpCloudRegion") == null) { - String lcpCloudRegion = tenantURI.getURIKeys().get("cloud-region-id") + String lcpCloudRegion = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.CLOUD_REGION.getUriParams().cloudRegionId) execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion) logger.debug(" Get AAI getCloudRegion() : " + lcpCloudRegion) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index a55381b295..cda7c321ac 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -23,11 +23,15 @@ package org.onap.so.bpmn.infrastructure.scripts import static org.apache.commons.lang3.StringUtils.*; - -import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -35,17 +39,10 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils; -import groovy.json.* - /** * This groovy class supports the <class>DoDeleteServiceInstance.bpmn</class> process. * @@ -294,7 +291,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("GENGS_FoundIndicator", true) execution.setVariable("GENGS_siResourceLink", uri.build().toString()) Map<String, String> keys = uri.getURIKeys() - String globalSubscriberId = execution.getVariable("globalSubscriberId") + String globalSubscriberId = execution.getVariable(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId) if(isBlank(globalSubscriberId)){ globalSubscriberId = keys.get("global-customer-id") execution.setVariable("globalSubscriberId", globalSubscriberId) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy index db90cd0d7b..355b5f77c0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy @@ -22,12 +22,16 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.apache.commons.lang3.StringUtils +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.aai.domain.yang.Relationship -import org.onap.aai.domain.yang.RelationshipData import org.onap.aai.domain.yang.VolumeGroup +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -35,15 +39,9 @@ import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.aai.entities.Relationships -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.slf4j.Logger import org.slf4j.LoggerFactory -import javax.ws.rs.NotFoundException class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ private static final Logger logger = LoggerFactory.getLogger( DoDeleteVfModuleVolumeV2.class); @@ -180,7 +178,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Volume Group ${volumeGroupId} currently in use - found vf-module relationship.") } for(AAIResourceUri aaiResourceUri: relationships.get().getRelatedAAIUris(AAIObjectType.TENANT)){ - volumeGroupTenantId = aaiResourceUri.getURIKeys().get("tenant-id") + volumeGroupTenantId = aaiResourceUri.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index 868ed214be..cf7bb22442 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -22,12 +22,22 @@ package org.onap.so.bpmn.infrastructure.scripts; -import javax.ws.rs.core.UriBuilder -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory -import org.apache.commons.lang3.* +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.L3Network +import org.onap.aai.domain.yang.NetworkPolicy +import org.onap.aai.domain.yang.RouteTableReference +import org.onap.aai.domain.yang.RouteTarget +import org.onap.aai.domain.yang.Subnet +import org.onap.aai.domain.yang.VpnBinding +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.bpmn.common.scripts.AaiUtil import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -38,33 +48,10 @@ import org.onap.so.bpmn.common.scripts.VidUtils 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.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults import org.slf4j.Logger import org.slf4j.LoggerFactory - -import org.springframework.web.util.UriUtils -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.NamedNodeMap -import org.w3c.dom.Node -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource -import org.onap.aai.domain.yang.VpnBinding -import org.onap.aai.domain.yang.L3Network -import org.onap.aai.domain.yang.NetworkPolicy -import org.onap.aai.domain.yang.RouteTableReference -import org.onap.aai.domain.yang.RouteTarget -import org.onap.aai.domain.yang.Subnet -import javax.ws.rs.NotFoundException - import groovy.json.* -import groovy.xml.XmlUtil /** * This groovy class supports the <class>DoUpdateNetworkInstance.bpmn</class> process. @@ -347,8 +334,8 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Service Instance not found in aai") }else{ Map<String, String> keys = uri.getURIKeys() - execution.setVariable("serviceType", keys.get("service-type")) - execution.setVariable("subscriberName", keys.get("global-customer-id")) + execution.setVariable("serviceType", keys.get(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType)) + execution.setVariable("subscriberName", keys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId)) } }catch(BpmnError e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index 3928747e17..148ab1898f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -22,28 +22,28 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.apache.commons.lang.StringUtils.isEmpty import org.apache.commons.collections.CollectionUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup -import org.onap.so.bpmn.common.scripts.ExceptionUtil -import org.onap.so.bpmn.common.scripts.MsoUtils -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.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.Relationships import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import org.onap.so.constants.Defaults +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder 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.common.scripts.VfModuleBase +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import static org.apache.commons.lang.StringUtils.isEmpty - class UpdateVfModuleVolume extends VfModuleBase { private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleVolume.class) @@ -196,7 +196,7 @@ class UpdateVfModuleVolume extends VfModuleBase { List<AAIResourceUri> resourceUriList = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT) if(CollectionUtils.isNotEmpty(resourceUriList)){ AAIResourceUri tenantUri = resourceUriList.get(0) - String volumeGroupTenantId = tenantUri.getURIKeys().get("tenant-id") + String volumeGroupTenantId = tenantUri.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) if( isEmpty(volumeGroupTenantId)){ exceptionUtil.buildAndThrowWorkflowException(execution,2500,"Could not find Tenant Id element in Volume Group with Volume Group Id" + volumeGroupId + ", AIC Cloud Region" + aicCloudRegion) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index a89ea5925b..b6873a19fe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -22,34 +22,33 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.onap.so.logger.LoggingAnchor -import groovy.json.JsonException -import groovy.json.JsonSlurper +import static org.apache.cxf.common.util.CollectionUtils.isEmpty +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.GenericVnf import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VolumeGroup +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +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.common.scripts.VfModuleBase import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.aai.entities.Relationships -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.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 - -import javax.ws.rs.core.UriBuilder - -import static org.apache.cxf.common.util.CollectionUtils.isEmpty +import groovy.json.JsonException +import groovy.json.JsonSlurper class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleVolumeInfraV1.class) @@ -217,7 +216,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { if (relationships.isPresent()) { List<AAIResourceUri> tenantURIList = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT) if (!isEmpty(tenantURIList)) { - String volumeGroupTenantId = tenantURIList.get(0).getURIKeys().get("tenant-id") + String volumeGroupTenantId = tenantURIList.get(0).getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId) logger.debug("Received Tenant Id {} from AAI for Volume Group with Volume Group Id {}, AIC Cloud Region ", volumeGroupTenantId, volumeGroupId, aicCloudRegion) 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 c2da495bff..aa3512379a 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 @@ -26,6 +26,12 @@ 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.aaiclient.client.aai.* +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.appc.client.lcm.model.Action import org.onap.appc.client.lcm.model.ActionIdentifiers import org.onap.appc.client.lcm.model.Flags @@ -39,11 +45,6 @@ import org.onap.so.bpmn.core.domain.ModelInfo import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.aaiclient.client.aai.* -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.aai.entities.Relationships -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.appc.ApplicationControllerClient import org.onap.so.client.appc.ApplicationControllerSupport import org.onap.so.logger.MessageEnum @@ -248,7 +249,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor { for (AAIResourceUri j in vserverUris) { - String vserverId = j.getURIKeys().get('vserver-id') + String vserverId = j.getURIKeys().get(AAIFluentTypeBuilder.Types.VSERVER.getUriParams().vserverId) String vserverJson = client.get(j).getJson() logger.debug("Retrieved vserverJson from AAI: {}", vserverJson) String vserverSelfLink = jsonUtils.getJsonValue(vserverJson, "vserver-selflink") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index 8b67790ffc..dd1dae6edd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -21,9 +21,17 @@ */ package org.onap.so.bpmn.vcpe.scripts -import org.onap.so.logger.LoggingAnchor +import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +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 @@ -31,19 +39,11 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.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 org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.aai.entities.Relationships -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import javax.ws.rs.NotFoundException - /** * This groovy class supports the <class>DeleteVcpeResCustService.bpmn</class> process. * @@ -220,7 +220,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { List<AAIResourceUri> vnfUris = relationships.get().getRelatedAAIUris(AAIObjectType.GENERIC_VNF) for(AAIResourceUri u:vnfUris){ Map<String, String> keys = u.getURIKeys() - String vnfId = keys.get("vnf-id") + String vnfId = keys.get(AAIFluentTypeBuilder.Types.GENERIC_VNF.getUriParams().vnfId) relatedVnfIdList.add(vnfId) } List<AAIResourceUri> arUris = relationships.get().getRelatedAAIUris(AAIObjectType.ALLOTTED_RESOURCE) 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 2668357f63..b337564dab 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 @@ -6,6 +6,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; import org.onap.aai.domain.yang.Vserver; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.appc.client.lcm.model.Action; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVm; @@ -17,10 +22,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIVnfResources; @@ -186,7 +187,7 @@ public class AppcOrchestratorPreProcessor { ArrayList<String> vserverIds = new ArrayList<String>(); ArrayList<String> vserverSelfLinks = new ArrayList<String>(); for (AAIResourceUri j : vserverUris) { - String vserverId = j.getURIKeys().get("vserver-id"); + String vserverId = j.getURIKeys().get(AAIFluentTypeBuilder.Types.VSERVER.getUriParams().vserverId); vserverIds.add(vserverId); Optional<Vserver> oVserver = aaiVnfResources.getVserver(j); if (oVserver.isPresent()) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index 52edacc29d..70edc375c4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -28,10 +28,15 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import org.onap.so.logger.LoggingAnchor; import org.json.JSONArray; import org.json.JSONObject; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.appc.client.lcm.model.Action; +import org.onap.logging.filter.base.ErrorCode; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -40,17 +45,13 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.logging.filter.base.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -257,7 +258,8 @@ public class AppcRunTasks { for (AAIResourceUri j : vserverUris) { if (j != null) { if (j.getURIKeys() != null) { - String vserverId = j.getURIKeys().get("vserver-id"); + String vserverId = + j.getURIKeys().get(AAIFluentTypeBuilder.Types.VSERVER.getUriParams().vserverId); vserverIds.put(vserverId); } aaiVnfResources.getVserver(j).ifPresent((vserver) -> { 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 677100cfc1..b4eb97a187 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 @@ -48,6 +48,13 @@ import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.Vnfc; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VpnBinding; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -60,12 +67,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; -import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAIEntityNotFoundException; @@ -94,9 +95,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.util.CollectionUtils; @Component public class WorkflowAction { @@ -1547,10 +1548,12 @@ public class WorkflowAction { Map<String, String> keys = bbInputSetupUtils.getURIKeysFromServiceInstance(si.getServiceInstanceId()); - throw new DuplicateNameException(SERVICE_INSTANCE, - String.format(NAME_EXISTS_WITH_DIFF_COMBINATION, instanceName, - keys.get("global-customer-id"), keys.get("service-type"), - si.getModelVersionId())); + throw new DuplicateNameException(SERVICE_INSTANCE, String.format( + NAME_EXISTS_WITH_DIFF_COMBINATION, instanceName, + keys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId), + keys.get( + AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType), + si.getModelVersionId())); } } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index c1107a4df8..e24eaf0581 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -34,14 +34,14 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.when; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; @@ -77,6 +77,12 @@ import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VfModules; import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -84,11 +90,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; -import org.onap.aaiclient.client.aai.AAIObjectType; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.orchestration.AAIEntityNotFoundException; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; @@ -2423,8 +2424,8 @@ public class WorkflowActionTest extends BaseTaskTest { when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances); Map<String, String> uriKeys = new HashMap<>(); - uriKeys.put("global-customer-id", "globalCustomerId"); - uriKeys.put("service-type", "serviceType"); + uriKeys.put(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId, "globalCustomerId"); + uriKeys.put(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType, "serviceType"); when(bbSetupUtils.getURIKeysFromServiceInstance("siId123")).thenReturn(uriKeys); |