aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml13
-rw-r--r--src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java3
-rw-r--r--src/main/java/org/onap/clamp/loop/Loop.java10
-rw-r--r--src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java10
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java150
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java35
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java13
-rw-r--r--src/test/resources/tosca/operational-policy-payload-legacy.yaml52
-rw-r--r--src/test/resources/tosca/operational-policy-payload.json2
-rw-r--r--src/test/resources/tosca/operational-policy-payload.yaml25
-rw-r--r--src/test/resources/tosca/operational-policy-properties.json4
11 files changed, 272 insertions, 45 deletions
diff --git a/pom.xml b/pom.xml
index a39373bb..4fdbea37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -922,6 +922,19 @@
</executions>
</plugin>
<plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.7</version>
+ <extensions>true</extensions>
+ <configuration>
+ <nexusUrl>https://nexus.onap.org</nexusUrl>
+ <stagingProfileId>176c31dfe190a</stagingProfileId>
+ <serverId>ecomp-staging</serverId>
+ <skipNexusStagingDeployMojo>${skip.staging.artifacts}</skipNexusStagingDeployMojo>
+ </configuration>
+ </plugin>
+
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
diff --git a/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java b/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java
index de6e4dcd..3dc80738 100644
--- a/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java
@@ -118,8 +118,7 @@ public class CamelConfiguration extends RouteBuilder {
.apiContextPath("api-doc").apiVendorExtension(true).apiProperty("api.title", "Clamp Rest API")
.apiProperty("api.version", ClampVersioning.getCldsVersionFromProps())
.apiProperty("base.path", "/restservices/clds/");
- // .apiProperty("cors", "true");
- camelContext.setTracing(true);
+ // camelContext.setTracing(true);
configureDefaultSslProperties();
registerTrustStore();
diff --git a/src/main/java/org/onap/clamp/loop/Loop.java b/src/main/java/org/onap/clamp/loop/Loop.java
index 89770860..6de2863e 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.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
@@ -47,6 +49,7 @@ import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
+import javax.persistence.Transient;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
@@ -66,6 +69,9 @@ public class Loop implements Serializable {
*/
private static final long serialVersionUID = -286522707701388642L;
+ @Transient
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(Loop.class);
+
@Id
@Expose
@Column(nullable = false, name = "name", unique = true)
@@ -279,7 +285,9 @@ public class Loop implements Serializable {
jsonArray.add(policyNode);
policyNode.addProperty("policy-id", policyName);
}
- return new GsonBuilder().setPrettyPrinting().create().toJson(jsonObject);
+ String payload = new GsonBuilder().setPrettyPrinting().create().toJson(jsonObject);
+ logger.info("PdpGroup policy payload: " + payload);
+ return payload;
}
/**
diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
index 2bbb9118..d8d15a5b 100644
--- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
+++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
@@ -23,6 +23,8 @@
package org.onap.clamp.policy.microservice;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
@@ -40,6 +42,7 @@ import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
+import javax.persistence.Transient;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
@@ -61,6 +64,9 @@ public class MicroServicePolicy implements Serializable, Policy {
*/
private static final long serialVersionUID = 6271238288583332616L;
+ @Transient
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(MicroServicePolicy.class);
+
@Expose
@Id
@Column(nullable = false, name = "name", unique = true)
@@ -271,7 +277,9 @@ public class MicroServicePolicy implements Serializable, Policy {
JsonObject policyProperties = new JsonObject();
policyDetails.add("properties", policyProperties);
policyProperties.add(this.getMicroServicePropertyNameFromTosca(toscaJson), this.getProperties());
- return new GsonBuilder().setPrettyPrinting().create().toJson(policyPayloadResult);
+ String policyPayload = new GsonBuilder().setPrettyPrinting().create().toJson(policyPayloadResult);
+ logger.info("Micro service policy payload: " + policyPayload);
+ return policyPayload;
}
}
diff --git a/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java
new file mode 100644
index 00000000..33148f0b
--- /dev/null
+++ b/src/main/java/org/onap/clamp/policy/operational/LegacyOperationalPolicy.java
@@ -0,0 +1,150 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.policy.operational;
+
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonElement;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.apache.commons.lang3.math.NumberUtils;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.DumperOptions.ScalarStyle;
+import org.yaml.snakeyaml.Yaml;
+
+/**
+ *
+ * This class contains the code required to support the sending of Legacy
+ * operational payload to policy engine. This will probably disappear in El
+ * Alto.
+ *
+ */
+public class LegacyOperationalPolicy {
+
+ private LegacyOperationalPolicy() {
+
+ }
+
+ private static void translateStringValues(String jsonKey, String stringValue, JsonElement parentJsonElement) {
+ if (stringValue.equalsIgnoreCase("true") || stringValue.equalsIgnoreCase("false")) {
+ parentJsonElement.getAsJsonObject().addProperty(jsonKey, Boolean.valueOf(stringValue));
+
+ } else if (NumberUtils.isParsable(stringValue)) {
+ parentJsonElement.getAsJsonObject().addProperty(jsonKey, Long.parseLong(stringValue));
+ }
+ }
+
+ private static JsonElement removeAllQuotes(JsonElement jsonElement) {
+ if (jsonElement.isJsonArray()) {
+ for (JsonElement element : jsonElement.getAsJsonArray()) {
+ removeAllQuotes(element);
+ }
+ } else if (jsonElement.isJsonObject()) {
+ for (Entry<String, JsonElement> entry : jsonElement.getAsJsonObject().entrySet()) {
+ if (entry.getValue().isJsonPrimitive() && entry.getValue().getAsJsonPrimitive().isString()) {
+ translateStringValues(entry.getKey(), entry.getValue().getAsString(), jsonElement);
+ } else {
+ removeAllQuotes(entry.getValue());
+ }
+ }
+ }
+ return jsonElement;
+ }
+
+ public static JsonElement reworkPayloadAttributes(JsonElement policyJson) {
+ for (JsonElement policy : policyJson.getAsJsonObject().get("policies").getAsJsonArray()) {
+ JsonElement payloadElem = policy.getAsJsonObject().get("payload");
+ String payloadString = payloadElem != null ? payloadElem.getAsString() : "";
+ if (!payloadString.isEmpty()) {
+ Map<String, String> testMap = new Yaml().load(payloadString);
+ String json = new GsonBuilder().create().toJson(testMap);
+ policy.getAsJsonObject().add("payload", new GsonBuilder().create().fromJson(json, JsonElement.class));
+ }
+ }
+ return policyJson;
+ }
+
+ private static void replacePropertiesIfEmpty(JsonElement policy, String key, String valueIfEmpty) {
+ JsonElement payloadElem = policy.getAsJsonObject().get(key);
+ String payloadString = payloadElem != null ? payloadElem.getAsString() : "";
+ if (payloadString.isEmpty()) {
+ policy.getAsJsonObject().addProperty(key, valueIfEmpty);
+ }
+ }
+
+ private static JsonElement fulfillPoliciesTreeField(JsonElement policyJson) {
+ for (JsonElement policy : policyJson.getAsJsonObject().get("policies").getAsJsonArray()) {
+ replacePropertiesIfEmpty(policy, "success", "final_success");
+ replacePropertiesIfEmpty(policy, "failure", "final_failure");
+ replacePropertiesIfEmpty(policy, "failure_timeout", "final_failure_timeout");
+ replacePropertiesIfEmpty(policy, "failure_retries", "final_failure_retries");
+ replacePropertiesIfEmpty(policy, "failure_exception", "final_failure_exception");
+ replacePropertiesIfEmpty(policy, "failure_guard", "final_failure_guard");
+ }
+ return policyJson;
+ }
+
+ private static Map<String, Object> createMap(JsonElement jsonElement) {
+ Map<String, Object> mapResult = new TreeMap<>();
+
+ if (jsonElement.isJsonObject()) {
+ for (Entry<String, JsonElement> entry : jsonElement.getAsJsonObject().entrySet()) {
+ if (entry.getValue().isJsonPrimitive() && entry.getValue().getAsJsonPrimitive().isString()) {
+ mapResult.put(entry.getKey(), entry.getValue().getAsString());
+ } else if (entry.getValue().isJsonPrimitive() && entry.getValue().getAsJsonPrimitive().isBoolean()) {
+ mapResult.put(entry.getKey(), entry.getValue().getAsBoolean());
+ } else if (entry.getValue().isJsonPrimitive() && entry.getValue().getAsJsonPrimitive().isNumber()) {
+ // Only int ro long normally, we don't need float here
+ mapResult.put(entry.getKey(), entry.getValue().getAsLong());
+ } else if (entry.getValue().isJsonArray()) {
+ List<Map<String, Object>> newArray = new ArrayList<>();
+ mapResult.put(entry.getKey(), newArray);
+ for (JsonElement element : entry.getValue().getAsJsonArray()) {
+ newArray.add(createMap(element));
+ }
+ } else if (entry.getValue().isJsonObject()) {
+ mapResult.put(entry.getKey(), createMap(entry.getValue()));
+ }
+ }
+ }
+ return mapResult;
+ }
+
+ public static String createPolicyPayloadYamlLegacy(JsonElement operationalPolicyJsonElement) {
+ JsonElement opPolicy = fulfillPoliciesTreeField(
+ removeAllQuotes(reworkPayloadAttributes(operationalPolicyJsonElement.getAsJsonObject().deepCopy())));
+ Map<?, ?> jsonMap = createMap(opPolicy);
+ DumperOptions options = new DumperOptions();
+ options.setDefaultScalarStyle(ScalarStyle.PLAIN);
+ options.setIndent(2);
+ options.setPrettyFlow(true);
+ // Policy can't support { } in the yaml
+ options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+ return (new Yaml(options)).dump(jsonMap);
+ }
+}
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 2ce5afff..62c5a1e9 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
@@ -23,6 +23,8 @@
package org.onap.clamp.policy.operational;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
@@ -45,6 +47,7 @@ import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
+import javax.persistence.Transient;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
@@ -52,6 +55,7 @@ import org.hibernate.annotations.TypeDefs;
import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
import org.onap.clamp.loop.Loop;
import org.onap.clamp.policy.Policy;
+import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
@Entity
@@ -63,6 +67,9 @@ public class OperationalPolicy implements Serializable, Policy {
*/
private static final long serialVersionUID = 6117076450841538255L;
+ @Transient
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(OperationalPolicy.class);
+
@Id
@Expose
@Column(nullable = false, name = "name", unique = true)
@@ -176,28 +183,33 @@ public class OperationalPolicy implements Serializable, Policy {
operationalPolicyDetails.add("metadata", metadata);
metadata.addProperty("policy-id", this.name);
- operationalPolicyDetails.add("properties", this.configurationsJson.get("operational_policy"));
+ operationalPolicyDetails.add("properties", LegacyOperationalPolicy
+ .reworkPayloadAttributes(this.configurationsJson.get("operational_policy").deepCopy()));
Gson gson = new GsonBuilder().create();
+
Map<?, ?> jsonMap = gson.fromJson(gson.toJson(policyPayloadResult), Map.class);
- 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);
+ DumperOptions options = new DumperOptions();
+ options.setIndent(2);
+ options.setPrettyFlow(true);
+ options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+
+ return (new Yaml(options)).dump(jsonMap);
}
@Override
public String createPolicyPayload() throws UnsupportedEncodingException {
- // Now the Yaml payload must be injected in a json ...
+ // Now using the legacy payload fo Dublin
JsonObject payload = new JsonObject();
payload.addProperty("policy-id", this.getName());
- payload.addProperty("content",
- URLEncoder.encode(createPolicyPayloadYamlLegacy(), StandardCharsets.UTF_8.toString()));
- return new GsonBuilder().setPrettyPrinting().create().toJson(payload);
+ payload.addProperty("content", URLEncoder.encode(
+ LegacyOperationalPolicy.createPolicyPayloadYamlLegacy(this.configurationsJson.get("operational_policy")),
+ StandardCharsets.UTF_8.toString()));
+ String opPayload = new GsonBuilder().setPrettyPrinting().create().toJson(payload);
+ logger.info("Operational policy payload: " + opPayload);
+ return opPayload;
}
/**
@@ -217,6 +229,7 @@ public class OperationalPolicy implements Serializable, Policy {
result.put(guardElem.getKey(), new GsonBuilder().create().toJson(guard));
}
}
+ logger.info("Guard policy payload: " + result);
return result;
}
diff --git a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
index caed3ba9..8972e511 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
@@ -33,6 +33,7 @@ import java.util.Map;
import org.junit.Test;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.policy.operational.LegacyOperationalPolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -43,15 +44,23 @@ public class OperationalPolicyPayloadTest {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
OperationalPolicy policy = new OperationalPolicy("testPolicy", null, jsonConfig);
+
assertThat(policy.createPolicyPayloadYaml())
.isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.yaml"));
- assertThat(policy.createPolicyPayloadYamlLegacy())
- .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload-legacy.yaml"));
+
assertThat(policy.createPolicyPayload())
.isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.json"));
}
@Test
+ public void testLegacyOperationalPolicyPayloadConstruction() throws IOException {
+ JsonObject jsonConfig = new GsonBuilder().create().fromJson(
+ ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
+ assertThat(LegacyOperationalPolicy.createPolicyPayloadYamlLegacy(jsonConfig.get("operational_policy")))
+ .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload-legacy.yaml"));
+ }
+
+ @Test
public void testGuardPolicyEmptyPayloadConstruction() throws IOException {
JsonObject jsonConfig = new GsonBuilder().create().fromJson(
ResourceFileUtil.getResourceAsString("tosca/operational-policy-no-guard-properties.json"),
diff --git a/src/test/resources/tosca/operational-policy-payload-legacy.yaml b/src/test/resources/tosca/operational-policy-payload-legacy.yaml
index ddaaf71f..41184c9c 100644
--- a/src/test/resources/tosca/operational-policy-payload-legacy.yaml
+++ b/src/test/resources/tosca/operational-policy-payload-legacy.yaml
@@ -1,23 +1,39 @@
-controlLoop: {controlLoopName: control loop, version: 2.0.0, trigger_policy: new1,
- timeout: '30', abatement: 'true'}
+controlLoop:
+ abatement: true
+ controlLoopName: control loop
+ timeout: 30
+ trigger_policy: new1
+ version: 2.0.0
policies:
-- id: new1
- recipe: Rebuild
- retry: '10'
- timeout: '20'
- actor: SO
- payload: test
- success: new2
+- actor: SO
failure: new2
- failure_timeout: new2
- failure_retries: new2
failure_exception: new2
failure_guard: new2
- target: {type: VFC, resourceTargetId: test}
-- id: new2
+ failure_retries: new2
+ failure_timeout: new2
+ id: new1
+ payload:
+ configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[10].value","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[15].value","enabled":"$.vf-module-topology.vf-module-parameters.param[22].value"}]'
+ requestParameters: '{"usePreload":true,"userParams":[]}'
+ recipe: Rebuild
+ retry: 10
+ success: new2
+ target:
+ resourceTargetId: test
+ type: VFC
+ timeout: 20
+- actor: SDNC
+ failure: final_failure
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard
+ failure_retries: final_failure_retries
+ failure_timeout: final_failure_timeout
+ id: new2
+ payload: ''
recipe: Migrate
- retry: '30'
- timeout: '40'
- actor: SDNC
- payload: test
- target: {type: VFC, resourceTargetId: test}
+ retry: 30
+ success: final_success
+ target:
+ resourceTargetId: test
+ type: VFC
+ timeout: 40
diff --git a/src/test/resources/tosca/operational-policy-payload.json b/src/test/resources/tosca/operational-policy-payload.json
index f2271cd3..5097654d 100644
--- a/src/test/resources/tosca/operational-policy-payload.json
+++ b/src/test/resources/tosca/operational-policy-payload.json
@@ -1,4 +1,4 @@
{
"policy-id": "testPolicy",
- "content": "controlLoop%3A+%7BcontrolLoopName%3A+control+loop%2C+version%3A+2.0.0%2C+trigger_policy%3A+new1%2C%0A++timeout%3A+%2730%27%2C+abatement%3A+%27true%27%7D%0Apolicies%3A%0A-+id%3A+new1%0A++recipe%3A+Rebuild%0A++retry%3A+%2710%27%0A++timeout%3A+%2720%27%0A++actor%3A+SO%0A++payload%3A+test%0A++success%3A+new2%0A++failure%3A+new2%0A++failure_timeout%3A+new2%0A++failure_retries%3A+new2%0A++failure_exception%3A+new2%0A++failure_guard%3A+new2%0A++target%3A+%7Btype%3A+VFC%2C+resourceTargetId%3A+test%7D%0A-+id%3A+new2%0A++recipe%3A+Migrate%0A++retry%3A+%2730%27%0A++timeout%3A+%2740%27%0A++actor%3A+SDNC%0A++payload%3A+test%0A++target%3A+%7Btype%3A+VFC%2C+resourceTargetId%3A+test%7D%0A"
+ "content": "controlLoop%3A%0A++abatement%3A+true%0A++controlLoopName%3A+control+loop%0A++timeout%3A+30%0A++trigger_policy%3A+new1%0A++version%3A+2.0.0%0Apolicies%3A%0A-+actor%3A+SO%0A++failure%3A+new2%0A++failure_exception%3A+new2%0A++failure_guard%3A+new2%0A++failure_retries%3A+new2%0A++failure_timeout%3A+new2%0A++id%3A+new1%0A++payload%3A%0A++++configurationParameters%3A+%27%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B10%5D.value%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B15%5D.value%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B22%5D.value%22%7D%5D%27%0A++++requestParameters%3A+%27%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D%27%0A++recipe%3A+Rebuild%0A++retry%3A+10%0A++success%3A+new2%0A++target%3A%0A++++resourceTargetId%3A+test%0A++++type%3A+VFC%0A++timeout%3A+20%0A-+actor%3A+SDNC%0A++failure%3A+final_failure%0A++failure_exception%3A+final_failure_exception%0A++failure_guard%3A+final_failure_guard%0A++failure_retries%3A+final_failure_retries%0A++failure_timeout%3A+final_failure_timeout%0A++id%3A+new2%0A++payload%3A+%27%27%0A++recipe%3A+Migrate%0A++retry%3A+30%0A++success%3A+final_success%0A++target%3A%0A++++resourceTargetId%3A+test%0A++++type%3A+VFC%0A++timeout%3A+40%0A"
} \ No newline at end of file
diff --git a/src/test/resources/tosca/operational-policy-payload.yaml b/src/test/resources/tosca/operational-policy-payload.yaml
index 68116b00..c3a6b5c2 100644
--- a/src/test/resources/tosca/operational-policy-payload.yaml
+++ b/src/test/resources/tosca/operational-policy-payload.yaml
@@ -4,28 +4,39 @@ topology_template:
- testPolicy:
type: onap.policies.controlloop.Operational
version: 1.0.0
- metadata: {policy-id: testPolicy}
+ metadata:
+ policy-id: testPolicy
properties:
- controlLoop: {controlLoopName: control loop, version: 2.0.0, trigger_policy: new1,
- timeout: '30', abatement: 'true'}
+ controlLoop:
+ controlLoopName: control loop
+ version: 2.0.0
+ trigger_policy: new1
+ timeout: '30'
+ abatement: 'true'
policies:
- id: new1
recipe: Rebuild
retry: '10'
timeout: '20'
actor: SO
- payload: test
+ payload:
+ requestParameters: '{"usePreload":true,"userParams":[]}'
+ configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[10].value","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[15].value","enabled":"$.vf-module-topology.vf-module-parameters.param[22].value"}]'
success: new2
failure: new2
failure_timeout: new2
failure_retries: new2
failure_exception: new2
failure_guard: new2
- target: {type: VFC, resourceTargetId: test}
+ target:
+ type: VFC
+ resourceTargetId: test
- id: new2
recipe: Migrate
retry: '30'
timeout: '40'
actor: SDNC
- payload: test
- target: {type: VFC, resourceTargetId: test}
+ payload: ''
+ target:
+ type: VFC
+ resourceTargetId: test
diff --git a/src/test/resources/tosca/operational-policy-properties.json b/src/test/resources/tosca/operational-policy-properties.json
index 52eabb8a..bfce6b33 100644
--- a/src/test/resources/tosca/operational-policy-properties.json
+++ b/src/test/resources/tosca/operational-policy-properties.json
@@ -42,7 +42,7 @@
"retry": "10",
"timeout": "20",
"actor": "SO",
- "payload": "test",
+ "payload": "requestParameters: '{\"usePreload\":true,\"userParams\":[]}'\r\nconfigurationParameters: '[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[10].value\",\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[15].value\",\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[22].value\"}]'",
"success": "new2",
"failure": "new2",
"failure_timeout": "new2",
@@ -60,7 +60,7 @@
"retry": "30",
"timeout": "40",
"actor": "SDNC",
- "payload": "test",
+ "payload": "",
"target": {
"type": "VFC",
"resourceTargetId": "test"