diff options
author | an4828 <nekrassov@att.com> | 2017-09-15 15:28:53 -0400 |
---|---|---|
committer | an4828 <nekrassov@att.com> | 2017-09-18 09:24:04 -0400 |
commit | 4edf0fa48892bf38d0e3838d125e9bf2324b38e0 (patch) | |
tree | 7216dae042828ec2cf38cb9300af1a32a17b3b91 /dcae-analytics-cdap-common/src/main | |
parent | 82aaf956855507e5a72d5ef5b45e398430d04a7a (diff) |
Add support for ABATED alerts within CDAP TCA
Change-Id: Iae560a2d0a47b30b41cd31206dc481a08e4930f7
Signed-off-by: an4828 <nekrassov@att.com>
Issue-ID: DCAEGEN2-107
Signed-off-by: an4828 <nekrassov@att.com>
Diffstat (limited to 'dcae-analytics-cdap-common/src/main')
7 files changed, 464 insertions, 64 deletions
diff --git a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/CDAPComponentsConstants.java b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/CDAPComponentsConstants.java index d00bc1b..3121c0e 100644 --- a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/CDAPComponentsConstants.java +++ b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/CDAPComponentsConstants.java @@ -158,6 +158,22 @@ public abstract class CDAPComponentsConstants { /** + * Fixed Name for TCA VES Alerts Abatement Flowlet + */ + public static final String TCA_FIXED_VES_ALERTS_ABATEMENT_NAME_FLOWLET = "TCAVESAlertsAbatementFlowlet"; + + /** + * Fixed Description for TCA VES Alerts Abatement Flowlet + */ + public static final String TCA_FIXED_VES_ALERTS_ABATEMENT_DESCRIPTION_FLOWLET = + "Determines if abatement event needs to be posted to downstream systems"; + + /** + * Fixed Name for TCA VES Alerts Abatement Flowlet output + */ + public static final String TCA_FIXED_VES_ALERTS_ABATEMENT_NAME_OUTPUT = "TCAVESAlertsAbatementFlowletOutput"; + + /** * Fixed Name for TCA VES Alerts Sink Flowlet */ public static final String TCA_FIXED_VES_ALERTS_SINK_NAME_FLOWLET = "TCAVESAlertsSinkFlowlet"; @@ -189,9 +205,20 @@ public abstract class CDAPComponentsConstants { /** * Fixed Description for TCA VES Alerts table which contains alerts that can be send to downstream systems */ - public static final String TCA_DEFAULT_VES_ALERTS_DESCRIPTION_TABLE = + public static final String TCA_FIXED_VES_ALERTS_DESCRIPTION_TABLE = "Stores alert messages that need to be DMaaP"; + /** + * Default Name for TCA Alerts abatement table which contains information to send out abated alerts + */ + public static final String TCA_DEFAULT_ALERTS_ABATEMENT_NAME_TABLE = "TCAAlertsAbatementTable"; + + /** + * Fixed Description for TCA Alerts abatement table which contains information to determine abatement alerts + */ + public static final String TCA_FIXED_ALERTS_ABATEMENT_DESCRIPTION_TABLE = + "Stores information to determine creation of abatement alerts"; + private CDAPComponentsConstants() { diff --git a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/domain/tca/ThresholdCalculatorOutput.java b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/domain/tca/ThresholdCalculatorOutput.java new file mode 100644 index 0000000..786faca --- /dev/null +++ b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/domain/tca/ThresholdCalculatorOutput.java @@ -0,0 +1,94 @@ +/* + * ===============================LICENSE_START====================================== + * dcae-analytics + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================LICENSE_END=========================================== + */ + +package org.openecomp.dcae.apod.analytics.cdap.common.domain.tca; + +import com.google.common.base.Objects; + +import java.io.Serializable; + +/** + * Simple POJO emitted by threshold calculator + * + * @author rs153v (Rajiv Singla) . Creation Date: 9/11/2017. + */ +public class ThresholdCalculatorOutput implements Serializable { + + private static final long serialVersionUID = 1L; + + private String cefMessage; + private String tcaPolicy; + private String violatedMetricsPerEventName; + private String alertMessage; + + public ThresholdCalculatorOutput() { + // no arg constructor + } + + public ThresholdCalculatorOutput(String cefMessage, String tcaPolicy, + String violatedMetricsPerEventName, String alertMessage) { + this.cefMessage = cefMessage; + this.tcaPolicy = tcaPolicy; + this.violatedMetricsPerEventName = violatedMetricsPerEventName; + this.alertMessage = alertMessage; + } + + public String getCefMessage() { + return cefMessage; + } + + public void setCefMessage(String cefMessage) { + this.cefMessage = cefMessage; + } + + public String getTcaPolicy() { + return tcaPolicy; + } + + public void setTcaPolicy(String tcaPolicy) { + this.tcaPolicy = tcaPolicy; + } + + public String getViolatedMetricsPerEventName() { + return violatedMetricsPerEventName; + } + + public void setViolatedMetricsPerEventName(String violatedMetricsPerEventName) { + this.violatedMetricsPerEventName = violatedMetricsPerEventName; + } + + public String getAlertMessage() { + return alertMessage; + } + + public void setAlertMessage(String alertMessage) { + this.alertMessage = alertMessage; + } + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("cefMessage", cefMessage) + .add("tcaPolicy", tcaPolicy) + .add("violatedMetricsPerEventName", violatedMetricsPerEventName) + .add("alertMessage", alertMessage) + .toString(); + } +} diff --git a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAAlertsAbatementEntity.java b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAAlertsAbatementEntity.java new file mode 100644 index 0000000..6f71801 --- /dev/null +++ b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAAlertsAbatementEntity.java @@ -0,0 +1,157 @@ +/* + * ===============================LICENSE_START====================================== + * dcae-analytics + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================LICENSE_END=========================================== + */ + +package org.openecomp.dcae.apod.analytics.cdap.common.persistance.tca; + +import com.google.common.base.Objects; +import org.apache.hadoop.io.Writable; +import org.apache.hadoop.io.WritableUtils; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.io.Serializable; + +/** + * TCA Alerts Abatement Entity is used to persist information to determine if abatement event need to sent to downstream + * systems + * + * @author rs153v (Rajiv Singla) . Creation Date: 9/11/2017. + */ +public class TCAAlertsAbatementEntity implements Writable, Serializable { + + private static final long serialVersionUID = 1L; + + private long creationTS; + private String requestId; + // Kept as string to avoid null checks + private String abatementSentTS; + + /** + * No Arg constructor required for Jackson Json Serialization / Deserialization + */ + public TCAAlertsAbatementEntity() { + // required no arg constructor + } + + /** + * Creates TCA Alerts Abatement Entity to persist information to determine if abatement alerts need to be posted + * + * @param creationTS record creation time + * @param requestId request ID of generated alert + * @param abatementSentTS time when abatement was sent out for that alert if any + */ + public TCAAlertsAbatementEntity(long creationTS, String requestId, String abatementSentTS) { + this.creationTS = creationTS; + this.requestId = requestId; + this.abatementSentTS = abatementSentTS; + } + + /** + * Timestamp when record was created + * + * @return timestamp when record was created + */ + public long getCreationTS() { + return creationTS; + } + + /** + * Set value for timestamp when record was created + * + * @param creationTS new value for timestamp when record was created + */ + public void setCreationTS(long creationTS) { + this.creationTS = creationTS; + } + + /** + * Request Id of ONSET alert which was sent + * + * @return request Id of ONSET alert which was sent + */ + public String getRequestId() { + return requestId; + } + + /** + * Set Request Id of ONSET alert + * + * @param requestId set new value for ONSET alert request id + */ + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + + /** + * Get abatement Sent Timestamp + * + * @return get abatement alert sent timestamp + */ + public String getAbatementSentTS() { + return abatementSentTS; + } + + /** + * Set timestamp when abatement alert is sent + * + * @param abatementSentTS sent new value for timestamp when abatement alert is sent + */ + public void setAbatementSentTS(String abatementSentTS) { + this.abatementSentTS = abatementSentTS; + } + + /** + * Write entity to Table + * + * @param dataOutput data output + * @throws IOException io exception + */ + @Override + public void write(DataOutput dataOutput) throws IOException { + WritableUtils.writeVLong(dataOutput, creationTS); + WritableUtils.writeString(dataOutput, requestId); + WritableUtils.writeString(dataOutput, abatementSentTS); + } + + /** + * Read entity from table + * + * @param dataInput data input + * @throws IOException io exception + */ + @Override + public void readFields(DataInput dataInput) throws IOException { + creationTS = WritableUtils.readVLong(dataInput); + requestId = WritableUtils.readString(dataInput); + abatementSentTS = WritableUtils.readString(dataInput); + } + + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("creationTS", creationTS) + .add("requestId", requestId) + .add("abatementSentTS", abatementSentTS) + .toString(); + } +} diff --git a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAAlertsAbatementPersister.java b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAAlertsAbatementPersister.java new file mode 100644 index 0000000..318fca8 --- /dev/null +++ b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAAlertsAbatementPersister.java @@ -0,0 +1,127 @@ +/* + * ===============================LICENSE_START====================================== + * dcae-analytics + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================LICENSE_END=========================================== + */ + +package org.openecomp.dcae.apod.analytics.cdap.common.persistance.tca; + +import co.cask.cdap.api.data.schema.Schema; +import co.cask.cdap.api.data.schema.UnsupportedTypeException; +import co.cask.cdap.api.dataset.DatasetProperties; +import co.cask.cdap.api.dataset.lib.IndexedTable; +import co.cask.cdap.api.dataset.lib.ObjectMappedTable; +import co.cask.cdap.api.dataset.lib.ObjectMappedTableProperties; +import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableList; +import org.openecomp.dcae.apod.analytics.cdap.common.CDAPComponentsConstants; +import org.openecomp.dcae.apod.analytics.common.exception.DCAEAnalyticsRuntimeException; +import org.openecomp.dcae.apod.analytics.common.utils.PersistenceUtils; +import org.openecomp.dcae.apod.analytics.model.domain.cef.EventListener; +import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.MetricsPerEventName; +import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.Threshold; +import org.openecomp.dcae.apod.analytics.model.facade.tca.TCAVESResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Date; +import java.util.List; + +import static org.openecomp.dcae.apod.analytics.common.utils.PersistenceUtils.TABLE_ROW_KEY_COLUMN_NAME; + +/** + * Utility methods to persist TCA Alerts Abatement information + * + * @author rs153v (Rajiv Singla) . Creation Date: 9/11/2017. + */ +public abstract class TCAAlertsAbatementPersister { + + private static final Logger LOG = LoggerFactory.getLogger(TCAAlertsAbatementPersister.class); + + private static final Joiner KEY_JOINER = Joiner.on(PersistenceUtils.ROW_KEY_DELIMITER); + + private TCAAlertsAbatementPersister() { + // private constructor + } + + /** + * Creates {@link DatasetProperties} for Alerts Table + * + * @param timeToLiveSeconds alerts table Time to Live + * + * @return Alerts Abatement table properties + */ + public static DatasetProperties getDatasetProperties(final int timeToLiveSeconds) { + try { + return ObjectMappedTableProperties.builder() + .setType(TCAAlertsAbatementEntity.class) + .setRowKeyExploreName(TABLE_ROW_KEY_COLUMN_NAME) + .setRowKeyExploreType(Schema.Type.STRING) + .add(IndexedTable.PROPERTY_TTL, timeToLiveSeconds) + .setDescription(CDAPComponentsConstants.TCA_FIXED_ALERTS_ABATEMENT_DESCRIPTION_TABLE) + .build(); + } catch (UnsupportedTypeException e) { + final String errorMessage = "Unable to convert TCAAlertsAbatementEntity class to Schema"; + throw new DCAEAnalyticsRuntimeException(errorMessage, LOG, e); + } + } + + + public static void persist(final EventListener eventListener, + final MetricsPerEventName violatedMetricsPerEventName, + final TCAVESResponse tcavesResponse, + final String abatementTS, + final ObjectMappedTable<TCAAlertsAbatementEntity> tcaAlertsAbatementTable) { + final String abatementTableKey = createKey(eventListener, violatedMetricsPerEventName); + + final long currentTimestamp = new Date().getTime(); + final String requestID = tcavesResponse.getRequestID(); + final TCAAlertsAbatementEntity tcaAlertsAbatementEntity = new TCAAlertsAbatementEntity(currentTimestamp, + requestID, abatementTS); + tcaAlertsAbatementTable.write(abatementTableKey, tcaAlertsAbatementEntity); + + LOG.debug("Persisted AlertsAbatementEntity: {} with Key: {}", tcaAlertsAbatementEntity, abatementTableKey); + + } + + public static TCAAlertsAbatementEntity lookUpByKey(final EventListener eventListener, + final MetricsPerEventName violatedMetricsPerEventName, + final ObjectMappedTable<TCAAlertsAbatementEntity> + tcaAlertsAbatementTable) { + final String abatementTableKey = createKey(eventListener, violatedMetricsPerEventName); + return tcaAlertsAbatementTable.read(abatementTableKey); + } + + + public static String createKey(final EventListener eventListener, + final MetricsPerEventName violatedMetricsPerEventName) { + // no null check required as all are required fields + final String eventName = violatedMetricsPerEventName.getEventName(); + final String sourceName = eventListener.getEvent().getCommonEventHeader().getSourceName(); + final String reportingEntityName = eventListener.getEvent().getCommonEventHeader().getReportingEntityName(); + // violated threshold will always be present + final Threshold violatedThreshold = violatedMetricsPerEventName.getThresholds().get(0); + final String closedLoopControlName = violatedThreshold.getClosedLoopControlName(); + final String fieldPath = violatedThreshold.getFieldPath(); + + final List<String> abatementKeyList = + ImmutableList.of(eventName, sourceName, reportingEntityName, closedLoopControlName, fieldPath); + + return KEY_JOINER.join(abatementKeyList); + } + +} diff --git a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAMessageStatusEntity.java b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAMessageStatusEntity.java index c529e55..d6b3099 100644 --- a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAMessageStatusEntity.java +++ b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAMessageStatusEntity.java @@ -22,12 +22,11 @@ package org.openecomp.dcae.apod.analytics.cdap.common.persistance.tca; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableUtils; -import org.openecomp.dcae.apod.analytics.model.domain.cef.EventSeverity; import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.Direction; import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.TCAPolicy; import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFJsonProcessor; import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyDomainFilter; -import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyFunctionalRoleFilter; +import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyEventNameFilter; import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyThresholdsProcessor; import java.io.DataInput; @@ -49,7 +48,7 @@ public class TCAMessageStatusEntity implements Writable, Serializable { private String messageType; private String vesMessage; private String domain; - private String functionalRole; + private String eventName; private String thresholdPath; private String thresholdSeverity; private String thresholdDirection; @@ -58,8 +57,8 @@ public class TCAMessageStatusEntity implements Writable, Serializable { private String jsonProcessorMessage; private String domainFilterStatus; private String domainFilterMessage; - private String functionalRoleFilterStatus; - private String functionalRoleFilterMessage; + private String eventNameFilterStatus; + private String eventNameFilterMessage; private String thresholdCalculatorStatus; private String thresholdCalculatorMessage; private String alertMessage; @@ -79,11 +78,11 @@ public class TCAMessageStatusEntity implements Writable, Serializable { * @param messageType {@link TCACalculatorMessageType} * @param vesMessage incoming VES message from collector * @param domain VES message domain if present - * @param functionalRole VES message functional role if present + * @param eventName VES message functional role if present */ public TCAMessageStatusEntity(final long creationTS, final int instanceId, final String messageType, - final String vesMessage, final String domain, final String functionalRole) { - this(creationTS, instanceId, messageType, vesMessage, domain, functionalRole, null, null, null, null, + final String vesMessage, final String domain, final String eventName) { + this(creationTS, instanceId, messageType, vesMessage, domain, eventName, null, null, null, null, null, null, null, null, null, null, null, null, null); } @@ -96,7 +95,7 @@ public class TCAMessageStatusEntity implements Writable, Serializable { * @param messageType {@link TCACalculatorMessageType} * @param vesMessage incoming VES message from collector * @param domain VES message domain if present - * @param functionalRole VES message functional role if present + * @param eventName VES message event name if present * @param thresholdPath Violated threshold path * @param thresholdSeverity Violated threshold Severity if any * @param thresholdDirection Violated threshold Direction if any @@ -105,23 +104,19 @@ public class TCAMessageStatusEntity implements Writable, Serializable { * @param jsonProcessorMessage {@link TCACEFJsonProcessor} message * @param domainFilterStatus {@link TCACEFPolicyDomainFilter} status * @param domainFilterMessage {@link TCACEFPolicyDomainFilter} message - * @param functionalRoleFilterStatus - * {@link TCACEFPolicyFunctionalRoleFilter} status - * @param functionalRoleFilterMessage - * {@link TCACEFPolicyFunctionalRoleFilter} message - * @param thresholdCalculatorStatus - * {@link TCACEFPolicyThresholdsProcessor} status - * @param thresholdCalculatorMessage - * {@link TCACEFPolicyThresholdsProcessor} message + * @param eventNameFilterStatus {@link TCACEFPolicyEventNameFilter} status + * @param eventNameFilterMessage {@link TCACEFPolicyEventNameFilter} message + * @param thresholdCalculatorStatus {@link TCACEFPolicyThresholdsProcessor} status + * @param thresholdCalculatorMessage {@link TCACEFPolicyThresholdsProcessor} message * @param alertMessage alert message that will be sent out in case of threshold violation */ public TCAMessageStatusEntity(long creationTS, int instanceId, String messageType, String vesMessage, - String domain, String functionalRole, + String domain, String eventName, String thresholdPath, String thresholdSeverity, String thresholdDirection, Long thresholdValue, String jsonProcessorStatus, String jsonProcessorMessage, String domainFilterStatus, String domainFilterMessage, - String functionalRoleFilterStatus, String functionalRoleFilterMessage, + String eventNameFilterStatus, String eventNameFilterMessage, String thresholdCalculatorStatus, String thresholdCalculatorMessage, String alertMessage) { this.creationTS = creationTS; @@ -129,7 +124,7 @@ public class TCAMessageStatusEntity implements Writable, Serializable { this.messageType = messageType; this.vesMessage = vesMessage; this.domain = domain; - this.functionalRole = functionalRole; + this.eventName = eventName; this.thresholdPath = thresholdPath; this.thresholdSeverity = thresholdSeverity; this.thresholdDirection = thresholdDirection; @@ -138,8 +133,8 @@ public class TCAMessageStatusEntity implements Writable, Serializable { this.jsonProcessorMessage = jsonProcessorMessage; this.domainFilterStatus = domainFilterStatus; this.domainFilterMessage = domainFilterMessage; - this.functionalRoleFilterStatus = functionalRoleFilterStatus; - this.functionalRoleFilterMessage = functionalRoleFilterMessage; + this.eventNameFilterStatus = eventNameFilterStatus; + this.eventNameFilterMessage = eventNameFilterMessage; this.thresholdCalculatorStatus = thresholdCalculatorStatus; this.thresholdCalculatorMessage = thresholdCalculatorMessage; this.alertMessage = alertMessage; @@ -237,21 +232,21 @@ public class TCAMessageStatusEntity implements Writable, Serializable { } /** - * Provides VES Message Functional Role + * Provides VES Message Event Name * - * @return ves message functional role + * @return ves message Event Name */ - public String getFunctionalRole() { - return functionalRole; + public String getEventName() { + return eventName; } /** * Sets VES Message Functional Role * - * @param functionalRole ves message Functional Role + * @param eventName ves message Functional Role */ - public void setFunctionalRole(String functionalRole) { - this.functionalRole = functionalRole; + public void setEventName(String eventName) { + this.eventName = eventName; } /** @@ -273,7 +268,7 @@ public class TCAMessageStatusEntity implements Writable, Serializable { } /** - * Violated threshold {@link EventSeverity} + * Violated threshold Event Severity * * @return event severity */ @@ -398,35 +393,35 @@ public class TCAMessageStatusEntity implements Writable, Serializable { this.domainFilterMessage = domainFilterMessage; } - public String getFunctionalRoleFilterStatus() { - return functionalRoleFilterStatus; + public String getEventNameFilterStatus() { + return eventNameFilterStatus; } /** - * Provides {@link TCACEFPolicyFunctionalRoleFilter} status + * Provides {@link TCACEFPolicyEventNameFilter} status * - * @param functionalRoleFilterStatus functional Role filter status + * @param eventNameFilterStatus functional Role filter status */ - public void setFunctionalRoleFilterStatus(String functionalRoleFilterStatus) { - this.functionalRoleFilterStatus = functionalRoleFilterStatus; + public void setEventNameFilterStatus(String eventNameFilterStatus) { + this.eventNameFilterStatus = eventNameFilterStatus; } /** - * Provides {@link TCACEFPolicyFunctionalRoleFilter} message + * Provides {@link TCACEFPolicyEventNameFilter} message * * @return functional role filter message */ - public String getFunctionalRoleFilterMessage() { - return functionalRoleFilterMessage; + public String getEventNameFilterMessage() { + return eventNameFilterMessage; } /** * Sets Functional Role filter message * - * @param functionalRoleFilterMessage functional role filter message + * @param eventNameFilterMessage functional role filter message */ - public void setFunctionalRoleFilterMessage(String functionalRoleFilterMessage) { - this.functionalRoleFilterMessage = functionalRoleFilterMessage; + public void setEventNameFilterMessage(String eventNameFilterMessage) { + this.eventNameFilterMessage = eventNameFilterMessage; } /** @@ -498,7 +493,7 @@ public class TCAMessageStatusEntity implements Writable, Serializable { WritableUtils.writeString(dataOutput, vesMessage); WritableUtils.writeString(dataOutput, domain); - WritableUtils.writeString(dataOutput, functionalRole); + WritableUtils.writeString(dataOutput, eventName); WritableUtils.writeString(dataOutput, thresholdPath); WritableUtils.writeString(dataOutput, thresholdSeverity); @@ -509,8 +504,8 @@ public class TCAMessageStatusEntity implements Writable, Serializable { WritableUtils.writeString(dataOutput, jsonProcessorMessage); WritableUtils.writeString(dataOutput, domainFilterStatus); WritableUtils.writeString(dataOutput, domainFilterMessage); - WritableUtils.writeString(dataOutput, functionalRoleFilterStatus); - WritableUtils.writeString(dataOutput, functionalRoleFilterMessage); + WritableUtils.writeString(dataOutput, eventNameFilterStatus); + WritableUtils.writeString(dataOutput, eventNameFilterMessage); WritableUtils.writeString(dataOutput, thresholdCalculatorStatus); WritableUtils.writeString(dataOutput, thresholdCalculatorMessage); @@ -532,7 +527,7 @@ public class TCAMessageStatusEntity implements Writable, Serializable { vesMessage = WritableUtils.readString(dataInput); domain = WritableUtils.readString(dataInput); - functionalRole = WritableUtils.readString(dataInput); + eventName = WritableUtils.readString(dataInput); thresholdPath = WritableUtils.readString(dataInput); thresholdSeverity = WritableUtils.readString(dataInput); @@ -543,8 +538,8 @@ public class TCAMessageStatusEntity implements Writable, Serializable { jsonProcessorMessage = WritableUtils.readString(dataInput); domainFilterStatus = WritableUtils.readString(dataInput); domainFilterMessage = WritableUtils.readString(dataInput); - functionalRoleFilterStatus = WritableUtils.readString(dataInput); - functionalRoleFilterMessage = WritableUtils.readString(dataInput); + eventNameFilterStatus = WritableUtils.readString(dataInput); + eventNameFilterMessage = WritableUtils.readString(dataInput); thresholdCalculatorStatus = WritableUtils.readString(dataInput); thresholdCalculatorMessage = WritableUtils.readString(dataInput); diff --git a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAMessageStatusPersister.java b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAMessageStatusPersister.java index 0f4c539..cb63ffb 100644 --- a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAMessageStatusPersister.java +++ b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAMessageStatusPersister.java @@ -34,11 +34,11 @@ import org.openecomp.dcae.apod.analytics.common.exception.DCAEAnalyticsRuntimeEx import org.openecomp.dcae.apod.analytics.common.service.processor.MessageProcessor; import org.openecomp.dcae.apod.analytics.common.service.processor.ProcessorContext; import org.openecomp.dcae.apod.analytics.common.utils.PersistenceUtils; -import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.MetricsPerFunctionalRole; +import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.MetricsPerEventName; import org.openecomp.dcae.apod.analytics.model.domain.policy.tca.Threshold; import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFJsonProcessor; import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyDomainFilter; -import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyFunctionalRoleFilter; +import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyEventNameFilter; import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFPolicyThresholdsProcessor; import org.openecomp.dcae.apod.analytics.tca.processor.TCACEFProcessorContext; import org.openecomp.dcae.apod.analytics.tca.utils.TCAUtils; @@ -102,12 +102,12 @@ public abstract class TCAMessageStatusPersister { final String vesMessage = StringEscapeUtils.unescapeJson(processorContext.getMessage()); // Find Functional Role and domain - final Pair<String, String> domainAndFunctionalRole = TCAUtils.getDomainAndFunctionalRole(processorContext); - final String domain = domainAndFunctionalRole.getLeft(); - final String functionalRole = domainAndFunctionalRole.getRight(); + final Pair<String, String> domainAndEventName = TCAUtils.getDomainAndEventName(processorContext); + final String domain = domainAndEventName.getLeft(); + final String eventName = domainAndEventName.getRight(); final TCAMessageStatusEntity tcaMessageStatusEntity = new TCAMessageStatusEntity(currentTS, - instanceId, calculatorMessageType.name(), vesMessage, domain, functionalRole); + instanceId, calculatorMessageType.name(), vesMessage, domain, eventName); // add threshold violation fields addViolatedThreshold(tcaMessageStatusEntity, processorContext); @@ -161,13 +161,13 @@ public abstract class TCAMessageStatusPersister { public static TCAMessageStatusEntity addViolatedThreshold(final TCAMessageStatusEntity tcaMessageStatusEntity, final TCACEFProcessorContext processorContext) { - final MetricsPerFunctionalRole metricsPerFunctionalRole = processorContext.getMetricsPerFunctionalRole(); + final MetricsPerEventName metricsPerEventName = processorContext.getMetricsPerEventName(); - if (metricsPerFunctionalRole != null - && metricsPerFunctionalRole.getThresholds() != null - && metricsPerFunctionalRole.getThresholds().get(0) != null) { + if (metricsPerEventName != null + && metricsPerEventName.getThresholds() != null + && metricsPerEventName.getThresholds().get(0) != null) { - final Threshold threshold = metricsPerFunctionalRole.getThresholds().get(0); + final Threshold threshold = metricsPerEventName.getThresholds().get(0); tcaMessageStatusEntity.setThresholdPath(threshold.getFieldPath()); tcaMessageStatusEntity.setThresholdSeverity(threshold.getSeverity().name()); tcaMessageStatusEntity.setThresholdDirection(threshold.getDirection().name()); @@ -209,9 +209,9 @@ public abstract class TCAMessageStatusPersister { tcaMessageStatusEntity.setDomainFilterMessage(processingMessage); } - if (messageProcessor.getClass().equals(TCACEFPolicyFunctionalRoleFilter.class)) { - tcaMessageStatusEntity.setFunctionalRoleFilterStatus(processingState); - tcaMessageStatusEntity.setFunctionalRoleFilterMessage(processingMessage); + if (messageProcessor.getClass().equals(TCACEFPolicyEventNameFilter.class)) { + tcaMessageStatusEntity.setEventNameFilterStatus(processingState); + tcaMessageStatusEntity.setEventNameFilterMessage(processingMessage); } if (messageProcessor.getClass().equals(TCACEFPolicyThresholdsProcessor.class)) { diff --git a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAVESAlertsPersister.java b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAVESAlertsPersister.java index 18293c7..36e3496 100644 --- a/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAVESAlertsPersister.java +++ b/dcae-analytics-cdap-common/src/main/java/org/openecomp/dcae/apod/analytics/cdap/common/persistance/tca/TCAVESAlertsPersister.java @@ -79,7 +79,7 @@ public abstract class TCAVESAlertsPersister { .setRowKeyExploreName(TABLE_ROW_KEY_COLUMN_NAME) .setRowKeyExploreType(Schema.Type.STRING) .add(IndexedTable.PROPERTY_TTL, timeToLiveSeconds) - .setDescription(CDAPComponentsConstants.TCA_DEFAULT_VES_ALERTS_DESCRIPTION_TABLE) + .setDescription(CDAPComponentsConstants.TCA_FIXED_VES_ALERTS_DESCRIPTION_TABLE) .build(); } catch (UnsupportedTypeException e) { final String errorMessage = "Unable to convert TCAVESAlertEntity class to Schema"; |