Update OofHoming w/ directives 07/68307/1
authorMarcus G K Williams <marcus.williams@intel.com>
Fri, 21 Sep 2018 00:46:07 +0000 (17:46 -0700)
committerMarcus G K Williams <marcus.williams@intel.com>
Fri, 21 Sep 2018 00:47:41 +0000 (17:47 -0700)
Issue-ID: SO-746
Change-Id: I597f7621a32eeb5b8e92cf80700c60bccdc5e560
Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java [deleted file]
bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy

index 35e68bb..70f9167 100644 (file)
@@ -24,8 +24,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
 
 import org.onap.so.bpmn.common.scripts.AaiUtil
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
-import org.onap.so.bpmn.core.domain.CloudFlavor
+
 import org.onap.so.bpmn.core.domain.InventoryType
 import org.onap.so.bpmn.core.domain.Resource
 import org.onap.so.bpmn.core.domain.ResourceType
@@ -33,7 +32,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
 import org.onap.so.bpmn.core.domain.Subscriber
 import org.onap.so.bpmn.core.domain.VnfResource
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
+import org.onap.so.db.catalog.beans.CloudIdentity
+import org.onap.so.db.catalog.beans.CloudSite
 import org.onap.so.rest.APIResponse
 import org.onap.so.rest.RESTClient
 import org.onap.so.rest.RESTConfig
@@ -52,7 +52,6 @@ import static org.onap.so.bpmn.common.scripts.GenericUtils.*
  */
 class OofHoming extends AbstractServiceTaskProcessor {
 
-       private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofHoming.class);
     ExceptionUtil exceptionUtil = new ExceptionUtil()
     JsonUtils jsonUtil = new JsonUtils()
     OofUtils oofUtils = new OofUtils(this)
@@ -114,10 +113,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
                 def authHeader = ""
                 String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
                 String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
-                               
 
-                               
-                               
                 String basicAuthValue = utils.encrypt(basicAuth, msokey)
                 if (basicAuthValue != null) {
                     utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue,
@@ -156,8 +152,8 @@ class OofHoming extends AbstractServiceTaskProcessor {
                 execution.setVariable("oofRequest", oofRequest)
                 utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled)
 
-                String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution);
-                String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution)
+                String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution)
+                String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution)
                 String url = host + endpoint
                 utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled)
 
@@ -240,30 +236,12 @@ class OofHoming extends AbstractServiceTaskProcessor {
                             }
                             resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
 
-                            // TODO Deal with Placement Solutions & Assignment Info here
                             JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
-                            Integer arrayIndex = 0
-                            Integer flavorsIndex = null
-                            Boolean foundFlavors = false
-                            String flavors = null
-                            Map<String, String> flavorsMap = null
-                            ArrayList<CloudFlavor> flavorsArrayList = new ArrayList<CloudFlavor>()
+                            String oofDirectives = null
                             assignmentArr.each { element ->
                                 JSONObject jsonObject = new JSONObject(element.toString())
-                                if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "flavors") {
-                                    flavors = jsonUtil.getJsonRawValue(jsonObject.toString(), "value")
-                                    foundFlavors = true
-                                    flavorsIndex = arrayIndex
-                                } else {
-                                    arrayIndex += 1
-                                }
-                            }
-                            if (foundFlavors) {
-                                assignmentArr.remove(flavorsIndex)
-                                flavorsMap = jsonUtil.jsonStringToMap(execution, flavors.toString())
-                                flavorsMap.each { label, flavor ->
-                                    CloudFlavor cloudFlavor = new CloudFlavor(label, flavor)
-                                    flavorsArrayList.add(cloudFlavor)
+                                if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "oof_directives") {
+                                    oofDirectives = jsonUtil.getJsonRawValue(jsonObject.toString(), "value")
                                 }
                             }
                             Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution,
