VOL-1209 Add alarm_type_name field to alarm extensions for publishing to Kafka
- Includes update to protos/events, adapter_agent and alarms/adapter_alarms.py
Change-Id: I49651bbcf50a384b1f3338110be79962e1a59fec
diff --git a/voltha/core/adapter_agent.py b/voltha/core/adapter_agent.py
index bf048d0..219fd84 100644
--- a/voltha/core/adapter_agent.py
+++ b/voltha/core/adapter_agent.py
@@ -952,7 +952,8 @@
severity=AlarmEventSeverity.MINOR,
state=AlarmEventState.RAISED,
context=None,
- logical_device_id=None):
+ logical_device_id=None,
+ alarm_type_name=None):
# Construct the ID if it is not provided
if id is None:
@@ -970,7 +971,8 @@
raised_ts=raised_ts,
changed_ts=changed_ts,
context=context,
- logical_device_id=logical_device_id
+ logical_device_id=logical_device_id,
+ alarm_type_name=alarm_type_name
)
def filter_alarm(self, device_id, alarm_event):
diff --git a/voltha/extensions/alarms/adapter_alarms.py b/voltha/extensions/alarms/adapter_alarms.py
index 5d3cfcb..fce8cf4 100644
--- a/voltha/extensions/alarms/adapter_alarms.py
+++ b/voltha/extensions/alarms/adapter_alarms.py
@@ -103,7 +103,8 @@
state=alarm_data.get('state'),
raised_ts=alarm_data.get('ts', 0),
context=current_context,
- logical_device_id=self.logical_device_id
+ logical_device_id=self.logical_device_id,
+ alarm_type_name=alarm_data.get('alarm_type_name')
)
self.adapter_agent.submit_alarm(self.device_id, alarm_event)
@@ -160,7 +161,8 @@
'type': self._alarm_type,
'category': self._alarm_category,
'severity': self._alarm_severity,
- 'state': AlarmEventState.RAISED if status else AlarmEventState.CLEARED
+ 'state': AlarmEventState.RAISED if status else AlarmEventState.CLEARED,
+ 'alarm_type_name': self._alarm
}
if self._resource_id is not None:
data['resource_id'] = self._resource_id
diff --git a/voltha/extensions/alarms/olt/olt_los_alarm.py b/voltha/extensions/alarms/olt/olt_los_alarm.py
index f6a1482..c8666a3 100644
--- a/voltha/extensions/alarms/olt/olt_los_alarm.py
+++ b/voltha/extensions/alarms/olt/olt_los_alarm.py
@@ -19,7 +19,7 @@
class OltLosAlarm(AlarmBase):
def __init__(self, alarm_mgr, intf_id, port_type_name):
super(OltLosAlarm, self).__init__(alarm_mgr, object_type='olt LOS',
- alarm='LOS',
+ alarm='OLT_LOS',
alarm_category=AlarmEventCategory.OLT,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_activation_fail_alarm.py b/voltha/extensions/alarms/onu/onu_activation_fail_alarm.py
index 1c30538..2bf054e 100644
--- a/voltha/extensions/alarms/onu/onu_activation_fail_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_activation_fail_alarm.py
@@ -18,7 +18,7 @@
class OnuActivationFailAlarm(AlarmBase):
def __init__(self, alarm_mgr, onu_id, intf_id):
super(OnuActivationFailAlarm, self).__init__(alarm_mgr, object_type='onu ACTIVATION FAIL',
- alarm='ACTIVATION_FAIL',
+ alarm='ONU_ACTIVATION_FAIL',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_discovery_alarm.py b/voltha/extensions/alarms/onu/onu_discovery_alarm.py
index 126cc00..c7da2bc 100644
--- a/voltha/extensions/alarms/onu/onu_discovery_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_discovery_alarm.py
@@ -18,7 +18,7 @@
class OnuDiscoveryAlarm(AlarmBase):
def __init__(self, alarm_mgr, pon_id, serial_number):
super(OnuDiscoveryAlarm, self).__init__(alarm_mgr, object_type='ONU Discovery',
- alarm='Discovery',
+ alarm='ONU_DISCOVERY',
alarm_category=AlarmEventCategory.PON,
resource_id=pon_id,
alarm_type=AlarmEventType.EQUIPMENT,
diff --git a/voltha/extensions/alarms/onu/onu_dying_gasp_alarm.py b/voltha/extensions/alarms/onu/onu_dying_gasp_alarm.py
index 72c6cb0..52b6850 100644
--- a/voltha/extensions/alarms/onu/onu_dying_gasp_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_dying_gasp_alarm.py
@@ -19,7 +19,7 @@
class OnuDyingGaspAlarm(AlarmBase):
def __init__(self, alarm_mgr, onu_id, intf_id):
super(OnuDyingGaspAlarm, self).__init__(alarm_mgr, object_type='onu DYING_GASP',
- alarm='DYING_GASP',
+ alarm='ONU_DYING_GASP',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_lob_alarm.py b/voltha/extensions/alarms/onu/onu_lob_alarm.py
index 9087cda..e595211 100644
--- a/voltha/extensions/alarms/onu/onu_lob_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_lob_alarm.py
@@ -18,7 +18,7 @@
class OnuLobAlarm(AlarmBase):
def __init__(self, alarm_mgr, onu_id, intf_id):
super(OnuLobAlarm, self).__init__(alarm_mgr, object_type='onu LOB',
- alarm='LOB',
+ alarm='ONU_LOB',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_lopc_mic_error_alarm.py b/voltha/extensions/alarms/onu/onu_lopc_mic_error_alarm.py
index c636d2b..cc05cb0 100644
--- a/voltha/extensions/alarms/onu/onu_lopc_mic_error_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_lopc_mic_error_alarm.py
@@ -19,7 +19,7 @@
class OnuLopcMicErrorAlarm(AlarmBase):
def __init__(self, alarm_mgr, onu_id, intf_id):
super(OnuLopcMicErrorAlarm, self).__init__(alarm_mgr, object_type='onu LOPC_MIC_ERROR',
- alarm='LOPC_MIC_ERROR',
+ alarm='ONU_LOPC_MIC_ERROR',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_lopc_miss_alarm.py b/voltha/extensions/alarms/onu/onu_lopc_miss_alarm.py
index 0f63716..af695ca 100644
--- a/voltha/extensions/alarms/onu/onu_lopc_miss_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_lopc_miss_alarm.py
@@ -19,7 +19,7 @@
class OnuLopcMissAlarm(AlarmBase):
def __init__(self, alarm_mgr, onu_id, intf_id):
super(OnuLopcMissAlarm, self).__init__(alarm_mgr, object_type='onu LOPC_MISS',
- alarm='LOPC_MISS',
+ alarm='ONU_LOPC_MISS',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_los_alarm.py b/voltha/extensions/alarms/onu/onu_los_alarm.py
index c2ad5d6..d2ebb7f 100644
--- a/voltha/extensions/alarms/onu/onu_los_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_los_alarm.py
@@ -18,7 +18,7 @@
class OnuLosAlarm(AlarmBase):
def __init__(self, alarm_mgr, onu_id, intf_id):
super(OnuLosAlarm, self).__init__(alarm_mgr, object_type='onu LOS',
- alarm='LOS',
+ alarm='ONU_LOS',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_signal_degrade_alarm.py b/voltha/extensions/alarms/onu/onu_signal_degrade_alarm.py
index a517b48..4861f75 100644
--- a/voltha/extensions/alarms/onu/onu_signal_degrade_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_signal_degrade_alarm.py
@@ -19,7 +19,7 @@
def __init__(self, alarm_mgr, onu_id, intf_id,
inverse_bit_error_rate):
super(OnuSignalDegradeAlarm, self).__init__(alarm_mgr, object_type='onu SIGNAL DEGRADE',
- alarm='SIGNAL_DEGRADE',
+ alarm='ONU_SIGNAL_DEGRADE',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_signal_fail_alarm.py b/voltha/extensions/alarms/onu/onu_signal_fail_alarm.py
index 6665d60..bcc629a 100644
--- a/voltha/extensions/alarms/onu/onu_signal_fail_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_signal_fail_alarm.py
@@ -25,7 +25,7 @@
class OnuSignalFailAlarm(AlarmBase):
def __init__(self, alarm_mgr, onu_id, intf_id, inverse_bit_error_rate):
super(OnuSignalFailAlarm, self).__init__(alarm_mgr, object_type='onu SIGNAL FAIL',
- alarm='SIGNAL_FAIL',
+ alarm='ONU_SIGNAL_FAIL',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_startup_alarm.py b/voltha/extensions/alarms/onu/onu_startup_alarm.py
index b937adb..9960f03 100644
--- a/voltha/extensions/alarms/onu/onu_startup_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_startup_alarm.py
@@ -27,7 +27,7 @@
def __init__(self, alarm_mgr, onu_id, intf_id):
super(OnuStartupAlarm, self).__init__(alarm_mgr, object_type='onu STARTUP FAIL',
- alarm='STARTUP_FAIL',
+ alarm='ONU_STARTUP_FAIL',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/extensions/alarms/onu/onu_window_drift_alarm.py b/voltha/extensions/alarms/onu/onu_window_drift_alarm.py
index 39af741..32d677d 100644
--- a/voltha/extensions/alarms/onu/onu_window_drift_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_window_drift_alarm.py
@@ -27,7 +27,7 @@
"""
def __init__(self, alarm_mgr, onu_id, intf_id, drift, new_eqd):
super(OnuWindowDriftAlarm, self).__init__(alarm_mgr, object_type='onu WINDOW DRIFT',
- alarm='WINDOW_DRIFT',
+ alarm='ONU_WINDOW_DRIFT',
alarm_category=AlarmEventCategory.ONU,
alarm_type=AlarmEventType.COMMUNICATION,
alarm_severity=AlarmEventSeverity.MAJOR)
diff --git a/voltha/protos/events.proto b/voltha/protos/events.proto
index 019f698..ed7ac8f 100644
--- a/voltha/protos/events.proto
+++ b/voltha/protos/events.proto
@@ -188,4 +188,7 @@
// logical device id
string logical_device_id = 12;
+
+ // alarm_type name indicates clearly the name of the alarm
+ string alarm_type_name = 13;
}