CLAMP-CDS integration to display all CDS actions for blueprint in CL 95/102995/1
authorVidyashree-Huawei <vidyashree.rama@huawei.com>
Wed, 4 Mar 2020 13:52:08 +0000 (19:22 +0530)
committerVidyashree-Huawei <vidyashree.rama@huawei.com>
Wed, 4 Mar 2020 13:52:34 +0000 (19:22 +0530)
CLAMP-CDS integration to display all CDS actions for blueprint in CL

Change-Id: I18b972b8952e5de9ac8e39d6c9cc4ecba0ec9b02
Issue-ID: CLAMP-491
Signed-off-by: Vidyashree-Huawei <vidyashree.rama@huawei.com>
20 files changed:
src/main/java/org/onap/clamp/clds/client/CdsServices.java [new file with mode: 0644]
src/main/java/org/onap/clamp/clds/model/cds/CdsBpWorkFlowListResponse.java [new file with mode: 0644]
src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java
src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java
src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
src/main/resources/application.properties
src/main/resources/clds/camel/routes/cds-flows.xml [new file with mode: 0644]
src/main/resources/clds/json-schema/operational_policies/operational_policy.json
src/test/resources/application.properties
src/test/resources/example/sdc/service_Vloadbalancerms_csar.csar
src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec&#63;connectionTimeToLive=5000/.file [new file with mode: 0644]
src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec&#63;connectionTimeToLive=5000/.header [new file with mode: 0644]
src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0&#63;connectionTimeToLive=5000/.file [new file with mode: 0644]
src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0&#63;connectionTimeToLive=5000/.header [new file with mode: 0644]
src/test/resources/tosca/model-properties.json
src/test/resources/tosca/operational-policy-json-schema.json
src/test/resources/tosca/operational-policy-payload.yaml
src/test/resources/tosca/operational-policy-properties.json
src/test/resources/tosca/resource-details.json

