summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java11
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java16
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy5
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java218
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java45
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java45
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java45
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java61
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java6
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java6
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java8
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java45
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java596
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/GetE2EServiceInstanceResponse.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java894
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java64
37 files changed, 1350 insertions, 849 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
index 950dc7b83b..eb18e10bc3 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
@@ -22,9 +22,16 @@ package org.openecomp.mso.client.sdno;
import java.io.IOException;
-@FunctionalInterface
public interface SDNOValidator {
- void healthDiagnostic(String vnfName, String uuid) throws IOException, Exception;
+ /**
+ * Issues a health diagnostic request for a given vnf to SDN-O
+ *
+ * @param vnfName
+ * @param uuid
+ * @throws IOException
+ * @throws Exception
+ */
+ public void healthDiagnostic(String vnfName, String uuid) throws IOException, Exception;
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java
index 6f65371ef2..7f922ce30e 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java
@@ -162,26 +162,24 @@ public class JsonUtilsTest {
try {
fis = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
-// jsonReq = br.readLine();
CharBuffer cbuf = CharBuffer.allocate((int)file.length()+1);
br.read(cbuf);
cbuf.flip();
jsonReq = cbuf.toString();
if (jsonReq != null) {
- System.out.println("initialize(): json request: " + jsonReq);
+ System.out.println("initialize(): json request: " + jsonReq);
} else {
System.out.println("initialize(): failed to read json request from src/test/resources/request.json");
}
fis.close();
fis = new FileInputStream(file2);
br = new BufferedReader(new InputStreamReader(fis));
-// jsonReqArray = br.readLine();
cbuf = CharBuffer.allocate((int)file.length()+1);
br.read(cbuf);
cbuf.flip();
jsonReqArray = cbuf.toString();
if (jsonReq != null) {
- System.out.println("initialize(): json request w/ array: " + jsonReqArray);
+ System.out.println("initialize(): json request w/ array: " + jsonReqArray);
} else {
System.out.println("initialize(): failed to read json request from src/test/resources/request2.json");
}
@@ -220,14 +218,11 @@ public class JsonUtilsTest {
// strip all the non-data whitespace
xmlOut = xmlOut.replaceAll(">\\s*<", "><");
-// System.out.println("testConversion(): xml in: " + xmlIn);
-// System.out.println("testConversion(): xml out: " + xmlOut);
Diff diffXml;
try {
diffXml = new Diff(xmlIn, xmlOut);
Assert.assertTrue(diffXml.similar());
-// Assert.assertTrue(diffXml.identical());
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
@@ -259,7 +254,6 @@ public class JsonUtilsTest {
Assert.assertEquals(value, null);
// retrieving a parameter/array value (originally a XML attribute)
value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name");
-// Assert.assertEquals(value, "[{\"content\":\"network1111\",\"name\":\"network\"},{\"content\":\"server1111\",\"name\":\"server\"}]");
Assert.assertEquals(value, "network");
value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content");
Assert.assertEquals(value, "network1111");
@@ -288,7 +282,6 @@ public class JsonUtilsTest {
System.out.println("testUpdate(): xml request to json: " + json);
// the add should be successful
String jsonUpd = JsonUtils.addJsonValue(json, "vnf-request.request-info.comment", "Some comment");
-// System.out.println("testUpdate(): post add json request: " + jsonUpd);
String value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.request-info.comment");
Assert.assertEquals(value, "Some comment");
// the add should be ignored as the field already exists
@@ -297,12 +290,10 @@ public class JsonUtilsTest {
Assert.assertEquals(value, "STMTN5MMSC21");
// the update should be successful
jsonUpd = JsonUtils.updJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name", "STMTN5MMSC22");
-// System.out.println("testUpdate(): post update json request: " + jsonUpd);
value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name");
Assert.assertEquals(value, "STMTN5MMSC22");
// the delete should be successful
jsonUpd = JsonUtils.delJsonValue(jsonUpd, "vnf-request.request-info.comment");
-// System.out.println("testUpdate(): post delete json request: " + jsonUpd);
value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.request-info.comment");
Assert.assertEquals(value, null);
// the delete should fail as field 'vnf-model' does not exist
@@ -352,14 +343,11 @@ public class JsonUtilsTest {
xmlOut = xmlOut.replaceAll(">\\s*<", "><");
System.out.println("testConversionArray(): XML after removing whitespace:" + xmlOut);
String xmlTest = xmlArrayReq.replaceAll(">\\s*<", "><");
-// System.out.println("testConversion(): xml test: " + xmlTest);
-// System.out.println("testConversion(): xml out: " + xmlOut);
Diff diffXml;
try {
diffXml = new Diff(xmlTest, xmlOut);
Assert.assertTrue(diffXml.similar());
-// Assert.assertTrue(diffXml.identical());
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
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 4d661c489a..11e31ef765 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
@@ -127,6 +127,8 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String uuiRequest = execution.getVariable("uuiRequest")
String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")
String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")
+ String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
+ execution.setVariable("serviceModelName", serviceModelName)
//aai serviceType and Role can be setted as fixed value now.
String aaiServiceType = "voLTE type"
String aaiServiceRole = "voLTE role"
@@ -416,8 +418,10 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
if(StringUtils.containsIgnoreCase(resourceName, resourceType)){
String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
+ String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")
String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")
execution.setVariable("resourceUUID", resourceUUID)
+ execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
execution.setVariable("resourceParameters", resourceParameters)
utils.log("INFO", "Prepare VFC Request resourceType:" + resourceType, isDebugEnabled)
utils.log("INFO", "Prepare VFC Request resourceUUID:" + resourceUUID, isDebugEnabled)
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 827cbf5783..41d7edbebc 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
@@ -234,8 +234,11 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
</relationship-data>
</relationship>"""
String endpoint = execution.getVariable("URN_aai_endpoint")
+ utils.log("INFO","Add Relationship req:\n" + addRelationPayload, isDebugEnabled)
String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship"
- executeAAIPutCall(execution, url, addRelationPayload)
+ APIResponse aaiRsp = executeAAIPutCall(execution, url, addRelationPayload)
+ utils.log("INFO","aai response status code:" + aaiRsp.getStatusCode(), isDebugEnabled)
+ utils.log("INFO","aai response content:" + aaiRsp.getResponseBodyAsString(), isDebugEnabled)
utils.log("INFO"," *****Exit addNSRelationship *****", isDebugEnabled)
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index f6f8fd25dd..6ca93f7238 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -20,6 +20,9 @@
package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -41,11 +44,13 @@ import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.Generic
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.requestsdb.RequestsDatabase;
-import org.openecomp.mso.requestsdb.RequestsDbConstant;
import org.openecomp.mso.requestsdb.ResourceOperationStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
/**
@@ -53,6 +58,8 @@ import java.util.Map;
*/
public abstract class AbstractSdncOperationTask extends BaseTask {
+ private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class);
+
private static final String DEFAULT_MSB_IP = "127.0.0.1";
private static final int DEFAULT_MSB_Port = 80;
private static final String SDCADAPTOR_INPUTS = "resourceParameters";
@@ -72,16 +79,43 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
" <statusDescription>$statusDescription</statusDescription>\n"+
" </ns:updateResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
+ private static final String getBodyTemplate = " <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"http://org.openecomp.mso/requestsdb\"><soapenv:Header/><soapenv:Body>\n" +
+ " <ns:getResourceOperationStatus>\n" +
+ " <operationId>$operationId</operationId>\n" +
+ " <resourceTemplateUUID>$resourceTemplateUUID</resourceTemplateUUID>\n" +
+ " <serviceId>$serviceId</serviceId>\n" +
+ " </ns:getResourceOperationStatus></soapenv:Body></soapenv:Envelope>";
+
private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException {
- CloseableHttpClient httpClient = HttpClients.createDefault();
+ logger.info("AbstractSdncOperationTask.updateResOperStatus begin!");
String url = "http://mso:8080/dbadapters/RequestsDbAdapter";
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
- String postBody = getStringBody(resourceOperationStatus);
+ String postBody = getPostStringBody(resourceOperationStatus);
httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML));
- String result;
+ httpPost(url, httpPost);
+ logger.info("AbstractSdncOperationTask.updateResOperStatus end!");
+ //requestsDB.updateResOperStatus(resourceOperationStatus);
+ }
+
+ protected String getPostbody(Object inputEntity) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ String postBody = null;
+ try {
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ postBody = objectMapper.writeValueAsString(inputEntity);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
+ return postBody;
+ }
+
+ protected String httpPost(String url, HttpPost httpPost) throws RouteException {
+ logger.info("AbstractSdncOperationTask.httpPost begin!");
+ CloseableHttpClient httpClient = HttpClients.createDefault();
+ String result = null;
boolean var15 = false;
String errorMsg;
@@ -90,7 +124,10 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
var15 = true;
CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost);
result = EntityUtils.toString(closeableHttpResponse.getEntity());
+ logger.info("result = {}", result);
+// LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, result.toString(), "SDNC", "");
if(closeableHttpResponse.getStatusLine().getStatusCode() != 200) {
+ logger.info("exception: fail for status code = {}", closeableHttpResponse.getStatusLine().getStatusCode());
throw new RouteException(result, "SERVICE_GET_ERR");
}
@@ -99,6 +136,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
break label91;
} catch (IOException var19) {
errorMsg = url + ":httpPostWithJSON connect faild";
+ logger.info("exception: POST_CONNECT_FAILD : {}", errorMsg);
throwsRouteException(errorMsg, var19, "POST_CONNECT_FAILD");
var15 = false;
} finally {
@@ -107,6 +145,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
httpClient.close();
} catch (IOException var16) {
String errorMsg1 = url + ":close httpClient faild";
+ logger.info("exception: CLOSE_CONNECT_FAILD : {}", errorMsg1);
throwsRouteException(errorMsg1, var16, "CLOSE_CONNECT_FAILD");
}
@@ -117,6 +156,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
httpClient.close();
} catch (IOException var17) {
errorMsg = url + ":close httpClient faild";
+ logger.info("exception: CLOSE_CONNECT_FAILD : {}", errorMsg);
throwsRouteException(errorMsg, var17, "CLOSE_CONNECT_FAILD");
}
}
@@ -125,47 +165,78 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
httpClient.close();
} catch (IOException var18) {
errorMsg = url + ":close httpClient faild";
+ logger.info("exception: CLOSE_CONNECT_FAILD : {}", errorMsg);
throwsRouteException(errorMsg, var18, "CLOSE_CONNECT_FAILD");
}
-
- //requestsDB.updateResOperStatus(resourceOperationStatus);
+ logger.info("AbstractSdncOperationTask.httpPost end!");
+ return result;
}
private static void throwsRouteException(String errorMsg, Exception e, String errorCode) throws RouteException {
String msg = errorMsg + ".errorMsg:" + e.getMessage();
+ logger.info("exception: {}", msg);
throw new RouteException(errorMsg, errorCode);
}
- private String getStringBody(ResourceOperationStatus resourceOperationStatus) {
+ private String getPostStringBody(ResourceOperationStatus resourceOperationStatus) {
+ logger.info("AbstractSdncOperationTask.getPostStringBody begin!");
String postBody = new String(postBodyTemplate);
- postBody.replace("$errorCode", resourceOperationStatus.getErrorCode());
- postBody.replace("$jobId", resourceOperationStatus.getJobId());
- postBody.replace("$operType", resourceOperationStatus.getOperType());
- postBody.replace("$operationId", resourceOperationStatus.getOperationId());
- postBody.replace("$progress", resourceOperationStatus.getProgress());
- postBody.replace("$resourceTemplateUUID", resourceOperationStatus.getResourceTemplateUUID());
- postBody.replace("$serviceId", resourceOperationStatus.getServiceId());
- postBody.replace("$status", resourceOperationStatus.getStatus());
- postBody.replace("$statusDescription", resourceOperationStatus.getStatusDescription());
+ postBody = postBody.replace("$errorCode", resourceOperationStatus.getErrorCode());
+ postBody = postBody.replace("$jobId", resourceOperationStatus.getJobId());
+ postBody = postBody.replace("$operType", resourceOperationStatus.getOperType());
+ postBody = postBody.replace("$operationId", resourceOperationStatus.getOperationId());
+ postBody = postBody.replace("$progress", resourceOperationStatus.getProgress());
+ postBody = postBody.replace("$resourceTemplateUUID", resourceOperationStatus.getResourceTemplateUUID());
+ postBody = postBody.replace("$serviceId", resourceOperationStatus.getServiceId());
+ postBody = postBody.replace("$status", resourceOperationStatus.getStatus());
+ postBody = postBody.replace("$statusDescription", resourceOperationStatus.getStatusDescription());
+ logger.info("AbstractSdncOperationTask.getPostStringBody end!");
return postBody;
}
+ private String getGetStringBody(String serviceId, String operationId, String resourceTemplateUUID) {
+ logger.info("AbstractSdncOperationTask.getGetStringBody begin!");
+ String getBody = new String(getBodyTemplate);
+ getBody = getBody.replace("$operationId", operationId);
+ getBody = getBody.replace("$resourceTemplateUUID", resourceTemplateUUID);
+ getBody = getBody.replace("$serviceId", serviceId);
+ logger.info("AbstractSdncOperationTask.getGetStringBody end!");
+ return getBody;
+ }
+
private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException {
- CloseableHttpClient httpClient = HttpClients.createDefault();
+ logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!");
String url = "http://mso:8080/dbadapters/RequestsDbAdapter";
- HttpGet httpGet = new HttpGet(url);
- httpGet.setHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk");
- httpGet.setHeader("Content-type", "application/soap+xml");
+ HttpPost httpPost = new HttpPost(url);
+ httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk");
+ httpPost.addHeader("Content-type", "application/soap+xml");
+ String getBody = getGetStringBody(serviceId, operationId, resourceTemplateUUID);
+ httpPost.setEntity(new StringEntity(getBody, ContentType.APPLICATION_XML));
+ String result = httpPost(url, httpPost);
+ ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result);
+ logger.info("AbstractSdncOperationTask.getResourceOperationStatus end!");
+ return resourceOperationStatus;
+
+ //return requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
+ }
+
+ private String httpGet(String url, HttpGet httpGet) throws RouteException {
+ logger.info("AbstractSdncOperationTask.httpGet begin!");
boolean var16 = false;
- String result="";
+ CloseableHttpClient httpClient = HttpClients.createDefault();
+ String result = "";
String errorMsg;
- label109: {
- label110: {
+ label109:
+ {
+ label110:
+ {
try {
var16 = true;
CloseableHttpResponse e = httpClient.execute(httpGet);
result = EntityUtils.toString(e.getEntity());
- if(e.getStatusLine().getStatusCode() != 200) {
+ logger.info("result = {}", result);
+ if (e.getStatusLine().getStatusCode() != 200) {
+ logger.info("exception: fail for status code = {}", e.getStatusLine().getStatusCode());
throw new RouteException(result, "SERVICE_GET_ERR");
}
@@ -174,19 +245,22 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
break label110;
} catch (ClientProtocolException var21) {
errorMsg = url + ":httpGetWithJSON connect faild";
+ logger.info("exception: GET_CONNECT_FAILD {}", errorMsg);
throwsRouteException(errorMsg, var21, "GET_CONNECT_FAILD");
var16 = false;
} catch (IOException var22) {
errorMsg = url + ":httpGetWithJSON connect faild";
+ logger.info("exception: GET_CONNECT_FAILD {}", errorMsg);
throwsRouteException(errorMsg, var22, "GET_CONNECT_FAILD");
var16 = false;
break label109;
} finally {
- if(var16) {
+ if (var16) {
try {
httpClient.close();
} catch (IOException var17) {
String errorMsg1 = url + ":close httpClient faild";
+ logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg1);
throwsRouteException(errorMsg1, var17, "CLOSE_CONNECT_FAILD");
}
@@ -197,6 +271,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
httpClient.close();
} catch (IOException var19) {
errorMsg = url + ":close httpClient faild";
+ logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg);
throwsRouteException(errorMsg, var19, "CLOSE_CONNECT_FAILD");
}
@@ -206,6 +281,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
httpClient.close();
} catch (IOException var20) {
errorMsg = url + ":close httpClient faild";
+ logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg);
throwsRouteException(errorMsg, var20, "CLOSE_CONNECT_FAILD");
}
@@ -215,17 +291,15 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
httpClient.close();
} catch (IOException var18) {
errorMsg = url + ":close httpClient faild";
+ logger.info("exception: CLOSE_CONNECT_FAILD {}", errorMsg);
throwsRouteException(errorMsg, var18, "CLOSE_CONNECT_FAILD");
}
-
- ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result);
-
- return resourceOperationStatus;
-
- //return requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
+ logger.info("AbstractSdncOperationTask.httpGet end!");
+ return result;
}
private ResourceOperationStatus getResourceOperationStatusFromXmlString(String result) {
+ logger.info("AbstractSdncOperationTask.getResourceOperationStatusFromXmlString begin!");
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();
resourceOperationStatus.setErrorCode(getValueByName("errorCode", result));
resourceOperationStatus.setJobId(getValueByName("jobId", result));
@@ -236,19 +310,24 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
resourceOperationStatus.setServiceId(getValueByName("serviceId", result));
resourceOperationStatus.setStatus(getValueByName("status", result));
resourceOperationStatus.setStatusDescription(getValueByName("statusDescription", result));
+ logger.info("AbstractSdncOperationTask.getResourceOperationStatusFromXmlString end!");
return resourceOperationStatus;
}
private String getValueByName(String Name, String xml) {
- String start = "<" + Name + ">";
- String end = "</" + Name + ">";
- return xml.substring(xml.indexOf(start), xml.indexOf(end)).replace(start, "");
+ if (!StringUtils.isBlank(xml) && xml.contains(Name)) {
+ String start = "<" + Name + ">";
+ String end = "</" + Name + ">";
+ return xml.substring(xml.indexOf(start), xml.indexOf(end)).replace(start, "");
+ }
+ return "";
}
- private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+ protected static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
@Override
public void execute(DelegateExecution execution) {
+ logger.info("AbstractSdncOperationTask.execute begin!");
GenericResourceApi genericResourceApiClient = getGenericResourceApiClient(execution);
// updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "10", "execute begin!");
Map<String, String> inputs = getInputs(execution);
@@ -258,17 +337,29 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
execution.setVariable("SDNCA_SuccessIndicator", true);
// updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!");
} catch (Exception e) {
+ logger.info("exception: AbstractSdncOperationTask.fail!");
+ logger.error("exception: AbstractSdncOperationTask.fail!:", e);
e.printStackTrace();
execution.setVariable("SDNCA_SuccessIndicator", false);
}
+ logger.info("AbstractSdncOperationTask.execute end!");
}
protected Map<String, String> getInputs(DelegateExecution execution) {
+ logger.info("AbstractSdncOperationTask.getInputs begin!");
Map<String, String> inputs = new HashMap<>();
String json = (String) execution.getVariable(SDCADAPTOR_INPUTS);
JSONObject jsonObject = new JSONObject(json);
JSONObject paras = jsonObject.getJSONObject("additionalParamForNs");
- paras.keySet().stream().forEach(key -> inputs.put(key, paras.getString((String) key)));
+ Iterator<String> iterator = paras.keys();
+ while (iterator.hasNext()) {
+ String key = iterator.next();
+ inputs.put(key, paras.getString(key));
+ }
+/* if (paras.keys().hasNext()) {
+ paras.keySet().stream().forEach(key -> inputs.put(key, paras.getString((String) key)));
+ }*/
+ logger.info("AbstractSdncOperationTask.getInputs end!");
return inputs;
}
@@ -281,6 +372,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
String errorCode,
String progress,
String statusDescription) {
+ logger.info("AbstractSdncOperationTask.updateProgress begin!");
String serviceId = (String) execution.getVariable("serviceId");
String operationId = (String) execution.getVariable("operationId");
String resourceTemplateUUID = (String) execution.getVariable("resourceUUID");
@@ -299,17 +391,61 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
resourceOperationStatus.setStatusDescription(statusDescription);
}
updateResOperStatus(resourceOperationStatus);
+ logger.info("AbstractSdncOperationTask.updateProgress end!");
} catch (Exception exception) {
System.out.println(exception);
- logger.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString());
+ logger.info("exception: AbstractSdncOperationTask.updateProgress fail!");
+ logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception);
+ LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString());
+ }
+ }
+
+
+ protected boolean isSend2SdncDirectly() {
+ logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!");
+ Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties");
+ if (properties != null) {
+ String sdncIp = properties.get("sdnc-ip");
+ String sdncPort = properties.get("sdnc-port");
+ if (!StringUtils.isBlank(sdncIp) && isIp(sdncIp) && !StringUtils.isBlank(sdncPort)) {
+ logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true.");
+ return true;
+ }
+ }
+ logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = false.");
+ return false;
+ }
+
+ protected String getSdncIp() {
+ logger.info("AbstractSdncOperationTask.getSdncIp begin.");
+ String sdncIp = null;
+ Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties");
+ if (properties != null) {
+ sdncIp = properties.get("sdnc-ip");
+ }
+ String returnIp = StringUtils.isBlank(sdncIp) || !isIp(sdncIp) ? null : sdncIp;
+ logger.info("AbstractSdncOperationTask.getSdncIp: sdncIp = {}", returnIp);
+ return returnIp;
+ }
+
+ protected String getSdncPort() {
+ logger.info("AbstractSdncOperationTask.getSdncPort begin.");
+ String sdncPort = null;
+ Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties");
+ if (properties != null) {
+ sdncPort = properties.get("sdnc-port");
}
+ String returnPort = StringUtils.isBlank(sdncPort) ? null : sdncPort;
+ logger.info("AbstractSdncOperationTask.getSdncPort: returnPort = {}", sdncPort);
+ return returnPort;
}
private GenericResourceApi getGenericResourceApiClient(DelegateExecution execution) {
+ logger.info("AbstractSdncOperationTask.getGenericResourceApiClient begin!");
// updateProgress(execution, null, null, "20", "getGenericResourceApiClient begin!");
String msbIp = System.getenv().get(ONAP_IP);
int msbPort = DEFAULT_MSB_Port;
- Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+ Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("topology.properties");
if (properties != null) {
if (StringUtils.isBlank(msbIp) || !isIp(msbIp)) {
msbIp = properties.get("msb-ip");
@@ -323,8 +459,10 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
}
msbPort = Integer.valueOf(strMsbPort);
}
+ logger.info("AbstractSdncOperationTask.getGenericResourceApiClient msbIp = " + msbIp + " msbPort = " + msbPort);
MSBServiceClient msbClient = new MSBServiceClient(msbIp, msbPort);
RestServiceCreater restServiceCreater = new RestServiceCreater(msbClient);
+ logger.info("AbstractSdncOperationTask.getGenericResourceApiClient end!");
return restServiceCreater.createService(GenericResourceApi.class);
}
@@ -340,7 +478,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
}
} catch (Exception e) {
System.out.println(e);
- logger.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString());
+ LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString());
}
return defaultValue;
}
@@ -353,7 +491,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
}
} catch (Exception e) {
System.out.println(e);
- logger.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString());
+ LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " getMsbIp catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, e.getClass().toString());
}
return defaultValue;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
index e72bf8aea8..e8bfcf5caa 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java
@@ -20,13 +20,21 @@
package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.msb.sdk.discovery.common.RouteException;
import org.openecomp.mso.bpmn.core.WorkflowException;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi;
+import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity;
+import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.requestsdb.RequestsDbConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Map;
@@ -34,20 +42,48 @@ import java.util.Map;
* Created by 10112215 on 2017/9/20.
*/
public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask {
+ private static final Logger logger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class);
+
+
+ private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation";
+
@Override
public void sendRestrequestAndHandleResponse(DelegateExecution execution,
Map<String, String> inputs,
GenericResourceApi genericResourceApiClient) throws Exception {
+ logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!");
updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!");
NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder();
RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs);
updateProgress(execution, null, null, "50", "RequestBody build finished!");
- RpcNetworkTopologyOperationOutputEntity outputEntity = genericResourceApiClient.postNetworkTopologyOperation(inputEntity).execute().body();
- updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
- saveOutput(execution, outputEntity);
+ RpcNetworkTopologyOperationOutputEntity outputEntity;
+ if (!isSend2SdncDirectly()) {
+ outputEntity = genericResourceApiClient.postNetworkTopologyOperation
+ (HeaderUtil.DefaulAuth, inputEntity).execute().body();
+ updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
+ saveOutput(execution, outputEntity);
+ } else {
+ Send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity);
+ }
+ logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!");
+ }
+
+ private void Send2SdncDirectly(String defaulAuth,
+ RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException {
+ logger.info("SdncNetworkTopologyOperationTask.Send2SdncDirectly begin!");
+ String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL;
+ HttpPost httpPost = new HttpPost(url);
+ httpPost.addHeader("Authorization", defaulAuth);
+ httpPost.addHeader("Content-type", "application/json");
+ String postBody = getPostbody(inputEntity);
+ LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody.toString(), "SDNC", "");
+ httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML));
+ httpPost(url, httpPost);
+ logger.info("SdncNetworkTopologyOperationTask.Send2SdncDirectly end!");
}
private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws Exception {
+ logger.info("SdncNetworkTopologyOperationTask.saveOutput begin!");
String responseCode = output.getOutput().getResponseCode();
if (!"200".equals(responseCode)) {
String processKey = getProcessKey(execution);
@@ -56,10 +92,11 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask
WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("SDNCA_SuccessIndicator", workflowException);
updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage);
+ logger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!");
throw new Exception("");
}
updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!");
-
+ logger.info("SdncNetworkTopologyOperationTask.saveOutput end!");
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
index bea7a129fa..89d0958c75 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
@@ -21,14 +21,20 @@
package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.msb.sdk.discovery.common.RouteException;
import org.openecomp.mso.bpmn.core.WorkflowException;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi;
+import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.ServiceRpcInputEntityBuilder;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationOutputEntity;
-import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceTopologyOperationOutputEntity;
-import org.openecomp.mso.requestsdb.RequestsDbConstant;
+import org.openecomp.mso.logger.MessageEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Map;
@@ -36,20 +42,49 @@ import java.util.Map;
* Created by 10112215 on 2017/9/26.
*/
public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask {
+ private static final Logger logger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class);
+
+
+ private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation";
+
@Override
public void sendRestrequestAndHandleResponse(DelegateExecution execution,
Map<String, String> inputs,
GenericResourceApi genericResourceApiClient) throws Exception {
+ logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!");
// updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!");
ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder();
RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs);
// updateProgress(execution, null, null, "50", "RequestBody build finished!");
- RpcServiceTopologyOperationOutputEntity outputEntity = genericResourceApiClient.postServiceTopologyOperation(inputEntity).execute().body();
+ RpcServiceTopologyOperationOutputEntity outputEntity;
+ if (!isSend2SdncDirectly()) {
+ outputEntity = genericResourceApiClient.postServiceTopologyOperation
+ (HeaderUtil.DefaulAuth, inputEntity).execute().body();
// updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!");
- saveOutput(execution, outputEntity);
+ saveOutput(execution, outputEntity);
+ } else {
+ Send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity);
+ }
+ logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!");
+
+ }
+
+ private void Send2SdncDirectly(String defaulAuth,
+ RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException {
+ logger.info("SdncServiceTopologyOperationTask.Send2SdncDirectly begin!");
+ String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL;
+ HttpPost httpPost = new HttpPost(url);
+ httpPost.addHeader("Authorization", defaulAuth);
+ httpPost.addHeader("Content-type", "application/json");
+ String postBody = getPostbody(inputEntity);
+ LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody.toString(), "SDNC", "");
+ httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML));
+ httpPost(url, httpPost);
+ logger.info("SdncServiceTopologyOperationTask.Send2SdncDirectly end!");
}
private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception {
+ logger.info("SdncServiceTopologyOperationTask.saveOutput begin!");
String responseCode = output.getOutput().getResponseCode();
if (!"200".equals(responseCode)) {
String processKey = getProcessKey(execution);
@@ -58,7 +93,9 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("SDNCA_SuccessIndicator", workflowException);
// updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage);
+ logger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!");
throw new Exception("");
}
+ logger.info("SdncServiceTopologyOperationTask.saveOutput end!");
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
index 8d2cb1ef7f..49d702d1ee 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
@@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import org.onap.msb.sdk.httpclient.RestServiceCreater;
import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi;
+import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity;
@@ -71,7 +72,8 @@ public class SdncUnderlayVpnOperationClient {
updateProgress(null, null, "50", "RequestBody build finished!");
RpcNetworkTopologyOperationOutputEntity networkRpcOutputEntiy = null;
try {
- networkRpcOutputEntiy = genericResourceApiClient.postNetworkTopologyOperation(body).execute().body();
+ networkRpcOutputEntiy = genericResourceApiClient.postNetworkTopologyOperation
+ (HeaderUtil.DefaulAuth ,body).execute().body();
} catch (Exception e) {
logger.debug("Exception: ", e);
updateProgress(RequestsDbConstant.Status.ERROR, null, null, "sendRestrequestAndHandleResponse exception:" + e.getMessage());
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java
index 62375afa20..23ad422599 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/GenericResourceApi.java
@@ -26,6 +26,7 @@ import org.onap.msb.sdk.httpclient.annotaion.ServiceHttpEndPoint;
import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.*;
import retrofit2.Call;
import retrofit2.http.Body;
+import retrofit2.http.Header;
import retrofit2.http.POST;
/**
@@ -35,13 +36,16 @@ import retrofit2.http.POST;
public interface GenericResourceApi {
@POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation")
- Call<ResponseBody> postNetworkTopologyOperation(@Body RequestBody input);
+ Call<ResponseBody> postNetworkTopologyOperation(@Header("Authorization") String authorization,
+ @Body RequestBody input);
@POST("/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation")
- Call<RpcNetworkTopologyOperationOutputEntity> postNetworkTopologyOperation(@Body RpcNetworkTopologyOperationInputEntity input);
+ Call<RpcNetworkTopologyOperationOutputEntity> postNetworkTopologyOperation(@Header("Authorization") String authorization,
+ @Body RpcNetworkTopologyOperationInputEntity input);
@POST("/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation")
- Call<RpcServiceTopologyOperationOutputEntity> postServiceTopologyOperation(@Body RpcServiceTopologyOperationInputEntity input);
+ Call<RpcServiceTopologyOperationOutputEntity> postServiceTopologyOperation(@Header("Authorization") String authorization,
+ @Body RpcServiceTopologyOperationInputEntity input);
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java
new file mode 100644
index 0000000000..a43eb526a6
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtil.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.workflow.serviceTask.client;
+
+import java.util.Base64;
+
+public class HeaderUtil {
+
+ public static final String USER = "admin";
+ public static final String PASS = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U";
+ public static final String DefaulAuth = getAuthorization(USER, PASS);
+
+ public static String getAuthorization(String usr, String pwd) {
+
+ return "Basic " + base64Encode(usr + ":" + pwd);
+ }
+
+ private static String base64Encode(String str) {
+ String base64 = str;
+ try {
+ base64 = Base64.getEncoder()
+ .encodeToString(str.getBytes("utf-8"));
+ } catch (Exception ex) {
+ }
+ return base64;
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
index 0634da7264..299c1c546b 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
@@ -114,25 +114,25 @@ public abstract class AbstractBuilder<IN, OUT> {
abstract OUT build(DelegateExecution execution, IN input) throws Exception;
protected String getRequestActoin(DelegateExecution execution) {
- String action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.name();
+ String action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.getName();
String operType = (String) execution.getVariable(OPERATION_TYPE);
String resourceType = ((String) execution.getVariable(RESOURCE_TYPE)).toLowerCase();
if (!StringUtils.isBlank(operType)) {
- if (RequestsDbConstant.OperationType.DELETE.equals(operType)) {
+ if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) {
if (isOverlay(resourceType)) {
- action = /*RequestInformation.*/RequestAction.DeActivateDCINetworkInstance.name();
+ action = /*RequestInformation.*/RequestAction.DeActivateDCINetworkInstance.getName();
} else if (isUnderlay(resourceType)) {
- action = /*RequestInformation.*/RequestAction.DeleteNetworkInstance.name();
+ action = /*RequestInformation.*/RequestAction.DeleteNetworkInstance.getName();
} else {
- action = /*RequestInformation.*/RequestAction.DeleteServiceInstance.name();
+ action = /*RequestInformation.*/RequestAction.DeleteServiceInstance.getName();
}
- } else if (RequestsDbConstant.OperationType.CREATE.equals(operType)) {
+ } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) {
if (isOverlay(resourceType)) {
- action = /*RequestInformation.*/RequestAction.ActivateDCINetworkInstance.name();
+ action = /*RequestInformation.*/RequestAction.ActivateDCINetworkInstance.getName();
} else if (isUnderlay(resourceType)) {
- action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.name();
+ action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.getName();
} else {
- action = /*RequestInformation.*/RequestAction.CreateServiceInstance.name();
+ action = /*RequestInformation.*/RequestAction.CreateServiceInstance.getName();
}
}
}
@@ -148,21 +148,25 @@ public abstract class AbstractBuilder<IN, OUT> {
}
protected String getSvcAction(DelegateExecution execution) {
- String action = /*SdncRequestHeader.*/SvcAction.Create.name();
+ String action = /*SdncRequestHeader.*/SvcAction.Create.getName();
String operType = (String) execution.getVariable(OPERATION_TYPE);
String resourceType = ((String) execution.getVariable(RESOURCE_TYPE)).toLowerCase();
if (!StringUtils.isBlank(operType)) {
- if (RequestsDbConstant.OperationType.DELETE.equals(operType)) {
+ if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) {
if (isOverlay(resourceType)) {
- action = /*SdncRequestHeader.*/SvcAction.Deactivate.name();
+ action = /*SdncRequestHeader.*/SvcAction.Deactivate.getName();
+ } else if (isUnderlay(resourceType)) {
+ action = /*SdncRequestHeader.*/SvcAction.Delete.getName();
} else {
- action = /*SdncRequestHeader.*/SvcAction.Delete.name();
+ action = /*SdncRequestHeader.*/SvcAction.Unassign.getName();
}
- } else if (RequestsDbConstant.OperationType.CREATE.equals(operType)) {
+ } else if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)) {
if (isOverlay(resourceType)) {
- action = /*SdncRequestHeader.*/SvcAction.Activate.name();
+ action = /*SdncRequestHeader.*/SvcAction.Activate.getName();
+ } else if (isUnderlay(resourceType)) {
+ action = /*SdncRequestHeader.*/SvcAction.Create.getName();
} else {
- action = /*SdncRequestHeader.*/SvcAction.Create.name();
+ action = /*SdncRequestHeader.*/SvcAction.Assign.getName();
}
}
}
@@ -179,13 +183,13 @@ public abstract class AbstractBuilder<IN, OUT> {
return requestId;
}
- protected OnapModelInformationEntity getOnapModelInformationEntity(DelegateExecution execution) {
+ protected OnapModelInformationEntity getOnapServiceModelInformationEntity(DelegateExecution execution) {
OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity();
{
String modelInvariantUuid = (String) execution.getVariable("modelInvariantUuid");
String modelVersion = (String) execution.getVariable("modelVersion");
String modelUuid = (String) execution.getVariable("modelUuid");
- String modelName = (String) execution.getVariable("modelName");
+ String modelName = (String) execution.getVariable("serviceModelName");
onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid);
onapModelInformationEntity.setModelVersion(modelVersion);
onapModelInformationEntity.setModelUuid(modelUuid);
@@ -193,6 +197,21 @@ public abstract class AbstractBuilder<IN, OUT> {
}
return onapModelInformationEntity;
}
+
+ protected OnapModelInformationEntity getOnapNetworkModelInformationEntity(DelegateExecution execution) {
+ OnapModelInformationEntity onapModelInformationEntity = new OnapModelInformationEntity();
+ {
+ String modelInvariantUuid = (String) execution.getVariable("resourceInvariantUUID");
+ String modelVersion = (String) execution.getVariable("modelVersion");
+ String modelUuid = (String) execution.getVariable("resourceUUID");
+ String modelName = (String) execution.getVariable("resourceType");
+ onapModelInformationEntity.setModelInvariantUuid(modelInvariantUuid);
+ onapModelInformationEntity.setModelVersion(modelVersion);
+ onapModelInformationEntity.setModelUuid(modelUuid);
+ onapModelInformationEntity.setModelName(modelName);
+ }
+ return onapModelInformationEntity;
+ }
protected List<ParamEntity> getParamEntities(Map<String, String> inputs) {
List<ParamEntity> paramEntityList = new ArrayList<>();
@@ -218,9 +237,9 @@ public abstract class AbstractBuilder<IN, OUT> {
protected ServiceInformationEntity getServiceInformationEntity(DelegateExecution execution) {
ServiceInformationEntity serviceInformationEntity = new ServiceInformationEntity();
- serviceInformationEntity.setServiceId((String) execution.getVariable("productFamilyId"));
- serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("subscriptionServiceType"));
- serviceInformationEntity.setOnapModelInformation(getOnapModelInformationEntity(execution));
+ serviceInformationEntity.setServiceId("VOLTE_SERVICE_ID");
+ serviceInformationEntity.setSubscriptionServiceType((String) execution.getVariable("serviceType"));
+ serviceInformationEntity.setOnapModelInformation(getOnapServiceModelInformationEntity(execution));
serviceInformationEntity.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
serviceInformationEntity.setGlobalCustomerId((String) execution.getVariable("globalSubscriberId"));
return serviceInformationEntity;
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java
index 94838ed1ff..ac411b5598 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilder.java
@@ -85,7 +85,7 @@ public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, St
private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity();
{
- OnapModelInformationEntity onapModelInformationEntity = getOnapModelInformationEntity(execution);
+ OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution);
networkInformationEntity.setOnapModelInformation(onapModelInformationEntity);
}
networkTopologyOperationInputEntity.setNetworkInformation(networkInformationEntity);
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java
index 02ac6824a1..3d59d3b73e 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInformationEntity.java
@@ -26,13 +26,13 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/20.
*/
public class NetworkInformationEntity {
- @JsonProperty("network-id")
+ @JsonProperty("GENERIC-RESOURCE-API:network-id")
private String networkId;
- @JsonProperty("network-type")
+ @JsonProperty("GENERIC-RESOURCE-API:network-type")
private String networkType;
- @JsonProperty("onap-model-information")
+ @JsonProperty("GENERIC-RESOURCE-API:onap-model-information")
private OnapModelInformationEntity onapModelInformation;
public String getNetworkId() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java
index b45a21d3ac..f7b055efcf 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkInputPaarametersEntity.java
@@ -36,6 +36,6 @@ public class NetworkInputPaarametersEntity {
this.paramList = paramList;
}
- @JsonProperty("param")
+ @JsonProperty("GENERIC-RESOURCE-API:param")
private List<ParamEntity> paramList;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java
index 1aff6e948a..420d547a39 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkRequestInputEntity.java
@@ -26,19 +26,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/20.
*/
public class NetworkRequestInputEntity {
- @JsonProperty("network-name")
+ @JsonProperty("GENERIC-RESOURCE-API:network-name")
private String networkName;
- @JsonProperty("tenant")
+ @JsonProperty("GENERIC-RESOURCE-API:tenant")
private String tenant;
- @JsonProperty("aic-cloud-region")
+ @JsonProperty("GENERIC-RESOURCE-API:aic-cloud-region")
private String aicCloudRegion;
- @JsonProperty("aic-clli")
+ @JsonProperty("GENERIC-RESOURCE-API:aic-clli")
private String aicClli;
- @JsonProperty("network-input-parameters")
+ @JsonProperty("GENERIC-RESOURCE-API:network-input-parameters")
private NetworkInputPaarametersEntity networkInputPaarameters;
public String getNetworkName() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java
index 69ee28758d..aa8ea39cd1 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkResponseInformationEntity.java
@@ -26,10 +26,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/22.
*/
public class NetworkResponseInformationEntity {
- @JsonProperty("instance-id")
+ @JsonProperty("GENERIC-RESOURCE-API:instance-id")
private String instanceId;
- @JsonProperty("object-path")
+ @JsonProperty("GENERIC-RESOURCE-API:object-path")
private String objectPath;
public String getInstanceId() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java
index 2fbc23e0cd..1ce0b455ed 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationInputEntity.java
@@ -26,19 +26,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/20.
*/
public class NetworkTopologyOperationInputEntity {
- @JsonProperty("sdnc-request-header")
+ @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header")
private SdncRequestHeaderEntity sdncRequestHeader;
- @JsonProperty("request-information")
+ @JsonProperty("GENERIC-RESOURCE-API:request-information")
private RequestInformationEntity requestInformation;
- @JsonProperty("service-information")
+ @JsonProperty("GENERIC-RESOURCE-API:service-information")
private ServiceInformationEntity serviceInformation;
- @JsonProperty("network-information")
+ @JsonProperty("GENERIC-RESOURCE-API:network-information")
private NetworkInformationEntity networkInformation;
- @JsonProperty("network-request-input")
+ @JsonProperty("GENERIC-RESOURCE-API:network-request-input")
private NetworkRequestInputEntity networkRequestInput;
public SdncRequestHeaderEntity getSdncRequestHeader() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java
index 4be0844fc9..c835efb9ed 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/NetworkTopologyOperationOutputEntity.java
@@ -26,22 +26,22 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/22.
*/
public class NetworkTopologyOperationOutputEntity {
- @JsonProperty("svc-request-id")
+ @JsonProperty("GENERIC-RESOURCE-API:svc-request-id")
private String svcRequestId;
- @JsonProperty("response-code")
+ @JsonProperty("GENERIC-RESOURCE-API:response-code")
private String responseCode;
- @JsonProperty("response-message")
+ @JsonProperty("GENERIC-RESOURCE-API:response-message")
private String responseMessage;
- @JsonProperty("ack-final-indicator")
+ @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator")
private String ackFinalIndicator;
- @JsonProperty("network-response-information")
+ @JsonProperty("GENERIC-RESOURCE-API:network-response-information")
private NetworkResponseInformationEntity networkResponseInformation;
- @JsonProperty("service-response-information")
+ @JsonProperty("GENERIC-RESOURCE-API:service-response-information")
private ServiceResponseInformationEntity serviceResponseInformation;
public String getSvcRequestId() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java
index f061c9ab0a..eeb8eda61f 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/OnapModelInformationEntity.java
@@ -26,19 +26,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/20.
*/
public class OnapModelInformationEntity {
- @JsonProperty("model-invariant-uuid")
+ @JsonProperty("GENERIC-RESOURCE-API:model-invariant-uuid")
private String modelInvariantUuid;
- @JsonProperty("model-customization-uuid")
+ @JsonProperty("GENERIC-RESOURCE-API:model-customization-uuid")
private String modelCustomizationUuid;
- @JsonProperty("model-uuid")
+ @JsonProperty("GENERIC-RESOURCE-API:model-uuid")
private String modelUuid;
- @JsonProperty("model-version")
+ @JsonProperty("GENERIC-RESOURCE-API:model-version")
private String modelVersion;
- @JsonProperty("model-name")
+ @JsonProperty("GENERIC-RESOURCE-API:model-name")
private String modelName;
public String getModelInvariantUuid() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java
index 8c2f217839..b45a1c3265 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ParamEntity.java
@@ -26,10 +26,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/20.
*/
public class ParamEntity {
- @JsonProperty("name")
+ @JsonProperty("GENERIC-RESOURCE-API:name")
private String name;
- @JsonProperty("value")
+ @JsonProperty("GENERIC-RESOURCE-API:value")
private String value;
public String getName() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java
index 1538b64c54..2982e5afc5 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RequestInformationEntity.java
@@ -74,21 +74,21 @@ public class RequestInformationEntity {
this.orerVersion = orerVersion;
}
- @JsonProperty("request-id")
+ @JsonProperty("GENERIC-RESOURCE-API:request-id")
private String requestId;
- @JsonProperty("request-action")
+ @JsonProperty("GENERIC-RESOURCE-API:request-action")
private String requestAction;
- @JsonProperty("source")
+ @JsonProperty("GENERIC-RESOURCE-API:source")
private String source;
- @JsonProperty("notification-url")
+ @JsonProperty("GENERIC-RESOURCE-API:notification-url")
private String notificationUrl;
- @JsonProperty("order-number")
+ @JsonProperty("GENERIC-RESOURCE-API:order-number")
private String orderUnmber;
- @JsonProperty("order-version")
+ @JsonProperty("GENERIC-RESOURCE-API:order-version")
private String orerVersion;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java
index ed8ae578a1..b20e9ab833 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationInputEntity.java
@@ -34,6 +34,6 @@ public class RpcNetworkTopologyOperationInputEntity {
this.input = input;
}
- @JsonProperty("input")
+ @JsonProperty("GENERIC-RESOURCE-API:input")
private NetworkTopologyOperationInputEntity input = null;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java
index 745d6c66b5..40d336e000 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcNetworkTopologyOperationOutputEntity.java
@@ -34,6 +34,6 @@ public class RpcNetworkTopologyOperationOutputEntity {
this.output = output;
}
- @JsonProperty("output")
+ @JsonProperty("GENERIC-RESOURCE-API:output")
private NetworkTopologyOperationOutputEntity output;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java
index 5b49e11efd..54933cce2a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationInputEntity.java
@@ -34,6 +34,6 @@ public class RpcServiceTopologyOperationInputEntity {
this.serviceTopologyOperationInputEntity = serviceTopologyOperationInputEntity;
}
- @JsonProperty("input")
+ @JsonProperty("GENERIC-RESOURCE-API:input")
private ServiceTopologyOperationInputEntity serviceTopologyOperationInputEntity;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java
index c59cc4eed1..02fb1116e1 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/RpcServiceTopologyOperationOutputEntity.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/26.
*/
public class RpcServiceTopologyOperationOutputEntity {
- @JsonProperty("output")
+ @JsonProperty("GENERIC-RESOURCE-API:output")
private ServiceTopologyOperationOutputEntity output;
public ServiceTopologyOperationOutputEntity getOutput() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java
index 1ea1045cc0..7e28aa07b6 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/SdncRequestHeaderEntity.java
@@ -26,13 +26,13 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/20.
*/
public class SdncRequestHeaderEntity {
- @JsonProperty("svc-request-id")
+ @JsonProperty("GENERIC-RESOURCE-API:svc-request-id")
private String svcRequestId;
- @JsonProperty("svc-action")
+ @JsonProperty("GENERIC-RESOURCE-API:svc-action")
private String svcAction;
- @JsonProperty("svc-notification-url")
+ @JsonProperty("GENERIC-RESOURCE-API:svc-notification-url")
private String svcNotificationUrl;
public String getSvcRequestId() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java
index 58d50fa724..46b53902a4 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInformationEntity.java
@@ -26,22 +26,22 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/20.
*/
public class ServiceInformationEntity {
- @JsonProperty("service-id")
+ @JsonProperty("GENERIC-RESOURCE-API:service-id")
private String serviceId;
- @JsonProperty("subscription-service-type")
+ @JsonProperty("GENERIC-RESOURCE-API:subscription-service-type")
private String subscriptionServiceType;
- @JsonProperty("onap-model-information")
+ @JsonProperty("GENERIC-RESOURCE-API:onap-model-information")
private OnapModelInformationEntity onapModelInformation;
- @JsonProperty("service-instance-id")
+ @JsonProperty("GENERIC-RESOURCE-API:service-instance-id")
private String serviceInstanceId;
- @JsonProperty("global-customer-id")
+ @JsonProperty("GENERIC-RESOURCE-API:global-customer-id")
private String globalCustomerId;
- @JsonProperty("subscriber-name")
+ @JsonProperty("GENERIC-RESOURCE-API:subscriber-name")
private String subscriberName;
public String getServiceId() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java
index 038c50c7c6..c056ffa5d9 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceInputParametersEntity.java
@@ -36,6 +36,6 @@ public class ServiceInputParametersEntity {
this.paramList = paramList;
}
- @JsonProperty("param")
+ @JsonProperty("GENERIC-RESOURCE-API:param")
private List<ParamEntity> paramList;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java
index 576995df49..934a94610d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceRequestInputEntity.java
@@ -27,10 +27,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
*/
public class ServiceRequestInputEntity {
- @JsonProperty("service-instance-name")
+ @JsonProperty("GENERIC-RESOURCE-API:service-instance-name")
private String serviceInstanceName;
- @JsonProperty("service-input-parameters")
+ @JsonProperty("GENERIC-RESOURCE-API:service-input-parameters")
private ServiceInputParametersEntity serviceInputParametersEntity;
public String getServiceInstanceName() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java
index ade389b30e..ee0104bff0 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceResponseInformationEntity.java
@@ -26,10 +26,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/22.
*/
public class ServiceResponseInformationEntity {
- @JsonProperty("instance-id")
+ @JsonProperty("GENERIC-RESOURCE-API:instance-id")
private String instanceId;
- @JsonProperty("object-path")
+ @JsonProperty("GENERIC-RESOURCE-API:object-path")
private String objectPath;
public String getInstanceId() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java
index d817b0c52f..ba46eb7ee1 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationInputEntity.java
@@ -26,16 +26,16 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/26.
*/
public class ServiceTopologyOperationInputEntity {
- @JsonProperty("sdnc-request-header")
+ @JsonProperty("GENERIC-RESOURCE-API:sdnc-request-header")
private SdncRequestHeaderEntity sdncRequestHeader;
- @JsonProperty("request-information")
+ @JsonProperty("GENERIC-RESOURCE-API:request-information")
private RequestInformationEntity requestInformation;
- @JsonProperty("service-information")
+ @JsonProperty("GENERIC-RESOURCE-API:service-information")
private ServiceInformationEntity serviceInformation;
- @JsonProperty("service-request-input")
+ @JsonProperty("GENERIC-RESOURCE-API:service-request-input")
private ServiceRequestInputEntity serviceRequestInput;
public SdncRequestHeaderEntity getSdncRequestHeader() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java
index ebc1ca807d..216a3d41bd 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/entity/ServiceTopologyOperationOutputEntity.java
@@ -26,19 +26,19 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* Created by 10112215 on 2017/9/26.
*/
public class ServiceTopologyOperationOutputEntity {
- @JsonProperty("svc-request-id")
+ @JsonProperty("GENERIC-RESOURCE-API:svc-request-id")
private String svcRequestId;
- @JsonProperty("response-code")
+ @JsonProperty("GENERIC-RESOURCE-API:response-code")
private String responseCode;
- @JsonProperty("response-message")
+ @JsonProperty("GENERIC-RESOURCE-API:response-message")
private String responseMessage;
- @JsonProperty("ack-final-indicator")
+ @JsonProperty("GENERIC-RESOURCE-API:ack-final-indicator")
private String ackFinalIndicator;
- @JsonProperty("service-response-information")
+ @JsonProperty("GENERIC-RESOURCE-API:service-response-information")
private ServiceResponseInformationEntity serviceResponseInformation;
public String getSvcRequestId() {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java
deleted file mode 100644
index f1224da30c..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.vcpe.workflow;
-
-import javax.ws.rs.Path;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
-
-
-/**
- *
- * @version 1.0
- * Asynchronous Workflow processing using JAX RS RESTeasy implementation
- * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
- * and the server thread is freed up, server scales better to process more incoming requests
- *
- * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
- * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
- */
-@Path("/async")
-public class WorkflowAsyncVcpeResource extends WorkflowAsyncResource {
-
- protected ProcessEngineServices getProcessEngineServices() {
- return pes4junit.orElse(ProcessEngines.getProcessEngine("vcpe"));
- }
-}
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 c5827046d6..f5d068f900 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
@@ -40,7 +40,6 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.codehaus.jackson.map.ObjectMapper;
-import org.eclipse.jetty.io.RuntimeIOException;
import org.hibernate.Session;
import org.json.JSONObject;
import org.openecomp.mso.apihandler.common.ErrorNumbers;
@@ -69,7 +68,6 @@ import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoAlarmLogger;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.properties.MsoDatabaseException;
-import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.OperationStatus;
import org.openecomp.mso.requestsdb.RequestsDatabase;
import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
@@ -83,11 +81,12 @@ import com.wordnik.swagger.annotations.ApiOperation;
public class E2EServiceInstances {
private HashMap<String, String> instanceIdMap = new HashMap<>();
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+ private static MsoLogger msoLogger = MsoLogger
+ .getMsoLogger(MsoLogger.Catalog.APIH);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
private ServiceInstancesRequest sir = null;
-
+
public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB";
public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine";
@@ -101,9 +100,11 @@ public class E2EServiceInstances {
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Create a E2E Service Instance on a version provided", response = Response.class)
- public Response createE2EServiceInstance(String request, @PathParam("version") String version) {
+ public Response createE2EServiceInstance(String request,
+ @PathParam("version") String version) {
- return processE2EserviceInstances(request, Action.createInstance, null, version);
+ return processE2EserviceInstances(request, Action.createInstance, null,
+ version);
}
/**
@@ -116,22 +117,30 @@ public class E2EServiceInstances {
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class)
- public Response deleteE2EServiceInstance(String request, @PathParam("version") String version,
+ public Response deleteE2EServiceInstance(String request,
+ @PathParam("version") String version,
@PathParam("serviceId") String serviceId) {
instanceIdMap.put("serviceId", serviceId);
- return deleteE2EserviceInstances(request, Action.deleteInstance, instanceIdMap, version);
+ return deleteE2EserviceInstances(request, Action.deleteInstance,
+ instanceIdMap, version);
}
-
+
@GET
@Path("/{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) {
+ public Response getE2EServiceInstances(
+ @PathParam("serviceId") String serviceId,
+ @PathParam("version") String version,
+ @PathParam("operationId") String operationId) {
+ return getE2EServiceInstances(serviceId, operationId);
+ }
+
+ private Response getE2EServiceInstances(String serviceId, String operationId) {
RequestsDatabase requestsDB = RequestsDatabase.getInstance();
-
+
GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();
MsoRequest msoRequest = new MsoRequest(serviceId);
@@ -141,169 +150,224 @@ public class E2EServiceInstances {
OperationStatus operationStatus = null;
try {
- operationStatus = requestsDB.getOperationStatus(serviceId, operationId);
+ operationStatus = requestsDB.getOperationStatus(serviceId,
+ operationId);
} 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,
+ 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.debug("End of the transaction, the final response is: "
+ + (String) response.getEntity());
return response;
}
if (operationStatus == null) {
- Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT,
- MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB",
+ 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.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,
+ 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());
+ msoLogger.debug("End of the transaction, the final response is: "
+ + (String) resp.getEntity());
return resp;
}
- e2eServiceResponse.setE2eRequest(operationStatus);
+ e2eServiceResponse.setOperationStatus(operationStatus);
return Response.status(200).entity(e2eServiceResponse).build();
}
- private Response deleteE2EserviceInstances(String requestJSON, Action action,
- HashMap<String, String> instanceIdMap, String version) {
- //TODO should be a new one or the same service instance Id
+ private Response deleteE2EserviceInstances(String requestJSON,
+ Action action, HashMap<String, String> instanceIdMap, String version) {
+ // TODO should be a new one or the same service instance Id
String requestId = instanceIdMap.get("serviceId");
long startTime = System.currentTimeMillis();
msoLogger.debug("requestId is: " + requestId);
E2EServiceInstanceDeleteRequest e2eDelReq = null;
MsoRequest msoRequest = new MsoRequest(requestId);
-
+
ObjectMapper mapper = new ObjectMapper();
try {
- e2eDelReq = mapper.readValue(requestJSON, E2EServiceInstanceDeleteRequest.class);
+ e2eDelReq = mapper.readValue(requestJSON,
+ E2EServiceInstanceDeleteRequest.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(),
- ErrorNumbers.SVC_BAD_PARAMETER, null);
- msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
+ Response response = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_BAD_REQUEST,
+ MsoException.ServiceException,
+ "Mapping of request to JSON object failed. "
+ + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,
+ null);
+ 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,
+ 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.debug("End of the transaction, the final response is: "
+ + (String) response.getEntity());
createOperationStatusRecordForError(action, requestId);
return response;
}
-
+
CatalogDatabase db = null;
RecipeLookupResult recipeLookupResult = null;
try {
db = CatalogDatabase.getInstance();
recipeLookupResult = getServiceInstanceOrchestrationURI(db, action);
} catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
- msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+ msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC,
+ MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.AvailabilityError,
+ "Exception while communciate with Catalog DB", e);
+ msoRequest
+ .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ "No communication to catalog DB " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
- alarmLogger.sendAlarm("MsoDatabaseAccessError", MsoAlarmLogger.CRITICAL,
- Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
+ alarmLogger.sendAlarm("MsoDatabaseAccessError",
+ MsoAlarmLogger.CRITICAL, Messages.errors
+ .get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));
msoRequest.createRequestRecord(Status.FAILED, action);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.DBAccessError,
"Exception while communciate with DB");
- msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+ msoLogger.debug(END_OF_THE_TRANSACTION
+ + (String) response.getEntity());
return response;
} finally {
closeCatalogDB(db);
}
if (recipeLookupResult == null) {
- msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "",
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
+ MSO_PROP_APIHANDLER_INFRA, "", "",
MsoLogger.ErrorCode.DataError, "No recipe found in DB");
- msoRequest.setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException, "Recipe does not exist in catalog DB",
+ msoRequest
+ .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
+ Response response = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ "Recipe does not exist in catalog DB",
ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);
msoRequest.createRequestRecord(Status.FAILED, action);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.DataNotFound,
"No recipe found in DB");
- msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
+ msoLogger.debug(END_OF_THE_TRANSACTION
+ + (String) response.getEntity());
createOperationStatusRecordForError(action, requestId);
return response;
}
-
RequestClient requestClient = null;
HttpResponse response = null;
long subStartTime = System.currentTimeMillis();
- //String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
+ // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);
try {
- requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(),
+ requestClient = RequestClientFactory.getRequestClient(
+ recipeLookupResult.getOrchestrationURI(),
MsoPropertiesUtils.loadMsoProperties());
JSONObject jjo = new JSONObject(requestJSON);
jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));
-
+
String bpmnRequest = jjo.toString();
-
- // Capture audit event
- msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
- String serviceId = instanceIdMap.get("serviceId");
- String serviceInstanceType = e2eDelReq.getServiceType();
- response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(),
- serviceId, null, null, null, null, serviceInstanceType, null, null, null, bpmnRequest);
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(),
- null);
+ // Capture audit event
+ msoLogger
+ .debug("MSO API Handler Posting call to BPEL engine for url: "
+ + requestClient.getUrl());
+ String serviceId = instanceIdMap.get("serviceId");
+ String serviceInstanceType = e2eDelReq.getServiceType();
+ response = requestClient.post(requestId, false,
+ recipeLookupResult.getRecipeTimeout(), action.name(),
+ serviceId, null, null, null, null, serviceInstanceType,
+ null, null, null, bpmnRequest);
+
+ msoLogger.recordMetricEvent(subStartTime,
+ MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully received response from BPMN engine", "BPMN",
+ recipeLookupResult.getOrchestrationURI(), null);
} catch (Exception e) {
- msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN",
+ msoLogger.recordMetricEvent(subStartTime,
+ MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError,
+ "Exception while communicate with BPMN engine", "BPMN",
recipeLookupResult.getOrchestrationURI(), null);
- Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
- MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
+ Response resp = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+ "Failed calling bpmn " + e.getMessage(),
ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
- alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL,
+ alarmLogger.sendAlarm("MsoConfigurationError",
+ MsoAlarmLogger.CRITICAL,
Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
+ MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.AvailabilityError,
"Exception while communicate with BPMN engine");
- msoLogger.debug("End of the transaction, the final response is: " + (String) resp.getEntity());
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.CommunicationError,
+ "Exception while communicate with BPMN engine");
+ msoLogger.debug("End of the transaction, the final response is: "
+ + (String) resp.getEntity());
createOperationStatusRecordForError(action, requestId);
return resp;
}
if (response == null) {
- Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
- MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
- msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
+ Response resp = msoRequest.buildServiceErrorResponse(
+ HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+ "bpelResponse is null",
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
+ MSO_PROP_APIHANDLER_INFRA, "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
+ "Null response from BPEL");
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError,
"Null response from BPMN");
msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
createOperationStatusRecordForError(action, requestId);
return resp;
}
- ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
+ ResponseHandler respHandler = new ResponseHandler(response,
+ requestClient.getType());
int bpelStatus = respHandler.getStatus();
- return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action);
+ return beplStatusUpdate(requestId, startTime, msoRequest,
+ requestClient, respHandler, bpelStatus, action, instanceIdMap);
}
private Response processE2EserviceInstances(String requestJSON, Action action,
@@ -356,10 +420,8 @@ public class E2EServiceInstances {
msoLogger.debug("End of the transaction, the final response is: " + (String) response.getEntity());
return response;
}
-
- InfraActiveRequests dup = null;
-// String instanceName = sir.getService().getName();
-// String requestScope = sir.getService().getParameters().getNodeType();
+
+ OperationStatus dup = null;
String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
try {
@@ -367,8 +429,7 @@ public class E2EServiceInstances {
&& (action == Action.createInstance || action == Action.activateInstance))) {
//TODO : Need to check for the duplicate record from the operation status,
//TODO : commenting this check for unblocking current testing for now... induces dead code...
-// dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate(instanceIdMap, instanceName,
-// requestScope);
+ dup = chkDuplicateServiceNameInOperStatus( instanceName);
}
} catch (Exception e) {
msoLogger.error(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "",
@@ -392,8 +453,8 @@ public class E2EServiceInstances {
instance = instanceIdMap.get(requestScope + "InstanceId");
}
String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") "
- + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - "
- + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
+ + "already has a request being worked with a status of " + dup.getProgress() + " (ServiceId - "
+ + dup.getServiceId() + "). The existing request must finish or be cleaned up before proceeding.";
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT,
MsoException.ServiceException, dupMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
@@ -447,7 +508,6 @@ public class E2EServiceInstances {
createOperationStatusRecordForError(action, requestId);
return response;
}
-
// try {
// msoRequest.createRequestRecord(Status.PENDING, action);
// //createOperationStatusRecord(action, requestId);
@@ -518,7 +578,7 @@ public class E2EServiceInstances {
ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
int bpelStatus = respHandler.getStatus();
- return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action);
+ return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);
}
private void closeCatalogDB(CatalogDatabase db) {
@@ -527,91 +587,87 @@ public class E2EServiceInstances {
}
}
- private InfraActiveRequests checkForDuplicateRecord(Action action, HashMap<String, String> instanceIdMap,
- String instanceName, String requestScope) {
- InfraActiveRequests dupValue = null;
- if (!(instanceName == null && "service".equals(requestScope)
- && (action == Action.createInstance || action == Action.activateInstance))) {
- dupValue = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate(instanceIdMap, instanceName,
- requestScope);
- }
- return dupValue;
- }
-
- private Response duplicateRecordFound(Action action, HashMap<String, String> instanceIdMap, long startTime,
- MsoRequest msoRequest, InfraActiveRequests dup, String instanceName, String requestScope) {
- String instance = null;
- if (instanceName != null) {
- instance = instanceName;
- } else {
- instance = instanceIdMap.get(requestScope + "InstanceId");
- }
- String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") "
- + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - "
- + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding.";
-
- Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException,
- dupMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
-
- msoLogger.warn(MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError,
- "Duplicate request - Subscriber already has a request for this service");
- msoRequest.createRequestRecord(Status.FAILED, action);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage);
- msoLogger.debug(END_OF_THE_TRANSACTION + (String) response.getEntity());
- return response;
- }
-
- private Response beplStatusUpdate(String requestId, long startTime, MsoRequest msoRequest,
- RequestClient requestClient, ResponseHandler respHandler, int bpelStatus, Action action) {
+ private Response beplStatusUpdate(String requestId, long startTime,
+ MsoRequest msoRequest, RequestClient requestClient,
+ ResponseHandler respHandler, int bpelStatus, Action action,
+ HashMap<String, String> instanceIdMap) {
// BPMN accepted the request, the request is in progress
if (bpelStatus == HttpStatus.SC_ACCEPTED) {
String camundaJSONResponseBody = respHandler.getResponseBody();
- msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody);
-
+ msoLogger
+ .debug("Received from Camunda: " + camundaJSONResponseBody);
+
// currently only for delete case we update the status here
- if(action == Action.deleteInstance){
+ if (action == Action.deleteInstance) {
ObjectMapper mapper = new ObjectMapper();
- try{
- DelE2ESvcResp jo = mapper.readValue(camundaJSONResponseBody, DelE2ESvcResp.class);
+ try {
+ DelE2ESvcResp jo = mapper.readValue(
+ camundaJSONResponseBody, DelE2ESvcResp.class);
String operationId = jo.getOperationId();
-
- this.createOperationStatusRecord("DELETE", requestId, operationId);
- }
- catch(Exception ex)
- {
- msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl(), "", "",
+ 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,
+ operationId);
+ }
+ } catch (Exception ex) {
+ msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ requestClient.getUrl(), "", "",
MsoLogger.ErrorCode.BusinessProcesssError,
- "Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
+ "Response from BPEL engine is failed with HTTP Status="
+ + bpelStatus);
}
}
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ msoLogger.recordAuditEvent(startTime,
+ MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
"BPMN accepted the request, the request is in progress");
msoLogger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody);
- return Response.status(HttpStatus.SC_ACCEPTED).entity(camundaJSONResponseBody).build();
+ return Response.status(HttpStatus.SC_ACCEPTED)
+ .entity(camundaJSONResponseBody).build();
} else {
List<String> variables = new ArrayList<>();
variables.add(bpelStatus + "");
String camundaJSONResponseBody = respHandler.getResponseBody();
- if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty()) {
- Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, MsoException.ServiceException,
- "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody,
+ if (camundaJSONResponseBody != null
+ && !camundaJSONResponseBody.isEmpty()) {
+ Response resp = msoRequest.buildServiceErrorResponse(
+ bpelStatus, MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1 "
+ + '\n' + camundaJSONResponseBody,
ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
- msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl(), "", "",
+ msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ requestClient.getUrl(), "", "",
MsoLogger.ErrorCode.BusinessProcesssError,
- "Response from BPEL engine is failed with HTTP Status=" + bpelStatus);
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
+ "Response from BPEL engine is failed with HTTP Status="
+ + bpelStatus);
+ msoLogger.recordAuditEvent(startTime,
+ MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError,
"Response from BPMN engine is failed");
- msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
+ msoLogger.debug(END_OF_THE_TRANSACTION
+ + (String) resp.getEntity());
return resp;
} else {
- Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, MsoException.ServiceException,
- "Request Failed due to BPEL error with HTTP Status= %1",
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables);
- msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl(), "", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty");
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
+ Response resp = msoRequest
+ .buildServiceErrorResponse(
+ bpelStatus,
+ MsoException.ServiceException,
+ "Request Failed due to BPEL error with HTTP Status= %1",
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR,
+ variables);
+ msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR,
+ requestClient.getUrl(), "", "",
+ MsoLogger.ErrorCode.BusinessProcesssError,
"Response from BPEL engine is empty");
- msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());
+ msoLogger.recordAuditEvent(startTime,
+ MsoLogger.StatusCode.ERROR,
+ MsoLogger.ResponseCode.InternalError,
+ "Response from BPEL engine is empty");
+ msoLogger.debug(END_OF_THE_TRANSACTION
+ + (String) resp.getEntity());
return resp;
}
}
@@ -624,13 +680,16 @@ public class E2EServiceInstances {
* @param action
* @return
*/
- private RecipeLookupResult getServiceInstanceOrchestrationURI(CatalogDatabase db, Action action) {
+ private RecipeLookupResult getServiceInstanceOrchestrationURI(
+ CatalogDatabase db, Action action) {
RecipeLookupResult recipeLookupResult = getServiceURI(db, action);
if (recipeLookupResult != null) {
- msoLogger.debug("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI()
- + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout()));
+ msoLogger.debug("Orchestration URI is: "
+ + recipeLookupResult.getOrchestrationURI()
+ + ", recipe Timeout is: "
+ + Integer.toString(recipeLookupResult.getRecipeTimeout()));
} else {
msoLogger.debug("No matching recipe record found");
}
@@ -648,13 +707,16 @@ public class E2EServiceInstances {
String defaultServiceModelName = "UUI_DEFAULT";
- Service serviceRecord = db.getServiceByModelName(defaultServiceModelName);
- ServiceRecipe recipe = db.getServiceRecipeByModelUUID(serviceRecord.getModelUUID(), action.name());
+ Service serviceRecord = db
+ .getServiceByModelName(defaultServiceModelName);
+ ServiceRecipe recipe = db.getServiceRecipeByModelUUID(
+ serviceRecord.getModelUUID(), action.name());
if (recipe == null) {
return null;
}
- return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
+ return new RecipeLookupResult(recipe.getOrchestrationUri(),
+ recipe.getRecipeTimeout());
}
@@ -665,7 +727,8 @@ public class E2EServiceInstances {
* @param e2eSir
* @return
*/
- private String mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir, String requestJSON) {
+ private String mapReqJsonToSvcInstReq(E2EServiceInstanceRequest e2eSir,
+ String requestJSON) {
sir = new ServiceInstancesRequest();
@@ -679,14 +742,15 @@ public class E2EServiceInstances {
// modelNameVersionId
modelInfo.setModelNameVersionId(e2eSir.getService().getTemplateId());
-// String modelInfoValue = e2eSir.getService().getParameters().getNodeTemplateName();
-// String[] arrayOfInfo = modelInfoValue.split(":");
-// String modelName = arrayOfInfo[0];
-// String modelVersion = arrayOfInfo[1];
+ // String modelInfoValue =
+ // e2eSir.getService().getParameters().getNodeTemplateName();
+ // String[] arrayOfInfo = modelInfoValue.split(":");
+ // String modelName = arrayOfInfo[0];
+ // String modelVersion = arrayOfInfo[1];
-// TODO: To ensure, if we dont get the values from the UUI
- String modelName = "voLTE";
- String modelVersion = "1.0";
+ // TODO: To ensure, if we dont get the values from the UUI
+ String modelName = "voLTE";
+ String modelVersion = "1.0";
// modelName
modelInfo.setModelName(modelName);
@@ -702,10 +766,12 @@ public class E2EServiceInstances {
SubscriberInfo subscriberInfo = new SubscriberInfo();
// globalsubscriberId
- subscriberInfo.setGlobalSubscriberId(e2eSir.getService().getParameters().getGlobalSubscriberId());
+ subscriberInfo.setGlobalSubscriberId(e2eSir.getService()
+ .getParameters().getGlobalSubscriberId());
// subscriberName
- subscriberInfo.setSubscriberName(e2eSir.getService().getParameters().getSubscriberName());
+ subscriberInfo.setSubscriberName(e2eSir.getService().getParameters()
+ .getSubscriberName());
// setting subscriberInfo to requestDetails
requestDetails.setSubscriberInfo(subscriberInfo);
@@ -731,18 +797,19 @@ public class E2EServiceInstances {
// Userparams
List<E2EUserParam> userParams;
- //userParams = e2eSir.getService().getParameters().getRequestParameters().getUserParams();
+ // userParams =
+ // e2eSir.getService().getParameters().getRequestParameters().getUserParams();
List<Map<String, String>> userParamList = new ArrayList<>();
Map<String, String> userParamMap = new HashMap<>();
- //complete json request updated in the camunda
+ // complete json request updated in the camunda
userParamMap.put("UUIRequest", requestJSON);
userParamMap.put("ServiceInstanceName", e2eSir.getService().getName());
-// Map<String, String> userParamMap3 = null;
-// for (E2EUserParam userp : userParams) {
-// userParamMap.put(userp.getName(), userp.getValue());
-//
-// }
+ // Map<String, String> userParamMap3 = null;
+ // for (E2EUserParam userp : userParams) {
+ // userParamMap.put(userp.getName(), userp.getValue());
+ //
+ // }
userParamList.add(userParamMap);
requestParameters.setUserParams(userParamList);
@@ -756,84 +823,111 @@ public class E2EServiceInstances {
try {
returnString = mapper.writeValueAsString(sir);
} catch (IOException e) {
- msoLogger.debug("Exception while converting ServiceInstancesRequest object to string", e);
+ msoLogger
+ .debug("Exception while converting ServiceInstancesRequest object to string",
+ e);
}
return returnString;
}
-
- private void createOperationStatusRecordForError(Action action, String requestId) throws MsoDatabaseException{
-
- AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
-
- Session session = null;
- try {
-
- session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
- session.beginTransaction();
-
- OperationStatus os = new OperationStatus();
- os.setOperation(action.name());
- os.setOperationContent("");
- os.setOperationId("");
- os.setProgress("100");
- os.setReason("");
- os.setResult("error");
- os.setServiceId(requestId);
- os.setUserId("");
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
- os.setFinishedAt(endTimeStamp);
- os.setOperateAt(startTimeStamp);
-
- session.save(os);
- session.getTransaction().commit();
-
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request in Operation", e);
- throw new MsoDatabaseException("Data did inserted in Operatus Status Table for failure", e);
- } finally {
- if (null != session) {
- session.close();
- }
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
+
+ Session session = null;
+ try {
+
+ session = requestsDbSessionFactoryManager.getSessionFactory()
+ .openSession();
+ session.beginTransaction();
+
+ OperationStatus os = new OperationStatus();
+ os.setOperation(action.name());
+ os.setOperationContent("");
+ os.setOperationId("");
+ os.setProgress("100");
+ os.setReason("");
+ os.setResult("error");
+ os.setServiceId(requestId);
+ os.setUserId("");
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ os.setFinishedAt(endTimeStamp);
+ os.setOperateAt(startTimeStamp);
+
+ session.save(os);
+ session.getTransaction().commit();
+
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
+ MsoLogger.ErrorCode.DataError,
+ "Exception when creation record request in Operation", e);
+ throw new MsoDatabaseException(
+ "Data did inserted in Operatus Status Table for failure", e);
+ } finally {
+ if (null != session) {
+ session.close();
}
}
- private void createOperationStatusRecord(String actionNm, String serviceId, String operationId) throws MsoDatabaseException{
+ }
- AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
+ private void createOperationStatusRecord(String actionNm, String serviceId,
+ String operationId) throws MsoDatabaseException {
- Session session = null;
- try {
+ AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
- session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
- session.beginTransaction();
-
- OperationStatus os = new OperationStatus();
- os.setOperation(actionNm);
- os.setOperationContent("");
- os.setOperationId(operationId);
- os.setProgress("0");
- os.setReason("");
- os.setResult("processing");
- os.setServiceId(serviceId);
- //TODO : to be updated...
- os.setUserId("");
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
- os.setFinishedAt(endTimeStamp);
- os.setOperateAt(startTimeStamp);
-
- session.save(os);
- session.getTransaction().commit();
-
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request in Operation", e);
- throw new MsoDatabaseException("Data did inserted in Operatus Status Table", e);
- } finally {
- if (null != session) {
- session.close();
- }
+ Session session = null;
+ try {
+
+ session = requestsDbSessionFactoryManager.getSessionFactory()
+ .openSession();
+ session.beginTransaction();
+
+ OperationStatus os = new OperationStatus();
+ os.setOperation(actionNm);
+ os.setOperationContent("");
+ os.setOperationId(operationId);
+ os.setProgress("0");
+ os.setReason("");
+ os.setResult("processing");
+ os.setServiceId(serviceId);
+ // TODO : to be updated...
+ os.setUserId("");
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
+ os.setFinishedAt(endTimeStamp);
+ os.setOperateAt(startTimeStamp);
+
+ session.save(os);
+ session.getTransaction().commit();
+
+ } catch (Exception e) {
+ msoLogger.error(MessageEnum.APIH_DB_INSERT_EXC, "", "",
+ MsoLogger.ErrorCode.DataError,
+ "Exception when creation record request in Operation", e);
+ throw new MsoDatabaseException(
+ "Data did inserted in Operatus Status Table", e);
+ } finally {
+ if (null != session) {
+ session.close();
}
+ }
+ }
+
+ private OperationStatus chkDuplicateServiceInOperStatus(String serviceId) {
+ OperationStatus dupServiceName = (RequestsDatabase.getInstance())
+ .getOperationStatusByServiceId(serviceId);
+
+ return dupServiceName;
+ }
+
+ private OperationStatus chkDuplicateServiceNameInOperStatus(
+ String serviceName) {
+ OperationStatus dupServiceName = (RequestsDatabase.getInstance())
+ .getOperationStatusByServiceName(serviceName);
+
+ return dupServiceName;
}
} \ No newline at end of file
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
index 4c749b7e58..64af30b1ee 100644
--- 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
@@ -27,14 +27,14 @@ import org.openecomp.mso.requestsdb.OperationStatus;
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
public class GetE2EServiceInstanceResponse {
- protected OperationStatus e2eRequest;
+ protected OperationStatus operation;
- public OperationStatus getE2eRequest() {
- return e2eRequest;
+ public OperationStatus getOperationStatus() {
+ return operation;
}
- public void setE2eRequest(OperationStatus requestDB) {
- this.e2eRequest = requestDB;
+ public void setOperationStatus(OperationStatus requestDB) {
+ this.operation = requestDB;
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
index cb8dda5628..238b6b677c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -47,8 +48,10 @@ import org.openecomp.mso.apihandler.common.RequestClientFactory;
import org.openecomp.mso.db.catalog.CatalogDatabase;
import org.openecomp.mso.db.catalog.beans.Service;
import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.properties.MsoDatabaseException;
import org.openecomp.mso.properties.MsoJavaProperties;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.OperationStatus;
import org.openecomp.mso.requestsdb.RequestsDatabase;
import mockit.Mock;
@@ -56,454 +59,555 @@ import mockit.MockUp;
public class E2EServiceInstancesTest {
-
@Test
- public void createE2EServiceInstanceTestSuccess(){
+ public void createE2EServiceInstanceTestSuccess() {
new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- return null;
- }
- };
- new MockUp<RequestsDatabase>() {
- @Mock
- public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
- return 0;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName (String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails){
- ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
- HttpResponse resp = new BasicHttpResponse(pv,202, "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
-
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 202,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("success") != -1);
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestBpelHTTPException(){
+ public void createE2EServiceInstanceTestBpelHTTPException() {
new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- return null;
- }
- };
- new MockUp<RequestsDatabase>() {
- @Mock
- public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
- return 0;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName (String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails){
- ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
- HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"success\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
-
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 500,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestBpelHTTPExceptionWithNullREsponseBody(){
+ public void createE2EServiceInstanceTestBpelHTTPExceptionWithNullREsponseBody() {
new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- return null;
- }
- };
- new MockUp<RequestsDatabase>() {
- @Mock
- public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
- return 0;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName (String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails){
- ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
- HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
- BasicHttpEntity entity = new BasicHttpEntity();
- String body = "{\"response\":\"\",\"message\":\"success\"}";
- InputStream instream = new ByteArrayInputStream(body.getBytes());
- entity.setContent(instream);
- resp.setEntity(entity);
- return resp;
- }
- };
-
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails) {
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 500,
+ "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestNullBPELResponse(){
+ public void createE2EServiceInstanceTestNullBPELResponse() {
new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- return null;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName (String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails){
- HttpResponse resp = null;
- return resp;
- }
- };
-
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction,
+ String serviceInstanceId, String vnfId, String vfModuleId,
+ String volumeGroupId, String networkId, String serviceType,
+ String vnfType, String vfModuleType, String networkType,
+ String requestDetails) {
+ HttpResponse resp = null;
+ return resp;
+ }
+ };
+
E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC1000") != -1);
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestBPMNNullREsponse(){
+ public void createE2EServiceInstanceTestBPMNNullREsponse() {
new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- return null;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName (String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
-
- new MockUp<RequestClientFactory>() {
- @Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
- }
- };
-
- new MockUp<CamundaClient>() {
- @Mock
- public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action){
- HttpResponse resp = null;
- return resp;
- }
- };
- try{
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC1000") != -1);
- }catch(Exception e){
- //TODO: need to catch
- }
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI,
+ MsoJavaProperties props) throws IllegalStateException {
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String camundaReqXML, String requestId,
+ String requestTimeout, String schemaVersion,
+ String serviceInstanceId, String action) {
+ HttpResponse resp = null;
+ return resp;
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestNullBpmn(){
+ public void createE2EServiceInstanceTestNullBpmn() {
new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- return null;
- }
- };
- new MockUp<CatalogDatabase>() {
- @Mock
- public Service getServiceByModelName (String modelName) {
- Service svc = new Service();
- return svc;
- }
- };
-
- new MockUp<CatalogDatabase>() {
- @Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
- ServiceRecipe rec = new ServiceRecipe();
- return rec;
- }
- };
- try{
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC1000") != -1);
- }catch(Exception e){
- //TODO: need to catch
- }
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName(String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID,
+ String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestNullReceipe(){
+ public void createE2EServiceInstanceTestNullReceipe() {
new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- return null;
- }
- };
- try{
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB null") != -1);
- assertTrue(true);
- }catch(Exception e){
- //TODO: need to catch
- }
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestNullDBResponse(){
+ public void createE2EServiceInstanceTestNullDBResponse() {
+
new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- return null;
- }
- };
- try{
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") !=-1);
- assertTrue(true);
- }catch(Exception e){
- //TODO: need to catch
- }
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestInvalidRequest(){
- try{
- new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- List<InfraActiveRequests> activeReqlist = new ArrayList<>();
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("39493992");
-
- activeReqlist.add(req);
- return activeReqlist;
- }
- };
+ public void createE2EServiceInstanceTestInvalidRequest() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC1000") != -1);
- }catch(Exception e){
- //TODO: need to catch
- }
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestEmptyDBQuery(){
- try{
- new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
- return Collections.EMPTY_LIST;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- //assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") != -1);
- assertTrue(true);
- }catch(Exception e){
- //TODO: need to catch
- }
+ public void createE2EServiceInstanceTestEmptyDBQuery() {
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ // assertTrue(true);
}
-
+
@Test
- public void createE2EServiceInstanceTestDBQueryFail(){
- try{
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"templateId\":\"4050083f-465f-4838-af1e-47a545222ad1\",\"parameters\":{\"globalSubscriberId\":\"123457\", \"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"MOG\",\"resourceDefId\":\"MOG\",\"resourceId\":\"MOG\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC1000") != -1);
- }catch(Exception e){
- //TODO: need to catch
- }
+ public void createE2EServiceInstanceTestDBQueryFail() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
-
+
@Test
- public void createE2EServiceInstanceTestForEmptyRequest(){
- try{
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);
- }catch(Exception e){
- //TODO: need to catch
- }
+ public void createE2EServiceInstanceTestForEmptyRequest() {
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr
+ .indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);
}
-
+
@Test
- public void deleteE2EServiceInstanceTestNormal(){
+ public void deleteE2EServiceInstanceTestNormal() {
E2EServiceInstances instance = new E2EServiceInstances();
String request = "{\"globalSubscriberId\":\"299392392\",\"serviceType\":\"VoLTE\"}";
- Response resp = instance.deleteE2EServiceInstance(request, "v3", "12345678");
+ Response resp = instance.deleteE2EServiceInstance(request, "v3",
+ "12345678");
String respStr = resp.getEntity().toString();
assertTrue(respStr.indexOf("SVC1000") != -1);
}
+
+ @Test
+ public void getE2EServiceInstanceTest() {
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatus(String serviceId,
+ String operationId) {
+ OperationStatus os = new OperationStatus();
+ os.setOperation("");
+ os.setOperationContent("");
+ os.setOperationId("123456");
+ os.setProgress("");
+ os.setServiceId("12345");
+ os.setServiceName("VoLTE");
+ os.setReason("");
+ os.setResult("");
+ os.setUserId("");
+ return os;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ Response resp = instance
+ .getE2EServiceInstances("12345", "v3", "123456");
+
+ }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index c6f0cea993..98121d8490 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -560,6 +560,70 @@ public class RequestsDatabase {
}
/**
+ * get the operation progress
+ * <br>
+ *
+ * @param serviceId the serviceId
+ * @return current progress of the operation
+ * @since ONAP Amsterdam Release
+ */
+ public OperationStatus getOperationStatusByServiceId(String serviceId) {
+
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("Execute query on infra active request table");
+
+ OperationStatus operStatus = null;
+ Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
+ try {
+ session.beginTransaction();
+ String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id";
+ Query query = session.createQuery(hql);
+ query.setParameter("service_id", serviceId);
+ operStatus = (OperationStatus)query.uniqueResult();
+
+ } finally {
+ if(session != null && session.isOpen()) {
+ session.close();
+ }
+ msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully", "RequestDB", "getOperationStatus", null);
+ }
+ return operStatus;
+ }
+
+ /**
+ * get the operation progress
+ * <br>
+ *
+ * @param serviceName the serviceName
+ * @return current progress of the operation
+ * @since ONAP Amsterdam Release
+ */
+ public OperationStatus getOperationStatusByServiceName(String serviceName) {
+
+ long startTime = System.currentTimeMillis();
+ msoLogger.debug("Execute query on infra active request table");
+
+ OperationStatus operStatus = null;
+ Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
+ try {
+ session.beginTransaction();
+ String hql = "FROM OperationStatus WHERE SERVICE_NAME = :service_name";
+ Query query = session.createQuery(hql);
+ query.setParameter("service_name", serviceName);
+ operStatus = (OperationStatus)query.uniqueResult();
+
+ } finally {
+ if(session != null && session.isOpen()) {
+ session.close();
+ }
+ msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully", "RequestDB", "getOperationStatus", null);
+ }
+ return operStatus;
+ }
+
+ /**
* update the operation status
* <br>
*