VOL-1141,VOL-894, VOL-886,VOL-891,VOL-887,VOL-1135

	- Added this group of alarms to voltha/adapters/openolt/openolt_alarms.py
	- Removed unnecessary voltha/adapters/openolt/alarms
		since these are now replaced by voltha/extensions/alarms
	- tested kafka message generation for all the new alarms.
	- removed unnecessary in openolt_alarms.py

Change-Id: Idd49716d640186404df29d5f2361beb15f54cec5
diff --git a/voltha/adapters/openolt/alarms/__init__.py b/voltha/adapters/openolt/alarms/__init__.py
deleted file mode 100644
index b0fb0b2..0000000
--- a/voltha/adapters/openolt/alarms/__init__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright 2017-present Open Networking Foundation
-#
-# 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.
diff --git a/voltha/adapters/openolt/alarms/adapter_alarms.py b/voltha/adapters/openolt/alarms/adapter_alarms.py
deleted file mode 100644
index 50d4d9b..0000000
--- a/voltha/adapters/openolt/alarms/adapter_alarms.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#
-# Copyright 2017 the original author or authors.
-#
-# 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.
-
-import structlog
-import arrow
-from voltha.protos.events_pb2 import AlarmEventType, \
-    AlarmEventSeverity, AlarmEventState, AlarmEventCategory
-
-# TODO: In the device adapter, the following alarms are still TBD
-# TODO: In the device adapter, the following alarms are still TBD
-#       (Taken from openolt_alarms
-
-
-# onu_alarm_ind
-# onu_startup_failure_indication
-# onu_signal_degrade_indication
-# onu_drift_of_window_ind
-# onu_loss_omci_ind
-# onu_signals_fail_ind
-# onu_tiwi_ind
-# onu_activation_fail_ind
-# onu_processing_error_ind
-
-
-class AdapterAlarms:
-    def __init__(self, adapter, device_id, logical_device_id):
-        self.log = structlog.get_logger(device_id=device_id)
-        self.adapter = adapter
-        self.device_id = device_id
-        self.logical_device_id = logical_device_id
-        self.lc = None
-
-    def format_id(self, alarm):
-        return 'voltha.{}.{}.{}'.format(self.adapter.adapter.name,
-                                        self.device_id,
-                                        alarm)
-
-    def format_description(self, _object, alarm, status):
-        return '{} Alarm - {} - {}'.format(_object.upper(),
-                                           alarm.upper(),
-                                           'Raised' if status else 'Cleared')
-
-    def send_alarm(self, context_data, alarm_data):
-        try:
-            current_context = {}
-
-            if isinstance(context_data, dict):
-                for key, value in context_data.iteritems():
-                    current_context[key] = str(value)
-
-            alarm_event = self.adapter.create_alarm(
-                id=alarm_data.get('id', 'voltha.{}.{}.olt'.format(self.adapter.adapter_name,
-                                                                  self.device_id)),
-                resource_id=str(alarm_data.get('resource_id', self.device_id)),
-                description="{}.{} - {}".format(self.adapter.adapter_name, self.device_id,
-                                                alarm_data.get('description')),
-                type=alarm_data.get('type'),
-                category=alarm_data.get('category'),
-                severity=alarm_data.get('severity'),
-                state=alarm_data.get('state'),
-                raised_ts=alarm_data.get('ts', 0),
-                context=current_context,
-                logical_device_id=self.logical_device_id
-            )
-            self.adapter.submit_alarm(self.device_id, alarm_event)
-
-        except Exception as e:
-            self.log.exception('failed-to-send-alarm', e=e)
-            raise Exception(e)
-
-
-class AlarmBase(object):
-    def __init__(self, handler, object_type, alarm,
-                 alarm_category,
-                 alarm_indication,
-                 resource_id=None,
-                 alarm_type=AlarmEventType.EQUIPMENT,
-                 alarm_severity=AlarmEventSeverity.CRITICAL
-                 ):
-
-        self._handler = handler
-        self._object_type = object_type
-        self._alarm = alarm
-        self._alarm_category = alarm_category
-        self._alarm_type = alarm_type
-        self._alarm_severity = alarm_severity
-        self._resource_id = resource_id
-        self.alarm_indication = alarm_indication
-
-    def get_alarm_data(self, status):
-        data = {
-            'ts': arrow.utcnow().timestamp,
-            'description': self._handler.format_description(self._object_type,
-                                                            self._alarm,
-                                                            status),
-            'id': self._handler.format_id(self._alarm),
-            'type': self._alarm_type,
-            'category': self._alarm_category,
-            'severity': self._alarm_severity,
-            'state': AlarmEventState.RAISED if status else AlarmEventState.CLEARED
-        }
-        if self._resource_id is not None:
-            data['resource_id'] = self._resource_id
-        return data
-
-    def get_context_data(self):
-        return {}   # You should override this if needed
-
-    def raise_alarm(self):
-        alarm_data = self.get_alarm_data(True)
-        context_data = self.get_context_data()
-        self._handler.send_alarm(context_data, alarm_data)
-
-    def clear_alarm(self):
-        alarm_data = self.get_alarm_data(False)
-        context_data = self.get_context_data()
-        self._handler.send_alarm(context_data, alarm_data)
diff --git a/voltha/adapters/openolt/alarms/heartbeat_alarm.py b/voltha/adapters/openolt/alarms/heartbeat_alarm.py
deleted file mode 100644
index 6115eb3..0000000
--- a/voltha/adapters/openolt/alarms/heartbeat_alarm.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2017-present Adtran, Inc.
-#
-# 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.
-from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
-from adapter_alarms import AlarmBase
-"""
-TODO:  To be Implemented in the openolt alarms
-"""
-
-
-class HeartbeatAlarm(AlarmBase):
-    def __init__(self, handler, object_type='olt', heartbeat_misses=0):
-        super(HeartbeatAlarm, self).__init__(handler, object_type,
-                                             alarm='Heartbeat',
-                                             alarm_category=AlarmEventCategory.PON,
-                                             alarm_type=AlarmEventType.EQUIPMENT,
-                                             alarm_severity=AlarmEventSeverity.CRITICAL)
-        self._misses = heartbeat_misses
-
-    def get_context_data(self):
-        return {'heartbeats-missed': self._misses}
-
diff --git a/voltha/adapters/openolt/alarms/olt_los_alarm.py b/voltha/adapters/openolt/alarms/olt_los_alarm.py
deleted file mode 100644
index bd1f8f7..0000000
--- a/voltha/adapters/openolt/alarms/olt_los_alarm.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2017-present Adtran, Inc.
-#
-# 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.
-
-from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
-from adapter_alarms import AlarmBase
-
-
-class OltLosAlarm(AlarmBase):
-    def __init__(self, handler, alarm_indication):
-        try:
-            super(OltLosAlarm, self).__init__(handler, 'olt LOS',
-                                              alarm='LOS',
-                                              alarm_indication=alarm_indication,
-                                              alarm_category=AlarmEventCategory.OLT,
-                                              alarm_type=AlarmEventType.COMMUNICATION,
-                                              alarm_severity=AlarmEventSeverity.MAJOR)
-            self._intf_id = self.alarm_indication.intf_id
-            self._status = self.alarm_indication.status
-        except Exception as e:
-            self._handler.adapter.log.exception("olt-los-alarm-object", errmsg=e.message)
-            raise Exception(e)
-
-    def get_context_data(self):
-        try:
-            retval = {'olt-id': self._handler.device_id,
-                      'logical-device-id': self._handler.logical_device_id,
-                      'olt-intf-id:': self.alarm_indication.intf_id
-                      }
-        except Exception as e:
-            raise Exception(e)
-        return retval
diff --git a/voltha/adapters/openolt/alarms/onu_active_alarm.py b/voltha/adapters/openolt/alarms/onu_active_alarm.py
deleted file mode 100644
index fa24ffc..0000000
--- a/voltha/adapters/openolt/alarms/onu_active_alarm.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 2017-present Adtran, Inc.
-#
-# 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.
-
-from adapter_alarms import AlarmBase
-from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
-"""
-TODO:  To be Implemented in the openolt alarms
-"""
-
-
-class OnuActiveAlarm(AlarmBase):
-    def __init__(self, handler, pon_id, serial_number, reg_id):
-        super(OnuActiveAlarm, self).__init__(handler, 'ONU',
-                                             alarm='ONU_ACTIVATED',
-                                             alarm_category=AlarmEventCategory.PON,
-                                             resource_id=pon_id,
-                                             alarm_type=AlarmEventType.EQUIPMENT,
-                                             alarm_severity=AlarmEventSeverity.CRITICAL)
-        self._pon_id = pon_id
-        self._serial_number = serial_number
-        self._device_id = handler.device_id
-        device = handler.adapter_agent.get_device(handler.device_id)
-        self._olt_serial_number = device.serial_number
-        self._host = device.ipv4_address
-        self._datapath_id = device.parent_id
-        self._reg_id = reg_id
-
-    def get_context_data(self):
-        return {
-            'pon-id': self._pon_id,
-            'serial-number': self._serial_number,
-            'host': self._host,
-            'olt_serial_number': self._olt_serial_number,
-            'datapath_id': self._datapath_id,
-            'device_id' : self._device_id,
-            'registration_id' : self._reg_id
-        }
-
-    def clear_alarm(self):
-        raise NotImplementedError('ONU Active Alarms are auto-clear')
-
diff --git a/voltha/adapters/openolt/alarms/onu_discovery_alarm.py b/voltha/adapters/openolt/alarms/onu_discovery_alarm.py
deleted file mode 100644
index f3e2b57..0000000
--- a/voltha/adapters/openolt/alarms/onu_discovery_alarm.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright 2017-present Adtran, Inc.
-#
-# 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.
-from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
-from adapter_alarms import AlarmBase
-"""
-TODO:  To be Implemented in the openolt alarms
-"""
-
-
-class OnuDiscoveryAlarm(AlarmBase):
-    def __init__(self, handler, pon_id, serial_number):
-        super(OnuDiscoveryAlarm, self).__init__(handler, 'ONU Discovery',
-                                                alarm='Discovery',
-                                                alarm_category=AlarmEventCategory.PON,
-                                                resource_id=pon_id,
-                                                alarm_type=AlarmEventType.EQUIPMENT,
-                                                alarm_severity=AlarmEventSeverity.CRITICAL)
-        self._pon_id = pon_id
-        self._serial_number = serial_number
-
-    def get_context_data(self):
-        return {
-            'pon-id': self._pon_id,
-            'serial-number': self._serial_number
-        }
-
-    def clear_alarm(self):
-        raise NotImplementedError('ONU Discovery Alarms are auto-clear')
diff --git a/voltha/adapters/openolt/alarms/onu_dying_gasp_alarm.py b/voltha/adapters/openolt/alarms/onu_dying_gasp_alarm.py
deleted file mode 100644
index 71d264f..0000000
--- a/voltha/adapters/openolt/alarms/onu_dying_gasp_alarm.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2017-present Adtran, Inc.
-#
-# 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.
-
-from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
-from adapter_alarms import AlarmBase
-
-
-class OnuDyingGaspAlarm(AlarmBase):
-    def __init__(self, handler, alarm_indication, onu_id):
-        super(OnuDyingGaspAlarm, self).__init__(handler, 'onu DYING_GASP',
-                                                alarm='DYING_GASP',
-                                                alarm_indication=alarm_indication,
-                                                alarm_category=AlarmEventCategory.ONU,
-                                                alarm_type=AlarmEventType.COMMUNICATION,
-                                                alarm_severity=AlarmEventSeverity.MINOR)
-        self._onu_id = onu_id
-        self._intf_id = self.alarm_indication.intf_id
-
-    def get_context_data(self):
-        try:
-            retval = {'onu-id': self._onu_id,
-                      'onu-intf-id': self._intf_id,
-                      "logical-device-id": self._handler.logical_device_id}
-        except Exception as e:
-            raise Exception(e)
-        return retval
diff --git a/voltha/adapters/openolt/openolt_alarms.py b/voltha/adapters/openolt/openolt_alarms.py
index 1a33ae3..5ebf20b 100644
--- a/voltha/adapters/openolt/openolt_alarms.py
+++ b/voltha/adapters/openolt/openolt_alarms.py
@@ -25,6 +25,12 @@
 from voltha.extensions.alarms.onu.onu_lopc_mic_error_alarm import OnuLopcMicErrorAlarm
 from voltha.extensions.alarms.onu.onu_lob_alarm import OnuLobAlarm
 
