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 {
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")
resource.setLinkId(linkId)
resource.setLinkName(epA)
resource.setLinkName2(epB)
+ if (isNotBlank(epBProtect)) {
+ resource.setSegmentId(epBProtect)
+ }
resource.setLinkType("TsciConnectionLink")
resource.setInMaint(false)
"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)
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) {
}
}
+ 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 {
}
}
+ 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)