aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN
diff options
context:
space:
mode:
authorc00149107 <chenchuanyu@huawei.com>2017-09-22 10:31:09 +0800
committerc00149107 <chenchuanyu@huawei.com>2017-09-22 10:32:11 +0800
commit22b44b9884ca367050e96045e2dcd9675cb605cd (patch)
tree0ac94cbce2ee61e305442a371438b52f7e5676af /bpmn/MSOInfrastructureBPMN
parentbf1dc58d9b8a6db720f1b3cdff14d3b794b9f60a (diff)
Add generic post function
Add generic post function and correct the api define Change-Id: I11c2a10f4aad00f389b68cf7b9c42dab4441027c Issue-ID:SO-57 Signed-off-by: c00149107 <chenchuanyu@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy43
1 files changed, 35 insertions, 8 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
index 4a7f4745bc..43a2731eb6 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
@@ -25,7 +25,6 @@ import groovy.xml.XmlUtil
import groovy.json.*
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-import org.openecomp.mso.bpmn.common.scripts.VidUtils
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.openecomp.mso.rest.APIResponse
@@ -36,7 +35,10 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.runtime.Execution
import org.apache.commons.lang3.*
import org.apache.commons.codec.binary.Base64;
-import org.springframework.web.util.UriUtils
+import org.springframework.web.util.UriUtils
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+import org.openecomp.mso.rest.APIResponse;
/**
* This groovy class supports the <class>CreateGenericE2EServiceInstance.bpmn</class> process.
@@ -44,18 +46,21 @@ import org.springframework.web.util.UriUtils
*/
public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcessor {
+ String createUrl = "/vfc/vfcadapters/v1/ns"
+
+ String instantiateUrl = "/vfcvfcadatpers/v1/ns/{nsInstanceId}/instantiate"
+
+ String queryJobUrl = "/vfc/vfcadatpers/v1/jobs/{jobId}"
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- VidUtils vidUtils = new VidUtils()
-
/**
* Pre Process the BPMN Flow Request
* Inclouds:
- * Deal with the parameters
- * generate the service instance id
- * generate the operation id
+ * generate the nsOperationKey
+ * generate the nsParameters
*/
public void preProcessRequest (Execution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
@@ -101,8 +106,8 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso
utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)
}
-
public void createNetworkService(Execution execution) {
+
}
public void instantiateNetworkService(Execution execution) {
@@ -116,4 +121,26 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso
public void finishNSCreate(Execution execution) {
}
+
+ /**
+ * post request
+ * url: the url of the request
+ * requestBody: the body of the request
+ */
+ private APIResponse postRequest(String url, String requestBody){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ taskProcessor.logDebug( " ======== Started Execute VFC adapter Post Process ======== ", isDebugEnabled)
+ taskProcessor.logDebug( "url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled)
+ APIResponse apiResponse = null
+ try{
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/json");
+ apiResponse = client.httpPost(requestBody)
+ taskProcessor.logDebug( "======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled)
+ }catch(Exception e){
+ taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ return apiResponse
+ }
}