aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorYulian Han <elaine.hanyulian@huawei.com>2018-11-24 16:53:35 +0800
committerYulian Han <elaine.hanyulian@huawei.com>2018-11-24 16:53:35 +0800
commit12c81872093919e10734abacf06d24e5e1df3a2c (patch)
tree4f0c0dc13ef24ee7b3999ad441d820bf1387a28a /bpmn
parent01e8d25e3f0cb7b8f7e118761dff403be4e54502 (diff)
use config value instead hard code of url
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064411 Issue-ID: SO-1249 Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy31
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy5
2 files changed, 25 insertions, 11 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
index dabd3517c3..44ee91885f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
@@ -31,6 +31,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.onap.so.bpmn.core.UrnPropertiesReader
import groovy.json.*
import javax.ws.rs.core.Response
@@ -43,11 +44,10 @@ import org.onap.so.utils.TargetEntity
public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVFCNSResource.class);
+// String vfcUrl = "/vfc/rest/v1/vfcadapter"
- String vfcUrl = "/vfc/rest/v1/vfcadapter"
-
- String host = "http://mso.mso.testlab.openecomp.org:8080"
-
+// String host = "http://mso.mso.testlab.openecomp.org:8080"
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -116,6 +116,18 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
execution.setVariable("nsParameters", nsParameters)
execution.setVariable("nsServiceModelUUID", nsServiceModelUUID);
+ String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
+
+ if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
+ msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
+ msoLogger.debug(msg)
+ }
+
+ while (vfcAdapterUrl.endsWith('/')) {
+ vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1)
+ }
+
+ execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
} catch (BpmnError e) {
throw e;
@@ -132,6 +144,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void createNetworkService(DelegateExecution execution) {
msoLogger.trace("createNetworkService ")
+ String vfcAdapterUrl = execution.setVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID");
String nsParameters = execution.getVariable("nsParameters");
@@ -149,7 +162,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
"additionalParamForNs":${requestInputs}
}
}"""
- Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody)
+ Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
String nsInstanceId = "";
@@ -165,6 +178,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void instantiateNetworkService(DelegateExecution execution) {
msoLogger.trace("instantiateNetworkService ")
+ String vfcAdapterUrl = execution.setVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
String nsServiceName = execution.getVariable("nsServiceName")
@@ -176,7 +190,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
"nsParameters":${nsParameters}
}"""
String nsInstanceId = execution.getVariable("nsInstanceId")
- String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate"
+ String url = vfcAdapterUrl + "/ns/" +nsInstanceId + "/instantiate"
Response apiResponse = postRequest(execution, url, reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -193,9 +207,10 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void queryNSProgress(DelegateExecution execution) {
msoLogger.trace("queryNSProgress ")
+ String vfcAdapterUrl = execution.setVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
- String url = host + vfcUrl + "/jobs/" + jobId
+ String url = vfcAdapterUrl + "/jobs/" + jobId
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -251,7 +266,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
private Response postRequest(DelegateExecution execution, String urlString, String requestBody){
msoLogger.trace("Started Execute VFC adapter Post Process ")
- msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody)
+ msoLogger.info("url:" + urlString +"\nrequestBody:"+ requestBody)
Response apiResponse = null
try{
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 61c88dbb03..f6e4fcc2ba 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -263,15 +263,14 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceModelUUID, requestAction)
if (resourceRecipe != null) {
- String recipeURL = BPMNProperties.getProperty("bpelURL", "http://bpmn-infra:8081") + resourceRecipe.getString("orchestrationUri")
+ String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + resourceRecipe.getString("orchestrationUri")
int recipeTimeOut = resourceRecipe.getInt("recipeTimeout")
String recipeParamXsd = resourceRecipe.get("paramXSD")
BpmnRestClient bpmnRestClient = new BpmnRestClient()
HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd)
} else {
- String exceptionMessage = "Resource receipe is not found for resource modeluuid: " +
- resourceInput.getResourceModelInfo().getModelUuid()
+ String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceModelUUID
msoLogger.trace(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage)
}