diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-05-18 15:52:02 +0200 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-05-18 15:52:02 +0200 |
commit | df19466321c94e4ec2c4e5ca5c8bf462602f2538 (patch) | |
tree | 5bee4eaa46cb5bcb10a4fe56706f003ac682f54e | |
parent | 4e68a4d91db14f6495c3a255bd422b50ff99c841 (diff) |
Fix duplicate thresholds
Fix issue detected when publishing multiple thresholds in the TCA UI
Issue-ID: CLAMP-165
Change-Id: I748f145c275a9e084effee451379e8c0615201d2
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
3 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java b/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java index 35c438d9..1478342c 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java +++ b/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java @@ -157,10 +157,9 @@ public class TcaRequestFormatter { private static void addThresholds(ClampProperties refProp, String service, ObjectNode appendToNode, TcaItem tcaItem, ModelProperties modelProperties) { ArrayNode tcaNodes = appendToNode.withArray("thresholds"); - ObjectNode tcaNode; try { - tcaNode = (ObjectNode) refProp.getJsonTemplate("tca.thresholds.template", service); for (TcaThreshold tcaThreshold : tcaItem.getTcaThresholds()) { + ObjectNode tcaNode = (ObjectNode) refProp.getJsonTemplate("tca.thresholds.template", service); tcaNode.put("closedLoopControlName", modelProperties.getControlNameAndPolicyUniqueId()); tcaNode.put("fieldPath", tcaThreshold.getFieldPath()); tcaNode.put("thresholdValue", tcaThreshold.getThreshold()); 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 4116b979..a35557cc 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: org.onap.dcae.dmaap.mtnje2.DcaeTestVESSub, subscriberUserName: m00502@tca.af.dcae.onap.org, subscriberUserPassword: Te5021abc, - tca_policy: '{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","controlLoopSchemaType":"VNF","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","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value","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.additionalMeasurements[*].arrayOfFields[0].value","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"}]}]}'} + tca_policy: '{"domain":"measurementsForVfScaling","metricsPerEventName":[{"eventName":"vFirewallBroadcastPackets","controlLoopSchemaType":"VNF","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","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value","thresholdValue":123,"direction":"LESS_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ABATED"},{"closedLoopControlName":"ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_null","version":"1.0.2","fieldPath":"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value","thresholdValue":123,"direction":"GREATER_OR_EQUAL","severity":"MAJOR","closedLoopEventStatus":"ONSET"}]}]}'} artifact_name: dcae-analytics-tca artifact_version: 1.0.0 connections: 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 5bf007bc..6e302dd6 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 @@ -28,9 +28,9 @@ "version": "1.0.2", "fieldPath": "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value", "thresholdValue": 123, - "direction": "GREATER_OR_EQUAL", + "direction": "LESS_OR_EQUAL", "severity": "MAJOR", - "closedLoopEventStatus": "ONSET" + "closedLoopEventStatus": "ABATED" }, { "closedLoopControlName": "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf_0", |