package org.onap.so.asdc.client;
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+ artifact.getArtifactUUID ()
+ ")");
+ String filePath = System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName();
+ // make parent directory
+ File file = new File(filePath);
+ File fileParent = file.getParentFile();
+ if (!fileParent.exists()) {
+ fileParent.mkdirs();
+ }
+
byte[] payloadBytes = resultArtifact.getArtifactPayload();
- try (FileOutputStream outFile = new FileOutputStream(System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactName())) {
+ try (FileOutputStream outFile = new FileOutputStream(filePath)) {
LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName());
outFile.write(payloadBytes, 0, payloadBytes.length);
outFile.close();
LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path"));
- File spoolFile = new File(System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactName());
+ String filePath = System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName();
+
+ File spoolFile = new File(filePath);
LOGGER.debug("ASDC File path is: " + spoolFile.getAbsolutePath());
LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***PATH", "ASDC", spoolFile.getAbsolutePath());
HashMap<String, String> map = new Gson().fromJson(value, new TypeToken<HashMap<String, String>>() {}.getType());
- File csarFile = new File(System.getProperty("mso.config.path") + "ASDC/" + map.get("name"));
+ String filePath = System.getProperty("mso.config.path") + "ASDC/" + map.get("version") + "/" + map.get("name");
+
+ File csarFile = new File(filePath);
if(!csarFile.exists()) {
throw new Exception("csar file does not exist.");
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.onap.so.rest.APIResponse
import org.springframework.web.util.UriUtils;
import groovy.json.*
}
+ public void saveServiceInputToAAI(DelegateExecution execution) {
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+
+ // create url for AAI requestInput
+ String aai_uri = aaiUriUtil.getAAIServiceInstanceUri(execution)
+ String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String serviceType = execution.getVariable("serviceType")
+ String uuiRequest = execution.getVariable("uuiRequest")
+
+ String payload =
+ """< xmlns=\"${namespace}\">
+ <service-instance>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <service-instance-name>${serviceInstanceName}</service-instance-name>
+ <service-type>${serviceType}</service-type>
+ <customer-request>${uuiRequest}</customer-request>
+ </service-instance>""".trim()
+ utils.logAudit(payload)
+
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(serviceInstanceId,"UTF-8")
+
+ APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload)
+ int responseCode = response.getStatusCode()
+ execution.setVariable(Prefix + "PutSppartnerResponseCode", responseCode)
+ }
+
+
public void postProcessAAIGET2(DelegateExecution execution) {
msoLogger.trace("postProcessAAIGET2 ")
String msg = ""
// if site location is in local Operator, create all resources in local ONAP;
// if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP
public void doProcessSiteLocation(DelegateExecution execution){
-
msoLogger.trace("======== Start doProcessSiteLocation Process ======== ")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- ServiceDecomposition serviceDecompositionforLocal = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest);
- execution.setVariable("serviceDecomposition", serviceDecompositionforLocal)
+ uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest);
+ execution.setVariable("uuiRequest", uuiRequest)
+ execution.setVariable("serviceDecomposition", serviceDecomposition)
msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ")
}
+
+ // Allocate cross link TPs(terminal points) for sotn network only
+ public void doTPResourcesAllocation(DelegateExecution execution){
+ msoLogger.trace("======== Start doTPResourcesAllocation Process ======== ")
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ String uuiRequest = execution.getVariable("uuiRequest")
+ uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest);
+ execution.setVariable("uuiRequest", uuiRequest)
+ msoLogger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ")
+ }
// prepare input param for using DoCreateResources.bpmn
public void preProcessForAddResource(DelegateExecution execution) {
package org.onap.so.bpmn.infrastructure.workflow.service;
-import org.json.JSONObject;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.runtime.Execution;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.core.domain.ServiceDecomposition;
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-
+import org.onap.so.bpmn.common.scripts.AaiUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
public class ServicePluginFactory {
// SOTN calculate route
- public static final String OOF_Default_EndPoint = "http://192.168.1.223:8443/oof/sotncalc";
+ public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc";
- public static final String Third_SP_Default_EndPoint = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
+ public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
- public static final String Inventory_OSS_Default_EndPoint = "http://192.168.1.199:8443/oss/inventory";
+ public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory";
private static final int DEFAULT_TIME_OUT = 60000;
static JsonUtils jsonUtil = new JsonUtils();
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ServicePluginFactory.class);
+ private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ServicePluginFactory.class);
private static ServicePluginFactory instance;
}
return instance;
}
-
- private ServicePluginFactory() {
-
- }
-
private String getInventoryOSSEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", Inventory_OSS_Default_EndPoint);
+ return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", INVENTORY_OSS_DEFAULT_ENDPOINT);
}
+
private String getThirdSPEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", Third_SP_Default_EndPoint);
+ return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", THIRD_SP_DEFAULT_ENDPOINT);
}
private String getOOFCalcEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_Default_EndPoint);
+ return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_DEFAULT_ENDPOINT);
}
+
+ @SuppressWarnings("unchecked")
+ public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ if(!isNeedProcessSite(uuiRequest)) {
+ return uuiRequest;
+ }
- public ServiceDecomposition doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- ServiceDecomposition serviceDecompositionforLocal = serviceDecomposition;
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
+ Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
+ Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
+ List<Object> resources = (List<Object>) serviceParametersObject.get("resources");
- if (isSiteLocationLocal(serviceDecomposition, uuiRequest)) {
- return serviceDecomposition;
+ if (isSiteLocationLocal(serviceRequestInputs, resources)) {
+ // resources changed : added TP info
+ String newRequest = getJsonString(uuiObject);
+ return newRequest;
}
List<Resource> addResourceList = serviceDecomposition.getServiceResources();
for (Resource resource : addResourceList) {
String resourcemodelName = resource.getModelInfo().getModelName();
- if (!StringUtils.containsIgnoreCase(resourcemodelName, "sp-partner")) {
- serviceDecompositionforLocal.deleteResource(resource);
+ if (!StringUtils.containsIgnoreCase(resourcemodelName, "sp-partner")
+ || !StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
+ // change serviceDecomposition
+ serviceDecomposition.deleteResource(resource);
break;
}
- if (!StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
- serviceDecompositionforLocal.deleteResource(resource);
+ }
+
+ return uuiRequest;
+ }
+
+ private boolean isNeedProcessSite(String uuiRequest) {
+ return uuiRequest.toLowerCase().contains("site_address") && uuiRequest.toLowerCase().contains("sotncondition_clientsignal");
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean isSiteLocationLocal(Map<String, Object> serviceRequestInputs, List<Object> resources) {
+ Map<String, Object> tpInfoMap = getTPforVPNAttachment(serviceRequestInputs);
+
+ if(tpInfoMap.isEmpty()) {
+ return true;
+ }
+ String host = (String) tpInfoMap.get("host");
+ // host is empty means TP is in local, not empty means TP is in remote ONAP
+ if (!host.isEmpty()) {
+ return false;
+ }
+
+ Map<String, Object> accessTPInfo = new HashMap<String, Object>();
+ accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id"));
+ accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id"));
+ accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id"));
+ accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id"));
+ accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id"));
+
+ // change resources
+ String resourceName = (String) accessTPInfo.get("resourceName");
+ for(Object curResource : resources) {
+ Map<String, Object> resource = (Map<String, Object>)curResource;
+ String curResourceName = (String) resource.get("resourceName");
+ curResourceName = curResourceName.replaceAll(" ", "");
+ if(resourceName.equalsIgnoreCase(curResourceName)) {
+ putResourceRequestInputs(resource, accessTPInfo);
break;
}
}
- return serviceDecompositionforLocal;
+ return true;
}
+
+ @SuppressWarnings("unchecked")
+ private Map<String, Object> getTPforVPNAttachment(Map<String, Object> serviceRequestInputs) {
+ Object location = "";
+ Object clientSignal = "";
+ String vpnAttachmentResourceName = "";
- public boolean isSiteLocationLocal(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- boolean isSiteLocationLocal = true;
-
- String serviceModelName = serviceDecomposition.getModelInfo().getModelName();
- String serviceParameters = JsonUtils.getJsonValue(uuiRequest, "service.parameters");
- String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs");
- JSONObject inputParameters = new JSONObject(requestInputs);
-
- if(StringUtils.containsIgnoreCase(serviceModelName, "site") && inputParameters.has("location"))
- {
- Object location = inputParameters.get("location");
- JSONObject locationObj = new JSONObject(location);
- String locationONAP = queryLocationFromInventoryOSS(locationObj);
- if(StringUtils.containsIgnoreCase(locationONAP, "remote")) {
- isSiteLocationLocal = false;
+ // support R2 uuiReq and R1 uuiReq
+ // logic for R2 uuiRequest params in service level
+ for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
+ String key = entry.getKey();
+ if (key.toLowerCase().contains("site_address")) {
+ location = entry.getValue();
+ }
+ if (key.toLowerCase().contains("sotncondition_clientsignal")) {
+ clientSignal = entry.getValue();
+ vpnAttachmentResourceName = key.substring(0, key.indexOf("_"));
}
}
- return isSiteLocationLocal;
+ Map<String, Object> tpInfoMap = new HashMap<String, Object>();
+
+ // Site resource has location param and SOTNAttachment resource has clientSignal param
+ if("".equals(location) || "".equals(clientSignal) ) {
+ return tpInfoMap;
+ }
+
+ // Query terminal points from InventoryOSS system by location.
+ String locationAddress = (String) location;
+ List<Object> locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress);
+ if(locationTPList != null && !locationTPList.isEmpty()) {
+ tpInfoMap = (Map<String, Object>) locationTPList.get(0);
+ // add resourceName
+ tpInfoMap.put("resourceName", vpnAttachmentResourceName);
+ LOGGER.debug("Get Terminal TP from InventoryOSS");
+ return tpInfoMap;
+ }
+
+ return tpInfoMap;
}
- private String queryLocationFromInventoryOSS(JSONObject locationObj) {
- String reqContent = getJsonString(locationObj);
+ @SuppressWarnings("unchecked")
+ private List<Object> queryAccessTPbyLocationFromInventoryOSS(String locationAddress) {
+ Map<String, String> locationSrc = new HashMap<String, String>();
+ locationSrc.put("location", locationAddress);
+ String reqContent = getJsonString(locationSrc);
String url = getInventoryOSSEndPoint();
String responseContent = sendRequest(url, "POST", reqContent);
- String locationONAP = "";
+ List<Object> accessTPs = new ArrayList<Object>();
if (null != responseContent) {
- locationONAP = getJsonObject(responseContent, String.class);
+ accessTPs = getJsonObject(responseContent, List.class);
+ }
+ return accessTPs;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void putResourceRequestInputs(Map<String, Object> resource, Map<String, Object> resourceInputs) {
+ Map<String, Object> resourceParametersObject = new HashMap<String, Object>();
+ Map<String, Object> resourceRequestInputs = new HashMap<String, Object>();
+ resourceRequestInputs.put("requestInputs", resourceInputs);
+ resourceParametersObject.put("parameters", resourceRequestInputs);
+
+ if(resource.containsKey("parameters")) {
+ Map<String, Object> resParametersObject = (Map<String, Object>) resource.get("parameters");
+ if(resParametersObject.containsKey("requestInputs")) {
+ Map<String, Object> resRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
+ resRequestInputs.putAll(resourceInputs);
+ }
+ else {
+ resParametersObject.putAll(resourceRequestInputs);
+ }
}
- return locationONAP;
+ else {
+ resource.putAll(resourceParametersObject);
+ }
+
+ return;
+ }
+
+
+
+ @SuppressWarnings("unchecked")
+ public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) {
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
+ Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
+ Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
+
+ if(!isNeedAllocateCrossTPResources(serviceRequestInputs)) {
+ return uuiRequest;
+ }
+
+ allocateCrossTPResources(execution, serviceRequestInputs);
+ String newRequest = getJsonString(uuiObject);
+ return newRequest;
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean isNeedAllocateCrossTPResources(Map<String, Object> serviceRequestInputs) {
+ if(serviceRequestInputs.containsKey("CallSource"))
+ {
+ String callSource = (String) serviceRequestInputs.get("CallSource");
+ if("ExternalAPI".equalsIgnoreCase(callSource)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) {
+
+ AaiUtil aai = new AaiUtil(null);
+ Map<String, Object> crossTPs = aai.getTPsfromAAI(execution);
+
+ if(crossTPs == null || crossTPs.isEmpty()) {
+ serviceRequestInputs.put("local-access-provider-id", "");
+ serviceRequestInputs.put("local-access-client-id", "");
+ serviceRequestInputs.put("local-access-topology-id", "");
+ serviceRequestInputs.put("local-access-node-id", "");
+ serviceRequestInputs.put("local-access-ltp-id", "");
+ serviceRequestInputs.put("remote-access-provider-id", "");
+ serviceRequestInputs.put("remote-access-client-id", "");
+ serviceRequestInputs.put("remote-access-topology-id", "");
+ serviceRequestInputs.put("remote-access-node-id", "");
+ serviceRequestInputs.put("remote-access-ltp-id", "");
+ }
+ else {
+ serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id"));
+ serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id"));
+ serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id"));
+ serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id"));
+ serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"));
+ serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"));
+ serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id"));
+ serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id"));
+ serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id"));
+ serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id"));
+ }
+
+ return;
}
public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
for (Object resource : resources) {
Map<String, Object> resourceObject = (Map<String, Object>) resource;
Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
- Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject
- .get("requestInputs");
+ Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
if (entry.getKey().toLowerCase().contains("location")) {
if ("".equals(srcLocation)) {
}
private List<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) {
- Map<String, String> locationSrc = new HashMap<>();
+ Map<String, String> locationSrc = new HashMap<String, String>();
locationSrc.put("location", srcLocation);
- Map<String, String> locationDst = new HashMap<>();
+ Map<String, String> locationDst = new HashMap<String, String>();
locationDst.put("location", dstLocation);
- List<Map<String, String>> locations = new ArrayList<>();
+ List<Map<String, String>> locations = new ArrayList<Map<String, String>>();
locations.add(locationSrc);
locations.add(locationDst);
- List<Object> returnList = new ArrayList<>();
+ List<Object> returnList = new ArrayList<Object>();
String reqContent = getJsonString(locations);
String url = getThirdSPEndPoint();
String responseContent = sendRequest(url, "POST", reqContent);
return returnList;
}
+ @SuppressWarnings("unchecked")
private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) {
for (Object resource : resources) {
Map<String, Object> resourceObject = (Map<String, Object>) resource;
Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
- Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject
- .get("requestInputs");
+ Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
if (entry.getKey().toLowerCase().contains("vpntype")) {
return resourceRequestInputs;
Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
- Map<String, Object> oofQueryObject = new HashMap<>();
+ Map<String, Object> oofQueryObject = new HashMap<String, Object>();
List<Object> resources = (List<Object>) serviceParametersObject.get("resources");
oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id"));
oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id"));
String url = getOOFCalcEndPoint();
String responseContent = sendRequest(url, "POST", oofRequestReq);
- List<Object> returnList = new ArrayList<>();
+ List<Object> returnList = new ArrayList<Object>();
if (null != responseContent) {
returnList = getJsonObject(responseContent, List.class);
}
}
private Map<String, Object> getReturnRoute(List<Object> returnList){
- Map<String, Object> returnRoute = new HashMap<>();
+ Map<String, Object> returnRoute = new HashMap<String,Object>();
for(Object returnVpn :returnList){
Map<String, Object> returnVpnInfo = (Map<String, Object>) returnVpn;
String accessTopoId = (String)returnVpnInfo.get("access-topology-id");
jsonStr = mapper.writeValueAsString(srcObj);
} catch (JsonProcessingException e) {
LOGGER.debug("SdcToscaParserException", e);
- e.printStackTrace();
}
return jsonStr;
}
try {
responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
} catch (ParseException e) {
- e.printStackTrace();
+ LOGGER.debug("ParseException in sendrequest", e);
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.debug("IOException in sendrequest", e);
}
}
if (null != method) {
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_1qctzm0" sourceRef="Task_0uiekmn" targetRef="Task_0raqlqc" />
<bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1m2tm19</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1qctzm0</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
def ddsi = new DoCreateE2EServiceInstance()
</camunda:connector>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1qctzm0</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_13xfsff</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_0bfwj4y</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to Decompose_Service">
<bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming>
<bpmn2:sequenceFlow id="SequenceFlow_1qiiycn" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" />
<bpmn2:sequenceFlow id="SequenceFlow_166w91p" sourceRef="IntermediateCatchEvent_0tv85pg" targetRef="ScriptTask_1cllqk3" />
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_16okck2" name="GoTo StartPrepareResource">
- <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_15d8lqu</bpmn2:incoming>
<bpmn2:linkEventDefinition name="StartPrepareResource" />
</bpmn2:intermediateThrowEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="IntermediateThrowEvent_16okck2" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1tkgqu3" sourceRef="ScriptTask_0q37vn9" targetRef="ScriptTask_08yiqtu" />
<bpmn2:sequenceFlow id="SequenceFlow_0w9t6tc" sourceRef="preProcessRequest_ScriptTask" targetRef="IntermediateThrowEvent_0bq4fxs" />
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0jrb3xu" name="StartService">
<bpmn2:outgoing>SequenceFlow_1i7t9hq</bpmn2:outgoing>
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EPutService" />
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource">
- <bpmn2:outgoing>SequenceFlow_1m2tm19</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing>
<bpmn2:linkEventDefinition name="StartPrepareResource" />
</bpmn2:intermediateCatchEvent>
- <bpmn2:scriptTask id="Task_0ush1g4" name="Process Site Location" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_13xfsff</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0y3i2k7</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi= new DoCreateE2EServiceInstance()
-dcsi.doProcessSiteLocation(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1hbesp9" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" />
<bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResourcesV3">
<bpmn2:extensionElements>
<camunda:in source="nsServiceName" target="nsServiceName" />
<bpmn2:outgoing>SequenceFlow_0d0c20n</bpmn2:outgoing>
</bpmn2:callActivity>
<bpmn2:scriptTask id="ScriptTask_04b21gb" name="PreProcess for Add Resources" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0y3i2k7</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_0p6ba92</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0bf6bzp</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
def csi = new DoCreateE2EServiceInstance()
def csi = new DoCreateE2EServiceInstance()
csi.postProcessForAddResource(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="Task_0ush1g4" />
<bpmn2:sequenceFlow id="SequenceFlow_0bf6bzp" sourceRef="ScriptTask_04b21gb" targetRef="CallActivity_1ojtwas" />
<bpmn2:sequenceFlow id="SequenceFlow_0d0c20n" sourceRef="CallActivity_1ojtwas" targetRef="ScriptTask_1y7jr4t" />
<bpmn2:endEvent id="EndEvent_0hzmoug">
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_0a6vgsu" sourceRef="ScriptTask_1y7jr4t" targetRef="EndEvent_0hzmoug" />
<bpmn2:sequenceFlow id="SequenceFlow_012h7yx" sourceRef="ScriptTask_1o01d7d" targetRef="IntermediateThrowEvent_1mlbhmt" />
- <bpmn2:sequenceFlow id="SequenceFlow_1m2tm19" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" />
- <bpmn2:sequenceFlow id="SequenceFlow_0y3i2k7" sourceRef="Task_0ush1g4" targetRef="ScriptTask_04b21gb" />
+ <bpmn2:scriptTask id="ScriptTask_0dpt36a" name="Process Site Location" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_0bfwj4y</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1e5vxox</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi= new DoCreateE2EServiceInstance()
+dcsi.doProcessSiteLocation(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:scriptTask id="ScriptTask_1a5mdd6" name="Process Link TP Resource Allocation" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1e5vxox</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0p6ba92</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi= new DoCreateE2EServiceInstance()
+dcsi.doTPResourcesAllocation(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1e5vxox" sourceRef="ScriptTask_0dpt36a" targetRef="ScriptTask_1a5mdd6" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0bfwj4y" sourceRef="Task_0raqlqc" targetRef="ScriptTask_0dpt36a" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0p6ba92" sourceRef="ScriptTask_1a5mdd6" targetRef="ScriptTask_04b21gb" />
+ <bpmn2:scriptTask id="ScriptTask_08yiqtu" name="Store ServiceInput to AAI" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1tkgqu3</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_15d8lqu</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def ddsi = new DoCreateE2EServiceInstance()
+ddsi.saveServiceInputToAAI(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_15d8lqu" sourceRef="ScriptTask_08yiqtu" targetRef="IntermediateThrowEvent_16okck2" />
</bpmn2:process>
<bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
<dc:Bounds x="126" y="-229" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0khp0qc_di" bpmnElement="CustomE2EPutService">
- <dc:Bounds x="713" y="54" width="100" height="80" />
+ <dc:Bounds x="478" y="54" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_129ih1g_di" bpmnElement="SequenceFlow_129ih1g">
- <di:waypoint xsi:type="dc:Point" x="813" y="94" />
- <di:waypoint xsi:type="dc:Point" x="941" y="94" />
- <di:waypoint xsi:type="dc:Point" x="941" y="94" />
- <di:waypoint xsi:type="dc:Point" x="1068" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="578" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="713" y="94" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="911" y="94" width="90" height="0" />
+ <dc:Bounds x="600.5" y="79" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true">
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9">
- <dc:Bounds x="1068" y="54" width="100" height="80" />
+ <dc:Bounds x="713" y="54" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0ocetux_di" bpmnElement="ScriptTask_0ocetux">
<dc:Bounds x="246" y="920" width="100" height="80" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qctzm0_di" bpmnElement="SequenceFlow_1qctzm0">
<di:waypoint xsi:type="dc:Point" x="226" y="300" />
- <di:waypoint xsi:type="dc:Point" x="337" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="297" y="300" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="236.5" y="279" width="90" height="12" />
+ <dc:Bounds x="216.5" y="279" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0v81r5h_di" bpmnElement="Task_0uiekmn">
<dc:Bounds x="126" y="260" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_14tnuxf_di" bpmnElement="Task_0raqlqc">
- <dc:Bounds x="337" y="260" width="100" height="80" />
+ <dc:Bounds x="297" y="260" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs">
<dc:Bounds x="1315" y="-207" width="36" height="36" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1tkgqu3_di" bpmnElement="SequenceFlow_1tkgqu3">
- <di:waypoint xsi:type="dc:Point" x="1168" y="94" />
- <di:waypoint xsi:type="dc:Point" x="1242" y="94" />
- <di:waypoint xsi:type="dc:Point" x="1242" y="94" />
- <di:waypoint xsi:type="dc:Point" x="1315" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="813" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="991" y="94" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1257" y="88" width="0" height="12" />
+ <dc:Bounds x="857" y="73" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0w9t6tc_di" bpmnElement="SequenceFlow_0w9t6tc">
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateCatchEvent_0jrb3xu_di" bpmnElement="IntermediateCatchEvent_0jrb3xu">
- <dc:Bounds x="18" y="79" width="36" height="36" />
+ <dc:Bounds x="18" y="76" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="8" y="115" width="60" height="12" />
+ <dc:Bounds x="8" y="112" width="60" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1i7t9hq_di" bpmnElement="SequenceFlow_1i7t9hq">
- <di:waypoint xsi:type="dc:Point" x="54" y="97" />
- <di:waypoint xsi:type="dc:Point" x="528" y="94" />
- <di:waypoint xsi:type="dc:Point" x="646" y="94" />
- <di:waypoint xsi:type="dc:Point" x="646" y="94" />
- <di:waypoint xsi:type="dc:Point" x="713" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="54" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="266" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="266" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="478" y="94" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="542" y="73" width="90" height="12" />
+ <dc:Bounds x="236" y="88" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b">
<dc:Bounds x="-3" y="318" width="82" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4">
- <dc:Bounds x="554" y="260" width="100" height="80" />
- </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1hbesp9_di" bpmnElement="SequenceFlow_1hbesp9">
+ <di:waypoint xsi:type="dc:Point" x="54" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="126" y="300" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="45" y="279" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_1ojtwas_di" bpmnElement="CallActivity_1ojtwas">
<dc:Bounds x="971" y="260" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_04b21gb_di" bpmnElement="ScriptTask_04b21gb">
- <dc:Bounds x="774" y="260" width="100" height="80" />
+ <dc:Bounds x="799" y="260" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1y7jr4t_di" bpmnElement="ScriptTask_1y7jr4t">
<dc:Bounds x="1145" y="260" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_13xfsff_di" bpmnElement="SequenceFlow_13xfsff">
- <di:waypoint xsi:type="dc:Point" x="437" y="300" />
- <di:waypoint xsi:type="dc:Point" x="554" y="300" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="450.5" y="279" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0bf6bzp_di" bpmnElement="SequenceFlow_0bf6bzp">
- <di:waypoint xsi:type="dc:Point" x="874" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="899" y="300" />
<di:waypoint xsi:type="dc:Point" x="971" y="300" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="877.5" y="279" width="90" height="12" />
+ <dc:Bounds x="890" y="279" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0d0c20n_di" bpmnElement="SequenceFlow_0d0c20n">
<dc:Bounds x="1064" y="-61" width="0" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1m2tm19_di" bpmnElement="SequenceFlow_1m2tm19">
- <di:waypoint xsi:type="dc:Point" x="54" y="300" />
- <di:waypoint xsi:type="dc:Point" x="126" y="300" />
+ <bpmndi:BPMNShape id="ScriptTask_0dpt36a_di" bpmnElement="ScriptTask_0dpt36a">
+ <dc:Bounds x="455" y="260" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1a5mdd6_di" bpmnElement="ScriptTask_1a5mdd6">
+ <dc:Bounds x="613" y="260" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1e5vxox_di" bpmnElement="SequenceFlow_1e5vxox">
+ <di:waypoint xsi:type="dc:Point" x="555" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="613" y="300" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="539" y="279" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0bfwj4y_di" bpmnElement="SequenceFlow_0bfwj4y">
+ <di:waypoint xsi:type="dc:Point" x="397" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="455" y="300" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="90" y="278" width="0" height="14" />
+ <dc:Bounds x="426" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0y3i2k7_di" bpmnElement="SequenceFlow_0y3i2k7">
- <di:waypoint xsi:type="dc:Point" x="654" y="300" />
- <di:waypoint xsi:type="dc:Point" x="774" y="300" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0p6ba92_di" bpmnElement="SequenceFlow_0p6ba92">
+ <di:waypoint xsi:type="dc:Point" x="713" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="799" y="300" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="756" y="279" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_08yiqtu_di" bpmnElement="ScriptTask_08yiqtu">
+ <dc:Bounds x="991" y="54" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15d8lqu_di" bpmnElement="SequenceFlow_15d8lqu">
+ <di:waypoint xsi:type="dc:Point" x="1091" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="1315" y="94" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="714" y="278" width="0" height="14" />
+ <dc:Bounds x="1203" y="73" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import java.io.IOException;
import java.nio.file.Files;
}
public String inputStream(String JsonInput)throws IOException{
- JsonInput = "src/test/resources/CamundaClientTest" + JsonInput;
- String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
- return input;
- }
+ JsonInput = "src/test/resources/CamundaClientTest" + JsonInput;
+ String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
+ return input;
+ }
@Test
public void wrapVIDRequestTest() throws IOException{
- CamundaClient testClient = new CamundaClient();
- testClient.setUrl("/mso/async/services/CreateGenericALaCarteServiceInstance");
-
- String requestId = "f7ce78bb-423b-11e7-93f8-0050569a796";
- boolean isBaseVfModule = true;
- int recipeTimeout = 10000;
- String requestAction = "createInstance";
- String serviceInstanceId = "12345679";
- String correlationId = "12345679";
- String vnfId = "234567891";
- String vfModuleId = "345678912";
- String volumeGroupId = "456789123";
- String networkId = "567891234";
- String configurationId = "678912345";
- String serviceType = "testService";
- String vnfType = "testVnf";
- String vfModuleType = "vfModuleType";
- String networkType = "networkType";
- String requestDetails = "{requestDetails: }";
- String apiVersion = "6";
- boolean aLaCarte = true;
- String requestUri = "v7/serviceInstances/assign";
-
- String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId,
- vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType,
- vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "");
- String expected = inputStream("/WrappedVIDRequest.json");
-
- assertEquals(expected, testResult);
+ CamundaClient testClient = new CamundaClient();
+ testClient.setUrl("/mso/async/services/CreateGenericALaCarteServiceInstance");
+
+ String requestId = "f7ce78bb-423b-11e7-93f8-0050569a796";
+ boolean isBaseVfModule = true;
+ int recipeTimeout = 10000;
+ String requestAction = "createInstance";
+ String serviceInstanceId = "12345679";
+ String correlationId = "12345679";
+ String vnfId = "234567891";
+ String vfModuleId = "345678912";
+ String volumeGroupId = "456789123";
+ String networkId = "567891234";
+ String configurationId = "678912345";
+ String serviceType = "testService";
+ String vnfType = "testVnf";
+ String vfModuleType = "vfModuleType";
+ String networkType = "networkType";
+ String requestDetails = "{requestDetails: }";
+ String apiVersion = "6";
+ boolean aLaCarte = true;
+ String requestUri = "v7/serviceInstances/assign";
+
+ String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId,
+ vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType,
+ vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "");
+ String expected = inputStream("/WrappedVIDRequest.json");
+
+ assertEquals(expected, testResult);
}
-
+ @Test
+ public void testPost() throws Exception{
+ CamundaClient testClient = new CamundaClient();
+ String orchestrationURI = "/engine-rest/process-definition/key/dummy/start";
+ MockEnvironment environment = new MockEnvironment();
+
+ environment.setProperty("mso.camundaUR", "yourValue1");
+ testClient.setProps(environment);
+ testClient.setClient(mockHttpClient);
+
+ testClient.setUrl(orchestrationURI);
+
+ String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
+ assertNull(testClient.post(responseBody));
+
+ }
}
"integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=",
"dev": true
},
+ "ngx-spinner": {
+ "version": "6.1.2",
+ "resolved": "https://registry.npmjs.org/ngx-spinner/-/ngx-spinner-6.1.2.tgz",
+ "integrity": "sha512-j/R8T5vKvsLLib1pTxKLYK3GYAFXw5VoUJmaTlcocO6Yi4qIypfhmw9PX9triy7hWVGPu6cUzVs7g9cEG9OYBA==",
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
"no-case": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz",
"bpmn-js": "^2.4.1",
"core-js": "^2.5.4",
"jquery": "^3.3.1",
+ "ngx-spinner": "^6.1.2",
"rxjs": "^6.0.0",
"toastr": "^2.1.4",
"zone.js": "^0.8.26"
import { MatDatepickerModule } from '@angular/material/datepicker';\r
import { MatNativeDateModule } from '@angular/material';\r
import { MatCardModule } from '@angular/material/card';\r
+import { NgxSpinnerModule } from 'ngx-spinner';\r
\r
@NgModule({\r
declarations: [\r
MatInputModule,\r
MatDatepickerModule,\r
MatNativeDateModule,\r
- MatCardModule\r
+ MatCardModule,\r
+ NgxSpinnerModule\r
],\r
providers: [ToastrNotificationService],\r
bootstrap: [AppComponent]\r
</mat-tab-group>\r
</div>\r
</div>\r
+\r
+<ngx-spinner bdColor="rgba(51, 51, 51, 0.8)" size="large" color="#00285f" type="ball-spin-clockwise-fade-rotating"></ngx-spinner>\r
import { MatTabsModule } from '@angular/material/tabs';\r
import { VarInstance } from '../model/variableInstance.model';\r
import { ToastrNotificationService } from '../toastr-notification-service.service';\r
+import { NgxSpinnerService } from 'ngx-spinner';\r
\r
@Component({\r
selector: 'app-details',\r
\r
displayedColumnsVariable = ['name', 'type', 'value'];\r
\r
- constructor(private route: ActivatedRoute, private data: DataService, private popup: ToastrNotificationService, private router: Router) { }\r
+ constructor(private route: ActivatedRoute, private data: DataService, private popup: ToastrNotificationService,\r
+ private router: Router, private spinner: NgxSpinnerService) { }\r
\r
getActInst(procInstId: string) {\r
this.data.getActivityInstance(procInstId).subscribe(\r
}\r
\r
displayCamundaflow(bpmnXml, activities: ACTINST[], r: Router) {\r
+ this.spinner.show();\r
\r
this.bpmnViewer.importXML(bpmnXml, (error) => {\r
if (error) {\r
console.error('Unable to load BPMN flow ', error);\r
this.popup.error('Unable to load BPMN flow ');\r
+ this.spinner.hide();\r
} else {\r
+ this.spinner.hide();\r
let canvas = this.bpmnViewer.get('canvas');\r
var eventBus = this.bpmnViewer.get('eventBus');\r
eventBus.on('element.click', function(e) {\r
if (a.activityId == e.element.id && a.calledProcessInstanceId !== null) {\r
console.log("will drill down to : " + a.calledProcessInstanceId);\r
r.navigate(['/details/' + a.calledProcessInstanceId]);\r
+ this.spinner.show();\r
}\r
});\r
});\r
<input matInput #searchValueRI type="text" [(ngModel)]="searchData.requestId" placeholder="Request Id">\r
</mat-form-field>\r
\r
- <!-- Angular Start Date Picker -->\r
- <mat-form-field class="startDate">\r
- <input matInput #startDate [matDatepicker]="picker" [(ngModel)]="searchData.startDate" placeholder="Choose a start date">\r
- <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>\r
- <mat-datepicker #picker></mat-datepicker>\r
- </mat-form-field>\r
-\r
- <!-- Dropdown box for Start Hour selection -->\r
- <mat-form-field class="selectHour">\r
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartHour" name="hourFrom" placeholder="Select Hour">\r
- <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>\r
- </mat-select>\r
- </mat-form-field>\r
-\r
- <!-- Dropdown box for Start Minute selection -->\r
- <mat-form-field class="selectMinute">\r
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartMinute" name="minuteFrom" placeholder="Select Minute">\r
- <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>\r
- </mat-select>\r
- </mat-form-field>\r
+ <!-- Angular Start Date Picker -->\r
+ <mat-form-field class="startDate">\r
+ <input matInput #startDate [matDatepicker]="picker" [(ngModel)]="searchData.startDate" placeholder="Choose a start date">\r
+ <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>\r
+ <mat-datepicker #picker></mat-datepicker>\r
+ </mat-form-field>\r
+\r
+ <!-- Dropdown box for Start Hour selection -->\r
+ <mat-form-field class="selectHour">\r
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartHour" name="hourFrom" placeholder="Select Hour">\r
+ <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>\r
+ </mat-select>\r
+ </mat-form-field>\r
+\r
+ <!-- Dropdown box for Start Minute selection -->\r
+ <mat-form-field class="selectMinute">\r
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartMinute" name="minuteFrom" placeholder="Select Minute">\r
+ <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>\r
+ </mat-select>\r
+ </mat-form-field>\r
</div>\r
\r
<!-- Dropdown Filter and TextBox for Service Name -->\r
<input matInput #searchValueSN type="text" [(ngModel)]="searchData.serviceInstanceName" placeholder="Service Name">\r
</mat-form-field>\r
\r
- <!-- Angular End Date Picker -->\r
- <mat-form-field class="endDate">\r
- <input matInput #endDate [matDatepicker]="endpicker" [(ngModel)]="searchData.endDate" placeholder="Choose an end date">\r
- <mat-datepicker-toggle matSuffix [for]="endpicker"></mat-datepicker-toggle>\r
- <mat-datepicker #endpicker></mat-datepicker>\r
- </mat-form-field>\r
-\r
- <!-- Dropdown box for End Hour selection -->\r
- <mat-form-field class="selectHour">\r
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndHour" name="hourTo" placeholder="Select Hour">\r
- <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>\r
- </mat-select>\r
- </mat-form-field>\r
-\r
- <!-- Dropdown box for End Minute selection -->\r
- <mat-form-field class="selectMinute">\r
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndMinute" name="minuteTo" placeholder="Select Minute">\r
- <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>\r
- </mat-select>\r
- </mat-form-field>\r
+ <!-- Angular End Date Picker -->\r
+ <mat-form-field class="endDate">\r
+ <input matInput #endDate [matDatepicker]="endpicker" [(ngModel)]="searchData.endDate" placeholder="Choose an end date">\r
+ <mat-datepicker-toggle matSuffix [for]="endpicker"></mat-datepicker-toggle>\r
+ <mat-datepicker #endpicker></mat-datepicker>\r
+ </mat-form-field>\r
+\r
+ <!-- Dropdown box for End Hour selection -->\r
+ <mat-form-field class="selectHour">\r
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndHour" name="hourTo" placeholder="Select Hour">\r
+ <mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>\r
+ </mat-select>\r
+ </mat-form-field>\r
+\r
+ <!-- Dropdown box for End Minute selection -->\r
+ <mat-form-field class="selectMinute">\r
+ <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndMinute" name="minuteTo" placeholder="Select Minute">\r
+ <mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>\r
+ </mat-select>\r
+ </mat-form-field>\r
</div>\r
\r
<!-- Dropdown Filter for Status -->\r
\r
<mat-tab label="Service Statistics">\r
<div id="servStats">\r
- <p>Total: {{ totalVal }}</p>\r
- <hr/>\r
- <p>Complete: {{ completeVal }}</p>\r
- <p><b> {{ percentageComplete }}%</b></p>\r
- <hr/>\r
- <p>Failed: {{ failedVal }}</p>\r
- <p><b> {{ percentageFailed }}%</b></p>\r
- <hr/>\r
- <p>In Progress: {{ inProgressVal }}</p>\r
- <hr/>\r
- <p>Pending: {{ pendingVal }}</p>\r
- <hr/>\r
- <p>Unlocked: {{ unlockedVal }}</p>\r
+ <table class="statsTable">\r
+ <tbody>\r
+ <tr>\r
+ <td>Total: {{ totalVal }}</td>\r
+ <td></td>\r
+ </tr>\r
+ <tr>\r
+ <td>Complete: {{ completeVal }}</td>\r
+ <td> {{ percentageComplete }}%</td>\r
+ </tr>\r
+ <tr>\r
+ <td>Failed: {{ failedVal }}</td>\r
+ <td> {{ percentageFailed }}%</td>\r
+ </tr>\r
+ <tr>\r
+ <td>In Progress: {{ inProgressVal }}</td>\r
+ <td> {{ percentageInProg }}%</td>\r
+ </tr>\r
+ <tr>\r
+ <td>Pending: {{ pendingVal }}</td>\r
+ <td> {{ percentagePending }}%</td>\r
+ </tr>\r
+ <tr>\r
+ <td>Unlocked: {{ unlockedVal }}</td>\r
+ <td> {{ percentageUnlocked }}%</td>\r
+ </tr>\r
+ </tbody>\r
+ </table>\r
</div>\r
</mat-tab>\r
</mat-tab-group>\r
</div>\r
</div>\r
\r
+<ngx-spinner bdColor="rgba(51, 51, 51, 0.8)" size="large" color="#00285f" type="ball-spin-clockwise-fade-rotating"></ngx-spinner>\r
<router-outlet></router-outlet>\r
\r
@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com\r
*/\r
-\r
@import "~@angular/material/prebuilt-themes/indigo-pink.css";\r
\r
.searchArea {\r
}\r
\r
.fa {\r
- float: left;\r
+ float: left;\r
width: 120px;\r
padding: 10px;\r
background: #2196F3;\r
display: inline-flex;\r
}\r
\r
-.startDate, .endDate{\r
+.endDate,\r
+.startDate {\r
margin-left: 90px;\r
width: 140px;\r
}\r
\r
-.selectHour, .selectMinute{\r
+.selectHour,\r
+.selectMinute {\r
margin-left: 30px;\r
- width: 100px\r
+ width: 100px;\r
}\r
\r
-#servStats{\r
+#servStats {\r
background-color: white;\r
padding: 10px;\r
font-size: 17px;\r
font-family: 'Montserrat', sans-serif;\r
}\r
\r
-hr {\r
- display: block;\r
- height: 1px;\r
- border: 0;\r
- border-top: 1px solid #ccc;\r
- margin: 1em 0;\r
- padding: 0;\r
+.statsTable {\r
+ td {\r
+ padding: 12px 80px 12px 12px;\r
+ text-align: left;\r
+ border-bottom: 1px solid #ccc;\r
+ }\r
}\r
import { MatDatepickerModule } from '@angular/material/datepicker';
import { FormControl } from '@angular/forms';
import { SearchRequest } from '../model/SearchRequest.model';
-import { ViewChild } from '@angular/core';
import { ElementRef } from '@angular/core';
import { Input } from '@angular/core';
+import { NgxSpinnerService } from 'ngx-spinner';
@Component({
selector: 'app-home',
unlockedVal = 0;
percentageComplete = 0;
percentageFailed = 0;
+ percentageInProg = 0;
+ percentagePending = 0;
+ percentageUnlocked = 0;
options = [{ name: "EQUAL", value: "EQ" }, { name: "NOT EQUAL", value: "NEQ" }, { name: "LIKE", value: "LIKE" }];
statusOptions = [{ name: "ALL", value: "ALL" }, { name: "COMPLETE", value: "COMPLETE" }, { name: "IN_PROGRESS", value: "IN_PROGRESS" },
displayedColumns = ['requestId', 'serviceInstanceId', 'serviceIstanceName', 'networkId', 'requestStatus', 'serviceType', 'startTime', 'endTime'];
constructor(private route: ActivatedRoute, private data: DataService,
- private router: Router, private popup: ToastrNotificationService) {
+ private router: Router, private popup: ToastrNotificationService,
+ private spinner: NgxSpinnerService) {
this.searchData = new SearchData();
}
makeCall() {
+ this.spinner.show();
+
var search = this.searchData.getSearchRequest().subscribe((result: SearchRequest) => {
this.data.retrieveInstance(result.getFilters(), result.getStartTimeInMilliseconds(), result.getEndTimeInMilliseconds())
.subscribe((data: Process[]) => {
+ this.spinner.hide();
this.processData = data;
- this.popup.info("Number of records found: " + data.length);
+ this.popup.info("Number of records found: " + data.length)
+
// Calculate Statistics for Service Statistics tab
this.completeVal = this.processData.filter(i => i.requestStatus === "COMPLETE").length;
this.inProgressVal = this.processData.filter(i => i.requestStatus === "IN_PROGRESS").length;
this.pendingVal = this.processData.filter(i => i.requestStatus === "PENDING").length;
this.unlockedVal = this.processData.filter(i => i.requestStatus === "UNLOCKED").length;
this.totalVal = this.processData.length;
- this.percentageComplete = Math.round(((this.completeVal / this.totalVal) * 100) * 100) / 100;
- this.percentageFailed = Math.round(((this.failedVal / this.totalVal) * 100) * 100) / 100;
+ // Calculate percentages to 2 decimal places and compare to 0 to avoid NaN error
+ if (this.totalVal != 0) {
+ this.percentageComplete = Math.round(((this.completeVal / this.totalVal) * 100) * 100) / 100;
+ this.percentageFailed = Math.round(((this.failedVal / this.totalVal) * 100) * 100) / 100;
+ this.percentageInProg = Math.round(((this.inProgressVal / this.totalVal) * 100) * 100) / 100;
+ this.percentagePending = Math.round(((this.pendingVal / this.totalVal) * 100) * 100) / 100;
+ this.percentageUnlocked = Math.round(((this.unlockedVal / this.totalVal) * 100) * 100) / 100;
+ }
console.log("COMPLETE: " + this.completeVal);
console.log("FAILED: " + this.failedVal);
}, error => {
console.log(error);
this.popup.error("Unable to perform search Error code:" + error.status);
+ this.spinner.hide();
});
}, error => {
console.log("Data validation error " + error);
this.popup.error(error);
+ this.spinner.hide();
});
}
getProcessIsntanceId(requestId: string) {
+ this.spinner.show();
+
var response = this.data.getProcessInstanceId(requestId).subscribe((data) => {
if (data.status == 200) {
+ this.spinner.hide();
var processInstanceId = (data.body as ProcessInstanceId).processInstanceId;
this.router.navigate(['/details/' + processInstanceId]);
} else {
this.popup.error('No process instance id found: ' + requestId);
+ this.spinner.hide();
console.log('No process instance id found: ' + requestId);
}
});