aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorShashikanth VH <shashikanth.vh@huawei.com>2022-03-28 15:27:21 +0000
committerGerrit Code Review <gerrit@onap.org>2022-03-28 15:27:21 +0000
commit485b697439d1d9fbc567d226d91987ee551bc477 (patch)
treed665c7325582deb719d6f7852693bf26a22ae521 /bpmn
parent1263902f3a5a8c649f7305551d60ddd7efa0503d (diff)
parent8f238b408a6d7c4b8f399f0ede383424c25cc93b (diff)
Merge "SO changes for CCVPN enhancement in Jakarta"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy54
2 files changed, 56 insertions, 3 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy
index 2e0f3cfd66..4681713fd7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isNotBlank
class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor {
@@ -333,6 +334,7 @@ class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor {
String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA")
String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB")
+ String epBProtect = jsonUtil.getJsonValue(linkStr, "transportEndpointBProtection")
String modelInvariantId = execution.getVariable("modelInvariantUuid")
String modelVersionId = execution.getVariable("modelUuid")
@@ -340,6 +342,9 @@ class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor {
resource.setLinkId(linkId)
resource.setLinkName(epA)
resource.setLinkName2(epB)
+ if (isNotBlank(epBProtect)) {
+ resource.setSegmentId(epBProtect)
+ }
resource.setLinkType("TsciConnectionLink")
resource.setInMaint(false)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy
index 5c9877840d..bfd5ac81d3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy
@@ -109,6 +109,14 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
"transportNetworks", "transportNetworks", true)
logger.debug("transportNetworks: " + execution.getVariable("transportNetworks"))
+ serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr,
+ "modifyAction", "modifyAction");
+ if (isNotBlank(execution.getVariable("modifyAction"))) {
+ logger.debug("modifyAction: " + execution.getVariable("modifyAction"))
+ } else {
+ logger.debug("modifyAction is not set")
+ }
+
if (isBlank(serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr,
"enableSdnc", "enableSdnc"))) {
serviceIntentUtils.setEnableSdncConfig(execution)
@@ -266,12 +274,16 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
void updateTsciNetworks(DelegateExecution execution) {
try {
+ if (modifyBandwidthGlobal(execution)) {
+ String netStr = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks")).get(0)
+ int maxBw = getMaxBwFromNetworkJsonStr(execution, netStr)
+ updateNetworkPolicyGlobal(execution, maxBw)
+ return
+ }
List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks"))
for (String networkStr : networkStrList) {
- updateLogicalLinksInNetwork(execution, networkStr)
- updateNetworkPolicy(execution, networkStr)
+ updateTsciNetwork(execution, networkStr)
}
-
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
@@ -280,6 +292,20 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
}
}
+ boolean modifyBandwidthGlobal(DelegateExecution execution) {
+ String modifyAction = execution.getVariable("modifyAction")
+ if (isNotBlank(modifyAction) && modifyAction.equals("bandwidth")) {
+ return true
+ }
+
+ return false
+ }
+
+ void updateTsciNetwork(DelegateExecution execution, String networkStr) {
+ updateLogicalLinksInNetwork(execution, networkStr)
+ updateNetworkPolicy(execution, networkStr)
+ }
+
int getMaxBwFromNetworkJsonStr(DelegateExecution execution, String networkJsonStr) {
int maxBw = 0
try {
@@ -327,6 +353,28 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
}
}
+ void updateNetworkPolicyGlobal(DelegateExecution execution, int maxBw) {
+ try {
+ List<String> arIdList = execution.getVariable("arIdList")
+ for (String arId : arIdList) {
+ Map<String, String> policyMap = execution.getVariable("arPolicyMap")
+ String policyId = policyMap.get(arId)
+ if (isBlank(policyId)) {
+ String msg = String.format("ERROR: updateNetworkPolicy: policyId not found. arId=%s", arId)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ updatePolicyMaxBandwidthInAAI(execution, policyId, maxBw)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = String.format("ERROR: updateNetworkPolicy: exception: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+
void updateNetworkPolicy(DelegateExecution execution, String networkJsonStr) {
try {
int maxBw = getMaxBwFromNetworkJsonStr(execution, networkJsonStr)