@@ -272,10 +250,26 @@ class OofHoming extends AbstractServiceTaskProcessor {
                             String cloudRegionId = assignmentMap.get("locationId")
                             resource.getHomingSolution().setCloudOwner(cloudOwner)
                             resource.getHomingSolution().setCloudRegionId(cloudRegionId)
-                            if (flavorsArrayList != null && flavorsArrayList.size != 0) {
-                                resource.getHomingSolution().setFlavors(flavorsArrayList)
-                                execution.setVariable(cloudRegionId + "_flavorList", flavorsArrayList)
-                                utils.log("DEBUG", "***** _flavorList is: " + flavorsArrayList.toString() +
+
+                            CloudSite cloudSite = new CloudSite();
+                            cloudSite.setId(cloudRegionId)
+                            cloudSite.setRegionId(cloudRegionId)
+                            String orchestrator = execution.getVariable("orchestrator")
+                            if ((orchestrator != null) || (orchestrator != "")) {
+                                cloudSite.setOrchestrator(orchestrator)
+                            }
+
+                            CloudIdentity cloudIdentity = new CloudIdentity();
+                            cloudIdentity.setId(cloudRegionId);
+                            cloudIdentity.setIdentityUrl("/api/multicloud /v1/" + cloudOwner + "/" + cloudRegionId + "/infra_workload")
+                            cloudSite.setIdentityService(cloudIdentity);
+
+                            // Set cloudsite in catalog DB here
+                            oofUtils.createCloudSiteCatalogDb(cloudSite)
+
+                            if (oofDirectives != null && oofDirectives != "") {
+                                resource.getHomingSolution().setOofDirectives(oofDirectives)
+                                utils.log("DEBUG", "***** OofDirectives is: " + oofDirectives +
                                         " *****", "true")
                             }
 
index 8ce6338..d957959 100644 (file)
@@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.domain.HomingSolution
 import org.onap.so.bpmn.core.domain.ModelInfo
 import org.onap.so.bpmn.core.domain.Resource
@@ -33,22 +33,32 @@ import org.onap.so.bpmn.core.domain.ServiceInstance
 import org.onap.so.bpmn.core.domain.Subscriber
 import org.onap.so.bpmn.core.domain.VnfResource
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
-
-import java.lang.reflect.Array
+import org.onap.so.db.catalog.beans.CloudSite
+import org.onap.so.rest.APIResponse
+import org.onap.so.rest.RESTClient
+import org.onap.so.rest.RESTConfig
+import org.springframework.http.HttpEntity
+import org.springframework.http.HttpHeaders
+import org.springframework.http.HttpMethod
+import org.springframework.http.ResponseEntity
+import org.springframework.http.client.BufferingClientHttpRequestFactory
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory
+import org.springframework.web.client.RestTemplate
+import org.springframework.web.util.UriComponentsBuilder
+
+import javax.ws.rs.core.MediaType
+import javax.ws.rs.core.Response
+import javax.xml.ws.http.HTTPException
 
 import static org.onap.so.bpmn.common.scripts.GenericUtils.*
 
 class OofUtils {
-       private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofUtils.class);
     ExceptionUtil exceptionUtil = new ExceptionUtil()
     JsonUtils jsonUtil = new JsonUtils()
 
     private AbstractServiceTaskProcessor utils
 
-    public MsoUtils msoUtils = new MsoUtils()
-
-    public OofUtils(AbstractServiceTaskProcessor taskProcessor) {
+    OofUtils(AbstractServiceTaskProcessor taskProcessor) {
         this.utils = taskProcessor
     }
 
@@ -466,4 +476,39 @@ class OofUtils {
         if (candidatesJson != "") {candidatesJson = candidatesJson.substring(0, candidatesJson.length() - 1)}
         return candidatesJson
     }
+    /**
+     * This method creates a cloudsite in catalog database.
+     *
+     * @param CloudSite cloudSite
+     *
+     * @return void
+     */
+    Void createCloudSiteCatalogDb(CloudSite cloudSite, DelegateExecution execution) {
+
+        String endpoint = UrnPropertiesReader.getVariable("mso.catalog.db.spring.endpoint", execution)
+        String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution)
+        String uri = "/cloudSite"
+
+        HttpHeaders headers = new HttpHeaders()
+
+        headers.set(HttpHeaders.AUTHORIZATION, auth)
+        headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON)
+        headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+
+        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(endpoint + uri)
+        HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers)
+        RESTConfig config = new RESTConfig(endpoint + uri)
+        RESTClient client = new RESTClient(config).addAuthorizationHeader(auth).
+                addHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+        APIResponse response = client.httpPost(request.getBody().toString())
+
+        int responseCode = response.getStatusCode()
+        logDebug("CatalogDB response code is: " + responseCode, isDebugEnabled)
+        String syncResponse = response.getResponseBodyAsString()
+        logDebug("CatalogDB response is: " + syncResponse, isDebugEnabled)
+
+        if(responseCode != 202){
+            exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.")
+        }
+    }
 }
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java
deleted file mode 100644 (file)
index 7160a2f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. 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.onap.so.bpmn.core.domain;
-
-import java.io.Serializable;
-
-/**
- * Stores Cloud Flavor information and is an attribute
- * of a <class>HomingSolution</class>
- *
- */
-public class CloudFlavor extends JsonWrapper implements Serializable {
-
-       private static final long serialVersionUID = 8423934332773299577L;
-       private String flavorLabel;
-    private String flavor;
-
-    public CloudFlavor (String flavorLabel, String flavor){
-        this.flavorLabel = flavorLabel;
-        this.flavor = flavor;
-    }
-
-    public String getFlavorLabel() {
-        return flavorLabel;
-    }
-
-    public void setFlavorLabel(String flavorLabel) {
-        this.flavorLabel = flavorLabel;
-    }
-
-    public String getFlavor() {
-        return flavor;
-    }
-
-    public void setFlavor(String flavor) {
-        this.flavor = flavor;
-    }
-
-}
index 57e6864..e4eb01e 100644 (file)
@@ -45,7 +45,7 @@ public class HomingSolution extends JsonWrapper implements Serializable  {
        private String aicVersion;
        private String tenant;
        private VnfResource vnf;
-       private List<CloudFlavor> flavors;
+       private String oofDirectives;
        private License license = new License();
 
 
@@ -130,12 +130,12 @@ public class HomingSolution extends JsonWrapper implements Serializable  {
        /**
         * @return a map<string, string> key is label name, value is any flavor
         */
-       public List<CloudFlavor> getFlavors() {
-               return flavors;
+       public String getOofDirectives() {
+               return oofDirectives;
        }
 
-       public void setFlavors(List<CloudFlavor> flavors) {
-               this.flavors = flavors;
+       public void setOofDirectives(String oofDirectives) {
+               this.oofDirectives = oofDirectives;
        }
 
        public License getLicense() {
index 9bcc559..d2dbde4 100644 (file)
@@ -38,7 +38,6 @@ import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
 import org.onap.so.bpmn.core.WorkflowException;
 import org.onap.so.bpmn.core.domain.AllottedResource;
-import org.onap.so.bpmn.core.domain.CloudFlavor;
 import org.onap.so.bpmn.core.domain.HomingSolution;
 import org.onap.so.bpmn.core.domain.ModelInfo;
 import org.onap.so.bpmn.core.domain.NetworkResource;
@@ -122,12 +121,133 @@ public class OofHomingIT extends BaseIntegrationTest {
         VnfResource vnf = new VnfResource();
         vnf.setResourceId("testResourceIdVNF");
         vnf.setNfFunction("testVnfFunctionName");
-        ArrayList<CloudFlavor> flavors = new ArrayList<>();
-        CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
-        CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
-        flavors.add(flavor1);
-        flavors.add(flavor2);
-        vnf.getHomingSolution().setFlavors(flavors);
+        vnf.getHomingSolution().setOofDirectives(
+                "{ \n" +
+                        "      \"directives\":[ \n" +
+                        "         { \n" +
+                        "            \"vnfc_directives\":[ \n" +
+                        "               { \n" +
+                        "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
+                        "                  \"directives\":[ \n" +
+                        "                     { \n" +
+                        "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+                        "                        \"attributes\":[ \n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+                        "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+                        "                           }\n" +
+                        "                        ]\n" +
+                        "                     },\n" +
+                        "                     { \n" +
+                        "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+                        "                        \"attributes\":[ \n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+                        "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
+                        "                           },\n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+                        "                              \"attribute_value\":\"<value such as physnet>\"\n" +
+                        "                           }\n" +
+                        "                        ]\n" +
+                        "                     }\n" +
+                        "                  ]\n" +
+                        "               }\n" +
+                        "            ]\n" +
+                        "         },\n" +
+                        "         { \n" +
+                        "            \"vnf_directives\":{ \n" +
+                        "               \"directives\":[ \n" +
+                        "                  { \n" +
+                        "                     \"directive_name\":\"<Name of directive>\",\n" +
+                        "                     \"attributes\":[ \n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value>\"\n" +
+                        "                        }\n" +
+                        "                     ]\n" +
+                        "                  },\n" +
+                        "                  { \n" +
+                        "                     \"directive_name\":\"<Name of directive>\",\n" +
+                        "                     \"attributes\":[ \n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value >\"\n" +
+                        "                        },\n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value >\"\n" +
+                        "                        }\n" +
+                        "                     ]\n" +
+                        "                  }\n" +
+                        "               ]\n" +
+                        "            }\n" +
+                        "         }\n" +
+                        "      ]\n" +
+                        "   },\n" +
+                        "   \"sdnc_directives\":{ \n" +
+                        "      \"directives\":[ \n" +
+                        "         { \n" +
+                        "            \"vnfc_directives\":[ \n" +
+                        "               { \n" +
+                        "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
+                        "                  \"directives\":[ \n" +
+                        "                     { \n" +
+                        "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+                        "                        \"attributes\":[ \n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+                        "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+                        "                           }\n" +
+                        "                        ]\n" +
+                        "                     },\n" +
+                        "                     { \n" +
+                        "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+                        "                        \"attributes\":[ \n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+                        "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
+                        "                           },\n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+                        "                              \"attribute_value\":\"<value such as physnet>\"\n" +
+                        "                           }\n" +
+                        "                        ]\n" +
+                        "                     }\n" +
+                        "                  ]\n" +
+                        "               }\n" +
+                        "            ]\n" +
+                        "         },\n" +
+                        "         { \n" +
+                        "            \"vnf_directives\":{ \n" +
+                        "               \"directives\":[ \n" +
+                        "                  { \n" +
+                        "                     \"directive_name\":\"<Name of directive>\",\n" +
+                        "                     \"attributes\":[ \n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value>\"\n" +
+                        "                        }\n" +
+                        "                     ]\n" +
+                        "                  },\n" +
+                        "                  { \n" +
+                        "                     \"directive_name\":\"<Name of directive>\",\n" +
+                        "                     \"attributes\":[ \n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value >\"\n" +
+                        "                        },\n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value >\"\n" +
+                        "                        }\n" +
+                        "                     ]\n" +
+                        "                  }\n" +
+                        "               ]\n" +
+                        "            }\n" +
+                        "         }\n" +
+                        "      ]\n" +
+                        "   }");
         ModelInfo vnfModel = new ModelInfo();
         vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
         vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
index 33e4443..7485526 100644 (file)
@@ -26,7 +26,6 @@ import org.junit.Test;
 import org.onap.so.BaseIntegrationTest;
 import org.onap.so.bpmn.core.WorkflowException;
 import org.onap.so.bpmn.core.domain.AllottedResource;
-import org.onap.so.bpmn.core.domain.CloudFlavor;
 import org.onap.so.bpmn.core.domain.HomingSolution;
 import org.onap.so.bpmn.core.domain.ModelInfo;
 import org.onap.so.bpmn.core.domain.NetworkResource;
@@ -126,12 +125,133 @@ public class OofHomingTestIT extends BaseIntegrationTest {
         VnfResource vnf = new VnfResource();
         vnf.setResourceId("testResourceIdVNF");
         vnf.setResourceInstanceName("testVnfInstanceName");
-        ArrayList<CloudFlavor> flavors = new ArrayList<>();
-        CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
-        CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
-        flavors.add(flavor1);
-        flavors.add(flavor2);
-        vnf.getHomingSolution().setFlavors(flavors);
+        vnf.getHomingSolution().setOofDirectives(
+                "{ \n" +
+                        "      \"directives\":[ \n" +
+                        "         { \n" +
+                        "            \"vnfc_directives\":[ \n" +
+                        "               { \n" +
+                        "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
+                        "                  \"directives\":[ \n" +
+                        "                     { \n" +
+                        "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+                        "                        \"attributes\":[ \n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+                        "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+                        "                           }\n" +
+                        "                        ]\n" +
+                        "                     },\n" +
+                        "                     { \n" +
+                        "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+                        "                        \"attributes\":[ \n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+                        "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
+                        "                           },\n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+                        "                              \"attribute_value\":\"<value such as physnet>\"\n" +
+                        "                           }\n" +
+                        "                        ]\n" +
+                        "                     }\n" +
+                        "                  ]\n" +
+                        "               }\n" +
+                        "            ]\n" +
+                        "         },\n" +
+                        "         { \n" +
+                        "            \"vnf_directives\":{ \n" +
+                        "               \"directives\":[ \n" +
+                        "                  { \n" +
+                        "                     \"directive_name\":\"<Name of directive>\",\n" +
+                        "                     \"attributes\":[ \n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value>\"\n" +
+                        "                        }\n" +
+                        "                     ]\n" +
+                        "                  },\n" +
+                        "                  { \n" +
+                        "                     \"directive_name\":\"<Name of directive>\",\n" +
+                        "                     \"attributes\":[ \n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value >\"\n" +
+                        "                        },\n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value >\"\n" +
+                        "                        }\n" +
+                        "                     ]\n" +
+                        "                  }\n" +
+                        "               ]\n" +
+                        "            }\n" +
+                        "         }\n" +
+                        "      ]\n" +
+                        "   },\n" +
+                        "   \"sdnc_directives\":{ \n" +
+                        "      \"directives\":[ \n" +
+                        "         { \n" +
+                        "            \"vnfc_directives\":[ \n" +
+                        "               { \n" +
+                        "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
+                        "                  \"directives\":[ \n" +
+                        "                     { \n" +
+                        "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+                        "                        \"attributes\":[ \n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+                        "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+                        "                           }\n" +
+                        "                        ]\n" +
+                        "                     },\n" +
+                        "                     { \n" +
+                        "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+                        "                        \"attributes\":[ \n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+                        "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
+                        "                           },\n" +
+                        "                           { \n" +
+                        "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+                        "                              \"attribute_value\":\"<value such as physnet>\"\n" +
+                        "                           }\n" +
+                        "                        ]\n" +
+                        "                     }\n" +
+                        "                  ]\n" +
+                        "               }\n" +
+                        "            ]\n" +
+                        "         },\n" +
+                        "         { \n" +
+                        "            \"vnf_directives\":{ \n" +
+                        "               \"directives\":[ \n" +
+                        "                  { \n" +
+                        "                     \"directive_name\":\"<Name of directive>\",\n" +
+                        "                     \"attributes\":[ \n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value>\"\n" +
+                        "                        }\n" +
+                        "                     ]\n" +
+                        "                  },\n" +
+                        "                  { \n" +
+                        "                     \"directive_name\":\"<Name of directive>\",\n" +
+                        "                     \"attributes\":[ \n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value >\"\n" +
+                        "                        },\n" +
+                        "                        { \n" +
+                        "                           \"attribute_name\":\"<name of attribute>\",\n" +
+                        "                           \"attribute_value\":\"<value >\"\n" +
+                        "                        }\n" +
+                        "                     ]\n" +
+                        "                  }\n" +
+                        "               ]\n" +
+                        "            }\n" +
+                        "         }\n" +
+                        "      ]\n" +
+                        "   }");
         ModelInfo vnfModel = new ModelInfo();
         vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
         vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
index 59d38bf..0f50ae6 100644 (file)
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.scripts
 import javax.xml.parsers.DocumentBuilder
 import javax.xml.parsers.DocumentBuilderFactory
 
-import org.apache.commons.lang3.*
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.json.JSONArray
@@ -38,7 +37,7 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase
 import org.onap.so.bpmn.core.RollbackData
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.core.domain.CloudFlavor
+
 import org.onap.so.bpmn.core.domain.VnfResource
 import org.onap.so.bpmn.core.json.DecomposeJsonUtil
 import org.onap.so.bpmn.core.json.JsonUtils
@@ -174,8 +173,8 @@ public class DoCreateVfModule extends VfModuleBase {
                                execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId)
                                rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId)
                                msoLogger.debug("serviceInstanceId: " + serviceInstanceId)
-                               //flavorList
-                               ArrayList<CloudFlavor> flavorList = execution.getVariable(cloudSiteId + "_flavorList")
+                               //OofDirectives
+                               String oofDirectives = execution.getVariable(cloudSiteId + "_oofDirectives")
                                if (flavorList != null) {
                                        execution.setVariable("DCVFM_flavorList", flavorList)
                                        logDebug("flavorList is: " + flavorList, isDebugLogEnabled)
@@ -921,8 +920,8 @@ public class DoCreateVfModule extends VfModuleBase {
                def serviceId = execution.getVariable("DCVFM_serviceId")
                //serviceInstanceId
                def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId")
-               //flavorList
-               ArrayList<CloudFlavor> flavorList = execution.getVariable("DCVFM_flavorList")
+               //OofDirectives
+               String oofDirectives = execution.getVariable("DCVFM_oofDirectives")
                //backoutOnFailure
                def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure")
                //volumeGroupId