+from voltha.extensions.alarms.onu.onu_startup_alarm import OnuStartupAlarm
+from voltha.extensions.alarms.onu.onu_signal_degrade_alarm import OnuSignalDegradeAlarm
+from voltha.extensions.alarms.onu.onu_signal_fail_alarm import OnuSignalFailAlarm
+from voltha.extensions.alarms.onu.onu_window_drift_alarm import OnuWindowDriftAlarm
+from voltha.extensions.alarms.onu.onu_activation_fail_alarm import OnuActivationFailAlarm
+
 import protos.openolt_pb2 as openolt_pb2
 import voltha.protos.device_pb2 as device_pb2
 
@@ -42,6 +48,14 @@
         self.adapter_agent = adapter_agent
         self.device_id = device_id
         self.logical_device_id = logical_device_id
+        """
+        The following is added to reduce the continual posting of OLT LOS alarming
+        to Kafka.   Set enable_alarm_suppress = true to enable  otherwise the
+        current openolt bal will send continuous olt los alarm cleared messages
+        ONU disc raised counter is place holder for a future addition
+        """
+        self.enable_alarm_suppress = True
+        self.alarm_suppress = {"olt_los_clear": 0, "onu_disc_raised": []}  # Keep count of alarms to limit.
         try:
             self.alarms = AdapterAlarms(self.adapter_agent, self.device_id, self.logical_device_id)
         except Exception as initerr:
