diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
20 files changed, 101 insertions, 107 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index 9e9c4b5cfa..d966528f6c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.appc.payload; import java.util.Optional; -import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersHealthCheck; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersQuiesce; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersResumeTraffic; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersDistributeTraffic; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java index 3791c5d461..21132aa665 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java @@ -20,15 +20,13 @@ package org.onap.so.bpmn.common; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIQueryClient; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIQueryClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.so.client.cds.CDSProcessingClient; import org.onap.so.client.cds.CDSProcessingListener; import org.onap.so.client.policy.PolicyClientImpl; -import org.onap.so.client.sdno.SDNOValidator; -import org.onap.so.client.sdno.SDNOValidatorImpl; import org.springframework.stereotype.Component; /* @@ -51,10 +49,6 @@ public class InjectionHelper { return new AAIQueryClient(); } - public SDNOValidator getSdnoValidator() { - return new SDNOValidatorImpl(); - } - public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() { return new AAICommonObjectMapperProvider(); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java index 3fc0808741..55a9f348c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java @@ -20,10 +20,8 @@ package org.onap.so.bpmn.servicedecomposition; -import com.fasterxml.jackson.databind.ObjectMapper; import javax.persistence.Id; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public interface ShallowCopy<T> { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java index 1105572e3a..e241696573 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; -import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java index 93d85daad1..fcc21f1df2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java @@ -23,10 +23,8 @@ package org.onap.so.bpmn.servicedecomposition.generalobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonRootName("license") public class License implements Serializable { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java index a98cdc712d..8f4a39a119 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.generalobjects; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; -import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("orchestration-context") public class OrchestrationContext implements Serializable { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java index 643113573e..c9b8613be1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.homingobjects; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; -import org.onap.so.bpmn.servicedecomposition.ShallowCopy; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @JsonRootName("solution") diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java index bb493f5aa9..4466a2c741 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonProperty; public class ModelInfoVolumeGroup extends ModelInfoVfModule implements Serializable { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index f0954c3695..0fd38badad 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -52,12 +52,12 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; @@ -77,7 +77,6 @@ import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; -import org.onap.so.serviceinstancebeans.Pnfs; import org.onap.so.serviceinstancebeans.RelatedInstance; import org.onap.so.serviceinstancebeans.RelatedInstanceList; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -108,6 +107,7 @@ public class BBInputSetup implements JavaDelegate { private static final String NETWORK_COLLECTION = "NetworkCollection"; private static final String PREPROV = "PREPROV"; private static final String CREATEVOLUME = "CreateVolume"; + private static final String CONTROLLER = "Controller"; @Autowired private BBInputSetupUtils bbInputSetupUtils; @@ -631,18 +631,22 @@ public class BBInputSetup implements JavaDelegate { break; } } + VfModuleCustomization vfResourceCustomization = null; if (vnfResourceCustomization != null) { - VfModuleCustomization vfResourceCustomization = vnfResourceCustomization.getVfModuleCustomizations() - .stream() // Convert to steam + vfResourceCustomization = vnfResourceCustomization.getVfModuleCustomizations().stream() // Convert to steam .filter(x -> modelInfo.getModelCustomizationId().equalsIgnoreCase(x.getModelCustomizationUUID()))// find // what // we // want .findAny() // If 'findAny' then return found .orElse(null); - if (vfResourceCustomization != null) { - vfModule.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); - } + } + if (vfResourceCustomization == null) { + vfResourceCustomization = bbInputSetupUtils + .getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId()); + } + if (vfResourceCustomization != null) { + vfModule.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); } } @@ -1383,7 +1387,8 @@ public class BBInputSetup implements JavaDelegate { cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); } gBB.setCloudRegion(cloudRegion); - if (bbName.contains(VNF)) { + if (bbName.contains(VNF) || (bbName.contains(CONTROLLER) + && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { for (GenericVnf genericVnf : serviceInstance.getVnfs()) { if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { @@ -1395,7 +1400,8 @@ public class BBInputSetup implements JavaDelegate { this.mapCatalogVnf(genericVnf, modelInfo, service); } } - } else if (bbName.contains(VF_MODULE)) { + } else if (bbName.contains(VF_MODULE) || (bbName.contains(CONTROLLER) + && (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { for (GenericVnf vnf : serviceInstance.getVnfs()) { for (VfModule vfModule : vnf.getVfModules()) { if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null @@ -1499,7 +1505,8 @@ public class BBInputSetup implements JavaDelegate { BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(executeBB.getRequestId()).setService(service) .setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).build(); - if (bbName.contains(VNF)) { + if (bbName.contains(VNF) || (bbName.contains(CONTROLLER) + && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { vnfs = findVnfsByKey(key, resources, vnfs); String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); // This stores the vnf id in request db to be retrieved later when @@ -1527,7 +1534,8 @@ public class BBInputSetup implements JavaDelegate { resources.getPnfs().stream() .filter(pnfs -> Objects.equals(key, pnfs.getModelInfo().getModelCustomizationId())).findFirst() .ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance)); - } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { + } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP) || (bbName.contains(CONTROLLER) + && (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); if (vnfsAndVfModules != null) { vfModules = vnfsAndVfModules.getValue1(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java index 68161a8dd5..4379864bfe 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.serviceinstancebeans.Pnfs; @@ -37,10 +36,6 @@ final class BBInputSetupPnf { Pnf pnf = new Pnf(); pnf.setPnfId(pnfId); pnf.setPnfName(pnfs.getInstanceName()); - pnf.setModelInfoPnf(new ModelInfoPnf()); - pnf.getModelInfoPnf().setModelCustomizationUuid(pnfs.getModelInfo().getModelCustomizationId()); - pnf.getModelInfoPnf().setModelInvariantUuid(pnfs.getModelInfo().getModelInvariantId()); - pnf.getModelInfoPnf().setModelUuid(pnfs.getModelInfo().getModelVersionId()); pnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); serviceInstance.getPnfs().add(pnf); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 85f5f1f728..4e0b5634ea 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -48,14 +48,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; -import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java index e4012e1290..c7e3234a56 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java @@ -28,10 +28,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java index c05557a317..c6a921abb5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -20,8 +20,9 @@ package org.onap.so.client.appc; -import java.util.HashMap; +import java.io.IOException; import java.util.List; +import java.util.Map; import java.util.Optional; import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.Status; @@ -40,10 +41,11 @@ public class ApplicationControllerAction { protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); private String errorCode = "1002"; private String errorMessage = "Unable to reach App C Servers"; + private static final String PAYLOAD_NOT_PRESENT_ERROR_MSG = "Payload is not present for "; private static Logger logger = LoggerFactory.getLogger(ApplicationControllerAction.class); public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional<String> payload, - HashMap<String, String> payloadInfo, String controllerType) { + Map<String, String> payloadInfo, String controllerType) { Status appCStatus = null; try { String vnfName = payloadInfo.getOrDefault("vnfName", ""); @@ -96,20 +98,8 @@ public class ApplicationControllerAction { logger.warn("vserverIds null in AppCClient"); break; } - String vmId = ""; - String vserverId = ""; - ObjectMapper mapper = new ObjectMapper(); - List<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>() {}); - List<String> vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference<List<String>>() {}); - int i = 0; - while (i < vmIdJsonList.size()) { - vmId = vmIdJsonList.get(i); - vserverId = vserverIdJsonList.get(i); - Optional<String> vserverIdString = Optional.of(vserverId); - appCStatus = - snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType); - i++; - } + appCStatus = getSnapshotActionAppcStatus(msoRequestId, vnfId, controllerType, identityUrl, vmIds, + vserverIds); break; case ConfigModify: case ConfigScaleOut: @@ -140,29 +130,44 @@ public class ApplicationControllerAction { logger.error("Error building Appc request: {}", e.getMessage(), e); errorCode = "1002"; errorMessage = e.getMessage(); - } catch (NoSuchMethodError e) { - logger.error("Error building Appc request: {}", e.getMessage(), e); - errorMessage = e.getMessage(); } catch (Exception e) { logger.error("Error building Appc request: {}", e.getMessage(), e); errorMessage = e.getMessage(); } } + private Status getSnapshotActionAppcStatus(String msoRequestId, String vnfId, String controllerType, + String identityUrl, String vmIds, String vserverIds) + throws IOException, ApplicationControllerOrchestratorException { + Status appcStatus = null; + String vmId = ""; + String vserverId = ""; + ObjectMapper mapper = new ObjectMapper(); + List<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>() {}); + List<String> vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference<List<String>>() {}); + int i = 0; + while (i < vmIdJsonList.size()) { + vmId = vmIdJsonList.get(i); + vserverId = vserverIdJsonList.get(i); + Optional<String> vserverIdString = Optional.of(vserverId); + appcStatus = snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType); + i++; + } + return appcStatus; + } + private Status payloadAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, - String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + String controllerType) throws ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { - throw new IllegalArgumentException("Payload is not present for " + action.toString()); + throw new IllegalArgumentException(PAYLOAD_NOT_PRESENT_ERROR_MSG + action.toString()); } return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, - String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { - throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString()); + throw new IllegalArgumentException(PAYLOAD_NOT_PRESENT_ERROR_MSG + Action.QuiesceTraffic.toString()); } payload = PayloadClient.quiesceTrafficFormat(payload, vnfName); return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); @@ -170,19 +175,18 @@ public class ApplicationControllerAction { private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + throws JsonProcessingException, ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { - throw new IllegalArgumentException("Payload is not present for " + action.toString()); + throw new IllegalArgumentException(PAYLOAD_NOT_PRESENT_ERROR_MSG + action.toString()); } payload = PayloadClient.upgradeFormat(payload, vnfName); return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } private Status distributeTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, - String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { - throw new IllegalArgumentException("Payload is not present for " + Action.DistributeTraffic.toString()); + throw new IllegalArgumentException(PAYLOAD_NOT_PRESENT_ERROR_MSG + Action.DistributeTraffic.toString()); } payload = PayloadClient.distributeTrafficFormat(payload, vnfName); return client.vnfCommand(Action.DistributeTraffic, msoRequestId, vnfId, Optional.empty(), payload, @@ -191,10 +195,10 @@ public class ApplicationControllerAction { private Status distributeTrafficCheckAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + throws JsonProcessingException, ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { throw new IllegalArgumentException( - "Payload is not present for " + Action.DistributeTrafficCheck.toString()); + PAYLOAD_NOT_PRESENT_ERROR_MSG + Action.DistributeTrafficCheck.toString()); } payload = PayloadClient.distributeTrafficCheckFormat(payload, vnfName); return client.vnfCommand(Action.DistributeTrafficCheck, msoRequestId, vnfId, Optional.empty(), payload, diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java index 165d9577af..b39ba5f63f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java @@ -22,7 +22,6 @@ package org.onap.so.client.appc; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Service; @Configuration public class ApplicationControllerConfiguration { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java index 10d3d85ffc..144cb257a6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java @@ -26,7 +26,6 @@ import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import org.springframework.stereotype.Component; import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; import org.onap.appc.client.lcm.api.ResponseHandler; import org.onap.appc.client.lcm.model.Status; @@ -36,7 +35,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; -import org.springframework.stereotype.Service; public class ApplicationControllerSupport { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java index 808d427d65..2812de799d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (C) 2020 Nordix * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -36,7 +38,7 @@ public final class PayloadConstants { public static final String SEPARATOR = "-"; public static final String PNF_SCOPE = "pnf"; public static final String VNF_SCOPE = "vnf"; - public static final String VF_MODULE_SCOPE = "vfModule"; + public static final String VF_MODULE_SCOPE = "vfmodule"; public static final String SERVICE_SCOPE = "service"; public static final String RESOLUTION_KEY = "resolution-key"; public static final String CDS_ACTOR = "cds"; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java index bba8925f21..c2874fe23d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2019 Bell Canada * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,7 +33,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.PayloadGenerationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import java.util.List; @@ -81,8 +82,8 @@ public class VfModuleCDSRequestProvider implements CDSRequestProvider { final String modelCustomizationUuidForVnf = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid(); - blueprintName = genericVnf.getBlueprintName(); - blueprintVersion = genericVnf.getBlueprintVersion(); + blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName(); + blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion(); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); vfModuleName = vfModule.getVfModuleName(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java index d33976d229..7425d09721 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2019 Bell Canada * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -79,8 +81,8 @@ public class VnfCDSRequestProvider implements CDSRequestProvider { final String modelCustomizationUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid(); resolutionKey = genericVnf.getVnfName(); - blueprintName = genericVnf.getBlueprintName(); - blueprintVersion = genericVnf.getBlueprintVersion(); + blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName(); + blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion(); vnfObject.addProperty("service-instance-id", serviceInstance.getServiceInstanceId()); vnfObject.addProperty("service-model-uuid", serviceInstance.getModelInfoServiceInstance().getModelUuid()); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 30fd2c8770..948c9326d8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -38,8 +38,8 @@ import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; @@ -80,7 +80,7 @@ public class ExceptionBuilder { } logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { // log trace, allow process to complete gracefully @@ -113,7 +113,7 @@ public class ExceptionBuilder { } logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { // log trace, allow process to complete gracefully @@ -144,7 +144,7 @@ public class ExceptionBuilder { } } logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { // log trace, allow process to complete gracefully @@ -176,7 +176,7 @@ public class ExceptionBuilder { } } logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { // log trace, allow process to complete gracefully @@ -260,7 +260,7 @@ public class ExceptionBuilder { public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) { logger.debug("Processing Audit Results"); - String auditListString = (String) execution.getVariable("auditInventoryResult"); + String auditListString = execution.getVariable("auditInventoryResult"); String processKey = getProcessKey(execution.getDelegateExecution()); if (auditListString != null) { StringBuilder errorMessage = new StringBuilder(); @@ -304,6 +304,7 @@ public class ExceptionBuilder { } catch (IOException | BBObjectNotFoundException e) { errorMessage = errorMessage.append("process objects in AAI. "); + logger.error("Exception occurred in processAuditException", e); } if (flowShouldContinue) { @@ -329,7 +330,7 @@ public class ExceptionBuilder { } } - public void processVnfAdapterException(DelegateExecution execution) { + public void processOpenstackAdapterException(DelegateExecution execution) { StringBuilder workflowExceptionMessage = new StringBuilder(); logger.debug("Processing Vnf Adapter Exception"); try { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java index c88e9ae34f..692d581b0d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java @@ -23,8 +23,8 @@ package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.springframework.stereotype.Component; @Component @@ -33,11 +33,10 @@ public class AAIPropertiesImpl implements AAIProperties { public static final String MSO_MSO_KEY = "mso.msoKey"; public static final String AAI_AUTH = "aai.auth"; public static final String AAI_ENDPOINT = "aai.endpoint"; - private UrnPropertiesReader reader; @Override public URL getEndpoint() throws MalformedURLException { - return new URL(reader.getVariable(AAI_ENDPOINT)); + return new URL(UrnPropertiesReader.getVariable(AAI_ENDPOINT)); } @Override @@ -52,11 +51,11 @@ public class AAIPropertiesImpl implements AAIProperties { @Override public String getAuth() { - return reader.getVariable(AAI_AUTH); + return UrnPropertiesReader.getVariable(AAI_AUTH); } @Override public String getKey() { - return reader.getVariable(MSO_MSO_KEY); + return UrnPropertiesReader.getVariable(MSO_MSO_KEY); } } |