aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main
diff options
context:
space:
mode:
authorc00149107 <chenchuanyu@huawei.com>2017-11-10 10:03:50 +0800
committerc00149107 <chenchuanyu@huawei.com>2017-11-10 10:03:50 +0800
commit0abcd5d7a158bc43c982f0005aad99baa6eb397f (patch)
tree21eb4fcef605417d885903e015e2dd95250a3f46 /bpmn/MSOInfrastructureBPMN/src/main
parentd6b6b333748752d72dcdb4bf30c177625ccd6933 (diff)
Fix Delete workflow sent msg to vfc adatper failed
Fix Delete workflow sent msg to vfc adatper failed Change-Id: Ibb86da2d9e03e0004854035b21daaae09d3f19e6 Issue-ID:SO-327 Signed-off-by: c00149107 <chenchuanyu@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy7
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy49
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn6
3 files changed, 37 insertions, 25 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index 11e31ef765..dbefb6c346 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -430,4 +430,11 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
utils.log("INFO", "Prepare VFC Request finished", isDebugEnabled)
}
+
+ /**
+ * post config request.
+ */
+ public void postConfigRequest(execution){
+ //now do noting
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
index 996173ead5..b5ceb7a803 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
@@ -46,11 +46,10 @@ import org.openecomp.mso.rest.APIResponse;
*/
public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
- String deleteUrl = "/vfc/vfcadapters/v1/ns/{nsInstanceId}"
-
- String terminateUrl = "/vfcvfcadatpers/v1/ns/{nsInstanceId}/terminate"
+
+ String vfcUrl = "/vfc/rest/v1/vfcadapter"
- String queryJobUrl = "/vfc/vfcadatpers/v1/jobs/{jobId}"
+ String host = "http://mso.mso.testlab.openecomp.org:8080"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -75,14 +74,20 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
utils.log("INFO", "serviceId:" + serviceId, isDebugEnabled)
String operationId = execution.getVariable("operationId")
utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled)
- String nodeTemplateUUID = execution.getVariable("resourceTemplateUUID")
+ String nodeTemplateUUID = execution.getVariable("resourceTemplateId")
utils.log("INFO", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled)
String nsInstanceId = execution.getVariable("resourceInstanceId")
utils.log("INFO", "nsInstanceId:" + nsInstanceId, isDebugEnabled)
- String nsOperationKey = "{\"globalSubscriberId\":\"" + globalSubscriberId + "\",\"serviceType:\""
- + serviceType + "\",\"serviceId\":\"" + serviceId + "\",\"operationId\":\"" + operationId
- +"\",\"nodeTemplateUUID\":\"" + nodeTemplateUUID + "\"}";
+ execution.setVariable("nsInstanceId",nsInstanceId)
+ String nsOperationKey = """{
+ "globalSubscriberId":"${globalSubscriberId}",
+ "serviceType":"${serviceType}",
+ "serviceId":"${serviceId}",
+ "operationId":"${operationId}",
+ "nodeTemplateUUID":"${nodeTemplateUUID}"
+ }"""
execution.setVariable("nsOperationKey", nsOperationKey);
+ utils.log("INFO", "nsOperationKey:" + nsOperationKey, isDebugEnabled)
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
@@ -99,9 +104,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
public void deleteNetworkService(Execution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", " *** deleteNetworkService start *** ", isDebugEnabled)
- String nsOperationKey = excution.getVariable("nsOperationKey");
- String url = deleteUrl.replaceAll("{nsInstanceId}", execution.getVariable("nsInstanceId"))
- APIResponse apiResponse = deleteRequest(url, reqBody)
+ String nsOperationKey = execution.getVariable("nsOperationKey");
+ String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId")
+ APIResponse apiResponse = deleteRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatusCode()
String aaiResponseAsString = apiResponse.getResponseBodyAsString()
String operationStatus = "error";
@@ -120,15 +125,15 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", " *** terminateNetworkService start *** ", isDebugEnabled)
String nsOperationKey = execution.getVariable("nsOperationKey")
- String url = terminateUrl.replaceAll("{nsInstanceId}", execution.getVariable("nsInstanceId"))
- APIResponse apiResponse = postRequest(url, reqBody)
+ String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate"
+ APIResponse apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatusCode()
String aaiResponseAsString = apiResponse.getResponseBodyAsString()
String jobId = "";
if(returnCode== "200"){
jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
}
- execution.setVariable("jobId", nsInstanceId)
+ execution.setVariable("jobId", jobId)
utils.log("INFO", " *** terminateNetworkService end *** ", isDebugEnabled)
}
@@ -139,9 +144,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", " *** queryNSProgress start *** ", isDebugEnabled)
String jobId = execution.getVariable("jobId")
- String nsOperationKey = excution.getVariable("nsOperationKey");
- String url = queryJobUrl.replaceAll("{jobId}", execution.getVariable("jobId"))
- APIResponse createRsp = postRequest(url, nsOperationKey)
+ String nsOperationKey = execution.getVariable("nsOperationKey");
+ String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId")
+ APIResponse createRsp = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatusCode()
String aaiResponseAsString = apiResponse.getResponseBodyAsString()
String operationProgress = "100"
@@ -175,14 +180,14 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
* url: the url of the request
* requestBody: the body of the request
*/
- private APIResponse postRequest(String url, String requestBody){
+ private APIResponse postRequest(Execution execution, String url, String requestBody){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("INFO", " ======== Started Execute VFC adapter Post Process ======== ", isDebugEnabled)
utils.log("INFO", "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");
+ RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk");;
apiResponse = client.httpPost(requestBody)
utils.log("INFO", "response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled)
utils.log("INFO", "======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled)
@@ -197,14 +202,14 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
* url: the url of the request
* requestBody: the body of the request
*/
- private APIResponse deleteRequest(String url, String requestBody){
+ private APIResponse deleteRequest(Execution execution, String url, String requestBody){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("INFO", " ======== Started Execute VFC adapter Delete Process ======== ", isDebugEnabled)
- utils.log("INFO", "url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled)
+ utils.log("INFO", "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");
+ RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk");
apiResponse = client.httpDelete(requestBody)
utils.log("INFO", "response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled)
utils.log("INFO", "======== Completed Execute VF-C adapter Delete Process ======== ", isDebugEnabled)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn
index e39db56ee8..461af11061 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn
@@ -133,10 +133,10 @@ ddsi.preResourceDelete(execution, resourceName )]]></bpmn:script>
<bpmn:extensionElements>
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="serviceType" target="serviceType" />
- <camunda:in source="serviceId" target="serviceId" />
+ <camunda:in source="serviceInstanceId" target="serviceId" />
<camunda:in source="operationId" target="operationId" />
- <camunda:in source="resouceTemplateUUID" target="resouceTemplateUUID" />
- <camunda:in source="resouceInstanceId" target="resouceInstanceId" />
+ <camunda:in source="resourceTemplateId" target="resourceTemplateId" />
+ <camunda:in source="resourceInstanceId" target="resourceInstanceId" />
<camunda:in source="resourceType" target="resourceType" />
<camunda:in source="operationType" target="operationType" />
</bpmn:extensionElements>