@@ -95,9 +109,17 @@
             try:
                 port_type_name = platform.intf_id_to_port_type_name(los_ind.intf_id)
                 if los_ind.status == 1 or los_ind.status == "on":
+                    # Zero out the suppression counter on OLT_LOS raise
+                    self.alarm_suppress['olt_los_clear'] = 0
                     OltLosAlarm(self.alarms, intf_id=los_ind.intf_id, port_type_name=port_type_name).raise_alarm()
                 else:
-                    OltLosAlarm(self.alarms, intf_id=los_ind.intf_id, port_type_name=port_type_name).clear_alarm()
+                    """ 
+                        Check if there has been more that one los clear following a previous los
+                    """
+                    if self.alarm_suppress['olt_los_clear'] == 0 and self.enable_alarm_suppress:
+                        OltLosAlarm(self.alarms, intf_id=los_ind.intf_id, port_type_name=port_type_name).clear_alarm()
+                        self.alarm_suppress['olt_los_clear'] += 1
+
             except Exception as alarm_err:
                 self.log.error('los-indication', errmsg=alarm_err.message)
         except Exception as e:
@@ -171,8 +193,6 @@
 
                 if onu_alarm_ind.los_status == 1 or onu_alarm_ind.los_status == "on":
                     OnuLosAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id).raise_alarm()
