fixed double encoding issue 65/63265/1
authorBenjamin, Max (mb388a) <mb388a@us.att.com>
Tue, 28 Aug 2018 13:52:58 +0000 (09:52 -0400)
committerBenjamin, Max (mb388a) <mb388a@us.att.com>
Tue, 28 Aug 2018 13:53:11 +0000 (09:53 -0400)
Changed the way customer and serviceType are extracted to prevent
double encoding.

Change-Id: I409da51a10ec38623b321985e25b5390ff4fa5d6
Issue-ID: SO-923
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy

index 7fa8b44..808bbc1 100644 (file)
@@ -259,6 +259,9 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
                        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
 
                        if(resourceClient.exists(uri)){
+                               Map<String, String> keys = uri.getURIKeys()
+                               execution.setVariable("globalCustomer", keys.get("global-customer-id"))
+                               execution.setVariable("serviceType", keys.get("service-type"))
                                execution.setVariable("GENGS_siResourceLink", uri.build().toString())
 
                        }else{
@@ -307,14 +310,9 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
 
                        //Get Service Instance Info
                        String serviceInstanceId = getVariableEnforced(execution, "DoCVNF_serviceInstanceId")
-                       String siRelatedLink = getVariableEnforced(execution, "GENGS_siResourceLink")
-
-                       int custStart = siRelatedLink.indexOf("customer/")
-                       int custEnd = siRelatedLink.indexOf("/service-subscriptions")
-                       String globalCustId = siRelatedLink.substring(custStart + 9, custEnd)
-                       int serviceStart = siRelatedLink.indexOf("service-subscription/")
-                       int serviceEnd = siRelatedLink.indexOf("/service-instances/")
-                       String serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd)
+
+                       String globalCustId = execution.getVariable("global-customer-id")
+                       String serviceType = execution.getVariable("service-type")
 
                        Map<String, String> payload = new LinkedHashMap<>();
                        payload.put("vnf-id", vnfId);