Chip Boling | 32aab30 | 2019-01-23 10:50:18 -0600 | [diff] [blame] | 1 | # Copyright 2017-present Adtran, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory |
| 15 | from voltha.extensions.alarms.adapter_alarms import AlarmBase |
| 16 | |
| 17 | |
| 18 | class OnuEquipmentAlarm(AlarmBase): |
| 19 | """ |
| 20 | The ONU Equipment Alarm is reported by both the CircuitPack (ME #6) and |
| 21 | the ONT-G (ME # 256) to indicate failure on an internal interface or |
| 22 | failed self-test. |
| 23 | |
| 24 | For CircuitPack equipment alarms, the intf_id reported is that of the |
| 25 | UNI's logical port number |
| 26 | |
| 27 | For ONT-G equipment alarms, the intf_id reported is that of the PON/ANI |
| 28 | physical port number |
| 29 | |
| 30 | Note: Some ONUs may use this alarm to report a self-test failure or may |
| 31 | may report it with a different alarm number specifically for a |
| 32 | self-test failure. |
| 33 | """ |
| 34 | def __init__(self, alarm_mgr, onu_id, intf_id): |
| 35 | super(OnuEquipmentAlarm, self).__init__(alarm_mgr, object_type='onu equipment', |
| 36 | alarm='ONU_EQUIPMENT', |
| 37 | alarm_category=AlarmEventCategory.ONU, |
| 38 | alarm_type=AlarmEventType.EQUIPTMENT, |
| 39 | alarm_severity=AlarmEventSeverity.CRITICAL) |
| 40 | self._onu_id = onu_id |
| 41 | self._intf_id = intf_id |
| 42 | |
| 43 | def get_context_data(self): |
| 44 | return {'onu-id': self._onu_id, |
| 45 | 'onu-intf-id': self._intf_id} |