diff --git a/src/main/java/org/onap/clamp/clds/client/CdsServices.java b/src/main/java/org/onap/clamp/clds/client/CdsServices.java
new file mode 100644 (file)
index 0000000..fe1937a
--- /dev/null
@@ -0,0 +1,171 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP CLAMP\r
+ * ================================================================================\r
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ * ================================================================================\r
+ *\r
+ */\r
+\r
+package org.onap.clamp.clds.client;\r
+\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
+import com.google.gson.JsonElement;\r
+import com.google.gson.JsonObject;\r
+import com.google.gson.JsonParser;\r
+\r
+import java.util.Date;\r
+import java.util.Map;\r
+\r
+import org.apache.camel.CamelContext;\r
+import org.apache.camel.Exchange;\r
+import org.apache.camel.builder.ExchangeBuilder;\r
+import org.onap.clamp.clds.model.cds.CdsBpWorkFlowListResponse;\r
+import org.onap.clamp.clds.util.JsonUtils;\r
+import org.onap.clamp.clds.util.LoggingUtils;\r
+import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.stereotype.Component;\r
+\r
+/**\r
+ * This class implements the communication with CDS for the service inventory.\r
+ */\r
+@Component\r
+public class CdsServices {\r
+\r
+    @Autowired\r
+    CamelContext camelContext;\r
+\r
+    protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CdsServices.class);\r
+\r
+    /**\r
+     * Constructor.\r
+     */\r
+    @Autowired\r
+    public CdsServices() {\r
+    }\r
+\r
+\r
+    /**\r
+     * Query CDS to get blueprint's workflow list.\r
+     *\r
+     * @param blueprintName    CDS blueprint name\r
+     * @param blueprintVersion CDS blueprint version\r
+     * @return CdsBpWorkFlowListResponse CDS blueprint's workflow list\r
+     */\r
+    public CdsBpWorkFlowListResponse getBlueprintWorkflowList(String blueprintName, String blueprintVersion) {\r
+        LoggingUtils.setTargetContext("CDS", "getBlueprintWorkflowList");\r
+\r
+        Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext)\r
+                .withProperty("blueprintName", blueprintName).withProperty("blueprintVersion", blueprintVersion)\r
+                .build();\r
+\r
+        Exchange exchangeResponse = camelContext.createProducerTemplate()\r
+                .send("direct:get-blueprint-workflow-list", myCamelExchange);\r
+\r
+        if (Integer.valueOf(200).equals(exchangeResponse.getIn().getHeader("CamelHttpResponseCode"))) {\r
+            String cdsResponse = (String) exchangeResponse.getIn().getBody();\r
+            logger.info("getBlueprintWorkflowList, response from CDS:" + cdsResponse);\r
+            LoggingUtils.setResponseContext("0", "Get Blueprint workflow list", this.getClass().getName());\r
+            Date startTime = new Date();\r
+            LoggingUtils.setTimeContext(startTime, new Date());\r
+            return JsonUtils.GSON_JPA_MODEL.fromJson(cdsResponse, CdsBpWorkFlowListResponse.class);\r
+        }\r
+        return null;\r
+    }\r
+\r
+    /**\r
+     * Query CDS to get input properties of workflow.\r
+     *\r
+     * @param blueprintName    CDS blueprint name\r
+     * @param blueprintVersion CDS blueprint name\r
+     * @param workflow         CDS blueprint's workflow\r
+     * @return input properties in json format\r
+     */\r
+    public JsonObject getWorkflowInputProperties(String blueprintName, String blueprintVersion,\r
+                                                 String workflow) {\r
+        LoggingUtils.setTargetContext("CDS", "getWorkflowInputProperties");\r
+\r
+        Exchange myCamelExchange = ExchangeBuilder.anExchange(camelContext)\r
+                .withBody(getCdsPayloadForWorkFlow(blueprintName, blueprintVersion, workflow))\r
+                .build();\r
+\r
+        Exchange exchangeResponse = camelContext.createProducerTemplate()\r
+                .send("direct:get-blueprint-workflow-input-properties", myCamelExchange);\r
+\r
+        if (Integer.valueOf(200).equals(exchangeResponse.getIn().getHeader("CamelHttpResponseCode"))) {\r
+            String cdsResponse = (String) exchangeResponse.getIn().getBody();\r
+            logger.info("getWorkflowInputProperties, response from CDS:" + cdsResponse);\r
+            LoggingUtils.setResponseContext("0", "Get Blueprint workflow input properties", this.getClass().getName());\r
+            Date startTime = new Date();\r
+            LoggingUtils.setTimeContext(startTime, new Date());\r
+            return parseCdsResponse(cdsResponse);\r
+        }\r
+        return null;\r
+    }\r
+\r
+    private JsonObject parseCdsResponse(String response) {\r
+        JsonObject root = JsonParser.parseString(response).getAsJsonObject();\r
+        JsonObject inputs = root.getAsJsonObject("workFlowData").getAsJsonObject("inputs");\r
+        JsonObject dataTypes = root.getAsJsonObject("dataTypes");\r
+\r
+        JsonObject workFlowProperties = new JsonObject();\r
+        workFlowProperties.add("inputs", getInputProperties(inputs, dataTypes));\r
+        return workFlowProperties;\r
+    }\r
+\r
+    private JsonObject getInputProperties(JsonObject inputs, JsonObject dataTypes) {\r
+        JsonObject inputObject = new JsonObject();\r
+        for (Map.Entry<String, JsonElement> entry : inputs.entrySet()) {\r
+            String key = entry.getKey();\r
+            JsonObject inputProperty = inputs.getAsJsonObject(key);\r
+            String type = inputProperty.get("type").getAsString();\r
+            if (isComplexType(type, dataTypes)) {\r
+                inputObject.add(key, handleComplexType(type, dataTypes));\r
+            } else {\r
+                inputObject.addProperty(key, "");\r
+            }\r
+        }\r
+        return inputObject;\r
+    }\r
+\r
+    private JsonObject handleComplexType(String key, JsonObject dataTypes) {\r
+        JsonObject properties = dataTypes.get(key).getAsJsonObject().get("properties").getAsJsonObject();\r
+        return getInputProperties(properties, dataTypes);\r
+    }\r
+\r
+    private boolean isComplexType(String type, JsonObject dataTypes) {\r
+        return dataTypes.get(type) != null;\r
+    }\r
+\r
+    /**\r
+     * Creates payload to query CDS to get workflow input properties.\r
+     *\r
+     * @param blueprintName CDS blueprint name\r
+     * @param version       CDS blueprint version\r
+     * @param workflow      CDS blueprint workflow\r
+     * @return returns payload in json format\r
+     */\r
+    public String getCdsPayloadForWorkFlow(String blueprintName, String version, String workflow) {\r
+        JsonObject jsonObject = new JsonObject();\r
+        jsonObject.addProperty("blueprintName", blueprintName);\r
+        jsonObject.addProperty("version", version);\r
+        jsonObject.addProperty("returnContent", "json");\r
+        jsonObject.addProperty("workflowName", workflow);\r
+        jsonObject.addProperty("specType", "TOSCA");\r
+        return jsonObject.toString();\r
+    }\r
+}\r
diff --git a/src/main/java/org/onap/clamp/clds/model/cds/CdsBpWorkFlowListResponse.java b/src/main/java/org/onap/clamp/clds/model/cds/CdsBpWorkFlowListResponse.java
new file mode 100644 (file)
index 0000000..66025c4
--- /dev/null
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ * ================================================================================
+ * 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.clamp.clds.model.cds;
+
+import com.google.gson.annotations.Expose;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * This class maps the CDS response to a pojo.
+ */
+public class CdsBpWorkFlowListResponse {
+
+    @Expose
+    private String blueprintName;
+
+    @Expose
+    private String version;
+
+    @Expose
+    private List<String> workflows = new LinkedList<String>();
+
+    public String getBlueprintName() {
+        return blueprintName;
+    }
+
+    public void setBlueprintName(String blueprintName) {
+        this.blueprintName = blueprintName;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public List<String> getWorkflows() {
+        return workflows;
+    }
+
+    public void setWorkflows(List<String> workflows) {
+        this.workflows = workflows;
+    }
+}
index 277fe00..889125f 100644 (file)
@@ -4,6 +4,7 @@
  * ================================================================================
  * Copyright (C) 2020 AT&T Intellectual Property. All rights
  *                             reserved.
+ * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,7 +30,9 @@ import com.google.gson.JsonObject;
 
 import java.util.Map.Entry;
 
+import org.onap.clamp.clds.client.CdsServices;
 import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
+import org.onap.clamp.clds.model.cds.CdsBpWorkFlowListResponse;
 import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
 import org.onap.clamp.clds.util.JsonUtils;
 import org.onap.sdc.tosca.parser.api.IEntityDetails;
@@ -53,9 +56,12 @@ public class CsarServiceInstaller {
     @Autowired
     ServiceRepository serviceRepository;
 
+    @Autowired
+    CdsServices cdsServices;
+
     /**
      * Install the Service from the csar.
-     * 
+     *
      * @param csar The Csar Handler
      * @return The service object
      */
@@ -77,7 +83,7 @@ public class CsarServiceInstaller {
         return modelService;
     }
 
-    private static JsonObject createServicePropertiesByType(CsarHandler csar) {
+    private JsonObject createServicePropertiesByType(CsarHandler csar) {
         JsonObject resourcesProp = new JsonObject();
         // Iterate on all types defined in the tosca lib
         for (SdcTypes type : SdcTypes.values()) {
@@ -86,6 +92,13 @@ public class CsarServiceInstaller {
             for (NodeTemplate nodeTemplate : csar.getSdcCsarHelper().getServiceNodeTemplateBySdcType(type)) {
                 resourcesPropByType.add(nodeTemplate.getName(),
                         JsonUtils.GSON.toJsonTree(nodeTemplate.getMetaData().getAllProperties()));
+                // get cds artifact information and save in resources Prop
+                if (SdcTypes.PNF == type || SdcTypes.VF == type) {
+                    JsonObject controllerProperties = createCdsArtifactProperties(nodeTemplate);
+                    if (controllerProperties != null) {
+                        resourcesPropByType.getAsJsonObject(nodeTemplate.getName()).add("controllerProperties", controllerProperties);
+                    }
+                }
             }
             resourcesProp.add(type.getValue(), resourcesPropByType);
         }
@@ -114,7 +127,7 @@ public class CsarServiceInstaller {
 
     /**
      * Verify whether Service in Csar is deployed.
-     * 
+     *
      * @param csar The Csar Handler
      * @return The flag indicating whether Service is deployed
      * @throws SdcArtifactInstallerException The SdcArtifactInstallerException
@@ -127,4 +140,43 @@ public class CsarServiceInstaller {
 
         return alreadyInstalled;
     }
+
+    /**
+     * Retrive CDS artifacts information from node template and save in resource object.
+     *
+     * @param nodeTemplate node template
+     * @return Returns CDS artifacts information
+     */
+    private JsonObject createCdsArtifactProperties(NodeTemplate nodeTemplate) {
+        Object artifactName = nodeTemplate.getPropertyValue("sdnc_model_name");
+        Object artifactVersion = nodeTemplate.getPropertyValue("sdnc_model_version");
+        if (artifactName != null && artifactVersion != null) {
+            CdsBpWorkFlowListResponse response = queryCdsToGetWorkFlowList(artifactName.toString(), artifactVersion.toString());
+            if (response == null) {
+                return null;
+            }
+
+            JsonObject workFlowProps = new JsonObject();
+            for (String workFlow : response.getWorkflows()) {
+                JsonObject inputs = queryCdsToGetWorkFlowInputProperties(response.getBlueprintName(),
+                                                                         response.getVersion(), workFlow);
+                workFlowProps.add(workFlow, inputs);
+            }
+
+            JsonObject controllerProperties = new JsonObject();
+            controllerProperties.addProperty("sdnc_model_name", artifactName.toString());
+            controllerProperties.addProperty("sdnc_model_version", artifactVersion.toString());
+            controllerProperties.add("workflows", workFlowProps);
+            return controllerProperties;
+        }
+        return null;
+    }
+
+    private CdsBpWorkFlowListResponse queryCdsToGetWorkFlowList(String artifactName, String artifactVersion) {
+        return cdsServices.getBlueprintWorkflowList(artifactName, artifactVersion);
+    }
+
+    private JsonObject queryCdsToGetWorkFlowInputProperties(String artifactName, String artifactVersion, String workFlow) {
+        return cdsServices.getWorkflowInputProperties(artifactName, artifactVersion, workFlow);
+    }
 }
index ff7777f..033f2ce 100644 (file)
@@ -4,6 +4,7 @@
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights
  *                             reserved.
+ * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -46,6 +47,11 @@ import org.yaml.snakeyaml.Yaml;
  */
 public class LegacyOperationalPolicy {
 
+    private static final String ACTOR = "actor";
+    private static final String RECIPE = "recipe";
+    private static final String POLICIES = "policies";
+    private static final String PAYLOAD = "payload";
+
     private LegacyOperationalPolicy() {
 
     }
@@ -79,7 +85,7 @@ public class LegacyOperationalPolicy {
     /**
      * This method rework the payload attribute (yaml) that is normally wrapped in a
      * string when coming from the UI.
-     * 
+     *
      * @param policyJson The operational policy json config
      * @return The same object reference but modified
      */
@@ -150,7 +156,7 @@ public class LegacyOperationalPolicy {
 
     /**
      * This method transforms the configuration json to a Yaml format.
-     * 
+     *
      * @param operationalPolicyJsonElement The operational policy json config
      * @return The Yaml as string
      */
@@ -162,13 +168,13 @@ public class LegacyOperationalPolicy {
         // Policy can't support { } in the yaml
         options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
         return (new Yaml(options)).dump(createMap(fulfillPoliciesTreeField(
-                removeAllQuotes(reworkPayloadAttributes(operationalPolicyJsonElement.getAsJsonObject().deepCopy())))));
+                removeAllQuotes(reworkActorAttributes(operationalPolicyJsonElement.getAsJsonObject().deepCopy())))));
     }
 
     /**
      * This method load mandatory field in the operational policy configuration
      * JSON.
-     * 
+     *
      * @param configurationsJson The operational policy JSON
      * @param loop               The parent loop object
      */
@@ -182,4 +188,45 @@ public class LegacyOperationalPolicy {
             configurationsJson.add("operational_policy", controlLoop);
         }
     }
+
+    /**
+     * This method rework on the actor/recipe and payload attribute.
+     *
+     * @param policyJson The operational policy json config
+     * @return The same object reference but modified
+     */
+    public static JsonElement reworkActorAttributes(JsonElement policyJson) {
+        for (JsonElement policy : policyJson.getAsJsonObject().get(POLICIES).getAsJsonArray()) {
+            JsonObject actor = policy.getAsJsonObject().get(ACTOR).getAsJsonObject();
+            policy.getAsJsonObject().remove(ACTOR);
+            String actorStr = actor.getAsJsonObject().get(ACTOR).getAsString();
+            policy.getAsJsonObject().addProperty(ACTOR, actorStr);
+            policy.getAsJsonObject().addProperty(RECIPE, getRecipe(actor));
+
+            if ("CDS".equalsIgnoreCase(actorStr)) {
+                addPayloadAttributes(actor.getAsJsonObject(ACTOR).getAsJsonObject(RECIPE), policy);
+            } else {
+                addPayloadAttributes(actor, policy);
+            }
+        }
+        return policyJson;
+    }
+
+    private static void addPayloadAttributes(JsonObject jsonObject,
+                                             JsonElement policy) {
+        JsonElement payloadElem = jsonObject.getAsJsonObject().get(PAYLOAD);
+        String payloadString = payloadElem != null ? payloadElem.getAsString() : "";
+        if (!payloadString.isEmpty()) {
+            Map<String, String> testMap = new Yaml().load(payloadString);
+            String json = new GsonBuilder().create().toJson(testMap);
+            policy.getAsJsonObject().add(PAYLOAD,
+                                         new GsonBuilder().create().fromJson(json, JsonElement.class));
+        } else {
+            policy.getAsJsonObject().addProperty(PAYLOAD, "");
+        }
+    }
+
+    private static String getRecipe(JsonObject actor) {
+        return actor.getAsJsonObject().get("type").getAsString();
+    }
 }
index aab30bf..7cf06dc 100644 (file)
@@ -4,6 +4,7 @@
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights
  *                             reserved.
+ * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -222,7 +223,7 @@ public class OperationalPolicy extends Policy implements Serializable {
         metadata.addProperty("policy-id", this.name);
 
         operationalPolicyDetails.add("properties", LegacyOperationalPolicy
-                .reworkPayloadAttributes(this.getConfigurationsJson().get("operational_policy").deepCopy()));
+                .reworkActorAttributes(this.getConfigurationsJson().get("operational_policy").deepCopy()));
 
         DumperOptions options = new DumperOptions();
         options.setIndent(2);
index 1d0d990..244f4c2 100644 (file)
@@ -4,6 +4,7 @@
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights
  *                             reserved.
+ * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -42,7 +43,7 @@ public class OperationalPolicyRepresentationBuilder {
      * used by ui for rendering. It uses the model (VF and VFModule) defined in the
      * loop object to do so, so it's dynamic. It also uses the operational policy
      * schema template defined in the resource folder.
-     * 
+     *
      * @param modelJson The loop model json
      * @return The json representation
      * @throws JsonSyntaxException If the schema template cannot be parsed
@@ -58,6 +59,22 @@ public class OperationalPolicyRepresentationBuilder {
                 .get("operational_policy").getAsJsonObject().get("properties").getAsJsonObject().get("policies")
                 .getAsJsonObject().get("items").getAsJsonObject().get("properties").getAsJsonObject().get("target")
                 .getAsJsonObject().get("anyOf").getAsJsonArray().addAll(createAnyOfArray(modelJson));
+
+        // update CDS recipe and payload information to schema
+        JsonArray actors = jsonSchema.get("schema").getAsJsonObject().get("items").getAsJsonObject().get("properties")
+                .getAsJsonObject().get("configurationsJson").getAsJsonObject().get("properties").getAsJsonObject()
+                .get("operational_policy").getAsJsonObject().get("properties").getAsJsonObject().get("policies")
+                .getAsJsonObject().get("items").getAsJsonObject().get("properties").getAsJsonObject().get("actor")
+                .getAsJsonObject().get("anyOf").getAsJsonArray();
+
+        for (JsonElement actor : actors) {
+            if ("CDS".equalsIgnoreCase(actor.getAsJsonObject().get("title").getAsString())) {
+                actor.getAsJsonObject().get("properties").getAsJsonObject().get("type").getAsJsonObject()
+                        .get("anyOf").getAsJsonArray()
+                        .addAll(createAnyOfArrayForCdsRecipe(modelJson.getResourceDetails()));
+            }
+        }
+
         return jsonSchema;
     }
 
@@ -143,4 +160,54 @@ public class OperationalPolicyRepresentationBuilder {
         targetOneOfStructure.addAll(createVfModuleSchema(modelJson));
         return targetOneOfStructure;
     }
+
+    private static JsonArray createAnyOfArrayForCdsRecipe(JsonObject resourceDetails) {
+        JsonArray anyOfStructure = new JsonArray();
+        anyOfStructure.addAll(createAnyOfCdsRecipe(resourceDetails.getAsJsonObject("VF")));
+        anyOfStructure.addAll(createAnyOfCdsRecipe(resourceDetails.getAsJsonObject("PNF")));
+        return anyOfStructure;
+    }
+
+    private static JsonArray createAnyOfCdsRecipe(JsonObject jsonObject) {
+        JsonArray schemaArray = new JsonArray();
+        for (Entry<String, JsonElement> entry : jsonObject.entrySet()) {
+            JsonObject controllerProperties = entry.getValue().getAsJsonObject()
+                    .getAsJsonObject("controllerProperties");
+
+            if (controllerProperties != null) {
+                JsonObject workflows = controllerProperties.getAsJsonObject("workflows");
+                for (Entry<String, JsonElement> workflowsEntry : workflows.entrySet()) {
+                    JsonObject obj = new JsonObject();
+                    obj.addProperty("title", workflowsEntry.getKey());
+                    obj.add("properties", createPayloadProperty(workflowsEntry.getValue().getAsJsonObject(),
+                                                                controllerProperties));
+                    schemaArray.add(obj);
+                }
+
+            }
+        }
+        return schemaArray;
+    }
+
+    private static JsonObject createPayloadProperty(JsonObject workFlow, JsonObject controllerProperties) {
+        JsonObject type = new JsonObject();
+        type.addProperty("title", "Payload (YAML)");
+        type.addProperty("type", "string");
+        type.addProperty("default", createDefaultStringForPayload(workFlow, controllerProperties));
+        type.addProperty("format", "textarea");
+        JsonObject properties = new JsonObject();
+        properties.add("type", type);
+        return properties;
+    }
+
+    private static String createDefaultStringForPayload(JsonObject workFlow, JsonObject controllerProperties) {
+        String artifactName = controllerProperties.get("sdnc_model_name").toString();
+        String artifactVersion = controllerProperties.get("sdnc_model_version").toString();
+        String data = workFlow.getAsJsonObject("inputs").toString();
+        StringBuilder builder = new StringBuilder("'").append("artifact_name : ").append(artifactName).append("\n")
+                .append("artifact_version : ").append(artifactVersion).append("\n")
+                .append("mode : async").append("\n")
+                .append("data : ").append("'").append("\\").append("'").append(data).append("\\").append("'").append("'");
+        return builder.toString();
+    }
 }
index 695319d..3abbcd5 100644 (file)
@@ -223,3 +223,8 @@ clamp.config.cadi.cadiX509Issuers=CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US:CN
 
 ## Tosca converter
 clamp.config.tosca.converter.templates=classpath:/clds/tosca_updates/templates.properties
+
+# Configuration settings for CDS
+clamp.config.cds.url=http4://blueprints-processor-http:8080
+clamp.config.cds.userName=ccsdkapps
+clamp.config.cds.password=ccsdkapps
\ No newline at end of file
diff --git a/src/main/resources/clds/camel/routes/cds-flows.xml b/src/main/resources/clds/camel/routes/cds-flows.xml
new file mode 100644 (file)
index 0000000..5c10a0c
--- /dev/null
@@ -0,0 +1,46 @@
+<routes xmlns="http://camel.apache.org/schema/spring">
+    <route id="get-blueprint-workflow-list">
+        <from uri="direct:get-blueprint-workflow-list"/>
+        <log loggingLevel="INFO"
+             message="Getting blueprint workflow list from CDS"/>
+        <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('CDS', 'Getting workflow list from CDS')"/>
+        <doTry>
+            <setHeader headerName="CamelHttpMethod">
+                <constant>GET</constant>
+            </setHeader>
+            <setHeader headerName="Content-Type">
+                <constant>application/json</constant>
+            </setHeader>
+            <log loggingLevel="INFO"
+                 message="Endpoint to query workflows from CDS : {{clamp.config.cds.url}}/api/v1/blueprint-model/workflows/blueprint-name/${exchangeProperty[blueprintName]}/version/${exchangeProperty[blueprintVersion]}"></log>
+            <toD uri="{{clamp.config.cds.url}}/api/v1/blueprint-model/workflows/blueprint-name/${exchangeProperty[blueprintName]}/version/${exchangeProperty[blueprintVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.cds.userName}}&amp;authPassword={{clamp.config.cds.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+            <convertBodyTo type="java.lang.String"/>
+            <doFinally>
+                <to uri="direct:reset-raise-http-exception-flag"/>
+                <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+            </doFinally>
+        </doTry>
+    </route>
+    <route id="get-blueprint-workflow-input-properties">
+        <from uri="direct:get-blueprint-workflow-input-properties"/>
+        <log loggingLevel="INFO"
+             message="Getting blueprint input properties for workflow"/>
+        <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('CDS', 'Getting input properties for workflow')"/>
+        <doTry>
+            <setHeader headerName="CamelHttpMethod">
+                <constant>POST</constant>
+            </setHeader>
+            <setHeader headerName="Content-Type">
+                <constant>application/json</constant>
+            </setHeader>
+            <log loggingLevel="INFO"
+                 message="Endpoint to query input properties for workflow from CDS : {{clamp.config.cds.url}}/api/v1/blueprint-model/workflow-spec"></log>
+            <toD uri="{{clamp.config.cds.url}}/api/v1/blueprint-model/workflow-spec?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.cds.userName}}&amp;authPassword={{clamp.config.cds.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+            <convertBodyTo type="java.lang.String"/>
+            <doFinally>
+                <to uri="direct:reset-raise-http-exception-flag"/>
+                <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+            </doFinally>
+        </doTry>
+    </route>
+</routes>
\ No newline at end of file
index 93738c8..ef22e81 100644 (file)
@@ -87,7 +87,6 @@
                                         "basicCategoryTitle": "recipe",
                                         "required": [
                                             "id",
-                                            "recipe",
                                             "retry",
                                             "timeout",
                                             "actor",
                                                 "title": "Policy ID",
                                                 "type": "string"
                                             },
-                                            "recipe": {
-                                                "title": "Recipe",
-                                                "type": "string",
-                                                "enum": [
-                                                    "Restart",
-                                                    "Rebuild",
-                                                    "Migrate",
-                                                    "Health-Check",
-                                                    "ModifyConfig",
-                                                    "VF Module Create",
-                                                    "VF Module Delete",
-                                                    "Reroute"
-                                                ]
-                                            },
                                             "retry": {
                                                 "default": "0",
                                                 "title": "Number of Retry",
                                                 "format": "number"
                                             },
                                             "actor": {
+                                                "type": "object",
                                                 "title": "Actor",
-                                                "type": "string",
-                                                "enum": [
-                                                    "APPC",
-                                                    "SO",
-                                                    "VFC",
-                                                    "SDNC",
-                                                    "SDNR"
+                                                "anyOf": [
+                                                    {
+                                                        "title": "APPC",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "APPC",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "string",
+                                                                "default": "",
+                                                                "enum": [
+                                                                    "Restart",
+                                                                    "Rebuild",
+                                                                    "Migrate",
+                                                                    "Health-Check",
+                                                                    "ModifyConfig"
+                                                                ]
+                                                            },
+                                                            "payload": {
+                                                                "title": "Payload (YAML)",
+                                                                "type": "string",
+                                                                "format": "textarea"
+                                                            }
+                                                        }
+                                                    },
+                                                    {
+                                                        "title": "SO",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "SO",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "string",
+                                                                "default": "",
+                                                                "enum": [
+                                                                    "VF Module Create",
+                                                                    "VF Module Delete"
+                                                                ]
+                                                            },
+                                                            "payload": {
+                                                                "title": "Payload (YAML)",
+                                                                "type": "string",
+                                                                "format": "textarea"
+                                                            }
+                                                        }
+                                                    },
+                                                    {
+                                                        "title": "SDNC",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "SDNC",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "string",
+                                                                "default": "",
+                                                                "enum": [
+                                                                    "Reroute",
+                                                                    "BandwidthOnDemand"
+                                                                ]
+                                                            },
+                                                            "payload": {
+                                                                "title": "Payload (YAML)",
+                                                                "type": "string",
+                                                                "format": "textarea"
+                                                            }
+                                                        }
+                                                    },
+                                                    {
+                                                        "title": "VFC",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "VFC",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "string",
+                                                                "required": [
+                                                                    "payload"
+                                                                ],
+                                                                "default": "",
+                                                                "enum": [
+                                                                    "ModifyConfig"
+                                                                ]
+                                                            },
+                                                            "payload": {
+                                                                "title": "Payload (YAML)",
+                                                                "type": "string",
+                                                                "format": "textarea"
+                                                            }
+                                                        }
+                                                    },
+                                                    {
+                                                        "title": "CDS",
+                                                        "properties": {
+                                                            "actor": {
+                                                                "title": "actor",
+                                                                "type": "string",
+                                                                "default": "CDS",
+                                                                "options": {
+                                                                    "hidden": true
+                                                                }
+                                                            },
+                                                            "type": {
+                                                                "title": "recipe",
+                                                                "type": "object",
+                                                                "required": [
+                                                                    "payload"
+                                                                ],
+                                                                "anyOf": [
+                                                                    {
+                                                                        "title": "user-defined",
+                                                                        "properties": {
+                                                                            "type": {
+                                                                                "title": "Payload (YAML)",
+                                                                                "type": "string",
+                                                                                "default" : "",
+                                                                                "format" : "textarea"
+                                                                            }
+                                                                        }
+                                                                    }
+                                                                ]
+                                                            }
+                                                        }
+                                                    }
                                                 ]
                                             },
