From f47919f1fe367b612fa9c96d34c59f01a541e882 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 8 Apr 2019 14:14:34 -0400 Subject: Replaced all tabs with spaces in java and pom.xml Added in maven plugins to enforce coding style rules Added in eclipse java formatting xml Change-Id: I3727bbf4ce8dc66abfd8ad21b6cfd0890c5d3ff0 Issue-ID: SO-1765 Signed-off-by: Benjamin, Max (mb388a) --- .../infrastructure/aai/AAICreateResources.java | 112 +- .../aai/AAIDeleteServiceInstance.java | 34 +- .../so/bpmn/infrastructure/aai/AAIResource.java | 22 +- .../infrastructure/aai/AAIServiceInstance.java | 263 ++-- .../aai/groovyflows/AAICreateResources.java | 166 +-- .../aai/groovyflows/AAIDeleteServiceInstance.java | 36 +- .../aai/groovyflows/AAIServiceInstance.java | 155 ++- .../generation/AAIObjectInstanceNameGenerator.java | 21 +- .../CheckAaiForPnfCorrelationIdDelegate.java | 2 - .../pnf/delegate/ConfigCheckerDelegate.java | 49 +- .../pnf/delegate/CreatePnfEntryInAaiDelegate.java | 5 +- .../pnf/delegate/CreateRelation.java | 4 +- .../pnf/delegate/GeneratePnfUuidDelegate.java | 3 +- .../pnf/delegate/InformDmaapClient.java | 8 +- .../pnf/delegate/PnfCheckInputs.java | 10 +- .../pnf/delegate/PrepareCdsCallDelegate.java | 26 +- .../pnf/delegate/PrepareConfigAssignDelegate.java | 26 +- .../pnf/delegate/PrepareConfigDeployDelegate.java | 41 +- .../pnf/dmaap/JsonUtilForPnfCorrelationId.java | 5 +- .../pnf/dmaap/PnfEventReadyDmaapClient.java | 19 +- .../pnf/management/PnfManagementImpl.java | 4 +- .../infrastructure/properties/BPMNProperties.java | 16 +- .../vfcmodel/NSResourceInputParameter.java | 2 - .../infrastructure/vfcmodel/NsOperationKey.java | 3 +- .../bpmn/infrastructure/vfcmodel/NsParameters.java | 3 +- .../bpmn/infrastructure/vfcmodel/VimLocation.java | 2 +- .../workflow/service/ServicePluginFactory.java | 1386 ++++++++++---------- .../serviceTask/AbstractSdncOperationTask.java | 94 +- .../SdncNetworkTopologyOperationTask.java | 27 +- .../SdncServiceTopologyOperationTask.java | 21 +- .../SdncUnderlayVpnOperationClient.java | 38 +- .../serviceTask/SdncUnderlayVpnPreprocessTask.java | 9 +- .../serviceTask/client/GenericResourceApi.java | 10 +- .../workflow/serviceTask/client/HeaderUtil.java | 3 +- .../client/builder/AbstractBuilder.java | 400 +++--- .../builder/NetworkRpcInputEntityBuilder.java | 35 +- .../builder/ServiceRpcInputEntityBuilder.java | 28 +- .../entity/NetworkInputParametersEntity.java | 5 +- .../client/entity/RequestInformationEntity.java | 4 +- .../RpcNetworkTopologyOperationInputEntity.java | 4 +- .../RpcNetworkTopologyOperationOutputEntity.java | 4 +- .../RpcServiceTopologyOperationInputEntity.java | 7 +- .../entity/ServiceInputParametersEntity.java | 5 +- 43 files changed, 1570 insertions(+), 1547 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/java') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java index a47b16fc33..d401522800 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResources.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.aai; import java.util.HashMap; import java.util.Map; import java.util.Optional; - import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; @@ -34,57 +33,64 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory; public class AAICreateResources extends AAIResource { - public void createAAIProject (String projectName, String serviceInstance){ - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); - getAaiClient().createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); - - } - - public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){ - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); - Map hashMap= new HashMap<>(); - hashMap.put("owning-entity-name", owningEntityName); - getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI); - } + public void createAAIProject(String projectName, String serviceInstance) { + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + getAaiClient().createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); + + } + + public void createAAIOwningEntity(String owningEntityId, String owningEntityName, String serviceInstance) { + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + Map hashMap = new HashMap<>(); + hashMap.put("owning-entity-name", owningEntityName); + getAaiClient().createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, + serviceInstanceURI); + } + + public boolean existsOwningEntity(String owningEntityId) { + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + return getAaiClient().exists(owningEntityURI); + } + + public void connectOwningEntityandServiceInstance(String owningEntityId, String serviceInstance) { + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + getAaiClient().connect(owningEntityURI, serviceInstanceURI); + } + + public void createAAIPlatform(String platformName, String vnfId) { + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + getAaiClient().createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); + } + + public void createAAILineOfBusiness(String lineOfBusiness, String vnfId) { + AAIResourceUri lineOfBusinessURI = + AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); + } + + public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) { + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalCustomerId, serviceType, serviceInstanceId); + getAaiClient().createIfNotExists(serviceInstanceURI, Optional.empty()); + } + + public Optional getVnfInstance(String vnfId) { + try { + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI); + Optional vnf = aaiResponse.asBean(GenericVnf.class); + return vnf; + } catch (Exception ex) { + return Optional.empty(); + } + } - public boolean existsOwningEntity(String owningEntityId){ - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - return getAaiClient().exists(owningEntityURI); - } - - public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){ - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); - getAaiClient().connect(owningEntityURI, serviceInstanceURI); - } - - public void createAAIPlatform(String platformName,String vnfId){ - AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); - getAaiClient().createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); - } - - public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){ - AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); - getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); - } - public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){ - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); - getAaiClient().createIfNotExists(serviceInstanceURI, Optional.empty()); - } - - public Optional getVnfInstance(String vnfId){ - try{ - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); - AAIResultWrapper aaiResponse = getAaiClient().get(vnfURI); - Optional vnf = aaiResponse.asBean(GenericVnf.class); - return vnf; - } catch (Exception ex){ - return Optional.empty(); - } - } - } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java index cea6fe740d..2526ca5c25 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java @@ -29,21 +29,23 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.springframework.stereotype.Component; -public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegate{ +public class AAIDeleteServiceInstance extends AAIResource implements JavaDelegate { + + ExceptionUtil exceptionUtil = new ExceptionUtil(); + + public void execute(DelegateExecution execution) throws Exception { + try { + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + getAaiClient().delete(serviceInstanceURI); + execution.setVariable("GENDS_SuccessIndicator", true); + } catch (Exception ex) { + String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + + ex.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + } - ExceptionUtil exceptionUtil = new ExceptionUtil(); - public void execute(DelegateExecution execution) throws Exception { - try{ - String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - serviceInstanceId); - getAaiClient().delete(serviceInstanceURI); - execution.setVariable("GENDS_SuccessIndicator",true); - } catch(Exception ex){ - String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage(); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); - } - - } - } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java index 3bc02be476..1410752f76 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIResource.java @@ -24,17 +24,17 @@ import org.onap.so.client.aai.AAIResourcesClient; import org.springframework.stereotype.Component; @Component -public abstract class AAIResource { - private AAIResourcesClient aaiClient; +public abstract class AAIResource { + private AAIResourcesClient aaiClient; - public AAIResourcesClient getAaiClient() { - if(aaiClient == null) - return new AAIResourcesClient(); - else - return aaiClient; - } + public AAIResourcesClient getAaiClient() { + if (aaiClient == null) + return new AAIResourcesClient(); + else + return aaiClient; + } - public void setAaiClient(AAIResourcesClient aaiClient) { - this.aaiClient = aaiClient; - } + public void setAaiClient(AAIResourcesClient aaiClient) { + this.aaiClient = aaiClient; + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java index c5cd2c70da..376ca4dbdb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstance.java @@ -21,129 +21,144 @@ package org.onap.so.bpmn.infrastructure.aai; public class AAIServiceInstance { - String serviceInstanceName; - String serviceType; - String serviceRole; - String orchestrationStatus; - String modelInvariantUuid; - String modelVersionId; - String environmentContext; - String workloadContext; - - public static class AAIServiceInstanceBuilder { - private String serviceInstanceName; - private String serviceType; - private String serviceRole; - private String orchestrationStatus; - private String modelInvariantUuid; - private String modelVersionId; - private String environmentContext; - private String workloadContext; - - public AAIServiceInstanceBuilder setServiceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - return this; - } - - public AAIServiceInstanceBuilder setServiceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - public AAIServiceInstanceBuilder setServiceRole(String serviceRole) { - this.serviceRole = serviceRole; - return this; - } - - public AAIServiceInstanceBuilder setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - return this; - } - - public AAIServiceInstanceBuilder setModelInvariantUuid(String modelInvariantUuid) { - this.modelInvariantUuid = modelInvariantUuid; - return this; - } - - public AAIServiceInstanceBuilder setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - return this; - } - - public AAIServiceInstanceBuilder setEnvironmentContext(String environmentContext) { - this.environmentContext = environmentContext; - return this; - } - - public AAIServiceInstanceBuilder setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - return this; - } - - public AAIServiceInstance createAAIServiceInstance() { - return new AAIServiceInstance(this); - } - } - - public AAIServiceInstance(AAIServiceInstanceBuilder aaiServiceInstanceBuilder) { - this.serviceInstanceName = aaiServiceInstanceBuilder.serviceInstanceName; - this.serviceType = aaiServiceInstanceBuilder.serviceType; - this.serviceRole = aaiServiceInstanceBuilder.serviceRole; - this.orchestrationStatus = aaiServiceInstanceBuilder.orchestrationStatus; - this.modelInvariantUuid = aaiServiceInstanceBuilder.modelInvariantUuid; - this.modelVersionId = aaiServiceInstanceBuilder.modelVersionId; - this.environmentContext = aaiServiceInstanceBuilder.environmentContext; - this.workloadContext = aaiServiceInstanceBuilder.workloadContext; - } - - public String getServiceInstanceName() { - return serviceInstanceName; - } - public void setServiceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - } - public String getServiceType() { - return serviceType; - } - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - public String getServiceRole() { - return serviceRole; - } - public void setServiceRole(String serviceRole) { - this.serviceRole = serviceRole; - } - public String getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public String getModelInvariantUuid() { - return modelInvariantUuid; - } - public void setModelInvariantUuid(String modelInvariantUuid) { - this.modelInvariantUuid = modelInvariantUuid; - } - public String getModelVersionId() { - return modelVersionId; - } - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - public String getEnvironmentContext() { - return environmentContext; - } - public void setEnvironmentContext(String environmentContext) { - this.environmentContext = environmentContext; - } - public String getWorkloadContext() { - return workloadContext; - } - public void setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - } - + String serviceInstanceName; + String serviceType; + String serviceRole; + String orchestrationStatus; + String modelInvariantUuid; + String modelVersionId; + String environmentContext; + String workloadContext; + + public static class AAIServiceInstanceBuilder { + private String serviceInstanceName; + private String serviceType; + private String serviceRole; + private String orchestrationStatus; + private String modelInvariantUuid; + private String modelVersionId; + private String environmentContext; + private String workloadContext; + + public AAIServiceInstanceBuilder setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + return this; + } + + public AAIServiceInstanceBuilder setServiceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + public AAIServiceInstanceBuilder setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + return this; + } + + public AAIServiceInstanceBuilder setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + return this; + } + + public AAIServiceInstanceBuilder setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + return this; + } + + public AAIServiceInstanceBuilder setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + return this; + } + + public AAIServiceInstanceBuilder setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + return this; + } + + public AAIServiceInstanceBuilder setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + return this; + } + + public AAIServiceInstance createAAIServiceInstance() { + return new AAIServiceInstance(this); + } + } + + public AAIServiceInstance(AAIServiceInstanceBuilder aaiServiceInstanceBuilder) { + this.serviceInstanceName = aaiServiceInstanceBuilder.serviceInstanceName; + this.serviceType = aaiServiceInstanceBuilder.serviceType; + this.serviceRole = aaiServiceInstanceBuilder.serviceRole; + this.orchestrationStatus = aaiServiceInstanceBuilder.orchestrationStatus; + this.modelInvariantUuid = aaiServiceInstanceBuilder.modelInvariantUuid; + this.modelVersionId = aaiServiceInstanceBuilder.modelVersionId; + this.environmentContext = aaiServiceInstanceBuilder.environmentContext; + this.workloadContext = aaiServiceInstanceBuilder.workloadContext; + } + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getServiceRole() { + return serviceRole; + } + + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + + public String getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getEnvironmentContext() { + return environmentContext; + } + + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + + public String getWorkloadContext() { + return workloadContext; + } + + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java index 0c519ef29f..bbca10be0f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java @@ -25,7 +25,6 @@ package org.onap.so.bpmn.infrastructure.aai.groovyflows; import java.util.HashMap; import java.util.Map; import java.util.Optional; - import org.onap.aai.domain.yang.OwningEntities; import org.onap.aai.domain.yang.OwningEntity; import org.onap.so.client.aai.AAIObjectPlurals; @@ -37,85 +36,88 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class AAICreateResources { - - private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class); - - public void createAAIProject (String projectName, String serviceInstance){ - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); - - } - - public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){ - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); - Map hashMap= new HashMap<>(); - hashMap.put("owning-entity-name", owningEntityName); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI); - } - - public boolean existsOwningEntity(String owningEntityId){ - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - return aaiRC.exists(owningEntityURI); - } - - protected OwningEntities getOwningEntityName(String owningEntityName){ - - AAIResourcesClient aaiRC = new AAIResourcesClient(); - return aaiRC.get(OwningEntities.class, - AAIUriFactory - .createResourceUri(AAIObjectPlurals.OWNING_ENTITY) - .queryParam("owning-entity-name", owningEntityName)) - .orElseGet(() -> { - logger.debug("No Owning Entity matched by name"); - return null; - }); - - } - - public Optional getOwningEntityNames(String owningEntityName) throws Exception{ - OwningEntity owningEntity = null; - OwningEntities owningEntities = null; - owningEntities = getOwningEntityName(owningEntityName); - - if (owningEntities == null) { - return Optional.empty(); - } else if (owningEntities.getOwningEntity().size() > 1) { - throw new Exception("Multiple OwningEntities Returned"); - } else { - owningEntity = owningEntities.getOwningEntity().get(0); - } - return Optional.of(owningEntity); - } - - public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){ - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.connect(owningEntityURI, serviceInstanceURI); - } - - public void createAAIPlatform(String platformName,String vnfId){ - AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); - } - - public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){ - AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); - AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); - } - public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){ - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty()); - } - + + private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class); + + public void createAAIProject(String projectName, String serviceInstance) { + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); + + } + + public void createAAIOwningEntity(String owningEntityId, String owningEntityName, String serviceInstance) { + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + Map hashMap = new HashMap<>(); + hashMap.put("owning-entity-name", owningEntityName); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI); + } + + public boolean existsOwningEntity(String owningEntityId) { + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + return aaiRC.exists(owningEntityURI); + } + + protected OwningEntities getOwningEntityName(String owningEntityName) { + + AAIResourcesClient aaiRC = new AAIResourcesClient(); + return aaiRC.get(OwningEntities.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) + .queryParam("owning-entity-name", owningEntityName)).orElseGet(() -> { + logger.debug("No Owning Entity matched by name"); + return null; + }); + + } + + public Optional getOwningEntityNames(String owningEntityName) throws Exception { + OwningEntity owningEntity = null; + OwningEntities owningEntities = null; + owningEntities = getOwningEntityName(owningEntityName); + + if (owningEntities == null) { + return Optional.empty(); + } else if (owningEntities.getOwningEntity().size() > 1) { + throw new Exception("Multiple OwningEntities Returned"); + } else { + owningEntity = owningEntities.getOwningEntity().get(0); + } + return Optional.of(owningEntity); + } + + public void connectOwningEntityandServiceInstance(String owningEntityId, String serviceInstance) { + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.connect(owningEntityURI, serviceInstanceURI); + } + + public void createAAIPlatform(String platformName, String vnfId) { + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); + } + + public void createAAILineOfBusiness(String lineOfBusiness, String vnfId) { + AAIResourceUri lineOfBusinessURI = + AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); + } + + public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) { + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalCustomerId, serviceType, serviceInstanceId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty()); + } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java index 495c77255d..fb95ae3993 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java @@ -28,22 +28,24 @@ 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; -public class AAIDeleteServiceInstance implements JavaDelegate{ +public class AAIDeleteServiceInstance implements JavaDelegate { + + ExceptionUtil exceptionUtil = new ExceptionUtil(); + + public void execute(DelegateExecution execution) throws Exception { + try { + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.delete(serviceInstanceURI); + execution.setVariable("GENDS_SuccessIndicator", true); + } catch (Exception ex) { + String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + + ex.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + } - ExceptionUtil exceptionUtil = new ExceptionUtil(); - public void execute(DelegateExecution execution) throws Exception { - try{ - String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - serviceInstanceId); - AAIResourcesClient aaiRC = new AAIResourcesClient(); - aaiRC.delete(serviceInstanceURI); - execution.setVariable("GENDS_SuccessIndicator",true); - } catch(Exception ex){ - String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage(); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); - } - - } - } 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 805ece9de8..2d69351744 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 @@ -21,74 +21,91 @@ package org.onap.so.bpmn.infrastructure.aai.groovyflows; public class AAIServiceInstance { - String serviceInstanceName; - String serviceType; - String serviceRole; - String orchestrationStatus; - String modelInvariantUuid; - String modelVersionId; - String environmentContext; - String workloadContext; - public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole, - String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext, - String workloadContext) { - this.serviceInstanceName = serviceInstanceName; - this.serviceType = serviceType; - this.serviceRole = serviceRole; - this.orchestrationStatus = orchestrationStatus; - this.modelInvariantUuid = modelInvariantUuid; - this.modelVersionId = modelVersionId; - this.environmentContext = environmentContext; - this.workloadContext = workloadContext; - } - public String getServiceInstanceName() { - return serviceInstanceName; - } - public void setServiceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - } - public String getServiceType() { - return serviceType; - } - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - public String getServiceRole() { - return serviceRole; - } - public void setServiceRole(String serviceRole) { - this.serviceRole = serviceRole; - } - public String getOrchestrationStatus() { - return orchestrationStatus; - } - public void setOrchestrationStatus(String orchestrationStatus) { - this.orchestrationStatus = orchestrationStatus; - } - public String getModelInvariantUuid() { - return modelInvariantUuid; - } - public void setModelInvariantUuid(String modelInvariantUuid) { - this.modelInvariantUuid = modelInvariantUuid; - } - public String getModelVersionId() { - return modelVersionId; - } - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - public String getEnvironmentContext() { - return environmentContext; - } - public void setEnvironmentContext(String environmentContext) { - this.environmentContext = environmentContext; - } - public String getWorkloadContext() { - return workloadContext; - } - public void setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - } - + String serviceInstanceName; + String serviceType; + String serviceRole; + String orchestrationStatus; + String modelInvariantUuid; + String modelVersionId; + String environmentContext; + String workloadContext; + + public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole, + String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext, + String workloadContext) { + this.serviceInstanceName = serviceInstanceName; + this.serviceType = serviceType; + this.serviceRole = serviceRole; + this.orchestrationStatus = orchestrationStatus; + this.modelInvariantUuid = modelInvariantUuid; + this.modelVersionId = modelVersionId; + this.environmentContext = environmentContext; + this.workloadContext = workloadContext; + } + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getServiceRole() { + return serviceRole; + } + + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + + public String getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getEnvironmentContext() { + return environmentContext; + } + + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + + public String getWorkloadContext() { + return workloadContext; + } + + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java index 3b443cbaf2..55387d6a3d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGenerator.java @@ -27,14 +27,15 @@ import org.springframework.stereotype.Component; @Component public class AAIObjectInstanceNameGenerator { - public String generateInstanceGroupName(InstanceGroup instanceGroup, GenericVnf vnf) { - if(vnf.getVnfName() != null && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) { - return vnf.getVnfName() + "_" + instanceGroup.getModelInfoInstanceGroup().getFunction(); - } else { - throw new IllegalArgumentException("Cannot generate instance group name because either one or both fields are null: " - + " Vnf Instance Name: " + vnf.getVnfName() - + ", Instance Group Function: " + instanceGroup.getModelInfoInstanceGroup().getFunction()); - } - } - + public String generateInstanceGroupName(InstanceGroup instanceGroup, GenericVnf vnf) { + if (vnf.getVnfName() != null && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) { + return vnf.getVnfName() + "_" + instanceGroup.getModelInfoInstanceGroup().getFunction(); + } else { + throw new IllegalArgumentException( + "Cannot generate instance group name because either one or both fields are null: " + + " Vnf Instance Name: " + vnf.getVnfName() + ", Instance Group Function: " + + instanceGroup.getModelInfoInstanceGroup().getFunction()); + } + } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java index e0fa41b7a1..493340c9ef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java @@ -22,9 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java index 9b60a05e98..d67e6ef0db 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegate.java @@ -1,20 +1,15 @@ /* - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ Licensed under the + * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may + * obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 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========================================================= + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.pnf.delegate; @@ -26,7 +21,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_MODEL_INFO; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SKIP_POST_INSTANTIATION_CONFIGURATION; - import java.util.List; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; @@ -50,7 +44,7 @@ public class ConfigCheckerDelegate implements JavaDelegate { private Logger logger = LoggerFactory.getLogger(ConfigCheckerDelegate.class); - //ERROR CODE for variable not found in the delegation Context + // ERROR CODE for variable not found in the delegation Context private static int ERROR_CODE = 601; @Autowired @@ -63,34 +57,33 @@ public class ConfigCheckerDelegate implements JavaDelegate { public void execute(DelegateExecution delegateExecution) throws Exception { logger.debug("Running execute block for activity id:{}, name:{}", delegateExecution.getCurrentActivityId(), - delegateExecution.getCurrentActivityName()); + delegateExecution.getCurrentActivityName()); if (delegateExecution.hasVariable(SERVICE_MODEL_INFO)) { String serviceModelInfo = (String) delegateExecution.getVariable(SERVICE_MODEL_INFO); String serviceModelUuid = JsonUtils.getJsonValue(serviceModelInfo, MODEL_UUID); delegateExecution.setVariable(MODEL_UUID, serviceModelUuid); - List pnfCustomizations = catalogDbClient - .getPnfResourceCustomizationByModelUuid(serviceModelUuid); + List pnfCustomizations = + catalogDbClient.getPnfResourceCustomizationByModelUuid(serviceModelUuid); if (pnfCustomizations != null && pnfCustomizations.size() >= 1) { PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0); boolean skipPostInstantiationConfiguration = pnfResourceCustomization.isSkipPostInstConf(); - delegateExecution - .setVariable(SKIP_POST_INSTANTIATION_CONFIGURATION, skipPostInstantiationConfiguration); + delegateExecution.setVariable(SKIP_POST_INSTANTIATION_CONFIGURATION, + skipPostInstantiationConfiguration); delegateExecution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName()); delegateExecution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion()); - delegateExecution - .setVariable(PRC_CUSTOMIZATION_UUID, pnfResourceCustomization.getModelCustomizationUUID()); + delegateExecution.setVariable(PRC_CUSTOMIZATION_UUID, + pnfResourceCustomization.getModelCustomizationUUID()); delegateExecution.setVariable(PRC_INSTANCE_NAME, pnfResourceCustomization.getModelInstanceName()); } else { - logger - .warn("Unable to find the PNF resource customizations of model service UUID: {}", serviceModelUuid); + logger.warn("Unable to find the PNF resource customizations of model service UUID: {}", + serviceModelUuid); exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, - "Unable to find the PNF resource customizations of model service UUID: " + serviceModelUuid); + "Unable to find the PNF resource customizations of model service UUID: " + serviceModelUuid); } } else { logger.warn("Unable to find the parameter: {} in the execution context", SERVICE_MODEL_INFO); - exceptionUtil - .buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, + exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "Unable to find parameter " + SERVICE_MODEL_INFO); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java index e56cb83119..cb06085ee8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java @@ -24,7 +24,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.aai.domain.yang.Pnf; @@ -37,9 +36,7 @@ import org.springframework.stereotype.Component; /** * Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn * - * Inputs: - * - pnfCorrelationId - String - * - pnfUuid - String + * Inputs: - pnfCorrelationId - String - pnfUuid - String */ @Component public class CreatePnfEntryInAaiDelegate implements JavaDelegate { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java index a367bada02..6d73b61ab2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java @@ -51,8 +51,8 @@ public class CreateRelation implements JavaDelegate { new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999, "An exception occurred when making service and pnf relation. Exception: " + e.getMessage()); } - logger.debug("The relation has been made between service with id: {} and pnf with name: {}", - serviceInstanceId, pnfName); + logger.debug("The relation has been made between service with id: {} and pnf with name: {}", serviceInstanceId, + pnfName); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java index f5483e489e..852ca4fcef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; - import java.util.UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; @@ -35,7 +34,7 @@ public class GeneratePnfUuidDelegate implements JavaDelegate { private static final Logger logger = LoggerFactory.getLogger(GeneratePnfUuidDelegate.class); @Override - public void execute(DelegateExecution delegateExecution){ + public void execute(DelegateExecution delegateExecution) { UUID uuid = UUID.randomUUID(); logger.debug("Generated UUID for pnf: {}, version: {}, variant: {}", uuid, uuid.version(), uuid.variant()); delegateExecution.setVariable(PNF_UUID, uuid.toString()); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index 96455acb84..5cbd530a93 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -36,12 +36,8 @@ public class InformDmaapClient implements JavaDelegate { public void execute(DelegateExecution execution) { String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID); RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); - dmaapClient.registerForUpdate(pnfCorrelationId, () -> - runtimeService - .createMessageCorrelation("WorkflowMessage") - .processInstanceBusinessKey(execution.getProcessBusinessKey()) - .correlateWithResult() - ); + dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService.createMessageCorrelation("WorkflowMessage") + .processInstanceBusinessKey(execution.getProcessBusinessKey()).correlateWithResult()); } @Autowired diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java index 1caadea0de..b52110ea82 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -26,7 +26,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; - import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; @@ -38,7 +37,8 @@ import org.springframework.stereotype.Component; @Component public class PnfCheckInputs implements JavaDelegate { - public static final String UUID_REGEX = "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$"; + public static final String UUID_REGEX = + "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$"; private String pnfEntryNotificationTimeout; @@ -58,7 +58,8 @@ public class PnfCheckInputs implements JavaDelegate { private void validatePnfCorrelationId(DelegateExecution execution) { String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID); if (Strings.isNullOrEmpty(pnfCorrelationId)) { - new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfCorrelationId variable not defined"); + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, + "pnfCorrelationId variable not defined"); } } @@ -83,7 +84,8 @@ public class PnfCheckInputs implements JavaDelegate { private void validateServiceInstanceId(DelegateExecution execution) { String serviceInstanceId = (String) execution.getVariable(SERVICE_INSTANCE_ID); if (Strings.isNullOrEmpty(serviceInstanceId)) { - new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "serviceInstanceId variable not defined"); + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, + "serviceInstanceId variable not defined"); } } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java index 49887af4be..c4c299d4b6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareCdsCallDelegate.java @@ -1,20 +1,15 @@ /* - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ Licensed under the + * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may + * obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 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========================================================= + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.pnf.delegate; @@ -24,7 +19,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_NAME; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_VERSION; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; @@ -50,7 +44,7 @@ public abstract class PrepareCdsCallDelegate implements JavaDelegate { protected ExceptionBuilder exceptionUtil; @Override - public void execute(DelegateExecution delegateExecution){ + public void execute(DelegateExecution delegateExecution) { logger.debug("Running execute block for activity:{}", delegateExecution.getCurrentActivityId()); AbstractCDSPropertiesBean cdsPropertiesBean = new AbstractCDSPropertiesBean(); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java index 5bf167ea7a..dd2601f0d0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegate.java @@ -1,20 +1,15 @@ /* - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ Licensed under the + * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may + * obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 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========================================================= + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.pnf.delegate; @@ -25,7 +20,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; @@ -48,7 +42,7 @@ public class PrepareConfigAssignDelegate extends PrepareCdsCallDelegate { } @Override - protected String getRequestObject(final DelegateExecution delegateExecution){ + protected String getRequestObject(final DelegateExecution delegateExecution) { ConfigAssignPropertiesForPnf configAssignProperties = new ConfigAssignPropertiesForPnf(); configAssignProperties.setServiceInstanceId((String) delegateExecution.getVariable(SERVICE_INSTANCE_ID)); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java index 5fbed598e3..16f712fa66 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegate.java @@ -1,20 +1,15 @@ /* - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ Licensed under the + * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may + * obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 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========================================================= + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.pnf.delegate; @@ -24,7 +19,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; - import java.io.IOException; import java.util.Optional; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -55,7 +49,7 @@ public class PrepareConfigDeployDelegate extends PrepareCdsCallDelegate { } @Override - protected String getRequestObject(DelegateExecution delegateExecution){ + protected String getRequestObject(DelegateExecution delegateExecution) { ConfigDeployPropertiesForPnf configDeployProperties = new ConfigDeployPropertiesForPnf(); @@ -85,7 +79,8 @@ public class PrepareConfigDeployDelegate extends PrepareCdsCallDelegate { return configDeployRequest.toString(); } - private void setIpAddress(ConfigDeployPropertiesForPnf configDeployProperties, DelegateExecution delegateExecution) { + private void setIpAddress(ConfigDeployPropertiesForPnf configDeployProperties, + DelegateExecution delegateExecution) { /** * Retrieve PNF entry from AAI. @@ -93,21 +88,23 @@ public class PrepareConfigDeployDelegate extends PrepareCdsCallDelegate { try { String pnfName = (String) delegateExecution.getVariable(PNF_CORRELATION_ID); Optional pnfOptional = pnfManagement.getEntryFor(pnfName); - if ( pnfOptional.isPresent()){ + if (pnfOptional.isPresent()) { Pnf pnf = pnfOptional.get(); /** - * PRH patches the AAI with oam address. - * Use ipaddress-v4-oam and ipaddress-v6-oam for the config deploy request. + * PRH patches the AAI with oam address. Use ipaddress-v4-oam and ipaddress-v6-oam for the config deploy + * request. */ configDeployProperties.setPnfIpV4Address(pnf.getIpaddressV4Oam()); configDeployProperties.setPnfIpV6Address(pnf.getIpaddressV6Oam()); } else { - exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "AAI entry for PNF: " + pnfName + " does not exist"); + exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, + "AAI entry for PNF: " + pnfName + " does not exist"); } } catch (IOException e) { logger.warn(e.getMessage(), e); - exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "Unable to fetch from AAI" + e.getMessage()); + exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, + "Unable to fetch from AAI" + e.getMessage()); } } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java index fb5d04328f..7cb78a10e5 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java @@ -41,9 +41,8 @@ public final class JsonUtilForPnfCorrelationId { List list = new ArrayList<>(); Spliterator spliterator = array.spliterator(); spliterator.forEachRemaining(jsonElement -> { - handleEscapedCharacters(jsonElement) - .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject) - .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId))); + handleEscapedCharacters(jsonElement).ifPresent(jsonObject -> getPnfCorrelationId(jsonObject) + .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId))); }); return list; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index 6f828f6cb0..3de0f38b70 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -60,12 +60,10 @@ public class PnfEventReadyDmaapClient implements DmaapClient { topicListenerDelayInSeconds = env.getProperty("pnf.dmaap.topicListenerDelayInSeconds", Integer.class); executor = null; getRequest = new HttpGet(UriBuilder.fromUri(env.getProperty("pnf.dmaap.uriPathPrefix")) - .scheme(env.getProperty("pnf.dmaap.protocol")) - .host(env.getProperty("pnf.dmaap.host")) - .port(env.getProperty("pnf.dmaap.port", Integer.class)) - .path(env.getProperty("pnf.dmaap.topicName")) - .path(env.getProperty("pnf.dmaap.consumerGroup")) - .path(env.getProperty("pnf.dmaap.consumerId")).build()); + .scheme(env.getProperty("pnf.dmaap.protocol")).host(env.getProperty("pnf.dmaap.host")) + .port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName")) + .path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId")) + .build()); } @Override @@ -92,8 +90,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient { executor = new ScheduledThreadPoolExecutor(1); executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); - executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0, - topicListenerDelayInSeconds, TimeUnit.SECONDS); + executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0, topicListenerDelayInSeconds, + TimeUnit.SECONDS); dmaapThreadListenerIsRunning = true; } } @@ -116,8 +114,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient { getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound); } catch (IOException e) { logger.error("Exception caught during sending rest request to dmaap for listening event topic", e); - } - finally { + } finally { getRequest.reset(); } } @@ -136,7 +133,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient { Runnable runnable = unregister(pnfCorrelationId); if (runnable != null) { logger.debug("dmaap listener gets pnf ready event for pnfCorrelationId: {}", pnfCorrelationId); - //runnable.run(); + // runnable.run(); runnable = null; } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java index 32ea357817..b1af8b1e0b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java @@ -46,8 +46,8 @@ public class PnfManagementImpl implements PnfManagement { @Override public void createRelation(String serviceInstanceId, String pnfName) { - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - serviceInstanceId); + AAIResourceUri serviceInstanceURI = + AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); AAIResourceUri pnfUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName); new AAIResourcesClient().connect(serviceInstanceURI, pnfUri); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java index ee8743f846..8b2bb9a8de 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java @@ -22,22 +22,22 @@ package org.onap.so.bpmn.infrastructure.properties; import java.util.Arrays; import java.util.List; import org.onap.so.bpmn.core.UrnPropertiesReader; - import org.onap.so.bpmn.core.UrnPropertiesReader; public class BPMNProperties { public static String getProperty(String key, String defaultValue) { - String value = UrnPropertiesReader.getVariable(key); - if (value == null) { - return defaultValue; - } else { - return value; - } + String value = UrnPropertiesReader.getVariable(key); + if (value == null) { + return defaultValue; + } else { + return value; + } } public static List getResourceSequenceProp(String input) { - String resourceSequence = UrnPropertiesReader.getVariable("mso.workflow.custom."+ input + ".resource.sequence"); + String resourceSequence = + UrnPropertiesReader.getVariable("mso.workflow.custom." + input + ".resource.sequence"); if (resourceSequence != null) { return Arrays.asList(resourceSequence.split(",")); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java index 292f6ef575..2995e24c00 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.vfcmodel; - /** * NS Create Input Parameter For VFC Adapter
*

