From 3b48f829b1325fa6675b8981c119d822a5ea1b13 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Fri, 24 May 2019 12:01:05 +0200 Subject: Fix op policy payload The payload should contain a different content value, not the entire yaml Issue-ID: CLAMP-395 Change-Id: I7311caffed554f3c97ef7e07c729266a4fe30940 Signed-off-by: Determe, Sebastien (sd378r) --- .../org/onap/clamp/policy/operational/OperationalPolicy.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java index 906c3cfa8..2ce5afff9 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java @@ -183,13 +183,20 @@ public class OperationalPolicy implements Serializable, Policy { return (new Yaml()).dump(jsonMap); } + public String createPolicyPayloadYamlLegacy() { + Gson gson = new GsonBuilder().create(); + Map jsonMap = gson.fromJson(gson.toJson(this.configurationsJson.get("operational_policy")), Map.class); + return (new Yaml()).dump(jsonMap); + } + @Override public String createPolicyPayload() throws UnsupportedEncodingException { // Now the Yaml payload must be injected in a json ... JsonObject payload = new JsonObject(); payload.addProperty("policy-id", this.getName()); - payload.addProperty("content", URLEncoder.encode(createPolicyPayloadYaml(), StandardCharsets.UTF_8.toString())); + payload.addProperty("content", + URLEncoder.encode(createPolicyPayloadYamlLegacy(), StandardCharsets.UTF_8.toString())); return new GsonBuilder().setPrettyPrinting().create().toJson(payload); } -- cgit 1.2.3-korg