aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2018-11-01 23:50:04 +0100
committersebdet <sebastien.determe@intl.att.com>2018-11-02 00:34:15 +0100
commit7253c2b707c1ac985fee1f6ed7ab45757a67b797 (patch)
treee1e54eaba59efdbfe05c47673b68f7b92059f60a
parenteff88976a4a9cbe246744b36c44cf84e14204308 (diff)
Fix Policy Yaml
Fix Policy Yaml generation, remove service and resource section + update the actor/recipe Issue-ID: CLAMP-243 Change-Id: Ia1adad6e653e7e85576858f2971f60f7903bfae2 Signed-off-by: sebdet <sebastien.determe@intl.att.com>
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatter.java19
-rw-r--r--src/main/resources/clds/templates/globalProperties.json19
-rw-r--r--src/test/resources/clds/templates/globalProperties.json18
-rw-r--r--src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml13
-rw-r--r--src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml13
-rw-r--r--src/test/resources/example/sdc/expected-result/sdc-properties-4cc5b45a.json18
-rw-r--r--src/test/resources/example/sdc/expected-result/sdc-properties-global.json18
7 files changed, 52 insertions, 66 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatter.java b/src/main/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatter.java
index 1fc36082..b9ed0c09 100644
--- a/src/main/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatter.java
+++ b/src/main/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyYamlFormatter.java
@@ -57,6 +57,7 @@ public class OperationalPolicyYamlFormatter {
protected OperationalPolicyYamlFormatter() {
}
+
/**
* Format Operational OpenLoop Policy yaml.
*
@@ -67,8 +68,8 @@ public class OperationalPolicyYamlFormatter {
* @throws BuilderException
* @throws UnsupportedEncodingException
*/
- public static String formatOpenLoopYaml(ModelProperties prop, String modelElementId,
- PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException {
+ public static String formatOpenLoopYaml(ModelProperties prop, String modelElementId, PolicyChain policyChain)
+ throws BuilderException, UnsupportedEncodingException {
// get property objects
Global global = prop.getGlobal();
prop.setCurrentModelElementId(modelElementId);
@@ -86,20 +87,15 @@ public class OperationalPolicyYamlFormatter {
return URLEncoder.encode(results.getSpecification(), "UTF-8");
}
- public static String formatYaml(ModelProperties prop, String modelElementId,
- PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException {
+ public static String formatYaml(ModelProperties prop, String modelElementId, PolicyChain policyChain)
+ throws BuilderException, UnsupportedEncodingException {
// get property objects
- Global global = prop.getGlobal();
prop.setCurrentModelElementId(modelElementId);
prop.setPolicyUniqueId(policyChain.getPolicyId());
- // convert values to SDC objects
- Service service = new Service(global.getService());
- Resource[] vfResources = convertToResources(global.getResourceVf(), ResourceType.VF);
- Resource[] vfcResources = convertToResources(global.getResourceVfc(), ResourceType.VFC);
+
// create builder
ControlLoopPolicyBuilder builder = ControlLoopPolicyBuilder.Factory.buildControlLoop(prop.getControlName(),
- policyChain.getTimeout(), service, vfResources);
- builder.addResource(vfcResources);
+ policyChain.getTimeout());
// process each policy
Map<String, Policy> policyObjMap = new HashMap<>();
List<PolicyItem> policyItemList = orderParentFirst(policyChain.getPolicyItems());
@@ -196,7 +192,6 @@ public class OperationalPolicyYamlFormatter {
}
}
-
protected static Resource[] convertToResources(List<String> stringList, ResourceType resourceType) {
if (stringList == null || stringList.isEmpty()) {
return new Resource[0];
diff --git a/src/main/resources/clds/templates/globalProperties.json b/src/main/resources/clds/templates/globalProperties.json
index 252b41f6..775ca1d9 100644
--- a/src/main/resources/clds/templates/globalProperties.json
+++ b/src/main/resources/clds/templates/globalProperties.json
@@ -50,17 +50,20 @@
"actor": {
"APPC":"APPC",
"SO": "SO",
- "VFC": "VFC"
+ "VFC": "VFC",
+ "SDNC":"SDNC",
+ "SDNR":"SDNR"
},
"vnfRecipe": {
"": "",
- "restart": "Restart",
- "rebuild": "Rebuild",
- "migrate": "Migrate",
- "healthCheck": "Health Check",
- "modifyConfig": "ModifyConfig",
- "vfModuleCreate":"VF Module Create",
- "scaleOut":"Scale Out"
+ "Restart": "Restart",
+ "Rebuild": "Rebuild",
+ "Migrate": "Migrate",
+ "HealthCheck": "Health Check",
+ "ModifyConfig": "Modify Config",
+ "VF Module Create":"VF Module Create",
+ "VF Module Delete":"VF Module Delete",
+ "Reroute":"Reroute"
},
"maxRetries": "3",
"recipeLevel": {
diff --git a/src/test/resources/clds/templates/globalProperties.json b/src/test/resources/clds/templates/globalProperties.json
index e677abe9..067063ea 100644
--- a/src/test/resources/clds/templates/globalProperties.json
+++ b/src/test/resources/clds/templates/globalProperties.json
@@ -9,8 +9,8 @@
"Measurement_vGMUX":"Measurement_vGMUX"
},
"fieldPathM": {
- "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value": "Packet-loss-rate",
- "$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta":"receivedTotalPacketsDelta"
+ "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value": "packetLossRate",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta":"receivedTotalPacketsDelta"
},
"operator": {
">": "GREATER",
@@ -49,12 +49,14 @@
"timeout": 345,
"vnfRecipe": {
"": "",
- "restart": "Restart",
- "rebuild": "Rebuild",
- "migrate": "Migrate",
- "healthCheck": "Health Check",
- "modifyConfig": "ModifyConfig",
- "vfModuleCreate":"VF Module Create"
+ "Restart": "Restart",
+ "Rebuild": "Rebuild",
+ "Migrate": "Migrate",
+ "HealthCheck": "Health Check",
+ "ModifyConfig": "Modify Config",
+ "VF Module Create":"VF Module Create",
+ "VF Module Delete":"VF Module Delete",
+ "Reroute":"Reroute"
},
"maxRetries": "3",
"retryTimeLimit": 180,
diff --git a/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml b/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml
index 3d0252a0..19ee585b 100644
--- a/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml
+++ b/src/test/resources/example/operational-policy/yaml-policy-chain-1.yaml
@@ -1,17 +1,8 @@
controlLoop:
abatement: false
controlLoopName: controlNameTest
- resources:
- - resourceInvariantUUID: null
- resourceName: 6c7aaec2-59eb-41d9-8681-b7f976ab668d
- resourceType: VF
- resourceUUID: null
- resourceVersion: null
- services:
- - serviceInvariantUUID: null
- serviceName: 0f983e18-4603-4bb4-a98c-e29691fb16a1
- serviceUUID: null
- serviceVersion: null
+ resources: null
+ services: null
timeout: 500
trigger_policy: <generatedId>
version: 2.0.0
diff --git a/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml b/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml
index 3d0252a0..19ee585b 100644
--- a/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml
+++ b/src/test/resources/example/operational-policy/yaml-policy-chain-2.yaml
@@ -1,17 +1,8 @@
controlLoop:
abatement: false
controlLoopName: controlNameTest
- resources:
- - resourceInvariantUUID: null
- resourceName: 6c7aaec2-59eb-41d9-8681-b7f976ab668d
- resourceType: VF
- resourceUUID: null
- resourceVersion: null
- services:
- - serviceInvariantUUID: null
- serviceName: 0f983e18-4603-4bb4-a98c-e29691fb16a1
- serviceUUID: null
- serviceVersion: null
+ resources: null
+ services: null
timeout: 500
trigger_policy: <generatedId>
version: 2.0.0
diff --git a/src/test/resources/example/sdc/expected-result/sdc-properties-4cc5b45a.json b/src/test/resources/example/sdc/expected-result/sdc-properties-4cc5b45a.json
index c695ae00..26454c31 100644
--- a/src/test/resources/example/sdc/expected-result/sdc-properties-4cc5b45a.json
+++ b/src/test/resources/example/sdc/expected-result/sdc-properties-4cc5b45a.json
@@ -9,8 +9,8 @@
"Measurement_vGMUX":"Measurement_vGMUX"
},
"fieldPathM": {
- "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value": "Packet-loss-rate",
- "$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta":"receivedTotalPacketsDelta"
+ "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value": "packetLossRate",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta":"receivedTotalPacketsDelta"
},
"operator": {
">": "GREATER",
@@ -49,12 +49,14 @@
"timeout": 345,
"vnfRecipe": {
"": "",
- "restart": "Restart",
- "rebuild": "Rebuild",
- "migrate": "Migrate",
- "healthCheck": "Health Check",
- "modifyConfig": "ModifyConfig",
- "vfModuleCreate":"VF Module Create"
+ "Restart": "Restart",
+ "Rebuild": "Rebuild",
+ "Migrate": "Migrate",
+ "HealthCheck": "Health Check",
+ "ModifyConfig": "Modify Config",
+ "VF Module Create":"VF Module Create",
+ "VF Module Delete":"VF Module Delete",
+ "Reroute":"Reroute"
},
"maxRetries": "3",
"retryTimeLimit": 180,
diff --git a/src/test/resources/example/sdc/expected-result/sdc-properties-global.json b/src/test/resources/example/sdc/expected-result/sdc-properties-global.json
index f81784d7..be46dbca 100644
--- a/src/test/resources/example/sdc/expected-result/sdc-properties-global.json
+++ b/src/test/resources/example/sdc/expected-result/sdc-properties-global.json
@@ -9,8 +9,8 @@
"Measurement_vGMUX": "Measurement_vGMUX"
},
"fieldPathM": {
- "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value": "Packet-loss-rate",
- "$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta": "receivedTotalPacketsDelta"
+ "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value": "packetLossRate",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta": "receivedTotalPacketsDelta"
},
"operator": {
">": "GREATER",
@@ -49,12 +49,14 @@
"timeout": 345,
"vnfRecipe": {
"": "",
- "restart": "Restart",
- "rebuild": "Rebuild",
- "migrate": "Migrate",
- "healthCheck": "Health Check",
- "modifyConfig": "ModifyConfig",
- "vfModuleCreate": "VF Module Create"
+ "Restart": "Restart",
+ "Rebuild": "Rebuild",
+ "Migrate": "Migrate",
+ "HealthCheck": "Health Check",
+ "ModifyConfig": "Modify Config",
+ "VF Module Create":"VF Module Create",
+ "VF Module Delete":"VF Module Delete",
+ "Reroute":"Reroute"
},
"maxRetries": "3",
"retryTimeLimit": 180,