-                    # remove the discovered flag
-                    self.alarm_suppress['onu_disc_raised'].remove(serial_number)
                 elif onu_alarm_ind.los_status == 0 or onu_alarm_ind.los_status == "off":
                     OnuLosAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id).clear_alarm()
                 else:     # No Change
@@ -199,35 +219,222 @@
                 else:     # No Change
                     pass
             except Exception as alarm_err:
-                self.log.error('onu-alarm-indication', errmsg=alarm_err.message)
+                self.log.exception('onu-alarm-indication', errmsg=alarm_err.message)
 
         except Exception as e:
-            self.log.error('onu-alarm-indication', errmsg=e.message)
+            self.log.exception('onu-alarm-indication', errmsg=e.message)
 
     def onu_startup_failure_indication(self, onu_startup_fail_ind):
-        self.log.info('not implemented yet')
+        """
+        Current protobuf indicator:
+        message OnuStartupFailureIndication {
+                fixed32 intf_id = 1;
+                fixed32 onu_id = 2;
+                string status = 3;
+            }
+
+        :param onu_startup_fail_ind:
+        :return:
+        """
+        try:
+            ind = onu_startup_fail_ind
+            label = "onu-startup-failure-indication"
+            self.log.debug(label + " received", onu_startup_fail_ind=ind, int_id=ind.intf_id, onu_id=ind.onu_id, status=ind.status)
+            try:
+                if ind.status == 1 or ind.status == "on":
+                    OnuStartupAlarm(self.alarms, intf_id=ind.intf_id,onu_id=ind.onu_id).raise_alarm()
+                else:
+                    OnuStartupAlarm(self.alarms, intf_id=ind.intf_id, onu_id=ind.onu_id).clear_alarm()
+            except Exception as alarm_err:
+                self.log.exception(label, errmsg=alarm_err.message)
+
+        except Exception as e:
+            self.log.exception(label, errmsg=e.message)
 
     def onu_signal_degrade_indication(self, onu_signal_degrade_ind):
