From 2187558aa7eac99f5afe9232354a6c7af0e9baf3 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 28 Aug 2019 09:53:19 -0400 Subject: Preload control loop coordination type in API Modified json based on input from Chenfei. Change-Id: Ibd70c5737713fee5dcd2370e02ef5f567d2a73b3 Issue-ID: POLICY-1847 Signed-off-by: Jim Hahn --- .../api/main/startstop/ApiDatabaseInitializer.java | 1 + .../onap.policies.controlloop.guard.Blacklist.json | 2 +- ...olicies.controlloop.guard.FrequencyLimiter.json | 2 +- .../onap.policies.controlloop.guard.MinMax.json | 2 +- ...lloop.guard.coordination.FirstBlocksSecond.json | 38 ++++++++++++++++++++++ .../startstop/TestApiCommandLineArguments.java | 2 +- 6 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.json (limited to 'main') diff --git a/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java b/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java index 27fc83a8..ad82d4bb 100644 --- a/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java +++ b/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java @@ -64,6 +64,7 @@ public class ApiDatabaseInitializer { "preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json", "preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json", "preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json", + "preloadedPolicyTypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.json", "preloadedPolicyTypes/onap.policies.controlloop.Operational.json" }; diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json index 9391496c..cc59ca4b 100644 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json +++ b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json @@ -37,7 +37,7 @@ }, "recipe": { "type": "string", - "description": "Specified the Recipe", + "description": "Specifies the Recipe", "required": true }, "time_range": { diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json index 598bd3c7..d0e50b74 100644 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json +++ b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json @@ -37,7 +37,7 @@ }, "recipe": { "type": "string", - "description": "Specified the Recipe", + "description": "Specifies the Recipe", "required": true }, "time_window": { diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json index 71658dd4..c9ea671b 100644 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json +++ b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json @@ -36,7 +36,7 @@ }, "recipe": { "type": "string", - "description": "Specified the Recipe", + "description": "Specifies the Recipe", "required": true }, "time_range": { diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.json new file mode 100644 index 00000000..43539d02 --- /dev/null +++ b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.json @@ -0,0 +1,38 @@ +{ + "policy_types": [ + { + "onap.policies.controlloop.Guard": { + "derived_from": "tosca.policies.Root", + "version": "1.0.0", + "description": "Guard Policies for Control Loop Operational Policies" + } + }, + { + "onap.policies.controlloop.guard.Coordination": { + "derived_from": "onap.policies.controlloop.Guard", + "version": "1.0.0", + "description": "Guard Policies for Control Loop Coordination" + } + }, + { + "onap.policies.controlloop.guard.coordination.FirstBlocksSecond": { + "derived_from": "onap.policies.controlloop.guard.Coordination", + "version": "1.0.0", + "description": "Supports one Control Loop blocking another", + "properties": { + "controlLoop": { + "type": "list", + "description": "Specific Control Loops to which to apply this guard", + "required": true, + "constraint": { + "length": 2 + }, + "entry_schema": { + "type": "string" + } + } + } + } + } + ] +} \ No newline at end of file diff --git a/main/src/test/java/org/onap/policy/api/main/startstop/TestApiCommandLineArguments.java b/main/src/test/java/org/onap/policy/api/main/startstop/TestApiCommandLineArguments.java index 73503694..bf728dd5 100644 --- a/main/src/test/java/org/onap/policy/api/main/startstop/TestApiCommandLineArguments.java +++ b/main/src/test/java/org/onap/policy/api/main/startstop/TestApiCommandLineArguments.java @@ -43,7 +43,7 @@ public class TestApiCommandLineArguments { @Test(expected = PolicyApiRuntimeException.class) public void testApiCommandLineArgumentsStringArray() { String [] args = {"---d"}; - ApiCommandLineArguments apiCmdArgs1 = new ApiCommandLineArguments(args); + new ApiCommandLineArguments(args); } @Test -- cgit 1.2.3-korg