summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2017-10-10 15:45:46 +0200
committerxg353y <xg353y@intl.att.com>2017-10-11 14:23:29 +0200
commita6c79acde23a0dead6cab4e32cd6934050df07aa (patch)
tree9ff89a80c5587a9e4c4b35994fdcd45f4e9dfdc8 /src/main/java
parent433d254989ecef089586db6b20da1a68891b6e4d (diff)
Update the TCA blueprint format
Change-Id: Ib5b6fe1b46a509bea6c40ebc8ec9058990e5f64d Signed-off-by: xg353y <xg353y@intl.att.com> Issue-ID: CLAMP-59
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/OperationalPolicyReq.java4
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java10
2 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/req/OperationalPolicyReq.java b/src/main/java/org/onap/clamp/clds/client/req/OperationalPolicyReq.java
index 1d345e9ca..a5506da97 100644
--- a/src/main/java/org/onap/clamp/clds/client/req/OperationalPolicyReq.java
+++ b/src/main/java/org/onap/clamp/clds/client/req/OperationalPolicyReq.java
@@ -178,7 +178,7 @@ public class OperationalPolicyReq {
* @throws BuilderException
* @throws UnsupportedEncodingException
*/
- private static String formatYaml(RefProp refProp, ModelProperties prop, String modelElementId,
+ public static String formatYaml(RefProp refProp, ModelProperties prop, String modelElementId,
PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException {
// get property objects
@@ -253,7 +253,7 @@ public class OperationalPolicyReq {
* @throws BuilderException
* @throws UnsupportedEncodingException
*/
- private static String formateNodeBYaml(RefProp refProp, ModelProperties prop, String modelElementId,
+ public static String formateNodeBYaml(RefProp refProp, ModelProperties prop, String modelElementId,
PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException {
// get property objects
diff --git a/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java b/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java
index 3fbf87397..c2590d764 100644
--- a/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java
+++ b/src/main/java/org/onap/clamp/clds/client/req/TcaRequestFormatter.java
@@ -29,6 +29,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.dataformat.yaml.snakeyaml.Yaml;
+import java.util.HashMap;
import java.util.Map;
import org.onap.clamp.clds.exception.TcaRequestFormatterException;
@@ -150,6 +151,15 @@ public class TcaRequestFormatter {
Map<String, Object> loadedYaml = (Map<String, Object>) yaml.load(yamlValue);
Map<String, Object> nodeTemplates = (Map<String, Object>) loadedYaml.get("node_templates");
+ //add policy_0 section in blueprint
+ Map<String, Object> policyObject = new HashMap<String, Object> ();
+ Map<String, Object> policyIdObject = new HashMap<String, Object> ();
+ String policyPrefix = refProp.getStringValue("tca.policyid.prefix");
+ policyIdObject.put("policy_id", policyPrefix + modelProperties.getCurrentPolicyScopeAndPolicyName());
+ policyObject.put("type", "dcae.nodes.policy");
+ policyObject.put("properties", policyIdObject);
+ nodeTemplates.put("policy_0", policyObject);
+
Map<String, Object> tcaObject = (Map<String, Object>) nodeTemplates.get("tca_tca");
Map<String, Object> propsObject = (Map<String, Object>) tcaObject.get("properties");
Map<String, Object> appPreferences = (Map<String, Object>) propsObject.get("app_preferences");