Fix the op policy payload

Fix the operational policy payload as it was not the one expected by
policy engine + rollback staging plugin

Issue-ID: CLAMP-395
Change-Id: I7b690eb02f50617b7aa402266c13aafa82f5b59b
Signed-off-by: Determe, Sebastien (sd378r) <sebastien.determe@intl.att.com>
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 de6e4dc..3dc8073 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 @@
             .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 8977086..6de2863 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.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 @@
      */
     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 @@
             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 2bbb911..d8d15a5 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.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 @@
      */
     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 @@
         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 0000000..33148f0
--- /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 2ce5aff..62c5a1e 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.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.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 @@
      */
     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 @@
         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 @@
                 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 caed3ba..8972e51 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 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 @@
         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 ddaaf71..41184c9 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 f2271cd..5097654 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 68116b0..c3a6b5c 100644
--- a/src/test/resources/tosca/operational-policy-payload.yaml
+++ b/src/test/resources/tosca/operational-policy-payload.yaml
@@ -4,28 +4,39 @@
   - 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 52eabb8..bfce6b3 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"