summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java2
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java26
-rw-r--r--src/test/resources/tosca/operational-policy-cds-payload-with-list.json152
-rw-r--r--src/test/resources/tosca/operational-policy-json-schema.json152
-rw-r--r--src/test/resources/tosca/operational-policy-properties.json31
-rw-r--r--src/test/resources/tosca/pdp-group-policy-payload.json4
6 files changed, 4 insertions, 363 deletions
diff --git a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java
index 4d51bb27c..26db6b013 100644
--- a/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopControllerTestItCase.java
@@ -94,7 +94,7 @@ public class LoopControllerTestItCase {
public void testUpdateOperationalPolicies() {
saveTestLoopToDb();
String policy = "[{\"name\":\"OPERATIONAL_CLholmes31_v1_0_vFW_PG_T10_k8s-holmes-rules\","
- + "\"configurationsJson\":{\"guard_policies\":{},"
+ + "\"configurationsJson\":{"
+ "\"operational_policy\":{\"controlLoop\":{\"trigger_policy\":\"unique-policy-id-1-modifyConfig\","
+ "\"timeout\":\"3600\",\"abatement\":\"false\","
+ "\"controlLoopName\":\"LOOP_CLholmes31_v1_0_vFW_PG_T10_k8s-holmes-rules\"},"
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 58a432d34..cef82e501 100644
--- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
+++ b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
@@ -59,30 +59,4 @@ public class OperationalPolicyPayloadTest {
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"),
- JsonObject.class);
- OperationalPolicy policy = new OperationalPolicy("testPolicy", jsonConfig, null, null, null, null, null);
- Map<String, String> guardsMap = policy.createGuardPolicyPayloads();
- assertThat(guardsMap).isEmpty();
- assertThat(guardsMap.entrySet()).isEmpty();
- }
-
- @Test
- public void testGuardPolicyPayloadConstruction() throws IOException {
- JsonObject jsonConfig = new GsonBuilder().create().fromJson(
- ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
- OperationalPolicy policy = new OperationalPolicy("testPolicy", jsonConfig, null, null, null, null, null);
-
- Map<String, String> guardsMap = policy.createGuardPolicyPayloads();
-
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/guard1-policy-payload.json"),
- guardsMap.get("guard.minmax.new"), false);
-
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/guard2-policy-payload.json"),
- guardsMap.get("guard.frequency.new"), false);
- }
}
diff --git a/src/test/resources/tosca/operational-policy-cds-payload-with-list.json b/src/test/resources/tosca/operational-policy-cds-payload-with-list.json
index 13b468ea0..d9b5aee93 100644
--- a/src/test/resources/tosca/operational-policy-cds-payload-with-list.json
+++ b/src/test/resources/tosca/operational-policy-cds-payload-with-list.json
@@ -2,8 +2,7 @@
"type": "object",
"title": "Configuration",
"required": [
- "operational_policy",
- "guard_policies"
+ "operational_policy"
],
"properties": {
"operational_policy": {
@@ -582,155 +581,6 @@
}
}
}
- },
- "guard_policies": {
- "type": "array",
- "format": "tabs-top",
- "title": "Associated Guard policies",
- "items": {
- "headerTemplate": "{{self.policy-id}} - {{self.content.recipe}}",
- "anyOf": [
- {
- "title": "Guard MinMax",
- "type": "object",
- "properties": {
- "policy-id": {
- "type": "string",
- "default": "guard.minmax.new",
- "pattern": "^(guard.minmax\\..*)$"
- },
- "content": {
- "properties": {
- "actor": {
- "type": "string",
- "enum": [
- "APPC",
- "SO",
- "VFC",
- "SDNC",
- "SDNR"
- ]
- },
- "recipe": {
- "type": "string",
- "enum": [
- "Restart",
- "Rebuild",
- "Migrate",
- "Health-Check",
- "ModifyConfig",
- "VF Module Create",
- "VF Module Delete",
- "Reroute"
- ]
- },
- "targets": {
- "type": "string",
- "default": ".*"
- },
- "clname": {
- "type": "string",
- "template": "{{loopName}}",
- "watch": {
- "loopName": "operational_policy.controlLoop.controlLoopName"
- }
- },
- "guardActiveStart": {
- "type": "string",
- "default": "00:00:00Z"
- },
- "guardActiveEnd": {
- "type": "string",
- "default": "10:00:00Z"
- },
- "min": {
- "type": "string",
- "default": "0"
- },
- "max": {
- "type": "string",
- "default": "1"
- }
- }
- }
- }
- },
- {
- "title": "Guard Frequency",
- "type": "object",
- "properties": {
- "policy-id": {
- "type": "string",
- "default": "guard.frequency.new",
- "pattern": "^(guard.frequency\\..*)$"
- },
- "content": {
- "properties": {
- "actor": {
- "type": "string",
- "enum": [
- "APPC",
- "SO",
- "VFC",
- "SDNC",
- "SDNR"
- ]
- },
- "recipe": {
- "type": "string",
- "enum": [
- "Restart",
- "Rebuild",
- "Migrate",
- "Health-Check",
- "ModifyConfig",
- "VF Module Create",
- "VF Module Delete",
- "Reroute"
- ]
- },
- "targets": {
- "type": "string",
- "default": ".*"
- },
- "clname": {
- "type": "string",
- "template": "{{loopName}}",
- "watch": {
- "loopName": "operational_policy.controlLoop.controlLoopName"
- }
- },
- "guardActiveStart": {
- "type": "string",
- "default": "00:00:00Z"
- },
- "guardActiveEnd": {
- "type": "string",
- "default": "10:00:00Z"
- },
- "limit": {
- "type": "string"
- },
- "timeWindow": {
- "type": "string"
- },
- "timeUnits": {
- "type": "string",
- "enum": [
- "minute",
- "hour",
- "day",
- "week",
- "month",
- "year"
- ]
- }
- }
- }
- }
- }
- ]
- }
}
}
} \ No newline at end of file
diff --git a/src/test/resources/tosca/operational-policy-json-schema.json b/src/test/resources/tosca/operational-policy-json-schema.json
index 9dee089e0..081e0f25a 100644
--- a/src/test/resources/tosca/operational-policy-json-schema.json
+++ b/src/test/resources/tosca/operational-policy-json-schema.json
@@ -2,8 +2,7 @@
"type": "object",
"title": "Configuration",
"required": [
- "operational_policy",
- "guard_policies"
+ "operational_policy"
],
"properties": {
"operational_policy": {
@@ -940,155 +939,6 @@
}
}
}
- },
- "guard_policies": {
- "type": "array",
- "format": "tabs-top",
- "title": "Associated Guard policies",
- "items": {
- "headerTemplate": "{{self.policy-id}} - {{self.content.recipe}}",
- "anyOf": [
- {
- "title": "Guard MinMax",
- "type": "object",
- "properties": {
- "policy-id": {
- "type": "string",
- "default": "guard.minmax.new",
- "pattern": "^(guard.minmax\\..*)$"
- },
- "content": {
- "properties": {
- "actor": {
- "type": "string",
- "enum": [
- "APPC",
- "SO",
- "VFC",
- "SDNC",
- "SDNR"
- ]
- },
- "recipe": {
- "type": "string",
- "enum": [
- "Restart",
- "Rebuild",
- "Migrate",
- "Health-Check",
- "ModifyConfig",
- "VF Module Create",
- "VF Module Delete",
- "Reroute"
- ]
- },
- "targets": {
- "type": "string",
- "default": ".*"
- },
- "clname": {
- "type": "string",
- "template": "{{loopName}}",
- "watch": {
- "loopName": "operational_policy.controlLoop.controlLoopName"
- }
- },
- "guardActiveStart": {
- "type": "string",
- "default": "00:00:00Z"
- },
- "guardActiveEnd": {
- "type": "string",
- "default": "10:00:00Z"
- },
- "min": {
- "type": "string",
- "default": "0"
- },
- "max": {
- "type": "string",
- "default": "1"
- }
- }
- }
- }
- },
- {
- "title": "Guard Frequency",
- "type": "object",
- "properties": {
- "policy-id": {
- "type": "string",
- "default": "guard.frequency.new",
- "pattern": "^(guard.frequency\\..*)$"
- },
- "content": {
- "properties": {
- "actor": {
- "type": "string",
- "enum": [
- "APPC",
- "SO",
- "VFC",
- "SDNC",
- "SDNR"
- ]
- },
- "recipe": {
- "type": "string",
- "enum": [
- "Restart",
- "Rebuild",
- "Migrate",
- "Health-Check",
- "ModifyConfig",
- "VF Module Create",
- "VF Module Delete",
- "Reroute"
- ]
- },
- "targets": {
- "type": "string",
- "default": ".*"
- },
- "clname": {
- "type": "string",
- "template": "{{loopName}}",
- "watch": {
- "loopName": "operational_policy.controlLoop.controlLoopName"
- }
- },
- "guardActiveStart": {
- "type": "string",
- "default": "00:00:00Z"
- },
- "guardActiveEnd": {
- "type": "string",
- "default": "10:00:00Z"
- },
- "limit": {
- "type": "string"
- },
- "timeWindow": {
- "type": "string"
- },
- "timeUnits": {
- "type": "string",
- "enum": [
- "minute",
- "hour",
- "day",
- "week",
- "month",
- "year"
- ]
- }
- }
- }
- }
- }
- ]
- }
}
}
}
diff --git a/src/test/resources/tosca/operational-policy-properties.json b/src/test/resources/tosca/operational-policy-properties.json
index aaf9dc378..a38334b55 100644
--- a/src/test/resources/tosca/operational-policy-properties.json
+++ b/src/test/resources/tosca/operational-policy-properties.json
@@ -128,34 +128,5 @@
}
}
]
- },
- "guard_policies": [
- {
- "policy-id": "guard.minmax.new",
- "content": {
- "actor": "APPC",
- "recipe": "Restart",
- "targets": ".*",
- "clname": "LOOP_ASJOy_v1_0_ResourceInstanceName1_tca",
- "guardActiveStart": "00:00:00Z",
- "guardActiveEnd": "10:00:00Z",
- "min": "0",
- "max": "1"
- }
- },
- {
- "policy-id": "guard.frequency.new",
- "content": {
- "actor": "APPC",
- "recipe": "Rebuild",
- "targets": ".*",
- "clname": "LOOP_ASJOy_v1_0_ResourceInstanceName1_tca",
- "guardActiveStart": "00:00:00Z",
- "guardActiveEnd": "10:00:00Z",
- "limit": "1",
- "timeWindow": "2",
- "timeUnits": "minute"
- }
- }
- ]
+ }
}
diff --git a/src/test/resources/tosca/pdp-group-policy-payload.json b/src/test/resources/tosca/pdp-group-policy-payload.json
index dce740fcd..17535ecbb 100644
--- a/src/test/resources/tosca/pdp-group-policy-payload.json
+++ b/src/test/resources/tosca/pdp-group-policy-payload.json
@@ -27,10 +27,6 @@
"version": "1.0.0"
},
{
- "name": "guard1",
- "version": "1.0.0"
- },
- {
"name": "opPolicy",
"version": "1.0.0"
}