From 4edf0fa48892bf38d0e3838d125e9bf2324b38e0 Mon Sep 17 00:00:00 2001 From: an4828 Date: Fri, 15 Sep 2017 15:28:53 -0400 Subject: Add support for ABATED alerts within CDAP TCA Change-Id: Iae560a2d0a47b30b41cd31206dc481a08e4930f7 Signed-off-by: an4828 Issue-ID: DCAEGEN2-107 Signed-off-by: an4828 --- .../apod/analytics/common/AnalyticsConstants.java | 27 +++++++++------- .../common/BaseAnalyticsCommonUnitTest.java | 2 +- .../filter/GenericJsonMessageFilterTest.java | 14 ++++---- .../common/utils/MessageProcessorUtilsTest.java | 4 +-- .../src/test/resources/data/json/cef_message.json | 37 ---------------------- 5 files changed, 26 insertions(+), 58 deletions(-) delete mode 100644 dcae-analytics-common/src/test/resources/data/json/cef_message.json (limited to 'dcae-analytics-common') diff --git a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/AnalyticsConstants.java b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/AnalyticsConstants.java index ec6a9b5..e7ce68d 100644 --- a/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/AnalyticsConstants.java +++ b/dcae-analytics-common/src/main/java/org/openecomp/dcae/apod/analytics/common/AnalyticsConstants.java @@ -103,15 +103,14 @@ public abstract class AnalyticsConstants { public static final String DMAAP_PUBLISHER_VARIABLE_NAME = "DMAAP_PUBLISHER"; // TCA VES Response Constants - public static final String TCA_VES_RESPONSE_TARGET_TYPE = "VNF"; - public static final String TCA_VES_RESPONSE_TARGET = "generic-vnf.vnf-id"; + // VNF Constants + public static final String TCA_VES_RESPONSE_VNF_TARGET_TYPE = "VNF"; + public static final String TCA_VES_RESPONSE_VNF_TARGET = "generic-vnf.vnf-id"; + // VM Constants + public static final String TCA_VES_RESPONSE_VM_TARGET_TYPE = "VM"; + public static final String TCA_VES_RESPONSE_VM_TARGET = "vserver.vserver-name"; + // VNF & VM - Common Constants public static final String TCA_VES_RESPONSE_FROM = "DCAE"; - public static final String TCA_VES_RESPONSE_CLOSED_LOOP_EVENT_STATUS = "ONSET"; - - // TCA VES Response Constants for vLoadBalancer - public static final String LOAD_BALANCER_FUNCTIONAL_ROLE = "vLoadBalancer"; - public static final String LOAD_BALANCER_TCA_VES_RESPONSE_TARGET_TYPE = "VM"; - public static final String LOAD_BALANCER_TCA_VES_RESPONSE_TARGET = "vserver.vserver-name"; // TCA VES Message Router Partition Key public static final String TCA_VES_MESSAGE_ROUTER_PARTITION_KEY = "VESMessageHash"; @@ -129,17 +128,23 @@ public abstract class AnalyticsConstants { /** * Default TTL for TCA VES Alerts table which contains alerts that can be send to downstream systems */ - public static final Integer TCA_DEFAULT_VES_ALERTS_TTL_TABLE = 60 * 60 * 24 * 20; // 20 Days + public static final Integer TCA_DEFAULT_VES_ALERTS_TTL_TABLE = 60 * 60 * 24 * 30; // 30 Days + + + /** + * Default TTL for TCA Alerts abatement table which contains information to send out abated alerts + */ + public static final Integer TCA_DEFAULT_ALERTS_ABATEMENT_TTL_TABLE = 60 * 60 * 24 * 30; // 30 Days // TCA Policy Runtime Argument Paths public static final String TCA_POLICY_DELIMITER = "."; public static final String TCA_POLICY_DOMAIN_PATH = "domain"; - public static final String TCA_POLICY_METRICS_PER_FUNCTIONAL_ROLE_PATH = "configuration.metricsPerFunctionalRole"; + public static final String TCA_POLICY_METRICS_PER_FUNCTIONAL_ROLE_PATH = "configuration.metricsPerEventName"; public static final String TCA_POLICY_THRESHOLDS_PATH_POSTFIX = "thresholds"; public static final String TCA_POLICY_JSON_KEY = "tca_policy"; - public static final String TCA_POLICY_STRING_DELIMITER = "'"; + public static final String TCA_POLICY_STRING_DELIMITER = "\""; private AnalyticsConstants() { diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/BaseAnalyticsCommonUnitTest.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/BaseAnalyticsCommonUnitTest.java index 9a42a97..81c8b57 100644 --- a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/BaseAnalyticsCommonUnitTest.java +++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/BaseAnalyticsCommonUnitTest.java @@ -35,7 +35,7 @@ public abstract class BaseAnalyticsCommonUnitTest extends BaseDCAEAnalyticsUnitT protected static final String TEST_MESSAGE_PROCESSOR_MESSAGE = "Test Processor Message"; - protected static final String CEF_MESSAGE_FILE_PATH = "data/json/cef_message.json"; + protected static final String CEF_MESSAGE_FILE_PATH = "data/json/cef/cef_message.json"; /* * Test implementation for {@link CDAPAppSettings} diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilterTest.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilterTest.java index 3a0d8bd..db72a03 100644 --- a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilterTest.java +++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/service/filter/GenericJsonMessageFilterTest.java @@ -48,7 +48,7 @@ public class GenericJsonMessageFilterTest extends BaseAnalyticsCommonUnitTest { final JsonMessageFilterProcessorContext finalMessageProcessorContext = processJsonMessageFilterChain(jsonMessage, "domainFilter", "$.event.commonEventHeader.domain", "measurementsForVfScaling", - "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall"); + "eventNameFilter", "$.event.commonEventHeader.eventName", "Mfvs_eNodeB_RANKPI"); assertJsonMessageAssertions(jsonMessage, finalMessageProcessorContext, true, true, 2); @@ -59,8 +59,8 @@ public class GenericJsonMessageFilterTest extends BaseAnalyticsCommonUnitTest { final JsonMessageFilterProcessorContext finalMessageProcessorContext = processJsonMessageFilterChain(jsonMessage, - "domainFilter", "$.event.commonEventHeader.sequence", "375", - "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall"); + "domainFilter", "$.event.commonEventHeader.sequence", "0", + "eventNameFilter", "$.event.commonEventHeader.eventName", "Mfvs_eNodeB_RANKPI"); assertJsonMessageAssertions(jsonMessage, finalMessageProcessorContext, true, true, 2); } @@ -71,7 +71,7 @@ public class GenericJsonMessageFilterTest extends BaseAnalyticsCommonUnitTest { final JsonMessageFilterProcessorContext finalMessageProcessorContext = processJsonMessageFilterChain(jsonMessage, "domainFilter", "$.event.commonEventHeader.domain", "xxxxxxxxxxx", - "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall"); + "functionalRoleFilter", "$.event.commonEventHeader.eventName", "vFirewall"); assertJsonMessageAssertions(jsonMessage, finalMessageProcessorContext, false, false, 1); } @@ -82,7 +82,7 @@ public class GenericJsonMessageFilterTest extends BaseAnalyticsCommonUnitTest { final JsonMessageFilterProcessorContext finalMessageProcessorContext = processJsonMessageFilterChain(jsonMessage, "domainFilter", "$.event.commonEventHeader.xxxxxxx", "measurementsForVfScaling", - "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall"); + "functionalRoleFilter", "$.event.commonEventHeader.eventName", "vFirewall"); assertJsonMessageAssertions(jsonMessage, finalMessageProcessorContext, false, false, 1); } @@ -93,7 +93,7 @@ public class GenericJsonMessageFilterTest extends BaseAnalyticsCommonUnitTest { final JsonMessageFilterProcessorContext finalMessageProcessorContext = processJsonMessageFilterChain("", "domainFilter", "$.event.commonEventHeader.domain", "measurementsForVfScaling", - "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall"); + "functionalRoleFilter", "$.event.commonEventHeader.eventName", "vFirewall"); assertJsonMessageAssertions("", finalMessageProcessorContext, false, null, 1); @@ -105,7 +105,7 @@ public class GenericJsonMessageFilterTest extends BaseAnalyticsCommonUnitTest { final JsonMessageFilterProcessorContext finalMessageProcessorContext = processJsonMessageFilterChain("invalidJson", "domainFilter", "$.event.commonEventHeader.domain", "measurementsForVfScaling", - "functionalRoleFilter", "$.event.commonEventHeader.functionalRole", "vFirewall"); + "functionalRoleFilter", "$.event.commonEventHeader.eventName", "vFirewall"); assertJsonMessageAssertions("invalidJson", finalMessageProcessorContext, false, null, 1); diff --git a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/utils/MessageProcessorUtilsTest.java b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/utils/MessageProcessorUtilsTest.java index 8f8c68f..5333150 100644 --- a/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/utils/MessageProcessorUtilsTest.java +++ b/dcae-analytics-common/src/test/java/org/openecomp/dcae/apod/analytics/common/utils/MessageProcessorUtilsTest.java @@ -42,8 +42,8 @@ public class MessageProcessorUtilsTest extends BaseAnalyticsCommonUnitTest { final Map> jsonFilterMappings = new HashMap<>(); jsonFilterMappings.put("$.event.commonEventHeader.domain", ImmutableSet.of("measurementsForVfScaling")); - jsonFilterMappings.put( - "$.event.commonEventHeader.functionalRole", ImmutableSet.of("vFirewall", "vLoadBalancer")); + jsonFilterMappings.put("$.event.commonEventHeader.eventName", + ImmutableSet.of("vFirewall", "vLoadBalancer", "Mfvs_eNodeB_RANKPI")); final JsonMessageFilterProcessorContext jsonMessageFilterProcessorContext = MessageProcessorUtils.processJsonFilterMappings(jsonMessage, jsonFilterMappings); diff --git a/dcae-analytics-common/src/test/resources/data/json/cef_message.json b/dcae-analytics-common/src/test/resources/data/json/cef_message.json deleted file mode 100644 index 52cf53b..0000000 --- a/dcae-analytics-common/src/test/resources/data/json/cef_message.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "event": { - "measurementsForVfScalingFields": { - "measurementInterval": 10, - "measurementsForVfScalingVersion": 1.1, - "vNicUsageArray": [ - { - "bytesIn": 6086, - "multicastPacketsIn": 0, - "multicastPacketsOut": 0, - "unicastPacketsIn": 0, - "broadcastPacketsOut": 0, - "packetsOut": 42, - "bytesOut": 7156, - "packetsIn": 93, - "broadcastPacketsIn": 0, - "vNicIdentifier": "eth0", - "unicastPacketsOut": 0 - } - ] - }, - "commonEventHeader": { - "reportingEntityName": "vpp-test", - "startEpochMicrosec": 1477070210290442, - "eventId": "375", - "lastEpochMicrosec": 1477070220290442, - "priority": "Normal", - "sequence": 375, - "sourceName": "Dummy VM name - No Metadata available", - "domain": "measurementsForVfScaling", - "functionalRole": "vFirewall", - "reportingEntityId": "No UUID available", - "version": 1.1, - "sourceId": "Dummy VM UUID - No Metadata available" - } - } -} -- cgit 1.2.3-korg