diff options
8 files changed, 1009 insertions, 310 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java index 219dac6907..bceb7496ab 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java @@ -20,14 +20,14 @@ package org.openecomp.mso.openstack.utils; -import java.lang.reflect.InvocationTargetException; import org.openecomp.mso.cloud.CloudConfig; import org.openecomp.mso.cloud.CloudConfigFactory; import org.openecomp.mso.cloud.CloudIdentity; import org.openecomp.mso.cloud.CloudSite; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.openstack.utils.MsoKeystoneUtils; + +import java.lang.reflect.InvocationTargetException; public class MsoTenantUtilsFactory { @@ -55,7 +55,7 @@ public class MsoTenantUtilsFactory { public MsoTenantUtils getTenantUtilsByServerType(String serverType) { MsoTenantUtils tenantU = null; - if (CloudIdentity.IdentityServerType.KEYSTONE.equals(serverType)) { + if (CloudIdentity.IdentityServerType.KEYSTONE.toString().equals(serverType)) { tenantU = new MsoKeystoneUtils (msoPropID); } else { try { 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 43a2731eb6..b346faf4c6 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 @@ -41,10 +41,10 @@ import org.openecomp.mso.rest.RESTConfig import org.openecomp.mso.rest.APIResponse;
/**
- * This groovy class supports the <class>CreateGenericE2EServiceInstance.bpmn</class> process.
- * flow for E2E ServiceInstance Create
+ * This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process.
+ * flow for VFC Network Service Create
*/
-public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcessor {
+public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
String createUrl = "/vfc/vfcadapters/v1/ns"
@@ -66,7 +66,12 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String msg = ""
utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled)
- try {
+ try {
+ //deal with nsName and Description
+ String nsServiceName = execution.getVariable("nsServiceName")
+ String nsServiceDescription = execution.getVariable("nsServiceDescription")
+ utils.log("DEBUG", "nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
+ //deal with operation key
String globalSubscriberId = execution.getVariable("globalSubscriberId")
utils.log("DEBUG", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
String serviceType = execution.getVariable("serviceType")
@@ -76,7 +81,7 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso String operationId = execution.getVariable("operationId")
utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled)
String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID")
- utils.log("DEBUG", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
+ utils.log("DEBUG", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled)
/*
* segmentInformation needed as a object of segment
* {
@@ -90,11 +95,12 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso */
String siRequest = execution.getVariable("segmentInformation")
utils.log("DEBUG", "Input Request:" + siRequest, isDebugEnabled)
- String nsOperationKey = "{\"globalSubscriberId\":" + globalSubscriberId + ",\"serviceType:\""
- + serviceType + ",\"serviceId\":" + serviceId + ",\"operationId\":" + operationId
- +",\"nodeTemplateUUID\":" + nodeTemplateUUID + "}";
+ String nsOperationKey = "{\"globalSubscriberId\":\"" + globalSubscriberId + "\",\"serviceType:\""
+ + serviceType + "\",\"serviceId\":\"" + serviceId + "\",\"operationId\":\"" + operationId
+ +"\",\"nodeTemplateUUID\":\"" + nodeTemplateUUID + "\"}";
execution.setVariable("nsOperationKey", nsOperationKey);
execution.setVariable("nsParameters", jsonUtil.getJsonValue(siRequest, "nsParameters"))
+
} catch (BpmnError e) {
throw e;
@@ -106,20 +112,82 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)
}
+ /**
+ * create NS task
+ */
public void createNetworkService(Execution execution) {
-
+
+ String nsOperationKey = excution.getVariable("nsOperationKey");
+ String nsParameters = excution.getVariable("nsParameters");
+ String nsServiceName = execution.getVariable("nsServiceName")
+ String nsServiceDescription = execution.getVariable("nsServiceDescription")
+ String reqBody = "{\"nsServiceName\":\"" + nsServiceName + "\",\"nsServiceDescription\":\"" + nsServiceDescription
+ +"\",\"nsOperationKey\":" + nsOperationKey + ",\"nsParameters\":" + nsParameters
+ APIResponse apiResponse = postRequest(createUrl, reqBody)
+ String returnCode = apiResponse.getStatusCode()
+ String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+ String nsInstanceId = "";
+ if(returnCode== "200"){
+ nsInstanceId = jsonUtil.getJsonValue(aaiResponseAsString, "nsInstanceId")
+ }
+ execution.setVariable("nsInstanceId", nsInstanceId)
+
}
+ /**
+ * instantiate NS task
+ */
public void instantiateNetworkService(Execution execution) {
+ String nsOperationKey = excution.getVariable("nsOperationKey");
+ String nsParameters = excution.getVariable("nsParameters");
+ String nsServiceName = execution.getVariable("nsServiceName")
+ String nsServiceDescription = execution.getVariable("nsServiceDescription")
+ String reqBody = "{\"nsServiceName\":\"" + nsServiceName + "\",\"nsServiceDescription\":\"" + nsServiceDescription
+ +"\",\"nsOperationKey\":" + nsOperationKey + ",\"nsParameters\":" + nsParameters
+ String url = instantiateUrl.replaceAll("{nsInstanceId}", execution.getVariable("nsInstanceId"))
+ APIResponse apiResponse = postRequest(url, reqBody)
+ String returnCode = apiResponse.getStatusCode()
+ String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+ String jobId = "";
+ if(returnCode== "200"){
+ jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
+ }
+ execution.setVariable("jobId", nsInstanceId)
}
+ /**
+ * query NS task
+ */
public void queryNSProgress(Execution execution) {
+ String jobId = execution.getVariable("jobId")
+ String nsOperationKey = excution.getVariable("nsOperationKey");
+ String url = queryJobUrl.replaceAll("{jobId}", execution.getVariable("jobId"))
+ APIResponse apiResponse = postRequest(url, nsOperationKey)
+ String returnCode = apiResponse.getStatusCode()
+ String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+ String operationStatus = "error"
+ if(returnCode== "200"){
+ operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status")
+ }
+ exection.setVariable("operationStatus", operationStatus)
}
+ /**
+ * delay 5 sec
+ */
public void timeDelay(Execution execution) {
+ try {
+ Thread.sleep(5000);
+ } catch(InterruptedException e) {
+ taskProcessor.utils.log("ERROR", "Time Delay exception" + e , isDebugEnabled)
+ }
}
+ /**
+ * finish NS task
+ */
public void finishNSCreate(Execution execution) {
+ //no need to do anything util now
}
/**
@@ -136,11 +204,12 @@ public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcesso 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( "response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled)
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
}
}
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 new file mode 100644 index 0000000000..f3659ed52c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -0,0 +1,207 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.scripts;
+
+import static org.apache.commons.lang3.StringUtils.*;
+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.core.WorkflowException
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.rest.APIResponse
+
+import java.util.UUID;
+
+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.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+import org.openecomp.mso.rest.APIResponse;
+
+/**
+ * This groovy class supports the <class>DODeleteVFCNetworkServiceInstance.bpmn</class> process.
+ * flow for E2E ServiceInstance Delete
+ */
+public class DODeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
+
+ String deleteUrl = "/vfc/vfcadapters/v1/ns/{nsInstanceId}"
+
+ String terminateUrl = "/vfcvfcadatpers/v1/ns/{nsInstanceId}/terminate"
+
+ String queryJobUrl = "/vfc/vfcadatpers/v1/jobs/{jobId}"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ /**
+ * Pre Process the BPMN Flow Request
+ * Inclouds:
+ * generate the nsOperationKey
+ */
+ public void preProcessRequest (Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ String msg = ""
+ utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled)
+ try {
+ //deal with operation key
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ utils.log("DEBUG", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
+ String serviceType = execution.getVariable("serviceType")
+ utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled)
+ String serviceId = execution.getVariable("serviceId")
+ utils.log("DEBUG", "serviceId:" + serviceId, isDebugEnabled)
+ String operationId = execution.getVariable("operationId")
+ utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled)
+ String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID")
+ utils.log("DEBUG", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled)
+ String nsInstanceId = execution.getVariable("nsInstanceId")
+ utils.log("DEBUG", "nsInstanceId:" + nsInstanceId, isDebugEnabled)
+ String nsOperationKey = "{\"globalSubscriberId\":\"" + globalSubscriberId + "\",\"serviceType:\""
+ + serviceType + "\",\"serviceId\":\"" + serviceId + "\",\"operationId\":\"" + operationId
+ +"\",\"nodeTemplateUUID\":\"" + nodeTemplateUUID + "\"}";
+ execution.setVariable("nsOperationKey", nsOperationKey);
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)
+ }
+
+ /**
+ * delete NS task
+ */
+ public void deleteNetworkService(Execution execution) {
+ String nsOperationKey = excution.getVariable("nsOperationKey");
+ String url = deleteUrl.replaceAll("{nsInstanceId}", execution.getVariable("nsInstanceId"))
+ APIResponse apiResponse = deleteRequest(url, reqBody)
+ String returnCode = apiResponse.getStatusCode()
+ String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+ String operationStatus = "error";
+ if(returnCode== "200"){
+ operationStatus = "finished"
+ }
+ execution.setVariable("operationStatus", operationStatus)
+ }
+
+ /**
+ * instantiate NS task
+ */
+ public void terminateNetworkService(Execution execution) {
+ String nsOperationKey = execution.getVariable("nsOperationKey")
+ String url = terminateUrl.replaceAll("{nsInstanceId}", execution.getVariable("nsInstanceId"))
+ APIResponse apiResponse = postRequest(url, reqBody)
+ String returnCode = apiResponse.getStatusCode()
+ String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+ String jobId = "";
+ if(returnCode== "200"){
+ jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
+ }
+ execution.setVariable("jobId", nsInstanceId)
+ }
+
+ /**
+ * query NS task
+ */
+ public void queryNSProgress(Execution execution) {
+ String jobId = execution.getVariable("jobId")
+ String nsOperationKey = excution.getVariable("nsOperationKey");
+ String url = queryJobUrl.replaceAll("{jobId}", execution.getVariable("jobId"))
+ APIResponse createRsp = postRequest(url, nsOperationKey)
+ String returnCode = apiResponse.getStatusCode()
+ String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+ String operationProgress = "100"
+ if(returnCode== "200"){
+ operationProgress = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.progress")
+ }
+ exection.setVariable("operationProgress", operationProgress)
+ }
+
+ /**
+ * delay 5 sec
+ */
+ public void timeDelay(Execution execution) {
+ try {
+ Thread.sleep(5000);
+ } catch(InterruptedException e) {
+ taskProcessor.utils.log("ERROR", "Time Delay exception" + e , isDebugEnabled)
+ }
+ }
+
+ /**
+ * finish NS task
+ */
+ public void finishNSDelete(Execution execution) {
+ //no need to do anything util now
+ }
+
+ /**
+ * 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( "response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled)
+ taskProcessor.logDebug( "======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled)
+ }catch(Exception e){
+ taskProcessor.utils.log("ERROR", "Exception occured while executing VF-C Post Call. Exception is: \n" + e, isDebugEnabled)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ return apiResponse
+ }
+ /**
+ * delete request
+ * url: the url of the request
+ * requestBody: the body of the request
+ */
+ private APIResponse deleteRequest(String url, String requestBody){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ taskProcessor.logDebug( " ======== Started Execute VFC adapter Delete 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.httpDelete(requestBody)
+ taskProcessor.logDebug( "response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled)
+ taskProcessor.logDebug( "======== Completed Execute VF-C adapter Delete Process ======== ", isDebugEnabled)
+ }catch(Exception e){
+ taskProcessor.utils.log("ERROR", "Exception occured while executing VF-C Post Call. Exception is: \n" + e, isDebugEnabled)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ return apiResponse
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index 2b3cfa6a8b..758de28d36 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -128,7 +128,7 @@ ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_1dd86x8" sourceRef="ScriptTask_0q37vn9" targetRef="ExclusiveGateway_1nk6aol" /> <bpmn2:scriptTask id="ScriptTask_0081lne" name="Prepare SDN-C Adaptor Data Request" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0mcyg0e</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0k4q7jm</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0ofqw6v</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() @@ -147,20 +147,10 @@ csi.preVFCRequest(execution)]]></bpmn2:script> </bpmn2:callActivity> <bpmn2:callActivity id="CallActivity_0uwm4l1" name="Call DoCreateVFCNetworkServiceInstance" calledElement="DoCreateVFCNetworkServiceInstance"> <bpmn2:incoming>SequenceFlow_15zgrcq</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1x8vphc</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_0k4q7jm</bpmn2:outgoing> </bpmn2:callActivity> - <bpmn2:exclusiveGateway id="ExclusiveGateway_0lczgac" name="Sueecss?" default="SequenceFlow_1yv1kef"> - <bpmn2:incoming>SequenceFlow_1vvdkcs</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1yv1kef</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_1d4wn2y</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:exclusiveGateway id="ExclusiveGateway_0cdz77v" name="Success?" default="SequenceFlow_0ou0spo"> - <bpmn2:incoming>SequenceFlow_1x8vphc</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0ou0spo</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_0mcyg0e</bpmn2:outgoing> - </bpmn2:exclusiveGateway> <bpmn2:scriptTask id="ScriptTask_1xdjlzm" name="Post Config Service Instance Creation" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1d4wn2y</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1vvdkcs</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_092ghvu</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* def csi = new DoCreateE2EServiceInstance() @@ -168,25 +158,13 @@ csi.postConfigRequest(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_0ofqw6v" sourceRef="ScriptTask_0081lne" targetRef="CallActivity_09c3ajg" /> <bpmn2:sequenceFlow id="SequenceFlow_15zgrcq" sourceRef="ScriptTask_0wvq4t8" targetRef="CallActivity_0uwm4l1" /> - <bpmn2:sequenceFlow id="SequenceFlow_1vvdkcs" sourceRef="CallActivity_09c3ajg" targetRef="ExclusiveGateway_0lczgac" /> - <bpmn2:sequenceFlow id="SequenceFlow_1x8vphc" sourceRef="CallActivity_0uwm4l1" targetRef="ExclusiveGateway_0cdz77v" /> - <bpmn2:sequenceFlow id="SequenceFlow_1yv1kef" name="No" sourceRef="ExclusiveGateway_0lczgac" targetRef="EndEvent_11lmyvs" /> - <bpmn2:sequenceFlow id="SequenceFlow_1d4wn2y" name="Yes" sourceRef="ExclusiveGateway_0lczgac" targetRef="ScriptTask_1xdjlzm"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_0ou0spo" name="No" sourceRef="ExclusiveGateway_0cdz77v" targetRef="EndEvent_01h4q8z" /> + <bpmn2:sequenceFlow id="SequenceFlow_1vvdkcs" sourceRef="CallActivity_09c3ajg" targetRef="ScriptTask_1xdjlzm" /> <bpmn2:sequenceFlow id="SequenceFlow_092ghvu" sourceRef="ScriptTask_1xdjlzm" targetRef="EndEvent_0kbbt94" /> - <bpmn2:sequenceFlow id="SequenceFlow_0mcyg0e" sourceRef="ExclusiveGateway_0cdz77v" targetRef="ScriptTask_0081lne" /> <bpmn2:sequenceFlow id="SequenceFlow_1170ztf" sourceRef="ExclusiveGateway_1nk6aol" targetRef="ScriptTask_0wvq4t8" /> - <bpmn2:endEvent id="EndEvent_11lmyvs"> - <bpmn2:incoming>SequenceFlow_1yv1kef</bpmn2:incoming> - </bpmn2:endEvent> - <bpmn2:endEvent id="EndEvent_01h4q8z"> - <bpmn2:incoming>SequenceFlow_0ou0spo</bpmn2:incoming> - </bpmn2:endEvent> <bpmn2:endEvent id="EndEvent_0kbbt94"> <bpmn2:incoming>SequenceFlow_092ghvu</bpmn2:incoming> </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0k4q7jm" sourceRef="CallActivity_0uwm4l1" targetRef="ScriptTask_0081lne" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -362,37 +340,25 @@ csi.postConfigRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0081lne_di" bpmnElement="ScriptTask_0081lne"> - <dc:Bounds x="786" y="818" width="100" height="80" /> + <dc:Bounds x="850" y="819" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0wvq4t8_di" bpmnElement="ScriptTask_0wvq4t8"> <dc:Bounds x="972" y="564" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_09c3ajg_di" bpmnElement="CallActivity_09c3ajg"> - <dc:Bounds x="573" y="819" width="100" height="80" /> + <dc:Bounds x="601" y="819" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0uwm4l1_di" bpmnElement="CallActivity_0uwm4l1"> <dc:Bounds x="972" y="690" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0lczgac_di" bpmnElement="ExclusiveGateway_0lczgac" isMarkerVisible="true"> - <dc:Bounds x="402" y="833" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="402" y="808" width="49" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0cdz77v_di" bpmnElement="ExclusiveGateway_0cdz77v" isMarkerVisible="true"> - <dc:Bounds x="997" y="833" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="998" y="808" width="49" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1xdjlzm_di" bpmnElement="ScriptTask_1xdjlzm"> - <dc:Bounds x="218" y="818" width="100" height="80" /> + <dc:Bounds x="372" y="819" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ofqw6v_di" bpmnElement="SequenceFlow_0ofqw6v"> - <di:waypoint xsi:type="dc:Point" x="786" y="858" /> - <di:waypoint xsi:type="dc:Point" x="673" y="859" /> + <di:waypoint xsi:type="dc:Point" x="850" y="859" /> + <di:waypoint xsi:type="dc:Point" x="701" y="859" /> <bpmndi:BPMNLabel> - <dc:Bounds x="684.5" y="837.5" width="90" height="12" /> + <dc:Bounds x="730.5" y="838" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_15zgrcq_di" bpmnElement="SequenceFlow_15zgrcq"> @@ -403,54 +369,17 @@ csi.postConfigRequest(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1vvdkcs_di" bpmnElement="SequenceFlow_1vvdkcs"> - <di:waypoint xsi:type="dc:Point" x="573" y="859" /> - <di:waypoint xsi:type="dc:Point" x="452" y="858" /> + <di:waypoint xsi:type="dc:Point" x="601" y="859" /> + <di:waypoint xsi:type="dc:Point" x="472" y="859" /> <bpmndi:BPMNLabel> - <dc:Bounds x="467.5" y="837.5" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1x8vphc_di" bpmnElement="SequenceFlow_1x8vphc"> - <di:waypoint xsi:type="dc:Point" x="1022" y="770" /> - <di:waypoint xsi:type="dc:Point" x="1022" y="833" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="992" y="795.5" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1yv1kef_di" bpmnElement="SequenceFlow_1yv1kef"> - <di:waypoint xsi:type="dc:Point" x="427" y="883" /> - <di:waypoint xsi:type="dc:Point" x="427" y="962" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="455" y="892" width="14" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1d4wn2y_di" bpmnElement="SequenceFlow_1d4wn2y"> - <di:waypoint xsi:type="dc:Point" x="402" y="858" /> - <di:waypoint xsi:type="dc:Point" x="318" y="858" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="823.2259872894327" y="883.5416267409498" width="18" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ou0spo_di" bpmnElement="SequenceFlow_0ou0spo"> - <di:waypoint xsi:type="dc:Point" x="1022" y="883" /> - <di:waypoint xsi:type="dc:Point" x="1022" y="962" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1045" y="895" width="14" height="12" /> + <dc:Bounds x="491.5" y="838" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_092ghvu_di" bpmnElement="SequenceFlow_092ghvu"> - <di:waypoint xsi:type="dc:Point" x="218" y="858" /> - <di:waypoint xsi:type="dc:Point" x="182" y="858" /> - <di:waypoint xsi:type="dc:Point" x="182" y="858" /> - <di:waypoint xsi:type="dc:Point" x="137" y="858" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="152" y="852" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0mcyg0e_di" bpmnElement="SequenceFlow_0mcyg0e"> - <di:waypoint xsi:type="dc:Point" x="997" y="858" /> - <di:waypoint xsi:type="dc:Point" x="886" y="858" /> + <di:waypoint xsi:type="dc:Point" x="372" y="859" /> + <di:waypoint xsi:type="dc:Point" x="222" y="859" /> <bpmndi:BPMNLabel> - <dc:Bounds x="896.5" y="837" width="90" height="12" /> + <dc:Bounds x="252" y="838" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1170ztf_di" bpmnElement="SequenceFlow_1170ztf"> @@ -460,24 +389,20 @@ csi.postConfigRequest(execution)]]></bpmn2:script> <dc:Bounds x="992" y="531" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0g2btws_di" bpmnElement="EndEvent_11lmyvs"> - <dc:Bounds x="409" y="962" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="292" y="1001" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0y0wvdf_di" bpmnElement="EndEvent_01h4q8z"> - <dc:Bounds x="1004" y="962" width="36" height="36" /> + <bpmndi:BPMNShape id="EndEvent_01p249c_di" bpmnElement="EndEvent_0kbbt94"> + <dc:Bounds x="186" y="841" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="887" y="1001" width="90" height="12" /> + <dc:Bounds x="68" y="881" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_01p249c_di" bpmnElement="EndEvent_0kbbt94"> - <dc:Bounds x="101" y="840" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_0k4q7jm_di" bpmnElement="SequenceFlow_0k4q7jm"> + <di:waypoint xsi:type="dc:Point" x="1022" y="770" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="859" /> + <di:waypoint xsi:type="dc:Point" x="950" y="859" /> <bpmndi:BPMNLabel> - <dc:Bounds x="28" y="880" width="0" height="12" /> + <dc:Bounds x="1037" y="808.5" width="0" height="12" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn new file mode 100644 index 0000000000..3cef94d6ea --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn @@ -0,0 +1,257 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="DoDeleteVFCNetworkServiceInstance" name="DoDeleteVFCNetworkServiceInstance" isExecutable="true"> + <bpmn:startEvent id="deleteNS_StartEvent" name="deleteNS_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="deleteNS_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:scriptTask id="Task_09nzhwk" name="Delete Network Service" scriptFormat="groovy"> + <bpmn:incoming>terminateFinished_SequenceFlow</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1sjop71</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoDeleteVFCNetworkServiceInstance() +dcsi.deleteNetworkService(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_150q0fo</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoDeleteVFCNetworkServiceInstance() +dcsi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="terminate_NSTask" name="terminate Network Service" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_150q0fo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ywe21t</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoDeleteVFCNetworkServiceInstance() +dcsi.terminateNetworkService(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0zfksms" name="Delete NS Success?"> + <bpmn:incoming>SequenceFlow_1sjop71</bpmn:incoming> + <bpmn:outgoing>deleteNSFailed_SequenceFlow</bpmn:outgoing> + <bpmn:outgoing>deleteNSSuccess_SequenceFlow</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="deleteNSFailed_SequenceFlow" name="no" sourceRef="ExclusiveGateway_0zfksms" targetRef="deleteNSFailed_EndEvent"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("operationStatus" ) != "finished")}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_1is7zys" name="terminate NS Success?"> + <bpmn:incoming>SequenceFlow_1ywe21t</bpmn:incoming> + <bpmn:outgoing>terminateFailed_SequenceFlow</bpmn:outgoing> + <bpmn:outgoing>terminateSuccess_SequenceFlow</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1ywe21t" sourceRef="terminate_NSTask" targetRef="ExclusiveGateway_1is7zys" /> + <bpmn:sequenceFlow id="terminateFailed_SequenceFlow" name="no" sourceRef="ExclusiveGateway_1is7zys" targetRef="EndEvent_1gkvvpn"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" ) == null || execution.getVariable("jobId" ) == "" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="terminateSuccess_SequenceFlow" name="yes" sourceRef="ExclusiveGateway_1is7zys" targetRef="queryJob_Task"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" ) != null && execution.getVariable("jobId" ) != "" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_15492gl" name="terminate Finished?"> + <bpmn:incoming>SequenceFlow_0xqo13p</bpmn:incoming> + <bpmn:outgoing>terminateFinished_SequenceFlow</bpmn:outgoing> + <bpmn:outgoing>terminateProcessing_SequenceFlow</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="terminateFinished_SequenceFlow" name="yes" sourceRef="ExclusiveGateway_15492gl" targetRef="Task_09nzhwk"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("operationProgress" ) == "100" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="terminateProcessing_SequenceFlow" name="no" sourceRef="ExclusiveGateway_15492gl" targetRef="timeDelay_Task"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("operationProgress" ) != "100" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0cq2q6g" sourceRef="finishNSDelete_Task" targetRef="EndEvent_1x6k78c" /> + <bpmn:endEvent id="deleteNSFailed_EndEvent" name="deleteNSFailed"> + <bpmn:incoming>deleteNSFailed_SequenceFlow</bpmn:incoming> + </bpmn:endEvent> + <bpmn:endEvent id="EndEvent_1gkvvpn"> + <bpmn:incoming>terminateFailed_SequenceFlow</bpmn:incoming> + </bpmn:endEvent> + <bpmn:endEvent id="EndEvent_1x6k78c"> + <bpmn:incoming>SequenceFlow_0cq2q6g</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="queryJob_Task" name="Query NS Progress" scriptFormat="groovy"> + <bpmn:incoming>terminateSuccess_SequenceFlow</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1gsbpxj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xqo13p</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoDeleteVFCNetworkServiceInstance() +dcsi.queryNSProgress(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="finishNSDelete_Task" name="Finish NS Delete"> + <bpmn:incoming>deleteNSSuccess_SequenceFlow</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateVFCNetworkServiceInstance() +dcsi.finishNSDelete(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0xqo13p" sourceRef="queryJob_Task" targetRef="ExclusiveGateway_15492gl" /> + <bpmn:scriptTask id="timeDelay_Task" name="timeDelay" scriptFormat="groovy"> + <bpmn:incoming>terminateProcessing_SequenceFlow</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1gsbpxj</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoDeleteVFCNetworkServiceInstance() +dcsi.timeDelay(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1gsbpxj" sourceRef="timeDelay_Task" targetRef="queryJob_Task" /> + <bpmn:sequenceFlow id="SequenceFlow_150q0fo" sourceRef="PreprocessIncomingRequest_task" targetRef="terminate_NSTask" /> + <bpmn:sequenceFlow id="SequenceFlow_1sjop71" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_0zfksms" /> + <bpmn:sequenceFlow id="deleteNSSuccess_SequenceFlow" name="yes" sourceRef="ExclusiveGateway_0zfksms" targetRef="finishNSDelete_Task"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("operationStatus" ) == "finished")}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteVFCNetworkServiceInstance"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNS_StartEvent"> + <dc:Bounds x="175" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="151" y="147" width="86" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint xsi:type="dc:Point" x="211" y="129" /> + <di:waypoint xsi:type="dc:Point" x="407" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="264" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> + <dc:Bounds x="722" y="555" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="407" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="terminate_NSTask"> + <dc:Bounds x="694" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0zfksms_di" bpmnElement="ExclusiveGateway_0zfksms" isMarkerVisible="true"> + <dc:Bounds x="517" y="570" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="519" y="624" width="52" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0df541u_di" bpmnElement="deleteNSFailed_SequenceFlow"> + <di:waypoint xsi:type="dc:Point" x="542" y="570" /> + <di:waypoint xsi:type="dc:Point" x="542" y="446" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="551" y="474.11353711790395" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1is7zys_di" bpmnElement="ExclusiveGateway_1is7zys" isMarkerVisible="true"> + <dc:Bounds x="1034" y="105" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1032" y="159" width="65" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ywe21t_di" bpmnElement="SequenceFlow_1ywe21t"> + <di:waypoint xsi:type="dc:Point" x="794" y="128" /> + <di:waypoint xsi:type="dc:Point" x="1034" y="130" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="869" y="108" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0j7xo94_di" bpmnElement="terminateFailed_SequenceFlow"> + <di:waypoint xsi:type="dc:Point" x="1059" y="105" /> + <di:waypoint xsi:type="dc:Point" x="1059" y="33" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1068" y="63" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ui2n9l_di" bpmnElement="terminateSuccess_SequenceFlow"> + <di:waypoint xsi:type="dc:Point" x="1059" y="155" /> + <di:waypoint xsi:type="dc:Point" x="1059" y="271" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1066" y="207" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_15492gl_di" bpmnElement="ExclusiveGateway_15492gl" isMarkerVisible="true"> + <dc:Bounds x="1034" y="570" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1040" y="624" width="47" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0hftgi6_di" bpmnElement="terminateFinished_SequenceFlow"> + <di:waypoint xsi:type="dc:Point" x="1034" y="595" /> + <di:waypoint xsi:type="dc:Point" x="822" y="595" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="891" y="574" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0omec46_di" bpmnElement="terminateProcessing_SequenceFlow"> + <di:waypoint xsi:type="dc:Point" x="1084" y="595" /> + <di:waypoint xsi:type="dc:Point" x="1212" y="595" /> + <di:waypoint xsi:type="dc:Point" x="1212" y="486" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1131" y="607" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0cq2q6g_di" bpmnElement="SequenceFlow_0cq2q6g"> + <di:waypoint xsi:type="dc:Point" x="321" y="595" /> + <di:waypoint xsi:type="dc:Point" x="256" y="595" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="243.5" y="574" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1ido9wi_di" bpmnElement="deleteNSFailed_EndEvent"> + <dc:Bounds x="524" y="410" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="460" y="450" width="75" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0xgvlmx_di" bpmnElement="EndEvent_1gkvvpn"> + <dc:Bounds x="1041" y="-3" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1014" y="37" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="220" y="577" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="148" y="617" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0sxy5we_di" bpmnElement="queryJob_Task"> + <dc:Bounds x="1009" y="271" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSDelete_Task"> + <dc:Bounds x="321" y="555" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0xqo13p_di" bpmnElement="SequenceFlow_0xqo13p"> + <di:waypoint xsi:type="dc:Point" x="1059" y="351" /> + <di:waypoint xsi:type="dc:Point" x="1059" y="570" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1074" y="454.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0rb5agx_di" bpmnElement="timeDelay_Task"> + <dc:Bounds x="1162" y="406" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1gsbpxj_di" bpmnElement="SequenceFlow_1gsbpxj"> + <di:waypoint xsi:type="dc:Point" x="1212" y="406" /> + <di:waypoint xsi:type="dc:Point" x="1212" y="311" /> + <di:waypoint xsi:type="dc:Point" x="1109" y="311" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1227" y="352.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_150q0fo_di" bpmnElement="SequenceFlow_150q0fo"> + <di:waypoint xsi:type="dc:Point" x="507" y="129" /> + <di:waypoint xsi:type="dc:Point" x="694" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="600.5" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1sjop71_di" bpmnElement="SequenceFlow_1sjop71"> + <di:waypoint xsi:type="dc:Point" x="722" y="595" /> + <di:waypoint xsi:type="dc:Point" x="567" y="595" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="644.5" y="574" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18n2g9j_di" bpmnElement="deleteNSSuccess_SequenceFlow"> + <di:waypoint xsi:type="dc:Point" x="517" y="595" /> + <di:waypoint xsi:type="dc:Point" x="421" y="595" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="460" y="574" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java index 26fdba47c4..fb507a69cf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java @@ -40,6 +40,8 @@ import javax.ws.rs.core.UriInfo; import org.apache.http.HttpStatus; import org.codehaus.jackson.map.ObjectMapper; import org.openecomp.mso.apihandler.common.ErrorNumbers; +import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2ERequest; +import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationListResponse; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences; @@ -57,18 +59,18 @@ import org.openecomp.mso.requestsdb.RequestsDatabase; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; -@Path("/orchestrationRequests") -@Api(value="/orchestrationRequests",description="API Requests for Orchestration requests") +@Path("/") +@Api(value = "/", description = "API Requests for Orchestration requests") public class OrchestrationRequests { - public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; + public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); + private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + + private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); - private RequestsDatabase requestsDB = RequestsDatabase.getInstance(); - /** * */ @@ -77,66 +79,122 @@ public class OrchestrationRequests { } @GET - @Path("/{version:[vV][2-5]}/{requestId}") - @ApiOperation(value="Find Orchestrated Requests for a given requestId",response=Response.class) + @Path("orchestrationRequests/{version:[vV][2-5]}/{requestId}") + @ApiOperation(value = "Find Orchestrated Requests for a given requestId", response = Response.class) @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@PathParam("requestId") String requestId, @PathParam("version") String version) { + public Response getOrchestrationRequest(@PathParam("requestId") String requestId, + @PathParam("version") String version) { GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse(); - MsoRequest msoRequest = new MsoRequest (requestId); + MsoRequest msoRequest = new MsoRequest(requestId); - long startTime = System.currentTimeMillis (); + long startTime = System.currentTimeMillis(); InfraActiveRequests requestDB = null; - try { - requestDB = requestsDB.getRequestFromInfraActive(requestId); - - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - e.getMessage (), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - - } - - if(requestDB == null) { - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - - } - - Request request = mapInfraActiveRequestToRequest(requestDB); - - orchestrationResponse.setRequest(request); - - return Response.status(200).entity(orchestrationResponse).build(); + try { + requestDB = requestsDB.getRequestFromInfraActive(requestId); + + } catch (Exception e) { + msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.AvailabilityError, + "Exception while communciate with Request DB - Infra Request Lookup", e); + msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null); + alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, + Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, + "Exception while communciate with Request DB"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); + return response; + + } + + if (requestDB == null) { + Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT, + MsoException.ServiceException, "Orchestration RequestId " + requestId + " is not found in DB", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.BusinessProcesssError, + "Null response from RequestDB when searching by RequestId"); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, + "Null response from RequestDB when searching by RequestId"); + msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity()); + return resp; + + } + + Request request = mapInfraActiveRequestToRequest(requestDB); + + orchestrationResponse.setRequest(request); + + return Response.status(200).entity(orchestrationResponse).build(); + } + + @GET + @Path("e2eServiceInstances/{version:[vV][3-5]}/{serviceId}/operations/{operationId}") + @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId", response = Response.class) + @Produces(MediaType.APPLICATION_JSON) + public Response getE2EServiceInstances(@PathParam("serviceId") String serviceId, + @PathParam("version") String version, @PathParam("operationId") String operationId) { + + GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse(); + + MsoRequest msoRequest = new MsoRequest(serviceId); + + long startTime = System.currentTimeMillis(); + + InfraActiveRequests requestDB = null; + + try { + requestDB = requestsDB.getRequestFromInfraActive(serviceId); + + } catch (Exception e) { + msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.AvailabilityError, + "Exception while communciate with Request DB - Infra Request Lookup", e); + msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null); + alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, + Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, + "Exception while communciate with Request DB"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); + return response; + + } + + if (requestDB == null) { + Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT, + MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.BusinessProcesssError, + "Null response from RequestDB when searching by serviceId"); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, + "Null response from RequestDB when searching by serviceId"); + msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity()); + return resp; + + } + + E2ERequest e2erequest = mapInfraActiveRequestToE2ERequest(requestDB); + + e2eServiceResponse.setE2eRequest(e2erequest); + + return Response.status(200).entity(e2eServiceResponse).build(); } @GET - @Path("/{version:[vV][2-5]}") - @ApiOperation(value="Find Orchestrated Requests for a URI Information",response=Response.class) + @Path("orchestrationRequests/{version:[vV][2-5]}") + @ApiOperation(value = "Find Orchestrated Requests for a URI Information", response = Response.class) @Produces(MediaType.APPLICATION_JSON) public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version) { - long startTime = System.currentTimeMillis (); + long startTime = System.currentTimeMillis(); MsoRequest msoRequest = new MsoRequest(); @@ -146,8 +204,7 @@ public class OrchestrationRequests { GetOrchestrationListResponse orchestrationList = null; - - try{ + try { Map<String, List<String>> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams); @@ -157,7 +214,7 @@ public class OrchestrationRequests { List<RequestList> requestLists = new ArrayList<RequestList>(); - for(InfraActiveRequests infraActive : activeRequests){ + for (InfraActiveRequests infraActive : activeRequests) { Request request = mapInfraActiveRequestToRequest(infraActive); RequestList requestList = new RequestList(); @@ -169,209 +226,241 @@ public class OrchestrationRequests { orchestrationList.setRequestList(requestLists); - }catch(Exception e){ - msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - "Get Orchestration Request with Filters Failed. " + e.getMessage(), - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get Orchestration Request with Filters Failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; + } catch (Exception e) { + msoLogger.debug("Get Orchestration Request with Filters Failed : ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, + MsoException.ServiceException, "Get Orchestration Request with Filters Failed. " + e.getMessage(), + ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, + "Get Orchestration Request with Filters Failed"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); + return response; } - - return Response.status(200).entity(orchestrationList).build(); + return Response.status(200).entity(orchestrationList).build(); } - @POST @Path("/{version: [vV][3-5]}/{requestId}/unlock") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value="Unlock Orchestrated Requests for a given requestId",response=Response.class) - public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) { + @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class) + public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, + @PathParam("version") String version) { - MsoRequest msoRequest = new MsoRequest (requestId); + MsoRequest msoRequest = new MsoRequest(requestId); - long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); + long startTime = System.currentTimeMillis(); + msoLogger.debug("requestId is: " + requestId); InfraActiveRequests requestDB = null; Request request = null; - msoLogger.debug ("requestId is: " + requestId); + msoLogger.debug("requestId is: " + requestId); ServiceInstancesRequest sir = null; - try{ + try { ObjectMapper mapper = new ObjectMapper(); sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - } catch(Exception e){ - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), + } catch (Exception e) { + msoLogger.debug("Mapping of request to JSON object failed : ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, + MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Mapping of request to JSON object failed"); + if (msoRequest.getRequestId() != null) { + msoLogger.debug("Mapping of request to JSON object failed"); } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.SchemaError, requestJSON, e); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, + "Mapping of request to JSON object failed"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); return response; } - - try{ + try { msoRequest.parseOrchestration(sir); } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), + msoLogger.debug("Validation failed: ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, + MsoException.ServiceException, "Error parsing request. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); + if (msoRequest.getRequestId() != null) { + msoLogger.debug("Logging failed message to the database"); } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.SchemaError, requestJSON, e); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, + "Validation of the input request failed"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); return response; } try { requestDB = requestsDB.getRequestFromInfraActive(requestId); - if(requestDB == null) { - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + if (requestDB == null) { + Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, "Orchestration RequestId " + requestId + " is not found in DB", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.BusinessProcesssError, + "Null response from RequestDB when searching by RequestId"); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, + "Null response from RequestDB when searching by RequestId"); + msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity()); return resp; - }else{ + } else { request = mapInfraActiveRequestToRequest(requestDB); RequestStatus reqStatus = request.getRequestStatus(); Status status = Status.valueOf(reqStatus.getRequestState()); - if(status == Status.IN_PROGRESS || status == Status.PENDING){ - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED); - reqStatus.setRequestState(Status.UNLOCKED.toString ()); - requestsDB.updateInfraStatus (requestId, - Status.UNLOCKED.toString (), + if (status == Status.IN_PROGRESS || status == Status.PENDING) { + msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED); + reqStatus.setRequestState(Status.UNLOCKED.toString()); + requestsDB.updateInfraStatus(requestId, Status.UNLOCKED.toString(), Constants.MODIFIED_BY_APIHANDLER); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "RequestId " + requestId + " has been unlocked"); - - }else{ - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_REQUEST, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "RequestId " + requestId + " has been unlocked"); + + } else { + Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, + MsoException.ServiceException, "Orchestration RequestId " + requestId + " has a status of " + + status + " and can not be unlocked", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); + msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + + status + " and can not be unlocked"); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, + "Orchestration RequestId " + requestId + " has a status of " + status + + " and can not be unlocked"); + msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity()); return resp; } } } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - e.getMessage (), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", + MsoLogger.ErrorCode.AvailabilityError, + "Exception while communciate with Request DB - Infra Request Lookup", e); + msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null); + alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL, + Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); + msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, + "Exception while communciate with Request DB"); + msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity()); return response; } - return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build (); + return Response.status(HttpStatus.SC_NO_CONTENT).entity("").build(); } - private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) { - - - Request request = new Request(); - - ObjectMapper mapper = new ObjectMapper(); - // mapper.configure(Feature.WRAP_ROOT_VALUE, true); - - request.setRequestId(requestDB.getRequestId()); - request.setRequestScope(requestDB.getRequestScope()); - request.setRequestType(requestDB.getRequestAction()); - - InstanceReferences ir = new InstanceReferences(); - if(requestDB.getNetworkId() != null) - ir.setNetworkInstanceId(requestDB.getNetworkId()); - if(requestDB.getNetworkName() != null) - ir.setNetworkInstanceName(requestDB.getNetworkName()); - if(requestDB.getServiceInstanceId() != null) - ir.setServiceInstanceId(requestDB.getServiceInstanceId()); - if(requestDB.getServiceInstanceName() != null) - ir.setServiceInstanceName(requestDB.getServiceInstanceName()); - if(requestDB.getVfModuleId() != null) - ir.setVfModuleInstanceId(requestDB.getVfModuleId()); - if(requestDB.getVfModuleName() != null) - ir.setVfModuleInstanceName(requestDB.getVfModuleName()); - if(requestDB.getVnfId() != null) - ir.setVnfInstanceId(requestDB.getVnfId()); - if(requestDB.getVnfName() != null) - ir.setVnfInstanceName(requestDB.getVnfName()); - if(requestDB.getVolumeGroupId() != null) - ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId()); - if(requestDB.getVolumeGroupName() != null) - ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName()); - if(requestDB.getRequestorId() != null) + private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) { + + Request request = new Request(); + + ObjectMapper mapper = new ObjectMapper(); + // mapper.configure(Feature.WRAP_ROOT_VALUE, true); + + request.setRequestId(requestDB.getRequestId()); + request.setRequestScope(requestDB.getRequestScope()); + request.setRequestType(requestDB.getRequestAction()); + + InstanceReferences ir = new InstanceReferences(); + if (requestDB.getNetworkId() != null) + ir.setNetworkInstanceId(requestDB.getNetworkId()); + if (requestDB.getNetworkName() != null) + ir.setNetworkInstanceName(requestDB.getNetworkName()); + if (requestDB.getServiceInstanceId() != null) + ir.setServiceInstanceId(requestDB.getServiceInstanceId()); + if (requestDB.getServiceInstanceName() != null) + ir.setServiceInstanceName(requestDB.getServiceInstanceName()); + if (requestDB.getVfModuleId() != null) + ir.setVfModuleInstanceId(requestDB.getVfModuleId()); + if (requestDB.getVfModuleName() != null) + ir.setVfModuleInstanceName(requestDB.getVfModuleName()); + if (requestDB.getVnfId() != null) + ir.setVnfInstanceId(requestDB.getVnfId()); + if (requestDB.getVnfName() != null) + ir.setVnfInstanceName(requestDB.getVnfName()); + if (requestDB.getVolumeGroupId() != null) + ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId()); + if (requestDB.getVolumeGroupName() != null) + ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName()); + if (requestDB.getRequestorId() != null) ir.setRequestorId(requestDB.getRequestorId()); - request.setInstanceReferences(ir); - String requestBody = requestDB.getRequestBody(); + String requestBody = requestDB.getRequestBody(); - RequestDetails requestDetails = null; + RequestDetails requestDetails = null; - try{ - requestDetails = mapper.readValue(requestBody, RequestDetails.class); + try { + requestDetails = mapper.readValue(requestBody, RequestDetails.class); - }catch(Exception e){ - msoLogger.debug("Exception caught mapping requestBody to RequestDetails",e); - } + } catch (Exception e) { + msoLogger.debug("Exception caught mapping requestBody to RequestDetails", e); + } - request.setRequestDetails(requestDetails); - String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT"; - request.setStartTime(startTimeStamp); + request.setRequestDetails(requestDetails); + String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + + " GMT"; + request.setStartTime(startTimeStamp); - RequestStatus status = new RequestStatus(); - if(requestDB.getStatusMessage() != null){ - status.setStatusMessage(requestDB.getStatusMessage()); - } + RequestStatus status = new RequestStatus(); + if (requestDB.getStatusMessage() != null) { + status.setStatusMessage(requestDB.getStatusMessage()); + } - if(requestDB.getEndTime() != null){ - String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT"; - status.setFinishTime(endTimeStamp); - } + if (requestDB.getEndTime() != null) { + String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + + " GMT"; + status.setFinishTime(endTimeStamp); + } + if (requestDB.getRequestStatus() != null) { + status.setRequestState(requestDB.getRequestStatus()); + } - if(requestDB.getRequestStatus() != null){ - status.setRequestState(requestDB.getRequestStatus()); - } + if (requestDB.getProgress() != null) { + status.setPercentProgress(requestDB.getProgress().intValue()); + } - if(requestDB.getProgress() != null){ - status.setPercentProgress(requestDB.getProgress().intValue()); - } + request.setRequestStatus(status); - request.setRequestStatus(status); + return request; + } - return request; - } - } + private E2ERequest mapInfraActiveRequestToE2ERequest(InfraActiveRequests requestDB) { + + E2ERequest e2erequest = new E2ERequest(); + + e2erequest.setOperationId(requestDB.getRequestId()); + // e2erequest.setRequestScope(requestDB.getRequestScope()); + e2erequest.setOperation(requestDB.getRequestAction()); + e2erequest.setResult(requestDB.getRequestStatus()); + e2erequest.setReason(requestDB.getStatusMessage()); + e2erequest.setUserId(requestDB.getRequestorId()); + e2erequest.setOperationContent(requestDB.getStatusMessage()); + e2erequest.setProgress(requestDB.getProgress()); + + String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + + " GMT"; + e2erequest.setOperateAt(startTimeStamp); + + if (requestDB.getEndTime() != null) { + String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + + " GMT"; + e2erequest.setFinishedAt(endTimeStamp); + } + + return e2erequest; + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java new file mode 100644 index 0000000000..e7ff2f611d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequest.java @@ -0,0 +1,113 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.sql.Timestamp;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
+public class E2ERequest {
+
+ protected String operationId;
+ protected String operation;
+ protected String result;
+ protected String reason;
+ protected String userId;
+ protected String operationContent;
+ protected long progress;
+ protected String operateAt;
+ protected String finishedAt;
+
+ public String getOperationId() {
+ return operationId;
+ }
+
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getOperationContent() {
+ return operationContent;
+ }
+
+ public void setOperationContent(String operationContent) {
+ this.operationContent = operationContent;
+ }
+
+ public long getProgress() {
+ return progress;
+ }
+
+ public void setProgress(long progress) {
+ this.progress = progress;
+ }
+
+ public String getOperateAt() {
+ return operateAt;
+ }
+
+ public void setOperateAt(String operateAt) {
+ this.operateAt = operateAt;
+ }
+
+ public String getFinishedAt() {
+ return finishedAt;
+ }
+
+ public void setFinishedAt(String finishedAt) {
+ this.finishedAt = finishedAt;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java new file mode 100644 index 0000000000..8145afca6d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java @@ -0,0 +1,39 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
+public class GetE2EServiceInstanceResponse {
+
+ protected E2ERequest e2eRequest;
+
+ public E2ERequest getE2eRequest() {
+ return e2eRequest;
+ }
+
+ public void setE2eRequest(E2ERequest e2eRequest) {
+ this.e2eRequest = e2eRequest;
+ }
+
+}
|