-                                            "payload": {
-                                                "title": "Payload (YAML)",
-                                                "type": "string",
-                                                "format": "textarea"
-                                            },
                                             "success": {
                                                 "default": "final_success",
                                                 "title": "When Success",
                                                 "anyOf": [
                                                     {
                                                         "title": "User Defined",
-                                                        "additionalProperties":"True",
+                                                        "additionalProperties": "True",
                                                         "properties": {
                                                             "type": {
                                                                 "title": "Target type",
index 5b921e9..4f1a845 100644 (file)
@@ -194,4 +194,9 @@ clamp.config.security.permission.type.template=permission-type-template
 clamp.config.security.permission.type.tosca=permission-type-tosca
 #This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties
 clamp.config.security.permission.instance=dev
-clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal
\ No newline at end of file
+clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal
+
+# Configuration settings for CDS
+clamp.config.cds.url=http4://localhost:${docker.http-cache.port.host}
+clamp.config.cds.userName=ccsdkapps
+clamp.config.cds.password=ccsdkapps
\ No newline at end of file
index 3330dd1..ff33799 100644 (file)
Binary files a/src/test/resources/example/sdc/service_Vloadbalancerms_csar.csar and b/src/test/resources/example/sdc/service_Vloadbalancerms_csar.csar differ
diff --git a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec&#63;connectionTimeToLive=5000/.file
new file mode 100644 (file)
index 0000000..13d3fea
--- /dev/null
@@ -0,0 +1,68 @@
+{
+    "blueprintName": "baseconfiguration",
+    "version": "1.0.0",
+    "workFlowData": {
+        "workFlowName": "resource-assignment",
+        "inputs": {
+            "resource-assignment-properties": {
+                "required": true,
+                "type": "dt-resource-assignment-properties"
+            }
+        },
+        "outputs": {
+            "response-property": {
+                "type": "string",
+                "value": "executed"
+            },
+            "template-properties": {
+                "type": "json",
+                "value": {
+                    "get_attribute": [
+                        "resource-assignment",
+                        "assignment-params"
+                    ]
+                }
+            }
+        }
+    },
+    "dataTypes": {
+        "dt-resource-assignment-properties": {
+            "description": "This is Dynamically generated data type for workflow activate",
+            "version": "1.0.0",
+            "metadata": null,
+            "attributes": null,
+            "properties": {
+                "request-id": {
+                    "required": true,
+                    "type": "string"
+                },
+                "service-instance-id": {
+                    "required": true,
+                    "type": "string"
+                },
+                "vnf-id": {
+                    "required": true,
+                    "type": "string"
+                },
+                "action-name": {
+                    "required": true,
+                    "type": "string"
+                },
+                "scope-type": {
+                    "required": true,
+                    "type": "string"
+                },
+                "hostname": {
+                    "required": true,
+                    "type": "string"
+                },
+                "vnf_name": {
+                    "required": true,
+                    "type": "string"
+                }
+            },
+            "constraints": null,
+            "derived_from": "tosca.datatypes.Dynamic"
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec&#63;connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec&#63;connectionTimeToLive=5000/.header
new file mode 100644 (file)
index 0000000..6a280d9
--- /dev/null
@@ -0,0 +1 @@
+{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"}
\ No newline at end of file
diff --git a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0&#63;connectionTimeToLive=5000/.file
new file mode 100644 (file)
index 0000000..58975d8
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    "blueprintName": "baseconfiguration",
+    "version": "1.0.0",
+    "workflows": [
+        "resource-assignment",
+        "activate",
+        "activate-restconf",
+        "activate-cli",
+        "assign-activate",
+        "imperative-test-wf"
+    ]
+}
\ No newline at end of file
diff --git a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0&#63;connectionTimeToLive=5000/.header b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0&#63;connectionTimeToLive=5000/.header
new file mode 100644 (file)
index 0000000..6a280d9
--- /dev/null
@@ -0,0 +1 @@
+{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"}
\ No newline at end of file
index e41471b..c405964 100644 (file)
                                "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
                                "version": "1.0",
                                "resourceVendorRelease": "1.0",
-                               "customizationUUID": "465246dc-7748-45f4-a013-308d92922552"
+                               "customizationUUID": "465246dc-7748-45f4-a013-308d92922552",
+                               "controllerProperties": {
+                                       "sdnc_model_name": "baseconfiguration",
+                                       "sdnc_model_version": "1.0.0",
+                                       "workflows": {
+                                               "resource-assignment": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "activate": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "activate-restconf": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "activate-cli": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "assign-activate": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "imperative-test-wf": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               } 
+                                       }
+                               }
                        }
                },
                "CR": {
index d6870dc..b43f6f9 100644 (file)
@@ -87,7 +87,6 @@
                                                                                "basicCategoryTitle": "recipe",
                                                                                "required": [
                                                                                        "id",
-                                                                                       "recipe",
                                                                                        "retry",
                                                                                        "timeout",
                                                                                        "actor",
                                                                                                "title": "Policy ID",
                                                                                                "type": "string"
                                                                                        },
-                                                                                       "recipe": {
-                                                                                               "title": "Recipe",
-                                                                                               "type": "string",
-                                                                                               "enum": [
-                                                                                                       "Restart",
-                                                                                                       "Rebuild",
-                                                                                                       "Migrate",
-                                                                                                       "Health-Check",
-                                                                                                       "ModifyConfig",
-                                                                                                       "VF Module Create",
-                                                                                                       "VF Module Delete",
-                                                                                                       "Reroute"
-                                                                                               ]
-                                                                                       },
                                                                                        "retry": {
                                                                                                "default": "0",
                                                                                                "title": "Number of Retry",
                                                                                                "format": "number"
                                                                                        },
                                                                                        "actor": {
+                                                                                               "type": "object",
                                                                                                "title": "Actor",
-                                                                                               "type": "string",
-                                                                                               "enum": [
-                                                                                                       "APPC",
-                                                                                                       "SO",
-                                                                                                       "VFC",
-                                                                                                       "SDNC",
-                                                                                                       "SDNR"
+                                                                                               "anyOf": [
+                                                                                                       {
+                                                                                                               "title": "APPC",
+                                                                                                               "properties": {
+                                                                                                                       "actor": {
+                                                                                                                               "title": "actor",
+                                                                                                                               "type": "string",
+                                                                                                                               "default": "APPC",
+                                                                                                                               "options": {
+                                                                                                                                       "hidden": true
+                                                                                                                               }
+                                                                                                                       },
+                                                                                                                       "type": {
+                                                                                                                               "title": "recipe",
+                                                                                                                               "type": "string",
+                                                                                                                               "default": "",
+                                                                                                                               "enum": [
+                                                                                                                                       "Restart",
+                                                                                                                                       "Rebuild",
+                                                                                                                                       "Migrate",
+                                                                                                                                       "Health-Check",
+                                                                                                                                       "ModifyConfig"
+                                                                                                                               ]
+                                                                                                                       },
+                                                                                                                       "payload": {
+                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                               "type": "string",
+                                                                                                                               "format": "textarea"
+                                                                                                                       }
+                                                                                                               }
+                                                                                                       },
+                                                                                                       {
+                                                                                                               "title": "SO",
+                                                                                                               "properties": {
+                                                                                                                       "actor": {
+                                                                                                                               "title": "actor",
+                                                                                                                               "type": "string",
+                                                                                                                               "default": "SO",
+                                                                                                                               "options": {
+                                                                                                                                       "hidden": true
+                                                                                                                               }
+                                                                                                                       },
+                                                                                                                       "type": {
+                                                                                                                               "title": "recipe",
+                                                                                                                               "type": "string",
+                                                                                                                               "default": "",
+                                                                                                                               "enum": [
+                                                                                                                                       "VF Module Create",
+                                                                                                                                       "VF Module Delete"
+                                                                                                                               ]
+                                                                                                                       },
+                                                                                                                       "payload": {
+                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                               "type": "string",
+                                                                                                                               "format": "textarea"
+                                                                                                                       }
+                                                                                                               }
+                                                                                                       },
+                                                                                                       {
+                                                                                                               "title": "SDNC",
+                                                                                                               "properties": {
+                                                                                                                       "actor": {
+                                                                                                                               "title": "actor",
+                                                                                                                               "type": "string",
+                                                                                                                               "default": "SDNC",
+                                                                                                                               "options": {
+                                                                                                                                       "hidden": true
+                                                                                                                               }
+                                                                                                                       },
+                                                                                                                       "type": {
+                                                                                                                               "title": "recipe",
+                                                                                                                               "type": "string",
+                                                                                                                               "default": "",
+                                                                                                                               "enum": [
+                                                                                                                                       "Reroute",
+                                                                                                                                       "BandwidthOnDemand"
+                                                                                                                               ]
+                                                                                                                       },
+                                                                                                                       "payload": {
+                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                               "type": "string",
+                                                                                                                               "format": "textarea"
+                                                                                                                       }
+                                                                                                               }
+                                                                                                       },
+                                                                                                       {
+                                                                                                               "title": "VFC",
+                                                                                                               "properties": {
+                                                                                                                       "actor": {
+                                                                                                                               "title": "actor",
+                                                                                                                               "type": "string",
+                                                                                                                               "default": "VFC",
+                                                                                                                               "options": {
+                                                                                                                                       "hidden": true
+                                                                                                                               }
+                                                                                                                       },
+                                                                                                                       "type": {
+                                                                                                                               "title": "recipe",
+                                                                                                                               "type": "string",
+                                                                                                                               "required": [
+                                                                                                                                       "payload"
+                                                                                                                               ],
+                                                                                                                               "default": "",
+                                                                                                                               "enum": [
+                                                                                                                                       "ModifyConfig"
+                                                                                                                               ]
+                                                                                                                       },
+                                                                                                                       "payload": {
+                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                               "type": "string",
+                                                                                                                               "format": "textarea"
+                                                                                                                       }
+                                                                                                               }
+                                                                                                       },
+                                                                                                       {
+                                                                                                               "title": "CDS",
+                                                                                                               "properties": {
+                                                                                                                       "actor": {
+                                                                                                                               "title": "actor",
+                                                                                                                               "type": "string",
+                                                                                                                               "default": "CDS",
+                                                                                                                               "options": {
+                                                                                                                                       "hidden": true
+                                                                                                                               }
+                                                                                                                       },
+                                                                                                                       "type": {
+                                                                                                                               "title": "recipe",
+                                                                                                                               "type": "object",
+                                                                                                                               "required": [
+                                                                                                                                       "payload"
+                                                                                                                               ],
+                                                                                                                               "anyOf": [
+                                                                                                                                       {
+                                                                                                                                               "title": "user-defined",
+                                                                                                                                               "properties": {
+                                                                                                                                                       "type": {
+                                                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                                                               "type": "string",
+                                                                                                                                                               "format": "textarea"
+                                                                                                                                                       }
+                                                                                                                                               }
+                                                                                                                                       },
+                                                                                                                                       {
+                                                                                                                                               "title": "resource-assignment",
+                                                                                                                                               "properties": {
+                                                                                                                                                       "type": {
+                                                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                                                               "type": "string",
+                                                                                                                                                               "default": "'artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : '\\'{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\''",
+                                                                                                                                                               "format": "textarea"
+                                                                                                                                                       }
+                                                                                                                                               }
+                                                                                                                                       },
+                                                                                                                                       {
+                                                                                                                                               "title": "activate",
+                                                                                                                                               "properties": {
+                                                                                                                                                       "type": {
+                                                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                                                               "type": "string",
+                                                                                                                                                               "default": "'artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : '\\'{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\''",
+                                                                                                                                                               "format": "textarea"
+                                                                                                                                                       }
+                                                                                                                                               }
+                                                                                                                                       },
+                                                                                                                                       {
+                                                                                                                                               "title": "activate-restconf",
+                                                                                                                                               "properties": {
+                                                                                                                                                       "type": {
+                                                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                                                               "type": "string",
+                                                                                                                                                               "default": "'artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : '\\'{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\''",
+                                                                                                                                                               "format": "textarea"
+                                                                                                                                                       }
+                                                                                                                                               }
+                                                                                                                                       },
+                                                                                                                                       {
+                                                                                                                                               "title": "activate-cli",
+                                                                                                                                               "properties": {
+                                                                                                                                                       "type": {
+                                                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                                                               "type": "string",
+                                                                                                                                                               "default": "'artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : '\\'{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\''",
+                                                                                                                                                               "format": "textarea"
+                                                                                                                                                       }
+                                                                                                                                               }
+                                                                                                                                       },
+                                                                                                                                       {
+                                                                                                                                               "title": "assign-activate",
+                                                                                                                                               "properties": {
+                                                                                                                                                       "type": {
+                                                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                                                               "type": "string",
+                                                                                                                                                               "default": "'artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : '\\'{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\''",
+                                                                                                                                                               "format": "textarea"
+                                                                                                                                                       }
+                                                                                                                                               }
+                                                                                                                                       },
+                                                                                                                                       {
+                                                                                                                                               "title": "imperative-test-wf",
+                                                                                                                                               "properties": {
+                                                                                                                                                       "type": {
+                                                                                                                                                               "title": "Payload (YAML)",
+                                                                                                                                                               "type": "string",
+                                                                                                                                                               "default": "'artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : '\\'{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\''",
+                                                                                                                                                               "format": "textarea"
+                                                                                                                                                       }
+                                                                                                                                               }
+                                                                                                                                       }
+                                                                                                                               ]
+                                                                                                                       }
+                                                                                                               }
+                                                                                                       }
                                                                                                ]
                                                                                        },
-                                                                                       "payload": {
-                                                                                               "title": "Payload (YAML)",
-                                                                                               "type": "string",
-                                                                                               "format": "textarea"
-                                                                                       },
                                                                                        "success": {
                                                                                                "default": "final_success",
                                                                                                "title": "When Success",
index ed03842..553a8af 100644 (file)
@@ -14,13 +14,8 @@ topology_template:
           controlLoopName: LOOP_ASJOy_v1_0_ResourceInstanceName1_tca
         policies:
         - id: policy1
-          recipe: Restart
           retry: '0'
           timeout: '0'
-          actor: APPC
-          payload:
-            requestParameters: '{"usePreload":true,"userParams":[]}'
-            configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[10].value","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[15].value","enabled":"$.vf-module-topology.vf-module-parameters.param[22].value"}]'
           success: final_success
           failure: policy2
           failure_timeout: final_failure_timeout
@@ -30,12 +25,14 @@ topology_template:
           target:
             type: VNF
             resourceID: vLoadBalancerMS
+          actor: APPC
+          recipe: Restart
+          payload:
+            requestParameters: '{"usePreload":true,"userParams":[]}'
+            configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[10].value","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[15].value","enabled":"$.vf-module-topology.vf-module-parameters.param[22].value"}]'
         - id: policy2
-          recipe: VF Module Create
           retry: '0'
           timeout: '0'
-          actor: SO
-          payload: ''
           success: final_success
           failure: final_failure
           failure_timeout: final_failure_timeout
@@ -50,3 +47,6 @@ topology_template:
             modelName: Vloadbalancerms..vpkg..module-1
             modelVersion: '1'
             modelCustomizationId: 1bffdc31-a37d-4dee-b65c-dde623a76e52
+          actor: SO
+          recipe: VF Module Create
+          payload: ''
index ac1314e..a2de76a 100644 (file)
@@ -8,12 +8,14 @@
     },
     "policies": [
       {
+        "actor": {
+          "actor": "APPC",
+          "type": "Restart",
+          "payload": "requestParameters: '{\"usePreload\":true,\"userParams\":[]}'\r\nconfigurationParameters: '[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[10].value\",\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[15].value\",\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[22].value\"}]'"
+        },
         "id": "policy1",
-        "recipe": "Restart",
         "retry": "0",
         "timeout": "0",
-        "actor": "APPC",
-        "payload": "requestParameters: '{\"usePreload\":true,\"userParams\":[]}'\r\nconfigurationParameters: '[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[10].value\",\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[15].value\",\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[22].value\"}]'",
         "success": "final_success",
         "failure": "policy2",
         "failure_timeout": "final_failure_timeout",
         }
       },
     {
+        "actor": {
+         "actor": "SO",
+         "type": "VF Module Create",
+         "payload": ""
+        },
         "id": "policy2",
-        "recipe": "VF Module Create",
         "retry": "0",
         "timeout": "0",
-        "actor": "SO",
-        "payload": "",
         "success": "final_success",
         "failure": "final_failure",
         "failure_timeout": "final_failure_timeout",
index 7b53f39..a638c35 100644 (file)
                        "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
                        "version": "1.0",
                        "resourceVendorRelease": "1.0",
-                       "customizationUUID": "465246dc-7748-45f4-a013-308d92922552"
+                       "customizationUUID": "465246dc-7748-45f4-a013-308d92922552",
+                               "controllerProperties": {
+                                       "sdnc_model_name": "baseconfiguration",
+                                       "sdnc_model_version": "1.0.0",
+                                       "workflows": {
+                                               "resource-assignment": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "activate": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "activate-restconf": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "activate-cli": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "assign-activate": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               },
+                                               "imperative-test-wf": {
+                                                       "inputs": {
+                                                               "resource-assignment-properties": {
+                                                                       "request-id": "",
+                                                                       "service-instance-id": "",
+                                                                       "vnf-id": "",
+                                                                       "action-name": "",
+                                                                       "scope-type": "",
+                                                                       "hostname": "",
+                                                                       "vnf_name": ""
+                                                               }
+                                                       }
+                                               } 
+                                }
+               }
                }
        },
        "CR": {