aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
authorhyu2010 <hyu2010b@gmail.com>2022-03-24 09:35:24 -0400
committerhyu2010 <hyu2010b@gmail.com>2022-03-24 09:40:43 -0400
commit8f238b408a6d7c4b8f399f0ede383424c25cc93b (patch)
treea3d6b0ada6dc3330dc8ecbfb26c5d97b0e642ce8 /bpmn/so-bpmn-infrastructure-common
parentf87f92782d2784c5e392517000e7a9b50453ee49 (diff)
SO changes for CCVPN enhancement in Jakarta
This update contains for the fixes for the following JIRA: SO-3913: CCVPN enhancement for cloud leased line protection and bandwidth modification Issue-ID: SO-3913 Change-Id: I8d82ef0f939efb5a94045a6d1117c692667eb554 Signed-off-by: hyu2010 <hyu2010b@gmail.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-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)