aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java40
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy35
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java14
5 files changed, 60 insertions, 33 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
index 5be6970554..7d6aed4785 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java
@@ -24,6 +24,10 @@ import java.util.Map;
import org.openecomp.mso.db.catalog.beans.Recipe;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
/**
* serivce csar query support
* <br>
@@ -41,16 +45,6 @@ public class QueryResourceRecipe extends CatalogQuery{
this.resourceRecipe =resourceRecipe;
}
- private final String template =
- "\t{\n"+
- "\t\t\"id\" : <ID>,\n"+
- "\t\t\"action\" : <ACTION>,\n"+
- "\t\t\"orchestrationUri\" : <ORCHESTRATION_URI>,\n"+
- "\t\t\"recipeTimeout\" : <RECIPE_TIMEOUT>,\n"+
- "\t\t\"paramXSD\" : <PARAM_XSD>,\n"+
- "\t\t\"description\" : <DESCRIPTION>\n"+
- "\t}";
-
@Override
public String toString() {
@@ -58,15 +52,25 @@ public class QueryResourceRecipe extends CatalogQuery{
}
@Override
- public String JSON2(boolean isArray, boolean isEmbed) {
+ public String JSON2(boolean isArray, boolean isEmbed) {
+
Map<String, String> valueMap = new HashMap<>();
- put(valueMap, "ID", null == resourceRecipe ? null : resourceRecipe.getId());
- put(valueMap, "ACTION", null == resourceRecipe ? null : resourceRecipe.getAction());
- put(valueMap, "ORCHESTRATION_URI", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri());
- put(valueMap, "RECIPE_TIMEOUT", null == resourceRecipe ? null : resourceRecipe.getRecipeTimeout());
- put(valueMap, "PARAM_XSD", null == resourceRecipe ? null : resourceRecipe.getParamXSD());
- put(valueMap, "DESCRIPTION", null == resourceRecipe ? null : resourceRecipe.getDescription());
- return this.setTemplate(template, valueMap);
+ valueMap.put("id", null == resourceRecipe ? null :String.valueOf(resourceRecipe.getId()));
+ valueMap.put("action", null == resourceRecipe ? null :resourceRecipe.getAction());
+ valueMap.put("orchestrationUri", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri());
+ valueMap.put("recipeTimeout", null == resourceRecipe ? null : String.valueOf(resourceRecipe.getRecipeTimeout()));
+ valueMap.put("paramXSD", null == resourceRecipe ? null : resourceRecipe.getParamXSD());
+ valueMap.put("description", null == resourceRecipe ? null : resourceRecipe.getDescription());
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ String jsonStr = "";
+ try {
+ jsonStr = mapper.writeValueAsString(valueMap);
+ } catch(JsonProcessingException e) {
+
+ e.printStackTrace();
+ }
+ return jsonStr;
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java
index 636b8b5fc6..7c3ea37817 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java
@@ -22,6 +22,7 @@ package org.openecomp.mso.bpmn.common.resource;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -122,7 +123,6 @@ public class ResourceRequestBuilder {
throws SdcToscaParserException {
Map<String, Object> resouceRequest = new HashMap<>();
-
String csarpath = null;
try {
csarpath = getCsarFromUuid(serviceUuid);
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index 5eda2cc145..ede76c0fd2 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -18,7 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.bpmn.infrastructure.scripts;
+package org.openecomp.mso.bpmn.infrastructure.scripts
+
+import org.json.JSONObject
+import org.json.XML;
import static org.apache.commons.lang3.StringUtils.*;
import groovy.xml.XmlUtil
@@ -117,7 +120,23 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
-
+
+ String customizeResourceParam(String netowrkInputParametersJson) {
+ List<Map<String, Object>> paramList = new ArrayList();
+ JSONObject jsonObject = new JSONObject(netowrkInputParametersJson);
+ Iterator iterator = jsonObject.keys();
+ while (iterator.hasNext()) {
+ String key = iterator.next();
+ HashMap<String, String> hashMap = new HashMap();
+ hashMap.put("name", key);
+ hashMap.put("value", jsonObject.get(key))
+ paramList.add(hashMap)
+ }
+ Map<String, List<Map<String, Object>>> paramMap = new HashMap();
+ paramMap.put("param", paramList);
+
+ return new JSONObject(paramMap).toString();
+ }
/**
* Pre Process the BPMN Flow Request
@@ -144,8 +163,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String serviceType = resourceInputObj.getServiceType()
String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid()
- String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelName()
- String serviceModelName = resourceInputObj.getServiceModelInfo().getModelVersion()
+ String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion()
+ String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName()
String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid();
String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
@@ -155,7 +174,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String resourceInputPrameters = resourceInputObj.getResourceParameters()
String netowrkInputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs")
//here convert json string to xml string
- String netowrkInputParameters = jsonUtil.json2xml(netowrkInputParametersJson)
+ String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(netowrkInputParametersJson)))
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
String sndcTopologyCreateRequest =
"""<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
@@ -179,14 +198,14 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${sdnc_service_id}</service-id>
+ <service-id>${serviceInstanceId}</service-id>
<subscription-service-type>${serviceType}</subscription-service-type>
- <ecomp-model-information>
+ <onap-model-information>
<model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid>
<model-uuid>${serviceModelUuid}</model-uuid>
<model-version>${serviceModelVersion}</model-version>
<model-name>${serviceModelName}</model-name>
- </ecomp-model-information>
+ </onap-model-information>
<service-instance-id>${serviceInstanceId}</service-instance-id>
<global-customer-id>${globalCustomerId}</global-customer-id>
</service-information>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
index ca32420b73..9f3910beed 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
@@ -80,6 +80,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
//deal with operation key
String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId")
utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
+ //set local globalSubscriberId variable
+ execution.setVariable("globalSubscriberId", globalSubscriberId);
String serviceType = execution.getVariable("serviceType")
utils.log("INFO", "serviceType:" + serviceType, 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 0aeb0c6310..25141a0c40 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
@@ -84,13 +84,14 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
private void updateResOperStatus(ResourceOperationStatus resourceOperationStatus) throws RouteException {
logger.info("AbstractSdncOperationTask.updateResOperStatus begin!");
- String url = "http://mso:8080/dbadapters/RequestsDbAdapter";
- HttpPost httpPost = new HttpPost(url);
+ Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+ String requestsdbEndPoint = properties.get("mso.adapters.openecomp.db.endpoint");
+ HttpPost httpPost = new HttpPost(requestsdbEndPoint);
httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
String postBody = getPostStringBody(resourceOperationStatus);
httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML));
- httpPost(url, httpPost);
+ httpPost(requestsdbEndPoint, httpPost);
logger.info("AbstractSdncOperationTask.updateResOperStatus end!");
}
@@ -165,13 +166,14 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
private ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) throws RouteException {
logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!");
- String url = "http://mso:8080/dbadapters/RequestsDbAdapter";
- HttpPost httpPost = new HttpPost(url);
+ Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+ String requestsdbEndPoint = properties.get("mso.adapters.openecomp.db.endpoint");
+ HttpPost httpPost = new HttpPost(requestsdbEndPoint);
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);
+ String result = httpPost(requestsdbEndPoint, httpPost);
ResourceOperationStatus resourceOperationStatus = getResourceOperationStatusFromXmlString(result);
logger.info("AbstractSdncOperationTask.getResourceOperationStatus end!");
return resourceOperationStatus;