diff options
author | Sébastien Determe <sebastien.determe@intl.att.com> | 2018-10-31 17:55:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-31 17:55:45 +0000 |
commit | b0eb2982ff2abccb178d378d9a6a6c9006559b84 (patch) | |
tree | 1d9b3a057bbfc90644a88e5206e498b5814a825e /src | |
parent | 46da03452820f5467c9ae77198e95a94cbd3b783 (diff) | |
parent | 88f0dc9de3216366af961250bef43fa4e232116d (diff) |
Merge "Fix Payload in policy"
Diffstat (limited to 'src')
3 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java index 2ac51ab46..d6deddc68 100644 --- a/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.Map; import org.onap.clamp.clds.util.JacksonUtils; +import org.yaml.snakeyaml.Yaml; /** * Parse policyConfigurations from Policy json properties. @@ -105,7 +106,16 @@ public class PolicyItem implements Cloneable { String payload = AbstractModelElement.getValueByName(node, "recipePayload"); if (payload != null && !payload.isEmpty()) { - recipePayload = JacksonUtils.getObjectMapperInstance().readValue(payload, new TypeReference<Map<String, String>>(){}); + if (payload.trim().startsWith("{") && payload.trim().endsWith("}")) { + // Seems to be a JSON + recipePayload = JacksonUtils.getObjectMapperInstance().readValue(payload, + new TypeReference<Map<String, String>>() { + }); + } else { + // SHould be a YAML then + Yaml yaml = new Yaml(); + recipePayload = (Map<String, String>) yaml.load(payload); + } } oapRop = AbstractModelElement.getValueByName(node, "oapRop"); oapLimit = AbstractModelElement.getValueByName(node, "oapLimit"); diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html index 5a4600304..331ab5cd1 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html @@ -253,9 +253,9 @@ label { </div> <label for="payload" class="col-sm-4 control-label"> - Payload</label> + Payload (YAML)</label> <div class="col-sm-8"> - <textarea class="form-control" id="recipeInput" name=recipeInput></textarea> + <textarea class="form-control" id="recipePayload" name=recipePayload></textarea> </div> </div> <div class="form-group clearfix"> diff --git a/src/main/resources/clds/templates/globalProperties.json b/src/main/resources/clds/templates/globalProperties.json index b6f68f64c..7cd449f9c 100644 --- a/src/main/resources/clds/templates/globalProperties.json +++ b/src/main/resources/clds/templates/globalProperties.json @@ -49,7 +49,7 @@ "timeout": 345, "actor": { "APPC":"APPC", - "MSO": "SO", + "SO": "SO", "VFC": "VFC" }, "vnfRecipe": { |