summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2017-10-24 11:49:46 +0200
committerxg353y <xg353y@intl.att.com>2017-10-26 14:56:41 +0200
commit1de3466a56a245223752c34423b7858117b56b73 (patch)
tree2866b9153e760a95a43fd80150c4d1d964674336 /src/test
parent8ecddd315559babae58e02d2e9a98da11fe54aa3 (diff)
Update TCA config json send to Policy
Update the format of the TCA configuration send to Policy Issue-ID: CLAMP-62 Change-Id: I53cbfcb1f8f8772856b645e8aec0db2a8a94d15e Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java3
-rw-r--r--src/test/resources/clds/clds-reference.properties6
-rw-r--r--src/test/resources/example/model-properties/tca/modelBpmnProperties.json6
-rw-r--r--src/test/resources/example/tca-policy-req/blueprint-expected.yaml4
-rw-r--r--src/test/resources/example/tca-policy-req/tca-policy-expected.json20
5 files changed, 27 insertions, 12 deletions
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
index 9daa97c6e..eb0214127 100644
--- a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java
@@ -69,12 +69,12 @@ public class ModelPropertiesTest {
assertNotNull(tca);
assertTrue(tca.isFound());
assertEquals("vFirewallBroadcastPackets", tca.getTcaItem().getEventName());
+ assertEquals("VNF", tca.getTcaItem().getControlLoopSchemaType());
assertEquals("policy1", tca.getTcaItem().getPolicyId());
assertEquals("f734f031-10aa-t8fb-330f-04dde2886325", tca.getTcaItem().getTcaUuId());
assertEquals(2, tca.getTcaItem().getTcaThresholds().size());
assertEquals("ABATED", tca.getTcaItem().getTcaThresholds().get(0).getClosedLoopEventStatus());
- assertEquals("VM", tca.getTcaItem().getTcaThresholds().get(0).getControlLoopSchema());
assertEquals(
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
tca.getTcaItem().getTcaThresholds().get(0).getFieldPath());
@@ -82,7 +82,6 @@ public class ModelPropertiesTest {
assertEquals(Integer.valueOf(123), tca.getTcaItem().getTcaThresholds().get(0).getThreshold());
assertEquals("ONSET", tca.getTcaItem().getTcaThresholds().get(1).getClosedLoopEventStatus());
- assertEquals("VNF", tca.getTcaItem().getTcaThresholds().get(1).getControlLoopSchema());
assertEquals("$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
tca.getTcaItem().getTcaThresholds().get(1).getFieldPath());
assertEquals("GREATER_OR_EQUAL", tca.getTcaItem().getTcaThresholds().get(1).getOperator());
diff --git a/src/test/resources/clds/clds-reference.properties b/src/test/resources/clds/clds-reference.properties
index 405b3ed6f..a9670e131 100644
--- a/src/test/resources/clds/clds-reference.properties
+++ b/src/test/resources/clds/clds-reference.properties
@@ -28,8 +28,10 @@
#
# TCA MicroService Policy request build properties
#
-tca.template={"cdap-tca-hi-lo_policy": {"domain": "measurementsForVfScaling","metricsPerEventName": [{"eventName": "???","policyScope": "DCAE","policyName": "???","policyVersion": "v0.0.1","thresholds": []}]}}
-tca.thresholds.template={"closedLoopControlName": "???", "controlLoopSchema": "VM","version": "1.0.2","fieldPath": "?????", "thresholdValue": 0,"direction": "???","severity": "MAJOR", "closedLoopEventStatus": "???"}
+tca.policyid.prefix=DCAE.Config_
+tca.policy.template={"service": "policy_tosca_tca", "version": "1.0.0", "location": "SampleServiceLocation", "configName": "SampleConfigName", "uuid": "test", "policyScope": "resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", "templateVersion": "OpenSource.version.1", "policyName": "MicroServicevCPE", "description": "MicroService Policy", "priority": "1", "riskType": "SampleRiskType", "riskLevel": "1", "guard": "False","content":{}}
+tca.template= {"domain": "measurementsForVfScaling", "metricsPerEventName": [{"eventName": "???", "controlLoopSchemaType":"VNF","policyScope": "DCAE","policyName": "???","policyVersion": "v0.0.1","thresholds": []}]}
+tca.thresholds.template={"closedLoopControlName": "???", "version": "1.0.2","fieldPath": "?????", "thresholdValue": 0,"direction": "???","severity": "MAJOR", "closedLoopEventStatus": "???"}
#
#
# DCAE request build properties
diff --git a/src/test/resources/example/model-properties/tca/modelBpmnProperties.json b/src/test/resources/example/model-properties/tca/modelBpmnProperties.json
index 0bfa78ce1..7bb4fe0bb 100644
--- a/src/test/resources/example/model-properties/tca/modelBpmnProperties.json
+++ b/src/test/resources/example/model-properties/tca/modelBpmnProperties.json
@@ -18,19 +18,21 @@
"value": "vFirewallBroadcastPackets"
},
{
+ "name": "controlLoopSchemaType",
+ "value": "VNF"
+ },
+ {
"serviceConfigurations": [
[
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
"LESS_OR_EQUAL",
"123",
- "VM",
"ABATED"
],
[
"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
"GREATER_OR_EQUAL",
"123",
- "VNF",
"ONSET"
]
]
diff --git a/src/test/resources/example/tca-policy-req/blueprint-expected.yaml b/src/test/resources/example/tca-policy-req/blueprint-expected.yaml
index 747d342c3..ffc50576f 100644
--- a/src/test/resources/example/tca-policy-req/blueprint-expected.yaml
+++ b/src/test/resources/example/tca-policy-req/blueprint-expected.yaml
@@ -30,7 +30,7 @@ node_templates:
subscriberMessageLimit: '-1', subscriberPollingInterval: '20000', subscriberProtocol: https,
subscriberTimeoutMS: '-1', subscriberTopicName: com.att.dcae.dmaap.mtnje2.DcaeTestVESSub,
subscriberUserName: m00502@tca.af.dcae.att.com, subscriberUserPassword: Te5021abc,
- tca_policy: '{"cdap-tca-hi-lo_policy":{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","policyScope":"DCAE","policyName":"example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","controlLoopSchema":"VNF","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"},{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","controlLoopSchema":"VNF","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"}]}]}}'}
+ tca_policy: '{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","controlLoopSchemaType":"VNF","policyScope":"DCAE","policyName":"DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4","policyVersion":"v0.0.1","thresholds":[{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"},{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"}]}]}'}
artifact_name: dcae-analytics-tca
artifact_version: 1.0.0
connections:
@@ -50,4 +50,4 @@ node_templates:
- {target: cdap_host_host, type: dcae.relationships.component_contained_in}
policy_0:
type: dcae.nodes.policy
- properties: {policy_id: nullexample_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4}
+ properties: {policy_id: DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4}
diff --git a/src/test/resources/example/tca-policy-req/tca-policy-expected.json b/src/test/resources/example/tca-policy-req/tca-policy-expected.json
index ce230918f..ad95c07b9 100644
--- a/src/test/resources/example/tca-policy-req/tca-policy-expected.json
+++ b/src/test/resources/example/tca-policy-req/tca-policy-expected.json
@@ -1,16 +1,29 @@
{
- "cdap-tca-hi-lo_policy": {
+ "service": "policy_tosca_tca",
+ "version": "1.0.0",
+ "location": "SampleServiceLocation",
+ "configName": "SampleConfigName",
+ "uuid": "test",
+ "policyScope": "resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
+ "templateVersion": "OpenSource.version.1",
+ "policyName": "DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
+ "description": "MicroService vCPE Policy",
+ "priority": "1",
+ "riskType": "SampleRiskType",
+ "riskLevel": "1",
+ "guard": "False",
+ "content": {
"domain": "measurementsForVfScaling",
"metricsPerEventName": [
{
"eventName": "vFirewallBroadcastPackets",
+ "controlLoopSchemaType": "VNF",
"policyScope": "DCAE",
- "policyName": "example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
+ "policyName": "DCAE.Config_example_model01.ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_TCA_1jy9to4",
"policyVersion": "v0.0.1",
"thresholds": [
{
"closedLoopControlName": "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null",
- "controlLoopSchema": "VNF",
"version": "1.0.2",
"fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
"thresholdValue": 123,
@@ -20,7 +33,6 @@
},
{
"closedLoopControlName": "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null",
- "controlLoopSchema": "VNF",
"version": "1.0.2",
"fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
"thresholdValue": 123,