aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy35
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java76
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json3
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java11
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy29
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy24
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy83
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy83
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy240
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn3
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn32
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn263
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java77
27 files changed, 812 insertions, 325 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 44188b462b..30cbeaf2d8 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.beans.nsmf.oof.NsiReqBody
+import org.onap.so.beans.nsmf.oof.NssiReqBody
import org.onap.so.beans.nsmf.oof.RequestInfo
import org.onap.so.beans.nsmf.oof.SubnetCapability
import org.onap.so.beans.nsmf.oof.TemplateInfo
@@ -658,9 +659,10 @@ return json.toString()
public String buildSelectNSIRequest(String requestId, TemplateInfo nstInfo, List<TemplateInfo> nsstInfo,
String messageType, Map<String, Object> serviceProfile,
- List<SubnetCapability> subnetCapabilities, Integer timeOut){
+ List<SubnetCapability> subnetCapabilities, Integer timeOut, boolean preferReuse){
def transactionId = requestId
+ String correlator = requestId
logger.debug( "transactionId is: " + transactionId)
String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
@@ -680,10 +682,39 @@ return json.toString()
nsiReqBody.setServiceProfile(serviceProfile)
nsiReqBody.setSubnetCapabilities(subnetCapabilities)
nsiReqBody.setNSSTInfo(nsstInfo)
-
+ nsiReqBody.setPreferReuse(preferReuse)
ObjectMapper objectMapper = new ObjectMapper()
return objectMapper.writeValueAsString(nsiReqBody)
}
+
+ public <T> String buildSelectNSSIRequest(String requestId, TemplateInfo nsstInfo, String messageType,
+ T sliceProfile, Integer timeOut){
+
+ def transactionId = requestId
+ String correlator = requestId
+ logger.debug( "transactionId is: " + transactionId)
+
+ String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
+
+ NssiReqBody nssiReqBody = new NssiReqBody()
+
+ RequestInfo requestInfo = new RequestInfo()
+ requestInfo.setRequestId(requestId)
+ requestInfo.setTransactionId(transactionId)
+ requestInfo.setCallbackUrl(callbackUrl)
+ requestInfo.setSourceId("so")
+ requestInfo.setTimeout(timeOut)
+ //requestInfo.setNumSolutions()
+
+ nssiReqBody.setRequestInfo(requestInfo)
+ nssiReqBody.setSliceProfile(sliceProfile)
+ nssiReqBody.setNSSTInfo(nsstInfo)
+
+
+ ObjectMapper objectMapper = new ObjectMapper()
+
+ return objectMapper.writeValueAsString(nssiReqBody)
+ }
}
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 9205cae5ed..afd7f6433c 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
@@ -87,7 +87,6 @@ import com.fasterxml.jackson.databind.type.TypeFactory;
public class BBInputSetupUtils {
private static final Logger logger = LoggerFactory.getLogger(BBInputSetupUtils.class);
- private ObjectMapper objectMapper = new ObjectMapper();
private static final String REQUEST_ERROR = "Could not find request.";
private static final String DATA_LOAD_ERROR = "Could not process loading data from database";
private static final String DATA_PARSE_ERROR = "Could not parse data";
@@ -190,7 +189,8 @@ public class BBInputSetupUtils {
request.getOriginalRequestId(), PROCESSING_DATA_NAME_EXECUTION_FLOWS);
try {
ObjectMapper om = new ObjectMapper();
- TypeFactory typeFactory = objectMapper.getTypeFactory();
+ TypeFactory typeFactory = om.getTypeFactory();
+ om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return om.readValue(requestProcessingData.getValue(),
typeFactory.constructCollectionType(List.class, ExecuteBuildingBlock.class));
} catch (Exception e) {
@@ -246,6 +246,8 @@ public class BBInputSetupUtils {
if (requestId != null && !requestId.isEmpty()) {
InfraActiveRequests activeRequest = this.getInfraActiveRequest(requestId);
String requestBody = activeRequest.getRequestBody().replaceAll("\\\\", "");
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
return objectMapper.readValue(requestBody, RequestDetails.class);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
index 51b1a218c8..55d76819fc 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
@@ -101,6 +101,7 @@ public class AbstractCDSProcessingBBUtils {
ExecutionServiceInput executionServiceInput = prepareExecutionServiceInput(executionObject);
execution.setVariable(EXEC_INPUT, executionServiceInput);
+ logger.debug("Input payload: " + executionServiceInput.getPayload());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java
new file mode 100644
index 0000000000..0d79dbb375
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForPnf.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Pnfs;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+@Component
+public class ConfigureInstanceParamsForPnf {
+
+ private ExtractServiceFromUserParameters extractServiceFromUserParameters;
+
+ @Autowired
+ public ConfigureInstanceParamsForPnf(ExtractServiceFromUserParameters extractServiceFromUserParameters) {
+ this.extractServiceFromUserParameters = extractServiceFromUserParameters;
+ }
+
+ /**
+ * Read instance parameters for PNF and put into JsonObject.
+ *
+ * @param jsonObject - JsonObject which will hold the payload to send to CDS.
+ * @param userParamsFromRequest - User parameters.
+ * @param modelCustomizationUuid - Unique ID for Pnf.
+ * @throws PayloadGenerationException if it doesn't able to populate instance parameters from SO payload.
+ */
+ public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
+ String modelCustomizationUuid) throws PayloadGenerationException {
+ try {
+ Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
+ List<Map<String, String>> instanceParamsList = getInstanceParamForPnf(service, modelCustomizationUuid);
+
+ instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
+ .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ } catch (Exception exception) {
+ throw new PayloadGenerationException("Couldn't able to resolve instance parameters", exception);
+ }
+ }
+
+ private List<Map<String, String>> getInstanceParamForPnf(Service service, String genericPnfModelCustomizationUuid)
+ throws PayloadGenerationException {
+ Optional<Pnfs> foundedPnfs = service.getResources().getPnfs().stream()
+ .filter(pnfs -> pnfs.getModelInfo().getModelCustomizationId().equals(genericPnfModelCustomizationUuid))
+ .findFirst();
+ if (foundedPnfs.isPresent()) {
+ return foundedPnfs.get().getInstanceParams();
+ } else {
+ throw new PayloadGenerationException(String.format(
+ "Can not find pnf for genericPnfModelCustomizationUuid: %s", genericPnfModelCustomizationUuid));
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
index c65b36a40c..85774ec23c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
@@ -42,6 +42,7 @@ import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
+import com.fasterxml.jackson.databind.DeserializationFeature;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -115,6 +116,7 @@ public class BBInputSetupUtilsTest {
@Before
public void setup() {
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json
index fa271b9e8d..7bbc287bad 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json
@@ -58,7 +58,8 @@
"vnfResourceCustomizationUUID": "a80f05b8-d651-44af-b999-8ed78fb4582f",
"cvnfcCustomizationUUID": "69cce457-9ffd-4359-962b-0596a1e83ad1",
"vnfcName": "zauk51bmcmr01mcm001"
- }
+ },
+ "resume": null
},
{
"buildingBlock": {
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
index 70c78472ba..daf942605b 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
@@ -55,6 +55,8 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
private String serviceType;
@JsonProperty("serviceRole")
private String serviceRole;
+ @JsonProperty("serviceCategory")
+ private String serviceCategory;
private ServiceInstance serviceInstance;
private Request request;
private String callbackURN;
@@ -259,8 +261,17 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
this.serviceProxy = serviceProxy;
}
+
// *****
+ public String getServiceCategory() {
+ return serviceCategory;
+ }
+
+ public void setServiceCategory(String serviceCategory) {
+ this.serviceCategory = serviceCategory;
+ }
+
// *****
// Access methods
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn
index 6cd2c20ab9..1dc371e054 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
- <bpmn:process id="Process_1" isExecutable="true">
+ <bpmn:process id="CnfAdapterBB" name="CnfAdapterBB" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>SequenceFlow_0xb4elc</bpmn:outgoing>
</bpmn:startEvent>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
index e253855ab3..67845910eb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
@@ -20,7 +20,7 @@
package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.isBlank
+import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONObject
@@ -44,7 +44,8 @@ import org.onap.so.db.request.beans.OperationStatus
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
-import groovy.json.JsonSlurper
+
+import static org.apache.commons.lang3.StringUtils.isBlank
/**
* This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process.
@@ -349,7 +350,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
/**
* get E2EST id through CST id and change communication profile to E2E service profile
* 1. get E2EST id from cst
- * 1.1 ęŸ„source service id
+ * 1.1 source service id
* 1.2 source service
* 1.3 source service input, init e2e profile
*/
@@ -383,9 +384,29 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
}
}
- //TODO
+ //TODO temp solution
e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id"))
e2eInputMap.put("sST", execution.getVariable("csServiceType"))
+
+ Integer activityFactor = 60
+ Integer random = new Random().nextInt(5) + 2
+ Integer dLThptPerUE = Integer.parseInt(csInputMap.get("expDataRateDL").toString())
+ Integer uLThptPerUE = Integer.parseInt(csInputMap.get("expDataRateUL").toString())
+ Integer maxNumberofUEs = Integer.parseInt(csInputMap.get("maxNumberofUEs").toString())
+ Integer dLThptPerSlice = dLThptPerUE * maxNumberofUEs * activityFactor * random
+ Integer uLThptPerSlice = uLThptPerUE * maxNumberofUEs * activityFactor * random
+ Integer maxNumberofConns = maxNumberofUEs * activityFactor * 3
+
+ e2eInputMap.put("jitter", 10)
+ e2eInputMap.put("activityFactor", activityFactor)
+ e2eInputMap.put("maxNumberofUEs", maxNumberofUEs)
+ e2eInputMap.put("dLThptPerUE", dLThptPerUE)
+ e2eInputMap.put("uLThptPerUE", uLThptPerUE)
+ e2eInputMap.put("dLThptPerSlice", dLThptPerSlice)
+ e2eInputMap.put("uLThptPerSlice", uLThptPerSlice)
+ e2eInputMap.put("maxNumberofConns", maxNumberofConns)
+ e2eInputMap.put("coverageAreaTAList", csInputMap.get("coverageAreaList"))
+
execution.setVariable("e2eInputMap", e2eInputMap)
execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType())
execution.setVariable("e2eModelInvariantUuid", e2eServiceDecomposition.getModelInfo().getModelInvariantUuid())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
index 65398eb658..72fd052f31 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+
import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
@@ -52,11 +54,15 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
String Prefix = "CRESS_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
+
JsonUtils jsonUtil = new JsonUtils()
+
JsonSlurper jsonSlurper = new JsonSlurper()
+
ObjectMapper objectMapper = new ObjectMapper()
+
OofUtils oofUtils = new OofUtils()
- NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
+
AAIResourcesClient client = getAAIClient()
private static final Logger logger = LoggerFactory.getLogger(CreateSliceService.class)
@@ -161,8 +167,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInputParams", inputMap)
execution.setVariable("uuiRequest", uuiRequest)
- execution.setVariable("se" +
- "rviceProfile", serviceProfile)
+ execution.setVariable("serviceProfile", serviceProfile)
//TODO
//execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))
@@ -267,10 +272,8 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
execution.setVariable("sliceTaskParams", sliceTaskParams)
- //todo:----------------------------------------
-// String paramJson = sliceTaskParams.convertToJson()
-// execution.setVariable("CSSOT_paramJson", paramJson)
- /*-------------------------------------------*/
+ String paramJson = sliceTaskParams.convertToJson()
+ execution.setVariable("CSSOT_paramJson", paramJson)
logger.debug("Finish createOrchestrationTask")
}
@@ -360,7 +363,8 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
logger.debug("Start prepareUpdateOrchestrationTask")
String requestMethod = "PUT"
String taskStatus = execution.getVariable("taskStatus")
- SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ SliceTaskParamsAdapter sliceTaskParams =
+ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
String paramJson = sliceTaskParams.convertToJson()
execution.setVariable("CSSOT_status", taskStatus)
execution.setVariable("CSSOT_paramJson", paramJson)
@@ -390,7 +394,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
OrchestrationTask orchestrationTask = objectMapper.readValue(response, OrchestrationTask.class)
String paramJson = orchestrationTask.getParams()
logger.debug("paramJson: " + paramJson)
- SliceTaskParams sliceTaskParams = new SliceTaskParams()
+ SliceTaskParamsAdapter sliceTaskParams = new SliceTaskParamsAdapter()
sliceTaskParams.convertFromJson(paramJson)
execution.setVariable("sliceTaskParams", sliceTaskParams)
logger.debug("Finish processUserOptions")
@@ -404,7 +408,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
try {
ServiceInstance si = new ServiceInstance()
si.setOrchestrationStatus(orchStatus)
- AAIResourcesClient client = new AAIResourcesClient()
+
AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
client.update(uri, si)
} catch (BpmnError e) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
index c497fc4517..d0c189cb04 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
@@ -20,7 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
-import static org.apache.commons.lang3.StringUtils.isBlank
+import org.onap.so.beans.nsmf.oof.SubnetType
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import javax.ws.rs.NotFoundException
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
@@ -49,8 +50,9 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import static org.apache.commons.lang3.StringUtils.isBlank
-class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{
+class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
private static final Logger logger = LoggerFactory.getLogger(DoAllocateNSIandNSSI.class);
@@ -338,6 +340,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
execution.setVariable("AnAllocateNssiNbiRequest", nbiRequest)
execution.setVariable("anBHSliceTaskInfo", sliceTaskInfo)
+ execution.setVariable("anSubnetType", SubnetType.AN_NF)
}
@@ -384,7 +387,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
}
/**
- * create An Slice Profile
+ * create Cn Slice Profile
* @param execution
*/
void createCnSliceProfile(DelegateExecution execution) {
@@ -426,7 +429,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
- allocateCnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID
+ allocateCnNssi.nssiId = sliceTaskInfo.suggestNssiId
allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile
allocateCnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId
@@ -446,6 +449,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
serviceInfo.nsiId = sliceParams.suggestNsiId
serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID
serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID
+ serviceInfo.nssiId = sliceTaskInfo.suggestNssiId //if shared
nbiRequest.setServiceInfo(serviceInfo)
nbiRequest.setEsrInfo(esrInfo)
@@ -453,6 +457,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
execution.setVariable("CnAllocateNssiNbiRequest", nbiRequest)
execution.setVariable("cnSliceTaskInfo", sliceTaskInfo)
+ execution.setVariable("cnSubnetType", SubnetType.CN)
}
@@ -501,7 +506,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
}
/**
- * create An Slice Profile
+ * create Tn Slice Profile
* @param execution
*/
void createTnBHSliceProfile(DelegateExecution execution) {
@@ -542,6 +547,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
//todo: AllocateTnNssi
+ //todo: endpointId -> set into tn
allocateTnNssi.setTransportSliceNetworks()
allocateTnNssi.setNetworkSliceInfos()
@@ -561,6 +567,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
serviceInfo.nsiId = sliceParams.suggestNsiId
serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID
serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID
+ serviceInfo.nssiId = sliceTaskInfo.suggestNssiId
nbiRequest.setServiceInfo(serviceInfo)
nbiRequest.setEsrInfo(esrInfo)
@@ -568,6 +575,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
execution.setVariable("TnBHAllocateNssiNbiRequest", nbiRequest)
execution.setVariable("tnBHSliceTaskInfo", sliceTaskInfo)
+ execution.setVariable("tnBHSubnetType", SubnetType.TN_BH)
}
/**
@@ -586,11 +594,13 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
ResponseDescriptor result = execution.getVariable("anNssiAllocateResult") as ResponseDescriptor
String nssiId = result.getNssiId()
- String endPointId = result.getEndPointId()
String nsiId = sliceParams.getSuggestNsiId()
String sliceProfileInstanceId = sliceParams.anSliceTaskInfo.sliceInstanceId
String serviceProfileInstanceId = sliceParams.serviceId
//nsi id
+ //todo: aai -> nssi -> relationship -> endpointId -> set into tn
+ String endPointId = getEndpointIdFromAAI(execution, nssiId)
+ execution.setVariable("endPointIdAn", endPointId)
updateRelationship(execution, nsiId, nssiId)
@@ -598,8 +608,8 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
updateRelationship(execution, sliceProfileInstanceId, nssiId)
- updateRelationship(execution, sliceProfileInstanceId, endPointId)
-
+ sliceParams.anSliceTaskInfo.suggestNssiId = nssiId
+ execution.setVariable("sliceTaskParams", sliceParams)
}
@@ -622,6 +632,9 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
String sliceProfileInstanceId = sliceParams.cnSliceTaskInfo.sliceInstanceId
String serviceProfileInstanceId = sliceParams.serviceId
//nsi id
+ //todo: aai -> nssi -> relationship -> endpointId -> set into tn
+ String endPointId = getEndpointIdFromAAI(execution, nssiId)
+ execution.setVariable("endPointIdCn", endPointId)
updateRelationship(execution, nsiId, nssiId)
@@ -629,7 +642,58 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
updateRelationship(execution,sliceProfileInstanceId, nssiId)
+ sliceParams.cnSliceTaskInfo.suggestNssiId = nssiId
+ execution.setVariable("sliceTaskParams", sliceParams)
+ }
+ /**
+ * get endpoint Id from AAI by nssi id
+ * @param execution
+ * @param nssiId
+ * @return
+ */
+ private String getEndpointIdFromAAI(DelegateExecution execution, String nssiId) {
+ logger.debug("Enter update relationship in DoAllocateNSIandNSSI()")
+ //todo: allottedResourceId
+
+ SliceTaskParamsAdapter sliceParams =
+ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+ //sliceParams.setServiceId(nsiServiceInstanceID)
+ AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId))
+
+ String endpointId = null
+
+ try {
+ AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class)
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ //todo: if exists
+ if (!si.ifPresent()) {
+ String msg = "NSSI in the option doesn't exist. " + nssiId
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ if (si.ifPresent()) {
+ ServiceInstance nssiInstance = si.get()
+ //todo: handle relationship and return endpointId
+ for (Relationship relationship : nssiInstance.relationshipList.getRelationship()) {
+ if (relationship.relationshipLabel){
+ endpointId = relationship //todo
+ }
+ }
+
+ return endpointId
+ }
+
+ }catch(BpmnError e) {
+ throw e
+ }catch (Exception ex){
+ String msg = "NSSI suggested in the option doesn't exist. " + nssiId
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("Exit update relationship in DoAllocateNSIandNSSI()")
}
/**
@@ -656,6 +720,9 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId)
updateRelationship(execution,sliceProfileInstanceId, nssiId)
+
+ sliceParams.tnBHSliceTaskInfo.suggestNssiId = nssiId
+ execution.setVariable("sliceTaskParams", sliceParams)
}
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
index 35f725738d..88014e7b54 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
@@ -1,6 +1,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import com.fasterxml.jackson.databind.ObjectMapper
+import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.beans.nsmf.EsrInfo
import org.onap.so.beans.nsmf.NssiResponse
@@ -8,24 +9,16 @@ import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
import org.onap.so.beans.nsmf.ResponseDescriptor
import org.onap.so.beans.nsmf.ServiceInfo
import org.onap.so.beans.nsmf.SliceTaskInfo
+import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
+import org.onap.so.beans.nsmf.oof.SubnetType
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
-import org.onap.so.bpmn.core.domain.ModelInfo
-import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.http.ResponseEntity
-import static org.apache.commons.lang3.StringUtils.isBlank
class DoAllocateNSSI extends AbstractServiceTaskProcessor {
@@ -49,13 +42,15 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest
- //SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo
+ execution.setVariable("currentCycle", 0)
boolean isNSIOptionAvailable = execution.getVariable("isNSIOptionAvailable") as Boolean
- if (isNSIOptionAvailable) {
- nbiRequest.serviceInfo.setActionType("modify")
- } else {
+ if (!isNSIOptionAvailable) {
nbiRequest.serviceInfo.setActionType("allocate")
+ } else if (StringUtils.isBlank(nbiRequest.serviceInfo.nssiId)){
+ nbiRequest.serviceInfo.setActionType("allocate")
+ } else {
+ nbiRequest.serviceInfo.setActionType("modify")
}
execution.setVariable("nbiRequest", nbiRequest)
logger.trace("Exit preProcessRequest")
@@ -111,11 +106,67 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
}
void prepareUpdateOrchestrationTask(DelegateExecution execution) {
- //todoļ¼›update orchestration task
+ logger.debug("Start prepareUpdateOrchestrationTask progress")
+ String requestMethod = "PUT"
+
+ SliceTaskParamsAdapter sliceParams =
+ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+ ResponseDescriptor response = execution.getVariable("nssiAllocateResult") as ResponseDescriptor
+ SubnetType subnetType = execution.getVariable("subnetType") as SubnetType
+
+
+ SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo
+ sliceTaskInfo.progress = response.getProgress()
+ sliceTaskInfo.status = response.getStatus()
+ sliceTaskInfo.statusDescription = response.getStatusDescription()
+ updateNssiResult(sliceParams, subnetType, sliceTaskInfo)
+
+ String paramJson = sliceParams.convertToJson()
+ execution.setVariable("CSSOT_paramJson", paramJson)
+ execution.setVariable("CSSOT_requestMethod", requestMethod)
+
+ execution.setVariable("sliceTaskParams", sliceParams)
+ execution.setVariable("sliceTaskInfo", sliceTaskInfo)
+ logger.debug("Finish prepareUpdateOrchestrationTask progress")
+ }
+
+ private void updateNssiResult(SliceTaskParamsAdapter sliceTaskParams, SubnetType subnetType,
+ SliceTaskInfo sliceTaskInfo) {
+ switch (subnetType) {
+ case SubnetType.CN:
+ sliceTaskParams.cnSliceTaskInfo = sliceTaskInfo
+ break
+ case SubnetType.AN_NF:
+ sliceTaskParams.anSliceTaskInfo = sliceTaskInfo
+ break
+ case SubnetType.TN_BH:
+ sliceTaskParams.tnBHSliceTaskInfo = sliceTaskInfo
+ break
+ case SubnetType.TN_FH:
+ sliceTaskParams.tnFHSliceTaskInfo = sliceTaskInfo
+ break
+ case SubnetType.TN_MH:
+ sliceTaskParams.tnMHSliceTaskInfo = sliceTaskInfo
+ break
+ }
}
void timeDelay(DelegateExecution execution) {
- //todo: time delay
+ logger.trace("Enter timeDelay in DoAllocateNSSI()")
+ try {
+ Thread.sleep(60000)
+ int currentCycle = execution.getVariable("currentCycle") as Integer
+ currentCycle = currentCycle + 1
+ if(currentCycle > 60)
+ {
+ logger.trace("Completed all the retry times... but still nssmf havent completed the creation process...")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "NSSMF creation didnt complete by time...")
+ }
+ execution.setVariable("currentCycle", currentCycle)
+ } catch(InterruptedException e) {
+ logger.info("Time Delay exception" + e)
+ }
+ logger.trace("Exit timeDelay in DoAllocateNSSI()")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
index f64f5e8ebf..48e1acd523 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
@@ -132,7 +132,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
}
- def rollbackData = execution.getVariable("RollbackData")
+ RollbackData rollbackData = execution.getVariable("RollbackData")
if (rollbackData == null) {
rollbackData = new RollbackData()
}
@@ -171,19 +171,15 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
serviceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
serviceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
serviceProfile.setResourceSharingLevel(serviceProfileMap.get("resourceSharingLevel").toString())
- serviceProfile.setExpDataRateUL(Integer.parseInt(serviceProfileMap.get("expDataRateUL").toString()))
- serviceProfile.setExpDataRateDL(Integer.parseInt(serviceProfileMap.get("expDataRateDL").toString()))
- serviceProfile.setAreaTrafficCapUL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapUL").toString()))
- serviceProfile.setAreaTrafficCapDL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapDL").toString()))
+ serviceProfile.setDlThptPerSlice(Integer.parseInt(serviceProfileMap.get("dLThptPerSlice").toString()))
+ serviceProfile.setDlThptPerUE(Integer.parseInt(serviceProfileMap.get("dLThptPerUE").toString()))
+ serviceProfile.setUlThptPerSlice(Integer.parseInt(serviceProfileMap.get("uLThptPerSlice").toString()))
+ serviceProfile.setUlThptPerUE(Integer.parseInt(serviceProfileMap.get("uLThptPerUE").toString()))
serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString()))
- serviceProfile.setJitter(0)
+ serviceProfile.setJitter(Integer.parseInt(serviceProfileMap.get("jitter").toString()))
serviceProfile.setSurvivalTime("0")
- serviceProfile.setCsAvailability(new Object())
serviceProfile.setReliability("")
- serviceProfile.setExpDataRate(0)
- serviceProfile.setTrafficDensity(0)
- serviceProfile.setConnDensity(0)
try {
AAIResourceUri uri = AAIUriFactory.createResourceUri(
AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
index 161b92080b..8993127dbc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
@@ -27,7 +27,6 @@ import org.onap.so.beans.nsmf.CnSliceProfile
import org.onap.so.beans.nsmf.EsrInfo
import org.onap.so.beans.nsmf.NetworkType
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
-import org.onap.so.beans.nsmf.SliceTaskParams
import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
import org.onap.so.beans.nsmf.TnSliceProfile
import org.onap.so.beans.nsmf.oof.SubnetCapability
@@ -42,15 +41,6 @@ import org.onap.so.bpmn.core.domain.AllottedResource
import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.HttpClient
-import org.onap.so.client.HttpClientFactory
-import org.onap.aaiclient.client.aai.AAIObjectType
-import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.http.ResponseEntity
@@ -181,7 +171,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
* @param execution
*/
public void handleNsstByType(DelegateExecution execution) {
- //todo: set to sliceTaskParams by type
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
@@ -194,11 +183,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) {
- //todo:
SubnetCapability subnetCapability = new SubnetCapability()
-
handleByType(execution, serviceDecomposition, sliceParams, subnetCapability)
-
subnetCapabilities.add(subnetCapability)
}
@@ -208,15 +194,12 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition,
SliceTaskParamsAdapter sliceParams, SubnetCapability subnetCapability) {
- //todo:
- String domainType = ""
ModelInfo modelInfo = serviceDecomposition.getModelInfo()
String vendor = serviceDecomposition.getServiceRole()
- SubnetType subnetType
+ SubnetType subnetType = convertServiceCategory(serviceDecomposition.getServiceCategory())
- switch (domainType) {
- case "tn_bh":
- subnetType = SubnetType.TN_BH
+ switch (subnetType) {
+ case SubnetType.TN_BH:
sliceParams.tnBHSliceTaskInfo.vendor = vendor
sliceParams.tnBHSliceTaskInfo.subnetType = subnetType
sliceParams.tnBHSliceTaskInfo.networkType = subnetType.networkType
@@ -225,8 +208,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnBHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
break
- case "tn_mh":
- subnetType = SubnetType.TN_MH
+ case SubnetType.TN_MH:
sliceParams.tnMHSliceTaskInfo.vendor = vendor
sliceParams.tnMHSliceTaskInfo.subnetType = subnetType
sliceParams.tnMHSliceTaskInfo.networkType = subnetType.networkType
@@ -235,8 +217,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
break
- case "an_nf":
- subnetType = SubnetType.AN_NF
+ case SubnetType.AN_NF:
sliceParams.anSliceTaskInfo.vendor = vendor
sliceParams.anSliceTaskInfo.subnetType = subnetType
sliceParams.anSliceTaskInfo.networkType = subnetType.networkType
@@ -244,8 +225,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.anSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
sliceParams.anSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
break
- case "cn":
- subnetType = SubnetType.CN
+ case SubnetType.CN:
sliceParams.cnSliceTaskInfo.vendor = vendor
sliceParams.cnSliceTaskInfo.subnetType = subnetType
sliceParams.cnSliceTaskInfo.networkType = subnetType.networkType
@@ -260,9 +240,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
//todo
}
- if (subnetType == null) {
- //todo: throw error
- return
+ if (null == subnetType) {
+ def msg = "Get subnetType failed, modelUUId=" + modelInfo.getModelUuid()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String response = querySubnetCapability(execution, vendor, subnetType)
ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
@@ -275,6 +256,26 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
}
/**
+ * get subnetType from serviceCategory
+ * @return
+ */
+ private SubnetType convertServiceCategory(String serviceCategory){
+ if(serviceCategory ==~ /CN.*/){
+ return SubnetType.CN
+ }
+ if (serviceCategory ==~ /AN.*NF.*/){
+ return SubnetType.AN_NF
+ }
+ if (serviceCategory ==~ /TN.*BH.*/){
+ return SubnetType.TN_BH
+ }
+ if(serviceCategory ==~ /TN.*MH.*/){
+ return SubnetType.TN_MH
+ }
+ return null
+ }
+
+ /**
* query Subnet Capability of TN AN CN
* @param execution
*/
@@ -319,12 +320,11 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
* prepare select nsi request
* @param execution
*/
- public void preNSIRequest(DelegateExecution execution) {
+ public void preNSIRequest(DelegateExecution execution, boolean preferReuse) {
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
logger.debug( "get NSI option OOF Url: " + urlString)
-
String requestId = execution.getVariable("msoRequestId")
String messageType = "NSISelectionResponse"
@@ -346,7 +346,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.getVariable("subnetCapabilities") as List<SubnetCapability>
String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos,
- messageType, profileInfo, subnetCapabilities, timeout as Integer)
+ messageType, profileInfo, subnetCapabilities, timeout as Integer, preferReuse)
execution.setVariable("nsiSelection_oofRequest", oofRequest)
logger.debug("Sending request to OOF: " + oofRequest)
@@ -362,12 +362,12 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
SliceTaskParamsAdapter sliceTaskParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
- logger.debug("NSI OOFResponse is: " + OOFResponse)
- execution.setVariable("OOFResponse", OOFResponse)
+ String oofResponse = execution.getVariable("nsiSelection_oofResponse")
+ logger.debug("NSI oofResponse is: " + oofResponse)
+ execution.setVariable("oofResponse", oofResponse)
//This needs to be changed to derive a value when we add policy to decide the solution options.
- Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
+ Map<String, Object> resMap = objectMapper.readValue(oofResponse, Map.class)
List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
Map<String, Object> solution = nsiSolutions.get(0)
@@ -511,82 +511,182 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
//todo
+ boolean needCnNssiSelection = execution.getVariable("NEED_CN_NSSI_SELECTION") as Boolean
+ boolean needAnNssiSelection = execution.getVariable("NEED_AN_NSSI_SELECTION") as Boolean
+ boolean needTnNssiSelection = execution.getVariable("NEED_TN_NSSI_SELECTION") as Boolean
+
+ /**
+ * [
+ * ā€‹ {
+ * ā€‹ "subType": subtype,
+ * ā€‹ "nsstInfo": object,
+ * ā€‹ "sliceProfile": object
+ * ā€‹ },
+ * {
+ * "subType": subtype,
+ * "nsstInfo": object,
+ * "sliceProfile": object
+ * }
+ * ]
+ */
+ List<Map> nssiNeedHandlerInfos = new ArrayList<>()
+ Map<String, Object> nssiNeedHandlerMap = new HashMap()
+
+ //List<TemplateInfo> nssiNeedHandlers = new ArrayList<>()
+ //List<Object> nssiProfileNeedHandlers = new ArrayList<>()
+ if (needCnNssiSelection) {
+ nssiNeedHandlerMap.put("subnetType", sliceTaskParams.cnSliceTaskInfo.subnetType)
+ nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.cnSliceTaskInfo.NSSTInfo)
+ nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.cnSliceTaskInfo.sliceProfile)
+ nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
+ }
+ if (needAnNssiSelection) {
+ nssiNeedHandlerMap.clear()
+ nssiNeedHandlerMap.put("subnetType", sliceTaskParams.anSliceTaskInfo.subnetType)
+ nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.anSliceTaskInfo.NSSTInfo)
+ nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.anSliceTaskInfo.sliceProfile)
+ nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
+ }
+ if (needTnNssiSelection) {
+ nssiNeedHandlerMap.clear()
+ nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnBHSliceTaskInfo.subnetType)
+ nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnBHSliceTaskInfo.NSSTInfo)
+ nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnBHSliceTaskInfo.sliceProfile)
+ nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
+
+ nssiNeedHandlerMap.clear()
+ nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnMHSliceTaskInfo.subnetType)
+ nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnMHSliceTaskInfo.NSSTInfo)
+ nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnMHSliceTaskInfo.sliceProfile)
+ nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
+
+ nssiNeedHandlerMap.clear()
+ nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnFHSliceTaskInfo.subnetType)
+ nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnFHSliceTaskInfo.NSSTInfo)
+ nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnFHSliceTaskInfo.sliceProfile)
+ nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
+
+ }
+
+ if (nssiNeedHandlerInfos.size() > 0) {
+ execution.setVariable("needSelectNssi", true)
+ execution.setVariable("currNssiIndex", 0)
+ execution.setVariable("nssiNeedHandlerInfos", nssiNeedHandlerInfos)
+ } else {
+ execution.setVariable("needSelectNssi", false)
+ }
+
+ execution.setVariable("sliceTaskParams", sliceTaskParams)
}
/**
- * todo: need rewrite
* prepare select nssi request
* @param execution
*/
public void preNSSIRequest(DelegateExecution execution) {
+ List<Map> nssiNeedHandlerInfos =
+ execution.getVariable("nssiNeedHandlerInfos") as List<Map>
+
+ int currNssiIndex = execution.getVariable("currNssiIndex") as Integer
+ Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map
+
+ TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo
+ Object profileInfo = nssiNeedHandlerInfo.get("sliceProfile")
+
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
logger.debug( "get NSI option OOF Url: " + urlString)
- boolean isNSISuggested = true
- execution.setVariable("isNSISuggested", isNSISuggested)
String requestId = execution.getVariable("msoRequestId")
- String messageType = "NSISelectionResponse"
+ String messageType = "NSSISelectionResponse"
- Map<String, Object> profileInfo = execution.getVariable("serviceProfile") as Map
- Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map
- logger.debug("Get NST selection from OOF: " + nstSolution.toString())
- String nstInfo = """{
- "modelInvariantId":"${nstSolution.invariantUUID}",
- "modelVersionId":"${nstSolution.UUID}",
- "modelName":"${nstSolution.NSTName}"
- }"""
-
- execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
- execution.setVariable("nsiSelection_messageType", messageType)
- execution.setVariable("nsiSelection_correlator", requestId)
+ execution.setVariable("nssiSelectionUrl", "/api/oof/selection/nssi/v1")
+ execution.setVariable("nssiSelection_messageType", messageType)
+ execution.setVariable("nssiSelection_correlator", requestId)
String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
- execution.setVariable("nsiSelection_timeout", timeout)
+ execution.setVariable("nssiSelection_timeout", timeout)
- //todo
- String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, messageType, profileInfo)
+ String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, nsstInfo, messageType,
+ profileInfo, timeout as Integer)
- execution.setVariable("nsiSelection_oofRequest", oofRequest)
+ execution.setVariable("nssiSelection_oofRequest", oofRequest)
logger.debug("Sending request to OOF: " + oofRequest)
}
/**
* process select nssi response
- * todo: unfinished
* @param execution
*/
public void processNSSIResp(DelegateExecution execution) {
- SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams
- String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
+ List<Map> nssiNeedHandlerInfos =
+ execution.getVariable("nssiNeedHandlerInfos") as List<Map>
+
+ int currNssiIndex = execution.getVariable("currNssiIndex") as Integer
+ Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map
+ SubnetType subnetType = nssiNeedHandlerInfo.get("subnetType") as SubnetType
+
+ SliceTaskParamsAdapter sliceTaskParams =
+ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
+
+ String OOFResponse = execution.getVariable("nssiSelection_oofResponse")
logger.debug("NSI OOFResponse is: " + OOFResponse)
execution.setVariable("OOFResponse", OOFResponse)
//This needs to be changed to derive a value when we add policy to decide the solution options.
Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
- Map<String, Object> solutions = nsiSolutions.get(0)
+ Map<String, Object> solution = nsiSolutions.get(0)
String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
- Boolean isSharable = resourceSharingLevel == "shared"
+ Boolean isSharable = resourceSharingLevel == "shared" //todo
- if (solutions != null) {
- if (isSharable && solutions.get("existingNSI")) {
- //sharedNSISolution
- //processSharedNSISolutions(solutions, execution)
- }
- else if(solutions.containsKey("newNSISolution")) {
- //processNewNSISolutions(solutions, execution)
- }
+ if (isSharable && solution != null) {
+ processNssiResult(sliceTaskParams, subnetType, solution)
}
+
execution.setVariable("sliceTaskParams", sliceTaskParams)
- logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson())
+ //logger.debug("sliceTaskParams: "+ sliceTaskParams.convertToJson())
logger.debug("*** Completed options Call to OOF ***")
logger.debug("start parseServiceProfile")
//parseServiceProfile(execution)
logger.debug("end parseServiceProfile")
+
+ if (currNssiIndex >= nssiNeedHandlerInfos.size() - 1) {
+ execution.setVariable("needSelectNssi", false)
+ } else {
+ execution.setVariable("currNssiIndex", currNssiIndex + 1)
+ execution.setVariable("needSelectNssi", true)
+ }
+
}
+ private void processNssiResult(SliceTaskParamsAdapter sliceTaskParams, SubnetType subnetType,
+ Map<String, Object> solution) {
+ switch (subnetType) {
+ case SubnetType.CN:
+ sliceTaskParams.cnSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
+ sliceTaskParams.cnSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
+ break
+ case SubnetType.AN_NF:
+ sliceTaskParams.anSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
+ sliceTaskParams.anSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
+ break
+ case SubnetType.TN_BH:
+ sliceTaskParams.tnBHSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
+ sliceTaskParams.tnBHSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
+ break
+ case SubnetType.TN_FH:
+ sliceTaskParams.tnFHSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
+ sliceTaskParams.tnFHSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
+ break
+ case SubnetType.TN_MH:
+ sliceTaskParams.tnMHSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
+ sliceTaskParams.tnMHSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
+ break
+ }
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
index 60d7355a9c..9656c86ae5 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
@@ -42,6 +42,8 @@ css.processUserOptions(execution)</bpmn:script>
<camunda:out source="rolledBack" target="rolledBack" />
<camunda:out source="serviceInstanceData" target="serviceInstanceData" />
<camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:out source="sliceTaskParams" target="sliceTaskParams" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1dfon41</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0jhqtls</bpmn:outgoing>
@@ -278,6 +280,7 @@ css.prepareUpdateOrchestrationTask(execution)</bpmn:script>
<camunda:out source="rollbackData" target="rollbackData" />
<camunda:out source="rolledBack" target="rolledBack" />
<camunda:in source="allottedResourceId" target="allottedResourceId" />
+ <camunda:out source="sliceTaskParams" target="sliceTaskParams" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn
index e42f001012..9090bf2fab 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn
@@ -58,19 +58,11 @@ dcnsio.createNSIinAAI(execution)</bpmn:script>
<bpmn:callActivity id="CallActivity_1yh9tiq" name="Call DoAllocateNSSI(RAN)" calledElement="DoAllocateNSSI">
<bpmn:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
- <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="nsstInput" target="nsstInput" />
- <camunda:in source="serviceProfile" target="serviceProfile" />
- <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
- <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
- <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
<camunda:in source="uuiRequest" target="uuiRequest" />
- <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" />
- <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" />
- <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" />
<camunda:in source="sliceTaskParams" target="sliceTaskParams" />
<camunda:in source="taskId" target="CSSOT_taskId" />
<camunda:in source="taskName" target="CSSOT_name" />
@@ -80,6 +72,8 @@ dcnsio.createNSIinAAI(execution)</bpmn:script>
<camunda:in source="anSliceTaskInfo" target="sliceTaskInfo" />
<camunda:out source="nssiAllocateResult" target="anNssiAllocateResult" />
<camunda:in source="AnAllocateNssiNbiRequest" target="nbiRequest" />
+ <camunda:out source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:in source="anSubnetType" target="subnetType" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0npsyye</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1xb5nx1</bpmn:outgoing>
@@ -88,19 +82,11 @@ dcnsio.createNSIinAAI(execution)</bpmn:script>
<bpmn:callActivity id="CallActivity_1ixah3o" name="Call DoAllocateNSSI(Core)" calledElement="DoAllocateNSSI">
<bpmn:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
- <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="nsstInput" target="nsstInput" />
- <camunda:in source="serviceProfile" target="serviceProfile" />
- <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
- <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
- <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
<camunda:in source="uuiRequest" target="uuiRequest" />
- <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" />
- <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" />
- <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" />
<camunda:in source="sliceTaskParams" target="sliceTaskParams" />
<camunda:in source="taskId" target="CSSOT_taskId" />
<camunda:in source="taskName" target="CSSOT_name" />
@@ -111,6 +97,8 @@ dcnsio.createNSIinAAI(execution)</bpmn:script>
<camunda:in source="domainType" target="domainType" />
<camunda:out source="nssiAllocateResult" target="cnNssiAllocateResult" />
<camunda:in source="CnAllocateNssiNbiRequest" target="nbiRequest" />
+ <camunda:out source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:in source="cnSubnetType" target="subnetType" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0cwbtmr</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1l74seh</bpmn:outgoing>
@@ -185,19 +173,11 @@ dcnsio.createTnBHSliceProfile(execution)</bpmn:script>
<bpmn:callActivity id="CallActivity_0b28wlb" name="Call DoAllocateNSSI(TN)" calledElement="DoAllocateNSSI">
<bpmn:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
- <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="nsstInput" target="nsstInput" />
- <camunda:in source="serviceProfile" target="serviceProfile" />
- <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
- <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
- <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
<camunda:in source="uuiRequest" target="uuiRequest" />
- <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" />
- <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" />
- <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" />
<camunda:in source="sliceTaskParams" target="sliceTaskParams" />
<camunda:in source="taskId" target="CSSOT_taskId" />
<camunda:in source="taskName" target="CSSOT_name" />
@@ -207,6 +187,8 @@ dcnsio.createTnBHSliceProfile(execution)</bpmn:script>
<camunda:in source="tnBHSliceTaskInfo" target="sliceTaskInfo" />
<camunda:out source="nssiAllocateResult" target="tnBHNssiAllocateResult" />
<camunda:in source="TnBHAllocateNssiNbiRequest" target="nbiRequest" />
+ <camunda:out source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:in source="tnBHSubnetType" target="subnetType" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_01isn2q</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1omynpt</bpmn:outgoing>
@@ -279,7 +261,7 @@ dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script>
</bpmn:process>
<bpmn:message id="Message_1i10pf1" name="Message_2mc69tg" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSIV2">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSI">
<bpmndi:BPMNShape id="StartEvent_1ym3sha_di" bpmnElement="StartEvent_1ym3sha">
<dc:Bounds x="138" y="122" width="36" height="36" />
<bpmndi:BPMNLabel>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn
index 6e94538775..58795056d4 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn
@@ -76,7 +76,7 @@ dcnssi.timeDelay(execution)</bpmn:script>
</bpmn:endEvent>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSIV2">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSI">
<bpmndi:BPMNShape id="StartEvent_0zs8ezi_di" bpmnElement="StartEvent_0zs8ezi">
<dc:Bounds x="147" y="112" width="36" height="36" />
<bpmndi:BPMNLabel>
@@ -155,4 +155,4 @@ dcnssi.timeDelay(execution)</bpmn:script>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn:definitions>
+</bpmn:definitions> \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
index 0345ea7a9f..2aa7da2cd2 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
@@ -25,7 +25,7 @@ dcsi.preProcessRequest(execution)</bpmn:script>
<bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateSliceServiceInstance()
-dcsi.instantiateSliceService(execution)</bpmn:script>
+dcsi.createServiceProfileInstance(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:endEvent id="EndEvent_1x6k78c">
<bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming>
@@ -135,4 +135,4 @@ dcsi.prepareDecomposeService(execution)</bpmn:script>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn:definitions>
+</bpmn:definitions> \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
index 045d88daa9..1bda596c6a 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
@@ -29,43 +29,19 @@ dcso.processDecompositionNST(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_1kzy63m" sourceRef="ScriptTask_11rb2ju" targetRef="CallActivity_0c567r4" />
<bpmn:sequenceFlow id="SequenceFlow_1t317y2" sourceRef="CallActivity_0c567r4" targetRef="ScriptTask_0z0dwk2" />
- <bpmn:parallelGateway id="ParallelGateway_05zg916">
- <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing>
- </bpmn:parallelGateway>
- <bpmn:parallelGateway id="ParallelGateway_06a2n9u">
- <bpmn:incoming>SequenceFlow_14rhmx9</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_103oxyw</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_0aasemn</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1tr3i9d</bpmn:outgoing>
- </bpmn:parallelGateway>
- <bpmn:callActivity id="CallActivity_0tzazs0" name="Handle NSST Selection OOF request" calledElement="DoHandleOofRequest">
+ <bpmn:callActivity id="CallActivity_0tzazs0" name="Handle NSSI Selection OOF request" calledElement="DoHandleOofRequest">
<bpmn:extensionElements>
- <camunda:in source="nstSelectionUrl" target="apiPath" />
- <camunda:in source="nstSelection_correlator" target="correlator" />
- <camunda:in source="nstSelection_messageType" target="messageType" />
- <camunda:in source="nstSelection_timeout" target="timeout" />
+ <camunda:in source="nssiSelectionUrl" target="apiPath" />
+ <camunda:in source="nssiSelection_correlator" target="correlator" />
+ <camunda:in source="nssiSelection_messageType" target="messageType" />
+ <camunda:in source="nssiSelection_timeout" target="timeout" />
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:out source="asyncCallbackResponse" target="nstSelection_oofResponse" />
- <camunda:in source="nstSelection_oofRequest" target="oofRequest" />
+ <camunda:out source="asyncCallbackResponse" target="nssiSelection_oofResponse" />
+ <camunda:in source="nssiSelection_oofRequest" target="oofRequest" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0abqxa1</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1tqg26p</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" />
- <bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" />
- <bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" />
- <bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" />
- <bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" />
- <bpmn:sequenceFlow id="SequenceFlow_0aasemn" sourceRef="CallActivity_0otry7e" targetRef="ParallelGateway_06a2n9u" />
- <bpmn:sequenceFlow id="SequenceFlow_1tr3i9d" sourceRef="ParallelGateway_06a2n9u" targetRef="Task_1jyj2vs" />
- <bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" />
- <bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" />
- <bpmn:endEvent id="EndEvent_0p0cjhl">
- <bpmn:incoming>SequenceFlow_1nrfy6i</bpmn:incoming>
- </bpmn:endEvent>
<bpmn:startEvent id="StartEvent_0mwlirs" name="Start">
<bpmn:outgoing>SequenceFlow_1fuwy35</bpmn:outgoing>
</bpmn:startEvent>
@@ -107,30 +83,11 @@ dcso.preNSSIRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:scriptTask id="Task_00nfg5x" name="Process NSST Solutions" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_1tqg26p</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1i3j8c3</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1ezi1oi</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcso = new DoCreateSliceServiceOption()
dcso.processNSSIResp(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:exclusiveGateway id="ExclusiveGateway_0b52m39" name="need select nssi?" default="SequenceFlow_1nrfy6i">
- <bpmn:incoming>SequenceFlow_1tey3hz</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_126j77n</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1nrfy6i</bpmn:outgoing>
- </bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_126j77n" name="yes" sourceRef="ExclusiveGateway_0b52m39" targetRef="Task_1m9qoo3">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "update")}</bpmn:conditionExpression>
- </bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" />
- <bpmn:sequenceFlow id="SequenceFlow_1i3j8c3" sourceRef="Task_00nfg5x" targetRef="Task_1jyj2vs" />
- <bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" />
- <bpmn:scriptTask id="Task_1jyj2vs" name="handle Nssi select " scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_1tr3i9d</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_1i3j8c3</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1tey3hz</bpmn:outgoing>
- <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcso = new DoCreateSliceServiceOption()
-dcso.handleNssiSelect(execution)</bpmn:script>
- </bpmn:scriptTask>
<bpmn:scriptTask id="ScriptTask_12sydez" name="prepare NSST decomposition" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_0zglfyw</bpmn:incoming>
<bpmn:incoming>SequenceFlow_0t4gmix</bpmn:incoming>
@@ -206,7 +163,7 @@ dcso.processNSIResp(execution)</bpmn:script>
<bpmn:outgoing>SequenceFlow_14o0fxe</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcso = new DoCreateSliceServiceOption()
-dcso.preNSIRequest(execution)</bpmn:script>
+dcso.preNSIRequest(execution,true)</bpmn:script>
</bpmn:scriptTask>
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_00uke3g" name=" Select NSSI ">
<bpmn:outgoing>SequenceFlow_1iawj3m</bpmn:outgoing>
@@ -215,10 +172,53 @@ dcso.preNSIRequest(execution)</bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_14o0fxe" sourceRef="ScriptTask_0bgvphs" targetRef="CallActivity_0vs5jgq" />
<bpmn:sequenceFlow id="SequenceFlow_0nwt0ci" sourceRef="CallActivity_0vs5jgq" targetRef="ScriptTask_12t6v71" />
<bpmn:sequenceFlow id="SequenceFlow_1iawj3m" sourceRef="IntermediateCatchEvent_00uke3g" targetRef="ScriptTask_0bgvphs" />
+ <bpmn:scriptTask id="Task_1jyj2vs" name="handle Nssi select " scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1tr3i9d</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1tey3hz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.handleNssiSelect(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:parallelGateway id="ParallelGateway_06a2n9u">
+ <bpmn:incoming>SequenceFlow_0aasemn</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_103oxyw</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_14rhmx9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1tr3i9d</bpmn:outgoing>
+ </bpmn:parallelGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1tr3i9d" sourceRef="ParallelGateway_06a2n9u" targetRef="Task_1jyj2vs" />
+ <bpmn:sequenceFlow id="SequenceFlow_0aasemn" sourceRef="CallActivity_0otry7e" targetRef="ParallelGateway_06a2n9u" />
+ <bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" />
+ <bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" />
+ <bpmn:parallelGateway id="ParallelGateway_05zg916">
+ <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing>
+ </bpmn:parallelGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" />
+ <bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" />
+ <bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" />
<bpmn:sequenceFlow id="SequenceFlow_1h3kdce" sourceRef="ScriptTask_12t6v71" targetRef="ParallelGateway_05zg916" />
+ <bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" />
+ <bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" />
+ <bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0b52m39" name="need select nssi?" default="SequenceFlow_1nrfy6i">
+ <bpmn:incoming>SequenceFlow_1tey3hz</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1ezi1oi</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_126j77n</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1nrfy6i</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_126j77n" name="yes" sourceRef="ExclusiveGateway_0b52m39" targetRef="Task_1m9qoo3">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("needSelectNssi" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_0p0cjhl">
+ <bpmn:incoming>SequenceFlow_1nrfy6i</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ezi1oi" sourceRef="Task_00nfg5x" targetRef="ExclusiveGateway_0b52m39" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOptionV2">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption">
<bpmndi:BPMNShape id="ScriptTask_11rb2ju_di" bpmnElement="ScriptTask_11rb2ju">
<dc:Bounds x="400" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -236,58 +236,9 @@ dcso.preNSIRequest(execution)</bpmn:script>
<di:waypoint x="660" y="180" />
<di:waypoint x="710" y="180" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916">
- <dc:Bounds x="635" y="475" width="50" height="50" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u">
- <dc:Bounds x="905" y="475" width="50" height="50" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0tzazs0_di" bpmnElement="CallActivity_0tzazs0">
<dc:Bounds x="1410" y="320" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_05250mp_di" bpmnElement="SequenceFlow_05250mp">
- <di:waypoint x="660" y="475" />
- <di:waypoint x="660" y="360" />
- <di:waypoint x="740" y="360" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_14rhmx9_di" bpmnElement="SequenceFlow_14rhmx9">
- <di:waypoint x="840" y="360" />
- <di:waypoint x="930" y="360" />
- <di:waypoint x="930" y="475" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf">
- <di:waypoint x="685" y="500" />
- <di:waypoint x="740" y="500" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw">
- <di:waypoint x="840" y="500" />
- <di:waypoint x="905" y="500" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0il5j01_di" bpmnElement="SequenceFlow_0il5j01">
- <di:waypoint x="660" y="525" />
- <di:waypoint x="660" y="620" />
- <di:waypoint x="740" y="620" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0aasemn_di" bpmnElement="SequenceFlow_0aasemn">
- <di:waypoint x="840" y="620" />
- <di:waypoint x="930" y="620" />
- <di:waypoint x="930" y="525" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d">
- <di:waypoint x="955" y="500" />
- <di:waypoint x="1010" y="500" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1">
- <di:waypoint x="1460" y="460" />
- <di:waypoint x="1460" y="400" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p">
- <di:waypoint x="1410" y="360" />
- <di:waypoint x="1110" y="360" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl">
- <dc:Bounds x="1442" y="602" width="36" height="36" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0mwlirs_di" bpmnElement="StartEvent_0mwlirs">
<dc:Bounds x="162" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
@@ -314,36 +265,7 @@ dcso.preNSIRequest(execution)</bpmn:script>
<dc:Bounds x="1410" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0aqbm7t_di" bpmnElement="Task_00nfg5x">
- <dc:Bounds x="1010" y="320" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true">
- <dc:Bounds x="1235" y="475" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1218" y="463" width="85" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_126j77n_di" bpmnElement="SequenceFlow_126j77n">
- <di:waypoint x="1285" y="500" />
- <di:waypoint x="1410" y="500" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1339" y="482" width="17" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i">
- <di:waypoint x="1260" y="525" />
- <di:waypoint x="1260" y="620" />
- <di:waypoint x="1442" y="620" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1i3j8c3_di" bpmnElement="SequenceFlow_1i3j8c3">
- <di:waypoint x="1060" y="400" />
- <di:waypoint x="1060" y="460" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz">
- <di:waypoint x="1110" y="500" />
- <di:waypoint x="1235" y="500" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs">
- <dc:Bounds x="1010" y="460" width="100" height="80" />
+ <dc:Bounds x="1210" y="320" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_12sydez_di" bpmnElement="ScriptTask_12sydez">
<dc:Bounds x="860" y="140" width="100" height="80" />
@@ -420,10 +342,87 @@ dcso.preNSIRequest(execution)</bpmn:script>
<di:waypoint x="178" y="500" />
<di:waypoint x="210" y="500" />
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs">
+ <dc:Bounds x="1010" y="460" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u">
+ <dc:Bounds x="905" y="475" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d">
+ <di:waypoint x="955" y="500" />
+ <di:waypoint x="1010" y="500" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0aasemn_di" bpmnElement="SequenceFlow_0aasemn">
+ <di:waypoint x="840" y="620" />
+ <di:waypoint x="930" y="620" />
+ <di:waypoint x="930" y="525" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw">
+ <di:waypoint x="840" y="500" />
+ <di:waypoint x="905" y="500" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_14rhmx9_di" bpmnElement="SequenceFlow_14rhmx9">
+ <di:waypoint x="840" y="360" />
+ <di:waypoint x="930" y="360" />
+ <di:waypoint x="930" y="475" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916">
+ <dc:Bounds x="635" y="475" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0il5j01_di" bpmnElement="SequenceFlow_0il5j01">
+ <di:waypoint x="660" y="525" />
+ <di:waypoint x="660" y="620" />
+ <di:waypoint x="740" y="620" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf">
+ <di:waypoint x="685" y="500" />
+ <di:waypoint x="740" y="500" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_05250mp_di" bpmnElement="SequenceFlow_05250mp">
+ <di:waypoint x="660" y="475" />
+ <di:waypoint x="660" y="360" />
+ <di:waypoint x="740" y="360" />
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1h3kdce_di" bpmnElement="SequenceFlow_1h3kdce">
<di:waypoint x="590" y="500" />
<di:waypoint x="635" y="500" />
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p">
+ <di:waypoint x="1410" y="360" />
+ <di:waypoint x="1310" y="360" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz">
+ <di:waypoint x="1110" y="500" />
+ <di:waypoint x="1235" y="500" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1">
+ <di:waypoint x="1460" y="460" />
+ <di:waypoint x="1460" y="400" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true">
+ <dc:Bounds x="1235" y="475" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1218" y="463" width="85" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_126j77n_di" bpmnElement="SequenceFlow_126j77n">
+ <di:waypoint x="1285" y="500" />
+ <di:waypoint x="1410" y="500" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1339" y="482" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl">
+ <dc:Bounds x="1242" y="632" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i">
+ <di:waypoint x="1260" y="525" />
+ <di:waypoint x="1260" y="632" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ezi1oi_di" bpmnElement="SequenceFlow_1ezi1oi">
+ <di:waypoint x="1260" y="400" />
+ <di:waypoint x="1260" y="475" />
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index b55499473c..9ac3579957 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -85,6 +85,11 @@ public class AAICreateTasks {
private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList";
private static String HEAT_STACK_ID = "heatStackId";
private static String NETWORK_POLICY_FQDN_PARAM = "network-policy-fqdn";
+ protected static final String EXCEPTION_NAME_EXISTS_WITH_DIFFERENT_ID =
+ "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)";
+ protected static final String EXCEPTION_NAME_AND_ID_ARE_NULL =
+ "Exception in AAICreateOwningEntity. OwningEntityId and Name are null.";
+
@Autowired
private AAIServiceInstanceResources aaiSIResources;
@Autowired
@@ -192,9 +197,8 @@ public class AAICreateTasks {
OwningEntity owningEntity = serviceInstance.getOwningEntity();
if (Strings.isNullOrEmpty(owningEntity.getOwningEntityId())
&& Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
- String msg = "Exception in AAICreateOwningEntity. OwningEntityId and Name are null.";
- execution.setVariable("ErrorCreateOEAAI", msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ execution.setVariable("ErrorCreateOEAAI", EXCEPTION_NAME_AND_ID_ARE_NULL);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "EXCEPTION_NAME_AND_ID_ARE_NULL");
} else if (Strings.isNullOrEmpty(owningEntity.getOwningEntityId())
&& !Strings.isNullOrEmpty(owningEntity.getOwningEntityName())) {
if (aaiSIResources.existsOwningEntityName(owningEntity.getOwningEntityName())) {
@@ -219,11 +223,11 @@ public class AAICreateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
} else {
if (aaiSIResources.existsOwningEntityName(owningEntity.getOwningEntityName())) {
- String msg =
- "Exception in AAICreateOwningEntity. Can't create OwningEntity as name already exists in AAI associated with a different owning-entity-id (name must be unique)";
- logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg,
- "BPMN", ErrorCode.UnknownError.getValue(), msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ EXCEPTION_NAME_EXISTS_WITH_DIFFERENT_ID, "BPMN", ErrorCode.UnknownError.getValue(),
+ EXCEPTION_NAME_EXISTS_WITH_DIFFERENT_ID);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ EXCEPTION_NAME_EXISTS_WITH_DIFFERENT_ID);
} else {
aaiSIResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
index c21b467a95..a556d3088c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
@@ -1,19 +1,16 @@
package org.onap.so.bpmn.infrastructure.adapter.cnf.tasks;
-import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowAction;
import org.onap.so.client.adapter.cnf.CnfAdapterClient;
-import org.onap.so.client.adapter.cnf.CnfAdapterClientException;
import org.onap.so.client.adapter.cnf.entities.InstanceRequest;
import org.onap.so.client.adapter.cnf.entities.InstanceResponse;
+import org.onap.so.client.adapter.cnf.entities.Labels;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class CnfAdapter {
@@ -25,8 +22,19 @@ public class CnfAdapter {
public void callCnfAdapter(DelegateExecution execution) throws Exception {
try {
- final String instanceRequest = (String) execution.getVariable("instanceRequest");
- InstanceRequest request = new ObjectMapper().readValue(instanceRequest, InstanceRequest.class);
+ InstanceRequest request = new InstanceRequest();
+ request.setRbName("test-rbdef");
+ request.setRbVersion("v1");
+ request.setCloudRegion("krd");
+ request.setVfModuleUUID("VF module UUID");
+ request.setProfileName("p1");
+ Map<String, String> overrideValues = new HashMap<>();
+ overrideValues.put("image.tag", "latest");
+ overrideValues.put("dcae_collector_ip", "1.2.3.4");
+ Map<String, String> labels = new HashMap<String, String>();
+ labels.put("custom-label-1", "abcdef");
+ request.setLabels(labels);
+ request.setOverrideValues(overrideValues);
InstanceResponse response = cnfAdapterClient.createVfModule(request);
} catch (Exception ex) {
logger.error("Exception in callCnfAdapter", ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
index 93d30512b6..7624bcb811 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
@@ -112,7 +112,7 @@ public class CnfAdapterCreateTasks {
request.setRbName(vfModule.getModelInfoVfModule().getModelInvariantUUID());
request.setRbVersion(vfModule.getModelInfoVfModule().getModelUUID());
request.setCloudRegion(cloudRegion.getLcpCloudRegionId());
- request.setReleaseName(vfModule.getVfModuleId());
+ request.setVfModuleUUID(vfModule.getVfModuleId());
request.setProfileName(sdncDirectives.get("k8s-rb-profile-name"));
request.setOverrideValues(sdncDirectives);
return request;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
index a1e513fd47..3b81d52703 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
@@ -22,17 +22,22 @@ import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.onap.so.client.cds.ConfigureInstanceParamsForPnf;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.cds.PayloadConstants;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.exception.PayloadGenerationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
import java.util.UUID;
import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME;
import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION;
@@ -54,13 +59,16 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui
private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils;
private ExtractPojosForBB extractPojosForBB;
private ExceptionBuilder exceptionBuilder;
+ private ConfigureInstanceParamsForPnf configureInstanceParamsForPnf;
@Autowired
public GenericPnfCDSControllerRunnableBB(AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils,
- ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) {
+ ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder,
+ ConfigureInstanceParamsForPnf configureInstanceParamsForPnf) {
this.abstractCDSProcessingBBUtils = abstractCDSProcessingBBUtils;
this.extractPojosForBB = extractPojosForBB;
this.exceptionBuilder = exceptionBuilder;
+ this.configureInstanceParamsForPnf = configureInstanceParamsForPnf;
}
@Override
@@ -115,6 +123,7 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui
String resolutionKey = null;
try {
final Pnf pnf = getPnf(execution);
+ final String modelCustomizationUuid = pnf.getModelInfoPnf().getModelCustomizationUuid();
final ServiceInstance serviceInstance = getServiceInstance(execution);
resolutionKey = pnf.getPnfName();
@@ -123,10 +132,17 @@ public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<Bui
pnfObject);
setExecutionVariable("pnf-id", pnf.getPnfId(), pnfObject);
setExecutionVariable("pnf-name", resolutionKey, pnfObject);
- setExecutionVariable("pnf-customization-uuid", pnf.getModelInfoPnf().getModelCustomizationUuid(),
- pnfObject);
+ setExecutionVariable("pnf-customization-uuid", modelCustomizationUuid, pnfObject);
+
+ final GeneralBuildingBlock generalBuildingBlock = execution.getGeneralBuildingBlock();
- } catch (BBObjectNotFoundException exception) {
+ List<Map<String, Object>> userParamsFromRequest =
+ generalBuildingBlock.getRequestContext().getRequestParameters().getUserParams();
+ if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
+ configureInstanceParamsForPnf.populateInstanceParams(pnfObject, userParamsFromRequest,
+ modelCustomizationUuid);
+ }
+ } catch (BBObjectNotFoundException | PayloadGenerationException exception) {
logger.error("An exception occurred when creating payload for CDS request", exception);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, exception);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java
index f44c15ac54..b74aa9056d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java
@@ -34,6 +34,7 @@ import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
@@ -75,11 +76,32 @@ public class CnfAdapterClient {
}
}
+ @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000))
+ public InstanceResponse healthcheck() throws CnfAdapterClientException {
+ try {
+ // String uri = env.getRequiredProperty("mso.cnf.adapter.endpoint"); //TODO: This needs to be added as well
+ // for configuration
+ String uri = "https://localhost:32780"; // TODO: What is the correct uri?
+ String endpoint = UriBuilder.fromUri(uri).path("/api/cnf-adapter/v1/healthcheck").build().toString();
+ HttpEntity<?> entity = new HttpEntity<>(getHttpHeaders());
+ ResponseEntity<InstanceResponse> result =
+ restTemplate.exchange(endpoint, HttpMethod.GET, entity, InstanceResponse.class);
+ return result.getBody();
+ } catch (HttpClientErrorException e) {
+ logger.error("Error Calling CNF Adapter, e");
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException(e.getResponseBodyAsString());
+ }
+ throw e;
+ }
+ }
+
protected HttpHeaders getHttpHeaders() {
HttpHeaders headers = new HttpHeaders();
- List<org.springframework.http.MediaType> acceptableMediaTypes = new ArrayList<>();
- acceptableMediaTypes.add(org.springframework.http.MediaType.APPLICATION_JSON);
+ List<MediaType> acceptableMediaTypes = new ArrayList<>();
+ acceptableMediaTypes.add(MediaType.APPLICATION_JSON);
headers.setAccept(acceptableMediaTypes);
+ headers.setContentType(MediaType.APPLICATION_JSON);
/*
* try { String userCredentials = CryptoUtils.decrypt(env.getRequiredProperty("mso.cnf.adapter.auth"),
* env.getRequiredProperty("mso.msoKey")); if (userCredentials != null) { headers.add(HttpHeaders.AUTHORIZATION,
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
index e4058097ab..37d4e41553 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
@@ -11,18 +11,18 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
"override-values"})
public class InstanceRequest {
- @JsonProperty("rb-name")
+ @JsonProperty("modelInvariantId")
private String rbName;
- @JsonProperty("rb-version")
+ @JsonProperty("modelVersionId")
private String rbVersion;
- @JsonProperty("profile-name")
+ @JsonProperty("k8sRBProfileName")
private String profileName;
- @JsonProperty("release-name")
- private String releaseName;
- @JsonProperty("cloud-region")
+ @JsonProperty("vfModuleUUID")
+ private String vfModuleUUID;
+ @JsonProperty("cloudRegionId")
private String cloudRegion;
@JsonProperty("labels")
- private Labels labels;
+ private Map<String, String> labels;
@JsonProperty(value = "override-values")
private Map<String, String> overrideValues;
@@ -67,21 +67,21 @@ public class InstanceRequest {
}
@JsonProperty("labels")
- public Labels getLabels() {
+ public Map<String, String> getLabels() {
return labels;
}
@JsonProperty("labels")
- public void setLabels(Labels labels) {
+ public void setLabels(Map<String, String> labels) {
this.labels = labels;
}
- public String getReleaseName() {
- return releaseName;
+ public String getVfModuleUUID() {
+ return vfModuleUUID;
}
- public void setReleaseName(String releaseName) {
- this.releaseName = releaseName;
+ public void setVfModuleUUID(String vfModuleUUID) {
+ this.vfModuleUUID = vfModuleUUID;
}
public Map<String, String> getOverrideValues() {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
index f09e792cf4..e1d3a7cbc4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -37,6 +37,7 @@ import java.util.List;
import java.util.Optional;
import java.util.TreeSet;
import java.util.stream.Collectors;
+import com.google.common.base.Strings;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Rule;
@@ -303,6 +304,22 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
+ public void createOwningEntityShouldThrowExceptionWhenNameAndIDAreNull() {
+ boolean catchedBpmnError = false;
+ serviceInstance.getOwningEntity().setOwningEntityName(null);
+ serviceInstance.getOwningEntity().setOwningEntityId(null);
+
+ try {
+ aaiCreateTasks.createOwningEntity(execution);
+ } catch (BpmnError err) {
+ catchedBpmnError = true;
+ }
+
+ assertTrue(catchedBpmnError);
+ assertEquals(execution.getVariable("ErrorCreateOEAAI"), aaiCreateTasks.EXCEPTION_NAME_AND_ID_ARE_NULL);
+ }
+
+ @Test
public void createOwningEntityNullOwningEntityNameTest() throws Exception {
expectedException.expect(BpmnError.class);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
index d6a28cba25..1cba35dc74 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
@@ -29,16 +29,31 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.ConfigureInstanceParamsForPnf;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Pnfs;
+import org.onap.so.serviceinstancebeans.Resources;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.EXECUTION_OBJECT;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID;
@@ -51,6 +66,8 @@ public class GenericPnfCDSControllerRunnableBBTest {
@Mock
private ExtractPojosForBB extractPojosForBB;
+ @Mock
+ private ConfigureInstanceParamsForPnf configureInstanceParamsForPnf;
@InjectMocks
private GenericPnfCDSControllerRunnableBB genericPnfCDSControllerRunnableBB;
@@ -67,6 +84,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
private final static String serviceModelUUID = "6bc0b04d-1873-4721-b53d-6615225b2a28";
private final static String pnfCustomizationUUID = "9acb3a83-8a52-412c-9a45-901764938144";
private final static String action = "action";
+ private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
@Before
public void setUp() {
@@ -104,7 +122,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
}
@Test
- public void prepareTest() throws BBObjectNotFoundException {
+ public void prepareTest() throws BBObjectNotFoundException, PayloadGenerationException {
// given
prepareData();
@@ -119,6 +137,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
assertThat(abstractCDSPropertiesBean).isNotNull();
assertThat(abstractCDSPropertiesBean.getRequestObject()).isNotNull();
assertThat(abstractCDSPropertiesBean.getRequestObject()).isInstanceOf(String.class);
+ assertThat(execution.getGeneralBuildingBlock()).isNotNull();
assertEquals(blueprintName, abstractCDSPropertiesBean.getBlueprintName());
assertEquals(blueprintVersion, abstractCDSPropertiesBean.getBlueprintVersion());
@@ -134,7 +153,7 @@ public class GenericPnfCDSControllerRunnableBBTest {
assertEquals(pnfCustomizationUUID, actionProperties.get("pnf-customization-uuid"));
}
- private void prepareData() throws BBObjectNotFoundException {
+ private void prepareData() throws BBObjectNotFoundException, PayloadGenerationException {
Pnf pnf = new Pnf();
ServiceInstance serviceInstance = new ServiceInstance();
@@ -149,8 +168,62 @@ public class GenericPnfCDSControllerRunnableBBTest {
modelInfoServiceInstance.setModelUuid(serviceModelUUID);
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY,
+ createGeneralBuildingBlock(createService(createPnfsList())));
when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.PNF))).thenReturn(pnf);
when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
+ doNothing().when(configureInstanceParamsForPnf).populateInstanceParams(any(), any(), any());
+ }
+
+ private Service createService(List<Pnfs> pnfList) {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setPnfs(pnfList);
+ service.setResources(resources);
+ return service;
+ }
+
+ private GeneralBuildingBlock createGeneralBuildingBlock(Object serviceJson) {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(createRequestUserParams(serviceJson));
+ requestContext.setRequestParameters(requestParameters);
+ generalBuildingBlock.setRequestContext(requestContext);
+ return generalBuildingBlock;
+ }
+
+ private List<Map<String, Object>> createRequestUserParams(Object serviceJson) {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", serviceJson);
+ userParams.add(userParamMap);
+ return userParams;
+ }
+
+ private List<Pnfs> createPnfsList() {
+ List<Map<String, String>> instanceParamsListSearchedPnf = new ArrayList<>();
+ Map<String, String> instanceParam = new HashMap<>();
+ instanceParam.put("INSTANCE_PARAM1_NAME", "INSTANCE_PARAM1_VALUE");
+ instanceParam.put("INSTANCE_PARAM2_NAME", "INSTANCE_PARAM2_VALUE");
+ Map<String, String> instanceParam2 = new HashMap<>();
+ instanceParam2.put("INSTANCE_PARAM3_NAME", "INSTANCE_PARAM3_VALUE");
+ instanceParamsListSearchedPnf.add(instanceParam);
+ instanceParamsListSearchedPnf.add(instanceParam2);
+ Pnfs searchedPnf = createPnfs("0c1ac643-377e-475b-be50-6be65f91a7ad", instanceParamsListSearchedPnf);
+
+ List<Pnfs> pnfList = new ArrayList<>();
+ pnfList.add(searchedPnf);
+ return pnfList;
+ }
+
+ private Pnfs createPnfs(String pnfModelCustomizationId, List<Map<String, String>> instanceParamsList) {
+ Pnfs pnfs = new Pnfs();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationUuid(pnfModelCustomizationId);
+ pnfs.setModelInfo(modelInfo);
+ pnfs.setInstanceParams(instanceParamsList);
+ return pnfs;
}
}