aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2017-11-10 04:49:49 +0000
committerGerrit Code Review <gerrit@onap.org>2017-11-10 04:49:49 +0000
commite795d55a244458a8705760e06a24747cc014cfd3 (patch)
treec485b3fe76cb3e4438fd4f6caf21b71945998289
parent3b24725073dead970e21509e02c04993efcd0575 (diff)
parentb6108e2ad2622a535d33e6da97b404fbc49394a6 (diff)
Merge changes I4e542ffd,Ibb86da2d
* changes: Fix Null Point Exception Fix Delete workflow sent msg to vfc adatper failed
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java3
-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
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java9
5 files changed, 41 insertions, 33 deletions
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 0bdead4835..0b404d76bd 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 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
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 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>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index f5d068f900..f6b30e8772 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -604,15 +604,8 @@ public class E2EServiceInstances {
DelE2ESvcResp jo = mapper.readValue(
camundaJSONResponseBody, DelE2ESvcResp.class);
String operationId = jo.getOperationId();
- OperationStatus operStatus = chkDuplicateServiceInOperStatus(instanceIdMap
- .get("serviceId"));
- if (null != operStatus) {
- msoLogger
- .debug("One task is already in progress state for this service id");
- } else {
- this.createOperationStatusRecord("DELETE", requestId,
+ this.createOperationStatusRecord("DELETE", requestId,
operationId);
- }
} catch (Exception ex) {
msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
requestClient.getUrl(), "", "",