/*-
* ============LICENSE_START=======================================================
- * OPENECOMP - MSO
+ * ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
import java.util.UUID;
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.util.UriUtils
* This method is executed during the preProcessRequest task of the <class>DoUpdateNetworkInstance.bpmn</class> process.
* @param execution
*/
- public InitializeProcessVariables(Execution execution){
+ public InitializeProcessVariables(DelegateExecution execution){
/* Initialize all the process variables in this block */
execution.setVariable(Prefix + "messageId", "")
* This method is executed during the preProcessRequest task of the <class>DoUpdateNetworkInstance.bpmn</class> process.
* @param execution
*/
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
}
}
- public void callRESTQueryAAICloudRegion (Execution execution) {
+ public void callRESTQueryAAICloudRegion (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
}
- public void callRESTQueryAAINetworkId(Execution execution) {
+ public void callRESTQueryAAINetworkId(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
String aai_endpoint = execution.getVariable("URN_aai_endpoint")
AaiUtil aaiUriUtil = new AaiUtil(this)
String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1"
+ String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
utils.logAudit(queryIdAAIRequest)
execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest)
utils.log("DEBUG", Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest, isDebugEnabled)
}
- public void callRESTReQueryAAINetworkId(Execution execution) {
+ public void callRESTReQueryAAINetworkId(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
String aai_endpoint = execution.getVariable("URN_aai_endpoint")
AaiUtil aaiUriUtil = new AaiUtil(this)
String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1"
+ String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
utils.logAudit(requeryIdAAIRequest)
execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest)
utils.log("DEBUG", " UPDNETI_requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest, isDebugEnabled)
}
- public void callRESTQueryAAINetworkVpnBinding(Execution execution) {
+ public void callRESTQueryAAINetworkVpnBinding(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
if (aai_uri == null || aai_uri == "") {
// using value of 'related-link' from response
if (vpnBindingUri[i].charAt(vpnBindingUri[i].length()-1) == '/') {
- queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1)
+ queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1) + "?depth=all"
} else {
- queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i]
+ queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i] + "?depth=all"
}
} else {
if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') {
vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1)
}
- queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId
+ queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId + "?depth=all"
}
utils.logAudit(queryVpnBindingAAIRequest)
utils.log("DEBUG", " AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled)
String routeTarget = ""
- if (utils.nodeExists(aaiResponseAsString, "global-route-target")) {
- routeTarget = utils.getNodeText1(aaiResponseAsString, "global-route-target")
- routeTargets += "<routeTargets>" + routeTarget + "</routeTargets>" + '\n'
+ String routeRole = ""
+ if (utils.nodeExists(aaiResponseAsString, "route-targets")) {
+ String aaiRouteTargets = utils.getNodeXml(aaiResponseAsString, "route-targets", false)
+ def aaiRouteTargetsXml = new XmlSlurper().parseText(aaiRouteTargets)
+ def aaiRouteTarget = aaiRouteTargetsXml.'**'.findAll {it.name() == "route-target"}
+ for (j in 0..aaiRouteTarget.size()-1) {
+ routeTarget = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "global-route-target")
+ routeRole = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "route-target-role")
+ routeTargets += "<routeTargets>" + '\n' +
+ " <routeTarget>" + routeTarget + "</routeTarget>" + '\n' +
+ " <routeTargetRole>" + routeRole + "</routeTargetRole>" + '\n' +
+ "</routeTargets>" + '\n'
+ }
}
} else {
}
- public void callRESTQueryAAINetworkPolicy(Execution execution) {
+ public void callRESTQueryAAINetworkPolicy(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
if (aai_uri == null || aai_uri == "") {
// using value of 'related-link' from response
if (networkPolicyUriList[i].charAt(networkPolicyUriList[i].length()-1) == '/') {
- queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1)
+ queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1) + "?depth=all"
} else {
- queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i]
+ queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i] + "?depth=all"
}
} else {
// using uri value in URN mapping
if (networkPolicyId.charAt(networkPolicyId.length()-1) == '/') {
networkPolicyId = networkPolicyId.substring(0, networkPolicyId.length()-1)
}
- queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId
+ queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId + "?depth=all"
}
}
- public void callRESTQueryAAINetworkTableRef(Execution execution) {
+ public void callRESTQueryAAINetworkTableRef(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
if (aai_uri == null || aai_uri == "") {
// using value of 'related-link' from response
if (networkTableRefUriList[i].charAt(networkTableRefUriList[i].length()-1) == '/') {
- queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1)
+ queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1) + "?depth=all"
} else {
- queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i]
+ queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i] + "?depth=all"
}
} else {
// using uri value in URN mapping
if (networkTableRefId.charAt(networkTableRefId.length()-1) == '/') {
networkTableRefId = networkTableRefId.substring(0, networkTableRefId.length()-1)
}
- queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId
+ queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId + "?depth=all"
}
}
- public void callRESTUpdateContrailAAINetwork(Execution execution) {
+ public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
String aai_endpoint = execution.getVariable("URN_aai_endpoint")
AaiUtil aaiUriUtil = new AaiUtil(this)
String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution)
- String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1"
+ String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all"
utils.logAudit(updateContrailAAIUrlRequest)
execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest)
}
- public void prepareUpdateNetworkRequest (Execution execution) {
+ public void prepareUpdateNetworkRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
}
- public void prepareSDNCRequest (Execution execution) {
+ public void prepareSDNCRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
// Post or Validate Response Section
// **************************************************
- public void validateUpdateNetworkResponse (Execution execution) {
+ public void validateUpdateNetworkResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
}
- public void validateSDNCResponse (Execution execution) {
+ public void validateSDNCResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
}
- public void postProcessResponse (Execution execution) {
+ public void postProcessResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
}
- public void prepareSDNCRollbackRequest (Execution execution) {
+ public void prepareSDNCRollbackRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
}
- public void prepareRollbackData(Execution execution) {
+ public void prepareRollbackData(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
}
- public void prepareSuccessRollbackData(Execution execution) {
+ public void prepareSuccessRollbackData(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
try {
- if (execution.getVariable("sdncVersion") == '1702') {
+ if (execution.getVariable("sdncVersion") != '1610') {
// skip: 1702 for 'changeassign' or equivalent not yet defined in SNDC, so no rollback.
} else {
prepareSDNCRollbackRequest(execution)
}
- public void setExceptionFlag(Execution execution){
+ public void setExceptionFlag(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
// Build Error Section
// *******************************
- public void processJavaException(Execution execution){
+ public void processJavaException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
try{