diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2017-11-10 04:49:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-11-10 04:49:49 +0000 |
commit | e795d55a244458a8705760e06a24747cc014cfd3 (patch) | |
tree | c485b3fe76cb3e4438fd4f6caf21b71945998289 /bpmn | |
parent | 3b24725073dead970e21509e02c04993efcd0575 (diff) | |
parent | b6108e2ad2622a535d33e6da97b404fbc49394a6 (diff) |
Merge changes I4e542ffd,Ibb86da2d
* changes:
Fix Null Point Exception
Fix Delete workflow sent msg to vfc adatper failed
Diffstat (limited to 'bpmn')
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> |