aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java91
-rw-r--r--src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.header2
-rw-r--r--src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policies/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/.file7
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.file101
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.header1
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/.header2
-rw-r--r--src/test/resources/http-cache/example/policy/pap/v1/pdps/.header2
-rw-r--r--src/test/resources/tosca/tca_hi_lo.json179
18 files changed, 359 insertions, 46 deletions
diff --git a/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java b/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java
index a98291be0..35ae9ed64 100644
--- a/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java
+++ b/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java
@@ -48,6 +48,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@@ -91,7 +92,7 @@ public class PolicyModelServiceItCase {
public void shouldCreatePolicyModel() {
// given
PolicyModel policyModel = getPolicyModel(POLICY_MODEL_TYPE_1, "yaml",
- POLICY_MODEL_TYPE_1_VERSION_1, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_1_VERSION_1, "TEST", "VARIANT", "user");
// when
PolicyModel actualPolicyModel = policyModelsService.saveOrUpdatePolicyModel(policyModel);
@@ -99,24 +100,24 @@ public class PolicyModelServiceItCase {
// then
assertThat(actualPolicyModel).isNotNull();
assertThat(actualPolicyModel).isEqualTo(policyModelsRepository
- .findById(new PolicyModelId(actualPolicyModel.getPolicyModelType(),
- actualPolicyModel.getVersion()))
- .get());
+ .findById(new PolicyModelId(actualPolicyModel.getPolicyModelType(),
+ actualPolicyModel.getVersion()))
+ .get());
assertThat(actualPolicyModel.getPolicyModelType())
- .isEqualTo(policyModel.getPolicyModelType());
+ .isEqualTo(policyModel.getPolicyModelType());
Assertions.assertThat(actualPolicyModel.getCreatedBy()).isEqualTo("Not found");
Assertions.assertThat(actualPolicyModel.getCreatedDate()).isNotNull();
assertThat(actualPolicyModel.getPolicyAcronym()).isEqualTo(policyModel.getPolicyAcronym());
assertThat(actualPolicyModel.getPolicyModelTosca())
- .isEqualTo(policyModel.getPolicyModelTosca());
+ .isEqualTo(policyModel.getPolicyModelTosca());
Assertions.assertThat(actualPolicyModel.getUpdatedBy()).isEqualTo("Not found");
Assertions.assertThat(actualPolicyModel.getUpdatedDate()).isNotNull();
assertThat(actualPolicyModel.getVersion()).isEqualTo(policyModel.getVersion());
assertThat(
- policyModelsService.getPolicyModel(POLICY_MODEL_TYPE_1, POLICY_MODEL_TYPE_1_VERSION_1))
+ policyModelsService.getPolicyModel(POLICY_MODEL_TYPE_1, POLICY_MODEL_TYPE_1_VERSION_1))
.isEqualToIgnoringGivenFields(policyModel, "createdDate", "updatedDate",
- "createdBy", "updatedBy");
+ "createdBy", "updatedBy");
}
/**
@@ -128,13 +129,36 @@ public class PolicyModelServiceItCase {
@Transactional
public void shouldCreatePolicyModelFromTosca() throws IOException {
String toscaModelYaml =
- ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml");
+ ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml");
PolicyModel policyModel = policyModelsService.createNewPolicyModelFromTosca(toscaModelYaml);
assertThat(policyModelsService.getAllPolicyModels()).contains(policyModel);
assertThat(policyModelsService.getPolicyModelTosca(policyModel.getPolicyModelType(),
- policyModel.getVersion())).contains(toscaModelYaml);
+ policyModel.getVersion())).contains(toscaModelYaml);
+ }
+
+ /**
+ * This tests the getPolicyModelJson. A json is expected.
+ *
+ * @throws IOException In case of failure
+ */
+ @Test
+ @Transactional
+ public void shouldGetPolicyModelInJson() throws IOException {
+ PolicyModel policyModel = getPolicyModel("onap.policies.monitoring.cdap.tca.hi.lo.app",
+ ResourceFileUtils.getResourceAsString(
+ "http-cache/example/policy/api/v1/policytypes/"
+ + "onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.file"),
+ "1.0.0", "TEST", "VARIANT", "user");
+ policyModelsService.saveOrUpdatePolicyModel(policyModel);
+
+ JsonObject policyTypeJson =
+ policyModelsService.getPolicyModelJson("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0");
+ assertThat(policyTypeJson).isNotNull();
+ JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/tca_hi_lo.json"),
+ policyTypeJson.toString(),
+ true);
}
/**
@@ -146,13 +170,13 @@ public class PolicyModelServiceItCase {
@Transactional
public void shouldUpdatePolicyModel() throws IOException {
String toscaModelYaml =
- ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml");
+ ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml");
PolicyModel policyModel = policyModelsService.createNewPolicyModelFromTosca(toscaModelYaml);
String newToscaModelYaml =
- ResourceFileUtils.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
+ ResourceFileUtils.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
PolicyModel updatedPolicyModel = policyModelsService.updatePolicyModelTosca(
- policyModel.getPolicyModelType(), policyModel.getVersion(), newToscaModelYaml);
+ policyModel.getPolicyModelType(), policyModel.getVersion(), newToscaModelYaml);
assertThat(updatedPolicyModel.getPolicyModelTosca()).isEqualTo(newToscaModelYaml);
@@ -166,15 +190,15 @@ public class PolicyModelServiceItCase {
public void shouldReturnAllPolicyModelTypes() {
// given
PolicyModel policyModel1 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
- POLICY_MODEL_TYPE_2_VERSION_1, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_2_VERSION_1, "TEST", "VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel1);
PolicyModel policyModel2 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
- POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel2);
List<String> policyModelTypesList = policyModelsService.getAllPolicyModelTypes();
assertThat(policyModelTypesList).contains(policyModel1.getPolicyModelType(),
- policyModel2.getPolicyModelType());
+ policyModel2.getPolicyModelType());
}
/**
@@ -184,10 +208,10 @@ public class PolicyModelServiceItCase {
@Transactional
public void shouldReturnAllPolicyModels() {
PolicyModel policyModel1 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
- POLICY_MODEL_TYPE_2_VERSION_1, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_2_VERSION_1, "TEST", "VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel1);
PolicyModel policyModel2 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
- POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel2);
assertThat(policyModelsService.getAllPolicyModels()).contains(policyModel1, policyModel2);
@@ -200,14 +224,14 @@ public class PolicyModelServiceItCase {
@Transactional
public void shouldReturnAllModelsByType() {
PolicyModel policyModel1 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
- POLICY_MODEL_TYPE_2_VERSION_1, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_2_VERSION_1, "TEST", "VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel1);
PolicyModel policyModel2 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
- POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel2);
assertThat(policyModelsService.getAllPolicyModelsByType(POLICY_MODEL_TYPE_2))
- .contains(policyModel1, policyModel2);
+ .contains(policyModel1, policyModel2);
}
/**
@@ -217,22 +241,22 @@ public class PolicyModelServiceItCase {
@Transactional
public void shouldReturnSortedSet() {
PolicyModel policyModel1 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
- POLICY_MODEL_TYPE_2_VERSION_1, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_2_VERSION_1, "TEST", "VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel1);
PolicyModel policyModel2 = getPolicyModel(POLICY_MODEL_TYPE_2, "yaml",
- POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_2_VERSION_2, "TEST", "VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel2);
PolicyModel policyModel3 = getPolicyModel(POLICY_MODEL_TYPE_3, "yaml",
- POLICY_MODEL_TYPE_3_VERSION_1, "TEST", "VARIANT", "user");
+ POLICY_MODEL_TYPE_3_VERSION_1, "TEST", "VARIANT", "user");
policyModelsService.saveOrUpdatePolicyModel(policyModel3);
SortedSet<PolicyModel> sortedSet = new TreeSet<>();
policyModelsService.getAllPolicyModels().forEach(sortedSet::add);
List<PolicyModel> listToCheck =
- sortedSet
- .stream().filter(policy -> policy.equals(policyModel3)
- || policy.equals(policyModel2) || policy.equals(policyModel1))
- .collect(Collectors.toList());
+ sortedSet
+ .stream().filter(policy -> policy.equals(policyModel3)
+ || policy.equals(policyModel2) || policy.equals(policyModel1))
+ .collect(Collectors.toList());
assertThat(listToCheck.get(0)).isEqualByComparingTo(policyModel2);
assertThat(listToCheck.get(1)).isEqualByComparingTo(policyModel1);
assertThat(listToCheck.get(2)).isEqualByComparingTo(policyModel3);
@@ -294,21 +318,22 @@ public class PolicyModelServiceItCase {
policyModelsService.updatePdpGroupInfo(pdpGroups);
JsonObject res1 =
- policyModelsService.getPolicyModel("org.onap.testos", "1.0.0").getPolicyPdpGroup();
+ policyModelsService.getPolicyModel("org.onap.testos", "1.0.0").getPolicyPdpGroup();
String expectedRes1 =
- "{\"supportedPdpGroups\":[{\"pdpGroup1\":[\"subGroup1\"]},{\"pdpGroup2\":[\"subGroup1\"]}]}";
+ "{\"supportedPdpGroups\":[{\"pdpGroup1\":[\"subGroup1\"]},{\"pdpGroup2\":[\"subGroup1\"]}]}";
JsonObject expectedJson1 = JsonUtils.GSON.fromJson(expectedRes1, JsonObject.class);
assertThat(res1).isEqualTo(expectedJson1);
JsonObject res2 =
- policyModelsService.getPolicyModel("org.onap.testos2", "2.0.0").getPolicyPdpGroup();
+ policyModelsService.getPolicyModel("org.onap.testos2", "2.0.0").getPolicyPdpGroup();
String expectedRes2 =
- "{\"supportedPdpGroups\":[{\"pdpGroup1\":[\"subGroup1\"]},{\"pdpGroup2\":[\"subGroup1\",\"subGroup2\"]}]}";
+ "{\"supportedPdpGroups\":[{\"pdpGroup1\":[\"subGroup1\"]},"
+ + "{\"pdpGroup2\":[\"subGroup1\",\"subGroup2\"]}]}";
JsonObject expectedJson2 = JsonUtils.GSON.fromJson(expectedRes2, JsonObject.class);
assertThat(res2).isEqualTo(expectedJson2);
JsonObject res3 =
- policyModelsService.getPolicyModel("org.onap.testos3", "1.0.0").getPolicyPdpGroup();
+ policyModelsService.getPolicyModel("org.onap.testos3", "1.0.0").getPolicyPdpGroup();
assertThat(res3).isNull();
}
}
diff --git a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.header b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.header
index 6a280d972..5464a754d 100644
--- a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.header
+++ b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflow-spec/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.header b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.header
+++ b/src/test/resources/http-cache/example/api/v1/blueprint-model/workflows/blueprint-name/baseconfiguration/version/1.0.0/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policies/.header b/src/test/resources/http-cache/example/policy/api/v1/policies/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policies/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policies/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file
index 7f5b897bf..50fcf9135 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.file
@@ -28,6 +28,13 @@ policy_types:
properties:
# Omitted for brevity, see Section 1
+ onap.policies.Naming:
+ version: 1.0.0
+ description: Supports blacklist of VNF's from performing control loop actions on.
+ derived_from: tosca.policies.Root
+ properties:
+ # Omitted for brevity, see Section 1
+
onap.policies.controlloop.guard.common.MinMax:
version: 1.0.0
description: Supports Min/Max number of VF Modules
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.file
new file mode 100644
index 000000000..a44435111
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.file
@@ -0,0 +1,101 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+policy_types:
+ onap.policies.Naming:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ name: onap.policies.Naming
+ description: Virtual policy node for naming
+ properties:
+ policy-instance-name:
+ type: string
+ naming-models:
+ type: list
+ entry_schema:
+ type: policy.data.naming-model-entity
+data_types:
+ policy.data.naming-model-entity:
+ derived_from: tosca.datatypes.Root
+ properties:
+ nfRole:
+ type: string
+ required: false
+ metadata:
+ matchable: true
+ naming-type:
+ type: string
+ required: true
+ metadata:
+ matchable: true
+ naming-recipe:
+ type: string
+ required: true
+ name-operation:
+ type: string
+ required: false
+ naming-properties:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.naming-property
+ policy.data.naming-property:
+ derived_from: tosca.datatypes.Root
+ properties:
+ property-name:
+ type: string
+ required: true
+ metadata:
+ matchable: true
+ property-value:
+ type: string
+ required: false
+ property-operation:
+ type: string
+ required: false
+ source-system:
+ type: string
+ required: false
+ source-endpoint:
+ type: string
+ required: false
+ increment-sequence:
+ type: policy.data.increment-sequence
+ required: false
+ policy.data.increment-sequence:
+ derived_from: tosca.nodes.Root
+ properties:
+ scope:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - CLOUD_REGION_ID
+ - LOCATION_CLLI
+ - VNF
+ - VM
+ - VFMODULE
+ - PRECEEDING
+ - TRAILING
+ - ENTIRETY
+ sequence-type:
+ type: string
+ require: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - numeric
+ - alpha-numeric
+ start-value:
+ type: string
+ required: true
+ max:
+ type: string
+ required: false
+ increment:
+ type: string
+ required: true
+ length:
+ type: string
+ required: true \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.header
new file mode 100644
index 000000000..b11784a21
--- /dev/null
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.Naming/versions/1.0.0/.header
@@ -0,0 +1 @@
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.Blacklist/versions/1.0.0/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/1.0.0/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.header
index 6a280d972..5464a754d 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.guard.common.MinMax/versions/2.0.0/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/.header b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/.header
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/http-cache/example/policy/pap/v1/pdps/.header b/src/test/resources/http-cache/example/policy/pap/v1/pdps/.header
index 6a280d972..b11784a21 100644
--- a/src/test/resources/http-cache/example/policy/pap/v1/pdps/.header
+++ b/src/test/resources/http-cache/example/policy/pap/v1/pdps/.header
@@ -1 +1 @@
-{"Transfer-Encoding": "chunked", "Set-Cookie": "JSESSIONID=158qxkdtdobkd1umr3ikkgrmlx;Path=/", "Expires": "Thu, 01 Jan 1970 00:00:00 GMT", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
+{"Transfer-Encoding": "chunked", "Server": "Jetty(9.3.21.v20170918)", "Content-Type": "application/json", "X-ECOMP-RequestID": "e2ddb3c8-994f-47df-b4dc-097d4fb55c08"} \ No newline at end of file
diff --git a/src/test/resources/tosca/tca_hi_lo.json b/src/test/resources/tosca/tca_hi_lo.json
new file mode 100644
index 000000000..cb3ed893f
--- /dev/null
+++ b/src/test/resources/tosca/tca_hi_lo.json
@@ -0,0 +1,179 @@
+{
+ "title": "onap.policies.monitoring.cdap.tca.hi.lo.app",
+ "type": "object",
+ "required": [
+ "tca_policy"
+ ],
+ "properties": {
+ "tca_policy": {
+ "title": "onap.datatypes.monitoring.tca_policy",
+ "type": "object",
+ "required": [
+ "domain",
+ "metricsPerEventName"
+ ],
+ "properties": {
+ "domain": {
+ "type": "string",
+ "description": "Domain name to which TCA needs to be applied",
+ "default": "measurementsForVfScaling",
+ "const": "measurementsForVfScaling"
+ },
+ "metricsPerEventName": {
+ "type": "array",
+ "description": "Contains eventName and threshold details that need to be applied to given eventName",
+ "items": {
+ "title": "onap.datatypes.monitoring.metricsPerEventName",
+ "type": "object",
+ "required": [
+ "controlLoopSchemaType",
+ "eventName",
+ "policyName",
+ "policyScope",
+ "policyVersion",
+ "thresholds"
+ ],
+ "properties": {
+ "controlLoopSchemaType": {
+ "type": "string",
+ "description": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM",
+ "enum": [
+ "VM",
+ "VNF"
+ ]
+ },
+ "eventName": {
+ "type": "string",
+ "description": "Event name to which thresholds need to be applied"
+ },
+ "policyName": {
+ "type": "string",
+ "description": "TCA Policy Scope Name"
+ },
+ "policyScope": {
+ "type": "string",
+ "description": "TCA Policy Scope"
+ },
+ "policyVersion": {
+ "type": "string",
+ "description": "TCA Policy Scope Version"
+ },
+ "thresholds": {
+ "type": "array",
+ "description": "Thresholds associated with eventName",
+ "items": {
+ "title": "onap.datatypes.monitoring.thresholds",
+ "type": "object",
+ "required": [
+ "closedLoopControlName",
+ "closedLoopEventStatus",
+ "direction",
+ "fieldPath",
+ "severity",
+ "thresholdValue",
+ "version"
+ ],
+ "properties": {
+ "closedLoopControlName": {
+ "type": "string",
+ "description": "Closed Loop Control Name associated with the threshold"
+ },
+ "closedLoopEventStatus": {
+ "type": "string",
+ "description": "Closed Loop Event Status of the threshold",
+ "enum": [
+ "ONSET",
+ "ABATED"
+ ]
+ },
+ "direction": {
+ "type": "string",
+ "description": "Direction of the threshold",
+ "enum": [
+ "LESS",
+ "LESS_OR_EQUAL",
+ "GREATER",
+ "GREATER_OR_EQUAL",
+ "EQUAL"
+ ]
+ },
+ "fieldPath": {
+ "type": "string",
+ "description": "Json field Path as per CEF message which needs to be analyzed for TCA",
+ "enum": [
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated",
+ "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle",
+ "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt",
+ "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice",
+ "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq",
+ "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal",
+ "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem",
+ "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait",
+ "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage",
+ "$.event.measurementsForVfScalingFields.meanRequestLatency",
+ "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered",
+ "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached",
+ "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured",
+ "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree",
+ "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed",
+ "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value"
+ ]
+ },
+ "severity": {
+ "type": "string",
+ "description": "Threshold Event Severity",
+ "enum": [
+ "CRITICAL",
+ "MAJOR",
+ "MINOR",
+ "WARNING",
+ "NORMAL"
+ ]
+ },
+ "thresholdValue": {
+ "type": "integer",
+ "description": "Threshold value for the field Path inside CEF message"
+ },
+ "version": {
+ "type": "string",
+ "description": "Version number associated with the threshold"
+ }
+ }
+ },
+ "format": "tabs-top"
+ }
+ }
+ },
+ "format": "tabs-top"
+ }
+ }
+ }
+ }
+} \ No newline at end of file