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>
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index 0bdead4..0b404d7 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -313,6 +313,9 @@
String resourceTemplateUUIDs) throws MsoRequestsDbException{
String[] resourceLst = resourceTemplateUUIDs.split(":");
for(String resource: resourceLst){
+ if("".equals(resource)){
+ continue;
+ }
ResourceOperationStatus resourceStatus = new ResourceOperationStatus();
resourceStatus.setOperationId(operationId);
resourceStatus.setServiceId(serviceId);
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 11e31ef..dbefb6c 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 @@
}
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 996173e..b5ceb7a 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 @@
*/
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 @@
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 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 @@
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 @@
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 @@
* 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 @@
* 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 e39db56..461af11 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn
@@ -133,10 +133,10 @@
<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>