aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2019-04-09 18:10:32 +0200
committersebdet <sebastien.determe@intl.att.com>2019-04-09 18:10:32 +0200
commiteb71d70552c827e1d8405862f73e8cbd827c6e48 (patch)
tree947b3c8d6bb26f6d966875e285beef883a1ba920 /src/main/java/org/onap
parentfb35c3e3c80bd17308abfd34964e854ad9975342 (diff)
PDP Group support
Add support to push all policies to pdp group + log Issue-ID: CLAMP-303 Change-Id: Ie53b1dfd11ef8db9c2b5ccca0511e6f6343fb70a 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/loop/Loop.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/org/onap/clamp/loop/Loop.java b/src/main/java/org/onap/clamp/loop/Loop.java
index a24d3449f..83f938dde 100644
--- a/src/main/java/org/onap/clamp/loop/Loop.java
+++ b/src/main/java/org/onap/clamp/loop/Loop.java
@@ -23,6 +23,8 @@
package org.onap.clamp.loop;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.annotations.Expose;
@@ -257,6 +259,30 @@ public class Loop implements Serializable {
return buffer.toString().replace('.', '_').replaceAll(" ", "");
}
+ public String createPoliciesPayloadPdpGroup() {
+ JsonObject jsonObject = new JsonObject();
+ JsonArray jsonArray = new JsonArray();
+ jsonObject.add("policies", jsonArray);
+
+ for (OperationalPolicy opPolicy : this.getOperationalPolicies()) {
+ JsonObject policyNode = new JsonObject();
+ jsonArray.add(policyNode);
+ policyNode.addProperty("policy-id", opPolicy.getName());
+
+ for (String guardName : opPolicy.createGuardPolicyPayloads().keySet()) {
+ JsonObject guardPolicyNode = new JsonObject();
+ jsonArray.add(guardPolicyNode);
+ guardPolicyNode.addProperty("policy-id", guardName);
+ }
+ }
+ for (MicroServicePolicy microServicePolicy : this.getMicroServicePolicies()) {
+ JsonObject policyNode = new JsonObject();
+ jsonArray.add(policyNode);
+ policyNode.addProperty("policy-id", microServicePolicy.getName());
+ }
+ return new GsonBuilder().setPrettyPrinting().create().toJson(jsonObject);
+ }
+
@Override
public int hashCode() {
final int prime = 31;