diff options
13 files changed, 1327 insertions, 256 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/CdsServices.java b/src/main/java/org/onap/clamp/clds/client/CdsServices.java index fe1937ab1..f25e8b80f 100644 --- a/src/main/java/org/onap/clamp/clds/client/CdsServices.java +++ b/src/main/java/org/onap/clamp/clds/client/CdsServices.java @@ -136,7 +136,7 @@ public class CdsServices { if (isComplexType(type, dataTypes)) {
inputObject.add(key, handleComplexType(type, dataTypes));
} else {
- inputObject.addProperty(key, "");
+ inputObject.add(key, entry.getValue());
}
}
return inputObject;
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java b/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java index 81e30cf43..ce1f94699 100644 --- a/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java +++ b/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java @@ -26,7 +26,10 @@ package org.onap.clamp.clds.tosca.update.execution.cds; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; + import java.util.Map; +import java.util.Set; + import org.onap.clamp.clds.tosca.update.execution.ToscaMetadataProcess; import org.onap.clamp.loop.service.Service; import org.onap.clamp.tosca.DictionaryService; @@ -58,9 +61,11 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { } private static void generatePayload(JsonObject childObject, Service serviceModel) { - generatePayloadPerResource(childObject, "VF", serviceModel); - generatePayloadPerResource(childObject, "PNF", serviceModel); - addToJsonArray(childObject, "anyOf", createBlankEntry()); + JsonArray schemaAnyOf = new JsonArray(); + schemaAnyOf.addAll(createBlankEntry()); + schemaAnyOf.addAll(generatePayloadPerResource("VF", serviceModel)); + schemaAnyOf.addAll(generatePayloadPerResource("PNF", serviceModel)); + addToJsonArray(childObject, "anyOf", schemaAnyOf); } private static void generateOperation(JsonObject childObject, Service serviceModel) { @@ -92,8 +97,8 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { } - private static void generatePayloadPerResource(JsonObject childObject, String resourceName, - Service serviceModel) { + private static JsonArray generatePayloadPerResource(String resourceName, + Service serviceModel) { JsonArray schemaAnyOf = new JsonArray(); for (Map.Entry<String, JsonElement> entry : serviceModel.getResourceDetails().getAsJsonObject(resourceName) @@ -105,13 +110,14 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { .entrySet()) { JsonObject obj = new JsonObject(); obj.addProperty("title", workflowsEntry.getKey()); - obj.add("properties", createPayloadProperty(workflowsEntry.getValue().getAsJsonObject(), - controllerProperties)); + obj.add("properties", + createInputPropertiesForPayload(workflowsEntry.getValue().getAsJsonObject(), + controllerProperties)); schemaAnyOf.add(obj); } } } - addToJsonArray(childObject, "anyOf", schemaAnyOf); + return schemaAnyOf; } private static JsonArray createBlankEntry() { @@ -123,20 +129,6 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { return result; } - private static JsonObject createPayloadProperty(JsonObject workFlow, JsonObject controllerProperties) { - JsonObject payloadResult = new JsonObject(); - - payloadResult.add("artifact_name", - createAnyOfJsonProperty("artifact_name", controllerProperties.get("sdnc_model_name").getAsString())); - payloadResult.add("artifact_version", - createAnyOfJsonProperty("artifact_version", - controllerProperties.get("sdnc_model_version").getAsString())); - payloadResult.add("mode", createAnyOfJsonProperty("mode", "async")); - - payloadResult.add("data", createAnyOfJsonObject("data", workFlow.getAsJsonObject("inputs"))); - return payloadResult; - } - private static JsonObject createAnyOfJsonProperty(String name, String defaultValue) { JsonObject result = new JsonObject(); result.addProperty("title", name); @@ -157,9 +149,73 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { private static void addToJsonArray(JsonObject childObject, String section, JsonArray value) { if (childObject.getAsJsonArray(section) != null) { childObject.getAsJsonArray(section).addAll(value); - } - else { + } else { childObject.add(section, value); } } + + /** + * Returns the properties of payload based on the cds work flows. + * + * @param workFlow cds work flows to update payload + * @param controllerProperties cds properties to get blueprint name and + * version + * @return returns the properties of payload + */ + public static JsonObject createInputPropertiesForPayload(JsonObject workFlow, + JsonObject controllerProperties) { + String artifactName = controllerProperties.get("sdnc_model_name").getAsString(); + String artifactVersion = controllerProperties.get("sdnc_model_version").getAsString(); + JsonObject inputs = workFlow.getAsJsonObject("inputs"); + JsonObject jsonObject = new JsonObject(); + jsonObject.add("artifact_name", createAnyOfJsonProperty( + "artifact name", artifactName)); + jsonObject.add("artifact_version", createAnyOfJsonProperty( + "artifact version", artifactVersion)); + jsonObject.add("mode", createCdsInputProperty( + "mode", "string", "async")); + jsonObject.add("data", createDataProperty(inputs)); + + return jsonObject; + } + + private static JsonObject createDataProperty(JsonObject inputs) { + JsonObject data = new JsonObject(); + data.addProperty("title", "data"); + data.add("properties", addDataFields(inputs)); + return data; + } + + private static JsonObject addDataFields(JsonObject inputs) { + JsonObject jsonObject = new JsonObject(); + Set<Map.Entry<String, JsonElement>> entrySet = inputs.entrySet(); + for (Map.Entry<String, JsonElement> entry : entrySet) { + String key = entry.getKey(); + JsonObject inputProperty = inputs.getAsJsonObject(key); + if (inputProperty.get("type") == null) { + jsonObject.add(entry.getKey(), + createAnyOfJsonObject(key, + addDataFields(entry.getValue().getAsJsonObject()))); + } else { + jsonObject.add(entry.getKey(), + createCdsInputProperty(key, + inputProperty.get("type").getAsString(), + null)); + } + } + return jsonObject; + } + + private static JsonObject createCdsInputProperty(String title, + String type, + String defaultValue) { + JsonObject property = new JsonObject(); + property.addProperty("title", title); + property.addProperty("type", type); + if (defaultValue != null) { + property.addProperty("default", defaultValue); + } + property.addProperty("format", "textarea"); + return property; + } } diff --git a/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java index 033f2cebb..3765277d8 100644 --- a/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java +++ b/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java @@ -201,11 +201,13 @@ public class LegacyOperationalPolicy { 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); + policy.getAsJsonObject().addProperty(RECIPE, getRecipe(actor)); + addCdsPayloadAttributes(actor.getAsJsonObject(RECIPE), policy); } else { + policy.getAsJsonObject().addProperty(RECIPE, + actor.getAsJsonObject().get(RECIPE).getAsString()); addPayloadAttributes(actor, policy); } } @@ -226,7 +228,20 @@ public class LegacyOperationalPolicy { } } + private static void addCdsPayloadAttributes(JsonObject jsonObject, + JsonElement policy) { + JsonElement payloadElem = jsonObject.getAsJsonObject().get(PAYLOAD); + JsonObject payloadObject = payloadElem != null ? + payloadElem.getAsJsonObject() : null; + if (payloadObject != null) { + policy.getAsJsonObject().add(PAYLOAD, + payloadObject); + } else { + policy.getAsJsonObject().addProperty(PAYLOAD, ""); + } + } + private static String getRecipe(JsonObject actor) { - return actor.getAsJsonObject().get("type").getAsString(); + return actor.getAsJsonObject().get("recipe").getAsJsonObject().get("recipe").getAsString(); } } diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java index 44ee11970..4e362d841 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java @@ -24,13 +24,17 @@ package org.onap.clamp.policy.operational; +import static org.onap.clamp.clds.tosca.update.execution.cds.ToscaMetadataCdsProcess.createInputPropertiesForPayload; + import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; + import java.io.IOException; import java.util.Map.Entry; + import org.onap.clamp.clds.util.JsonUtils; import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.clamp.loop.service.Service; @@ -70,7 +74,7 @@ public class OperationalPolicyRepresentationBuilder { for (JsonElement actor : actors) { if ("CDS".equalsIgnoreCase(actor.getAsJsonObject().get("title").getAsString())) { - actor.getAsJsonObject().get("properties").getAsJsonObject().get("type").getAsJsonObject() + actor.getAsJsonObject().get("properties").getAsJsonObject().get("recipe").getAsJsonObject() .get("anyOf").getAsJsonArray() .addAll(createAnyOfArrayForCdsRecipe(modelJson)); } @@ -195,8 +199,9 @@ public class OperationalPolicyRepresentationBuilder { for (Entry<String, JsonElement> workflowsEntry : workflows.entrySet()) { JsonObject obj = new JsonObject(); obj.addProperty("title", workflowsEntry.getKey()); + obj.addProperty("type", "object"); obj.add("properties", createPayloadProperty(workflowsEntry.getValue().getAsJsonObject(), - controllerProperties)); + controllerProperties, workflowsEntry.getKey())); schemaArray.add(obj); } @@ -205,26 +210,27 @@ public class OperationalPolicyRepresentationBuilder { 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"); + private static JsonObject createPayloadProperty(JsonObject workFlow, + JsonObject controllerProperties, String workFlowName) { + JsonObject payload = new JsonObject(); + payload.addProperty("title", "Payload (YAML)"); + payload.addProperty("type", "object"); + payload.add("properties", createInputPropertiesForPayload(workFlow, + controllerProperties)); JsonObject properties = new JsonObject(); - properties.add("type", type); + properties.add("recipe", createRecipeForCdsWorkflow(workFlowName)); + properties.add("payload", payload); 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(); + private static JsonObject createRecipeForCdsWorkflow(String workflow) { + JsonObject recipe = new JsonObject(); + recipe.addProperty("title", "recipe"); + recipe.addProperty("type", "string"); + recipe.addProperty("default", workflow); + JsonObject options = new JsonObject(); + options.addProperty("hidden", true); + recipe.add("options", options); + return recipe; } } diff --git a/src/main/resources/clds/json-schema/operational_policies/operational_policy.json b/src/main/resources/clds/json-schema/operational_policies/operational_policy.json index 49d7878a8..7214b022c 100644 --- a/src/main/resources/clds/json-schema/operational_policies/operational_policy.json +++ b/src/main/resources/clds/json-schema/operational_policies/operational_policy.json @@ -99,6 +99,7 @@ "anyOf": [ { "title": "APPC", + "type": "object", "properties": { "actor": { "title": "actor", @@ -108,7 +109,7 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "string", "default": "", @@ -129,6 +130,7 @@ }, { "title": "SO", + "type": "object", "properties": { "actor": { "title": "actor", @@ -138,7 +140,7 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "string", "default": "", @@ -156,6 +158,7 @@ }, { "title": "SDNC", + "type": "object", "properties": { "actor": { "title": "actor", @@ -165,7 +168,7 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "string", "default": "", @@ -183,6 +186,7 @@ }, { "title": "VFC", + "type": "object", "properties": { "actor": { "title": "actor", @@ -192,12 +196,9 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "string", - "required": [ - "payload" - ], "default": "", "enum": [ "ModifyConfig" @@ -212,6 +213,7 @@ }, { "title": "CDS", + "type": "object", "properties": { "actor": { "title": "actor", @@ -221,17 +223,21 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "object", - "required": [ - "payload" - ], "anyOf": [ { "title": "user-defined", + "type": "object", "properties": { - "type": { + "recipe": { + "title": "recipe", + "type": "string", + "default": "user-defined", + "format": "textarea" + }, + "payload": { "title": "Payload (YAML)", "type": "string", "default": "", diff --git a/src/test/resources/tosca/model-properties.json b/src/test/resources/tosca/model-properties.json index c405964ee..688a09ab4 100644 --- a/src/test/resources/tosca/model-properties.json +++ b/src/test/resources/tosca/model-properties.json @@ -40,78 +40,204 @@ "resource-assignment": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "activate": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "activate-restconf": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "activate-cli": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "assign-activate": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "imperative-test-wf": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } } diff --git a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json index 58dff236e..12edd7738 100644 --- a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json +++ b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json @@ -66,16 +66,20 @@ "description": "Name/value pairs of payload information passed by Policy to the actor", "anyOf": [ { + "title": "User defined", + "properties": {} + }, + { "title": "resource-assignment", "properties": { "artifact_name": { - "title": "artifact_name", + "title": "artifact name", "type": "string", "default": "baseconfiguration", "readOnly": "True" }, "artifact_version": { - "title": "artifact_version", + "title": "artifact version", "type": "string", "default": "1.0.0", "readOnly": "True" @@ -84,20 +88,51 @@ "title": "mode", "type": "string", "default": "async", - "readOnly": "True" + "format": "textarea" }, "data": { "title": "data", - "type": "object", "properties": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } } } } @@ -107,13 +142,13 @@ "title": "activate", "properties": { "artifact_name": { - "title": "artifact_name", + "title": "artifact name", "type": "string", "default": "baseconfiguration", "readOnly": "True" }, "artifact_version": { - "title": "artifact_version", + "title": "artifact version", "type": "string", "default": "1.0.0", "readOnly": "True" @@ -122,20 +157,51 @@ "title": "mode", "type": "string", "default": "async", - "readOnly": "True" + "format": "textarea" }, "data": { "title": "data", - "type": "object", "properties": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } } } } @@ -145,13 +211,13 @@ "title": "activate-restconf", "properties": { "artifact_name": { - "title": "artifact_name", + "title": "artifact name", "type": "string", "default": "baseconfiguration", "readOnly": "True" }, "artifact_version": { - "title": "artifact_version", + "title": "artifact version", "type": "string", "default": "1.0.0", "readOnly": "True" @@ -160,20 +226,51 @@ "title": "mode", "type": "string", "default": "async", - "readOnly": "True" + "format": "textarea" }, "data": { "title": "data", - "type": "object", "properties": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } } } } @@ -183,13 +280,13 @@ "title": "activate-cli", "properties": { "artifact_name": { - "title": "artifact_name", + "title": "artifact name", "type": "string", "default": "baseconfiguration", "readOnly": "True" }, "artifact_version": { - "title": "artifact_version", + "title": "artifact version", "type": "string", "default": "1.0.0", "readOnly": "True" @@ -198,20 +295,51 @@ "title": "mode", "type": "string", "default": "async", - "readOnly": "True" + "format": "textarea" }, "data": { "title": "data", - "type": "object", "properties": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } } } } @@ -221,13 +349,13 @@ "title": "assign-activate", "properties": { "artifact_name": { - "title": "artifact_name", + "title": "artifact name", "type": "string", "default": "baseconfiguration", "readOnly": "True" }, "artifact_version": { - "title": "artifact_version", + "title": "artifact version", "type": "string", "default": "1.0.0", "readOnly": "True" @@ -236,20 +364,51 @@ "title": "mode", "type": "string", "default": "async", - "readOnly": "True" + "format": "textarea" }, "data": { "title": "data", - "type": "object", "properties": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } } } } @@ -259,13 +418,13 @@ "title": "imperative-test-wf", "properties": { "artifact_name": { - "title": "artifact_name", + "title": "artifact name", "type": "string", "default": "baseconfiguration", "readOnly": "True" }, "artifact_version": { - "title": "artifact_version", + "title": "artifact version", "type": "string", "default": "1.0.0", "readOnly": "True" @@ -274,28 +433,55 @@ "title": "mode", "type": "string", "default": "async", - "readOnly": "True" + "format": "textarea" }, "data": { "title": "data", - "type": "object", "properties": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } } } } } - }, - { - "title": "User defined", - "properties": {} } ] }, diff --git a/src/test/resources/tosca/operational-policy-json-schema.json b/src/test/resources/tosca/operational-policy-json-schema.json index 6ab84a8cf..ffa88ecaf 100644 --- a/src/test/resources/tosca/operational-policy-json-schema.json +++ b/src/test/resources/tosca/operational-policy-json-schema.json @@ -99,6 +99,7 @@ "anyOf": [ { "title": "APPC", + "type": "object", "properties": { "actor": { "title": "actor", @@ -108,7 +109,7 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "string", "default": "", @@ -129,6 +130,7 @@ }, { "title": "SO", + "type": "object", "properties": { "actor": { "title": "actor", @@ -138,7 +140,7 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "string", "default": "", @@ -156,6 +158,7 @@ }, { "title": "SDNC", + "type": "object", "properties": { "actor": { "title": "actor", @@ -165,7 +168,7 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "string", "default": "", @@ -183,6 +186,7 @@ }, { "title": "VFC", + "type": "object", "properties": { "actor": { "title": "actor", @@ -192,12 +196,9 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "string", - "required": [ - "payload" - ], "default": "", "enum": [ "ModifyConfig" @@ -212,6 +213,7 @@ }, { "title": "CDS", + "type": "object", "properties": { "actor": { "title": "actor", @@ -221,17 +223,21 @@ "hidden": true } }, - "type": { + "recipe": { "title": "recipe", "type": "object", - "required": [ - "payload" - ], "anyOf": [ { "title": "user-defined", + "type": "object", "properties": { - "type": { + "recipe": { + "title": "recipe", + "type": "string", + "default": "user-defined", + "format": "textarea" + }, + "payload": { "title": "Payload (YAML)", "type": "string", "default": "", @@ -241,67 +247,505 @@ }, { "title": "resource-assignment", + "type": "object", "properties": { - "type": { - "title": "Payload (YAML)", + "recipe": { + "title": "recipe", "type": "string", - "default": "\u0027artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : \u0027\\\u0027{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\\u0027\u0027", - "format": "textarea" + "default": "resource-assignment", + "options": { + "hidden": true + } + }, + "payload": { + "title": "Payload (YAML)", + "type": "object", + "properties": { + "artifact_name": { + "title": "artifact name", + "type": "string", + "default": "baseconfiguration", + "readOnly": "True" + }, + "artifact_version": { + "title": "artifact version", + "type": "string", + "default": "1.0.0", + "readOnly": "True" + }, + "mode": { + "title": "mode", + "type": "string", + "default": "async", + "format": "textarea" + }, + "data": { + "title": "data", + "properties": { + "resource-assignment-properties": { + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } + } + } + } + } } } }, { "title": "activate", + "type": "object", "properties": { - "type": { - "title": "Payload (YAML)", + "recipe": { + "title": "recipe", "type": "string", - "default": "\u0027artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : \u0027\\\u0027{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\\u0027\u0027", - "format": "textarea" + "default": "activate", + "options": { + "hidden": true + } + }, + "payload": { + "title": "Payload (YAML)", + "type": "object", + "properties": { + "artifact_name": { + "title": "artifact name", + "type": "string", + "default": "baseconfiguration", + "readOnly": "True" + }, + "artifact_version": { + "title": "artifact version", + "type": "string", + "default": "1.0.0", + "readOnly": "True" + }, + "mode": { + "title": "mode", + "type": "string", + "default": "async", + "format": "textarea" + }, + "data": { + "title": "data", + "properties": { + "resource-assignment-properties": { + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } + } + } + } + } } } }, { "title": "activate-restconf", + "type": "object", "properties": { - "type": { - "title": "Payload (YAML)", + "recipe": { + "title": "recipe", "type": "string", - "default": "\u0027artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : \u0027\\\u0027{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\\u0027\u0027", - "format": "textarea" + "default": "activate-restconf", + "options": { + "hidden": true + } + }, + "payload": { + "title": "Payload (YAML)", + "type": "object", + "properties": { + "artifact_name": { + "title": "artifact name", + "type": "string", + "default": "baseconfiguration", + "readOnly": "True" + }, + "artifact_version": { + "title": "artifact version", + "type": "string", + "default": "1.0.0", + "readOnly": "True" + }, + "mode": { + "title": "mode", + "type": "string", + "default": "async", + "format": "textarea" + }, + "data": { + "title": "data", + "properties": { + "resource-assignment-properties": { + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } + } + } + } + } } } }, { "title": "activate-cli", + "type": "object", "properties": { - "type": { - "title": "Payload (YAML)", + "recipe": { + "title": "recipe", "type": "string", - "default": "\u0027artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : \u0027\\\u0027{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\\u0027\u0027", - "format": "textarea" + "default": "activate-cli", + "options": { + "hidden": true + } + }, + "payload": { + "title": "Payload (YAML)", + "type": "object", + "properties": { + "artifact_name": { + "title": "artifact name", + "type": "string", + "default": "baseconfiguration", + "readOnly": "True" + }, + "artifact_version": { + "title": "artifact version", + "type": "string", + "default": "1.0.0", + "readOnly": "True" + }, + "mode": { + "title": "mode", + "type": "string", + "default": "async", + "format": "textarea" + }, + "data": { + "title": "data", + "properties": { + "resource-assignment-properties": { + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } + } + } + } + } } } }, { "title": "assign-activate", + "type": "object", "properties": { - "type": { - "title": "Payload (YAML)", + "recipe": { + "title": "recipe", "type": "string", - "default": "\u0027artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : \u0027\\\u0027{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\\u0027\u0027", - "format": "textarea" + "default": "assign-activate", + "options": { + "hidden": true + } + }, + "payload": { + "title": "Payload (YAML)", + "type": "object", + "properties": { + "artifact_name": { + "title": "artifact name", + "type": "string", + "default": "baseconfiguration", + "readOnly": "True" + }, + "artifact_version": { + "title": "artifact version", + "type": "string", + "default": "1.0.0", + "readOnly": "True" + }, + "mode": { + "title": "mode", + "type": "string", + "default": "async", + "format": "textarea" + }, + "data": { + "title": "data", + "properties": { + "resource-assignment-properties": { + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } + } + } + } + } } } }, { "title": "imperative-test-wf", + "type": "object", "properties": { - "type": { - "title": "Payload (YAML)", + "recipe": { + "title": "recipe", "type": "string", - "default": "\u0027artifact_name : \"baseconfiguration\"\nartifact_version : \"1.0.0\"\nmode : async\ndata : \u0027\\\u0027{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"vnf-id\":\"\",\"action-name\":\"\",\"scope-type\":\"\",\"hostname\":\"\",\"vnf_name\":\"\"}}\\\u0027\u0027", - "format": "textarea" + "default": "imperative-test-wf", + "options": { + "hidden": true + } + }, + "payload": { + "title": "Payload (YAML)", + "type": "object", + "properties": { + "artifact_name": { + "title": "artifact name", + "type": "string", + "default": "baseconfiguration", + "readOnly": "True" + }, + "artifact_version": { + "title": "artifact version", + "type": "string", + "default": "1.0.0", + "readOnly": "True" + }, + "mode": { + "title": "mode", + "type": "string", + "default": "async", + "format": "textarea" + }, + "data": { + "title": "data", + "properties": { + "resource-assignment-properties": { + "title": "resource-assignment-properties", + "type": "object", + "properties": { + "request-id": { + "title": "request-id", + "type": "string", + "format": "textarea" + }, + "service-instance-id": { + "title": "service-instance-id", + "type": "string", + "format": "textarea" + }, + "vnf-id": { + "title": "vnf-id", + "type": "string", + "format": "textarea" + }, + "action-name": { + "title": "action-name", + "type": "string", + "format": "textarea" + }, + "scope-type": { + "title": "scope-type", + "type": "string", + "format": "textarea" + }, + "hostname": { + "title": "hostname", + "type": "string", + "format": "textarea" + }, + "vnf_name": { + "title": "vnf_name", + "type": "string", + "format": "textarea" + } + } + } + } + } + } } } } @@ -731,4 +1175,4 @@ } } } -}
\ No newline at end of file +} diff --git a/src/test/resources/tosca/operational-policy-payload-legacy.yaml b/src/test/resources/tosca/operational-policy-payload-legacy.yaml index f4708ebc3..72bbf9bad 100644 --- a/src/test/resources/tosca/operational-policy-payload-legacy.yaml +++ b/src/test/resources/tosca/operational-policy-payload-legacy.yaml @@ -40,3 +40,35 @@ policies: resourceID: Vloadbalancerms..vpkg..module-1 type: VFMODULE timeout: 0 +- actor: CDS + failure: final_failure + failure_exception: final_failure_exception + failure_guard: final_failure_guard + failure_retries: final_failure_retries + failure_timeout: final_failure_timeout + id: policy3 + payload: + artifact_name: baseconfiguration + artifact_version: 1.0.0 + data: + resource-assignment-properties: + action-name: action-name + hostname: hostname + request-id: request-id + scope-type: scope-type + service-instance-id: service-instance-id + vnf-id: vnf-id + vnf_name: vnf_name + mode: async + recipe: resource-assignment + retry: 0 + success: final_success + target: + modelCustomizationId: 1bffdc31-a37d-4dee-b65c-dde623a76e52 + modelInvariantId: ca052563-eb92-4b5b-ad41-9111768ce043 + modelName: Vloadbalancerms..vpkg..module-1 + modelVersion: 1 + modelVersionId: 1e725ccc-b823-4f67-82b9-4f4367070dbc + resourceID: Vloadbalancerms..vpkg..module-1 + type: VFMODULE + timeout: 0 diff --git a/src/test/resources/tosca/operational-policy-payload.json b/src/test/resources/tosca/operational-policy-payload.json index 033eecd17..e53950af3 100644 --- a/src/test/resources/tosca/operational-policy-payload.json +++ b/src/test/resources/tosca/operational-policy-payload.json @@ -1,4 +1,4 @@ { "policy-id": "testPolicy.legacy", - "content": "controlLoop%3A%0A++abatement%3A+true%0A++controlLoopName%3A+LOOP_ASJOy_v1_0_ResourceInstanceName1_tca%0A++timeout%3A+0%0A++trigger_policy%3A+policy1%0Apolicies%3A%0A-+actor%3A+APPC%0A++failure%3A+policy2%0A++failure_exception%3A+final_failure_exception%0A++failure_guard%3A+final_failure_guard%0A++failure_retries%3A+final_failure_retries%0A++failure_timeout%3A+final_failure_timeout%0A++id%3A+policy1%0A++payload%3A%0A++++configurationParameters%3A+%27%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B10%5D.value%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B15%5D.value%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B22%5D.value%22%7D%5D%27%0A++++requestParameters%3A+%27%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D%27%0A++recipe%3A+Restart%0A++retry%3A+0%0A++success%3A+final_success%0A++target%3A%0A++++resourceID%3A+vLoadBalancerMS%0A++++type%3A+VNF%0A++timeout%3A+0%0A-+actor%3A+SO%0A++failure%3A+final_failure%0A++failure_exception%3A+final_failure_exception%0A++failure_guard%3A+final_failure_guard%0A++failure_retries%3A+final_failure_retries%0A++failure_timeout%3A+final_failure_timeout%0A++id%3A+policy2%0A++recipe%3A+VF+Module+Create%0A++retry%3A+0%0A++success%3A+final_success%0A++target%3A%0A++++modelCustomizationId%3A+1bffdc31-a37d-4dee-b65c-dde623a76e52%0A++++modelInvariantId%3A+ca052563-eb92-4b5b-ad41-9111768ce043%0A++++modelName%3A+Vloadbalancerms..vpkg..module-1%0A++++modelVersion%3A+1%0A++++modelVersionId%3A+1e725ccc-b823-4f67-82b9-4f4367070dbc%0A++++resourceID%3A+Vloadbalancerms..vpkg..module-1%0A++++type%3A+VFMODULE%0A++timeout%3A+0%0A" + "content": "controlLoop%3A%0A++abatement%3A+true%0A++controlLoopName%3A+LOOP_ASJOy_v1_0_ResourceInstanceName1_tca%0A++timeout%3A+0%0A++trigger_policy%3A+policy1%0Apolicies%3A%0A-+actor%3A+APPC%0A++failure%3A+policy2%0A++failure_exception%3A+final_failure_exception%0A++failure_guard%3A+final_failure_guard%0A++failure_retries%3A+final_failure_retries%0A++failure_timeout%3A+final_failure_timeout%0A++id%3A+policy1%0A++payload%3A%0A++++configurationParameters%3A+%27%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B10%5D.value%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B15%5D.value%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B22%5D.value%22%7D%5D%27%0A++++requestParameters%3A+%27%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D%27%0A++recipe%3A+Restart%0A++retry%3A+0%0A++success%3A+final_success%0A++target%3A%0A++++resourceID%3A+vLoadBalancerMS%0A++++type%3A+VNF%0A++timeout%3A+0%0A-+actor%3A+SO%0A++failure%3A+final_failure%0A++failure_exception%3A+final_failure_exception%0A++failure_guard%3A+final_failure_guard%0A++failure_retries%3A+final_failure_retries%0A++failure_timeout%3A+final_failure_timeout%0A++id%3A+policy2%0A++recipe%3A+VF+Module+Create%0A++retry%3A+0%0A++success%3A+final_success%0A++target%3A%0A++++modelCustomizationId%3A+1bffdc31-a37d-4dee-b65c-dde623a76e52%0A++++modelInvariantId%3A+ca052563-eb92-4b5b-ad41-9111768ce043%0A++++modelName%3A+Vloadbalancerms..vpkg..module-1%0A++++modelVersion%3A+1%0A++++modelVersionId%3A+1e725ccc-b823-4f67-82b9-4f4367070dbc%0A++++resourceID%3A+Vloadbalancerms..vpkg..module-1%0A++++type%3A+VFMODULE%0A++timeout%3A+0%0A-+actor%3A+CDS%0A++failure%3A+final_failure%0A++failure_exception%3A+final_failure_exception%0A++failure_guard%3A+final_failure_guard%0A++failure_retries%3A+final_failure_retries%0A++failure_timeout%3A+final_failure_timeout%0A++id%3A+policy3%0A++payload%3A%0A++++artifact_name%3A+baseconfiguration%0A++++artifact_version%3A+1.0.0%0A++++data%3A%0A++++++resource-assignment-properties%3A%0A++++++++action-name%3A+action-name%0A++++++++hostname%3A+hostname%0A++++++++request-id%3A+request-id%0A++++++++scope-type%3A+scope-type%0A++++++++service-instance-id%3A+service-instance-id%0A++++++++vnf-id%3A+vnf-id%0A++++++++vnf_name%3A+vnf_name%0A++++mode%3A+async%0A++recipe%3A+resource-assignment%0A++retry%3A+0%0A++success%3A+final_success%0A++target%3A%0A++++modelCustomizationId%3A+1bffdc31-a37d-4dee-b65c-dde623a76e52%0A++++modelInvariantId%3A+ca052563-eb92-4b5b-ad41-9111768ce043%0A++++modelName%3A+Vloadbalancerms..vpkg..module-1%0A++++modelVersion%3A+1%0A++++modelVersionId%3A+1e725ccc-b823-4f67-82b9-4f4367070dbc%0A++++resourceID%3A+Vloadbalancerms..vpkg..module-1%0A++++type%3A+VFMODULE%0A++timeout%3A+0%0A" }
\ No newline at end of file diff --git a/src/test/resources/tosca/operational-policy-payload.yaml b/src/test/resources/tosca/operational-policy-payload.yaml index 69c86cc84..aaa962769 100644 --- a/src/test/resources/tosca/operational-policy-payload.yaml +++ b/src/test/resources/tosca/operational-policy-payload.yaml @@ -50,3 +50,35 @@ topology_template: actor: SO recipe: VF Module Create payload: '' + - id: policy3 + retry: '0' + timeout: '0' + success: final_success + failure: final_failure + failure_timeout: final_failure_timeout + failure_retries: final_failure_retries + failure_exception: final_failure_exception + failure_guard: final_failure_guard + target: + type: VFMODULE + resourceID: Vloadbalancerms..vpkg..module-1 + modelInvariantId: ca052563-eb92-4b5b-ad41-9111768ce043 + modelVersionId: 1e725ccc-b823-4f67-82b9-4f4367070dbc + modelName: Vloadbalancerms..vpkg..module-1 + modelVersion: '1' + modelCustomizationId: 1bffdc31-a37d-4dee-b65c-dde623a76e52 + actor: CDS + recipe: resource-assignment + payload: + artifact_name: baseconfiguration + artifact_version: 1.0.0 + mode: async + data: + resource-assignment-properties: + request-id: request-id + service-instance-id: service-instance-id + vnf-id: vnf-id + action-name: action-name + scope-type: scope-type + hostname: hostname + vnf_name: vnf_name diff --git a/src/test/resources/tosca/operational-policy-properties.json b/src/test/resources/tosca/operational-policy-properties.json index a2de76a98..2777a158c 100644 --- a/src/test/resources/tosca/operational-policy-properties.json +++ b/src/test/resources/tosca/operational-policy-properties.json @@ -10,7 +10,7 @@ { "actor": { "actor": "APPC", - "type": "Restart", + "recipe": "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", @@ -27,11 +27,11 @@ "resourceID": "vLoadBalancerMS" } }, - { + { "actor": { - "actor": "SO", - "type": "VF Module Create", - "payload": "" + "actor": "SO", + "recipe": "VF Module Create", + "payload": "" }, "id": "policy2", "retry": "0", @@ -51,6 +51,48 @@ "modelVersion": "1", "modelCustomizationId": "1bffdc31-a37d-4dee-b65c-dde623a76e52" } + }, + { + "actor": { + "actor": "CDS", + "recipe": { + "recipe": "resource-assignment", + "payload": { + "artifact_name": "baseconfiguration", + "artifact_version": "1.0.0", + "mode": "async", + "data": { + "resource-assignment-properties": { + "request-id": "request-id", + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id", + "action-name": "action-name", + "scope-type": "scope-type", + "hostname": "hostname", + "vnf_name": "vnf_name" + } + } + } + } + }, + "id": "policy3", + "retry": "0", + "timeout": "0", + "success": "final_success", + "failure": "final_failure", + "failure_timeout": "final_failure_timeout", + "failure_retries": "final_failure_retries", + "failure_exception": "final_failure_exception", + "failure_guard": "final_failure_guard", + "target": { + "type": "VFMODULE", + "resourceID": "Vloadbalancerms..vpkg..module-1", + "modelInvariantId": "ca052563-eb92-4b5b-ad41-9111768ce043", + "modelVersionId": "1e725ccc-b823-4f67-82b9-4f4367070dbc", + "modelName": "Vloadbalancerms..vpkg..module-1", + "modelVersion": "1", + "modelCustomizationId": "1bffdc31-a37d-4dee-b65c-dde623a76e52" + } } ] }, diff --git a/src/test/resources/tosca/resource-details.json b/src/test/resources/tosca/resource-details.json index a638c350d..dc47b44db 100644 --- a/src/test/resources/tosca/resource-details.json +++ b/src/test/resources/tosca/resource-details.json @@ -24,78 +24,204 @@ "resource-assignment": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "activate": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "activate-restconf": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "activate-cli": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "assign-activate": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } }, "imperative-test-wf": { "inputs": { "resource-assignment-properties": { - "request-id": "", - "service-instance-id": "", - "vnf-id": "", - "action-name": "", - "scope-type": "", - "hostname": "", - "vnf_name": "" + "request-id": { + "type": "string", + "required": true + }, + "service-instance-id": { + "type": "string", + "required": true + }, + "vnf-id": { + "type": "string", + "required": true + }, + "action-name": { + "type": "string", + "required": true + }, + "scope-type": { + "type": "string", + "required": true + }, + "hostname": { + "type": "string", + "required": true + }, + "vnf_name": { + "type": "string", + "required": true + } } } } |