-        self.log.info('not implemented yet')
+        """
+        Current protobuf indicator:
+        OnuSignalDegradeIndication {
+            fixed32 intf_id = 1;
+            fixed32 onu_id = 2;
+            string status = 3;
+            fixed32 inverse_bit_error_rate = 4;
+        }
+        :param onu_signal_degrade_ind:
+        :return:
+        """
+        try:
+            ind = onu_signal_degrade_ind
+            label = "onu-signal-degrade-indication"
+            self.log.debug(label + ' received',
+                           onu_startup_fail_ind=ind,
+                           int_id=ind.intf_id,
+                           onu_id=ind.onu_id,
+                           inverse_bit_error_rate=ind.inverse_bit_error_rate,
+                           status=ind.status)
+            try:
+                if ind.status == 1 or ind.status == "on":
+                    OnuSignalDegradeAlarm(self.alarms, intf_id=ind.intf_id, onu_id=ind.onu_id,
+                                          inverse_bit_error_rate=ind.inverse_bit_error_rate).raise_alarm()
+                else:
+                    OnuSignalDegradeAlarm(self.alarms, intf_id=ind.intf_id, onu_id=ind.onu_id,
+                                          inverse_bit_error_rate=ind.inverse_bit_error_rate).clear_alarm()
+            except Exception as alarm_err:
+                self.log.exception(label, errmsg=alarm_err.message)
+
+        except Exception as e:
+            self.log.exception(label, errmsg=e.message)
 
     def onu_drift_of_window_indication(self, onu_drift_of_window_ind):
-        self.log.info('not implemented yet')
+        """
+        Current protobuf indicator:
+        OnuDriftOfWindowIndication {
+            fixed32 intf_id = 1;
+            fixed32 onu_id = 2;
+            string status = 3;
+            fixed32 drift = 4;
+            fixed32 new_eqd = 5;
+        }
+
+        :param onu_drift_of_window_ind:
+        :return:
+        """
+        try:
+            ind = onu_drift_of_window_ind
+            label = "onu-window-drift-indication"
+
+            onu_device_id, onu_serial_number = self.resolve_onudev_id_onudev_serialnum(
+                self.resolve_onu_id(ind.onu_id, port_intf_id=ind.intf_id))
+
+            self.log.debug(label + ' received',
+                           onu_drift_of_window_ind=ind,
+                           int_id=ind.intf_id,
+                           onu_id=ind.onu_id,
+                           onu_device_id=onu_device_id,
+                           drift=ind.drift,
+                           new_eqd=ind.new_eqd,
+                           status=ind.status)
+            try:
+                if ind.status == 1 or ind.status == "on":
+                    OnuWindowDriftAlarm(self.alarms, intf_id=ind.intf_id,
+                           onu_id=onu_device_id,
+                           drift=ind.drift,
+                           new_eqd=ind.new_eqd).raise_alarm()
+                else:
+                    OnuWindowDriftAlarm(self.alarms, intf_id=ind.intf_id,
+                           onu_id=onu_device_id,
+                           drift=ind.drift,
+                           new_eqd=ind.new_eqd).clear_alarm()
+            except Exception as alarm_err:
+                self.log.exception(label, errmsg=alarm_err.message)
+
+        except Exception as e:
+            self.log.exception(label, errmsg=e.message)
 
     def onu_loss_omci_indication(self, onu_loss_omci_ind):
         self.log.info('not implemented yet')
 
     def onu_signals_failure_indication(self, onu_signals_fail_ind):
