\r
import org.apache.commons.lang3.*\r
import org.camunda.bpm.engine.delegate.BpmnError\r
-import org.camunda.bpm.engine.runtime.Execution\r
+import org.camunda.bpm.engine.delegate.DelegateExecution\r
+\r
import org.openecomp.mso.bpmn.core.WorkflowException\r
-import org.openecomp.mso.bpmn.core.json.JsonUtils\r
+import org.openecomp.mso.bpmn.core.json.JsonUtils;\r
import org.springframework.web.util.UriUtils\r
\r
\r
this.taskProcessor = taskProcessor\r
}\r
\r
- String SDNCAdapterFeatureRequest(Execution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {\r
+ String SDNCAdapterFeatureRequest(DelegateExecution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {\r
+\r
def utils=new MsoUtils()\r
\r
def prefix = execution.getVariable('prefix')\r
return sdncAdapterFeatureRequest\r
}\r
\r
- String SDNCAdapterActivateVnfRequest(Execution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) {\r
+ String SDNCAdapterActivateVnfRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) {\r
+\r
def utils=new MsoUtils()\r
\r
def prefix = execution.getVariable('prefix')\r
return sdncAdapterActivateVnfRequest\r
}\r
\r
- String SDNCAdapterL3ToHigherLayerRequest(Execution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {\r
+ String SDNCAdapterL3ToHigherLayerRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {\r
+\r
def utils=new MsoUtils()\r
\r
def prefix = execution.getVariable('prefix')\r
\r
\r
\r
- private void SDNCAdapterActivateRequest(Execution execution, String resultVar, String svcAction,\r
+ private void SDNCAdapterActivateRequest(DelegateExecution execution, String resultVar, String svcAction,\r
+\r
String svcOperation, String additionalData) {\r
def utils=new MsoUtils()\r
\r
additionalData = ""\r
}\r
\r
+ boolean isAic3 = execution.getVariable("isAic3")\r
+ \r
+ if(isAic3) {\r
+ nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0")\r
+ }\r
+ else {\r
+ nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X")\r
+ }\r
+ \r
String content = """\r
<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"\r
xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">\r
execution.setVariable(resultVar, content)\r
}\r
\r
+ /**\r
+ * Builds an SDNC "reserve" request and stores it in the specified execution\r
+ * variable. \r
+ * @param execution the execution\r
+ * @param action the type of action: reserve, turnup, etc\r
+ * @param resultVar the execution variable in which the result will be stored\r
+ */\r
+ public void sdncReservePrep(DelegateExecution execution, String action, String resultVar) {\r
+ sdncReservePrep(execution, action, resultVar, false)\r
+ }\r
+\r
/**\r
* Builds an SDNC "reserve" request and stores it in the specified execution\r
* variable.\r
* @param execution the execution\r
+ * @param action the type of action: reserve, turnup, etc\r
* @param resultVar the execution variable in which the result will be stored\r
+ * @param isAic3 boolean to indicate whether request is for AIC3.0\r
*/\r
- public void sdncReservePrep(Execution execution, String action, String resultVar) {\r
- sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, this.taskProcessor)\r
+ public void sdncReservePrep(DelegateExecution execution, String action, String resultVar, boolean isAic3) {\r
+\r
+ sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, isAic3, this.taskProcessor)\r
}\r
\r
/**\r
* @param additionalData additional XML content to be inserted into the\r
* RequestData element (may be null)\r
*/\r
- public void sdncPrep(Execution execution, String resultVar, String svcAction,\r
- String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) {\r
+ public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction,\r
+ String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) {\r
+ sdncPrep(execution, resultVar, svcAction, svcOperation, additionalData, false, taskProcessor)\r
+ }\r
+\r
+ /**\r
+ * Builds a basic SDNC request and stores it in the specified execution variable.\r
+ * @param execution the execution\r
+ * @param resultVar the execution variable in which the result will be stored\r
+ * @param svcAction the svcAction element value\r
+ * @param svcOperation the svcOperation element value\r
+ * @param additionalData additional XML content to be inserted into the RequestData element (may be null)\r
+ * @param isAic3 boolean to indicate whether request is for AIC3.0\r
+ */\r
+ public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction,\r
+\r
+ String svcOperation, String additionalData, boolean isAic3, AbstractServiceTaskProcessor taskProcessor) {\r
def method = getClass().getSimpleName() + '.sdncPrep(' +\r
'execution=' + execution.getId() +\r
', resultVar=' + resultVar +\r
if (additionalData == null) {\r
additionalData = ""\r
}\r
+ \r
+ if(isAic3) {\r
+ nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0")\r
+ }\r
+ else {\r
+ nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X")\r
+ }\r
+\r
\r
String content = """\r
<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"\r
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error")\r
}\r
}\r
-\r
+ \r
+ public String updateHomingInfo(String homingInfo, String aicVersion) {\r
+ String newHomingInfo\r
+ if(homingInfo == null || homingInfo.trim().length() == 0) {\r
+ newHomingInfo = "<l2-homing-information><aic-version>" + aicVersion + "</aic-version></l2-homing-information>"\r
+ }\r
+ else {\r
+ newHomingInfo = homingInfo.substring(0, homingInfo.indexOf("</l2-homing-information>")) + "<aic-version>" + aicVersion + "</aic-version></l2-homing-information>"\r
+ }\r
+ }\r
+ \r
/**\r
* Builds a topology SDNC request and return String request.\r
* As V2 will use 1607-style request, region instead of aic clli code\r
* @param additionalData additional XML content to be inserted into the\r
* RequestData element (may be null)\r
*/\r
- public String sdncTopologyRequestV2 (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) {\r
+ public String sdncTopologyRequestV2 (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) {\r
+\r
def utils=new MsoUtils()\r
\r
// SNDC is expecting request Id for header as unique each call.\r
* @param additionalData additional XML content to be inserted into the\r
* RequestData element (may be null)\r
*/\r
- public String sdncTopologyRequestRsrc (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) {\r
+ public String sdncTopologyRequestRsrc (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) {\r
+\r
def utils=new MsoUtils()\r
\r
// SNDC is expecting request Id for header as unique each call.\r
* @param responseVar the execution variable in which the response is stored\r
* @param workflowException the WorkflowException Object returned from sdnc call\r
*/\r
- public void validateSDNCResponse(Execution execution, String response, WorkflowException workflowException, boolean successIndicator){\r
+ public void validateSDNCResponse(DelegateExecution execution, String response, WorkflowException workflowException, boolean successIndicator){\r
+\r
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
taskProcessor.utils.log("DEBUG", "SDNC Response is: " + response, isDebugLogEnabled)\r
taskProcessor.utils.log("DEBUG", "SuccessIndicator is: " + successIndicator, isDebugLogEnabled)\r
execution.setVariable(prefix+'sdncResponseSuccess', false)\r
taskProcessor.utils.log("DEBUG", "Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response, isDebugLogEnabled)\r
\r
- if (successIndicator == true){\r
+ if (successIndicator){\r
if (response == null || response.trim().equals("")) {\r
taskProcessor.utils.log("DEBUG", response + ' is empty');\r
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty")\r
}else{\r
+\r
// we need to peer into the request data for error\r
- def String decodedXml = taskProcessor.utils.getNodeText1(response, "RequestData")\r
+ def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false)\r
+ def String decodedXml = decodeXML(sdncAdapterWorkflowResponse).replace('<?xml version="1.0" encoding="UTF-8"?>', "")\r
+\r
+ // change '&' to "& (if present as data, ex: subscriber-name = 'FOUR SEASONS HEATING & COOLING_8310006378683'\r
+ decodedXml = decodedXml.replace("&", "&")\r
\r
taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled)\r
\r
\r
try{\r
if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {\r
- requestDataResponseMessage = taskProcessor.utils.getNodeText1(decodedXml, "response-message")\r
- \r
- // note: ResponseMessage appears within "response", not "decodedXml"\r
- } else if (taskProcessor.utils.nodeExists(response, "ResponseMessage")) {\r
- requestDataResponseMessage = taskProcessor.utils.getNodeText1(response, "ResponseMessage")\r
+ requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")\r
+ } else if (taskProcessor.utils.nodeExists(decodedXml, "ResponseMessage")) {\r
+ requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "ResponseMessage")\r
}\r
}catch(Exception e){\r
- taskProcessor.utils.log("DEBUG", 'Error caught while decoding response ' + e.getMessage(), isDebugLogEnabled)\r
+ taskProcessor.utils.log("DEBUG", 'Error caught while decoding resposne ' + e.getMessage(), isDebugLogEnabled)\r
}\r
\r
if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) {\r
taskProcessor.utils.log("DEBUG","response-code node is empty", isDebugLogEnabled)\r
requestDataResponseCode = 0\r
}else{\r
- requestDataResponseCode = code as Integer\r
+ requestDataResponseCode = code.toInteger()\r
taskProcessor.utils.log("DEBUG","response-code is: " + requestDataResponseCode, isDebugLogEnabled)\r
}\r
- \r
- // note: ResponseCode appears within "response", not "decodedXml"\r
- }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){\r
+ }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){\r
taskProcessor.utils.log("DEBUG","ResponseCode node Exist ", isDebugLogEnabled)\r
- String code = taskProcessor.utils.getNodeText1(response, "ResponseCode")\r
+ String code = taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")\r
if(code.isEmpty() || code.equals("")){\r
// if ResponseCode blank then Success\r
taskProcessor.utils.log("DEBUG","ResponseCode node is empty", isDebugLogEnabled)\r
requestDataResponseCode = 0\r
}else{\r
- requestDataResponseCode = code as Integer\r
+ requestDataResponseCode = code.toInteger()\r
taskProcessor.utils.log("DEBUG","ResponseCode is: " + requestDataResponseCode, isDebugLogEnabled)\r
}\r
}else{\r
* @param responseCodeVar the execution variable in which the response code is stored\r
* @param errorResponseVar the execution variable in which the error response is stored\r
*/\r
- public void validateL3BondingSDNCResp(Execution execution, String response, WorkflowException workflowException, boolean success) {\r
+ public void validateL3BondingSDNCResp(DelegateExecution execution, String response, WorkflowException workflowException, boolean success) {\r
+\r
def method = getClass().getSimpleName() + '.validateL3BondingSDNCResp(' +\r
'execution=' + execution.getId() +\r
', response=' + response +\r
execution.setVariable(prefix+'sdncResponseSuccess', false)\r
\r
taskProcessor.utils.log("sdncAdapter Success Indicator is: " + success, isDebugLogEnabled)\r
- if (success == true) {\r
+ if (success) {\r
\r
// we need to look inside the request data for error\r
def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false)\r
\r
\r
\r
-}
+}\r