Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 1 | # Copyright 2018 the original author or authors. |
| 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. |
Zack Williams | 84a71e9 | 2019-11-15 09:00:19 -0700 | [diff] [blame] | 14 | from __future__ import absolute_import |
William Kurkian | ede82e9 | 2019-03-05 13:02:57 -0500 | [diff] [blame] | 15 | from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 16 | from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase |
| 17 | |
| 18 | |
| 19 | class OnuHighRxOpticalAlarm(AlarmBase): |
| 20 | """ |
| 21 | The ONU High Tx Optical Power Alarm is reported by the ANI-G (ME # 263) to |
| 22 | indicate that the received downstream optical power above threshold.. |
| 23 | |
| 24 | For ANI-G equipment alarms, the intf_id reported is that of the PON/ANI |
| 25 | physical port number |
| 26 | """ |
Yongjie Zhang | 6d6dc3a | 2019-08-06 14:00:29 -0400 | [diff] [blame] | 27 | def __init__(self, alarm_mgr, onu_id, intf_id, serial_number): |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 28 | super(OnuHighRxOpticalAlarm, self).__init__(alarm_mgr, object_type='onu high rx optical power', |
| 29 | alarm='ONU_HIGH_RX_OPTICAL', |
| 30 | alarm_category=AlarmEventCategory.ONU, |
| 31 | alarm_type=AlarmEventType.COMMUNICATION, |
| 32 | alarm_severity=AlarmEventSeverity.MAJOR) |
| 33 | self._onu_id = onu_id |
| 34 | self._intf_id = intf_id |
Yongjie Zhang | 6d6dc3a | 2019-08-06 14:00:29 -0400 | [diff] [blame] | 35 | self._serial_number = serial_number |
Chip Boling | 67b674a | 2019-02-08 11:42:18 -0600 | [diff] [blame] | 36 | |
| 37 | def get_context_data(self): |
| 38 | return {'onu-id': self._onu_id, |
Yongjie Zhang | 6d6dc3a | 2019-08-06 14:00:29 -0400 | [diff] [blame] | 39 | 'onu-intf-id': self._intf_id, |
| 40 | 'onu-serial-number': self._serial_number} |