-        self.log.info('not implemented yet')
+        """
+        Current protobuf indicator:
+        OnuSignalsFailureIndication {
+            fixed32 intf_id = 1;
+            fixed32 onu_id = 2;
+            string status = 3;
+            fixed32 inverse_bit_error_rate = 4;
+        }
+
+        :param onu_signals_fail_ind:
+        :return:
+        """
+        try:
+            ind = onu_signals_fail_ind
+            label = "onu-signal-failure-indication"
+
+            onu_device_id, onu_serial_number = self.resolve_onudev_id_onudev_serialnum(
+                self.resolve_onu_id(ind.onu_id, port_intf_id=ind.intf_id))
+
+            self.log.debug(label + ' received',
+                           onu_startup_fail_ind=ind,
+                           int_id=ind.intf_id,
+                           onu_id=ind.onu_id,
+                           onu_device_id=onu_device_id,
+                           onu_serial_number=onu_serial_number,
+                           inverse_bit_error_rate=ind.inverse_bit_error_rate,
+                           status=ind.status)
+            try:
+                if ind.status == 1 or ind.status == "on":
+                    OnuSignalFailAlarm(self.alarms, intf_id=ind.intf_id,
+                           onu_id=onu_device_id,
+                           inverse_bit_error_rate=ind.inverse_bit_error_rate).raise_alarm()
+                else:
+                    OnuSignalFailAlarm(self.alarms, intf_id=ind.intf_id,
+                           onu_id=onu_device_id,
+                           inverse_bit_error_rate=ind.inverse_bit_error_rate).clear_alarm()
+            except Exception as alarm_err:
+                self.log.exception(label, errmsg=alarm_err.message)
+
+        except Exception as e:
+            self.log.exception(label, errmsg=e.message)
+
 
     def onu_transmission_interference_warning(self, onu_tiwi_ind):
         self.log.info('not implemented yet')
 
     def onu_activation_failure_indication(self, onu_activation_fail_ind):
-        self.log.info('not implemented yet')
+        """
+
+        No status is currently passed with this alarm. Consequently it will always just raise
+        :param onu_activation_fail_ind:
+        :return:
+        """
+        try:
+            ind = onu_activation_fail_ind
+            label = "onu-activation-failure-indication"
+
+            onu_device_id, onu_serial_number = self.resolve_onudev_id_onudev_serialnum(
+                self.resolve_onu_id(ind.onu_id, port_intf_id=ind.intf_id))
+
+            self.log.debug(label + ' received',
+                           onu_startup_fail_ind=ind,
+                           int_id=ind.intf_id,
+                           onu_id=ind.onu_id,
+                           onu_device_id=onu_device_id,
+                           onu_serial_number=onu_serial_number)
+            try:
+
+                OnuActivationFailAlarm(self.alarms, intf_id=ind.intf_id,
+                       onu_id=onu_device_id).raise_alarm()
+            except Exception as alarm_err:
+                self.log.exception(label, errmsg=alarm_err.message)
+
+        except Exception as e:
+            self.log.exception(label, errmsg=e.message)
 
     def onu_processing_error_indication(self, onu_processing_error_ind):
         self.log.info('not implemented yet')
 
