diff options
author | sebdet <sebastien.determe@intl.att.com> | 2018-10-31 18:41:40 +0100 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2018-10-31 18:41:40 +0100 |
commit | 88f0dc9de3216366af961250bef43fa4e232116d (patch) | |
tree | cd9f944e078bf9739f1bc7dc07c1348bde5739b4 /src/main/java/org/onap | |
parent | 626d60b91ebe94bc9de2dfae45b211a7c9bd7687 (diff) |
Fix Payload in policy
Fix payload field in Op Policy, must now be YAML format + fix SO actor
value
Issue-ID: CLAMP-241
Change-Id: Icce97a0c396fb9ae11c98ace66893066494fcf73
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java | 12 |
1 files changed, 11 insertions, 1 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"); |