summaryrefslogtreecommitdiffstats
path: root/holmes-actions
diff options
context:
space:
mode:
authorVenkata Molluru <venkatamuralimohanreddy.molluru@techmahindra.com>2021-10-30 08:42:47 +0000
committerVenkata Molluru <venkatamuralimohanreddy.molluru@techmahindra.com>2021-10-30 08:42:47 +0000
commitf1958e194b60cd244db9e482ab4d6a84b33476fe (patch)
tree28532ee7ce3671bf9cbc41cfef4049e7628204c2 /holmes-actions
parent5d42272560178e4ecf72776e52e0ac143d62c2d6 (diff)
Add support to 7.1 VES data-stream in-parallel to 5.4
Change-Id: I9ee1d712c419cb95547e5f6125ff8f7b8c686b08 Issue-ID: HOLMES-308 Signed-off-by: Venkata Molluru <venkatamuralimohanreddy.molluru@techmahindra.com>
Diffstat (limited to 'holmes-actions')
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java3
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java32
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/utils/AlarmInfoMapper.java1
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/api/stat/VesAlarmTest.java18
-rw-r--r--holmes-actions/src/test/java/org/onap/holmes/common/utils/AlarmInfoMapperTest.java1
5 files changed, 34 insertions, 21 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java
index c7881d1..47aeb0d 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/AlarmInfo.java
@@ -44,6 +44,9 @@ public class AlarmInfo {
@SerializedName(value = "sourcename")
private String sourceName;
+ @SerializedName(value = "sequence")
+ private int sequence;
+
@SerializedName(value = "alarmiscleared")
private int alarmIsCleared;
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java
index ae71ad4..09daf54 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/VesAlarm.java
@@ -17,8 +17,9 @@
package org.onap.holmes.common.api.stat;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.TimeZone;
import lombok.Getter;
import lombok.Setter;
@@ -41,20 +42,23 @@ public class VesAlarm implements Cloneable, Serializable{
private String sourceId;
private String sourceName;
private Long startEpochMicrosec;
- private Long version;
+ private String version;
- private List<AlarmAdditionalField> alarmAdditionalInformation;
+ private Map<String, String> alarmAdditionalInformation;
private String alarmCondition;
private String alarmInterfaceA;
private String eventCategory;
private String eventSeverity;
private String eventSourceType;
- private Long faultFieldsVersion;
+ private String faultFieldsVersion;
private String specificProblem;
private String vfStatus;
private String parentId;
private int alarmIsCleared = 0; //mark as 1 when alarm type is cleared, else mark as 0
private int rootFlag = 0; // mark as 1 when alarm is a root alarm , else mark as 0
+ private String nfVendorName;
+ private String vesEventListenerVersion;
+ private TimeZone timeZoneOffset;
@Override
public int hashCode() {
@@ -91,18 +95,13 @@ public class VesAlarm implements Cloneable, Serializable{
vesAlarm.setSourceName(this.getSourceName());
vesAlarm.setStartEpochMicrosec(this.getStartEpochMicrosec());
vesAlarm.setVersion(this.getVersion());
-
if (alarmAdditionalInformation != null) {
- List<AlarmAdditionalField> alarmAdditionalFields = new ArrayList<>();
- alarmAdditionalInformation.forEach(alarmAdditionalField -> {
- AlarmAdditionalField alarmAdditionalField1 = new AlarmAdditionalField();
- alarmAdditionalField1.setName(alarmAdditionalField.getName());
- alarmAdditionalField1.setName(alarmAdditionalField.getValue());
- alarmAdditionalFields.add(alarmAdditionalField1);
- });
- vesAlarm.setAlarmAdditionalInformation(alarmAdditionalFields);
+ Map<String, String> alarmAdditionalFields = new HashMap<String, String>();
+ for(String key: alarmAdditionalInformation.keySet()) {
+ alarmAdditionalFields.put(key, alarmAdditionalInformation.get(key));
+ }
+ vesAlarm.setAlarmAdditionalInformation(alarmAdditionalFields);
}
-
vesAlarm.setAlarmCondition(this.getAlarmCondition());
vesAlarm.setAlarmInterfaceA(this.getAlarmInterfaceA());
vesAlarm.setEventCategory(this.getEventCategory());
@@ -113,6 +112,9 @@ public class VesAlarm implements Cloneable, Serializable{
vesAlarm.setVfStatus(this.vfStatus);
vesAlarm.setAlarmIsCleared(this.alarmIsCleared);
vesAlarm.setRootFlag(this.rootFlag);
+ vesAlarm.setVesEventListenerVersion(this.vesEventListenerVersion);
+ vesAlarm.setNfVendorName(this.nfVendorName);
+ vesAlarm.setTimeZoneOffset(this.timeZoneOffset);
return vesAlarm;
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/AlarmInfoMapper.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/AlarmInfoMapper.java
index 0c7d756..e5b0830 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/AlarmInfoMapper.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/AlarmInfoMapper.java
@@ -32,6 +32,7 @@ public class AlarmInfoMapper implements ResultSetMapper<AlarmInfo> {
alarmInfo.setEventName(resultSet.getString("eventname"));
alarmInfo.setSourceId(resultSet.getString("sourceid"));
alarmInfo.setSourceName(resultSet.getString("sourcename"));
+ alarmInfo.setSequence(resultSet.getInt("sequence"));
alarmInfo.setStartEpochMicroSec(resultSet.getLong("startepochmicrosec"));
alarmInfo.setLastEpochMicroSec(resultSet.getLong("lastepochmicrosec"));
return alarmInfo;
diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/api/stat/VesAlarmTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/api/stat/VesAlarmTest.java
index f046517..0f5a2b4 100644
--- a/holmes-actions/src/test/java/org/onap/holmes/common/api/stat/VesAlarmTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/api/stat/VesAlarmTest.java
@@ -19,7 +19,9 @@ package org.onap.holmes.common.api.stat;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.*;
-import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.TimeZone;
import org.junit.Test;
public class VesAlarmTest {
@@ -69,16 +71,20 @@ public class VesAlarmTest {
alarm.setSourceId("");
alarm.setSourceName("");
alarm.setStartEpochMicrosec(0L);
- alarm.setVersion(0L);
- alarm.setAlarmAdditionalInformation(new ArrayList<>());
- alarm.setAlarmCondition("");
+ alarm.setVersion("0");
+ alarm.setAlarmAdditionalInformation(new HashMap<>());
+ alarm.setAlarmCondition("");
alarm.setAlarmInterfaceA("");
alarm.setEventCategory("");
alarm.setEventSeverity("");
alarm.setEventSourceType("");
- alarm.setFaultFieldsVersion(0L);
+ alarm.setFaultFieldsVersion("0");
alarm.setSpecificProblem("");
alarm.setVfStatus("");
+ TimeZone offtime_zone = TimeZone.getTimeZone("Europe/Rome");
+ alarm.setTimeZoneOffset(offtime_zone);
+ alarm.setNfVendorName("");
+ alarm.setVesEventListenerVersion("0");
alarm.getDomain();
alarm.getEventId();
@@ -107,4 +113,4 @@ public class VesAlarmTest {
alarm.getVfStatus();
}
-} \ No newline at end of file
+}
diff --git a/holmes-actions/src/test/java/org/onap/holmes/common/utils/AlarmInfoMapperTest.java b/holmes-actions/src/test/java/org/onap/holmes/common/utils/AlarmInfoMapperTest.java
index 06bbfa8..3d36def 100644
--- a/holmes-actions/src/test/java/org/onap/holmes/common/utils/AlarmInfoMapperTest.java
+++ b/holmes-actions/src/test/java/org/onap/holmes/common/utils/AlarmInfoMapperTest.java
@@ -33,6 +33,7 @@ public class AlarmInfoMapperTest {
expect(resultSet.getString("eventname")).andReturn("");
expect(resultSet.getString("sourceid")).andReturn("");
expect(resultSet.getString("sourcename")).andReturn("");
+ expect(resultSet.getInt("sequence")).andReturn(0);
expect(resultSet.getLong("startepochmicrosec")).andReturn(0L);
expect(resultSet.getLong("lastepochmicrosec")).andReturn(0L);
expect(resultSet.getInt("alarmiscleared")).andReturn(0);