summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChenfei Gao <cgao@research.att.com>2019-05-07 14:46:22 -0400
committerChenfei Gao <cgao@research.att.com>2019-05-07 20:02:07 -0400
commit90555d0346c7e852e6a4dc9622ed29343353b95c (patch)
tree842bc1f51389d04481849d1e7ed5ff2d03c4f82f
parenta962474f4c1498a335bfd1afaa7d15859ae04be2 (diff)
Preload legacy operational policy type and guard policy types
Includes: a) Add legacy operational policy type and guard policy types into preloading list. b) Fix corresponding junit test failure. Issue-ID: POLICY-1738 Change-Id: I071e898be31e62f47d427094f1e76069fafd0148 Signed-off-by: Chenfei Gao <cgao@research.att.com>
-rw-r--r--main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java6
-rw-r--r--main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.Operational.json12
-rw-r--r--main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json62
-rw-r--r--main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json77
-rw-r--r--main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json66
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java10
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java33
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java31
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java2
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java2
-rw-r--r--main/src/test/resources/policytypes/onap.policies.controlloop.Operational.json12
-rw-r--r--main/src/test/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.json77
-rw-r--r--main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json (renamed from main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json)0
-rw-r--r--main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml (renamed from main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml)0
14 files changed, 382 insertions, 8 deletions
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 3973e626..27fc83a8 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
@@ -60,7 +60,11 @@ public class ApiDatabaseInitializer {
"preloadedPolicyTypes/onap.policies.optimization.QueryPolicy.json",
"preloadedPolicyTypes/onap.policies.optimization.SubscriberPolicy.json",
"preloadedPolicyTypes/onap.policies.optimization.Vim_fit.json",
- "preloadedPolicyTypes/onap.policies.optimization.VnfPolicy.json"
+ "preloadedPolicyTypes/onap.policies.optimization.VnfPolicy.json",
+ "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.Operational.json"
};
/**
diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.Operational.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.Operational.json
new file mode 100644
index 00000000..2d36a258
--- /dev/null
+++ b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.Operational.json
@@ -0,0 +1,12 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "policy_types": [
+ {
+ "onap.policies.controlloop.Operational": {
+ "derived_from": "tosca.policies.Root",
+ "version": "1.0.0",
+ "description": "Operational Policy for Control Loops"
+ }
+ }
+ ]
+} \ No newline at end of file
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
new file mode 100644
index 00000000..9391496c
--- /dev/null
+++ b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json
@@ -0,0 +1,62 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "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.Blacklist": {
+ "derived_from": "onap.policies.controlloop.Guard",
+ "version": "1.0.0",
+ "description": "Supports blacklist of VNF's from performing control loop actions on.",
+ "properties": {
+ "blacklist_policy": {
+ "type": "map",
+ "description": null,
+ "entry_schema": {
+ "type": "onap.datatypes.guard.Blacklist"
+ }
+ }
+ }
+ }
+ }
+ ],
+ "data_types": [
+ {
+ "onap.datatypes.guard.Blacklist": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "actor": {
+ "type": "string",
+ "description": "Specifies the Actor",
+ "required": true
+ },
+ "recipe": {
+ "type": "string",
+ "description": "Specified the Recipe",
+ "required": true
+ },
+ "time_range": {
+ "type": "tosca.datatypes.TimeInterval",
+ "description": "An optional range of time during the day the blacklist is valid for.",
+ "required": false
+ },
+ "controlLoopName": {
+ "type": "string",
+ "description": "An optional specific control loop to apply this guard to.",
+ "required": false
+ },
+ "blacklist": {
+ "type": "list",
+ "description": "List of VNF's",
+ "required": true
+ }
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
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
new file mode 100644
index 00000000..598bd3c7
--- /dev/null
+++ b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json
@@ -0,0 +1,77 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "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.FrequencyLimiter": {
+ "derived_from": "onap.policies.controlloop.Guard",
+ "version": "1.0.0",
+ "description": "Supports limiting the frequency of actions being taken by a Actor.",
+ "properties": {
+ "frequency_policy": {
+ "type": "map",
+ "description": null,
+ "entry_schema": {
+ "type": "onap.datatypes.guard.FrequencyLimiter"
+ }
+ }
+ }
+ }
+ }
+ ],
+ "data_types": [
+ {
+ "onap.datatypes.guard.FrequencyLimiter": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "actor": {
+ "type": "string",
+ "description": "Specifies the Actor",
+ "required": true
+ },
+ "recipe": {
+ "type": "string",
+ "description": "Specified the Recipe",
+ "required": true
+ },
+ "time_window": {
+ "type": "scalar-unit.time",
+ "description": "The time window to count the actions against.",
+ "required": true
+ },
+ "limit": {
+ "type": "integer",
+ "description": "The limit",
+ "required": true,
+ "constraints": [
+ {
+ "greater_than": 0
+ }
+ ]
+ },
+ "time_range": {
+ "type": "tosca.datatypes.TimeInterval",
+ "description": "An optional range of time during the day the frequency is valid for.",
+ "required": false
+ },
+ "controlLoopName": {
+ "type": "string",
+ "description": "An optional specific control loop to apply this guard to.",
+ "required": false
+ },
+ "target": {
+ "type": "string",
+ "description": "An optional specific VNF to apply this guard to.",
+ "required": false
+ }
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
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
new file mode 100644
index 00000000..71658dd4
--- /dev/null
+++ b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json
@@ -0,0 +1,66 @@
+{
+ "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.MinMax": {
+ "derived_from": "onap.policies.controlloop.Guard",
+ "version": "1.0.0",
+ "description": "Supports Min/Max number of VF Modules",
+ "properties": {
+ "minmax_policy": {
+ "type": "map",
+ "description": null,
+ "entry_schema": {
+ "type": "onap.datatypes.guard.MinMax"
+ }
+ }
+ }
+ }
+ }
+ ],
+ "data_types": [
+ {
+ "onap.datatypes.guard.MinMax": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "actor": {
+ "type": "string",
+ "description": "Specifies the Actor",
+ "required": true
+ },
+ "recipe": {
+ "type": "string",
+ "description": "Specified the Recipe",
+ "required": true
+ },
+ "time_range": {
+ "type": "tosca.datatypes.TimeInterval",
+ "description": "An optional range of time during the day the Min/Max limit is valid for.",
+ "required": false
+ },
+ "controlLoopName": {
+ "type": "string",
+ "description": "An optional specific control loop to apply this guard to.",
+ "required": false
+ },
+ "min_vf_module_instances": {
+ "type": "integer",
+ "required": true,
+ "description": "The minimum instances of this VF-Module"
+ },
+ "max_vf_module_instances": {
+ "type": "integer",
+ "required": false,
+ "description": "The maximum instances of this VF-Module"
+ }
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
index 0d820548..6be91739 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
@@ -144,7 +144,7 @@ public class TestApiRestServer {
};
private String[] toscaPolicyTypeResourceNames = {
- "policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json",
+ "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json",
"policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json"
};
@@ -447,7 +447,7 @@ public class TestApiRestServer {
main = startApiService(true);
for (String resrcName : legacyGuardPolicyResourceNames) {
Response rawResponse = createGuardPolicy(GUARD_POLICIES, resrcName, true);
- assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus());
}
}).doesNotThrowAnyException();
}
@@ -459,7 +459,7 @@ public class TestApiRestServer {
main = startApiService(true);
for (String resrcName : legacyOperationalPolicyResourceNames) {
Response rawResponse = createOperationalPolicy(OPS_POLICIES, resrcName, true);
- assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus());
}
}).doesNotThrowAnyException();
}
@@ -601,7 +601,7 @@ public class TestApiRestServer {
main = startApiService(false);
for (String resrcName : legacyGuardPolicyResourceNames) {
Response rawResponse = createGuardPolicy(GUARD_POLICIES, resrcName, false);
- assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus());
}
}).doesNotThrowAnyException();
}
@@ -613,7 +613,7 @@ public class TestApiRestServer {
main = startApiService(false);
for (String resrcName : legacyOperationalPolicyResourceNames) {
Response rawResponse = createOperationalPolicy(OPS_POLICIES, resrcName, false);
- assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
+ assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus());
}
}).doesNotThrowAnyException();
}
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java
index 76641aae..fb7c21c7 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java
@@ -40,6 +40,7 @@ import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
@@ -51,11 +52,16 @@ import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
public class TestLegacyGuardPolicyProvider {
private static LegacyGuardPolicyProvider guardPolicyProvider;
+ private static PolicyTypeProvider policyTypeProvider;
private static PolicyModelsProviderParameters providerParams;
private static ApiParameterGroup apiParamGroup;
private static StandardCoder standardCoder;
private static final String POLICY_RESOURCE = "policies/vDNS.policy.guard.frequency.input.json";
+ private static final String POLICY_TYPE_RESOURCE =
+ "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.json";
+ private static final String POLICY_TYPE_ID = "onap.policies.controlloop.guard.FrequencyLimiter:1.0.0";
+ private static final String POLICY_ID = "guard.frequency.scaleout:1.0.0";
/**
* Initializes parameters.
@@ -75,6 +81,7 @@ public class TestLegacyGuardPolicyProvider {
apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams);
ParameterService.register(apiParamGroup, true);
guardPolicyProvider = new LegacyGuardPolicyProvider();
+ policyTypeProvider = new PolicyTypeProvider();
}
/**
@@ -86,6 +93,7 @@ public class TestLegacyGuardPolicyProvider {
public static void tearDown() throws PfModelException {
guardPolicyProvider.close();
+ policyTypeProvider.close();
ParameterService.deregister(apiParamGroup);
}
@@ -105,6 +113,19 @@ public class TestLegacyGuardPolicyProvider {
@Test
public void testCreateGuardPolicy() {
+ assertThatThrownBy(() -> {
+ String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
+ LegacyGuardPolicyInput policyToCreate = standardCoder.decode(policyString, LegacyGuardPolicyInput.class);
+ guardPolicyProvider.createGuardPolicy(policyToCreate);
+ }).hasMessage("policy type " + POLICY_TYPE_ID + " for policy " + POLICY_ID + " does not exist");
+
+ assertThatCode(() -> {
+ String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE);
+ ToscaServiceTemplate policyTypeServiceTemplate =
+ standardCoder.decode(policyTypeString, ToscaServiceTemplate.class);
+ policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
+ }).doesNotThrowAnyException();
+
assertThatCode(() -> {
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
LegacyGuardPolicyInput policyToCreate = standardCoder.decode(policyString, LegacyGuardPolicyInput.class);
@@ -130,6 +151,13 @@ public class TestLegacyGuardPolicyProvider {
}).hasMessage("no policy found for policy ID: dummy");
assertThatCode(() -> {
+ String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE);
+ ToscaServiceTemplate policyTypeServiceTemplate =
+ standardCoder.decode(policyTypeString, ToscaServiceTemplate.class);
+ policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
+ }).doesNotThrowAnyException();
+
+ assertThatCode(() -> {
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
LegacyGuardPolicyInput policyToCreate = standardCoder.decode(policyString, LegacyGuardPolicyInput.class);
Map<String, LegacyGuardPolicyOutput> createdPolicy = guardPolicyProvider.createGuardPolicy(policyToCreate);
@@ -151,5 +179,10 @@ public class TestLegacyGuardPolicyProvider {
assertThatThrownBy(() -> {
guardPolicyProvider.deleteGuardPolicy("guard.frequency.scaleout", "1.0.0");
}).hasMessage("no policy found for policy ID: guard.frequency.scaleout");
+
+ assertThatCode(() -> {
+ policyTypeProvider.deletePolicyType("onap.policies.controlloop.guard.FrequencyLimiter", "1.0.0");
+ }).doesNotThrowAnyException();
+
}
}
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
index 8aa19793..b5bcbbd6 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
@@ -38,6 +38,7 @@ import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
/**
@@ -48,11 +49,15 @@ import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
public class TestLegacyOperationalPolicyProvider {
private static LegacyOperationalPolicyProvider operationalPolicyProvider;
+ private static PolicyTypeProvider policyTypeProvider;
private static PolicyModelsProviderParameters providerParams;
private static ApiParameterGroup apiParamGroup;
private static StandardCoder standardCoder;
private static final String POLICY_RESOURCE = "policies/vCPE.policy.operational.input.json";
+ private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.controlloop.Operational.json";
+ private static final String POLICY_TYPE_ID = "onap.policies.controlloop.Operational:1.0.0";
+ private static final String POLICY_ID = "operational.restart:1.0.0";
/**
* Initializes parameters.
@@ -72,6 +77,7 @@ public class TestLegacyOperationalPolicyProvider {
apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams);
ParameterService.register(apiParamGroup, true);
operationalPolicyProvider = new LegacyOperationalPolicyProvider();
+ policyTypeProvider = new PolicyTypeProvider();
}
/**
@@ -83,6 +89,7 @@ public class TestLegacyOperationalPolicyProvider {
public static void tearDown() throws PfModelException {
operationalPolicyProvider.close();
+ policyTypeProvider.close();
ParameterService.deregister(apiParamGroup);
}
@@ -101,6 +108,19 @@ public class TestLegacyOperationalPolicyProvider {
@Test
public void testCreateOperationalPolicy() {
+ assertThatThrownBy(() -> {
+ String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
+ LegacyOperationalPolicy policyToCreate = standardCoder.decode(policyString, LegacyOperationalPolicy.class);
+ operationalPolicyProvider.createOperationalPolicy(policyToCreate);
+ }).hasMessage("policy type " + POLICY_TYPE_ID + " for policy " + POLICY_ID + " does not exist");
+
+ assertThatCode(() -> {
+ String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE);
+ ToscaServiceTemplate policyTypeServiceTemplate =
+ standardCoder.decode(policyTypeString, ToscaServiceTemplate.class);
+ policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
+ }).doesNotThrowAnyException();
+
assertThatCode(() -> {
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
LegacyOperationalPolicy policyToCreate = standardCoder.decode(policyString, LegacyOperationalPolicy.class);
@@ -124,6 +144,13 @@ public class TestLegacyOperationalPolicyProvider {
}).hasMessage("no policy found for policy ID: dummy");
assertThatCode(() -> {
+ String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE);
+ ToscaServiceTemplate policyTypeServiceTemplate =
+ standardCoder.decode(policyTypeString, ToscaServiceTemplate.class);
+ policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
+ }).doesNotThrowAnyException();
+
+ assertThatCode(() -> {
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
LegacyOperationalPolicy policyToCreate = standardCoder.decode(policyString, LegacyOperationalPolicy.class);
LegacyOperationalPolicy createdPolicy = operationalPolicyProvider.createOperationalPolicy(policyToCreate);
@@ -142,5 +169,9 @@ public class TestLegacyOperationalPolicyProvider {
assertThatThrownBy(() -> {
operationalPolicyProvider.deleteOperationalPolicy("operational.restart", "1.0.0");
}).hasMessage("no policy found for policy ID: operational.restart");
+
+ assertThatCode(() -> {
+ policyTypeProvider.deletePolicyType("onap.policies.controlloop.Operational", "1.0.0");
+ }).doesNotThrowAnyException();
}
}
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
index 0ae718d1..8b1be3d5 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
@@ -52,7 +52,7 @@ public class TestPolicyProvider {
private static StandardCoder standardCoder;
private static final String POLICY_RESOURCE = "policies/vCPE.policy.monitoring.input.tosca.json";
- private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json";
+ private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json";
private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_ID = "policies/vCPE.policy.bad.policytypeid.json";
private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_VERSION =
"policies/vCPE.policy.bad.policytypeversion.json";
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
index 03d49332..7865453f 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
@@ -52,7 +52,7 @@ public class TestPolicyTypeProvider {
private static StandardCoder standardCoder;
private static final String POLICY_RESOURCE = "policies/vCPE.policy.monitoring.input.tosca.json";
- private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json";
+ private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json";
/**
* Initializes parameters.
diff --git a/main/src/test/resources/policytypes/onap.policies.controlloop.Operational.json b/main/src/test/resources/policytypes/onap.policies.controlloop.Operational.json
new file mode 100644
index 00000000..2d36a258
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.controlloop.Operational.json
@@ -0,0 +1,12 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "policy_types": [
+ {
+ "onap.policies.controlloop.Operational": {
+ "derived_from": "tosca.policies.Root",
+ "version": "1.0.0",
+ "description": "Operational Policy for Control Loops"
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/main/src/test/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.json b/main/src/test/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.json
new file mode 100644
index 00000000..598bd3c7
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.json
@@ -0,0 +1,77 @@
+{
+ "tosca_definitions_version": "tosca_simple_yaml_1_0_0",
+ "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.FrequencyLimiter": {
+ "derived_from": "onap.policies.controlloop.Guard",
+ "version": "1.0.0",
+ "description": "Supports limiting the frequency of actions being taken by a Actor.",
+ "properties": {
+ "frequency_policy": {
+ "type": "map",
+ "description": null,
+ "entry_schema": {
+ "type": "onap.datatypes.guard.FrequencyLimiter"
+ }
+ }
+ }
+ }
+ }
+ ],
+ "data_types": [
+ {
+ "onap.datatypes.guard.FrequencyLimiter": {
+ "derived_from": "tosca.datatypes.Root",
+ "properties": {
+ "actor": {
+ "type": "string",
+ "description": "Specifies the Actor",
+ "required": true
+ },
+ "recipe": {
+ "type": "string",
+ "description": "Specified the Recipe",
+ "required": true
+ },
+ "time_window": {
+ "type": "scalar-unit.time",
+ "description": "The time window to count the actions against.",
+ "required": true
+ },
+ "limit": {
+ "type": "integer",
+ "description": "The limit",
+ "required": true,
+ "constraints": [
+ {
+ "greater_than": 0
+ }
+ ]
+ },
+ "time_range": {
+ "type": "tosca.datatypes.TimeInterval",
+ "description": "An optional range of time during the day the frequency is valid for.",
+ "required": false
+ },
+ "controlLoopName": {
+ "type": "string",
+ "description": "An optional specific control loop to apply this guard to.",
+ "required": false
+ },
+ "target": {
+ "type": "string",
+ "description": "An optional specific VNF to apply this guard to.",
+ "required": false
+ }
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json b/main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json
index 1d1a4d64..1d1a4d64 100644
--- a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json
+++ b/main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json
diff --git a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml b/main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml
index 2985603a..2985603a 100644
--- a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml
+++ b/main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml