summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-06-05 16:24:37 -0400
committerSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-06-06 11:26:38 -0400
commit560e84158798cb884de65e3cf33ab657f0e6e6df (patch)
tree83a5aedb750eed64fcff623742bebc63a2a07161 /bpmn
parent5f4c4f3f3215eb136f9c4f84f51dc8fcd5fe0353 (diff)
parent59eff996497691e0fc82b627dcda306e861655b3 (diff)
Merge remote-tracking branch 'origin/dublin' into 'origin/master'
Change-Id: I551ea3f29a76dc99532455ea4d7e84a316f9bf38 Issue-ID: SO-1980 Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy38
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy35
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy2302
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersDistributeTraffic.java78
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficAction.java44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficCheckAction.java44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java31
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json29
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java58
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml4
-rw-r--r--bpmn/pom.xml1
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn12
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn8
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy50
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy34
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml22
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn35
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn26
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn141
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java73
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java129
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTaskTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java)62
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java28
59 files changed, 2291 insertions, 1460 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index 182976d69e..e233e6a7c6 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -311,7 +311,7 @@
<dependency>
<groupId>org.onap.appc.client</groupId>
<artifactId>client-lib</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>${appc.client.version}</version>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
@@ -330,7 +330,7 @@
<dependency>
<groupId>org.onap.appc.client</groupId>
<artifactId>client-kit</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>${appc.client.version}</version>
<exclusions>
<exclusion>
<groupId>org.mockito</groupId>
@@ -364,16 +364,6 @@
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.sdc.sdc-tosca</groupId>
- <artifactId>sdc-tosca</artifactId>
- <version>1.4.4</version>
- </dependency>
- <dependency>
- <groupId>org.onap.sdc.jtosca</groupId>
- <artifactId>jtosca</artifactId>
- <version>1.4.4</version>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index d17a3c42a6..6583ded413 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -32,15 +32,18 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.Subscriber
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.DefaultProperties
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.db.catalog.beans.AuthenticationType
import org.onap.so.db.catalog.beans.CloudIdentity
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.db.catalog.beans.ServerType
import org.onap.so.utils.TargetEntity
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.json.JSONArray
import org.json.JSONObject
@@ -106,12 +109,12 @@ class OofHoming extends AbstractServiceTaskProcessor {
if (isBlank(subscriberInfo)) {
subscriber = new Subscriber("", "", "")
} else {
- String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId")
- String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName")
- String subCommonSiteId = ""
- if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) {
- subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId")
- }
+ String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId")
+ String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName")
+ String subCommonSiteId = ""
+ if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) {
+ subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId")
+ }
subscriber = new Subscriber(subId, subName, subCommonSiteId)
}
@@ -161,21 +164,24 @@ class OofHoming extends AbstractServiceTaskProcessor {
logger.debug( "Posting to OOF Url: " + urlString)
- URL url = new URL(urlString);
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO)
+ URL url = new URL(urlString)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.OOF)
httpClient.addAdditionalHeader("Authorization", authHeader)
- Response httpResponse = httpClient.post(oofRequest)
+ Response httpResponse = httpClient.post(oofRequest)
- int responseCode = httpResponse.getStatus()
- logger.debug("OOF sync response code is: " + responseCode)
+ int responseCode = httpResponse.getStatus()
+ logger.debug("OOF sync response code is: " + responseCode)
+ if(responseCode != 202){
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+ }
logger.debug( "*** Completed Homing Call OOF ***")
}
} catch (BpmnError b) {
throw b
} catch (Exception e) {
- logger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
"Internal Error - Occured in Homing callOof: " + e.getMessage())
}
@@ -358,7 +364,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
throw b
} catch (Exception e) {
logger.debug( "ProcessHomingSolution Exception: " + e)
- logger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution")
}
}
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 2f46630715..4bfb29bc45 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
@@ -25,6 +25,7 @@ package org.onap.so.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.util.OofInfraUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.domain.HomingSolution
import org.onap.so.bpmn.core.domain.ModelInfo
@@ -53,6 +54,7 @@ import org.slf4j.LoggerFactory
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
+import javax.ws.rs.core.UriBuilder
import javax.xml.ws.http.HTTPException
import static org.onap.so.bpmn.common.scripts.GenericUtils.*
@@ -62,6 +64,7 @@ class OofUtils {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+ OofInfraUtils oofInfraUtils = new OofInfraUtils()
private AbstractServiceTaskProcessor utils
@@ -504,27 +507,8 @@ class OofUtils {
*
* @return void
*/
- Void createCloudSiteCatalogDb(CloudSite cloudSite, DelegateExecution execution) {
-
- String endpoint = UrnPropertiesReader.getVariable("mso.catalog.db.spring.endpoint", execution)
- String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- String uri = "/cloudSite"
-
- URL url = new URL(endpoint + uri)
- HttpClient client = new HttpClientFactory().newJsonClient(url, TargetEntity.EXTERNAL)
- client.addAdditionalHeader(HttpHeaders.AUTHORIZATION, auth)
- client.addAdditionalHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON)
-
- Response response = client.post(request.getBody().toString())
-
- int responseCode = response.getStatus()
- logger.debug("CatalogDB response code is: " + responseCode)
- String syncResponse = response.readEntity(String.class)
- logger.debug("CatalogDB response is: " + syncResponse)
-
- if(responseCode != 202){
- exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.")
- }
+ Void createCloudSite(CloudSite cloudSite, DelegateExecution execution) {
+ oofInfraUtils.createCloudSite(cloudSite, execution)
}
/**
@@ -537,11 +521,12 @@ class OofUtils {
Void createHomingInstance(HomingInstance homingInstance, DelegateExecution execution) {
oofInfraUtils.createHomingInstance(homingInstance, execution)
}
- String getMsbHost(DelegateExecution execution) {
- String msbHost = UrnPropertiesReader.getVariable("mso.msb.host", execution, "msb-iag.onap")
- Integer msbPort = UrnPropertiesReader.getVariable("mso.msb.port", execution, "80").toInteger()
+ String getMsbHost(DelegateExecution execution) {
+ String msbHost = UrnPropertiesReader.getVariable("mso.msb.host", execution, "msb-iag.onap")
+
+ Integer msbPort = UrnPropertiesReader.getVariable("mso.msb.port", execution, "80").toInteger()
- return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString()
+ return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString()
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index 82c1e4fa6e..fb662f627f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -227,6 +227,8 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
try {
getAAIClient().update(uri,payload)
+ execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 200)
+ execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', "Success")
} catch (Exception ex) {
logger.debug('Exception occurred while executing AAI PATCH: {}', ex.getMessage(), ex)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
index 0e8631e7b4..bbb5fc7a7b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
@@ -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.
@@ -41,839 +41,926 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger( VfModuleBase.class);
- protected XmlParser xmlParser = new XmlParser()
-
- /**
- * Get the XmlParser.
- *
- * @return the XmlParser.
- */
- protected XmlParser getXmlParser() {
- return xmlParser
- }
-
- /**
- * Find the VF Module with specified ID in the specified Generic VF. If no such
- * VF Module is found, null is returned.
- *
- * @param genericVnf The Generic VNF in which to search for the specified VF Moduel.
- * @param vfModuleId The ID of the VF Module for which to search.
- * @return a VFModule object for the found VF Module or null if no VF Module is found.
- */
- protected VfModule findVfModule(String genericVnf, String vfModuleId) {
-
- def genericVnfNode = xmlParser.parseText(genericVnf)
- def vfModulesNode = utils.getChildNode(genericVnfNode, 'vf-modules')
- if (vfModulesNode == null) {
- return null
- }
- def vfModuleList = utils.getIdenticalChildren(vfModulesNode, 'vf-module')
- for (vfModuleNode in vfModuleList) {
- def vfModuleIdNode = utils.getChildNode(vfModuleNode, 'vf-module-id')
- if ((vfModuleIdNode != null) && (vfModuleIdNode.text().equals(vfModuleId))) {
- return new VfModule(vfModuleNode, (vfModuleList.size() == 1))
- }
- }
- return null
- }
-
- /**
- * Transform all '*_network' parameter specifications from the incoming '*-params' root
- * element to a corresponding list of 'vnf-networks' specifications (typically used when
- * invoking the VNF Rest Adpater). Each element in '*-params' whose name attribute ends
- * with '_network' is used to create an 'vnf-networks' element.
- *
- * @param paramsNode A Node representing a '*-params' element.
- * @return a String of 'vnf-networks' elements, one for each 'param' element whose name
- * attribute ends with '_network'.
- */
- protected String transformNetworkParamsToVnfNetworks(String paramsRootXml) {
- if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
- return ''
- }
- def String vnfNetworks = ''
- try {
- paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
- def paramsNode = xmlParser.parseText(paramsRootXml)
- def params = utils.getIdenticalChildren(paramsNode, 'param')
- for (param in params) {
- def String attrName = (String) param.attribute('name')
- if (attrName.endsWith('_network')) {
- def networkRole = attrName.substring(0, (attrName.length()-'_network'.length()))
- def networkName = param.text()
- String vnfNetwork = """
+ protected XmlParser xmlParser = new XmlParser()
+
+ /**
+ * Get the XmlParser.
+ *
+ * @return the XmlParser.
+ */
+ protected XmlParser getXmlParser() {
+ return xmlParser
+ }
+
+ /**
+ * Find the VF Module with specified ID in the specified Generic VF. If no such
+ * VF Module is found, null is returned.
+ *
+ * @param genericVnf The Generic VNF in which to search for the specified VF Moduel.
+ * @param vfModuleId The ID of the VF Module for which to search.
+ * @return a VFModule object for the found VF Module or null if no VF Module is found.
+ */
+ protected VfModule findVfModule(String genericVnf, String vfModuleId) {
+
+ def genericVnfNode = xmlParser.parseText(genericVnf)
+ def vfModulesNode = utils.getChildNode(genericVnfNode, 'vf-modules')
+ if (vfModulesNode == null) {
+ return null
+ }
+ def vfModuleList = utils.getIdenticalChildren(vfModulesNode, 'vf-module')
+ for (vfModuleNode in vfModuleList) {
+ def vfModuleIdNode = utils.getChildNode(vfModuleNode, 'vf-module-id')
+ if ((vfModuleIdNode != null) && (vfModuleIdNode.text().equals(vfModuleId))) {
+ return new VfModule(vfModuleNode, (vfModuleList.size() == 1))
+ }
+ }
+ return null
+ }
+
+ /**
+ * Transform all '*_network' parameter specifications from the incoming '*-params' root
+ * element to a corresponding list of 'vnf-networks' specifications (typically used when
+ * invoking the VNF Rest Adpater). Each element in '*-params' whose name attribute ends
+ * with '_network' is used to create an 'vnf-networks' element.
+ *
+ * @param paramsNode A Node representing a '*-params' element.
+ * @return a String of 'vnf-networks' elements, one for each 'param' element whose name
+ * attribute ends with '_network'.
+ */
+ protected String transformNetworkParamsToVnfNetworks(String paramsRootXml) {
+ if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
+ return ''
+ }
+ def String vnfNetworks = ''
+ try {
+ paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
+ def paramsNode = xmlParser.parseText(paramsRootXml)
+ def params = utils.getIdenticalChildren(paramsNode, 'param')
+ for (param in params) {
+ def String attrName = (String) param.attribute('name')
+ if (attrName.endsWith('_network')) {
+ def networkRole = attrName.substring(0, (attrName.length()-'_network'.length()))
+ def networkName = param.text()
+ String vnfNetwork = """
<vnf-networks>
<network-role>${MsoUtils.xmlEscape(networkRole)}</network-role>
<network-name>${MsoUtils.xmlEscape(networkName)}</network-name>
</vnf-networks>
"""
- vnfNetworks = vnfNetworks + vnfNetwork
- }
- }
- } catch (Exception e) {
- logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(),
- 'Exception transforming network params to vnfNetworks', "BPMN",
- ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e);
- }
- return vnfNetworks
- }
-
- /**
- * Transform the parameter specifications from the incoming '*-params' root element to
- * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
- * Each element in '*-params' is used to create an 'entry' element.
- *
- * @param paramsNode A Node representing a '*-params' element.
- * @return a String of 'entry' elements, one for each 'param' element.
- */
- protected String transformParamsToEntries(String paramsRootXml) {
- if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
- return ''
- }
- def String entries = ''
- try {
- paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
- def paramsNode = xmlParser.parseText(paramsRootXml)
- def params = utils.getIdenticalChildren(paramsNode, 'param')
- for (param in params) {
- def key = (String) param.attribute('name')
- if (key == null) {
- key = ''
- }
- def value = (String) param.text()
- String entry = """
+ vnfNetworks = vnfNetworks + vnfNetwork
+ }
+ }
+ } catch (Exception e) {
+ logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ 'Exception transforming network params to vnfNetworks', "BPMN",
+ ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e);
+ }
+ return vnfNetworks
+ }
+
+ /**
+ * Transform the parameter specifications from the incoming '*-params' root element to
+ * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
+ * Each element in '*-params' is used to create an 'entry' element.
+ *
+ * @param paramsNode A Node representing a '*-params' element.
+ * @return a String of 'entry' elements, one for each 'param' element.
+ */
+ protected String transformParamsToEntries(String paramsRootXml) {
+ if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
+ return ''
+ }
+ def String entries = ''
+ try {
+ paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
+ def paramsNode = xmlParser.parseText(paramsRootXml)
+ def params = utils.getIdenticalChildren(paramsNode, 'param')
+ for (param in params) {
+ def key = (String) param.attribute('name')
+ if (key == null) {
+ key = ''
+ }
+ def value = (String) param.text()
+ String entry = """
<entry>
<key>${MsoUtils.xmlEscape(key)}</key>
<value>${MsoUtils.xmlEscape(value)}</value>
</entry>
"""
- entries = entries + entry
- }
- } catch (Exception e) {
- logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(),
- 'Exception transforming params to entries', "BPMN",
- ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
- }
- return entries
- }
-
- /**
- * Transform the parameter specifications from the incoming '*-params' root element to
- * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
- * Each element in '*-params' is used to create an 'entry' element.
- *
- * @param paramsNode A Node representing a '*-params' element.
- * @return a String of 'entry' elements, one for each 'param' element.
- */
- protected String transformVolumeParamsToEntries(String paramsRootXml) {
- if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
- return ''
- }
- def String entries = ''
- try {
- paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
- def paramsNode = xmlParser.parseText(paramsRootXml)
- def params = utils.getIdenticalChildren(paramsNode, 'param')
- for (param in params) {
- def key = (String) param.attribute('name')
- if (key == null) {
- key = ''
- }
- if ( !(key in ['vnf_id', 'vnf_name', 'vf_module_id', 'vf_module_name'])) {
- def value = (String) param.text()
- String entry = """
+ entries = entries + entry
+ }
+ } catch (Exception e) {
+ logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ 'Exception transforming params to entries', "BPMN",
+ ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
+ }
+ return entries
+ }
+
+ /**
+ * Transform the parameter specifications from the incoming '*-params' root element to
+ * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
+ * Each element in '*-params' is used to create an 'entry' element.
+ *
+ * @param paramsNode A Node representing a '*-params' element.
+ * @return a String of 'entry' elements, one for each 'param' element.
+ */
+ protected String transformVolumeParamsToEntries(String paramsRootXml) {
+ if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
+ return ''
+ }
+ def String entries = ''
+ try {
+ paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
+ def paramsNode = xmlParser.parseText(paramsRootXml)
+ def params = utils.getIdenticalChildren(paramsNode, 'param')
+ for (param in params) {
+ def key = (String) param.attribute('name')
+ if (key == null) {
+ key = ''
+ }
+ if ( !(key in [
+ 'vnf_id',
+ 'vnf_name',
+ 'vf_module_id',
+ 'vf_module_name'
+ ])) {
+ def value = (String) param.text()
+ String entry = """
<entry>
<key>${MsoUtils.xmlEscape(key)}</key>
<value>${MsoUtils.xmlEscape(value)}</value>
</entry>
"""
- entries = entries + entry
- }
- }
- } catch (Exception e) {
- logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(),
- 'Exception transforming params to entries', "BPMN",
- ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
- }
- return entries
- }
-
- /*
- * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response
- * and puts them into the format expected by VNF adapter.
- * @param vnfParamsMap - map of VNF parameters passed in the request body
- * @param sdncGetResponse - response string from SDNC GET topology request
- * @param vnfId
- * @param vnfName
- * @param vfModuleId
- * @param vfModuleName
- * @param vfModuleIndex - can be null
- * @return a String of key/value entries for vfModuleParams
- */
-
-
- protected String buildVfModuleParams(Map<String, String> vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName,
- String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) {
-
- //Get SDNC Response Data
-
- String data = utils.getNodeXml(sdncGetResponse, "response-data")
-
- String serviceData = utils.getNodeXml(data, "service-data")
- serviceData = utils.removeXmlPreamble(serviceData)
- serviceData = utils.removeXmlNamespaces(serviceData)
- String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information")
- String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id")
- oldVnfId = utils.removeXmlPreamble(oldVnfId)
- oldVnfId = utils.removeXmlNamespaces(oldVnfId)
- serviceData = serviceData.replace(oldVnfId, "")
- def vnfId1 = utils.getNodeText(serviceData, "vnf-id")
-
- Map<String, String> paramsMap = new HashMap<String, String>()
-
- if (vfModuleIndex != null) {
- paramsMap.put("vf_module_index", "${vfModuleIndex}")
- }
-
- // Add-on data
- paramsMap.put("vnf_id", "${vnfId}")
- paramsMap.put("vnf_name", "${vnfName}")
- paramsMap.put("vf_module_id", "${vfModuleId}")
- paramsMap.put("vf_module_name", "${vfModuleName}")
- paramsMap.put("environment_context", "${environmentContext}")
- paramsMap.put("workload_context", "${workloadContext}")
-
- InputSource source = new InputSource(new StringReader(data));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document responseXml = docBuilder.parse(source)
-
-
- // Availability Zones Data
-
- NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
- String aZonePosition = "0"
- for (int z = 0; z < aZonesList.getLength(); z++) {
- Node node = aZonesList.item(z)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String aZoneValue = utils.getElementText(eElement, "availability-zone")
- aZonePosition = z.toString()
- paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
- }
- }
-
- // Map of network-roles and network-tags from vm-networks
-
- NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks")
- Map<String, String> networkRoleMap = new HashMap<String, String>()
- for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
- Node nodeNetworkKey = vmNetworksListGlobal.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
- String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkRoleValue.isEmpty()) {
- networkRoleValue = networkRole
- }
- networkRoleMap.put(networkRole, networkRoleValue)
- }
- }
-
- // VNF Networks Data
-
- StringBuilder sbNet = new StringBuilder()
-
- NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
- for (int x = 0; x < vnfNetworkList.getLength(); x++) {
- Node node = vnfNetworkList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
- String networkRole = utils.getElementText(eElement, "network-role")
- if (vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRoleMap.get(networkRole)
- if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRole
- }
- }
- String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
- String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
- String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
- String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
- String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
- paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}")
- paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}")
-
- NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
- StringBuffer sriovFilterBuf = new StringBuffer()
- String values = ""
- for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
- Node node1 = sriovVlanFilterList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- String value = utils.getElementText(eElement1, "sriov-vlan-filter")
- if (i != sriovVlanFilterList.getLength() - 1) {
- values = sriovFilterBuf.append(value + ",")
- }
- else {
- values = sriovFilterBuf.append(value);
- }
- }
- }
- if (!values.isEmpty()) {
- paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}")
- }
- }
- }
-
- // VNF-VMS Data
-
- def key
- def value
- def networkKey
- def networkValue
- def floatingIPKey
- def floatingIPKeyValue
- def floatingIPV6Key
- def floatingIPV6KeyValue
- StringBuilder sb = new StringBuilder()
-
- NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
- for (int x = 0; x < vmsList.getLength(); x++) {
- Node node = vmsList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- key = utils.getElementText(eElement, "vm-type")
- String values
- String position = "0"
- StringBuilder sb1 = new StringBuilder()
- NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
- NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
- for(int i = 0; i < valueList.getLength(); i++){
- Node node1 = valueList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- value = utils.getElementText(eElement1, "vm-name")
- if (i != valueList.getLength() - 1) {
- values = sb1.append(value + ",")
- }
- else {
- values = sb1.append(value);
- }
- position = i.toString()
- paramsMap.put("${key}_name_${position}", "${value}")
- }
- }
- for(int n = 0; n < vmNetworksList.getLength(); n++){
- String floatingIpKeyValueStr = ""
- String floatingIpV6KeyValueStr = ""
- Node nodeNetworkKey = vmNetworksList.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String ipAddressValues
- String ipV6AddressValues
- String networkPosition = "0"
- StringBuilder sb2 = new StringBuilder()
- StringBuilder sb3 = new StringBuilder()
- StringBuilder sb4 = new StringBuilder()
- networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkKey.isEmpty()) {
- networkKey = utils.getElementText(eElementNetworkKey, "network-role")
- }
- floatingIPKey = key + '_' + networkKey + '_floating_ip'
- floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
- if(!floatingIPKeyValue.isEmpty()){
- paramsMap.put("$floatingIPKey", "$floatingIPKeyValue")
- }
- floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
- floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
- if(!floatingIPV6KeyValue.isEmpty()){
- paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue")
- }
- NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
- for(int a = 0; a < networkIpsList.getLength(); a++){
- Node ipAddress = networkIpsList.item(a)
- if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpAddress = (Element) ipAddress
- String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
- if (a != networkIpsList.getLength() - 1) {
- ipAddressValues = sb2.append(ipAddressValue + ",")
- }
- else {
- ipAddressValues = sb2.append(ipAddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}")
- }
- }
-
- paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}")
-
- NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
- String interfaceRoutePrefixValues = sb3.append("[")
-
- for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
- Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
- if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
- String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
- if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
- interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
- }
- if (a != interfaceRoutePrefixesList.getLength() - 1) {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
- }
- else {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
- }
- }
- }
- interfaceRoutePrefixValues = sb3.append("]")
- if (interfaceRoutePrefixesList.getLength() > 0) {
- paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}")
- }
-
- NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
- for(int a = 0; a < networkIpsV6List.getLength(); a++){
- Node ipV6Address = networkIpsV6List.item(a)
- if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpV6Address = (Element) ipV6Address
- String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
- if (a != networkIpsV6List.getLength() - 1) {
- ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
- }
- else {
- ipV6AddressValues = sb4.append(ipV6AddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}")
- }
- }
- paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}")
- }
- }
- paramsMap.put("${key}_names", "${values}")
- }
- }
- //SDNC Response Params
- String sdncResponseParams = ""
- List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
- String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
- if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
- // No SDNC params
- }else{
- NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
- paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
- }
- }
- }
-
- // Parameters received from the request should overwrite any parameters received from SDNC
- if (vnfParamsMap != null) {
- for (Map.Entry<String, String> entry : vnfParamsMap.entrySet()) {
- String vnfKey = entry.getKey()
- String vnfValue = entry.getValue()
- paramsMap.put("$vnfKey", "$vnfValue")
- }
- }
-
- StringBuilder sbParams = new StringBuilder()
- def vfModuleParams = ""
- for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
- String paramsXml
- String paramName = entry.getKey()
- String paramValue = entry.getValue()
- paramsXml =
- """<entry>
+ entries = entries + entry
+ }
+ }
+ } catch (Exception e) {
+ logger.warn(Strings.repeat("{} ", 5), MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ 'Exception transforming params to entries', "BPMN",
+ ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
+ }
+ return entries
+ }
+
+ /*
+ * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response
+ * and puts them into the format expected by VNF adapter.
+ * @param vnfParamsMap - map of VNF parameters passed in the request body
+ * @param sdncGetResponse - response string from SDNC GET topology request
+ * @param vnfId
+ * @param vnfName
+ * @param vfModuleId
+ * @param vfModuleName
+ * @param vfModuleIndex - can be null
+ * @return a String of key/value entries for vfModuleParams
+ */
+
+
+ protected String buildVfModuleParams(Map<String, String> vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName,
+ String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) {
+
+ //Get SDNC Response Data
+
+ String data = utils.getNodeXml(sdncGetResponse, "response-data")
+
+ String serviceData = utils.getNodeXml(data, "service-data")
+ serviceData = utils.removeXmlPreamble(serviceData)
+ serviceData = utils.removeXmlNamespaces(serviceData)
+ String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information")
+ String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id")
+ oldVnfId = utils.removeXmlPreamble(oldVnfId)
+ oldVnfId = utils.removeXmlNamespaces(oldVnfId)
+ serviceData = serviceData.replace(oldVnfId, "")
+ def vnfId1 = utils.getNodeText(serviceData, "vnf-id")
+
+ Map<String, String> paramsMap = new HashMap<String, String>()
+
+ if (vfModuleIndex != null) {
+ paramsMap.put("vf_module_index", "${vfModuleIndex}")
+ }
+
+ // Add-on data
+ paramsMap.put("vnf_id", "${vnfId}")
+ paramsMap.put("vnf_name", "${vnfName}")
+ paramsMap.put("vf_module_id", "${vfModuleId}")
+ paramsMap.put("vf_module_name", "${vfModuleName}")
+ paramsMap.put("environment_context", "${environmentContext}")
+ paramsMap.put("workload_context", "${workloadContext}")
+
+ InputSource source = new InputSource(new StringReader(data));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document responseXml = docBuilder.parse(source)
+
+
+ // Availability Zones Data
+
+ NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
+ String aZonePosition = "0"
+ for (int z = 0; z < aZonesList.getLength(); z++) {
+ Node node = aZonesList.item(z)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String aZoneValue = utils.getElementText(eElement, "availability-zone")
+ aZonePosition = z.toString()
+ paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
+ }
+ }
+
+ // Map of network-roles and network-tags from vm-networks
+
+ NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks")
+ Map<String, String> networkRoleMap = new HashMap<String, String>()
+ for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
+ Node nodeNetworkKey = vmNetworksListGlobal.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
+ String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkRoleValue.isEmpty()) {
+ networkRoleValue = networkRole
+ }
+ networkRoleMap.put(networkRole, networkRoleValue)
+ }
+ }
+
+ // VNF Networks Data
+
+ StringBuilder sbNet = new StringBuilder()
+
+ NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
+ for (int x = 0; x < vnfNetworkList.getLength(); x++) {
+ Node node = vnfNetworkList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
+ String networkRole = utils.getElementText(eElement, "network-role")
+ if (vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRoleMap.get(networkRole)
+ if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRole
+ }
+ }
+ String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
+ String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
+ String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
+ String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
+ String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
+ paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}")
+ paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}")
+ paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}")
+ paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}")
+ paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}")
+
+ NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
+ StringBuffer sriovFilterBuf = new StringBuffer()
+ String values = ""
+ for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
+ Node node1 = sriovVlanFilterList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ String value = utils.getElementText(eElement1, "sriov-vlan-filter")
+ if (i != sriovVlanFilterList.getLength() - 1) {
+ values = sriovFilterBuf.append(value + ",")
+ }
+ else {
+ values = sriovFilterBuf.append(value);
+ }
+ }
+ }
+ if (!values.isEmpty()) {
+ paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}")
+ }
+ }
+ }
+
+ // VNF-VMS Data
+
+ def key
+ def value
+ def networkKey
+ def networkValue
+ def floatingIPKey
+ def floatingIPKeyValue
+ def floatingIPV6Key
+ def floatingIPV6KeyValue
+ StringBuilder sb = new StringBuilder()
+
+ NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
+ for (int x = 0; x < vmsList.getLength(); x++) {
+ Node node = vmsList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ key = utils.getElementText(eElement, "vm-type")
+ String values
+ String position = "0"
+ StringBuilder sb1 = new StringBuilder()
+ NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
+ NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
+ for(int i = 0; i < valueList.getLength(); i++){
+ Node node1 = valueList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ value = utils.getElementText(eElement1, "vm-name")
+ if (i != valueList.getLength() - 1) {
+ values = sb1.append(value + ",")
+ }
+ else {
+ values = sb1.append(value);
+ }
+ position = i.toString()
+ paramsMap.put("${key}_name_${position}", "${value}")
+ }
+ }
+ for(int n = 0; n < vmNetworksList.getLength(); n++){
+ String floatingIpKeyValueStr = ""
+ String floatingIpV6KeyValueStr = ""
+ Node nodeNetworkKey = vmNetworksList.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String ipAddressValues
+ String ipV6AddressValues
+ String networkPosition = "0"
+ StringBuilder sb2 = new StringBuilder()
+ StringBuilder sb3 = new StringBuilder()
+ StringBuilder sb4 = new StringBuilder()
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkKey.isEmpty()) {
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role")
+ }
+ floatingIPKey = key + '_' + networkKey + '_floating_ip'
+ floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
+ if(!floatingIPKeyValue.isEmpty()){
+ paramsMap.put("$floatingIPKey", "$floatingIPKeyValue")
+ }
+ floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
+ floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
+ if(!floatingIPV6KeyValue.isEmpty()){
+ paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue")
+ }
+ NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
+ for(int a = 0; a < networkIpsList.getLength(); a++){
+ Node ipAddress = networkIpsList.item(a)
+ if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpAddress = (Element) ipAddress
+ String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
+ if (a != networkIpsList.getLength() - 1) {
+ ipAddressValues = sb2.append(ipAddressValue + ",")
+ }
+ else {
+ ipAddressValues = sb2.append(ipAddressValue);
+ }
+ networkPosition = a.toString()
+ paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}")
+ }
+ }
+
+ paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}")
+
+ NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
+ String interfaceRoutePrefixValues = sb3.append("[")
+
+ for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
+ Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
+ if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
+ String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
+ if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
+ interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
+ }
+ if (a != interfaceRoutePrefixesList.getLength() - 1) {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
+ }
+ else {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
+ }
+ }
+ }
+ interfaceRoutePrefixValues = sb3.append("]")
+ if (interfaceRoutePrefixesList.getLength() > 0) {
+ paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}")
+ }
+
+ NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
+ for(int a = 0; a < networkIpsV6List.getLength(); a++){
+ Node ipV6Address = networkIpsV6List.item(a)
+ if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpV6Address = (Element) ipV6Address
+ String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
+ if (a != networkIpsV6List.getLength() - 1) {
+ ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
+ }
+ else {
+ ipV6AddressValues = sb4.append(ipV6AddressValue);
+ }
+ networkPosition = a.toString()
+ paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}")
+ }
+ }
+ paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}")
+ }
+ }
+ paramsMap.put("${key}_names", "${values}")
+ }
+ }
+ //SDNC Response Params
+ String sdncResponseParams = ""
+ List<String> sdncResponseParamsToSkip = [
+ "vnf_id",
+ "vf_module_id",
+ "vnf_name",
+ "vf_module_name"
+ ]
+ String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
+ if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
+ // No SDNC params
+ }else{
+ NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
+ for (int z = 0; z < paramsList.getLength(); z++) {
+ Node node = paramsList.item(z)
+ Element eElement = (Element) node
+ String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
+ if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
+ String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
+ paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
+ }
+ }
+ }
+
+ // make the sdnc_directives parameter
+ String sdncDirectives = "{}"
+ StringBuilder sdncDirectivesBuilder = new StringBuilder()
+ sdncDirectivesBuilder.append("{ \"attributes\": [")
+ int pcnt = 0
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String attributeName = entry.getKey()
+ String attributeValue = entry.getValue()
+ if (pcnt > 0) {
+ sdncDirectivesBuilder.append(",")
+ }
+ pcnt++
+ sdncDirectivesBuilder.append("{\"attribute_name\":\"${attributeName}\",")
+ sdncDirectivesBuilder.append("\"attribute_value\":\"${attributeValue}\"}")
+ }
+ if (pcnt > 0) {
+ sdncDirectives = sdncDirectivesBuilder.append("]}").toString()
+ }
+ paramsMap.put("sdnc_directives", "${sdncDirectives}")
+
+ // Parameters received from the request should overwrite any parameters received from SDNC
+ // Also build the user_directives parameter
+ String userDirectives = "{}"
+ if (vnfParamsMap != null) {
+ StringBuilder userDirectivesBuilder = new StringBuilder()
+ userDirectivesBuilder.append("{ \"attributes\": [")
+ pcnt = 0
+ for (Map.Entry<String, String> entry : vnfParamsMap.entrySet()) {
+ String vnfKey = entry.getKey()
+ String vnfValue = entry.getValue()
+ paramsMap.put("$vnfKey", "$vnfValue")
+ if (!"oof_directives".equals(vnfKey)) {
+ if (pcnt > 0) {
+ userDirectivesBuilder.append(",")
+ }
+ pcnt++
+ userDirectivesBuilder.append("{\"attribute_name\":\"${vnfKey}\",")
+ userDirectivesBuilder.append("\"attribute_value\":\"${vnfValue}\"}")
+ }
+ }
+ if (pcnt > 0) {
+ userDirectives = userDirectivesBuilder.append("]}").toString()
+ }
+ }
+ paramsMap.put("user_directives", "${userDirectives}")
+
+ StringBuilder sbParams = new StringBuilder()
+ def vfModuleParams = ""
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String paramsXml
+ String paramName = entry.getKey()
+ String paramValue = entry.getValue()
+ paramsXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(paramName)}</key>
<value>${MsoUtils.xmlEscape(paramValue)}</value>
</entry>
"""
-
- vfModuleParams = sbParams.append(paramsXml)
- }
-
- return vfModuleParams
-
- }
-
-
- /*
- * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response
- * for both VNF and VF Module
- * and puts them into the format expected by VNF adapter.
- * @param vnfParamsMap - map of VNF parameters passed in the request body
- * @param vnfSdncGetResponse - response string from SDNC GET VNF topology request
- * @param vfmoduleSdncGetResponse - response string from SDNC GET VF Module topology request
- * @param vnfId
- * @param vnfName
- * @param vfModuleId
- * @param vfModuleName
- * @param vfModuleIndex - can be null
- * @return a String of key/value entries for vfModuleParams
- */
-
- protected String buildVfModuleParamsFromCombinedTopologies(Map<String, String> vnfParamsMap, String vnfSdncGetResponse, String vfmoduleSdncGetResponse, String vnfId, String vnfName,
- String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) {
-
- // Set up initial parameters
-
- Map<String, String> paramsMap = new HashMap<String, String>()
-
- if (vfModuleIndex != null) {
- paramsMap.put("vf_module_index", "${vfModuleIndex}")
- }
-
- // Add-on data
- paramsMap.put("vnf_id", "${vnfId}")
- paramsMap.put("vnf_name", "${vnfName}")
- paramsMap.put("vf_module_id", "${vfModuleId}")
- paramsMap.put("vf_module_name", "${vfModuleName}")
- paramsMap.put("environment_context","${environmentContext}")
- paramsMap.put("workload_context", "${workloadContext}")
-
- //Get SDNC Response Data for VNF
-
- String vnfData = utils.getNodeXml(vnfSdncGetResponse, "response-data")
-
- String vnfTopology = utils.getNodeXml(vnfData, "vnf-topology")
- vnfTopology = utils.removeXmlPreamble(vnfTopology)
- vnfTopology = utils.removeXmlNamespaces(vnfTopology)
-
- InputSource sourceVnf = new InputSource(new StringReader(vnfData));
- DocumentBuilderFactory docFactoryVnf = DocumentBuilderFactory.newInstance();
- docFactoryVnf.setNamespaceAware(true)
- DocumentBuilder docBuilderVnf = docFactoryVnf.newDocumentBuilder()
- Document responseXmlVnf = docBuilderVnf.parse(sourceVnf)
-
- // Availability Zones Data
-
- NodeList aZonesList = responseXmlVnf.getElementsByTagNameNS("*", "availability-zones")
- String aZonePosition = "0"
- for (int z = 0; z < aZonesList.getLength(); z++) {
- Node node = aZonesList.item(z)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String aZoneValue = utils.getElementText(eElement, "availability-zone")
- aZonePosition = z.toString()
- paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
- }
- }
-
- //Get SDNC Response Data for VF Module
-
- String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data")
-
- String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology")
- vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology)
- vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology)
- String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier")
-
- InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData));
- DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance();
- docFactoryVfModule.setNamespaceAware(true)
- DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder()
- Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule)
-
- // Map of network-roles and network-tags from vm-networks
-
- NodeList vmNetworksListGlobal = responseXmlVfModule.getElementsByTagNameNS("*", "vm-networks")
- Map<String, String> networkRoleMap = new HashMap<String, String>()
- for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
- Node nodeNetworkKey = vmNetworksListGlobal.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
- String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkRoleValue.isEmpty()) {
- networkRoleValue = networkRole
- }
- networkRoleMap.put(networkRole, networkRoleValue)
- }
- }
-
- // VNF Networks Data
-
- StringBuilder sbNet = new StringBuilder()
-
- NodeList vnfNetworkList = responseXmlVnf.getElementsByTagNameNS("*", "vnf-networks")
- for (int x = 0; x < vnfNetworkList.getLength(); x++) {
- Node node = vnfNetworkList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
- String networkRole = utils.getElementText(eElement, "network-role")
- if (vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRoleMap.get(networkRole)
- if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRole
- }
- }
- String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
- String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
- String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
- String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
- String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
- paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}")
- paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}")
-
- NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
- StringBuffer sriovFilterBuf = new StringBuffer()
- String values = ""
- for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
- Node node1 = sriovVlanFilterList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- String value = utils.getElementText(eElement1, "sriov-vlan-filter")
- if (i != sriovVlanFilterList.getLength() - 1) {
- values = sriovFilterBuf.append(value + ",")
- }
- else {
- values = sriovFilterBuf.append(value);
- }
- }
- }
- if (!values.isEmpty()) {
- paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}")
- }
- }
- }
-
-
-
- // VMS Data
-
- def key
- def value
- def networkKey
- def networkValue
- def floatingIPKey
- def floatingIPKeyValue
- def floatingIPV6Key
- def floatingIPV6KeyValue
- StringBuilder sb = new StringBuilder()
-
- NodeList vmsList = responseXmlVfModule.getElementsByTagNameNS("*","vm")
- for (int x = 0; x < vmsList.getLength(); x++) {
- Node node = vmsList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- key = utils.getElementText(eElement, "vm-type")
- String values
- String position = "0"
- StringBuilder sb1 = new StringBuilder()
- NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
- NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
- for(int i = 0; i < valueList.getLength(); i++){
- Node node1 = valueList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- value = utils.getElementText(eElement1, "vm-name")
- if (i != valueList.getLength() - 1) {
- values = sb1.append(value + ",")
- }
- else {
- values = sb1.append(value);
- }
- position = i.toString()
- paramsMap.put("${key}_name_${position}", "${value}")
- }
- }
- for(int n = 0; n < vmNetworksList.getLength(); n++){
- String floatingIpKeyValueStr = ""
- String floatingIpV6KeyValueStr = ""
- Node nodeNetworkKey = vmNetworksList.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String ipAddressValues
- String ipV6AddressValues
- String networkPosition = "0"
- StringBuilder sb2 = new StringBuilder()
- StringBuilder sb3 = new StringBuilder()
- StringBuilder sb4 = new StringBuilder()
- networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkKey.isEmpty()) {
- networkKey = utils.getElementText(eElementNetworkKey, "network-role")
- }
- floatingIPKey = key + '_' + networkKey + '_floating_ip'
- floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
- if(!floatingIPKeyValue.isEmpty()){
- paramsMap.put("$floatingIPKey", "$floatingIPKeyValue")
- }
- floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
- floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
- if(!floatingIPV6KeyValue.isEmpty()){
- paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue")
- }
- NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
- for(int a = 0; a < networkIpsList.getLength(); a++){
- Node ipAddress = networkIpsList.item(a)
- if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpAddress = (Element) ipAddress
- String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
- if (a != networkIpsList.getLength() - 1) {
- ipAddressValues = sb2.append(ipAddressValue + ",")
- }
- else {
- ipAddressValues = sb2.append(ipAddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}")
- }
- }
-
- paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}")
-
- NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
- String interfaceRoutePrefixValues = sb3.append("[")
-
- for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
- Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
- if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
- String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
- if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
- interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
- }
- if (a != interfaceRoutePrefixesList.getLength() - 1) {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
- }
- else {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
- }
- }
- }
- interfaceRoutePrefixValues = sb3.append("]")
- if (interfaceRoutePrefixesList.getLength() > 0) {
- paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}")
- }
-
- NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
- for(int a = 0; a < networkIpsV6List.getLength(); a++){
- Node ipV6Address = networkIpsV6List.item(a)
- if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpV6Address = (Element) ipV6Address
- String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
- if (a != networkIpsV6List.getLength() - 1) {
- ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
- }
- else {
- ipV6AddressValues = sb4.append(ipV6AddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}")
- }
- }
- paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}")
- }
- }
- paramsMap.put("${key}_names", "${values}")
- }
- }
- //SDNC Response Params
- List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
-
- String vnfParamsChildNodes = utils.getChildNodes(vnfData, "param")
- if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
- // No SDNC params for VNF
- }else{
- NodeList paramsList = responseXmlVnf.getElementsByTagNameNS("*", "param")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "value")
- paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
- }
- }
- }
-
- String vfModuleParamsChildNodes = utils.getChildNodes(vfModuleData, "param")
- if(vfModuleParamsChildNodes == null || vfModuleParamsChildNodes.length() < 1){
- // No SDNC params for VF Module
- }else{
- NodeList paramsList = responseXmlVfModule.getElementsByTagNameNS("*", "param")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "value")
- paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
- }
- }
- }
-
- // Parameters received from the request should overwrite any parameters received from SDNC
- if (vnfParamsMap != null) {
- for (Map.Entry<String, String> entry : vnfParamsMap.entrySet()) {
- String vnfKey = entry.getKey()
- String vnfValue = entry.getValue()
- paramsMap.put("$vnfKey", "$vnfValue")
- }
- }
-
- StringBuilder sbParams = new StringBuilder()
- def vfModuleParams = ""
- for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
- String paramsXml
- String paramName = entry.getKey()
- String paramValue = entry.getValue()
- paramsXml =
- """<entry>
+
+ vfModuleParams = sbParams.append(paramsXml)
+ }
+
+ return vfModuleParams
+
+ }
+
+
+ /*
+ * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response
+ * for both VNF and VF Module
+ * and puts them into the format expected by VNF adapter.
+ * @param vnfParamsMap - map of VNF parameters passed in the request body
+ * @param vnfSdncGetResponse - response string from SDNC GET VNF topology request
+ * @param vfmoduleSdncGetResponse - response string from SDNC GET VF Module topology request
+ * @param vnfId
+ * @param vnfName
+ * @param vfModuleId
+ * @param vfModuleName
+ * @param vfModuleIndex - can be null
+ * @return a String of key/value entries for vfModuleParams
+ */
+
+ protected String buildVfModuleParamsFromCombinedTopologies(Map<String, String> vnfParamsMap, String vnfSdncGetResponse, String vfmoduleSdncGetResponse, String vnfId, String vnfName,
+ String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) {
+
+ // Set up initial parameters
+
+ Map<String, String> paramsMap = new HashMap<String, String>()
+
+ if (vfModuleIndex != null) {
+ paramsMap.put("vf_module_index", "${vfModuleIndex}")
+ }
+
+ // Add-on data
+ paramsMap.put("vnf_id", "${vnfId}")
+ paramsMap.put("vnf_name", "${vnfName}")
+ paramsMap.put("vf_module_id", "${vfModuleId}")
+ paramsMap.put("vf_module_name", "${vfModuleName}")
+ paramsMap.put("environment_context","${environmentContext}")
+ paramsMap.put("workload_context", "${workloadContext}")
+
+ //Get SDNC Response Data for VNF
+
+ String vnfData = utils.getNodeXml(vnfSdncGetResponse, "response-data")
+
+ String vnfTopology = utils.getNodeXml(vnfData, "vnf-topology")
+ vnfTopology = utils.removeXmlPreamble(vnfTopology)
+ vnfTopology = utils.removeXmlNamespaces(vnfTopology)
+
+ InputSource sourceVnf = new InputSource(new StringReader(vnfData));
+ DocumentBuilderFactory docFactoryVnf = DocumentBuilderFactory.newInstance();
+ docFactoryVnf.setNamespaceAware(true)
+ DocumentBuilder docBuilderVnf = docFactoryVnf.newDocumentBuilder()
+ Document responseXmlVnf = docBuilderVnf.parse(sourceVnf)
+
+ // Availability Zones Data
+
+ NodeList aZonesList = responseXmlVnf.getElementsByTagNameNS("*", "availability-zones")
+ String aZonePosition = "0"
+ for (int z = 0; z < aZonesList.getLength(); z++) {
+ Node node = aZonesList.item(z)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String aZoneValue = utils.getElementText(eElement, "availability-zone")
+ aZonePosition = z.toString()
+ paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
+ }
+ }
+
+ //Get SDNC Response Data for VF Module
+
+ String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data")
+
+ String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology")
+ vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology)
+ vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology)
+ String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier")
+
+ InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData));
+ DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance();
+ docFactoryVfModule.setNamespaceAware(true)
+ DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder()
+ Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule)
+
+ // Map of network-roles and network-tags from vm-networks
+
+ NodeList vmNetworksListGlobal = responseXmlVfModule.getElementsByTagNameNS("*", "vm-networks")
+ Map<String, String> networkRoleMap = new HashMap<String, String>()
+ for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
+ Node nodeNetworkKey = vmNetworksListGlobal.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
+ String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkRoleValue.isEmpty()) {
+ networkRoleValue = networkRole
+ }
+ networkRoleMap.put(networkRole, networkRoleValue)
+ }
+ }
+
+ // VNF Networks Data
+
+ StringBuilder sbNet = new StringBuilder()
+
+ NodeList vnfNetworkList = responseXmlVnf.getElementsByTagNameNS("*", "vnf-networks")
+ for (int x = 0; x < vnfNetworkList.getLength(); x++) {
+ Node node = vnfNetworkList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
+ String networkRole = utils.getElementText(eElement, "network-role")
+ if (vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRoleMap.get(networkRole)
+ if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRole
+ }
+ }
+ String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
+ String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
+ String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
+ String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
+ String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
+ paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}")
+ paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}")
+ paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}")
+ paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}")
+ paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}")
+
+ NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
+ StringBuffer sriovFilterBuf = new StringBuffer()
+ String values = ""
+ for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
+ Node node1 = sriovVlanFilterList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ String value = utils.getElementText(eElement1, "sriov-vlan-filter")
+ if (i != sriovVlanFilterList.getLength() - 1) {
+ values = sriovFilterBuf.append(value + ",")
+ }
+ else {
+ values = sriovFilterBuf.append(value);
+ }
+ }
+ }
+ if (!values.isEmpty()) {
+ paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}")
+ }
+ }
+ }
+
+
+
+ // VMS Data
+
+ def key
+ def value
+ def networkKey
+ def networkValue
+ def floatingIPKey
+ def floatingIPKeyValue
+ def floatingIPV6Key
+ def floatingIPV6KeyValue
+ StringBuilder sb = new StringBuilder()
+
+ NodeList vmsList = responseXmlVfModule.getElementsByTagNameNS("*","vm")
+ for (int x = 0; x < vmsList.getLength(); x++) {
+ Node node = vmsList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ key = utils.getElementText(eElement, "vm-type")
+ String values
+ String position = "0"
+ StringBuilder sb1 = new StringBuilder()
+ NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
+ NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
+ for(int i = 0; i < valueList.getLength(); i++){
+ Node node1 = valueList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ value = utils.getElementText(eElement1, "vm-name")
+ if (i != valueList.getLength() - 1) {
+ values = sb1.append(value + ",")
+ }
+ else {
+ values = sb1.append(value);
+ }
+ position = i.toString()
+ paramsMap.put("${key}_name_${position}", "${value}")
+ }
+ }
+ for(int n = 0; n < vmNetworksList.getLength(); n++){
+ String floatingIpKeyValueStr = ""
+ String floatingIpV6KeyValueStr = ""
+ Node nodeNetworkKey = vmNetworksList.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String ipAddressValues
+ String ipV6AddressValues
+ String networkPosition = "0"
+ StringBuilder sb2 = new StringBuilder()
+ StringBuilder sb3 = new StringBuilder()
+ StringBuilder sb4 = new StringBuilder()
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkKey.isEmpty()) {
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role")
+ }
+ floatingIPKey = key + '_' + networkKey + '_floating_ip'
+ floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
+ if(!floatingIPKeyValue.isEmpty()){
+ paramsMap.put("$floatingIPKey", "$floatingIPKeyValue")
+ }
+ floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
+ floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
+ if(!floatingIPV6KeyValue.isEmpty()){
+ paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue")
+ }
+ NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
+ for(int a = 0; a < networkIpsList.getLength(); a++){
+ Node ipAddress = networkIpsList.item(a)
+ if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpAddress = (Element) ipAddress
+ String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
+ if (a != networkIpsList.getLength() - 1) {
+ ipAddressValues = sb2.append(ipAddressValue + ",")
+ }
+ else {
+ ipAddressValues = sb2.append(ipAddressValue);
+ }
+ networkPosition = a.toString()
+ paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}")
+ }
+ }
+
+ paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}")
+
+ NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
+ String interfaceRoutePrefixValues = sb3.append("[")
+
+ for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
+ Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
+ if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
+ String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
+ if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
+ interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
+ }
+ if (a != interfaceRoutePrefixesList.getLength() - 1) {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
+ }
+ else {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
+ }
+ }
+ }
+ interfaceRoutePrefixValues = sb3.append("]")
+ if (interfaceRoutePrefixesList.getLength() > 0) {
+ paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}")
+ }
+
+ NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
+ for(int a = 0; a < networkIpsV6List.getLength(); a++){
+ Node ipV6Address = networkIpsV6List.item(a)
+ if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpV6Address = (Element) ipV6Address
+ String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
+ if (a != networkIpsV6List.getLength() - 1) {
+ ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
+ }
+ else {
+ ipV6AddressValues = sb4.append(ipV6AddressValue);
+ }
+ networkPosition = a.toString()
+ paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}")
+ }
+ }
+ paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}")
+ }
+ }
+ paramsMap.put("${key}_names", "${values}")
+ }
+ }
+ //SDNC Response Params
+ List<String> sdncResponseParamsToSkip = [
+ "vnf_id",
+ "vf_module_id",
+ "vnf_name",
+ "vf_module_name"
+ ]
+
+ String vnfParamsChildNodes = utils.getChildNodes(vnfData, "param")
+ if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
+ // No SDNC params for VNF
+ }else{
+ NodeList paramsList = responseXmlVnf.getElementsByTagNameNS("*", "param")
+ for (int z = 0; z < paramsList.getLength(); z++) {
+ Node node = paramsList.item(z)
+ Element eElement = (Element) node
+ String vnfParameterName = utils.getElementText(eElement, "name")
+ if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
+ String vnfParameterValue = utils.getElementText(eElement, "value")
+ paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
+ }
+ }
+ }
+
+ String vfModuleParamsChildNodes = utils.getChildNodes(vfModuleData, "param")
+ if(vfModuleParamsChildNodes == null || vfModuleParamsChildNodes.length() < 1){
+ // No SDNC params for VF Module
+ }else{
+ NodeList paramsList = responseXmlVfModule.getElementsByTagNameNS("*", "param")
+ for (int z = 0; z < paramsList.getLength(); z++) {
+ Node node = paramsList.item(z)
+ Element eElement = (Element) node
+ String vnfParameterName = utils.getElementText(eElement, "name")
+ if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
+ String vnfParameterValue = utils.getElementText(eElement, "value")
+ paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
+ }
+ }
+ }
+
+ // make the sdnc_directives parameter
+ String sdncDirectives = "{}"
+ StringBuilder sdncDirectivesBuilder = new StringBuilder()
+ sdncDirectivesBuilder.append("{ \"attributes\": [")
+ int pcnt = 0
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String attributeName = entry.getKey()
+ String attributeValue = entry.getValue()
+ if (pcnt > 0) {
+ sdncDirectivesBuilder.append(",")
+ }
+ pcnt++
+ sdncDirectivesBuilder.append("{\"attribute_name\":\"${attributeName}\",")
+ sdncDirectivesBuilder.append("\"attribute_value\":\"${attributeValue}\"}")
+ }
+ if (pcnt > 0) {
+ sdncDirectives = sdncDirectivesBuilder.append("]}").toString()
+ }
+ paramsMap.put("sdnc_directives", "${sdncDirectives}")
+
+
+ // Parameters received from the request should overwrite any parameters received from SDNC
+ String userDirectives = "{}"
+ if (vnfParamsMap != null) {
+ StringBuilder userDirectivesBuilder = new StringBuilder()
+ userDirectivesBuilder.append("{ \"attributes\": [")
+ pcnt = 0
+ for (Map.Entry<String, String> entry : vnfParamsMap.entrySet()) {
+ String vnfKey = entry.getKey()
+ String vnfValue = entry.getValue()
+ paramsMap.put("$vnfKey", "$vnfValue")
+ if (pcnt > 0) {
+ userDirectivesBuilder.append(",")
+ }
+ pcnt++
+ userDirectivesBuilder.append("{\"attribute_name\":\"${vnfKey}\",")
+ userDirectivesBuilder.append("\"attribute_value\":\"${vnfValue}\"}")
+ }
+ if (pcnt > 0) {
+ userDirectives = userDirectivesBuilder.append("]}").toString()
+ }
+ }
+ paramsMap.put("user_directives", "${userDirectives}")
+
+ StringBuilder sbParams = new StringBuilder()
+ def vfModuleParams = ""
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String paramsXml
+ String paramName = entry.getKey()
+ String paramValue = entry.getValue()
+ paramsXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(paramName)}</key>
<value>${MsoUtils.xmlEscape(paramValue)}</value>
</entry>
"""
-
- vfModuleParams = sbParams.append(paramsXml)
- }
-
- return vfModuleParams
-
- }
-
-
- /*
- * VBNG specific method that parses VNF parameters passed in on the
- * incoming requests and SDNC parameters returned from SDNC get response
- * and puts them into the format expected by VNF adapter.
- * @param vnfParamsMap - map of VNF parameters passed in the request body
- * @param sdncGetResponse - response string from SDNC GET topology request
- * @param vnfId
- * @param vnfName
- * @param vfModuleId
- * @param vfModuleName
- * @return a String of key/value entries for vfModuleParams
- */
-
- protected String buildVfModuleParamsVbng(String vnfParams, String sdncGetResponse, String vnfId, String vnfName,
- String vfModuleId, String vfModuleName) {
-
- //Get SDNC Response Data
-
- String data = utils.getNodeXml(sdncGetResponse, "response-data")
-
-
-
- // Add-on data
- String vnfInfo =
- """<entry>
+
+ vfModuleParams = sbParams.append(paramsXml)
+ }
+
+ return vfModuleParams
+
+ }
+
+
+ /*
+ * VBNG specific method that parses VNF parameters passed in on the
+ * incoming requests and SDNC parameters returned from SDNC get response
+ * and puts them into the format expected by VNF adapter.
+ * @param vnfParamsMap - map of VNF parameters passed in the request body
+ * @param sdncGetResponse - response string from SDNC GET topology request
+ * @param vnfId
+ * @param vnfName
+ * @param vfModuleId
+ * @param vfModuleName
+ * @return a String of key/value entries for vfModuleParams
+ */
+
+ protected String buildVfModuleParamsVbng(String vnfParams, String sdncGetResponse, String vnfId, String vnfName,
+ String vfModuleId, String vfModuleName) {
+
+ //Get SDNC Response Data
+
+ String data = utils.getNodeXml(sdncGetResponse, "response-data")
+
+
+
+ // Add-on data
+ String vnfInfo =
+ """<entry>
<key>vnf_id</key>
<value>${MsoUtils.xmlEscape(vnfId)}</value>
</entry>
@@ -890,347 +977,352 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
<value>${MsoUtils.xmlEscape(vfModuleName)}</value>
</entry>"""
- logger.debug("vnfInfo: " + vnfInfo)
- InputSource source = new InputSource(new StringReader(data));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document responseXml = docBuilder.parse(source)
-
-
- // Availability Zones Data
- String aZones = ""
- StringBuilder sbAZone = new StringBuilder()
- NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
- String aZonePosition = "0"
- for (int z = 0; z < aZonesList.getLength(); z++) {
- Node node = aZonesList.item(z)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String aZoneValue = utils.getElementText(eElement, "availability-zone")
- aZonePosition = z.toString()
- String aZoneXml =
- """<entry>
+ logger.debug("vnfInfo: " + vnfInfo)
+ InputSource source = new InputSource(new StringReader(data));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document responseXml = docBuilder.parse(source)
+
+
+ // Availability Zones Data
+ String aZones = ""
+ StringBuilder sbAZone = new StringBuilder()
+ NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
+ String aZonePosition = "0"
+ for (int z = 0; z < aZonesList.getLength(); z++) {
+ Node node = aZonesList.item(z)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String aZoneValue = utils.getElementText(eElement, "availability-zone")
+ aZonePosition = z.toString()
+ String aZoneXml =
+ """<entry>
<key>availability_zone_${MsoUtils.xmlEscape(aZonePosition)}</key>
<value>${MsoUtils.xmlEscape(aZoneValue)}</value>
</entry>"""
- aZones = sbAZone.append(aZoneXml)
- }
- }
-
- // Map of network-roles and network-tags from vm-networks
-
- NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks")
- Map<String, String> networkRoleMap = new HashMap<String, String>()
- for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
- Node nodeNetworkKey = vmNetworksListGlobal.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
- String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkRoleValue.isEmpty()) {
- networkRoleValue = networkRole
- }
- networkRoleMap.put(networkRole, networkRoleValue)
- }
- }
-
- // VNF Networks Data
- String vnfNetworkNetId = ""
- String vnfNetworkNetName = ""
- String vnfNetworkSubNetId = ""
- String vnfNetworkV6SubNetId = ""
- String vnfNetworkNetFqdn = ""
- String vnfNetworksSriovVlanFilters = ""
- StringBuilder sbNet = new StringBuilder()
- StringBuilder sbNet2 = new StringBuilder()
- StringBuilder sbNet3 = new StringBuilder()
- StringBuilder sbNet4 = new StringBuilder()
- StringBuilder sbNet5 = new StringBuilder()
- StringBuilder sbNet6 = new StringBuilder()
- NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
- for (int x = 0; x < vnfNetworkList.getLength(); x++) {
- Node node = vnfNetworkList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
- String networkRole = utils.getElementText(eElement, "network-role")
- if (vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRoleMap.get(networkRole)
- if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
- vnfNetworkKey = networkRole
- }
- }
- String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
- String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
- String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
- String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
- String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
- String vnfNetworkNetIdXml =
- """<entry>
+ aZones = sbAZone.append(aZoneXml)
+ }
+ }
+
+ // Map of network-roles and network-tags from vm-networks
+
+ NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks")
+ Map<String, String> networkRoleMap = new HashMap<String, String>()
+ for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
+ Node nodeNetworkKey = vmNetworksListGlobal.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
+ String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkRoleValue.isEmpty()) {
+ networkRoleValue = networkRole
+ }
+ networkRoleMap.put(networkRole, networkRoleValue)
+ }
+ }
+
+ // VNF Networks Data
+ String vnfNetworkNetId = ""
+ String vnfNetworkNetName = ""
+ String vnfNetworkSubNetId = ""
+ String vnfNetworkV6SubNetId = ""
+ String vnfNetworkNetFqdn = ""
+ String vnfNetworksSriovVlanFilters = ""
+ StringBuilder sbNet = new StringBuilder()
+ StringBuilder sbNet2 = new StringBuilder()
+ StringBuilder sbNet3 = new StringBuilder()
+ StringBuilder sbNet4 = new StringBuilder()
+ StringBuilder sbNet5 = new StringBuilder()
+ StringBuilder sbNet6 = new StringBuilder()
+ NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
+ for (int x = 0; x < vnfNetworkList.getLength(); x++) {
+ Node node = vnfNetworkList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
+ String networkRole = utils.getElementText(eElement, "network-role")
+ if (vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRoleMap.get(networkRole)
+ if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRole
+ }
+ }
+ String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
+ String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
+ String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
+ String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
+ String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
+ String vnfNetworkNetIdXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(vnfNetworkKey)}_net_id</key>
<value>${MsoUtils.xmlEscape(vnfNetworkNeutronIdValue)}</value>
</entry>"""
- vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml)
- String vnfNetworkNetNameXml =
- """<entry>
+ vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml)
+ String vnfNetworkNetNameXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(vnfNetworkKey)}_net_name</key>
<value>${MsoUtils.xmlEscape(vnfNetworkNetNameValue)}</value>
</entry>"""
- vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml)
- String vnfNetworkSubNetIdXml =
- """<entry>
+ vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml)
+ String vnfNetworkSubNetIdXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(vnfNetworkKey)}_subnet_id</key>
<value>${MsoUtils.xmlEscape(vnfNetworkSubNetIdValue)}</value>
</entry>"""
- vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml)
- String vnfNetworkV6SubNetIdXml =
- """<entry>
+ vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml)
+ String vnfNetworkV6SubNetIdXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(vnfNetworkKey)}_v6_subnet_id</key>
<value>${MsoUtils.xmlEscape(vnfNetworkV6SubNetIdValue)}</value>
</entry>"""
- vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml)
- String vnfNetworkNetFqdnXml =
- """<entry>
+ vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml)
+ String vnfNetworkNetFqdnXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(vnfNetworkKey)}_net_fqdn</key>
<value>${MsoUtils.xmlEscape(vnfNetworkNetFqdnValue)}</value>
</entry>"""
- vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml)
-
- NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
- StringBuffer sriovFilterBuf = new StringBuffer()
- String values = ""
- for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
- Node node1 = sriovVlanFilterList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- String value = utils.getElementText(eElement1, "sriov-vlan-filter")
- if (i != sriovVlanFilterList.getLength() - 1) {
- values = sriovFilterBuf.append(value + ",")
- }
- else {
- values = sriovFilterBuf.append(value);
- }
- }
- }
- if (!values.isEmpty()) {
- String vnfNetworkSriovVlanFilterXml =
- """<entry>
+ vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml)
+
+ NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
+ StringBuffer sriovFilterBuf = new StringBuffer()
+ String values = ""
+ for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
+ Node node1 = sriovVlanFilterList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ String value = utils.getElementText(eElement1, "sriov-vlan-filter")
+ if (i != sriovVlanFilterList.getLength() - 1) {
+ values = sriovFilterBuf.append(value + ",")
+ }
+ else {
+ values = sriovFilterBuf.append(value);
+ }
+ }
+ }
+ if (!values.isEmpty()) {
+ String vnfNetworkSriovVlanFilterXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(vnfNetworkKey)}_ATT_VF_VLAN_FILTER</key>
<value>${MsoUtils.xmlEscape(values)}</value>
</entry>"""
- vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml)
- }
- }
- }
-
- // VNF-VMS Data
- String vnfVMS = ""
- String vnfVMSPositions = ""
- String vmNetworks = ""
- String vmNetworksPositions = ""
- String vmNetworksPositionsV6 = ""
- String interfaceRoutePrefixes = ""
- def key
- def value
- def networkKey
- def networkValue
- def floatingIPKey
- def floatingIPKeyValue
- def floatingIPV6Key
- def floatingIPV6KeyValue
- StringBuilder sb = new StringBuilder()
- StringBuilder sbPositions = new StringBuilder()
- StringBuilder sbVmNetworks = new StringBuilder()
- StringBuilder sbNetworksPositions = new StringBuilder()
- StringBuilder sbInterfaceRoutePrefixes = new StringBuilder()
- StringBuilder sbNetworksPositionsV6 = new StringBuilder()
-
- NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
- for (int x = 0; x < vmsList.getLength(); x++) {
- Node node = vmsList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- key = utils.getElementText(eElement, "vm-type")
- String values
- String position = "0"
- StringBuilder sb1 = new StringBuilder()
- NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
- NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
- for(int i = 0; i < valueList.getLength(); i++){
- Node node1 = valueList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- value = utils.getElementText(eElement1, "vm-name")
- if (i != valueList.getLength() - 1) {
- values = sb1.append(value + ",")
- }
- else {
- values = sb1.append(value);
- }
- position = i.toString()
- String vnfPositionXml =
- """<entry>
+ vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml)
+ }
+ }
+ }
+
+ // VNF-VMS Data
+ String vnfVMS = ""
+ String vnfVMSPositions = ""
+ String vmNetworks = ""
+ String vmNetworksPositions = ""
+ String vmNetworksPositionsV6 = ""
+ String interfaceRoutePrefixes = ""
+ def key
+ def value
+ def networkKey
+ def networkValue
+ def floatingIPKey
+ def floatingIPKeyValue
+ def floatingIPV6Key
+ def floatingIPV6KeyValue
+ StringBuilder sb = new StringBuilder()
+ StringBuilder sbPositions = new StringBuilder()
+ StringBuilder sbVmNetworks = new StringBuilder()
+ StringBuilder sbNetworksPositions = new StringBuilder()
+ StringBuilder sbInterfaceRoutePrefixes = new StringBuilder()
+ StringBuilder sbNetworksPositionsV6 = new StringBuilder()
+
+ NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
+ for (int x = 0; x < vmsList.getLength(); x++) {
+ Node node = vmsList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ key = utils.getElementText(eElement, "vm-type")
+ String values
+ String position = "0"
+ StringBuilder sb1 = new StringBuilder()
+ NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
+ NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
+ for(int i = 0; i < valueList.getLength(); i++){
+ Node node1 = valueList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ value = utils.getElementText(eElement1, "vm-name")
+ if (i != valueList.getLength() - 1) {
+ values = sb1.append(value + ",")
+ }
+ else {
+ values = sb1.append(value);
+ }
+ position = i.toString()
+ String vnfPositionXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(key)}_name_${MsoUtils.xmlEscape(position)}</key>
<value>${MsoUtils.xmlEscape(value)}</value>
</entry>"""
- nfVMSPositions = sbPositions.append(vnfPositionXml)
- }
- }
- for(int n = 0; n < vmNetworksList.getLength(); n++){
- String floatingIpKeyValueStr = ""
- String floatingIpV6KeyValueStr = ""
- Node nodeNetworkKey = vmNetworksList.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String ipAddressValues
- String ipV6AddressValues
- String networkPosition = "0"
- StringBuilder sb2 = new StringBuilder()
- StringBuilder sb3 = new StringBuilder()
- StringBuilder sb4 = new StringBuilder()
- networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
- if (networkKey.isEmpty()) {
- networkKey = utils.getElementText(eElementNetworkKey, "network-role")
- }
- floatingIPKey = key + '_' + networkKey + '_floating_ip'
- floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
- if(!floatingIPKeyValue.isEmpty()){
- floatingIpKeyValueStr = """<entry>
+ nfVMSPositions = sbPositions.append(vnfPositionXml)
+ }
+ }
+ for(int n = 0; n < vmNetworksList.getLength(); n++){
+ String floatingIpKeyValueStr = ""
+ String floatingIpV6KeyValueStr = ""
+ Node nodeNetworkKey = vmNetworksList.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String ipAddressValues
+ String ipV6AddressValues
+ String networkPosition = "0"
+ StringBuilder sb2 = new StringBuilder()
+ StringBuilder sb3 = new StringBuilder()
+ StringBuilder sb4 = new StringBuilder()
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkKey.isEmpty()) {
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role")
+ }
+ floatingIPKey = key + '_' + networkKey + '_floating_ip'
+ floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
+ if(!floatingIPKeyValue.isEmpty()){
+ floatingIpKeyValueStr = """<entry>
<key>$floatingIPKey</key>
<value>$floatingIPKeyValue</value>
</entry>"""
- }
- floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
- floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
- if(!floatingIPV6KeyValue.isEmpty()){
- floatingIpV6KeyValueStr = """<entry>
+ }
+ floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
+ floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
+ if(!floatingIPV6KeyValue.isEmpty()){
+ floatingIpV6KeyValueStr = """<entry>
<key>$floatingIPV6Key</key>
<value>$floatingIPV6KeyValue</value>
</entry>"""
- }
- NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
- for(int a = 0; a < networkIpsList.getLength(); a++){
- Node ipAddress = networkIpsList.item(a)
- if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpAddress = (Element) ipAddress
- String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
- if (a != networkIpsList.getLength() - 1) {
- ipAddressValues = sb2.append(ipAddressValue + ",")
- }
- else {
- ipAddressValues = sb2.append(ipAddressValue);
- }
- networkPosition = a.toString()
- String vmNetworksPositionsXml =
- """<entry>
+ }
+ NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
+ for(int a = 0; a < networkIpsList.getLength(); a++){
+ Node ipAddress = networkIpsList.item(a)
+ if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpAddress = (Element) ipAddress
+ String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
+ if (a != networkIpsList.getLength() - 1) {
+ ipAddressValues = sb2.append(ipAddressValue + ",")
+ }
+ else {
+ ipAddressValues = sb2.append(ipAddressValue);
+ }
+ networkPosition = a.toString()
+ String vmNetworksPositionsXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_ip_${MsoUtils.xmlEscape(networkPosition)}</key>
<value>${MsoUtils.xmlEscape(ipAddressValue)}</value>
</entry>"""
- vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml)
- }
- }
- vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr)
-
- String vmNetworksXml =
- """<entry>
+ vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml)
+ }
+ }
+ vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr)
+
+ String vmNetworksXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_ips</key>
<value>${MsoUtils.xmlEscape(ipAddressValues)}</value>
</entry>"""
- vmNetworks = sbVmNetworks.append(vmNetworksXml)
-
- NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
- String interfaceRoutePrefixValues = sb3.append("[")
-
- for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
- Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
- if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
- String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
- if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
- interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
- }
- if (a != interfaceRoutePrefixesList.getLength() - 1) {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
- }
- else {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
- }
- }
- }
- interfaceRoutePrefixValues = sb3.append("]")
- if (interfaceRoutePrefixesList.getLength() > 0) {
- String interfaceRoutePrefixesXml =
- """<entry>
+ vmNetworks = sbVmNetworks.append(vmNetworksXml)
+
+ NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
+ String interfaceRoutePrefixValues = sb3.append("[")
+
+ for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
+ Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
+ if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
+ String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
+ if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
+ interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
+ }
+ if (a != interfaceRoutePrefixesList.getLength() - 1) {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
+ }
+ else {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
+ }
+ }
+ }
+ interfaceRoutePrefixValues = sb3.append("]")
+ if (interfaceRoutePrefixesList.getLength() > 0) {
+ String interfaceRoutePrefixesXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_route_prefixes</key>
<value>${MsoUtils.xmlEscape(interfaceRoutePrefixValues)}</value>
- </entry>"""
- interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml)
- }
-
- NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
- for(int a = 0; a < networkIpsV6List.getLength(); a++){
- Node ipV6Address = networkIpsV6List.item(a)
- if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpV6Address = (Element) ipV6Address
- String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
- if (a != networkIpsV6List.getLength() - 1) {
- ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
- }
- else {
- ipV6AddressValues = sb4.append(ipV6AddressValue);
- }
- networkPosition = a.toString()
- String vmNetworksPositionsV6Xml =
- """<entry>
+ </entry>"""
+ interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml)
+ }
+
+ NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
+ for(int a = 0; a < networkIpsV6List.getLength(); a++){
+ Node ipV6Address = networkIpsV6List.item(a)
+ if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpV6Address = (Element) ipV6Address
+ String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
+ if (a != networkIpsV6List.getLength() - 1) {
+ ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
+ }
+ else {
+ ipV6AddressValues = sb4.append(ipV6AddressValue);
+ }
+ networkPosition = a.toString()
+ String vmNetworksPositionsV6Xml =
+ """<entry>
<key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_v6_ip_${MsoUtils.xmlEscape(networkPosition)}</key>
<value>${MsoUtils.xmlEscape(ipV6AddressValue)}</value>
</entry>"""
- vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml)
- }
- }
- String vmNetworksV6Xml =
- """<entry>
+ vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml)
+ }
+ }
+ String vmNetworksV6Xml =
+ """<entry>
<key>${MsoUtils.xmlEscape(key)}_${MsoUtils.xmlEscape(networkKey)}_v6_ips</key>
<value>${MsoUtils.xmlEscape(ipV6AddressValues)}</value>
</entry>"""
- vmNetworks = sbVmNetworks.append(vmNetworksV6Xml)
- }
- }
- String vnfXml =
- """<entry>
+ vmNetworks = sbVmNetworks.append(vmNetworksV6Xml)
+ }
+ }
+ String vnfXml =
+ """<entry>
<key>${MsoUtils.xmlEscape(key)}_names</key>
<value>${MsoUtils.xmlEscape(values)}</value>
</entry>"""
- vnfVMS = sb.append(vnfXml)
- }
- }
- //SDNC Response Params
- String sdncResponseParams = ""
- List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
- String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
- if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
- // No SDNC params
- }else{
- NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
- String paraEntry =
- """<entry>
+ vnfVMS = sb.append(vnfXml)
+ }
+ }
+ //SDNC Response Params
+ String sdncResponseParams = ""
+ List<String> sdncResponseParamsToSkip = [
+ "vnf_id",
+ "vf_module_id",
+ "vnf_name",
+ "vf_module_name"
+ ]
+ String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
+ if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
+ // No SDNC params
+ }else{
+ NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
+ for (int z = 0; z < paramsList.getLength(); z++) {
+ Node node = paramsList.item(z)
+ Element eElement = (Element) node
+ String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
+ if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
+ String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
+ String paraEntry =
+ """<entry>
<key>${MsoUtils.xmlEscape(vnfParameterName)}</key>
<value>${MsoUtils.xmlEscape(vnfParameterValue)}</value>
</entry>"""
- sdncResponseParams = sb.append(paraEntry)
- }
- }
- }
-
-
- def vfModuleParams = """
+ sdncResponseParams = sb.append(paraEntry)
+ }
+ }
+ }
+
+
+ def vfModuleParams = """
${vnfInfo}
${aZones}
${vnfNetworkNetId}
@@ -1248,8 +1340,8 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
${vnfParams}
${sdncResponseParams}"""
- return vfModuleParams
+ return vfModuleParams
- }
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java
index 3b768cbc3b..9e9c4b5cfa 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java
@@ -24,11 +24,14 @@ import java.util.Optional;
import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersHealthCheck;
import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersQuiesce;
import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersResumeTraffic;
+import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersDistributeTraffic;
import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersUpgrade;
import org.onap.so.bpmn.appc.payload.beans.HealthCheckAction;
import org.onap.so.bpmn.appc.payload.beans.QuiesceTrafficAction;
import org.onap.so.bpmn.appc.payload.beans.RequestParametersHealthCheck;
import org.onap.so.bpmn.appc.payload.beans.ResumeTrafficAction;
+import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficAction;
+import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficCheckAction;
import org.onap.so.bpmn.appc.payload.beans.SnapshotAction;
import org.onap.so.bpmn.appc.payload.beans.StartStopAction;
import org.onap.so.bpmn.appc.payload.beans.UpgradeAction;
@@ -56,6 +59,38 @@ public class PayloadClient {
return Optional.of(mapper.writeValueAsString(payloadResult));
}
+ public static Optional<String> distributeTrafficFormat(Optional<String> payload, String vnfName)
+ throws JsonProcessingException {
+ DistributeTrafficAction payloadResult = new DistributeTrafficAction();
+ ConfigurationParametersDistributeTraffic configParams = new ConfigurationParametersDistributeTraffic();
+ String payloadString = payload.isPresent() ? payload.get() : "";
+ String bookName = JsonUtils.getJsonValue(payloadString, "book_name");
+ String nodeList = JsonUtils.getJsonValue(payloadString, "node_list");
+ String fileParameterContent = JsonUtils.getJsonValue(payloadString, "file_parameter_content");
+ configParams.setBookName(bookName);
+ configParams.setNodeList(nodeList);
+ configParams.setFileParameterContent(fileParameterContent);
+ configParams.setVnfName(vnfName);
+ payloadResult.setConfigurationParameters(configParams);
+ return Optional.of(mapper.writeValueAsString(payloadResult));
+ }
+
+ public static Optional<String> distributeTrafficCheckFormat(Optional<String> payload, String vnfName)
+ throws JsonProcessingException {
+ DistributeTrafficCheckAction payloadResult = new DistributeTrafficCheckAction();
+ ConfigurationParametersDistributeTraffic configParams = new ConfigurationParametersDistributeTraffic();
+ String payloadString = payload.isPresent() ? payload.get() : "";
+ String bookName = JsonUtils.getJsonValue(payloadString, "book_name");
+ String nodeList = JsonUtils.getJsonValue(payloadString, "node_list");
+ String fileParameterContent = JsonUtils.getJsonValue(payloadString, "file_parameter_content");
+ configParams.setBookName(bookName);
+ configParams.setNodeList(nodeList);
+ configParams.setFileParameterContent(fileParameterContent);
+ configParams.setVnfName(vnfName);
+ payloadResult.setConfigurationParameters(configParams);
+ return Optional.of(mapper.writeValueAsString(payloadResult));
+ }
+
public static Optional<String> resumeTrafficFormat(String vnfName) throws JsonProcessingException {
ResumeTrafficAction payloadResult = new ResumeTrafficAction();
ConfigurationParametersResumeTraffic configParams = new ConfigurationParametersResumeTraffic();
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersDistributeTraffic.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersDistributeTraffic.java
new file mode 100644
index 0000000000..a4ffdbfdba
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigurationParametersDistributeTraffic.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.bpmn.appc.payload.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"vnf_name", "book_name", "node_list", "file_parameter_content"})
+public class ConfigurationParametersDistributeTraffic {
+ @JsonProperty("vnf_name")
+ private String vnfName;
+ @JsonProperty("book_name")
+ private String bookName;
+ @JsonProperty("node_list")
+ private String nodeList;
+ @JsonProperty("file_parameter_content")
+ private String fileParameterContent;
+
+ @JsonProperty("vnf_name")
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ @JsonProperty("vnf_name")
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ @JsonProperty("book_name")
+ public String getBookName() {
+ return bookName;
+ }
+
+ @JsonProperty("book_name")
+ public void setBookName(String bookName) {
+ this.bookName = bookName;
+ }
+
+ @JsonProperty("node_list")
+ public String getNodeList() {
+ return nodeList;
+ }
+
+ @JsonProperty("node_list")
+ public void setNodeList(String nodeList) {
+ this.nodeList = nodeList;
+ }
+
+ @JsonProperty("file_parameter_content")
+ public String getFileParameterContent() {
+ return fileParameterContent;
+ }
+
+ @JsonProperty("file_parameter_content")
+ public void setFileParameterContent(String fileParameterContent) {
+ this.fileParameterContent = fileParameterContent;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficAction.java
new file mode 100644
index 0000000000..9b7856e33f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficAction.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Orange Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.bpmn.appc.payload.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"configuration-parameters"})
+public class DistributeTrafficAction {
+
+ @JsonProperty("configuration-parameters")
+ private ConfigurationParametersDistributeTraffic configurationParameters;
+
+ @JsonProperty("configuration-parameters")
+ public ConfigurationParametersDistributeTraffic getConfigurationParameters() {
+ return configurationParameters;
+ }
+
+ @JsonProperty("configuration-parameters")
+ public void setConfigurationParameters(ConfigurationParametersDistributeTraffic configurationParameters) {
+ this.configurationParameters = configurationParameters;
+ }
+}
+
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficCheckAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficCheckAction.java
new file mode 100644
index 0000000000..b9831a90c4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/DistributeTrafficCheckAction.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Orange Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.bpmn.appc.payload.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"configuration-parameters"})
+public class DistributeTrafficCheckAction {
+
+ @JsonProperty("configuration-parameters")
+ private ConfigurationParametersDistributeTraffic configurationParameters;
+
+ @JsonProperty("configuration-parameters")
+ public ConfigurationParametersDistributeTraffic getConfigurationParameters() {
+ return configurationParameters;
+ }
+
+ @JsonProperty("configuration-parameters")
+ public void setConfigurationParameters(ConfigurationParametersDistributeTraffic configurationParameters) {
+ this.configurationParameters = configurationParameters;
+ }
+}
+
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java
index 14327a3583..a558057979 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoGenericVnf.java
@@ -55,7 +55,26 @@ public class ModelInfoGenericVnf extends ModelInfoMetadata implements Serializab
private String MultiStageDesign;
@JsonProperty("created")
private String Created;
+ @JsonProperty("blueprintName")
+ private String blueprintName;
+ @JsonProperty("blueprintVersion")
+ private String blueprintVersion;
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
public String getToscaNodeType() {
return ToscaNodeType;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 86f7eeb2cd..2fc84b5dde 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -350,7 +350,9 @@ public class BBInputSetupMapperLayer {
public RequestContext mapRequestContext(RequestDetails requestDetails) {
RequestContext context = new RequestContext();
- modelMapper.map(requestDetails.getRequestInfo(), context);
+ if (null != requestDetails.getRequestInfo()) {
+ modelMapper.map(requestDetails.getRequestInfo(), context);
+ }
org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters();
if (null != requestParameters) {
context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
@@ -393,7 +395,11 @@ public class BBInputSetupMapperLayer {
protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) {
OrchestrationContext context = new OrchestrationContext();
- context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback()));
+ if (requestDetails.getRequestInfo() != null) {
+ context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback()));
+ } else {
+ context.setIsRollbackEnabled(false);
+ }
return context;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
index 86bbead9a4..b76316bf0e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
@@ -57,8 +57,13 @@ public class ExtractPojosForBB {
GenericVnf vnf;
switch (key) {
case SERVICE_INSTANCE_ID:
- result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(),
- value);
+ if (gBBInput.getCustomer().getServiceSubscription() == null
+ && gBBInput.getServiceInstance() != null) {
+ result = Optional.of((T) gBBInput.getServiceInstance());
+ } else {
+ result = lookupObjectInList(
+ gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value);
+ }
break;
case GENERIC_VNF_ID:
serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
index eccd81217f..b97b9ac1ca 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
@@ -68,6 +68,12 @@ public class ApplicationControllerAction {
case QuiesceTraffic:
appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType);
break;
+ case DistributeTraffic:
+ appCStatus = distributeTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType);
+ break;
+ case DistributeTrafficCheck:
+ appCStatus = distributeTrafficCheckAction(msoRequestId, vnfId, payload, vnfName, controllerType);
+ break;
case HealthCheck:
appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType);
break;
@@ -91,8 +97,6 @@ public class ApplicationControllerAction {
break;
case ConfigModify:
case ConfigScaleOut:
- case DistributeTraffic:
- case DistributeTrafficCheck:
appCStatus = payloadAction(action, msoRequestId, vnfId, payload, controllerType);
break;
case UpgradePreCheck:
@@ -158,6 +162,29 @@ public class ApplicationControllerAction {
return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType);
}
+ private Status distributeTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName,
+ String controllerType)
+ throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException {
+ if (!(payload.isPresent())) {
+ throw new IllegalArgumentException("Payload is not present for " + Action.DistributeTraffic.toString());
+ }
+ payload = PayloadClient.distributeTrafficFormat(payload, vnfName);
+ return client.vnfCommand(Action.DistributeTraffic, msoRequestId, vnfId, Optional.empty(), payload,
+ controllerType);
+ }
+
+ private Status distributeTrafficCheckAction(String msoRequestId, String vnfId, Optional<String> payload,
+ String vnfName, String controllerType)
+ throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException {
+ if (!(payload.isPresent())) {
+ throw new IllegalArgumentException(
+ "Payload is not present for " + Action.DistributeTrafficCheck.toString());
+ }
+ payload = PayloadClient.distributeTrafficCheckFormat(payload, vnfName);
+ return client.vnfCommand(Action.DistributeTrafficCheck, msoRequestId, vnfId, Optional.empty(), payload,
+ controllerType);
+ }
+
private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName, String controllerType)
throws JsonProcessingException, ApplicationControllerOrchestratorException {
Optional<String> payload = PayloadClient.resumeTrafficFormat(vnfName);
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 6bfa67502d..5498b5be31 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
@@ -34,6 +34,7 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOu
import org.onap.so.client.PreconditionFailedException;
import org.onap.so.client.RestPropertiesLoader;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,6 +59,12 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
private static final String FAILED = "Failed";
private static final String PROCESSING = "Processing";
+ /**
+ * indicate exception thrown.
+ */
+ private static final String EXCEPTION = "Exception";
+
+
private final AtomicReference<String> cdsResponse = new AtomicReference<>();
@Autowired
@@ -132,7 +139,15 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
}
if (cdsResponse != null) {
- execution.setVariable("CDSStatus", cdsResponse.get());
+ String cdsResponseStatus = cdsResponse.get();
+ execution.setVariable("CDSStatus", cdsResponseStatus);
+
+ /**
+ * throw CDS failed exception.
+ */
+ if (cdsResponseStatus != SUCCESS) {
+ throw new BadResponseException("CDS call failed with status: " + cdsResponseStatus);
+ }
}
} catch (Exception ex) {
@@ -177,6 +192,7 @@ public class AbstractCDSProcessingBBUtils implements CDSProcessingListener {
public void onError(Throwable t) {
Status status = Status.fromThrowable(t);
logger.error("Failed processing blueprint {}", status, t);
+ cdsResponse.set(EXCEPTION);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
index 8ab2c8e155..7bd2beeb92 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
@@ -227,4 +227,16 @@ public class ExtractPojosForBBTest extends BaseTest {
gBBInput.setCustomer(customer);
extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
}
+
+ @Test
+ public void getServiceInstanceWithNoCustomer() throws BBObjectNotFoundException {
+ ServiceInstance serviceInstancePend = new ServiceInstance();
+ serviceInstancePend.setServiceInstanceId("abc");
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstancePend.getServiceInstanceId());
+ Customer customer = new Customer();
+ gBBInput.setCustomer(customer);
+ gBBInput.setServiceInstance(serviceInstancePend);
+ ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId());
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
index 37f8b8b2fd..13d2b7d3d3 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
@@ -573,6 +573,19 @@ public class BBInputSetupMapperLayerTest {
}
@Test
+ public void testMapOrchestrationContextNoRequestInfo() throws IOException {
+ OrchestrationContext expected = new OrchestrationContext();
+ expected.setIsRollbackEnabled(false);
+
+ RequestDetails requestDetails = mapper.readValue(
+ new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContextNoRequestInfo.json"), RequestDetails.class);
+
+ OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
public void testMapLocationContext() {
CloudRegion expected = new CloudRegion();
expected.setCloudOwner("test-owner-name");
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json
index 98f966e753..9703b9c105 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoGenericVnfExpected.json
@@ -17,5 +17,7 @@
"model-version" : "modelVersion",
"model-invariant-uuid" : "modelInvariantUUID",
"model-name" : "modelName",
- "model-uuid" : "modelUUID"
+ "model-uuid" : "modelUUID",
+ "blueprintName" : "testBlueprintName",
+ "blueprintVersion" : "testBlueprintVersion"
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json
new file mode 100644
index 0000000000..41f0fde834
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContextNoRequestInfo.json
@@ -0,0 +1,29 @@
+{
+ "requestParameters": {
+ "subscriptionServiceType": "subscriptionServiceType",
+ "userParams": [
+ {
+ "name" : "mns_vfw_protected_route_prefixes",
+ "value" : [ {
+ "interface_route_table_routes_route" : "1.1.1.1/32"
+ }, {
+ "interface_route_table_routes_route" : "0::1/128"
+ } ]
+ },
+ {
+ "name": "name1",
+ "value": "value1"
+ },
+ {
+ "ignore": "false",
+ "skip": "ignore"
+ }]
+ },
+ "configurationParameters": [
+ {
+ "availability-zone":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]",
+ "xtz-123":"$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]"
+ }
+ ]
+}
+
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json
index 26516ce907..95b116cec8 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VnfResourceCustomizationInput.json
@@ -9,6 +9,8 @@
"nfRole" : "nfRole",
"nfNamingCode" : "nfNamingCode",
"multiStageDesign" : "multiStageDesign",
+ "blueprintName" : "testBlueprintName",
+ "blueprintVersion" : "testBlueprintVersion",
"vnfResources" : {
"modelUUID" : "modelUUID",
"modelInvariantUUID" : "modelInvariantUUID",
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 599dce5339..2aa433ba5a 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -25,14 +25,14 @@ package org.onap.so.bpmn.infrastructure;
import java.util.List;
import java.util.concurrent.Executor;
import com.google.common.base.Strings;
-import org.camunda.bpm.application.PostDeploy;
+import javax.annotation.PostConstruct;
import org.camunda.bpm.application.PreUndeploy;
import org.camunda.bpm.application.ProcessApplicationInfo;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.repository.DeploymentBuilder;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.db.catalog.beans.Workflow;
-import org.onap.so.db.catalog.data.repository.WorkflowRepository;
+import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,13 +40,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Primary;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@@ -57,17 +55,17 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@SpringBootApplication
@EnableAsync
-@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
-@EntityScan({"org.onap.so.db.catalog.beans"})
@ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class MSOInfrastructureApplication {
private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class);
+ @Autowired
+ private ProcessEngine processEngine;
@Autowired
- private WorkflowRepository workflowRepository;
+ private CatalogDbClient catalogDbClient;
@Value("${mso.async.core-pool-size}")
private int corePoolSize;
@@ -80,6 +78,7 @@ public class MSOInfrastructureApplication {
private static final String LOGS_DIR = "logs_dir";
private static final String BPMN_SUFFIX = ".bpmn";
+ private static final String SDC_SOURCE = "sdc";
private static void setLogsDir() {
@@ -94,10 +93,14 @@ public class MSOInfrastructureApplication {
setLogsDir();
}
- @PostDeploy
- public void postDeploy(ProcessEngine processEngineInstance) {
- DeploymentBuilder deploymentBuilder = processEngineInstance.getRepositoryService().createDeployment();
- deployCustomWorkflows(deploymentBuilder);
+ @PostConstruct
+ public void postConstruct() {
+ try {
+ DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment();
+ deployCustomWorkflows(deploymentBuilder);
+ } catch (Exception e) {
+ logger.warn("Unable to invoke deploymentBuilder: " + e.getMessage());
+ }
}
@PreUndeploy
@@ -118,23 +121,26 @@ public class MSOInfrastructureApplication {
}
public void deployCustomWorkflows(DeploymentBuilder deploymentBuilder) {
- if (workflowRepository == null) {
- return;
- }
- List<Workflow> workflows = workflowRepository.findAll();
- if (workflows != null && workflows.size() != 0) {
- for (Workflow workflow : workflows) {
- String workflowName = workflow.getName();
- String workflowBody = workflow.getBody();
- if (!workflowName.endsWith(BPMN_SUFFIX)) {
- workflowName += BPMN_SUFFIX;
- }
- if (workflowBody != null) {
- logger.info(Strings.repeat("{} ", 2), "Deploying custom workflow", workflowName);
- deploymentBuilder.addString(workflowName, workflowBody);
+ logger.debug("Attempting to deploy custom workflows");
+ try {
+ List<Workflow> workflows = catalogDbClient.findWorkflowBySource(SDC_SOURCE);
+ if (workflows != null && workflows.size() != 0) {
+ for (Workflow workflow : workflows) {
+ String workflowName = workflow.getName();
+ String workflowBody = workflow.getBody();
+ if (!workflowName.endsWith(BPMN_SUFFIX)) {
+ workflowName += BPMN_SUFFIX;
+ }
+ if (workflowBody != null) {
+ logger.info(Strings.repeat("{} ", 2), "Deploying custom workflow", workflowName);
+ deploymentBuilder.addString(workflowName, workflowBody);
+ }
+ deploymentBuilder.enableDuplicateFiltering(true);
+ deploymentBuilder.deploy();
}
}
- deploymentBuilder.deploy();
+ } catch (Exception e) {
+ logger.warn("Unable to deploy custom workflows, " + e.getMessage());
}
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
index a91cb9d88d..e364981a66 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
@@ -4,7 +4,7 @@ server:
max-threads: 50
mso:
infra:
- auditInventory: true
+ auditInventory: false
spring:
datasource:
driver-class-name: org.mariadb.jdbc.Driver
@@ -36,4 +36,4 @@ management:
export:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
- step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file
+ step: 1m # Step size (i.e. reporting frequency) to use.
diff --git a/bpmn/pom.xml b/bpmn/pom.xml
index b8c572fe19..f09cfaa38c 100644
--- a/bpmn/pom.xml
+++ b/bpmn/pom.xml
@@ -25,6 +25,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sdnc.northbound.version>1.5.2-SNAPSHOT</sdnc.northbound.version>
+ <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
</properties>
<modules>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn
index 7bb97939dd..d522f3445e 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn
@@ -24,7 +24,7 @@
<bpmn:sequenceFlow id="SequenceFlow_1nle8kc" sourceRef="Task_createInstanceGroups" targetRef="ExclusiveGateway_02tchpp" />
<bpmn:sequenceFlow id="SequenceFlow_11jum90" name="no" sourceRef="ExclusiveGateway_02tchpp" targetRef="ExclusiveGateway_1blf52g" />
<bpmn:sequenceFlow id="SequenceFlow_1uiok7v" name="yes" sourceRef="ExclusiveGateway_02tchpp" targetRef="Task_callHoming">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("homing")}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("homing") == true}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0v8d14a" sourceRef="Task_callHoming" targetRef="ExclusiveGateway_1blf52g" />
<bpmn:callActivity id="Task_callHoming" name="Call Homing" calledElement="HomingBB">
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
index 13bd107fdb..38bbdc1134 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfInstantiateBB.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" id="Definitions_0x13ohc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
+<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" id="Definitions_0x13ohc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
<bpmn:process id="EtsiVnfInstantiateBB" name="&#10;EtsiVnfInstantiateBB" isExecutable="true">
<bpmn:serviceTask id="ServiceTask_02e82t2" name="Create &#10;CreateVnfRequest&#10;" camunda:expression="${VnfmAdapterCreateVnfTask.buildCreateVnfRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_18fsqzd</bpmn:incoming>
@@ -25,16 +25,22 @@
<bpmn:sequenceFlow id="SequenceFlow_0hp0ka1" sourceRef="ServiceTask_06ao4xu" targetRef="CallActivity_0fuqfru" />
<bpmn:callActivity id="CallActivity_0fuqfru" name="Monitor Instantiation Job" calledElement="MonitorVnfmCreateJob">
<bpmn:extensionElements>
- <camunda:in source="SDNCRequest" target="SDNCRequest" />
- <camunda:out source="SDNCResponse" target="SDNCResponse" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:in source="createVnfResponse" target="createVnfResponse" />
+ <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0hp0ka1</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1owx4yu</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:sequenceFlow id="SequenceFlow_1owx4yu" sourceRef="CallActivity_0fuqfru" targetRef="CallActivity_0agszsb" />
<bpmn:callActivity id="CallActivity_0agszsb" name="Monitor Create Node Status" calledElement="MonitorVnfmCreateNodeStatus">
+ <bpmn:extensionElements>
+ <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ </bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1owx4yu</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0n57z81</bpmn:outgoing>
</bpmn:callActivity>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn
index 6d54262dc5..9712ca8ab7 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmCreateNodeStatus.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_1ko0frn" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
- <bpmn:process id="Process_1" isExecutable="true">
+<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_1ko0frn" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+ <bpmn:process id="MonitorVnfmCreateNodeStatus" name="MonitorVnfmCreateNodeStatus" isExecutable="true">
<bpmn:startEvent id="StartEvent_0k0qfjb">
<bpmn:outgoing>SequenceFlow_1miob62</bpmn:outgoing>
</bpmn:startEvent>
@@ -24,7 +24,7 @@
<bpmn:endEvent id="EndEvent_0tei3i9">
<bpmn:incoming>SequenceFlow_1rxbeqi</bpmn:incoming>
</bpmn:endEvent>
- <bpmn:serviceTask id="ServiceTask_0y71su8" name="&#10;Get node status &#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:serviceTask id="ServiceTask_0y71su8" name="&#10;Get node status &#10;" camunda:asyncAfter="true" camunda:expression="${MonitorInstantiateVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_1moaz0q</bpmn:incoming>
<bpmn:incoming>SequenceFlow_09t51ao</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0qvy3sn</bpmn:outgoing>
@@ -56,7 +56,7 @@
<bpmn:sequenceFlow id="SequenceFlow_0qcc5x4" sourceRef="BoundaryEvent_1f5o5i9" targetRef="ServiceTask_12qp0ty" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="MonitorVnfmCreateNodeStatus">
<bpmndi:BPMNShape id="StartEvent_0k0qfjb_di" bpmnElement="StartEvent_0k0qfjb">
<dc:Bounds x="155" y="219" width="36" height="36" />
</bpmndi:BPMNShape>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn
index 8fababaffe..668cfaa44a 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteNodeStatus.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_15jp7td" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
+<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_15jp7td" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
<bpmn:process id="MonitorVnfmDeleteNodeStatus" name="MonitorVnfmDeleteNodeStatus" isExecutable="true">
<bpmn:startEvent id="StartEvent_0f7nbs2">
<bpmn:outgoing>SequenceFlow_0spr34x</bpmn:outgoing>
@@ -28,7 +28,7 @@
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("deleteVnfNodeStatus")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0zlblru" sourceRef="ExclusiveGateway_1j9jbtk" targetRef="IntermediateCatchEvent_15yl23y" />
- <bpmn:serviceTask id="ServiceTask_1ksqjjf" name="&#10;Get node status &#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:serviceTask id="ServiceTask_1ksqjjf" name="&#10;Get node status &#10;" camunda:asyncAfter="true" camunda:expression="${MonitorTerminateVnfmNodeTask.getNodeStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_17vvpzi</bpmn:incoming>
<bpmn:incoming>SequenceFlow_11rfobu</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1unicf9</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
index 9380943238..ef0dba83df 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
@@ -23,24 +23,28 @@
package org.onap.so.bpmn.infrastructure.scripts
-import com.google.common.base.Strings
-import org.onap.so.logger.ErrorCode;
-
import static org.apache.commons.lang3.StringUtils.*
-
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.ServiceInstance
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
-
+import com.google.common.base.Strings
import groovy.json.*
/**
@@ -333,5 +337,41 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
}
logger.trace("finished prepareInitServiceOperationStatus")
}
+
+ public void updateAAIOrchStatus (DelegateExecution execution){
+ logger.debug(" ***** start updateAAIOrchStatus ***** ")
+ String msg = ""
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ logger.debug("serviceInstanceId: "+serviceInstanceId)
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ try {
+ ServiceInstance si = execution.getVariable("serviceInstanceData")
+ boolean allActive = true
+ for (VnfResource resource : serviceDecomposition.vnfResources) {
+ logger.debug("resource.modelInfo.getModelName: " + resource.modelInfo.getModelName() +" | resource.getOrchestrationStatus: "+resource.getOrchestrationStatus())
+ if (resource.getOrchestrationStatus() != "Active") {
+ allActive = false
+ }
+ }
+
+ if (allActive){
+ si.setOrchestrationStatus("Active")
+ }else {
+ si.setOrchestrationStatus("Pending")
+ }
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ client.update(uri, si)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.updateAAIOrchStatus " + ex.getMessage()
+ logger.info( msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug(" ***** end updateAAIOrchStatus ***** ")
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index 23c11ca4dc..d431bdc3b4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -201,10 +201,9 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.CVLAN", cvlan)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.SVLAN", svlan)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.accessID", remoteId)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.remote_id", remoteId)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ONTSN", ontsn)
-
logger.debug("old resource input:" + resourceInputObj.toString())
resourceInputObj.setResourceParameters(uResourceInput)
execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
@@ -882,4 +881,4 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
logger.debug(" ***** Exit sendSyncResponse *****")
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index a303da9a8f..587337b647 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -352,5 +352,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
public void postConfigRequest(DelegateExecution execution){
//now do noting
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ for (VnfResource resource : serviceDecomposition.vnfResources) {
+ resource.setOrchestrationStatus("Active")
+ }
+ execution.setVariable("serviceDecomposition", serviceDecomposition)
}
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index 8e39636ab0..c65d97145a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -271,11 +271,11 @@ public class DoCreateVfModule extends VfModuleBase {
Map<String,String> vfModuleInputParams = execution.getVariable("vfModuleInputParams")
if (oofDirectives != null && vfModuleInputParams != null) {
vfModuleInputParams.put("oof_directives", oofDirectives)
- vfModuleInputParams.put("sdnc_directives", "{}")
+ //vfModuleInputParams.put("sdnc_directives", "{}")
logger.debug("OofDirectives are: " + oofDirectives)
} else if (vfModuleInputParams != null) {
vfModuleInputParams.put("oof_directives", "{}")
- vfModuleInputParams.put("sdnc_directives", "{}")
+ //vfModuleInputParams.put("sdnc_directives", "{}")
}
if (vfModuleInputParams != null) {
execution.setVariable("DCVFM_vnfParamsMap", vfModuleInputParams)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
index 0920206b13..2dcfcaa4f4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
@@ -345,7 +345,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
}
}
- String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri
+ String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + recipeUri
BpmnRestClient bpmnRestClient = new BpmnRestClient()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
index 0c676b5589..1acadbdad8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
@@ -290,7 +290,8 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
- if(resourceClient.exists(uri)){
+ if(resourceClient.exists(uri)){
+ execution.setVariable("GENGS_FoundIndicator", true)
execution.setVariable("GENGS_siResourceLink", uri.build().toString())
Map<String, String> keys = uri.getURIKeys()
String globalSubscriberId = execution.getVariable("globalSubscriberId")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy
index 90c2b923b0..f06d71cec4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.CatalogDbUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames
@@ -35,50 +34,57 @@ public class HandlePNF extends AbstractServiceTaskProcessor{
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
@Override
void preProcessRequest(DelegateExecution execution) {
- msoLogger.debug("Start preProcess for HandlePNF")
-
+ logger.debug("Start preProcess for HandlePNF")
// set correlation ID
def resourceInput = execution.getVariable("resourceInput")
String serInput = jsonUtil.getJsonValue(resourceInput, "requestsInputs")
String correlationId = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_pnf_name")
if (!StringUtils.isEmpty(correlationId)) {
- execution.setVariable(ExecutionVariableNames.CORRELATION_ID, correlationId)
- msoLogger.debug("Found correlation id : " + correlationId)
+ execution.setVariable(ExecutionVariableNames.PNF_CORRELATION_ID, correlationId)
+ logger.debug("Found correlation id : " + correlationId)
} else {
- msoLogger.error("== correlation id is empty ==")
+ logger.error("== correlation id is empty ==")
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "correlation id is not provided")
}
+
+ String serviceInstanceID = jsonUtil.getJsonValue(resourceInput, ExecutionVariableNames.SERVICE_INSTANCE_ID)
+ if (!StringUtils.isEmpty(serviceInstanceID)) {
+ execution.setVariable(ExecutionVariableNames.SERVICE_INSTANCE_ID, serviceInstanceID)
+ logger.debug("found serviceInstanceID: "+serviceInstanceID)
+ } else {
+ logger.error("== serviceInstance ID is empty ==")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "serviceInstance ID is not provided")
+ }
// next task will set the uuid
- msoLogger.debug("exit preProcess for HandlePNF")
+ logger.debug("exit preProcess for HandlePNF")
}
void postProcessRequest(DelegateExecution execution) {
- msoLogger.debug("start postProcess for HandlePNF")
+ logger.debug("start postProcess for HandlePNF")
- msoLogger.debug("exit postProcess for HandlePNF")
+ logger.debug("exit postProcess for HandlePNF")
}
public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.debug(" *** sendSyncResponse *** ")
+ logger.debug(" *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" ***** Exit sendSyncResponse *****")
+ logger.debug(" ***** Exit sendSyncResponse *****")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy
index faa6a0e395..5a6ad4291e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy
@@ -7,9 +7,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.
@@ -47,6 +47,9 @@ import static org.mockito.Mockito.*
class DoCreateVfModuleTest {
def prefix = "DCVFM_"
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(8090);
+
@Captor
static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
@@ -54,7 +57,7 @@ class DoCreateVfModuleTest {
void init() throws IOException {
MockitoAnnotations.initMocks(this);
}
-
+
@Test
void testQueryAAIVfModule() {
ExecutionEntity mockExecution = setupMock()
@@ -90,7 +93,7 @@ class DoCreateVfModuleTest {
Mockito.verify(mockExecution).setVariable("DCVFM_queryAAIVfModuleForStatusResponseCode", 200)
}
-
+
@Test
void testPreProcessVNFAdapterRequest() {
@@ -122,7 +125,7 @@ class DoCreateVfModuleTest {
map.put("vrr_image_name", "MDT17");
map.put("availability_zone_0", "nova");
map.put("vrr_flavor_name", "ns.c16r32d128.v1");
- when(mockExecution.getVariable("vnfParamsMap")).thenReturn(map)
+ when(mockExecution.getVariable(prefix + "vnfParamsMap")).thenReturn(map)
when(mockExecution.getVariable("mso-request-id")).thenReturn("testRequestId-1503410089303")
when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true")
when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn("http://localhost:28080/mso/WorkflowMesssage")
@@ -155,7 +158,7 @@ class DoCreateVfModuleTest {
Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionReturnCode", "200")
}
-
+
@Test
void testCreateNetworkPoliciesInAAI() {
@@ -181,7 +184,7 @@ class DoCreateVfModuleTest {
Mockito.verify(mockExecution).setVariable(prefix + "aaiQqueryNetworkPolicyByFqdnReturnCode", 200)
}
-
+
private static ExecutionEntity setupMock() {
ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml
index f78d38f802..782936c382 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml
@@ -1,5 +1,6 @@
<createVfModuleRequest>
<cloudSiteId>RDM2WAGPLCP</cloudSiteId>
+ <cloudOwner>null</cloudOwner>
<tenantId>fba1bd1e195a404cacb9ce17a9b2b421</tenantId>
<vnfId>skask</vnfId>
<vnfName>skask-test</vnfName>
@@ -47,6 +48,10 @@
<value>null</value>
</entry>
<entry>
+ <key>user_directives</key>
+ <value>{ &quot;attributes&quot;: [{&quot;attribute_name&quot;:&quot;vrr_image_name&quot;,&quot;attribute_value&quot;:&quot;MDT17&quot;},{&quot;attribute_name&quot;:&quot;availability_zone_0&quot;,&quot;attribute_value&quot;:&quot;nova&quot;},{&quot;attribute_name&quot;:&quot;vrr_flavor_name&quot;,&quot;attribute_value&quot;:&quot;ns.c16r32d128.v1&quot;}]}</value>
+ </entry>
+ <entry>
<key>vf_module_name</key>
<value>PCRF::module-0-2</value>
</entry>
@@ -71,6 +76,10 @@
<value></value>
</entry>
<entry>
+ <key>vrr_flavor_name</key>
+ <value>ns.c16r32d128.v1</value>
+ </entry>
+ <entry>
<key>ADIG_SRIOV_2_net_name</key>
<value>ADIG_SRIOV_2</value>
</entry>
@@ -103,6 +112,10 @@
<value>null</value>
</entry>
<entry>
+ <key>sdnc_directives</key>
+ <value>{ &quot;attributes&quot;: [{&quot;attribute_name&quot;:&quot;vf_module_id&quot;,&quot;attribute_value&quot;:&quot;cb510af0-5b21-4bc7-86d9-323cb396ce32&quot;},{&quot;attribute_name&quot;:&quot;vrra_Internal-Network1_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIGOam.OAM_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vnf_name&quot;,&quot;attribute_value&quot;:&quot;skask-test&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_v6_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;workload_context&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vf_module_name&quot;,&quot;attribute_value&quot;:&quot;PCRF::module-0-2&quot;},{&quot;attribute_name&quot;:&quot;vnf_id&quot;,&quot;attribute_value&quot;:&quot;skask&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_v6_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIG_SRIOV_1_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_v6_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_net_name&quot;,&quot;attribute_value&quot;:&quot;ADIG_SRIOV_2&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_net_id&quot;,&quot;attribute_value&quot;:&quot;491c7cef-a3f4-4990-883e-b0af397466d0&quot;},{&quot;attribute_name&quot;:&quot;environment_context&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_net_fqdn&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_net_name&quot;,&quot;attribute_value&quot;:&quot;ADIGOAM.OAM&quot;},{&quot;attribute_name&quot;:&quot;vrra_name_0&quot;,&quot;attribute_value&quot;:&quot;frkdevRvrra24&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIG_SRIOV_2_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_net_fqdn&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;vrra_Internal-Network2_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_net_name&quot;,&quot;attribute_value&quot;:&quot;ADIG_SRIOV_1&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIG_SRIOV_1_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIGOam.OAM_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vrra_Internal-Network1_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_net_fqdn&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;vrra_names&quot;,&quot;attribute_value&quot;:&quot;frkdevRvrra24&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_net_id&quot;,&quot;attribute_value&quot;:&quot;491c7cef-a3f4-4990-883e-b0af397466d0&quot;},{&quot;attribute_name&quot;:&quot;vrra_Internal-Network2_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIG_SRIOV_2_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_net_id&quot;,&quot;attribute_value&quot;:&quot;491c7cef-a3f4-4990-883e-b0af397466d0&quot;},{&quot;attribute_name&quot;:&quot;vf_module_index&quot;,&quot;attribute_value&quot;:&quot;index&quot;},{&quot;attribute_name&quot;:&quot;availability_zone_0&quot;,&quot;attribute_value&quot;:&quot;frkde-esx-az01&quot;}]}</value>
+ </entry>
+ <entry>
<key>ADIG_SRIOV_2_net_fqdn</key>
<value></value>
</entry>
@@ -127,6 +140,10 @@
<value>null</value>
</entry>
<entry>
+ <key>vrr_image_name</key>
+ <value>MDT17</value>
+ </entry>
+ <entry>
<key>ADIGOam.OAM_net_fqdn</key>
<value></value>
</entry>
@@ -156,9 +173,10 @@
</entry>
<entry>
<key>availability_zone_0</key>
- <value>frkde-esx-az01</value>
+ <value>nova</value>
</entry>
+
</vfModuleParams>
<msoRequest>
<requestId>testRequestId</requestId>
@@ -166,4 +184,4 @@
</msoRequest>
<messageId>testRequestId-1503410089303-1513204371234</messageId>
<notificationUrl>http://localhost:28080/mso/WorkflowMesssage/VNFAResponse/testRequestId-1503410089303-1513204371234</notificationUrl>
-</createVfModuleRequest> \ No newline at end of file
+</createVfModuleRequest>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn
index f489a27052..9a1a7ed628 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn
@@ -30,7 +30,7 @@
<bpmn:incoming>SequenceFlow_17llfxw</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0p0aqtx</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:exclusiveGateway id="ExclusiveGateway_0vtv1wi">
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0vtv1wi" default="SequenceFlow_1w4p9f7">
<bpmn:incoming>SequenceFlow_0p0aqtx</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1owbpsy</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_1w4p9f7</bpmn:outgoing>
@@ -49,7 +49,7 @@
<bpmn:incoming>SequenceFlow_0jfgn7n</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_08voj55</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:exclusiveGateway id="ExclusiveGateway_01jwwmc">
+ <bpmn:exclusiveGateway id="ExclusiveGateway_01jwwmc" default="SequenceFlow_0d24h26">
<bpmn:incoming>SequenceFlow_08voj55</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1n080up</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0d24h26</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn
index 04ff48d4ed..c1b5ef82de 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2">
+<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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
<bpmn:process id="CreateCustomE2EServiceInstance" name="CreateCustomE2EServiceInstance" isExecutable="true">
<bpmn:startEvent id="StartEvent_00qj6ro" name="Create SI Start Flow">
<bpmn:outgoing>SequenceFlow_0s2spoq</bpmn:outgoing>
@@ -44,6 +44,8 @@ ex.processJavaException(execution)</bpmn:script>
<camunda:in source="uuiRequest" target="uuiRequest" />
<camunda:in source="requestAction" target="operationType" />
<camunda:in source="operationId" target="operationId" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="serviceInstanceData" target="serviceInstanceData" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_19eilro</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing>
@@ -74,7 +76,7 @@ csi.prepareCompletionRequest(execution)</bpmn:script>
<camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" />
<camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" />
</bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_0je30si</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0kaz8ac</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0yayvrf</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:subProcess id="SubProcess_0vaws86" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
@@ -140,7 +142,7 @@ csi.sendSyncResponse(execution)</bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="CallActivity_02fyxz0" />
+ <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="Task_1bgdtc9" />
<bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") != null}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
@@ -175,6 +177,14 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script>
<bpmn:outgoing>SequenceFlow_081z8l2</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_081z8l2" sourceRef="Task_19mxcw3" targetRef="ScriptTask_0xupxj9" />
+ <bpmn:sequenceFlow id="SequenceFlow_0kaz8ac" sourceRef="Task_1bgdtc9" targetRef="CallActivity_02fyxz0" />
+ <bpmn:scriptTask id="Task_1bgdtc9" name="Update AAI Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0je30si</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0kaz8ac</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new CreateCustomE2EServiceInstance()
+csi.updateAAIOrchStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
</bpmn:process>
<bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -192,9 +202,9 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script>
<dc:Bounds x="751" y="158" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0bpd6c0_di" bpmnElement="EndEvent_0bpd6c0">
- <dc:Bounds x="1258" y="286" width="36" height="36" />
+ <dc:Bounds x="1387" y="286" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1268" y="322" width="22" height="12" />
+ <dc:Bounds x="1398" y="322" width="20" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d">
@@ -204,7 +214,7 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script>
<dc:Bounds x="1038" y="158" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0">
- <dc:Bounds x="1226" y="158" width="100" height="80" />
+ <dc:Bounds x="1355" y="158" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_0vaws86_di" bpmnElement="SubProcess_0vaws86" isExpanded="true">
<dc:Bounds x="348" y="370" width="679" height="194" />
@@ -246,8 +256,8 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf">
- <di:waypoint x="1276" y="238" />
- <di:waypoint x="1276" y="286" />
+ <di:waypoint x="1405" y="238" />
+ <di:waypoint x="1405" y="286" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1246" y="262" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -270,7 +280,7 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si">
<di:waypoint x="1138" y="198" />
- <di:waypoint x="1226" y="198" />
+ <di:waypoint x="1189" y="198" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1137" y="183" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -386,6 +396,13 @@ csi.prepareInitServiceOperationStatus(execution)</bpmn:script>
<dc:Bounds x="533" y="177" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kaz8ac_di" bpmnElement="SequenceFlow_0kaz8ac">
+ <di:waypoint x="1289" y="198" />
+ <di:waypoint x="1355" y="198" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0novdpr_di" bpmnElement="Task_1bgdtc9">
+ <dc:Bounds x="1189" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn
index c81b289737..257a0dee64 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn
@@ -1,19 +1,17 @@
<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2">
+<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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
<bpmn:process id="HandlePNF" name="HandlePNF" isExecutable="true">
<bpmn:startEvent id="createNS_StartEvent_pnf_disc" name="start PNF handling">
<bpmn:outgoing>SequenceFlow_1c92ks3_activate</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:scriptTask id="Task_13sx2bp_activate" name="Pre Process Request" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_1c92ks3_activate</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_17xr584</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_12q67gd</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def handlePNF = new HandlePNF()
handlePNF.preProcessRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_1c92ks3_activate" sourceRef="createNS_StartEvent_pnf_disc" targetRef="Task_13sx2bp_activate" />
- <bpmn:sequenceFlow id="SequenceFlow_17xr584" sourceRef="Task_13sx2bp_activate" targetRef="Task_0kv28gm" />
<bpmn:sequenceFlow id="SequenceFlow_0pujwl4" sourceRef="Task_0657l04" targetRef="PostProcessPNFDiscovery" />
<bpmn:endEvent id="EndEvent_0pigsdfk3" name="end PNF hadler">
<bpmn:incoming>SequenceFlow_02fi1yn</bpmn:incoming>
@@ -21,8 +19,10 @@ handlePNF.preProcessRequest(execution)</bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_1la8oih" sourceRef="PostProcessPNFDiscovery" targetRef="Task_1r8h7of" />
<bpmn:callActivity id="Task_0657l04" name="invoke pnf handler" calledElement="CreateAndActivatePnfResource">
<bpmn:extensionElements>
- <camunda:in source="correlationId" target="correlationId" />
+ <camunda:in source="pnfCorrelationId" target="pnfCorrelationId" />
<camunda:in source="pnfUuid" target="pnfUuid" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in businessKey="#{execution.processBusinessKey}" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1apj1fn</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0pujwl4</bpmn:outgoing>
@@ -30,7 +30,6 @@ handlePNF.preProcessRequest(execution)</bpmn:script>
<bpmn:scriptTask id="PostProcessPNFDiscovery" name="Post Process Request" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_0pujwl4</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1la8oih</bpmn:outgoing>
- <bpmn:outgoing>SequenceFlow_1ezf4gu</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def handlePNF = new HandlePNF()
handlePNF.postProcessRequest(execution)</bpmn:script>
@@ -39,13 +38,10 @@ handlePNF.postProcessRequest(execution)</bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_1apj1fn" sourceRef="Task_0kv28gm" targetRef="Task_0657l04" />
<bpmn:serviceTask id="Task_0kv28gm" name="Generate PNF uuid" camunda:delegateExpression="${GeneratePnfUuidDelegate}">
<bpmn:incoming>SequenceFlow_12q67gd</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_17xr584</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1apj1fn</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_1ezf4gu" sourceRef="PostProcessPNFDiscovery" targetRef="Task_1r8h7of" />
<bpmn:sequenceFlow id="SequenceFlow_02fi1yn" sourceRef="Task_1r8h7of" targetRef="EndEvent_0pigsdfk3" />
<bpmn:scriptTask id="Task_1r8h7of" name="Send Sync Response" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_1ezf4gu</bpmn:incoming>
<bpmn:incoming>SequenceFlow_1la8oih</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_02fi1yn</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
@@ -68,10 +64,6 @@ handlePNF.sendSyncResponse(execution)</bpmn:script>
<di:waypoint x="-428" y="324" />
<di:waypoint x="-341" y="324" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_17xr584_di" bpmnElement="SequenceFlow_17xr584">
- <di:waypoint x="-241" y="324" />
- <di:waypoint x="-180" y="324" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0pujwl4_di" bpmnElement="SequenceFlow_0pujwl4">
<di:waypoint x="81" y="324" />
<di:waypoint x="156" y="324" />
@@ -94,19 +86,15 @@ handlePNF.sendSyncResponse(execution)</bpmn:script>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_12q67gd_di" bpmnElement="SequenceFlow_12q67gd">
<di:waypoint x="-241" y="324" />
- <di:waypoint x="-180" y="324" />
+ <di:waypoint x="-176" y="324" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1apj1fn_di" bpmnElement="SequenceFlow_1apj1fn">
- <di:waypoint x="-80" y="324" />
+ <di:waypoint x="-76" y="324" />
<di:waypoint x="-19" y="324" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1y3h50n_di" bpmnElement="Task_0kv28gm">
- <dc:Bounds x="-180" y="284" width="100" height="80" />
+ <dc:Bounds x="-176" y="284" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1ezf4gu_di" bpmnElement="SequenceFlow_1ezf4gu">
- <di:waypoint x="256" y="324" />
- <di:waypoint x="353" y="324" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_02fi1yn_di" bpmnElement="SequenceFlow_02fi1yn">
<di:waypoint x="453" y="324" />
<di:waypoint x="543" y="324" />
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
index eccb9486dd..76dd6facd6 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoCreateE2EServiceInstanceV3" name="DoCreateE2EServiceInstanceV3" isExecutable="true">
<bpmn2:startEvent id="createSI_startEvent" name="Start Flow">
<bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing>
@@ -7,10 +7,10 @@
<bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1qiiycn</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0w9t6tc</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateE2EServiceInstance()
dcsi.preProcessRequest(execution)
-]]></bpmn2:script>
+</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:subProcess id="SubProcess_06d8lk8" name="Sub-process for Application Errors" triggeredByEvent="true">
<bpmn2:startEvent id="StartEvent_0yljq9y">
@@ -36,28 +36,28 @@ dcsi.preProcessRequest(execution)
<bpmn2:scriptTask id="ScriptTask_0ocetux" name="Pre Process Rollback" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0tgrn11</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1lqktwf</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateE2EServiceInstance()
dcsi.preProcessRollback(execution)
-]]></bpmn2:script>
+</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_1lqktwf" sourceRef="ScriptTask_0ocetux" targetRef="CallActivity_1srx6p6" />
<bpmn2:scriptTask id="ScriptTask_1p0vyip" name="Post Process Rollback" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0eumzpf</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1xzgv5k</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateE2EServiceInstance()
dcsi.postProcessRollback(execution)
-]]></bpmn2:script>
+</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_1xzgv5k" sourceRef="ScriptTask_1p0vyip" targetRef="EndEvent_117lkk3" />
</bpmn2:subProcess>
<bpmn2:scriptTask id="ScriptTask_0q37vn9" name="&#10;AAI&#10;Create&#10;(srv instance)&#10;" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_012h7yx</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1tkgqu3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCreateE2EServiceInstance()
-ddsi.createServiceInstance(execution)]]></bpmn2:script>
+ddsi.createServiceInstance(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to Decompose_Service">
<bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming>
@@ -66,9 +66,9 @@ ddsi.createServiceInstance(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="ScriptTask_1o01d7d" name="PostProcess&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0xjwb45</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_012h7yx</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi= new DoCreateE2EServiceInstance()
-dcsi.processDecomposition(execution)]]></bpmn2:script>
+dcsi.processDecomposition(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:callActivity id="CallActivity_0biblpc" name="Call Decompose Service" calledElement="DecomposeService">
<bpmn2:extensionElements>
@@ -85,9 +85,9 @@ dcsi.processDecomposition(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="ScriptTask_1cllqk3" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_166w91p</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0qxzgvq</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi= new DoCreateE2EServiceInstance()
-dcsi.prepareDecomposeService(execution)]]></bpmn2:script>
+dcsi.prepareDecomposeService(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0tv85pg" name="Decompose_Service">
<bpmn2:outgoing>SequenceFlow_166w91p</bpmn2:outgoing>
@@ -111,9 +111,9 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="ScriptTask_1rzf8a1" name="Prepare Resource Oper Status" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1y9rkfr</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0n7nbx3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCreateE2EServiceInstance()
-ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script>
+ddsi.preInitResourcesOperStatus(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:serviceTask id="ServiceTask_1asgesv" name="Init Resource Oper Status">
<bpmn2:extensionElements>
@@ -154,6 +154,7 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script>
<camunda:in source="serviceDecomposition" target="serviceDecomposition" />
<camunda:in source="uuiRequest" target="uuiRequest" />
<camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0b1dsaj</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0sphcy5</bpmn2:outgoing>
@@ -161,16 +162,16 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="ScriptTask_0ns08tn" name="PreProcess for Add Resources" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_022onug</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0b1dsaj</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def csi = new DoCreateE2EServiceInstance()
-csi.preProcessForAddResource(execution)]]></bpmn2:script>
+csi.preProcessForAddResource(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_19t13rd" name="PostProcess for Add Resource" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0sphcy5</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_18gnns6</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def csi = new DoCreateE2EServiceInstance()
-csi.postProcessForAddResource(execution)]]></bpmn2:script>
+csi.postProcessForAddResource(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:endEvent id="EndEvent_1x4kvfh">
<bpmn2:incoming>SequenceFlow_18gnns6</bpmn2:incoming>
@@ -178,16 +179,16 @@ csi.postProcessForAddResource(execution)]]></bpmn2:script>
<bpmn2:scriptTask id="ScriptTask_0jxdler" name="Process Site Location" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0yuzaen</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1y9rkfr</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi= new DoCreateE2EServiceInstance()
-dcsi.doProcessSiteLocation(execution)]]></bpmn2:script>
+dcsi.doProcessSiteLocation(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_0ts3c3b" name="Process Link TP Resource Allocation" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0ckto7v</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_022onug</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+ <bpmn2:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi= new DoCreateE2EServiceInstance()
-dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
+dcsi.doTPResourcesAllocation(execution)</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_1y9rkfr" sourceRef="ScriptTask_0jxdler" targetRef="ScriptTask_1rzf8a1" />
<bpmn2:sequenceFlow id="SequenceFlow_0n7nbx3" sourceRef="ScriptTask_1rzf8a1" targetRef="ServiceTask_1asgesv" />
@@ -230,15 +231,15 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
<dc:Bounds x="409" y="920" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0eumzpf_di" bpmnElement="SequenceFlow_0eumzpf">
- <di:waypoint xsi:type="dc:Point" x="509" y="960" />
- <di:waypoint xsi:type="dc:Point" x="577" y="960" />
+ <di:waypoint x="509" y="960" />
+ <di:waypoint x="577" y="960" />
<bpmndi:BPMNLabel>
<dc:Bounds x="498" y="945" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0tgrn11_di" bpmnElement="SequenceFlow_0tgrn11">
- <di:waypoint xsi:type="dc:Point" x="147" y="960" />
- <di:waypoint xsi:type="dc:Point" x="246" y="960" />
+ <di:waypoint x="147" y="960" />
+ <di:waypoint x="246" y="960" />
<bpmndi:BPMNLabel>
<dc:Bounds x="152" y="945" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -250,8 +251,8 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
<dc:Bounds x="246" y="920" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1lqktwf_di" bpmnElement="SequenceFlow_1lqktwf">
- <di:waypoint xsi:type="dc:Point" x="346" y="960" />
- <di:waypoint xsi:type="dc:Point" x="409" y="960" />
+ <di:waypoint x="346" y="960" />
+ <di:waypoint x="409" y="960" />
<bpmndi:BPMNLabel>
<dc:Bounds x="333" y="945" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -260,10 +261,10 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
<dc:Bounds x="577" y="920" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1xzgv5k_di" bpmnElement="SequenceFlow_1xzgv5k">
- <di:waypoint xsi:type="dc:Point" x="677" y="960" />
- <di:waypoint xsi:type="dc:Point" x="709" y="960" />
- <di:waypoint xsi:type="dc:Point" x="709" y="960" />
- <di:waypoint xsi:type="dc:Point" x="744" y="960" />
+ <di:waypoint x="677" y="960" />
+ <di:waypoint x="709" y="960" />
+ <di:waypoint x="709" y="960" />
+ <di:waypoint x="744" y="960" />
<bpmndi:BPMNLabel>
<dc:Bounds x="679" y="960" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -290,29 +291,29 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0xjwb45_di" bpmnElement="SequenceFlow_0xjwb45">
- <di:waypoint xsi:type="dc:Point" x="569" y="146" />
- <di:waypoint xsi:type="dc:Point" x="704" y="146" />
+ <di:waypoint x="569" y="146" />
+ <di:waypoint x="704" y="146" />
<bpmndi:BPMNLabel>
<dc:Bounds x="592" y="125" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0qxzgvq_di" bpmnElement="SequenceFlow_0qxzgvq">
- <di:waypoint xsi:type="dc:Point" x="287" y="146" />
- <di:waypoint xsi:type="dc:Point" x="469" y="146" />
+ <di:waypoint x="287" y="146" />
+ <di:waypoint x="469" y="146" />
<bpmndi:BPMNLabel>
<dc:Bounds x="333" y="125" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qiiycn_di" bpmnElement="SequenceFlow_1qiiycn">
- <di:waypoint xsi:type="dc:Point" x="45" y="-4" />
- <di:waypoint xsi:type="dc:Point" x="117" y="-4" />
+ <di:waypoint x="45" y="-4" />
+ <di:waypoint x="117" y="-4" />
<bpmndi:BPMNLabel>
<dc:Bounds x="36" y="-25" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_166w91p_di" bpmnElement="SequenceFlow_166w91p">
- <di:waypoint xsi:type="dc:Point" x="53" y="146" />
- <di:waypoint xsi:type="dc:Point" x="187" y="146" />
+ <di:waypoint x="53" y="146" />
+ <di:waypoint x="187" y="146" />
<bpmndi:BPMNLabel>
<dc:Bounds x="75" y="125" width="90" height="12" />
</bpmndi:BPMNLabel>
@@ -324,19 +325,19 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1tkgqu3_di" bpmnElement="SequenceFlow_1tkgqu3">
- <di:waypoint xsi:type="dc:Point" x="1112" y="146" />
- <di:waypoint xsi:type="dc:Point" x="1222" y="146" />
- <di:waypoint xsi:type="dc:Point" x="1222" y="146" />
- <di:waypoint xsi:type="dc:Point" x="1306" y="146" />
+ <di:waypoint x="1112" y="146" />
+ <di:waypoint x="1222" y="146" />
+ <di:waypoint x="1222" y="146" />
+ <di:waypoint x="1306" y="146" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1192" y="140" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc">
- <di:waypoint xsi:type="dc:Point" x="217" y="-4" />
- <di:waypoint xsi:type="dc:Point" x="762" y="-4" />
- <di:waypoint xsi:type="dc:Point" x="762" y="-4" />
- <di:waypoint xsi:type="dc:Point" x="1306" y="-4" />
+ <di:waypoint x="217" y="-4" />
+ <di:waypoint x="762" y="-4" />
+ <di:waypoint x="762" y="-4" />
+ <di:waypoint x="1306" y="-4" />
<bpmndi:BPMNLabel>
<dc:Bounds x="732" y="-10" width="90" height="12" />
</bpmndi:BPMNLabel>
@@ -348,10 +349,10 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_012h7yx_di" bpmnElement="SequenceFlow_012h7yx">
- <di:waypoint xsi:type="dc:Point" x="804" y="146" />
- <di:waypoint xsi:type="dc:Point" x="917" y="146" />
- <di:waypoint xsi:type="dc:Point" x="917" y="146" />
- <di:waypoint xsi:type="dc:Point" x="1012" y="146" />
+ <di:waypoint x="804" y="146" />
+ <di:waypoint x="917" y="146" />
+ <di:waypoint x="917" y="146" />
+ <di:waypoint x="1012" y="146" />
<bpmndi:BPMNLabel>
<dc:Bounds x="887" y="139" width="90" height="14" />
</bpmndi:BPMNLabel>
@@ -384,61 +385,61 @@ dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
<dc:Bounds x="599" y="260" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1y9rkfr_di" bpmnElement="SequenceFlow_1y9rkfr">
- <di:waypoint xsi:type="dc:Point" x="188" y="300" />
- <di:waypoint xsi:type="dc:Point" x="262" y="300" />
+ <di:waypoint x="188" y="300" />
+ <di:waypoint x="262" y="300" />
<bpmndi:BPMNLabel>
<dc:Bounds x="180" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0n7nbx3_di" bpmnElement="SequenceFlow_0n7nbx3">
- <di:waypoint xsi:type="dc:Point" x="362" y="300" />
- <di:waypoint xsi:type="dc:Point" x="433" y="300" />
+ <di:waypoint x="362" y="300" />
+ <di:waypoint x="433" y="300" />
<bpmndi:BPMNLabel>
<dc:Bounds x="353.5" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ckto7v_di" bpmnElement="SequenceFlow_0ckto7v">
- <di:waypoint xsi:type="dc:Point" x="533" y="300" />
- <di:waypoint xsi:type="dc:Point" x="599" y="300" />
+ <di:waypoint x="533" y="300" />
+ <di:waypoint x="599" y="300" />
<bpmndi:BPMNLabel>
<dc:Bounds x="521" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0b1dsaj_di" bpmnElement="SequenceFlow_0b1dsaj">
- <di:waypoint xsi:type="dc:Point" x="885" y="300" />
- <di:waypoint xsi:type="dc:Point" x="957" y="300" />
+ <di:waypoint x="885" y="300" />
+ <di:waypoint x="957" y="300" />
<bpmndi:BPMNLabel>
<dc:Bounds x="876" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0sphcy5_di" bpmnElement="SequenceFlow_0sphcy5">
- <di:waypoint xsi:type="dc:Point" x="1057" y="300" />
- <di:waypoint xsi:type="dc:Point" x="1131" y="300" />
+ <di:waypoint x="1057" y="300" />
+ <di:waypoint x="1131" y="300" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1049" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_022onug_di" bpmnElement="SequenceFlow_022onug">
- <di:waypoint xsi:type="dc:Point" x="699" y="300" />
- <di:waypoint xsi:type="dc:Point" x="785" y="300" />
+ <di:waypoint x="699" y="300" />
+ <di:waypoint x="785" y="300" />
<bpmndi:BPMNLabel>
<dc:Bounds x="697" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_18gnns6_di" bpmnElement="SequenceFlow_18gnns6">
- <di:waypoint xsi:type="dc:Point" x="1231" y="300" />
- <di:waypoint xsi:type="dc:Point" x="1301" y="300" />
+ <di:waypoint x="1231" y="300" />
+ <di:waypoint x="1301" y="300" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1221" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0yuzaen_di" bpmnElement="SequenceFlow_0yuzaen">
- <di:waypoint xsi:type="dc:Point" x="54" y="300" />
- <di:waypoint xsi:type="dc:Point" x="88" y="300" />
+ <di:waypoint x="54" y="300" />
+ <di:waypoint x="88" y="300" />
<bpmndi:BPMNLabel>
<dc:Bounds x="71" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn2:definitions> \ No newline at end of file
+</bpmn2:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn
index 50436352ea..df95cf0210 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnf.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoCreateVnf" name="DoCreateVnf" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
@@ -90,7 +90,7 @@ createVnf.preProcessSDNCActivateRequest(execution)]]></bpmn2:script>
<bpmn2:extensionElements>
<camunda:in source="DoCVNF_activateSDNCRequest" target="sdncAdapterWorkflowRequest" />
<camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
- <camunda:in source="mso-reqeuest-id" target="mso-request-id" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="sdncAdapterResponse" target="DoCVNF_activateSDNCAdapterResponse" />
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
index f51ea006d2..5b095a9983 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
@@ -27,13 +27,12 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
-import com.google.protobuf.Struct;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
-import org.camunda.bpm.engine.runtime.Execution;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
import org.junit.Ignore;
@@ -47,17 +46,19 @@ import org.onap.so.bpmn.mock.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import com.google.protobuf.Struct;
/**
* Basic Integration test for createVcpeResCustService_Simplified.bpmn workflow.
*/
-@Ignore
public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
- private static final long WORKFLOW_WAIT_TIME = 1000L;
private Logger logger = LoggerFactory.getLogger(getClass());
+ private static final long WORKFLOW_WAIT_TIME = 1000L;
+ private static final int DMAAP_DELAY_TIME_MS = 2000;
+
private static final String TEST_PROCESSINSTANCE_KEY = "CreateVcpeResCustService_simplified";
private String testBusinessKey;
@@ -103,6 +104,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
}
+ @Ignore
@Test
public void workflow_validInput_expectedOuput() throws InterruptedException {
@@ -113,17 +115,9 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
ProcessInstance pi =
runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, variables);
- assertThat(pi).isNotNull();
-
- Thread.sleep(WORKFLOW_WAIT_TIME);
-
- Execution execution = runtimeService.createExecutionQuery().processInstanceBusinessKey(testBusinessKey)
- .messageEventSubscriptionName("WorkflowMessage").singleResult();
-
- assertThat(execution).isNotNull();
int waitCount = 10;
- while (!pi.isEnded() && waitCount >= 0) {
+ while (!isProcessInstanceEnded() && waitCount >= 0) {
Thread.sleep(WORKFLOW_WAIT_TIME);
waitCount--;
}
@@ -145,6 +139,11 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
}
}
+ private boolean isProcessInstanceEnded() {
+ return runtimeService.createProcessInstanceQuery().processDefinitionKey(TEST_PROCESSINSTANCE_KEY)
+ .singleResult() == null;
+ }
+
private void checkConfigAssign(ExecutionServiceInput executionServiceInput) {
logger.info("Checking the configAssign request");
@@ -154,26 +153,26 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
* the fields of actionIdentifiers should match the one in the
* response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
- assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
- assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
- assertThat(actionIdentifiers.getActionName()).matches("config-assign");
- assertThat(actionIdentifiers.getMode()).matches("sync");
+ assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_configuration_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).isEqualTo("config-assign");
+ assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
CommonHeader commonHeader = executionServiceInput.getCommonHeader();
- assertThat(commonHeader.getOriginatorId()).matches("SO");
- assertThat(commonHeader.getRequestId()).matches(msoRequestId);
+ assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
+ assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
Struct payload = executionServiceInput.getPayload();
Struct requeststruct = payload.getFieldsOrThrow("config-assign-request").getStructValue();
- assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo");
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-properties").getStructValue();
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
- .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ .isEqualTo("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
- .matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ .isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680");
}
private void checkConfigDeploy(ExecutionServiceInput executionServiceInput) {
@@ -185,32 +184,32 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
* the fields of actionIdentifiers should match the one in the
* response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
- assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
- assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
- assertThat(actionIdentifiers.getActionName()).matches("config-deploy");
- assertThat(actionIdentifiers.getMode()).matches("async");
+ assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_configuration_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).isEqualTo("config-deploy");
+ assertThat(actionIdentifiers.getMode()).isEqualTo("async");
CommonHeader commonHeader = executionServiceInput.getCommonHeader();
- assertThat(commonHeader.getOriginatorId()).matches("SO");
- assertThat(commonHeader.getRequestId()).matches(msoRequestId);
+ assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
+ assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
Struct payload = executionServiceInput.getPayload();
Struct requeststruct = payload.getFieldsOrThrow("config-deploy-request").getStructValue();
- assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo");
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-deploy-properties").getStructValue();
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
- .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ .isEqualTo("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
- .matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ .isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680");
/**
* IP addresses match the OAM ip addresses from AAI.
*/
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).matches("1.1.1.1");
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).matches("::/128");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).isEqualTo("1.1.1.1");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).isEqualTo("::/128");
}
/**
@@ -223,8 +222,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
/**
* Get the events from PNF topic
*/
- wireMockServer
- .stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*")).willReturn(okJson(pnfResponse)));
+ wireMockServer.stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*"))
+ .willReturn(okJson(pnfResponse).withFixedDelay(DMAAP_DELAY_TIME_MS)));
}
private void mockAai() {
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 71bcd58fee..79672404d2 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
@@ -196,7 +196,7 @@ public class AAICreateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- execution.setVariable("callHoming", Boolean.TRUE.equals(vnf.isCallHoming()));
+ execution.setVariable("homing", Boolean.TRUE.equals(vnf.isCallHoming()));
aaiVnfResources.createVnfandConnectServiceInstance(vnf, serviceInstance);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index d39e58b778..cea9d54631 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -32,6 +32,7 @@ import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables;
import org.camunda.bpm.engine.variable.VariableMap;
import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
@@ -56,6 +57,7 @@ public class ExecuteActivity implements JavaDelegate {
private static final String G_REQUEST_ID = "mso-request-id";
private static final String VNF_ID = "vnfId";
private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
+ private static final String WORKFLOW_SYNC_ACK_SENT = "workflowSyncAckSent";
private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation";
private static final String ACTIVITY_PREFIX = "activity:";
@@ -66,12 +68,19 @@ public class ExecuteActivity implements JavaDelegate {
private RuntimeService runtimeService;
@Autowired
private ExceptionBuilder exceptionBuilder;
+ @Autowired
+ private WorkflowActionBBTasks workflowActionBBTasks;
@Override
public void execute(DelegateExecution execution) throws Exception {
final String requestId = (String) execution.getVariable(G_REQUEST_ID);
try {
+ Boolean workflowSyncAckSent = (Boolean) execution.getVariable(WORKFLOW_SYNC_ACK_SENT);
+ if (workflowSyncAckSent == null || workflowSyncAckSent == false) {
+ workflowActionBBTasks.sendSyncAck(execution);
+ execution.setVariable(WORKFLOW_SYNC_ACK_SENT, Boolean.TRUE);
+ }
final String implementationString =
execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE);
logger.debug("activity implementation String: {}", implementationString);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java
new file mode 100644
index 0000000000..b885cc2ee5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTask.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+@Component
+public class MonitorInstantiateVnfmNodeTask extends MonitorVnfmNodeTask {
+
+ @Autowired
+ public MonitorInstantiateVnfmNodeTask(final ExtractPojosForBB extractPojosForBB,
+ final ExceptionBuilder exceptionUtil, final AAIVnfResources aaiVnfResources) {
+ super(extractPojosForBB, exceptionUtil, aaiVnfResources);
+ }
+
+ @Override
+ public String getNodeStatusVariableName() {
+ return CREATE_VNF_NODE_STATUS;
+ }
+
+ @Override
+ public boolean isOrchestrationStatusValid(final String orchestrationStatus) {
+ return VNF_CREATED.equalsIgnoreCase(orchestrationStatus);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java
new file mode 100644
index 0000000000..34296c20d6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTask.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+@Component
+public class MonitorTerminateVnfmNodeTask extends MonitorVnfmNodeTask {
+
+ @Autowired
+ public MonitorTerminateVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil,
+ final AAIVnfResources aaiVnfResources) {
+ super(extractPojosForBB, exceptionUtil, aaiVnfResources);
+ }
+
+ @Override
+ public String getNodeStatusVariableName() {
+ return DELETE_VNF_NODE_STATUS;
+ }
+
+ @Override
+ public boolean isOrchestrationStatusValid(final String orchestrationStatus) {
+ return VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
index 4645680fc2..4c84bcaa1f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
@@ -55,11 +55,18 @@ public class MonitorVnfmCreateJobTask extends MonitorVnfmJobTask {
* @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
*/
public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing getCurrentOperationStatus ...");
- final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
- execution.setVariable(OPERATION_STATUS_PARAM_NAME,
- getOperationStatus(execution, vnfInstantiateResponse.getJobId()));
- LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ try {
+ LOGGER.debug("Executing getCurrentOperationStatus ...");
+ final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME,
+ getOperationStatus(execution, vnfInstantiateResponse.getJobId()));
+ LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ } catch (final Exception exception) {
+ final String message = "Unable to invoke get current Operation status";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1209, message);
+
+ }
}
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
index e91f362d53..34e3efa8f5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
@@ -56,10 +56,18 @@ public class MonitorVnfmDeleteJobTask extends MonitorVnfmJobTask {
* @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
*/
public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing getCurrentOperationStatus ...");
- final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME);
- execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, deleteVnfResponse.getJobId()));
- LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ try {
+ LOGGER.debug("Executing getCurrentOperationStatus ...");
+ final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME);
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME,
+ getOperationStatus(execution, deleteVnfResponse.getJobId()));
+ LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ } catch (final Exception exception) {
+ final String message = "Unable to invoke get current Operation status";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1216, message);
+
+ }
}
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java
index 65b05e21f5..a7a4eadb33 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeTask.java
@@ -19,38 +19,39 @@
*/
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED;
import static org.onap.so.bpmn.servicedecomposition.entities.ResourceKey.GENERIC_VNF_ID;
+import java.util.Optional;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception.GenericVnfNotFoundException;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIVnfResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
/**
*
* @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ * @author Waqas Ikram (waqas.ikram@est.tech)
*
*/
-@Component
-public class MonitorVnfmNodeTask {
+public abstract class MonitorVnfmNodeTask {
private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmNodeTask.class);
private final ExtractPojosForBB extractPojosForBB;
private final ExceptionBuilder exceptionUtil;
+ private final AAIVnfResources aaiVnfResources;
@Autowired
- public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil) {
+ public MonitorVnfmNodeTask(final ExtractPojosForBB extractPojosForBB, final ExceptionBuilder exceptionUtil,
+ final AAIVnfResources aaiVnfResources) {
this.exceptionUtil = exceptionUtil;
this.extractPojosForBB = extractPojosForBB;
+ this.aaiVnfResources = aaiVnfResources;
}
/**
@@ -61,11 +62,23 @@ public class MonitorVnfmNodeTask {
public void getNodeStatus(final BuildingBlockExecution execution) {
try {
LOGGER.debug("Executing getNodeStatus ...");
- final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
- String orchestrationStatus = vnf.getOrchestrationStatus();
- LOGGER.debug("Orchestration Status in AAI {}", orchestrationStatus);
- execution.setVariable(CREATE_VNF_NODE_STATUS, VNF_CREATED.equalsIgnoreCase(orchestrationStatus));
- execution.setVariable(DELETE_VNF_NODE_STATUS, VNF_ASSIGNED.equalsIgnoreCase(orchestrationStatus));
+
+ final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf =
+ extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID);
+
+ final String vnfId = vnf.getVnfId();
+ LOGGER.debug("Query A&AI for generic VNF using vnfID: {}", vnfId);
+ final Optional<GenericVnf> aaiGenericVnfOptional = aaiVnfResources.getGenericVnf(vnfId);
+
+ if (!aaiGenericVnfOptional.isPresent()) {
+ throw new GenericVnfNotFoundException("Unable to find generic vnf in A&AI using vnfID: " + vnfId);
+ }
+ final GenericVnf genericVnf = aaiGenericVnfOptional.get();
+ final String orchestrationStatus = genericVnf.getOrchestrationStatus();
+ LOGGER.debug("Found generic vnf with orchestration status : {}", orchestrationStatus);
+
+ execution.setVariable(getNodeStatusVariableName(), isOrchestrationStatusValid(orchestrationStatus));
+
} catch (final Exception exception) {
LOGGER.error("Unable to get vnf from AAI", exception);
exceptionUtil.buildAndThrowWorkflowException(execution, 1220, exception);
@@ -73,6 +86,20 @@ public class MonitorVnfmNodeTask {
}
/**
+ * Get variable to store in execution context
+ *
+ * @return the variable name
+ */
+ public abstract String getNodeStatusVariableName();
+
+ /**
+ * @param orchestrationStatus the orchestration status from A&AI
+ * @return true if valid
+ */
+ public abstract boolean isOrchestrationStatusValid(final String orchestrationStatus);
+
+
+ /**
* Log and throw exception on timeout for job status
*
* @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
index e0176eb802..32516c1dcb 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImpl.java
@@ -146,7 +146,7 @@ public class VnfmAdapterServiceProviderImpl implements VnfmAdapterServiceProvide
return Optional.of(response.getBody());
} catch (final RestProcessingException | InvalidRestRequestException httpInvocationException) {
LOGGER.error("Unexpected error while processing job request", httpInvocationException);
- return Optional.absent();
+ throw httpInvocationException;
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java
new file mode 100644
index 0000000000..d33d0bc895
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/exception/GenericVnfNotFoundException.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.exception;
+
+/**
+ * @author waqas.ikram@est.tech
+ *
+ */
+public class GenericVnfNotFoundException extends Exception {
+ private static final long serialVersionUID = -2049370314818025597L;
+
+ public GenericVnfNotFoundException(final String message) {
+ super(message);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
index b2058b25a0..bc71fc6f67 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
@@ -91,8 +91,9 @@ public class ConfigAssignVnf {
configAssignRequestVnf.setResolutionKey(vnf.getVnfName());
configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
- String blueprintName = vnf.getBlueprintName();
- String blueprintVersion = vnf.getBlueprintVersion();
+ String blueprintName = vnf.getModelInfoGenericVnf().getBlueprintName();
+ String blueprintVersion = vnf.getModelInfoGenericVnf().getBlueprintVersion();
+ logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion);
AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
index 4ec8b932c0..dd36900139 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
@@ -92,8 +92,10 @@ public class ConfigDeployVnf {
configDeployRequestVnf.setResolutionKey(vnf.getVnfName());
configDeployRequestVnf.setConfigDeployPropertiesForVnf(configDeployPropertiesForVnf);
- String blueprintName = vnf.getBlueprintName();
- String blueprintVersion = vnf.getBlueprintVersion();
+ String blueprintName = vnf.getModelInfoGenericVnf().getBlueprintName();
+ String blueprintVersion = vnf.getModelInfoGenericVnf().getBlueprintVersion();
+ logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion);
+
AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
abstractCDSPropertiesBean.setBlueprintName(blueprintName);
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 2fc301f9d7..70726f2014 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
@@ -415,7 +415,7 @@ public class WorkflowAction {
protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
for (OrchestrationFlow flow : orchFlows) {
- if (flow.getFlowName().contains("Configuration")) {
+ if (flow.getFlowName().contains("Configuration") && !flow.getFlowName().equals("ConfigurationScaleOutBB")) {
return true;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 753a050c03..e1c0d57b10 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -87,11 +87,10 @@ public class WorkflowActionBBTasks {
if (ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigAssignVnfBB")
|| ebb.getBuildingBlock().getBpmnFlowName().equals("ConfigDeployVnfBB")) {
- String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId();
String vnfCustomizationUUID = ebb.getBuildingBlock().getKey();
- List<VnfResourceCustomization> vnfResourceCustomizations =
- catalogDbClient.getVnfResourceCustomizationByModelUuid(serviceInstanceId);
+ List<VnfResourceCustomization> vnfResourceCustomizations = catalogDbClient
+ .getVnfResourceCustomizationByModelUuid(ebb.getRequestDetails().getModelInfo().getModelUuid());
if (vnfResourceCustomizations != null && vnfResourceCustomizations.size() >= 1) {
VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID,
vnfResourceCustomizations);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 94e95687db..b0ba0595d5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -205,14 +205,22 @@ public class VnfAdapterVfModuleObjectMapper {
private void buildDirectivesParamFromMap(Map<String, Object> paramsMap, String directive,
Map<String, Object> srcMap) {
StringBuilder directives = new StringBuilder();
- if (srcMap.size() > 0) {
+ int no_directives_size = 0;
+ if (directives.equals(MsoMulticloudUtils.USER_DIRECTIVES)
+ && srcMap.containsKey(MsoMulticloudUtils.OOF_DIRECTIVES)) {
+ no_directives_size = 1;
+ }
+ if (srcMap.size() > no_directives_size) {
directives.append("{ \"attributes\": [ ");
int i = 0;
for (String attributeName : srcMap.keySet()) {
- directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString()));
- if (i < (srcMap.size() - 1))
- directives.append(", ");
- i++;
+ if (!(MsoMulticloudUtils.USER_DIRECTIVES.equals(directives)
+ && attributeName.equals(MsoMulticloudUtils.OOF_DIRECTIVES))) {
+ directives.append(new AttributeNameValue(attributeName, srcMap.get(attributeName).toString()));
+ if (i < (srcMap.size() - 1 + no_directives_size))
+ directives.append(", ");
+ i++;
+ }
}
directives.append("] }");
} else {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java
new file mode 100644
index 0000000000..effcf24a8d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorInstantiateVnfmNodeTaskTest.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED;
+import java.util.Optional;
+import java.util.UUID;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.orchestration.AAIVnfResources;
+
+/**
+ *
+ * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class MonitorInstantiateVnfmNodeTaskTest extends BaseTaskTest {
+
+ private static final String VNF_ID = UUID.randomUUID().toString();
+
+ private static final String VNF_NAME = "VNF_NAME";
+
+ private MonitorVnfmNodeTask objUnderTest;
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ @Mock
+ private AAIVnfResources mockedAaiVnfResources;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Before
+ public void setUp() {
+ objUnderTest = getEtsiVnfMonitorNodeJobTask();
+ }
+
+ @Test
+ public void testGetNodeStatus_genericVnfWithOrchStatusCreated_executionVariableSetToCreate() throws Exception {
+ final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf();
+ final GenericVnf aaiGenericVnf = getAAIGenericVnf();
+ aaiGenericVnf.setOrchestrationStatus(VNF_CREATED);
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
+ when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.of(aaiGenericVnf));
+ objUnderTest.getNodeStatus(stubbedxecution);
+ assertTrue(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
+ }
+
+ @Test
+ public void testGetNodeStatus_noGenericVnfFoundInAAI_throwException() throws Exception {
+ final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf();
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
+ when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.empty());
+ objUnderTest.getNodeStatus(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220),
+ any(Exception.class));
+ assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
+
+ }
+
+ @Test
+ public void testGetNodeStatusException() throws Exception {
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
+ objUnderTest.getNodeStatus(stubbedxecution);
+ assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220),
+ any(Exception.class));
+ }
+
+ @Test
+ public void testTimeOutLogFailue() throws Exception {
+ objUnderTest.timeOutLogFailue(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1221),
+ eq("Node operation time out"));
+ }
+
+ private GenericVnf getAAIGenericVnf() {
+ final GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ genericVnf.setVnfName(VNF_NAME);
+ return genericVnf;
+ }
+
+ private org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf getGenericVnf() {
+ final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ return genericVnf;
+
+ }
+
+ private MonitorInstantiateVnfmNodeTask getEtsiVnfMonitorNodeJobTask() {
+ return new MonitorInstantiateVnfmNodeTask(extractPojosForBB, exceptionUtil, mockedAaiVnfResources);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTaskTest.java
index 6b84f6a918..04831733e1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmNodeJobTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorTerminateVnfmNodeTaskTest.java
@@ -20,16 +20,15 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_NODE_STATUS;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_CREATED;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_NODE_STATUS;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.VNF_ASSIGNED;
+import java.util.Optional;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
@@ -38,13 +37,14 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.orchestration.AAIVnfResources;
/**
*
- * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ * @author Waqas Ikram (waqas.ikram@est.tech)
*
*/
-public class MonitorVnfmNodeJobTest extends BaseTaskTest {
+public class MonitorTerminateVnfmNodeTaskTest extends BaseTaskTest {
private static final String VNF_ID = UUID.randomUUID().toString();
@@ -55,6 +55,9 @@ public class MonitorVnfmNodeJobTest extends BaseTaskTest {
@Mock
private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+ @Mock
+ private AAIVnfResources mockedAaiVnfResources;
+
private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
@Before
@@ -63,49 +66,48 @@ public class MonitorVnfmNodeJobTest extends BaseTaskTest {
}
@Test
- public void testGetNodeStatusCreate() throws Exception {
- GenericVnf vnf = getGenericVnf();
- vnf.setOrchestrationStatus(VNF_CREATED);
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
- objUnderTest.getNodeStatus(stubbedxecution);
- assertTrue(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
- }
-
- @Test
public void testGetNodeStatusDelete() throws Exception {
- GenericVnf vnf = getGenericVnf();
- vnf.setOrchestrationStatus(VNF_ASSIGNED);
+ final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf();
+ final GenericVnf aaiGenericVnf = getAAIGenericVnf();
+ aaiGenericVnf.setOrchestrationStatus(VNF_ASSIGNED);
+
when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
+ when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.of(aaiGenericVnf));
+
objUnderTest.getNodeStatus(stubbedxecution);
assertTrue(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS));
}
@Test
- public void testGetNodeStatusException() throws Exception {
- when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenThrow(RuntimeException.class);
+ public void testGetNodeStatus_noGenericVnfFoundInAAI_throwException() throws Exception {
+ final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = getGenericVnf();
+
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(vnf);
+ when(mockedAaiVnfResources.getGenericVnf(eq(VNF_ID))).thenReturn(Optional.empty());
objUnderTest.getNodeStatus(stubbedxecution);
- assertNull(stubbedxecution.getVariable(CREATE_VNF_NODE_STATUS));
- assertNull(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS));
verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1220),
any(Exception.class));
- }
+ assertNull(stubbedxecution.getVariable(DELETE_VNF_NODE_STATUS));
- @Test
- public void testTimeOutLogFailue() throws Exception {
- objUnderTest.timeOutLogFailue(stubbedxecution);
- verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1221),
- eq("Node operation time out"));
}
- private GenericVnf getGenericVnf() {
+ private GenericVnf getAAIGenericVnf() {
final GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId(VNF_ID);
genericVnf.setVnfName(VNF_NAME);
return genericVnf;
}
- private MonitorVnfmNodeTask getEtsiVnfMonitorNodeJobTask() {
- return new MonitorVnfmNodeTask(extractPojosForBB, exceptionUtil);
+ private org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf getGenericVnf() {
+ final org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
+ genericVnf.setVnfId(VNF_ID);
+ return genericVnf;
+
+ }
+
+ private MonitorTerminateVnfmNodeTask getEtsiVnfMonitorNodeJobTask() {
+ return new MonitorTerminateVnfmNodeTask(extractPojosForBB, exceptionUtil, mockedAaiVnfResources);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
index 7bd6435b60..e94d7c2923 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterServiceProviderImplTest.java
@@ -228,7 +228,7 @@ public class VnfmAdapterServiceProviderImplTest {
assertFalse(actual.isPresent());
}
- @Test
+ @Test(expected = RestProcessingException.class)
public void testGetInstantiateOperationJobStatus_Exception() {
when(mockedHttpServiceProvider.getHttpResponse(eq(TestConstants.JOB_STATUS_EXPECTED_URL),
@@ -237,8 +237,7 @@ public class VnfmAdapterServiceProviderImplTest {
final VnfmAdapterServiceProvider objUnderTest =
new VnfmAdapterServiceProviderImpl(getVnfmAdapterUrlProvider(), mockedHttpServiceProvider);
- final Optional<QueryJobResponse> actual = objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
- assertFalse(actual.isPresent());
+ objUnderTest.getInstantiateOperationJobStatus(DUMMY_JOB_ID);
}
private QueryJobResponse getQueryJobResponse() {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index a60927d694..1013cc8330 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -48,6 +48,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RequestDetails;
import org.springframework.core.env.Environment;
public class WorkflowActionBBTasksTest extends BaseTaskTest {
@@ -95,14 +97,16 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
String vnfCustomizationUUID = "1234567";
- String serviceInstanceId = "1234567";
+ String modelUuid = "1234567";
BuildingBlock buildingBlock = new BuildingBlock();
buildingBlock.setBpmnFlowName("ConfigAssignVnfBB");
buildingBlock.setKey(vnfCustomizationUUID);
ebb.setBuildingBlock(buildingBlock);
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId(serviceInstanceId);
- ebb.setWorkflowResourceIds(workflowResourceIds);
+ RequestDetails rd = new RequestDetails();
+ ModelInfo mi = new ModelInfo();
+ mi.setModelUuid(modelUuid);
+ rd.setModelInfo(mi);
+ ebb.setRequestDetails(rd);
flowsToExecute.add(ebb);
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
@@ -112,8 +116,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
vnfResourceCustomizations.add(vrc);
GenericVnf genericVnf = new GenericVnf();
genericVnf.setModelCustomizationId(vnfCustomizationUUID);
- doReturn(vnfResourceCustomizations).when(catalogDbClient)
- .getVnfResourceCustomizationByModelUuid(serviceInstanceId);
+ doReturn(vnfResourceCustomizations).when(catalogDbClient).getVnfResourceCustomizationByModelUuid(modelUuid);
doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID,
vnfResourceCustomizations);
@@ -138,14 +141,16 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
String vnfCustomizationUUID = "1234567";
- String serviceInstanceId = "1234567";
+ String modelUuid = "1234567";
BuildingBlock buildingBlock = new BuildingBlock();
buildingBlock.setBpmnFlowName("ConfigDeployVnfBB");
buildingBlock.setKey(vnfCustomizationUUID);
ebb.setBuildingBlock(buildingBlock);
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId(serviceInstanceId);
- ebb.setWorkflowResourceIds(workflowResourceIds);
+ RequestDetails rd = new RequestDetails();
+ ModelInfo mi = new ModelInfo();
+ mi.setModelUuid(modelUuid);
+ rd.setModelInfo(mi);
+ ebb.setRequestDetails(rd);
flowsToExecute.add(ebb);
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
@@ -155,8 +160,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
vnfResourceCustomizations.add(vrc);
GenericVnf genericVnf = new GenericVnf();
genericVnf.setModelCustomizationId(vnfCustomizationUUID);
- doReturn(vnfResourceCustomizations).when(catalogDbClient)
- .getVnfResourceCustomizationByModelUuid(serviceInstanceId);
+ doReturn(vnfResourceCustomizations).when(catalogDbClient).getVnfResourceCustomizationByModelUuid(modelUuid);
doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID,
vnfResourceCustomizations);