summaryrefslogtreecommitdiffstats
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/NssmfAdapterUtils.groovy136
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy16
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy49
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy72
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java9
8 files changed, 165 insertions, 137 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy
index 775f088136..bbe5f0d0a4 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy
@@ -22,22 +22,15 @@ package org.onap.so.bpmn.common.scripts
import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONArray
-import org.json.JSONObject
-import org.onap.logging.filter.base.ErrorCode
import org.onap.logging.filter.base.ONAPComponents
-import org.onap.logging.ref.slf4j.ONAPLogConstants
+import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.web.util.UriUtils
-import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
/***
@@ -94,56 +87,91 @@ class NssmfAdapterUtils {
}
- public String sendPostRequestNSSMF (DelegateExecution execution, String endPoint, String nssmfRequest) {
- try {
-
- String nssmfEndpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint",execution)
- String queryEndpoint = nssmfEndpoint + endPoint
- def responseData
- HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.EXTERNAL)
- String basicAuthCred = execution.getVariable("BasicAuthHeaderValue")
- client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution)))
-
- logger.debug('sending POST to NSSMF endpoint: ' + endPoint)
- Response response = client.post(nssmfRequest)
-
- responseData = response.readEntity(String.class)
- if (responseData != null) {
- logger.debug("Received data from NSSMF: " + responseData)
- }
-
- logger.debug('Response code:' + response.getStatus())
- logger.debug('Response:' + System.lineSeparator() + responseData)
- if (response.getStatus() >= 200 && response.getStatus() < 300) {
- // parse response as needed
- return responseData
- }
- else {
- return null
- }
- }
- catch (Exception e) {
- logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
- throw e
- }
+ public String sendPostRequestNSSMF (DelegateExecution execution, String endPoint, String nssmfRequest) {
+ try {
- }
+ String nssmfEndpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint",execution)
+ String queryEndpoint = nssmfEndpoint + endPoint
+ def responseData
+ HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.EXTERNAL)
+ String basicAuthCred = execution.getVariable("BasicAuthHeaderValue")
+ client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution)))
+ logger.debug('sending POST to NSSMF endpoint: ' + endPoint)
+ Response response = client.post(nssmfRequest)
+
+ responseData = response.readEntity(String.class)
+ if (responseData != null) {
+ logger.debug("Received data from NSSMF: " + responseData)
+ }
+
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
+ if (response.getStatus() >= 200 && response.getStatus() < 300) {
+ // parse response as needed
+ return responseData
+ }
+ else {
+ return null
+ }
+ }
+ catch (Exception e) {
+ logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
+ throw e
+ }
- private String getBasicDBAuthHeader(DelegateExecution execution) {
+ }
- String encodedString = null
- try {
- String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
- logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
+ public String sendPostRequestNSSMF (DelegateExecution execution, String endPoint, NssmfAdapterNBIRequest nssmfRequest) {
+ try {
+
+ String nssmfEndpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint",execution)
+ String queryEndpoint = nssmfEndpoint + endPoint
+ def responseData
+ HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.EXTERNAL)
+ String basicAuthCred = execution.getVariable("BasicAuthHeaderValue")
+ client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution)))
+
+ logger.debug('sending POST to NSSMF endpoint: ' + endPoint)
+ Response response = client.post(nssmfRequest)
+
+ responseData = response.readEntity(String.class)
+ if (responseData != null) {
+ logger.debug("Received data from NSSMF: " + responseData)
+ }
+
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
+ if (response.getStatus() >= 200 && response.getStatus() < 300) {
+ // parse response as needed
+ return responseData
+ }
+ else {
+ return null
+ }
+ }
+ catch (Exception e) {
+ logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
+ throw e
+ }
+
+ }
+
+ private String getBasicDBAuthHeader(DelegateExecution execution) {
+
+ String encodedString = null
+ try {
+ String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
+ logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
+
+ encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ execution.setVariable("BasicAuthHeaderValue", encodedString)
+ } catch (IOException ex) {
+ String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
+ logger.error(dataErrorMessage)
+ }
+ return encodedString
+ }
- encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
- execution.setVariable("BasicAuthHeaderValue", encodedString)
- } catch (IOException ex) {
- String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- logger.error(dataErrorMessage)
- }
- return encodedString
- }
}
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 ff31c46a3a..4eb9eedad5 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
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import com.google.gson.GsonBuilder
import org.onap.so.beans.nsmf.oof.NsiReqBody
import org.onap.so.beans.nsmf.oof.NssiReqBody
import org.onap.so.beans.nsmf.oof.RequestInfo
@@ -673,7 +674,7 @@ return json.toString()
requestInfo.setCallbackUrl(callbackUrl)
requestInfo.setSourceId("so")
requestInfo.setTimeout(timeOut)
- //requestInfo.setNumSolutions()
+ requestInfo.setNumSolutions(100)
nsiReqBody.setRequestInfo(requestInfo)
nsiReqBody.setNSTInfo(nstInfo)
@@ -682,9 +683,7 @@ return json.toString()
nsiReqBody.setNSSTInfo(nsstInfo)
nsiReqBody.setPreferReuse(preferReuse)
- ObjectMapper objectMapper = new ObjectMapper()
-
- return objectMapper.writeValueAsString(nsiReqBody)
+ return bean2JsonStr(nsiReqBody)
}
public <T> String buildSelectNSSIRequest(String requestId, TemplateInfo nsstInfo, String messageType,
@@ -704,15 +703,16 @@ return json.toString()
requestInfo.setCallbackUrl(callbackUrl)
requestInfo.setSourceId("so")
requestInfo.setTimeout(timeOut)
- //requestInfo.setNumSolutions()
+ requestInfo.setNumSolutions(100)
nssiReqBody.setRequestInfo(requestInfo)
nssiReqBody.setSliceProfile(sliceProfile)
nssiReqBody.setNSSTInfo(nsstInfo)
+ return bean2JsonStr(nssiReqBody)
+ }
- ObjectMapper objectMapper = new ObjectMapper()
-
- return objectMapper.writeValueAsString(nssiReqBody)
+ private static <T> String bean2JsonStr(T t) {
+ return new GsonBuilder().setPrettyPrinting().create().toJson(t)
}
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
index 1229c86d64..c46d504186 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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_1ahlzqg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.14.0">
+<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_1ahlzqg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0">
<bpmn:process id="ControllerExecutionBB" name="ControllerExecutionBB" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>SequenceFlow_0gmfit3</bpmn:outgoing>
@@ -34,13 +34,10 @@
<bpmn:sequenceFlow id="SequenceFlow_15gxql1" sourceRef="ExclusiveGateway_13q340y" targetRef="EndEvent_0mnaj50" />
<bpmn:serviceTask id="ServiceTask_0inxg9l" name="Set Actor, Scope and Action Params" camunda:expression="${ControllerExecution.setControllerActorScopeAction(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0gmfit3</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_05j6hg6</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_1lspfyy</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_05j6hg6" sourceRef="ServiceTask_0inxg9l" targetRef="ExclusiveGateway_0plxwkg" />
<bpmn:exclusiveGateway id="ExclusiveGateway_0plxwkg" default="SequenceFlow_1t7hs4k">
<bpmn:incoming>SequenceFlow_1lspfyy</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_05j6hg6</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1t7hs4k</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0vzx2yr</bpmn:outgoing>
</bpmn:exclusiveGateway>
@@ -146,13 +143,6 @@
<bpmndi:BPMNShape id="ServiceTask_0inxg9l_di" bpmnElement="ServiceTask_0inxg9l">
<dc:Bounds x="259" y="301" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_05j6hg6_di" bpmnElement="SequenceFlow_05j6hg6">
- <di:waypoint x="359" y="341" />
- <di:waypoint x="399" y="341" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="184" y="240" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0plxwkg_di" bpmnElement="ExclusiveGateway_0plxwkg" isMarkerVisible="true">
<dc:Bounds x="399" y="316" width="50" height="50" />
<bpmndi:BPMNLabel>
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 5f0d412de0..c136d52b13 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
@@ -315,12 +315,14 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
logger.debug("Start prepareSelectNSTRequest")
String requestId = execution.getVariable("msoRequestId")
String messageType = "NSTSelectionResponse"
- Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") as Map<String, Object>
execution.setVariable("nstSelectionUrl", "/api/oof/v1/selection/nst")
execution.setVariable("nstSelection_messageType", messageType)
execution.setVariable("nstSelection_correlator", requestId)
String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
execution.setVariable("nstSelection_timeout", timeout)
+
+ Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") as Map<String, Object>
+ serviceProfile.remove("profileId")
String oofRequest = oofUtils.buildSelectNSTRequest(requestId, messageType, serviceProfile)
execution.setVariable("nstSelection_oofRequest", oofRequest)
logger.debug("Finish prepareSelectNSTRequest")
@@ -349,7 +351,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
TemplateInfo nstInfo = new TemplateInfo()
nstInfo.setUUID(nstSolution.get("UUID") as String)
nstInfo.setInvariantUUID(nstSolution.get("invariantUUID") as String)
- nstInfo.setName(nstSolution.get("name") as String)
+ nstInfo.setName(nstSolution.get("NSTName") as String)
sliceTaskParams.setNSTInfo(nstInfo)
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 d0c189cb04..1d7acd31c1 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
@@ -41,7 +41,6 @@ import org.onap.so.beans.nsmf.CnSliceProfile
import org.onap.so.beans.nsmf.EsrInfo
import org.onap.so.beans.nsmf.NssiResponse
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
@@ -157,6 +156,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
+ execution.setVariable("sliceTaskParams", sliceParams)
logger.debug("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()")
}
@@ -201,8 +201,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
try {
AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class)
Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
- //todo: if exists
- if (!si.ifPresent()) {
+ if (!si.isPresent()) {
String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
@@ -251,15 +250,13 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
rspi.setOrchestrationStatus(oStatus)
rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
- rspi.setInputParameters(uuiRequest)
- rspi.setWorkloadContext(useInterval)
- rspi.setEnvironmentContext(sNSSAI_id)
+ rspi.setInputParameters(execution.getVariable("uuiRequest"))
+ rspi.setWorkloadContext(execution.getVariable("useInterval"))
+ rspi.setEnvironmentContext(execution.getVariable("sNSSAI_id"))
//timestamp format YYYY-MM-DD hh:mm:ss
rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
- execution.setVariable("communicationServiceInstance", rspi)
-
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
client.create(uri, rspi)
@@ -312,11 +309,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
- allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
- allocateAnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID
- allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile
- allocateAnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId
EsrInfo esrInfo = new EsrInfo()
//todo: vendor and network
@@ -339,8 +332,8 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
nbiRequest.setAllocateAnNssi(allocateAnNssi)
execution.setVariable("AnAllocateNssiNbiRequest", nbiRequest)
- execution.setVariable("anBHSliceTaskInfo", sliceTaskInfo)
- execution.setVariable("anSubnetType", SubnetType.AN_NF)
+ execution.setVariable("anSliceTaskInfo", sliceTaskInfo)
+ execution.setVariable("anSubnetType", SubnetType.AN)
}
@@ -592,7 +585,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- ResponseDescriptor result = execution.getVariable("anNssiAllocateResult") as ResponseDescriptor
+ NssiResponse result = execution.getVariable("anNssiAllocateResult") as NssiResponse
String nssiId = result.getNssiId()
String nsiId = sliceParams.getSuggestNsiId()
String sliceProfileInstanceId = sliceParams.anSliceTaskInfo.sliceInstanceId
@@ -660,23 +653,25 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
//sliceParams.setServiceId(nsiServiceInstanceID)
- AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId))
+ AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("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()) {
+ if (!si.isPresent()) {
String msg = "NSSI in the option doesn't exist. " + nssiId
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
-
- if (si.ifPresent()) {
+ } else {
ServiceInstance nssiInstance = si.get()
//todo: handle relationship and return endpointId
+ if (nssiInstance.relationshipList == null) {
+ String msg = "relationshipList of " + nssiId + " is null"
+ logger.debug(msg)
+ return null
+ }
for (Relationship relationship : nssiInstance.relationshipList.getRelationship()) {
if (relationship.relationshipLabel){
endpointId = relationship //todo
@@ -689,7 +684,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
}catch(BpmnError e) {
throw e
}catch (Exception ex){
- String msg = "NSSI suggested in the option doesn't exist. " + nssiId
+ String msg = "Exception: " + ex
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -735,14 +730,14 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
//relation ship
Relationship relationship = new Relationship()
- AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(targetId))
+ AAIResourceUri targetInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(targetId))
- logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri)
+ logger.info("Creating relationship, targetInstanceUri: " + targetInstanceUri)
- relationship.setRelatedLink(nsiServiceUri.build().toString())
+ relationship.setRelatedLink(targetInstanceUri.build().toString())
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sourceId).relationshipAPI())
- client.create(uri, relationship)
+ AAIResourceUri sourceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sourceId)).relationshipAPI()
+ client.create(sourceInstanceUri, relationship)
}
}
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 3e834fa7bb..896d7ff4b1 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
@@ -139,7 +139,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
case SubnetType.CN:
sliceTaskParams.cnSliceTaskInfo = sliceTaskInfo
break
- case SubnetType.AN_NF:
+ case SubnetType.AN:
sliceTaskParams.anSliceTaskInfo = sliceTaskInfo
break
case SubnetType.TN_BH:
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 cfdbe98c34..2cce68a2b6 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
@@ -43,7 +43,7 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.http.ResponseEntity
+import org.springframework.util.StringUtils
class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
@@ -139,7 +139,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
* @param execution
*/
public void processDecompositionNSST(DelegateExecution execution) {
-
List<ServiceDecomposition> nsstServiceDecompositions =
execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition>
@@ -153,6 +152,9 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
int num = execution.getVariable("maxNsstIndex") as Integer
int index = execution.getVariable("currentNsstIndex") as Integer
+ List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo>
+ nsstInfos.get(index).name = nsstServiceDecomposition.modelInfo.modelName
+ execution.setVariable("nsstInfos", nsstInfos)
execution.setVariable("currentNsstIndex", index + 1)
if (index >= num) {
@@ -178,17 +180,16 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
List<SubnetCapability> subnetCapabilities = new ArrayList<>()
for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) {
- SubnetCapability subnetCapability = new SubnetCapability()
- handleByType(execution, serviceDecomposition, sliceParams, subnetCapability)
- subnetCapabilities.add(subnetCapability)
+ handleByType(execution, serviceDecomposition, sliceParams, subnetCapabilities)
}
execution.setVariable("sliceTaskParams", sliceParams)
execution.setVariable("subnetCapabilities", subnetCapabilities)
+ logger.debug("sliceTaskParams= " + sliceParams.toString())
}
private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition,
- SliceTaskParamsAdapter sliceParams, SubnetCapability subnetCapability) {
+ SliceTaskParamsAdapter sliceParams, List<SubnetCapability> subnetCapabilities) {
ModelInfo modelInfo = serviceDecomposition.getModelInfo()
String vendor = serviceDecomposition.getServiceRole()
SubnetType subnetType = convertServiceCategory(serviceDecomposition.getServiceCategory())
@@ -210,7 +211,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnMHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
break
- case SubnetType.AN_NF:
+ case SubnetType.AN:
sliceParams.anSliceTaskInfo.vendor = vendor
sliceParams.anSliceTaskInfo.subnetType = subnetType
sliceParams.anSliceTaskInfo.networkType = subnetType.networkType
@@ -236,12 +237,14 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
String response = querySubnetCapability(execution, vendor, subnetType)
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
-
- Map<String, Object> result = responseEntity.getBody() as Map
- for (Map.Entry<String, Object> entry : result.entrySet()) {
- subnetCapability.setDomainType(entry.getKey())
- subnetCapability.setCapabilityDetails(entry.getValue())
+ if (!StringUtils.isEmpty(response)) {
+ SubnetCapability subnetCapability = new SubnetCapability()
+ Map<String, Object> result = objectMapper.readValue(response, Map.class)
+ for (Map.Entry<String, Object> entry : result.entrySet()) {
+ subnetCapability.setDomainType(entry.getKey())
+ subnetCapability.setCapabilityDetails(entry.getValue())
+ }
+ subnetCapabilities.add(subnetCapability)
}
}
@@ -254,7 +257,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
return SubnetType.CN
}
if (serviceCategory ==~ /AN.*NF.*/){
- return SubnetType.AN_NF
+ return SubnetType.AN
}
if (serviceCategory ==~ /TN.*BH.*/){
return SubnetType.TN_BH
@@ -271,9 +274,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
*/
private String querySubnetCapability(DelegateExecution execution, String vendor, SubnetType subnetType) {
- String strRequest = objectMapper.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetType))
-
- String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest)
+ String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY,
+ buildQuerySubnetCapRequest(vendor, subnetType))
return response
}
@@ -284,24 +286,24 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
* @param networkType
* @return
*/
- private static String buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) {
+ private static NssmfAdapterNBIRequest buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) {
NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
-// List<String> subnetTypes = new ArrayList<>()
-// subnetTypes.add(subnetType.subnetType)
- Map<String, Object> paramMap = new HashMap()
- paramMap.put("subnetType", subnetType.subnetType)
+ List<String> subnetTypes = new ArrayList<>()
+
+ subnetTypes.add(subnetType.subnetType)
+
+ Map<String, Object> paramMap = new HashMap<>()
+ paramMap.put("subnetTypes", subnetTypes)
- request.setSubnetCapabilityQuery(objectMapper.writeValueAsString(paramMap))
+ request.setSubnetCapabilityQuery(paramMap)
EsrInfo esrInfo = new EsrInfo()
esrInfo.setVendor(vendor)
esrInfo.setNetworkType(subnetType.networkType)
request.setEsrInfo(esrInfo)
- String strRequest = objectMapper.writeValueAsString(request)
-
- return strRequest
+ return request
}
/**
@@ -328,6 +330,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
Map<String, Object> profileInfo = sliceParams.getServiceProfile()
+ profileInfo.remove("profileId")
TemplateInfo nstInfo = sliceParams.getNSTInfo()
List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo>
@@ -336,7 +339,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.getVariable("subnetCapabilities") as List<SubnetCapability>
String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos,
- messageType, profileInfo, subnetCapabilities, timeout as Integer, preferReuse)
+ messageType, profileInfo, subnetCapabilities, 600, preferReuse)
execution.setVariable("nsiSelection_oofRequest", oofRequest)
logger.debug("Sending request to OOF: " + oofRequest)
@@ -358,7 +361,13 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
//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)
+ String requestStatus = resMap.get("requestStatus")
+ if (StringUtils.isEmpty(requestStatus)) {
+ exceptionUtil.buildWorkflowException(execution, 7000, "get nsi from oof error: " + oofResponse)
+ }
+
List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+
Map<String, Object> solution = nsiSolutions.get(0)
String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
@@ -378,7 +387,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
}
}
execution.setVariable("sliceTaskParams", sliceTaskParams)
- //logger.debug("sliceTaskParams: " + sliceTaskParams.convertToJson())
logger.debug("*** Completed options Call to OOF ***")
}
@@ -402,6 +410,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnBHSliceTaskInfo.sliceProfile = sliceProfile as TnSliceProfile
break
case "an-nf":
+ case "an":
sliceParams.anSliceTaskInfo.sliceProfile = sliceProfile as AnSliceProfile
break
case "cn":
@@ -587,7 +596,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map
TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo
- Object profileInfo = nssiNeedHandlerInfo.get("sliceProfile")
+ Map<String, Object> profileInfo = nssiNeedHandlerInfo.get("sliceProfile") as Map
+ profileInfo.remove("profileId")
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
logger.debug( "get NSI option OOF Url: " + urlString)
@@ -602,7 +612,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.setVariable("nssiSelection_timeout", timeout)
String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, nsstInfo, messageType,
- profileInfo, timeout as Integer)
+ profileInfo, 600)
execution.setVariable("nssiSelection_oofRequest", oofRequest)
logger.debug("Sending request to OOF: " + oofRequest)
@@ -665,7 +675,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceTaskParams.cnSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
sliceTaskParams.cnSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
break
- case SubnetType.AN_NF:
+ case SubnetType.AN:
sliceTaskParams.anSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
sliceTaskParams.anSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
break
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 8f150b301c..5d95f973bf 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -1252,9 +1252,12 @@ public class WorkflowAction {
foundVfModuleOrVG = true;
}
- if (vfModuleCustomization.getVfModule() != null
- && vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null
- && vfModuleCustomization.getHeatEnvironment() != null) {
+ if ((vfModuleCustomization.getVfModule() != null)
+ && ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null
+ && vfModuleCustomization.getHeatEnvironment() != null))
+ || (vfModuleCustomization.getVfModule().getModelName() != null
+ && vfModuleCustomization.getVfModule().getModelName()
+ .contains("helm"))) {
foundVfModuleOrVG = true;
Resource resource = new Resource(WorkflowType.VFMODULE,
vfModuleCustomization.getModelCustomizationUUID(), false);