+    """
+    Helper Methods
+    """
+
+    def resolve_onudev_id_onudev_serialnum(self,onu_device):
+        """
+        Convenience wrapper to resolve device_id and serial number
+        :param onu_device:
+        :return: tuple: onu_device_id, onu_serial_number
+        """
+        try:
+            onu_device_id = "unresolved"
+            onu_serial_number = "unresolved"
+            if onu_device != None:
+                onu_device_id = onu_device.id
+                onu_serial_number = onu_device.serial_number
+        except Exception as err:
+            self.log.exception("openolt-alarms-resolve-onudev-id  ", errmsg=err.message)
+            raise Exception(err)
+        return onu_device_id, onu_serial_number
+
     def resolve_onu_id(self, onu_id, port_intf_id):
         """
         Resolve the onu_device from the intf_id value and port. Uses the adapter agent to
@@ -252,4 +459,3 @@
 
         return onu_device
 
-
diff --git a/voltha/adapters/openolt/alarms/onu_los_alarm.py b/voltha/extensions/alarms/onu/onu_activation_fail_alarm.py
similarity index 69%
rename from voltha/adapters/openolt/alarms/onu_los_alarm.py
rename to voltha/extensions/alarms/onu/onu_activation_fail_alarm.py
index 1bfdd4d..1c30538 100644
--- a/voltha/adapters/openolt/alarms/onu_los_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_activation_fail_alarm.py
@@ -11,23 +11,20 @@
 # 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.
-
 from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
-from adapter_alarms import AlarmBase
-"""
-TODO:  To be Implemented in the openolt alarms
-"""
+from voltha.extensions.alarms.adapter_alarms import AlarmBase
 
 
-class OnuLosAlarm(AlarmBase):
-    def __init__(self, handler, onu_id, intf_id):
-        super(OnuLosAlarm, self).__init__(handler, 'onu LOS',
-                                          alarm='LOS',
-                                          alarm_category=AlarmEventCategory.ONT,
+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_category=AlarmEventCategory.ONU,
                                           alarm_type=AlarmEventType.COMMUNICATION,
                                           alarm_severity=AlarmEventSeverity.MAJOR)
         self._onu_id = onu_id
         self._intf_id = intf_id
 
     def get_context_data(self):
-        return {'onu-id': self._onu_id}
+        return {'onu-id': self._onu_id,
+                'onu-intf-id': self._intf_id}
diff --git a/voltha/adapters/openolt/alarms/onu_los_alarm.py b/voltha/extensions/alarms/onu/onu_signal_degrade_alarm.py
similarity index 62%
copy from voltha/adapters/openolt/alarms/onu_los_alarm.py
copy to voltha/extensions/alarms/onu/onu_signal_degrade_alarm.py
index 1bfdd4d..a517b48 100644
--- a/voltha/adapters/openolt/alarms/onu_los_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_signal_degrade_alarm.py
@@ -11,23 +11,23 @@
 # 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.
-
 from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
-from adapter_alarms import AlarmBase
-"""
-TODO:  To be Implemented in the openolt alarms
-"""
+from voltha.extensions.alarms.adapter_alarms import AlarmBase
 
 
-class OnuLosAlarm(AlarmBase):
-    def __init__(self, handler, onu_id, intf_id):
-        super(OnuLosAlarm, self).__init__(handler, 'onu LOS',
-                                          alarm='LOS',
-                                          alarm_category=AlarmEventCategory.ONT,
+class OnuSignalDegradeAlarm(AlarmBase):
+    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_category=AlarmEventCategory.ONU,
                                           alarm_type=AlarmEventType.COMMUNICATION,
                                           alarm_severity=AlarmEventSeverity.MAJOR)
         self._onu_id = onu_id
         self._intf_id = intf_id
+        self._inverse_bit_error_rate=inverse_bit_error_rate
 
     def get_context_data(self):
-        return {'onu-id': self._onu_id}
+        return {'onu-id': self._onu_id,
+                'onu-intf-id': self._intf_id,
+                'inverse-bit-error-rate': self._inverse_bit_error_rate}
diff --git a/voltha/extensions/alarms/onu/onu_signal_fail_alarm.py b/voltha/extensions/alarms/onu/onu_signal_fail_alarm.py
new file mode 100644
index 0000000..6665d60
--- /dev/null
+++ b/voltha/extensions/alarms/onu/onu_signal_fail_alarm.py
@@ -0,0 +1,39 @@
+# Copyright 2017-present Adtran, Inc.
+#
+# 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.
+from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
+from voltha.extensions.alarms.adapter_alarms import AlarmBase
+
+"""
+    OnuSignalsFailureIndication {
+                fixed32 intf_id = 1;
+                fixed32 onu_id = 2;
+                string status = 3;
+                fixed32 inverse_bit_error_rate = 4;
+"""
+
+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_category=AlarmEventCategory.ONU,
+                                          alarm_type=AlarmEventType.COMMUNICATION,
+                                          alarm_severity=AlarmEventSeverity.MAJOR)
+        self._onu_id = onu_id
+        self._intf_id = intf_id
+        self._inverse_bit_error_rate = inverse_bit_error_rate
+
+    def get_context_data(self):
+        return {'onu-id': self._onu_id,
+                'onu-intf-id': self._intf_id,
+                'inverse-bit-error-rate': self._inverse_bit_error_rate}
diff --git a/voltha/adapters/openolt/alarms/onu_los_alarm.py b/voltha/extensions/alarms/onu/onu_startup_alarm.py
similarity index 65%
copy from voltha/adapters/openolt/alarms/onu_los_alarm.py
copy to voltha/extensions/alarms/onu/onu_startup_alarm.py
index 1bfdd4d..b937adb 100644
--- a/voltha/adapters/openolt/alarms/onu_los_alarm.py
+++ b/voltha/extensions/alarms/onu/onu_startup_alarm.py
@@ -11,23 +11,29 @@
 # 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.
-
 from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
-from adapter_alarms import AlarmBase
+from voltha.extensions.alarms.adapter_alarms import AlarmBase
+
 """
-TODO:  To be Implemented in the openolt alarms
+    message OnuStartupFailureIndication {
+    fixed32 intf_id = 1;
+    fixed32 onu_id = 2;
+    string status = 3;
+}
+
 """
 
+class OnuStartupAlarm(AlarmBase):
 
-class OnuLosAlarm(AlarmBase):
-    def __init__(self, handler, onu_id, intf_id):
-        super(OnuLosAlarm, self).__init__(handler, 'onu LOS',
-                                          alarm='LOS',
-                                          alarm_category=AlarmEventCategory.ONT,
+    def __init__(self, alarm_mgr, onu_id, intf_id):
+        super(OnuStartupAlarm, self).__init__(alarm_mgr, object_type='onu STARTUP FAIL',
+                                          alarm='STARTUP_FAIL',
+                                          alarm_category=AlarmEventCategory.ONU,
                                           alarm_type=AlarmEventType.COMMUNICATION,
                                           alarm_severity=AlarmEventSeverity.MAJOR)
         self._onu_id = onu_id
         self._intf_id = intf_id
 
     def get_context_data(self):
-        return {'onu-id': self._onu_id}
+        return {'onu-id': self._onu_id,
+                'onu-intf-id': self._intf_id}
diff --git a/voltha/extensions/alarms/onu/onu_window_drift_alarm.py b/voltha/extensions/alarms/onu/onu_window_drift_alarm.py
new file mode 100644
index 0000000..39af741
--- /dev/null
+++ b/voltha/extensions/alarms/onu/onu_window_drift_alarm.py
@@ -0,0 +1,43 @@
+# Copyright 2017-present Adtran, Inc.
+#
+# 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.
+from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
+from voltha.extensions.alarms.adapter_alarms import AlarmBase
+
+
+class OnuWindowDriftAlarm(AlarmBase):
+    """
+    OnuDriftOfWindowIndication {
+            fixed32 intf_id = 1;
+            fixed32 onu_id = 2;
+            string status = 3;
+            fixed32 drift = 4;
+            fixed32 new_eqd = 5;
+        }
+    """
+    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_category=AlarmEventCategory.ONU,
+                                          alarm_type=AlarmEventType.COMMUNICATION,
+                                          alarm_severity=AlarmEventSeverity.MAJOR)
+        self._onu_id = onu_id
+        self._intf_id = intf_id
+        self._drift = drift
+        self._new_eqd = new_eqd
+
+    def get_context_data(self):
+        return {'onu-id': self._onu_id,
+                'onu-intf-id': self._intf_id,
+                'drift': self._drift,
+                'new-eqd': self._new_eqd}