@@ -44,7 +43,6 @@ public class NSResourceInputParameter { - /** * @return Returns the nsServiceName. */ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java index 81826a27eb..3e35952a9e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsOperationKey.java @@ -21,8 +21,7 @@ package org.onap.so.bpmn.infrastructure.vfcmodel; /** - * The operation key object for NS - *
+ * The operation key object for NS
*

*

* diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java index 0d8f2fcbd7..ad388feffc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/NsParameters.java @@ -37,7 +37,8 @@ public class NsParameters { private List locationConstraints; - private Map additionalParamForNs = new HashMap(); + private Map additionalParamForNs = new HashMap(); + /** * @return Returns the locationConstraints. */ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java index 970fa43d9f..8b9295b44f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/vfcmodel/VimLocation.java @@ -28,7 +28,7 @@ package org.onap.so.bpmn.infrastructure.vfcmodel; *

* * @author - * @version ONAP Amsterdam Release 2017-10-18 + * @version ONAP Amsterdam Release 2017-10-18 */ public class VimLocation { private String vimId; 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 9b878afb7c..896a8bd98c 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 @@ -73,549 +73,550 @@ import org.springframework.web.util.UriUtils; public class ServicePluginFactory { - // SOTN calculate route - public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc"; - - public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps"; - - public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory"; - - private static final int DEFAULT_TIME_OUT = 60000; - - static JsonUtils jsonUtil = new JsonUtils(); - - private static Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class); - - private static ServicePluginFactory instance; - - - public static synchronized ServicePluginFactory getInstance() { - if (null == instance) { - instance = new ServicePluginFactory(); - } - return instance; - } - - private ServicePluginFactory() { - - } - - private String getInventoryOSSEndPoint(){ - return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", INVENTORY_OSS_DEFAULT_ENDPOINT); - } - - private String getThirdSPEndPoint(){ - return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", THIRD_SP_DEFAULT_ENDPOINT); - } - - private String getOOFCalcEndPoint(){ - return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_DEFAULT_ENDPOINT); - } - - @SuppressWarnings("unchecked") - public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) { - if(!isNeedProcessSite(uuiRequest)) { - return uuiRequest; - } - - Map uuiObject = getJsonObject(uuiRequest, Map.class); - if (uuiObject == null) { - return uuiRequest; - } - Map serviceObject = (Map) uuiObject - .getOrDefault("service", Collections.emptyMap()); - Map serviceParametersObject = (Map) serviceObject - .getOrDefault("parameters", Collections.emptyMap()); - Map serviceRequestInputs = (Map) serviceParametersObject - .getOrDefault("requestInputs", Collections.emptyMap()); - List resources = (List) serviceParametersObject.getOrDefault("resources", Collections.emptyList()); - - if (isSiteLocationLocal(serviceRequestInputs, resources)) { - // resources changed : added TP info - return getJsonString(uuiObject); - } - - List addResourceList = new ArrayList<>(); - addResourceList.addAll(serviceDecomposition.getServiceResources()); - - serviceDecomposition.setVnfResources(null); - serviceDecomposition.setAllottedResources(null); - serviceDecomposition.setNetworkResources(null); - serviceDecomposition.setConfigResources(null); - for (Resource resource : addResourceList) { - String resourcemodelName = resource.getModelInfo().getModelName(); - if (StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) { - // change serviceDecomposition - serviceDecomposition.addResource(resource); - break; - } - } - - return uuiRequest; - } - - private boolean isNeedProcessSite(String uuiRequest) { - return uuiRequest.toLowerCase().contains("site_address") && uuiRequest.toLowerCase().contains("sotncondition_clientsignal"); - } - - @SuppressWarnings("unchecked") - private boolean isSiteLocationLocal(Map serviceRequestInputs, List resources) { - Map tpInfoMap = getTPforVPNAttachment(serviceRequestInputs); - - if(tpInfoMap.isEmpty()) { - return true; - } - String host = (String) tpInfoMap.get("host"); - // host is empty means TP is in local, not empty means TP is in remote ONAP - if (!host.isEmpty()) { - return false; - } - - Map accessTPInfo = new HashMap(); - accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id")); - accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id")); - accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id")); - accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id")); - accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id")); - - // change resources - String resourceName = (String) tpInfoMap.get("resourceName"); - for(Object curResource : resources) { - Map resource = (Map)curResource; - String curResourceName = (String) resource.get("resourceName"); - curResourceName = curResourceName.replaceAll(" ", ""); - if(resourceName.equalsIgnoreCase(curResourceName)) { - putResourceRequestInputs(resource, accessTPInfo); - break; - } - } - - return true; - } - - @SuppressWarnings("unchecked") - private Map getTPforVPNAttachment(Map serviceRequestInputs) { - Object location = null; - Object clientSignal = null; - String vpnAttachmentResourceName = null; - - // support R2 uuiReq and R1 uuiReq - // logic for R2 uuiRequest params in service level - for (Entry entry : serviceRequestInputs.entrySet()) { - String key = entry.getKey(); - if (key.toLowerCase().contains("site_address")) { - location = entry.getValue(); - } - if (key.toLowerCase().contains("sotncondition_clientsignal")) { - clientSignal = entry.getValue(); - vpnAttachmentResourceName = key.substring(0, key.indexOf("_")); - } - } - - Map tpInfoMap = new HashMap(); - - // Site resource has location param and SOTNAttachment resource has clientSignal param - if(location == null || clientSignal == null ) { - return tpInfoMap; - } - - // Query terminal points from InventoryOSS system by location. - String locationAddress = (String) location; - List locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress); - if(locationTPList != null && !locationTPList.isEmpty()) { - for(Object tp: locationTPList) { - Map tpJson = (Map) tp; - String loc = (String)tpJson.get ("location"); - if(StringUtils.equalsIgnoreCase (locationAddress, loc)) { - tpInfoMap = tpJson; - // add resourceName - tpInfoMap.put("resourceName", vpnAttachmentResourceName); - break; - } - } - logger.debug("Get Terminal TP from InventoryOSS"); - return tpInfoMap; - } - - return tpInfoMap; - } - - @SuppressWarnings("unchecked") - private List queryAccessTPbyLocationFromInventoryOSS(String locationAddress) { - String url = getInventoryOSSEndPoint(); - url += "/oss/inventory?location=" + UriUtils.encode(locationAddress,"UTF-8"); - String responseContent = sendRequest(url, "GET", ""); - List accessTPs = new ArrayList<>(); - if (null != responseContent) { - accessTPs = getJsonObject(responseContent, List.class); - } - return accessTPs; - } - - @SuppressWarnings("unchecked") - private void putResourceRequestInputs(Map resource, Map resourceInputs) { - Map resourceParametersObject = new HashMap<>(); - Map resourceRequestInputs = new HashMap<>(); - resourceRequestInputs.put("requestInputs", resourceInputs); - resourceParametersObject.put("parameters", resourceRequestInputs); - - if(resource.containsKey("parameters")) { - Map resParametersObject = (Map) resource.get("parameters"); - if(resParametersObject.containsKey("requestInputs")) { - Map resRequestInputs = (Map) resourceRequestInputs.get("requestInputs"); - Map oldRequestInputs = (Map) resParametersObject.get("requestInputs"); - if(oldRequestInputs != null) { - oldRequestInputs.putAll(resRequestInputs); - } - else { - resParametersObject.put("requestInputs", resRequestInputs); - } - } - else { - resParametersObject.putAll(resourceRequestInputs); - } - } - else { - resource.putAll(resourceParametersObject); - } - - return; - } - - - - @SuppressWarnings("unchecked") - public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) { - Map uuiObject = getJsonObject(uuiRequest, Map.class); - if (uuiObject == null) { - return uuiRequest; - } - Map serviceObject = (Map) uuiObject - .getOrDefault("service", Collections.emptyMap()); - Map serviceParametersObject = (Map) serviceObject - .getOrDefault("parameters", Collections.emptyMap()); - Map serviceRequestInputs = (Map) serviceParametersObject - .getOrDefault("requestInputs", Collections.emptyMap()); - - if (!isNeedAllocateCrossTPResources(serviceRequestInputs)) { - return uuiRequest; - } - - allocateCrossTPResources(execution, serviceRequestInputs); - return getJsonString(uuiObject); - } - - @SuppressWarnings("unchecked") - private boolean isNeedAllocateCrossTPResources(Map serviceRequestInputs) { - if(serviceRequestInputs.containsKey("CallSource")) - { - String callSource = (String) serviceRequestInputs.get("CallSource"); - if("ExternalAPI".equalsIgnoreCase(callSource)) { - return false; - } - } - for (String input : serviceRequestInputs.keySet()) - { - if(input.toLowerCase().contains("sotnconnectivity")) { - return true; - } - } - return false; - } - - @SuppressWarnings("unchecked") - private void allocateCrossTPResources(DelegateExecution execution, Map serviceRequestInputs) { - - Map crossTPs = this.getTPsfromAAI(); - - if(crossTPs == null || crossTPs.isEmpty()) { - serviceRequestInputs.put("local-access-provider-id", ""); - serviceRequestInputs.put("local-access-client-id", ""); - serviceRequestInputs.put("local-access-topology-id", ""); - serviceRequestInputs.put("local-access-node-id", ""); - serviceRequestInputs.put("local-access-ltp-id", ""); - serviceRequestInputs.put("remote-access-provider-id", ""); - serviceRequestInputs.put("remote-access-client-id", ""); - serviceRequestInputs.put("remote-access-topology-id", ""); - serviceRequestInputs.put("remote-access-node-id", ""); - serviceRequestInputs.put("remote-access-ltp-id", ""); - } - else { - serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); - serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id")); - serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); - serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id")); - serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); - serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); - serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id")); - serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id")); - serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id")); - serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id")); - } - - return; - } - - // This method returns Local and remote TPs information from AAI - public Map getTPsfromAAI() { - Map tpInfo = new HashMap<>(); - - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK); - AAIResourcesClient client = new AAIResourcesClient(); - Optional result = client.get(LogicalLinks.class, uri); - - if (result.isPresent()) { - LogicalLinks links = result.get(); - boolean isRemoteLink = false; - - links.getLogicalLink(); - - for (LogicalLink link : links.getLogicalLink()) { - AAIResultWrapper wrapper = new AAIResultWrapper(link); - Optional optRelationships = wrapper.getRelationships(); - List pInterfaces = new ArrayList<>(); - if (optRelationships.isPresent()) { - Relationships relationships = optRelationships.get(); - if (!relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty()) { - isRemoteLink = true; - } - pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE)); - } - - if (isRemoteLink) { - // find remote p interface - AAIResourceUri localTP = null; - AAIResourceUri remoteTP = null; - - AAIResourceUri pInterface0 = pInterfaces.get(0); - - if (isRemotePInterface(client, pInterface0)) { - remoteTP = pInterfaces.get(0); - localTP = pInterfaces.get(1); - } else { - localTP = pInterfaces.get(0); - remoteTP = pInterfaces.get(1); - } - - if (localTP != null && remoteTP != null) { - // give local tp - String tpUrl = localTP.build().toString(); - PInterface intfLocal = client.get(PInterface.class, localTP).get(); - tpInfo.put("local-access-node-id", tpUrl.split("/")[6]); - - String[] networkRef = intfLocal.getNetworkRef().split("/"); - if (networkRef.length == 6) { - tpInfo.put("local-access-provider-id", networkRef[1]); - tpInfo.put("local-access-client-id", networkRef[3]); - tpInfo.put("local-access-topology-id", networkRef[5]); - } - String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1); - if (ltpIdStr.contains("-")) { - tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1)); - } - - // give remote tp - tpUrl = remoteTP.build().toString(); - PInterface intfRemote = client.get(PInterface.class, remoteTP).get(); - tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]); - - String[] networkRefRemote = intfRemote.getNetworkRef().split("/"); - - if (networkRefRemote.length == 6) { - tpInfo.put("remote-access-provider-id", networkRefRemote[1]); - tpInfo.put("remote-access-client-id", networkRefRemote[3]); - tpInfo.put("remote-access-topology-id", networkRefRemote[5]); - } - String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1); - if (ltpIdStrR.contains("-")) { - tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1)); - } - return tpInfo; - } - } - } - } - return tpInfo; - } - - // this method check if pInterface is remote - private boolean isRemotePInterface(AAIResourcesClient client, AAIResourceUri uri) { - - String uriString = uri.build().toString(); - - if (uriString != null) { - // get the pnfname - String[] token = uriString.split("/"); - AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]); - - AAIResultWrapper wrapper = client.get(parent); - Optional optRelationships = wrapper.getRelationships(); - if (optRelationships.isPresent()) { - Relationships relationships = optRelationships.get(); - - return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty(); - } - } - - return false; - } - - public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) { - - // now only for sotn - if (isSOTN(serviceDecomposition, uuiRequest)) { - // We Need to query the terminalpoint of the VPN by site location - // info - return preProcessSOTNService(serviceDecomposition, uuiRequest); - } - return uuiRequest; - } - - public String doServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) { - // now only for sotn - if (isSOTN(serviceDecomposition, uuiRequest)) { - return doSOTNServiceHoming(serviceDecomposition, uuiRequest); - } - return uuiRequest; - } - - private boolean isSOTN(ServiceDecomposition serviceDecomposition, String uuiRequest) { - // there should be a register platform , we check it very simple here. - return uuiRequest.contains("clientSignal") && uuiRequest.contains("vpnType"); - } - - @SuppressWarnings("unchecked") - private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) { - Map uuiObject = getJsonObject(uuiRequest, Map.class); - if (uuiObject == null) { - return uuiRequest; - } - Map serviceObject = (Map) uuiObject - .getOrDefault("service", Collections.emptyMap()); - Map serviceParametersObject = (Map) serviceObject - .getOrDefault("parameters", Collections.emptyMap()); - Map serviceRequestInputs = (Map) serviceParametersObject - .getOrDefault("requestInputs", Collections.emptyMap()); - List resources = (List) serviceParametersObject.getOrDefault("resources", Collections.emptyList()); - // This is a logic for demo , it could not be finalized to community. - String srcLocation = ""; - String dstLocation = ""; - String srcClientSignal = ""; - String dstClientSignal = ""; - // support R2 uuiReq and R1 uuiReq - // logic for R2 uuiRequest params in service level - for (Entry entry : serviceRequestInputs.entrySet()) { - if (entry.getKey().toLowerCase().contains("location")) { - if ("".equals(srcLocation)) { - srcLocation = (String) entry.getValue(); - } else if ("".equals(dstLocation)) { - dstLocation = (String) entry.getValue(); - } - } - if (entry.getKey().toLowerCase().contains("clientsignal")) { - if ("".equals(srcClientSignal)) { - srcClientSignal = (String) entry.getValue(); - } else if ("".equals(dstClientSignal)) { - dstClientSignal = (String) entry.getValue(); - } - } - } - - // logic for R1 uuiRequest, params in resource level - for (Object resource : resources) { - Map resourceObject = (Map) resource; - Map resourceParametersObject = (Map) resourceObject.get("parameters"); - Map resourceRequestInputs = (Map) resourceParametersObject.get("requestInputs"); - for (Entry entry : resourceRequestInputs.entrySet()) { - if (entry.getKey().toLowerCase().contains("location")) { - if ("".equals(srcLocation)) { - srcLocation = (String) entry.getValue(); - } else if ("".equals(dstLocation)) { - dstLocation = (String) entry.getValue(); - } - } - if (entry.getKey().toLowerCase().contains("clientsignal")) { - if ("".equals(srcClientSignal)) { - srcClientSignal = (String) entry.getValue(); - } else if ("".equals(dstClientSignal)) { - dstClientSignal = (String) entry.getValue(); - } - } - } - } - - Map vpnRequestInputs = getVPNResourceRequestInputs(resources); - // here we put client signal to vpn resource inputs - if(null!=vpnRequestInputs) { - vpnRequestInputs.put("src-client-signal", srcClientSignal); - vpnRequestInputs.put("dst-client-signal", dstClientSignal); - } - - - // Now we need to query terminal points from SP resourcemgr system. - List locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation); - Map tpInfoMap = (Map) locationTerminalPointList.get(0); - - serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id")); - serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id")); - serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id")); - serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id")); - serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id")); - tpInfoMap = (Map) locationTerminalPointList.get(1); - - serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id")); - serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id")); - serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id")); - serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id")); - serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id")); - - String newRequest = getJsonString(uuiObject); - return newRequest; - } - - private List queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) { - Map locationSrc = new HashMap<>(); - locationSrc.put("location", srcLocation); - Map locationDst = new HashMap<>(); - locationDst.put("location", dstLocation); - List> locations = new ArrayList<>(); - locations.add(locationSrc); - locations.add(locationDst); - List returnList = new ArrayList<>(); - String reqContent = getJsonString(locations); - String url = getThirdSPEndPoint(); - String responseContent = sendRequest(url, "POST", reqContent); - if (null != responseContent) { - returnList = getJsonObject(responseContent, List.class); - } - return returnList; - } - - @SuppressWarnings("unchecked") - private Map getVPNResourceRequestInputs(List resources) { - for (Object resource : resources) { - Map resourceObject = (Map) resource; - Map resourceParametersObject = (Map) resourceObject.get("parameters"); - Map resourceRequestInputs = (Map) resourceParametersObject.get("requestInputs"); - for (Entry entry : resourceRequestInputs.entrySet()) { - if (entry.getKey().toLowerCase().contains("vpntype")) { - return resourceRequestInputs; - } - } - } - return null; - } - - public static void main(String args[]){ - String str = "restconf/config/GENERIC-RESOURCE-API:services/service/eca7e542-12ba-48de-8544-fac59303b14e/service-data/networks/network/aec07806-1671-4af2-b722-53c8e320a633/network-data/"; - - int index1 = str.indexOf("/network/"); - int index2 = str.indexOf("/network-data"); - - String str1 = str.substring(index1 + "/network/".length(), index2); - System.out.println(str1); - - } + // SOTN calculate route + public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc"; + + public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps"; + + public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory"; + + private static final int DEFAULT_TIME_OUT = 60000; + + static JsonUtils jsonUtil = new JsonUtils(); + + private static Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class); + + private static ServicePluginFactory instance; + + + public static synchronized ServicePluginFactory getInstance() { + if (null == instance) { + instance = new ServicePluginFactory(); + } + return instance; + } + + private ServicePluginFactory() { + + } + + private String getInventoryOSSEndPoint() { + return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", + INVENTORY_OSS_DEFAULT_ENDPOINT); + } + + private String getThirdSPEndPoint() { + return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", THIRD_SP_DEFAULT_ENDPOINT); + } + + private String getOOFCalcEndPoint() { + return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_DEFAULT_ENDPOINT); + } + + @SuppressWarnings("unchecked") + public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) { + if (!isNeedProcessSite(uuiRequest)) { + return uuiRequest; + } + + Map uuiObject = getJsonObject(uuiRequest, Map.class); + if (uuiObject == null) { + return uuiRequest; + } + Map serviceObject = + (Map) uuiObject.getOrDefault("service", Collections.emptyMap()); + Map serviceParametersObject = + (Map) serviceObject.getOrDefault("parameters", Collections.emptyMap()); + Map serviceRequestInputs = + (Map) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap()); + List resources = + (List) serviceParametersObject.getOrDefault("resources", Collections.emptyList()); + + if (isSiteLocationLocal(serviceRequestInputs, resources)) { + // resources changed : added TP info + return getJsonString(uuiObject); + } + + List addResourceList = new ArrayList<>(); + addResourceList.addAll(serviceDecomposition.getServiceResources()); + + serviceDecomposition.setVnfResources(null); + serviceDecomposition.setAllottedResources(null); + serviceDecomposition.setNetworkResources(null); + serviceDecomposition.setConfigResources(null); + for (Resource resource : addResourceList) { + String resourcemodelName = resource.getModelInfo().getModelName(); + if (StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) { + // change serviceDecomposition + serviceDecomposition.addResource(resource); + break; + } + } + + return uuiRequest; + } + + private boolean isNeedProcessSite(String uuiRequest) { + return uuiRequest.toLowerCase().contains("site_address") + && uuiRequest.toLowerCase().contains("sotncondition_clientsignal"); + } + + @SuppressWarnings("unchecked") + private boolean isSiteLocationLocal(Map serviceRequestInputs, List resources) { + Map tpInfoMap = getTPforVPNAttachment(serviceRequestInputs); + + if (tpInfoMap.isEmpty()) { + return true; + } + String host = (String) tpInfoMap.get("host"); + // host is empty means TP is in local, not empty means TP is in remote ONAP + if (!host.isEmpty()) { + return false; + } + + Map accessTPInfo = new HashMap(); + accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id")); + accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id")); + accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id")); + accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id")); + accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id")); + + // change resources + String resourceName = (String) tpInfoMap.get("resourceName"); + for (Object curResource : resources) { + Map resource = (Map) curResource; + String curResourceName = (String) resource.get("resourceName"); + curResourceName = curResourceName.replaceAll(" ", ""); + if (resourceName.equalsIgnoreCase(curResourceName)) { + putResourceRequestInputs(resource, accessTPInfo); + break; + } + } + + return true; + } + + @SuppressWarnings("unchecked") + private Map getTPforVPNAttachment(Map serviceRequestInputs) { + Object location = null; + Object clientSignal = null; + String vpnAttachmentResourceName = null; + + // support R2 uuiReq and R1 uuiReq + // logic for R2 uuiRequest params in service level + for (Entry entry : serviceRequestInputs.entrySet()) { + String key = entry.getKey(); + if (key.toLowerCase().contains("site_address")) { + location = entry.getValue(); + } + if (key.toLowerCase().contains("sotncondition_clientsignal")) { + clientSignal = entry.getValue(); + vpnAttachmentResourceName = key.substring(0, key.indexOf("_")); + } + } + + Map tpInfoMap = new HashMap(); + + // Site resource has location param and SOTNAttachment resource has clientSignal param + if (location == null || clientSignal == null) { + return tpInfoMap; + } + + // Query terminal points from InventoryOSS system by location. + String locationAddress = (String) location; + List locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress); + if (locationTPList != null && !locationTPList.isEmpty()) { + for (Object tp : locationTPList) { + Map tpJson = (Map) tp; + String loc = (String) tpJson.get("location"); + if (StringUtils.equalsIgnoreCase(locationAddress, loc)) { + tpInfoMap = tpJson; + // add resourceName + tpInfoMap.put("resourceName", vpnAttachmentResourceName); + break; + } + } + logger.debug("Get Terminal TP from InventoryOSS"); + return tpInfoMap; + } + + return tpInfoMap; + } + + @SuppressWarnings("unchecked") + private List queryAccessTPbyLocationFromInventoryOSS(String locationAddress) { + String url = getInventoryOSSEndPoint(); + url += "/oss/inventory?location=" + UriUtils.encode(locationAddress, "UTF-8"); + String responseContent = sendRequest(url, "GET", ""); + List accessTPs = new ArrayList<>(); + if (null != responseContent) { + accessTPs = getJsonObject(responseContent, List.class); + } + return accessTPs; + } + + @SuppressWarnings("unchecked") + private void putResourceRequestInputs(Map resource, Map resourceInputs) { + Map resourceParametersObject = new HashMap<>(); + Map resourceRequestInputs = new HashMap<>(); + resourceRequestInputs.put("requestInputs", resourceInputs); + resourceParametersObject.put("parameters", resourceRequestInputs); + + if (resource.containsKey("parameters")) { + Map resParametersObject = (Map) resource.get("parameters"); + if (resParametersObject.containsKey("requestInputs")) { + Map resRequestInputs = (Map) resourceRequestInputs.get("requestInputs"); + Map oldRequestInputs = (Map) resParametersObject.get("requestInputs"); + if (oldRequestInputs != null) { + oldRequestInputs.putAll(resRequestInputs); + } else { + resParametersObject.put("requestInputs", resRequestInputs); + } + } else { + resParametersObject.putAll(resourceRequestInputs); + } + } else { + resource.putAll(resourceParametersObject); + } + + return; + } + + + + @SuppressWarnings("unchecked") + public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) { + Map uuiObject = getJsonObject(uuiRequest, Map.class); + if (uuiObject == null) { + return uuiRequest; + } + Map serviceObject = + (Map) uuiObject.getOrDefault("service", Collections.emptyMap()); + Map serviceParametersObject = + (Map) serviceObject.getOrDefault("parameters", Collections.emptyMap()); + Map serviceRequestInputs = + (Map) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap()); + + if (!isNeedAllocateCrossTPResources(serviceRequestInputs)) { + return uuiRequest; + } + + allocateCrossTPResources(execution, serviceRequestInputs); + return getJsonString(uuiObject); + } + + @SuppressWarnings("unchecked") + private boolean isNeedAllocateCrossTPResources(Map serviceRequestInputs) { + if (serviceRequestInputs.containsKey("CallSource")) { + String callSource = (String) serviceRequestInputs.get("CallSource"); + if ("ExternalAPI".equalsIgnoreCase(callSource)) { + return false; + } + } + for (String input : serviceRequestInputs.keySet()) { + if (input.toLowerCase().contains("sotnconnectivity")) { + return true; + } + } + return false; + } + + @SuppressWarnings("unchecked") + private void allocateCrossTPResources(DelegateExecution execution, Map serviceRequestInputs) { + + Map crossTPs = this.getTPsfromAAI(); + + if (crossTPs == null || crossTPs.isEmpty()) { + serviceRequestInputs.put("local-access-provider-id", ""); + serviceRequestInputs.put("local-access-client-id", ""); + serviceRequestInputs.put("local-access-topology-id", ""); + serviceRequestInputs.put("local-access-node-id", ""); + serviceRequestInputs.put("local-access-ltp-id", ""); + serviceRequestInputs.put("remote-access-provider-id", ""); + serviceRequestInputs.put("remote-access-client-id", ""); + serviceRequestInputs.put("remote-access-topology-id", ""); + serviceRequestInputs.put("remote-access-node-id", ""); + serviceRequestInputs.put("remote-access-ltp-id", ""); + } else { + serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); + serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id")); + serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); + serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id")); + serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); + serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); + serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id")); + serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id")); + serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id")); + serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id")); + } + + return; + } + + // This method returns Local and remote TPs information from AAI + public Map getTPsfromAAI() { + Map tpInfo = new HashMap<>(); + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK); + AAIResourcesClient client = new AAIResourcesClient(); + Optional result = client.get(LogicalLinks.class, uri); + + if (result.isPresent()) { + LogicalLinks links = result.get(); + boolean isRemoteLink = false; + + links.getLogicalLink(); + + for (LogicalLink link : links.getLogicalLink()) { + AAIResultWrapper wrapper = new AAIResultWrapper(link); + Optional optRelationships = wrapper.getRelationships(); + List pInterfaces = new ArrayList<>(); + if (optRelationships.isPresent()) { + Relationships relationships = optRelationships.get(); + if (!relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty()) { + isRemoteLink = true; + } + pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE)); + } + + if (isRemoteLink) { + // find remote p interface + AAIResourceUri localTP = null; + AAIResourceUri remoteTP = null; + + AAIResourceUri pInterface0 = pInterfaces.get(0); + + if (isRemotePInterface(client, pInterface0)) { + remoteTP = pInterfaces.get(0); + localTP = pInterfaces.get(1); + } else { + localTP = pInterfaces.get(0); + remoteTP = pInterfaces.get(1); + } + + if (localTP != null && remoteTP != null) { + // give local tp + String tpUrl = localTP.build().toString(); + PInterface intfLocal = client.get(PInterface.class, localTP).get(); + tpInfo.put("local-access-node-id", tpUrl.split("/")[6]); + + String[] networkRef = intfLocal.getNetworkRef().split("/"); + if (networkRef.length == 6) { + tpInfo.put("local-access-provider-id", networkRef[1]); + tpInfo.put("local-access-client-id", networkRef[3]); + tpInfo.put("local-access-topology-id", networkRef[5]); + } + String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1); + if (ltpIdStr.contains("-")) { + tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1)); + } + + // give remote tp + tpUrl = remoteTP.build().toString(); + PInterface intfRemote = client.get(PInterface.class, remoteTP).get(); + tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]); + + String[] networkRefRemote = intfRemote.getNetworkRef().split("/"); + + if (networkRefRemote.length == 6) { + tpInfo.put("remote-access-provider-id", networkRefRemote[1]); + tpInfo.put("remote-access-client-id", networkRefRemote[3]); + tpInfo.put("remote-access-topology-id", networkRefRemote[5]); + } + String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1); + if (ltpIdStrR.contains("-")) { + tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1)); + } + return tpInfo; + } + } + } + } + return tpInfo; + } + + // this method check if pInterface is remote + private boolean isRemotePInterface(AAIResourcesClient client, AAIResourceUri uri) { + + String uriString = uri.build().toString(); + + if (uriString != null) { + // get the pnfname + String[] token = uriString.split("/"); + AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]); + + AAIResultWrapper wrapper = client.get(parent); + Optional optRelationships = wrapper.getRelationships(); + if (optRelationships.isPresent()) { + Relationships relationships = optRelationships.get(); + + return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty(); + } + } + + return false; + } + + public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) { + + // now only for sotn + if (isSOTN(serviceDecomposition, uuiRequest)) { + // We Need to query the terminalpoint of the VPN by site location + // info + return preProcessSOTNService(serviceDecomposition, uuiRequest); + } + return uuiRequest; + } + + public String doServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) { + // now only for sotn + if (isSOTN(serviceDecomposition, uuiRequest)) { + return doSOTNServiceHoming(serviceDecomposition, uuiRequest); + } + return uuiRequest; + } + + private boolean isSOTN(ServiceDecomposition serviceDecomposition, String uuiRequest) { + // there should be a register platform , we check it very simple here. + return uuiRequest.contains("clientSignal") && uuiRequest.contains("vpnType"); + } + + @SuppressWarnings("unchecked") + private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) { + Map uuiObject = getJsonObject(uuiRequest, Map.class); + if (uuiObject == null) { + return uuiRequest; + } + Map serviceObject = + (Map) uuiObject.getOrDefault("service", Collections.emptyMap()); + Map serviceParametersObject = + (Map) serviceObject.getOrDefault("parameters", Collections.emptyMap()); + Map serviceRequestInputs = + (Map) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap()); + List resources = + (List) serviceParametersObject.getOrDefault("resources", Collections.emptyList()); + // This is a logic for demo , it could not be finalized to community. + String srcLocation = ""; + String dstLocation = ""; + String srcClientSignal = ""; + String dstClientSignal = ""; + // support R2 uuiReq and R1 uuiReq + // logic for R2 uuiRequest params in service level + for (Entry entry : serviceRequestInputs.entrySet()) { + if (entry.getKey().toLowerCase().contains("location")) { + if ("".equals(srcLocation)) { + srcLocation = (String) entry.getValue(); + } else if ("".equals(dstLocation)) { + dstLocation = (String) entry.getValue(); + } + } + if (entry.getKey().toLowerCase().contains("clientsignal")) { + if ("".equals(srcClientSignal)) { + srcClientSignal = (String) entry.getValue(); + } else if ("".equals(dstClientSignal)) { + dstClientSignal = (String) entry.getValue(); + } + } + } + + // logic for R1 uuiRequest, params in resource level + for (Object resource : resources) { + Map resourceObject = (Map) resource; + Map resourceParametersObject = (Map) resourceObject.get("parameters"); + Map resourceRequestInputs = + (Map) resourceParametersObject.get("requestInputs"); + for (Entry entry : resourceRequestInputs.entrySet()) { + if (entry.getKey().toLowerCase().contains("location")) { + if ("".equals(srcLocation)) { + srcLocation = (String) entry.getValue(); + } else if ("".equals(dstLocation)) { + dstLocation = (String) entry.getValue(); + } + } + if (entry.getKey().toLowerCase().contains("clientsignal")) { + if ("".equals(srcClientSignal)) { + srcClientSignal = (String) entry.getValue(); + } else if ("".equals(dstClientSignal)) { + dstClientSignal = (String) entry.getValue(); + } + } + } + } + + Map vpnRequestInputs = getVPNResourceRequestInputs(resources); + // here we put client signal to vpn resource inputs + if (null != vpnRequestInputs) { + vpnRequestInputs.put("src-client-signal", srcClientSignal); + vpnRequestInputs.put("dst-client-signal", dstClientSignal); + } + + + // Now we need to query terminal points from SP resourcemgr system. + List locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation); + Map tpInfoMap = (Map) locationTerminalPointList.get(0); + + serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id")); + serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id")); + serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id")); + serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id")); + serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id")); + tpInfoMap = (Map) locationTerminalPointList.get(1); + + serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id")); + serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id")); + serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id")); + serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id")); + serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id")); + + String newRequest = getJsonString(uuiObject); + return newRequest; + } + + private List queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) { + Map locationSrc = new HashMap<>(); + locationSrc.put("location", srcLocation); + Map locationDst = new HashMap<>(); + locationDst.put("location", dstLocation); + List> locations = new ArrayList<>(); + locations.add(locationSrc); + locations.add(locationDst); + List returnList = new ArrayList<>(); + String reqContent = getJsonString(locations); + String url = getThirdSPEndPoint(); + String responseContent = sendRequest(url, "POST", reqContent); + if (null != responseContent) { + returnList = getJsonObject(responseContent, List.class); + } + return returnList; + } + + @SuppressWarnings("unchecked") + private Map getVPNResourceRequestInputs(List resources) { + for (Object resource : resources) { + Map resourceObject = (Map) resource; + Map resourceParametersObject = (Map) resourceObject.get("parameters"); + Map resourceRequestInputs = + (Map) resourceParametersObject.get("requestInputs"); + for (Entry entry : resourceRequestInputs.entrySet()) { + if (entry.getKey().toLowerCase().contains("vpntype")) { + return resourceRequestInputs; + } + } + } + return null; + } + + public static void main(String args[]) { + String str = + "restconf/config/GENERIC-RESOURCE-API:services/service/eca7e542-12ba-48de-8544-fac59303b14e/service-data/networks/network/aec07806-1671-4af2-b722-53c8e320a633/network-data/"; + + int index1 = str.indexOf("/network/"); + int index2 = str.indexOf("/network-data"); + + String str1 = str.substring(index1 + "/network/".length(), index2); + System.out.println(str1); + + } @SuppressWarnings("unchecked") private String doSOTNServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) { @@ -624,15 +625,15 @@ public class ServicePluginFactory { if (uuiObject == null) { return uuiRequest; } - Map serviceObject = (Map) uuiObject - .getOrDefault("service", Collections.emptyMap()); - Map serviceParametersObject = (Map) serviceObject - .getOrDefault("parameters", Collections.emptyMap()); - Map serviceRequestInputs = (Map) serviceParametersObject - .getOrDefault("requestInputs", Collections.emptyMap()); + Map serviceObject = + (Map) uuiObject.getOrDefault("service", Collections.emptyMap()); + Map serviceParametersObject = + (Map) serviceObject.getOrDefault("parameters", Collections.emptyMap()); + Map serviceRequestInputs = + (Map) serviceParametersObject.getOrDefault("requestInputs", Collections.emptyMap()); Map oofQueryObject = new HashMap<>(); - List resources = (List) serviceParametersObject - .getOrDefault("resources", Collections.emptyList()); + List resources = + (List) serviceParametersObject.getOrDefault("resources", Collections.emptyList()); oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id")); oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id")); oofQueryObject.put("src-access-topology-id", serviceRequestInputs.get("inner-src-access-topology-id")); @@ -660,147 +661,144 @@ public class ServicePluginFactory { return getJsonString(uuiObject); } - private Map getReturnRoute(List returnList){ - Map returnRoute = new HashMap<>(); - for(Object returnVpn :returnList){ - Map returnVpnInfo = (Map) returnVpn; - String accessTopoId = (String)returnVpnInfo.get("access-topology-id"); - if("100".equals(accessTopoId)){ - returnRoute.putAll(returnVpnInfo); - } - else if("101".equals(accessTopoId)){ - for(String key : returnVpnInfo.keySet()){ - returnRoute.put("domain1-" + key, returnVpnInfo.get(key)); - } - } - else if("102".equals(accessTopoId)){ - for(String key : returnVpnInfo.keySet()){ - returnRoute.put("domain2-" + key, returnVpnInfo.get(key)); - } - } - else{ - for(String key : returnVpnInfo.keySet()){ - returnRoute.put("domain" + accessTopoId +"-" + key, returnVpnInfo.get(key)); - } - } - } - return returnRoute; - } - - private Map getResourceParams(Execution execution, String resourceCustomizationUuid, - String serviceParameters) { - List resourceList = jsonUtil.StringArrayToList(execution, - JsonUtils.getJsonValue(serviceParameters, "resources")); - // Get the right location str for resource. default is an empty array. - String resourceInputsFromUui = ""; - for (String resource : resourceList) { - String resCusUuid = JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); - if (resourceCustomizationUuid.equals(resCusUuid)) { - String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); - resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); - } - } - Map resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); - return resourceInputsFromUuiMap; - } - - private static T getJsonObject(String jsonstr, Class type) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - try { - return mapper.readValue(jsonstr, type); - } catch (IOException e) { - logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(), - ErrorCode.BusinessProcesssError.getValue(), e); - } - return null; - } - - public static String getJsonString(Object srcObj) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - String jsonStr = null; - try { - jsonStr = mapper.writeValueAsString(srcObj); - } catch (JsonProcessingException e) { - logger.debug("SdcToscaParserException", e); - } - return jsonStr; - } - - private static String sendRequest(String url, String methodType, String content) { - - String msbUrl = url; - HttpRequestBase method = null; - HttpResponse httpResponse = null; - - try { - int timeout = DEFAULT_TIME_OUT; - - RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout) - .setConnectionRequestTimeout(timeout).build(); - - HttpClient client = HttpClientBuilder.create().build(); - - if ("POST".equals(methodType.toUpperCase())) { - HttpPost httpPost = new HttpPost(msbUrl); - httpPost.setConfig(requestConfig); - httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); - method = httpPost; - } else if ("PUT".equals(methodType.toUpperCase())) { - HttpPut httpPut = new HttpPut(msbUrl); - httpPut.setConfig(requestConfig); - httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); - method = httpPut; - } else if ("GET".equals(methodType.toUpperCase())) { - HttpGet httpGet = new HttpGet(msbUrl); - httpGet.setConfig(requestConfig); - httpGet.addHeader("X-FromAppId", "MSO"); - httpGet.addHeader("Accept","application/json"); - method = httpGet; - } else if ("DELETE".equals(methodType.toUpperCase())) { - HttpDelete httpDelete = new HttpDelete(msbUrl); - httpDelete.setConfig(requestConfig); - method = httpDelete; - } - - httpResponse = client.execute(method); - String responseContent = null; - if (null != httpResponse && httpResponse.getEntity() != null) { - try { - responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); - } catch (ParseException e) { - logger.debug("ParseException in sendrequest", e); - } catch (IOException e) { - logger.debug("IOException in sendrequest", e); - } - } - if (null != method) { - method.reset(); - } - method = null; - return responseContent; - - } catch (SocketTimeoutException | ConnectTimeoutException e) { - return null; - - } catch (Exception e) { - return null; - - } finally { - if (httpResponse != null) { - try { - EntityUtils.consume(httpResponse.getEntity()); - } catch (Exception e) { - } - } - if (method != null) { - try { - method.reset(); - } catch (Exception e) { - - } - } - } - } + private Map getReturnRoute(List returnList) { + Map returnRoute = new HashMap<>(); + for (Object returnVpn : returnList) { + Map returnVpnInfo = (Map) returnVpn; + String accessTopoId = (String) returnVpnInfo.get("access-topology-id"); + if ("100".equals(accessTopoId)) { + returnRoute.putAll(returnVpnInfo); + } else if ("101".equals(accessTopoId)) { + for (String key : returnVpnInfo.keySet()) { + returnRoute.put("domain1-" + key, returnVpnInfo.get(key)); + } + } else if ("102".equals(accessTopoId)) { + for (String key : returnVpnInfo.keySet()) { + returnRoute.put("domain2-" + key, returnVpnInfo.get(key)); + } + } else { + for (String key : returnVpnInfo.keySet()) { + returnRoute.put("domain" + accessTopoId + "-" + key, returnVpnInfo.get(key)); + } + } + } + return returnRoute; + } + + private Map getResourceParams(Execution execution, String resourceCustomizationUuid, + String serviceParameters) { + List resourceList = + jsonUtil.StringArrayToList(execution, JsonUtils.getJsonValue(serviceParameters, "resources")); + // Get the right location str for resource. default is an empty array. + String resourceInputsFromUui = ""; + for (String resource : resourceList) { + String resCusUuid = JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); + if (resourceCustomizationUuid.equals(resCusUuid)) { + String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); + resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); + } + } + Map resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); + return resourceInputsFromUuiMap; + } + + private static T getJsonObject(String jsonstr, Class type) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + try { + return mapper.readValue(jsonstr, type); + } catch (IOException e) { + logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(), + ErrorCode.BusinessProcesssError.getValue(), e); + } + return null; + } + + public static String getJsonString(Object srcObj) { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + String jsonStr = null; + try { + jsonStr = mapper.writeValueAsString(srcObj); + } catch (JsonProcessingException e) { + logger.debug("SdcToscaParserException", e); + } + return jsonStr; + } + + private static String sendRequest(String url, String methodType, String content) { + + String msbUrl = url; + HttpRequestBase method = null; + HttpResponse httpResponse = null; + + try { + int timeout = DEFAULT_TIME_OUT; + + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout).build(); + + HttpClient client = HttpClientBuilder.create().build(); + + if ("POST".equals(methodType.toUpperCase())) { + HttpPost httpPost = new HttpPost(msbUrl); + httpPost.setConfig(requestConfig); + httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPost; + } else if ("PUT".equals(methodType.toUpperCase())) { + HttpPut httpPut = new HttpPut(msbUrl); + httpPut.setConfig(requestConfig); + httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON)); + method = httpPut; + } else if ("GET".equals(methodType.toUpperCase())) { + HttpGet httpGet = new HttpGet(msbUrl); + httpGet.setConfig(requestConfig); + httpGet.addHeader("X-FromAppId", "MSO"); + httpGet.addHeader("Accept", "application/json"); + method = httpGet; + } else if ("DELETE".equals(methodType.toUpperCase())) { + HttpDelete httpDelete = new HttpDelete(msbUrl); + httpDelete.setConfig(requestConfig); + method = httpDelete; + } + + httpResponse = client.execute(method); + String responseContent = null; + if (null != httpResponse && httpResponse.getEntity() != null) { + try { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + } catch (ParseException e) { + logger.debug("ParseException in sendrequest", e); + } catch (IOException e) { + logger.debug("IOException in sendrequest", e); + } + } + if (null != method) { + method.reset(); + } + method = null; + return responseContent; + + } catch (SocketTimeoutException | ConnectTimeoutException e) { + return null; + + } catch (Exception e) { + return null; + + } finally { + if (httpResponse != null) { + try { + EntityUtils.consume(httpResponse.getEntity()); + } catch (Exception e) { + } + } + if (method != null) { + try { + method.reset(); + } catch (Exception e) { + + } + } + } + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 4c9bb4259e..5451f9ff57 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -27,7 +27,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; - import org.apache.commons.lang3.StringUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; @@ -52,7 +51,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -69,30 +67,31 @@ public abstract class AbstractSdncOperationTask extends BaseTask { private static final String TOPOLOGY_PROPERTIES = "topology.properties"; public static final String ONAP_IP = "ONAP_IP"; - private static final String POST_BODY_TEMPLATE = "\n"+ - " \n"+ - " $errorCode\n"+ - " $jobId\n"+ - " $operType\n"+ - " $operationId\n"+ - " $progress\n"+ - " $resourceTemplateUUID\n"+ - " $serviceId\n"+ - " $status\n"+ - " $statusDescription\n"+ - " "; - - private static final String GET_BODY_TEMPLATE = " \n" + - " \n" + - " $operationId\n" + - " $resourceTemplateUUID\n" + - " $serviceId\n" + - " "; + private static final String POST_BODY_TEMPLATE = + "\n" + + " \n" + + " $errorCode\n" + " $jobId\n" + + " $operType\n" + + " $operationId\n" + + " $progress\n" + + " $resourceTemplateUUID\n" + + " $serviceId\n" + + " $status\n" + + " $statusDescription\n" + + " "; + + private static final String GET_BODY_TEMPLATE = + " \n" + + " \n" + + " $operationId\n" + + " $resourceTemplateUUID\n" + + " $serviceId\n" + + " "; private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException { logger.info("AbstractSdncOperationTask.updateResOperStatus begin!"); - String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); + String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); HttpPost httpPost = new HttpPost(requestsdbEndPoint); httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk"); httpPost.addHeader("Content-type", "application/soap+xml"); @@ -119,12 +118,13 @@ public abstract class AbstractSdncOperationTask extends BaseTask { String result = null; String errorMsg; - try(CloseableHttpClient httpClient = HttpClients.createDefault()) { + try (CloseableHttpClient httpClient = HttpClients.createDefault()) { CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost); result = EntityUtils.toString(closeableHttpResponse.getEntity()); logger.info("result = {}", result); - if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) { - logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode()); + if (closeableHttpResponse.getStatusLine().getStatusCode() != 200) { + logger.info("exception: fail for status code = {}", + closeableHttpResponse.getStatusLine().getStatusCode()); throw new RouteException(result, "SERVICE_GET_ERR"); } @@ -171,9 +171,10 @@ public abstract class AbstractSdncOperationTask extends BaseTask { return getBody; } - private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException { + private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, + String resourceTemplateUUID) throws RouteException { logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!"); - String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); + String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); HttpPost httpPost = new HttpPost(requestsdbEndPoint); httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk"); httpPost.addHeader("Content-type", "application/soap+xml"); @@ -224,7 +225,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask { logger.error("exception: AbstractSdncOperationTask.fail!:", e); logger.error(Arrays.toString(e.getStackTrace())); execution.setVariable("SDNCA_SuccessIndicator", false); - updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100", "sendRestrequestAndHandleResponse finished!"); + updateProgress(execution, RequestsDbConstant.Status.ERROR, null, "100", + "sendRestrequestAndHandleResponse finished!"); } logger.info("AbstractSdncOperationTask.execute end!"); @@ -247,15 +249,11 @@ public abstract class AbstractSdncOperationTask extends BaseTask { return inputs; } - public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution, - Map inputs, - GenericResourceApi genericResourceApiClient) throws Exception; + public abstract void sendRestrequestAndHandleResponse(DelegateExecution execution, Map inputs, + GenericResourceApi genericResourceApiClient) throws Exception; - public void updateProgress(DelegateExecution execution, - String status, - String errorCode, - String progress, - String statusDescription) { + public void updateProgress(DelegateExecution execution, String status, String errorCode, String progress, + String statusDescription) { logger.info("AbstractSdncOperationTask.updateProgress begin!"); String serviceId = (String) execution.getVariable("serviceId"); serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId; @@ -265,7 +263,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask { resourceTemplateId = StringUtils.isBlank(resourceTemplateId) ? "" : resourceTemplateUUID; resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? resourceTemplateId : resourceTemplateUUID; try { - ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); + ResourceOperationStatus resourceOperationStatus = + getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); if (!StringUtils.isBlank(status)) { resourceOperationStatus.setStatus(status); } @@ -284,8 +283,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask { logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), - " updateProgress catch exception: ", this.getTaskName(), - ErrorCode.UnknownError.getValue(), exception.getClass().toString()); + " updateProgress catch exception: ", this.getTaskName(), ErrorCode.UnknownError.getValue(), + exception.getClass().toString()); } } @@ -293,11 +292,11 @@ public abstract class AbstractSdncOperationTask extends BaseTask { protected boolean isSend2SdncDirectly() { logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!"); String sdncHost = UrnPropertiesReader.getVariable("sdnc.host"); - if (!StringUtils.isBlank(sdncHost)) { - logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true."); - return true; - } - + if (!StringUtils.isBlank(sdncHost)) { + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true."); + return true; + } + logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = false."); return false; } @@ -305,7 +304,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { protected String getSdncIp() { logger.info("AbstractSdncOperationTask.getSdncIp begin."); String sdncIp = null; - sdncIp = UrnPropertiesReader.getVariable("sdnc-ip"); + sdncIp = UrnPropertiesReader.getVariable("sdnc-ip"); String returnIp = StringUtils.isBlank(sdncIp) || !isIp(sdncIp) ? null : sdncIp; logger.info("AbstractSdncOperationTask.getSdncIp: sdncIp = {}", returnIp); return returnIp; @@ -340,7 +339,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { strMsbPort = env.getProperty("msb.port", String.valueOf(DEFAULT_MSB_PORT)); } msbPort = Integer.valueOf(strMsbPort); - + logger.info("AbstractSdncOperationTask.getGenericResourceApiClient msbIp = " + msbIp + " msbPort = " + msbPort); MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort); RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient); @@ -353,6 +352,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } public String getProcessKey(DelegateExecution execution) { - return execution.getProcessEngineServices().getRepositoryService().getProcessDefinition(execution.getProcessDefinitionId()).getKey(); + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index a5c609dc2a..4d58439fda 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask; import java.util.Map; - import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -49,29 +48,30 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation"; @Override - public void sendRestrequestAndHandleResponse(DelegateExecution execution, - Map inputs, - GenericResourceApi genericResourceApiClient) throws Exception { + public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map inputs, + GenericResourceApi genericResourceApiClient) throws Exception { logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); - updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "sendRestrequestAndHandleResponse begin!"); + updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", + "sendRestrequestAndHandleResponse begin!"); NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "50", "RequestBody build finished!"); RpcNetworkTopologyOperationOutputEntity outputEntity; if (!isSend2SdncDirectly()) { - outputEntity = genericResourceApiClient.postNetworkTopologyOperation - (HeaderUtil.DefaulAuth, inputEntity).execute().body(); - updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); - saveOutput(execution, outputEntity); + outputEntity = genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth, inputEntity) + .execute().body(); + updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(execution, outputEntity); } else { send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } - updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, + "execute finished!"); logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); } - private void send2SdncDirectly(String defaulAuth, - RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException { + private void send2SdncDirectly(String defaulAuth, RpcNetworkTopologyOperationInputEntity inputEntity) + throws RouteException { logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!"); String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; HttpPost httpPost = new HttpPost(url); @@ -84,7 +84,8 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); } - private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException { + private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) + throws RouteException { logger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index 2fd550dbb8..4fb6817a39 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -24,7 +24,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask; import java.util.Map; - import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -50,9 +49,8 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation"; @Override - public void sendRestrequestAndHandleResponse(DelegateExecution execution, - Map inputs, - GenericResourceApi genericResourceApiClient) throws Exception { + public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map inputs, + GenericResourceApi genericResourceApiClient) throws Exception { logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder(); @@ -60,10 +58,10 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask updateProgress(execution, null, null, "50", "RequestBody build finished!"); RpcServiceTopologyOperationOutputEntity outputEntity; if (!isSend2SdncDirectly()) { - outputEntity = genericResourceApiClient.postServiceTopologyOperation - (HeaderUtil.DefaulAuth, inputEntity).execute().body(); - updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); - saveOutput(execution, outputEntity); + outputEntity = genericResourceApiClient.postServiceTopologyOperation(HeaderUtil.DefaulAuth, inputEntity) + .execute().body(); + updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(execution, outputEntity); } else { send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } @@ -71,8 +69,8 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask } - private void send2SdncDirectly(String defaulAuth, - RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException { + private void send2SdncDirectly(String defaulAuth, RpcServiceTopologyOperationInputEntity inputEntity) + throws RouteException { logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); String url = getSdncHost() + URL; HttpPost httpPost = new HttpPost(url); @@ -85,7 +83,8 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); } - private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception { + private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) + throws Exception { logger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java index f54d6692d6..001d8fb6c0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask; import java.util.Map; - import org.apache.commons.lang3.StringUtils; import org.onap.msb.sdk.httpclient.RestServiceCreater; import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; @@ -46,33 +45,32 @@ public class SdncUnderlayVpnOperationClient { private static Logger logger = LoggerFactory.getLogger(SdncUnderlayVpnOperationClient.class); - public boolean excute(String msbIp, - int msbPort, - Map inputs, - String iServiceID, - String iOperationID, - String resourceTemplateUUID_i){ - ResourceOperationStatusId id = new ResourceOperationStatusId(iServiceID, iOperationID, resourceTemplateUUID_i); + public boolean excute(String msbIp, int msbPort, Map inputs, String iServiceID, String iOperationID, + String resourceTemplateUUID_i) { + ResourceOperationStatusId id = new ResourceOperationStatusId(iServiceID, iOperationID, resourceTemplateUUID_i); GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(msbIp, msbPort); updateProgress(id, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!"); return sendRestrequestAndHandleResponse(id, inputs, genericResourceApiClient); } - public boolean sendRestrequestAndHandleResponse(ResourceOperationStatusId id, Map inputs, GenericResourceApi genericResourceApiClient){ + public boolean sendRestrequestAndHandleResponse(ResourceOperationStatusId id, Map inputs, + GenericResourceApi genericResourceApiClient) { updateProgress(id, null, null, "40", "sendRestrequestAndHandleResponse begin!"); NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); RpcNetworkTopologyOperationInputEntity body = builder.build(null, inputs); updateProgress(id, null, null, "50", "RequestBody build finished!"); - //RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null; + // RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null; try { - genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth ,body).execute().body(); + genericResourceApiClient.postNetworkTopologyOperation(HeaderUtil.DefaulAuth, body).execute().body(); } catch (Exception e) { logger.debug("Exception: ", e); - updateProgress(id, RequestsDbConstant.Status.ERROR, null, null, "sendRestrequestAndHandleResponse exception:" + e.getMessage()); + updateProgress(id, RequestsDbConstant.Status.ERROR, null, null, + "sendRestrequestAndHandleResponse exception:" + e.getMessage()); return false; } updateProgress(id, null, null, "90", "sendRestrequestAndHandleResponse finished!"); - updateProgress(id, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); + updateProgress(id, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, + "execute finished!"); return true; } @@ -88,13 +86,11 @@ public class SdncUnderlayVpnOperationClient { return restServiceCreater.createService(GenericResourceApi.class); } - public void updateProgress(ResourceOperationStatusId id, String status, - String errorCode, - String progress, - String statusDescription) { - - - ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();//rosRepo.getOne(id); + public void updateProgress(ResourceOperationStatusId id, String status, String errorCode, String progress, + String statusDescription) { + + + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();// rosRepo.getOne(id); if (!StringUtils.isBlank(status)) { resourceOperationStatus.setStatus(status); } @@ -107,7 +103,7 @@ public class SdncUnderlayVpnOperationClient { if (!StringUtils.isBlank(statusDescription)) { resourceOperationStatus.setStatusDescription(statusDescription); } - //rosRepo.save(resourceOperationStatus); + // rosRepo.save(resourceOperationStatus); } private void saveOutput() { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java index 8bc9dce966..5b7f3bb432 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java @@ -41,8 +41,13 @@ public class SdncUnderlayVpnPreprocessTask extends BaseTask { serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId; String operationId = (String) execution.getVariable("operationId"); String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); - resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID; - ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();//rosRepo.getOne(new ResourceOperationStatusId(serviceId, operationId, resourceTemplateUUID)); + resourceTemplateUUID = + StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") + : resourceTemplateUUID; + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();// rosRepo.getOne(new + // ResourceOperationStatusId(serviceId, + // operationId, + // resourceTemplateUUID)); return resourceOperationStatus.getOperType(); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java index a837782a2c..ca9269242c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java @@ -34,15 +34,15 @@ public interface GenericResourceApi { @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") Call postNetworkTopologyOperation(@Header("Authorization") String authorization, - @Body RequestBody input); + @Body RequestBody input); @POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation") - Call postNetworkTopologyOperation(@Header("Authorization") String authorization, - @Body RpcNetworkTopologyOperationInputEntity input); + Call postNetworkTopologyOperation( + @Header("Authorization") String authorization, @Body RpcNetworkTopologyOperationInputEntity input); @POST("/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation") - Call postServiceTopologyOperation(@Header("Authorization") String authorization, - @Body RpcServiceTopologyOperationInputEntity input); + Call postServiceTopologyOperation( + @Header("Authorization") String authorization, @Body RpcServiceTopologyOperationInputEntity input); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java index 696be02809..3da5b0de70 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java @@ -36,8 +36,7 @@ public class HeaderUtil { private static String base64Encode(String str) { String base64 = str; try { - base64 = Base64.getEncoder() - .encodeToString(str.getBytes("utf-8")); + base64 = Base64.getEncoder().encodeToString(str.getBytes("utf-8")); } catch (Exception ex) { } return base64; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java index 961b846ace..21b14c35f9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; - import org.apache.commons.lang3.StringUtils; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity; @@ -35,205 +34,206 @@ import org.onap.so.requestsdb.RequestsDbConstant; public abstract class AbstractBuilder { - public static final String OPERATION_TYPE = "operationType"; - public static final String RESOURCE_TYPE = "resourceType"; - - public enum RequestAction { - CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), - ACTIVATE_NETWORK_INSTANCE(1, "ActivateNetworkInstance"), - CREATE_SERVICE_INSTANCE(2, "CreateServiceInstance"), - DELETE_SERVICE_INSTANCE(3, "DeleteServiceInstance"), - DELETE_NETWORK_INSTANCE(4, "DeleteNetworkInstance"), - CREATE_VNF_INSTANCE(5, "CreateVnfInstance"), - ACTIVATE_VNF_INSTANCE(6, "ActivateVnfInstance"), - DELETE_VNF_INSTANCE(7, "DeleteVnfInstance"), - CREATE_VF_MODULE_INSTANCE(8, "CreateVfModuleInstance"), - ACTIVATE_VF_MODULE_INSTANCE(9, "ActivateVfModuleInstance"), - DELETE_VF_MODULE_INSTANCE(10, "DeleteVfModuleInstance"), - CREATE_CONTRAIL_ROUTE_INSTANCE(11, "CreateContrailRouteInstance"), - DELETE_CONTRAIL_ROUTE_INSTANCE(12, "DeleteContrailRouteInstance"), - CREATE_SECURITY_ZONE_INSTANCE(13, "CreateSecurityZoneInstance"), - DELETE_SECURITY_ZONE_INSTANCE(14, "DeleteSecurityZoneInstance"), - ACTIVATE_DCI_NETWORK_INSTANCE(15, "ActivateDCINetworkInstance"), - DEACTIVATE_DCI_NETWORK_INSTANCE(16, "DeActivateDCINetworkInstance"); - - String name; - int value; - - private RequestAction(int value, String name) { - this.value = value; - this.name = name; - } - - public String getName() { - return this.name; - } - - public int getIntValue() { - return this.value; - } - } - - public enum SvcAction { - RESERVE(0, "reserve"), - ASSIGN(1, "assign"), - ACTIVATE(2, "activate"), - DELETE(3, "delete"), - CHANGEASSIGN(4, "changeassign"), - CHANGEDELETE(5, "changedelete"), - ROLLBACK(6, "rollback"), - DEACTIVATE(7, "deactivate"), - UNASSIGN(8, "unassign"), - CREATE(9, "create"); - - String name; - int value; - - private SvcAction(int value, String name) { - this.value = value; - this.name = name; - } - - public String getName() { - return this.name; - } - - public int getIntValue() { - return this.value; - } - } - - protected String requestId = null; - - abstract O build(DelegateExecution execution, I input) throws Exception; - - protected String getRequestAction(DelegateExecution execution) { - String action = /*RequestInformation.*/RequestAction.CREATE_NETWORK_INSTANCE.getName(); - String operType = (String) execution.getVariable(OPERATION_TYPE); - String resourceType = (String)execution.getVariable(RESOURCE_TYPE); - if (!StringUtils.isBlank(operType)) { - if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { - if (isOverlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(); - } else if (isUnderlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.DELETE_NETWORK_INSTANCE.getName(); - } else { - action = /*RequestInformation.*/RequestAction.DELETE_SERVICE_INSTANCE.getName(); - } - } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { - if (isOverlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(); - } else if (isUnderlay(resourceType)) { - action = /*RequestInformation.*/RequestAction.CREATE_NETWORK_INSTANCE.getName(); - } else { - action = /*RequestInformation.*/RequestAction.CREATE_SERVICE_INSTANCE.getName(); - } - } - } - return action; - } - - private boolean isOverlay(String resourceType) { - return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("overlay"); - } - - private boolean isUnderlay(String resourceType) { - return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("underlay"); - } - - protected String getSvcAction(DelegateExecution execution) { - String action = /*SdncRequestHeader.*/SvcAction.CREATE.getName(); - String operType = (String) execution.getVariable(OPERATION_TYPE); - String resourceType = (String)execution.getVariable(RESOURCE_TYPE); - if (!StringUtils.isBlank(operType)) { - if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { - if (isOverlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.DEACTIVATE.getName(); - } else if (isUnderlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.DELETE.getName(); - } else { - action = /*SdncRequestHeader.*/SvcAction.UNASSIGN.getName(); - } - } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { - if (isOverlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.ACTIVATE.getName(); - } else if (isUnderlay(resourceType)) { - action = /*SdncRequestHeader.*/SvcAction.CREATE.getName(); - } else { - action = /*SdncRequestHeader.*/SvcAction.ASSIGN.getName(); - } - } - } - return action; - } - - protected synchronized String getRequestId(DelegateExecution execution) { - if (StringUtils.isBlank(requestId)) { - requestId = (String) execution.getVariable("msoRequestId"); - if (StringUtils.isBlank(requestId)) { - requestId = UUID.randomUUID().toString(); - } - } - return requestId; - } - - protected OnapModelInformationEntity getOnapServiceModelInformationEntity(DelegateExecution execution) { - OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); - String modelInvariantUuid = (String) execution.getVariable("modelInvariantUuid"); - String modelVersion = (String) execution.getVariable("modelVersion"); - String modelUuid = (String) execution.getVariable("modelUuid"); - String modelName = (String) execution.getVariable("serviceModelName"); - onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); - onapModelInformationEntity.setModelVersion(modelVersion); - onapModelInformationEntity.setModelUuid(modelUuid); - onapModelInformationEntity.setModelName(modelName); - return onapModelInformationEntity; - } - - protected OnapModelInformationEntity getOnapNetworkModelInformationEntity(DelegateExecution execution) { - OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); - String modelInvariantUuid = (String) execution.getVariable("resourceInvariantUUID"); - String modelVersion = (String) execution.getVariable("modelVersion"); - String modelUuid = (String) execution.getVariable("resourceUUID"); - String modelName = (String) execution.getVariable(RESOURCE_TYPE); - onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); - onapModelInformationEntity.setModelVersion(modelVersion); - onapModelInformationEntity.setModelUuid(modelUuid); - onapModelInformationEntity.setModelName(modelName); - return onapModelInformationEntity; + public static final String OPERATION_TYPE = "operationType"; + public static final String RESOURCE_TYPE = "resourceType"; + + public enum RequestAction { + CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), ACTIVATE_NETWORK_INSTANCE(1, + "ActivateNetworkInstance"), CREATE_SERVICE_INSTANCE(2, + "CreateServiceInstance"), DELETE_SERVICE_INSTANCE(3, + "DeleteServiceInstance"), DELETE_NETWORK_INSTANCE(4, + "DeleteNetworkInstance"), CREATE_VNF_INSTANCE(5, + "CreateVnfInstance"), ACTIVATE_VNF_INSTANCE(6, + "ActivateVnfInstance"), DELETE_VNF_INSTANCE(7, + "DeleteVnfInstance"), CREATE_VF_MODULE_INSTANCE(8, + "CreateVfModuleInstance"), ACTIVATE_VF_MODULE_INSTANCE( + 9, + "ActivateVfModuleInstance"), DELETE_VF_MODULE_INSTANCE( + 10, + "DeleteVfModuleInstance"), CREATE_CONTRAIL_ROUTE_INSTANCE( + 11, + "CreateContrailRouteInstance"), DELETE_CONTRAIL_ROUTE_INSTANCE( + 12, + "DeleteContrailRouteInstance"), CREATE_SECURITY_ZONE_INSTANCE( + 13, + "CreateSecurityZoneInstance"), DELETE_SECURITY_ZONE_INSTANCE( + 14, + "DeleteSecurityZoneInstance"), ACTIVATE_DCI_NETWORK_INSTANCE( + 15, + "ActivateDCINetworkInstance"), DEACTIVATE_DCI_NETWORK_INSTANCE( + 16, + "DeActivateDCINetworkInstance"); + + String name; + int value; + + private RequestAction(int value, String name) { + this.value = value; + this.name = name; + } + + public String getName() { + return this.name; + } + + public int getIntValue() { + return this.value; + } + } + + public enum SvcAction { + RESERVE(0, "reserve"), ASSIGN(1, "assign"), ACTIVATE(2, "activate"), DELETE(3, "delete"), CHANGEASSIGN(4, + "changeassign"), CHANGEDELETE(5, "changedelete"), ROLLBACK(6, + "rollback"), DEACTIVATE(7, "deactivate"), UNASSIGN(8, "unassign"), CREATE(9, "create"); + + String name; + int value; + + private SvcAction(int value, String name) { + this.value = value; + this.name = name; + } + + public String getName() { + return this.name; + } + + public int getIntValue() { + return this.value; + } + } + + protected String requestId = null; + + abstract O build(DelegateExecution execution, I input) throws Exception; + + protected String getRequestAction(DelegateExecution execution) { + String action = /* RequestInformation. */RequestAction.CREATE_NETWORK_INSTANCE.getName(); + String operType = (String) execution.getVariable(OPERATION_TYPE); + String resourceType = (String) execution.getVariable(RESOURCE_TYPE); + if (!StringUtils.isBlank(operType)) { + if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /* RequestInformation. */RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(); + } else if (isUnderlay(resourceType)) { + action = /* RequestInformation. */RequestAction.DELETE_NETWORK_INSTANCE.getName(); + } else { + action = /* RequestInformation. */RequestAction.DELETE_SERVICE_INSTANCE.getName(); + } + } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /* RequestInformation. */RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(); + } else if (isUnderlay(resourceType)) { + action = /* RequestInformation. */RequestAction.CREATE_NETWORK_INSTANCE.getName(); + } else { + action = /* RequestInformation. */RequestAction.CREATE_SERVICE_INSTANCE.getName(); + } + } + } + return action; + } + + private boolean isOverlay(String resourceType) { + return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("overlay"); + } + + private boolean isUnderlay(String resourceType) { + return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("underlay"); + } + + protected String getSvcAction(DelegateExecution execution) { + String action = /* SdncRequestHeader. */SvcAction.CREATE.getName(); + String operType = (String) execution.getVariable(OPERATION_TYPE); + String resourceType = (String) execution.getVariable(RESOURCE_TYPE); + if (!StringUtils.isBlank(operType)) { + if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /* SdncRequestHeader. */SvcAction.DEACTIVATE.getName(); + } else if (isUnderlay(resourceType)) { + action = /* SdncRequestHeader. */SvcAction.DELETE.getName(); + } else { + action = /* SdncRequestHeader. */SvcAction.UNASSIGN.getName(); + } + } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) { + if (isOverlay(resourceType)) { + action = /* SdncRequestHeader. */SvcAction.ACTIVATE.getName(); + } else if (isUnderlay(resourceType)) { + action = /* SdncRequestHeader. */SvcAction.CREATE.getName(); + } else { + action = /* SdncRequestHeader. */SvcAction.ASSIGN.getName(); + } + } + } + return action; + } + + protected synchronized String getRequestId(DelegateExecution execution) { + if (StringUtils.isBlank(requestId)) { + requestId = (String) execution.getVariable("msoRequestId"); + if (StringUtils.isBlank(requestId)) { + requestId = UUID.randomUUID().toString(); + } + } + return requestId; + } + + protected OnapModelInformationEntity getOnapServiceModelInformationEntity(DelegateExecution execution) { + OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); + String modelInvariantUuid = (String) execution.getVariable("modelInvariantUuid"); + String modelVersion = (String) execution.getVariable("modelVersion"); + String modelUuid = (String) execution.getVariable("modelUuid"); + String modelName = (String) execution.getVariable("serviceModelName"); + onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); + onapModelInformationEntity.setModelVersion(modelVersion); + onapModelInformationEntity.setModelUuid(modelUuid); + onapModelInformationEntity.setModelName(modelName); + return onapModelInformationEntity; + } + + protected OnapModelInformationEntity getOnapNetworkModelInformationEntity(DelegateExecution execution) { + OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity(); + String modelInvariantUuid = (String) execution.getVariable("resourceInvariantUUID"); + String modelVersion = (String) execution.getVariable("modelVersion"); + String modelUuid = (String) execution.getVariable("resourceUUID"); + String modelName = (String) execution.getVariable(RESOURCE_TYPE); + onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid); + onapModelInformationEntity.setModelVersion(modelVersion); + onapModelInformationEntity.setModelUuid(modelUuid); + onapModelInformationEntity.setModelName(modelName); + return onapModelInformationEntity; } - protected List getParamEntities(Map inputs) { - List paramEntityList = new ArrayList<>(); - if (inputs != null && !inputs.isEmpty()) { - inputs.keySet().forEach(key -> { - ParamEntity paramEntity = new ParamEntity(); - paramEntity.setName(key); - paramEntity.setValue(inputs.get(key)); - paramEntityList.add(paramEntity); - }); - } - return paramEntityList; - } - - protected RequestInformationEntity getRequestInformationEntity(DelegateExecution execution) { - RequestInformationEntity requestInformationEntity = new RequestInformationEntity(); - requestInformationEntity.setRequestId(getRequestId(execution)); - requestInformationEntity.setRequestAction(getRequestAction(execution)); - return requestInformationEntity; - } - - protected ServiceInformationEntity getServiceInformationEntity(DelegateExecution execution) { - ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity(); - serviceInformationEntity.setServiceId((String) execution.getVariable("serviceInstanceId")); - serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("serviceType")); - serviceInformationEntity.setOnapModelInformation(getOnapServiceModelInformationEntity(execution)); - serviceInformationEntity.setServiceInstanceId((String) execution.getVariable("serviceInstanceId")); - serviceInformationEntity.setGlobalCustomerId((String) execution.getVariable("globalSubscriberId")); - return serviceInformationEntity; - } - - protected String getServiceInstanceName(DelegateExecution execution) { - return (String) execution.getVariable("serviceInstanceName"); - } + protected List getParamEntities(Map inputs) { + List paramEntityList = new ArrayList<>(); + if (inputs != null && !inputs.isEmpty()) { + inputs.keySet().forEach(key -> { + ParamEntity paramEntity = new ParamEntity(); + paramEntity.setName(key); + paramEntity.setValue(inputs.get(key)); + paramEntityList.add(paramEntity); + }); + } + return paramEntityList; + } + + protected RequestInformationEntity getRequestInformationEntity(DelegateExecution execution) { + RequestInformationEntity requestInformationEntity = new RequestInformationEntity(); + requestInformationEntity.setRequestId(getRequestId(execution)); + requestInformationEntity.setRequestAction(getRequestAction(execution)); + return requestInformationEntity; + } + + protected ServiceInformationEntity getServiceInformationEntity(DelegateExecution execution) { + ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity(); + serviceInformationEntity.setServiceId((String) execution.getVariable("serviceInstanceId")); + serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("serviceType")); + serviceInformationEntity.setOnapModelInformation(getOnapServiceModelInformationEntity(execution)); + serviceInformationEntity.setServiceInstanceId((String) execution.getVariable("serviceInstanceId")); + serviceInformationEntity.setGlobalCustomerId((String) execution.getVariable("globalSubscriberId")); + return serviceInformationEntity; + } + + protected String getServiceInstanceName(DelegateExecution execution) { + return (String) execution.getVariable("serviceInstanceName"); + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java index 547df2bb3a..4a2194ed3d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder; import java.util.List; import java.util.Map; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInformationEntity; import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInputParametersEntity; @@ -35,44 +34,53 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNet import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.SdncRequestHeaderEntity; import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity; -public class NetworkRpcInputEntityBuilder extends AbstractBuilder, RpcNetworkTopologyOperationInputEntity> { +public class NetworkRpcInputEntityBuilder + extends AbstractBuilder, RpcNetworkTopologyOperationInputEntity> { @Override public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map inputs) { - RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = new RpcNetworkTopologyOperationInputEntity(); - NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = getNetworkTopologyOperationInputEntity(execution, inputs); + RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = + new RpcNetworkTopologyOperationInputEntity(); + NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = + getNetworkTopologyOperationInputEntity(execution, inputs); rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity); return rpcNetworkTopologyOperationInputEntity; } - private void loadNetwrokRequestInputEntity(Map inputs, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) { + private void loadNetwrokRequestInputEntity(Map inputs, + NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) { NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity(); - NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity(); + NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity(); List paramEntityList = getParamEntities(inputs); networkInputParametersEntity.setParamList(paramEntityList); - networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity); + networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity); networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity); } - private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { + private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, + DelegateExecution execution) { RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution); networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity); } - private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { + private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, + DelegateExecution execution) { SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity(); sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution)); sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution)); networkTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity); } - private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) { + private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, + DelegateExecution execution) { ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution); networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity); } - private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, Map inputs) { - NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = new NetworkTopologyOperationInputEntity(); + private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, + Map inputs) { + NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = + new NetworkTopologyOperationInputEntity(); loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution); loadRequestInformationEntity(networkTopologyOperationInputEntity, execution); loadServiceInformation(networkTopologyOperationInputEntity, execution); @@ -81,7 +89,8 @@ public class NetworkRpcInputEntityBuilder extends AbstractBuilder, RpcServiceTopologyOperationInputEntity> { +public class ServiceRpcInputEntityBuilder + extends AbstractBuilder, RpcServiceTopologyOperationInputEntity> { @Override - public RpcServiceTopologyOperationInputEntity build(DelegateExecution execution, Map inputs) throws Exception { - RpcServiceTopologyOperationInputEntity rpcServiceTopologyOperationInputEntity = new RpcServiceTopologyOperationInputEntity(); - ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity = new ServiceTopologyOperationInputEntity(); + public RpcServiceTopologyOperationInputEntity build(DelegateExecution execution, Map inputs) + throws Exception { + RpcServiceTopologyOperationInputEntity rpcServiceTopologyOperationInputEntity = + new RpcServiceTopologyOperationInputEntity(); + ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity = + new ServiceTopologyOperationInputEntity(); loadSdncRequestHeaderEntity(serviceTopologyOperationInputEntity, execution); loadRequestInformationEntity(serviceTopologyOperationInputEntity, execution); loadServiceInformation(serviceTopologyOperationInputEntity, execution); loadServiceRequestInputEntity(serviceTopologyOperationInputEntity, execution); - rpcServiceTopologyOperationInputEntity.setServiceTopologyOperationInputEntity(serviceTopologyOperationInputEntity); + rpcServiceTopologyOperationInputEntity + .setServiceTopologyOperationInputEntity(serviceTopologyOperationInputEntity); return rpcServiceTopologyOperationInputEntity; } - private void loadServiceRequestInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, DelegateExecution execution) { + private void loadServiceRequestInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity, + DelegateExecution execution) { ServiceRequestInputEntity serviceRequestInputEntity = getServiceRequestInputEntity(execution); serviceTopologyOperationInputEntity.setServiceRequestInput(serviceRequestInputEntity); } @@ -54,17 +59,20 @@ public class ServiceRpcInputEntityBuilder extends AbstractBuilder paramList; - + public List getParamList() { return paramList; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java index af448942cc..238a4f32c0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java @@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; import com.fasterxml.jackson.annotation.JsonProperty; public class RequestInformationEntity { - @JsonProperty("GENERIC-RESOURCE-API:request-id") + @JsonProperty("GENERIC-RESOURCE-API:request-id") private String requestId; @JsonProperty("GENERIC-RESOURCE-API:request-action") @@ -40,7 +40,7 @@ public class RequestInformationEntity { @JsonProperty("GENERIC-RESOURCE-API:order-version") private String orerVersion; - + public String getRequestId() { return requestId; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java index 4e58a61750..76494f5585 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java @@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; import com.fasterxml.jackson.annotation.JsonProperty; public class RpcNetworkTopologyOperationInputEntity { - @JsonProperty("GENERIC-RESOURCE-API:input") + @JsonProperty("GENERIC-RESOURCE-API:input") private NetworkTopologyOperationInputEntity input = null; - + public NetworkTopologyOperationInputEntity getInput() { return input; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java index 915a8a5e39..c93b3f2ad9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java @@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; import com.fasterxml.jackson.annotation.JsonProperty; public class RpcNetworkTopologyOperationOutputEntity { - @JsonProperty("GENERIC-RESOURCE-API:output") + @JsonProperty("GENERIC-RESOURCE-API:output") private NetworkTopologyOperationOutputEntity output; - + public NetworkTopologyOperationOutputEntity getOutput() { return output; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java index 145759e190..dbca00ae24 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java @@ -23,14 +23,15 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; import com.fasterxml.jackson.annotation.JsonProperty; public class RpcServiceTopologyOperationInputEntity { - @JsonProperty("GENERIC-RESOURCE-API:input") + @JsonProperty("GENERIC-RESOURCE-API:input") private ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity; - + public ServiceTopologyOperationInputEntity getServiceTopologyOperationInputEntity() { return serviceTopologyOperationInputEntity; } - public void setServiceTopologyOperationInputEntity(ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity) { + public void setServiceTopologyOperationInputEntity( + ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity) { this.serviceTopologyOperationInputEntity = serviceTopologyOperationInputEntity; } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java index c1ba7dc614..5c199bd413 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java @@ -21,13 +21,12 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.List; public class ServiceInputParametersEntity { - @JsonProperty("GENERIC-RESOURCE-API:param") + @JsonProperty("GENERIC-RESOURCE-API:param") private List paramList; - + public List getParamList() { return paramList; } -- cgit 1.2.3-korg