diff options
Diffstat (limited to 'bpmn')
5 files changed, 38 insertions, 31 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml index 1ad95b3ab9..e08cf0f578 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -5,6 +5,7 @@ server: mso: infra: auditInventory: false + camundaAuth: AE2E9BE6EF9249085AF98689C4EE087736A5500629A72F35068FFB88813A023581DD6E765071F1C04075B36EA4213A spring: datasource: hikari: @@ -42,3 +43,9 @@ management: prometheus: enabled: true # Whether exporting of metrics to Prometheus is enabled. step: 1m # Step size (i.e. reporting frequency) to use. +org: + onap: + so: + adapters: + network: + encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7 diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy index f5e90000b3..d22ee5e82f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy @@ -77,7 +77,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { checkAndSetRequestParam(siRequest,"globalSubscriberId",false, execution) checkAndSetRequestParam(siRequest,"serviceType",false, execution) checkAndSetRequestParam(siRequest,"operationId",false, execution) - + checkAndSetRequestParam(siRequest,"scriptName",false, execution) //prepare init operation status execution.setVariable("progress", "0") execution.setVariable("result", "processing") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy index 4be6ca7e49..547cb6cad7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy @@ -139,12 +139,14 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor String profileId = currentNSSI['profileId'] String nssiId = currentNSSI['nssiServiceInstanceId'] String nsiId = currentNSSI['nsiServiceInstanceId'] + String scriptName = execution.getVariable("scriptName") DeAllocateNssi deAllocateNssi = new DeAllocateNssi() deAllocateNssi.setNsiId(nsiId) deAllocateNssi.setNssiId(nssiId) deAllocateNssi.setTerminateNssiOption(0) deAllocateNssi.setSnssaiList(Arrays.asList(snssai)) + deAllocateNssi.setScriptName(scriptName) NssiDeAllocateRequest deAllocateRequest = new NssiDeAllocateRequest() deAllocateRequest.setDeAllocateNssi(deAllocateNssi) diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn index 3024e39c4e..8dd326aa16 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0prw6yo" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0prw6yo" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> <bpmn:process id="DeleteSliceService" name="DeleteSliceService" isExecutable="true"> <bpmn:startEvent id="StartEvent_1" name="start"> <bpmn:outgoing>SequenceFlow_1ti9sxe</bpmn:outgoing> @@ -102,6 +102,7 @@ dss.deleteSliceServiceInstance(execution)</bpmn:script> <camunda:in source="operationId" target="operationId" /> <camunda:in source="operationType" target="operationType" /> <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="scriptName" target="scriptName" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_16lh6o6</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0nl4kfh</bpmn:outgoing> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java index ce0f2c7417..6831a656a8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java @@ -24,7 +24,6 @@ import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.EXT_V import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH; import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL; import java.io.IOException; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; @@ -32,14 +31,14 @@ import java.util.stream.Collectors; import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.ExternalVirtualLink; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.jsonpath.JsonPathUtil; import org.onap.so.client.sdnc.SDNCClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; -import net.minidev.json.JSONArray; /** * This class retrieve pre-load data from SDNC using <br/> @@ -56,9 +55,12 @@ public class SdncInputParametersProvider extends AbstractInputParametersProvider private final SDNCClient sdncClient; + private final ObjectMapper mapper; + @Autowired public SdncInputParametersProvider(final SDNCClient sdncClient) { this.sdncClient = sdncClient; + this.mapper = new ObjectMapper(); } @Override @@ -70,21 +72,23 @@ public class SdncInputParametersProvider extends AbstractInputParametersProvider try { LOGGER.debug("Will query sdnc for input parameters using url: {}", url); final String jsonResponse = sdncClient.get(url); - - final JSONArray vnfParametersArray = JsonPath.read(jsonResponse, VNF_PARAMETERS_PATH); - if (vnfParametersArray != null) { - for (int index = 0; index < vnfParametersArray.size(); index++) { - final Object vnfParametersObject = vnfParametersArray.get(index); - if (vnfParametersObject instanceof JSONArray) { - final JSONArray vnfParameters = (JSONArray) vnfParametersObject; - final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParameters); - final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap); - final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap); - final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks); - LOGGER.info("InputParameter found in sdnc response : {}", inputParameter); - return inputParameter; - } + final String json = JsonPathUtil.getInstance().locateResult(jsonResponse, VNF_PARAMETERS_PATH).orElse(null); + + try { + + if (json != null) { + final List<VnfParameter> vnfParametersArray = + mapper.readValue(json, new TypeReference<List<VnfParameter>>() {}); + final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParametersArray); + final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap); + final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap); + final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks); + LOGGER.info("InputParameter found in sdnc response : {}", inputParameter); + return inputParameter; } + + } catch (final IOException exception) { + LOGGER.error("Unable to parse vnf parameters : {}", json, exception); } } catch (final Exception exception) { LOGGER.error("Unable to retrieve/parse input parameters using URL: {} ", url, exception); @@ -112,19 +116,12 @@ public class SdncInputParametersProvider extends AbstractInputParametersProvider } - private Map<String, String> getVnfParameterMap(final JSONArray array) { - try { - if (array != null) { - final ObjectMapper mapper = new ObjectMapper(); - final VnfParameter[] readValue = mapper.readValue(array.toJSONString(), VnfParameter[].class); - LOGGER.debug("Vnf parameters: {}", Arrays.asList(readValue)); - return Arrays.asList(readValue).stream() - .filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null) - .collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue)); - } - } catch (final IOException exception) { - LOGGER.error("Unable to parse vnf parameters : {}", array, exception); + private Map<String, String> getVnfParameterMap(final List<VnfParameter> array) { + if (array != null) { + return array.stream().filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null) + .collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue)); } + return Collections.emptyMap(); } |