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 | message OnuStartupFailureIndication { |
| 19 | fixed32 intf_id = 1; |
| 20 | fixed32 onu_id = 2; |
| 21 | string status = 3; |
| 22 | } |
| 23 | |
| 24 | """ |
| 25 | |
| 26 | class OnuStartupAlarm(AlarmBase): |
| 27 | |
| 28 | def __init__(self, alarm_mgr, onu_id, intf_id): |
| 29 | super(OnuStartupAlarm, self).__init__(alarm_mgr, object_type='onu STARTUP FAIL', |
| 30 | alarm='ONU_STARTUP_FAIL', |
| 31 | alarm_category=AlarmEventCategory.ONU, |
| 32 | alarm_type=AlarmEventType.COMMUNICATION, |
| 33 | alarm_severity=AlarmEventSeverity.MAJOR) |
| 34 | self._onu_id = onu_id |
| 35 | self._intf_id = intf_id |
| 36 | |
| 37 | def get_context_data(self): |
| 38 | return {'onu-id': self._onu_id, |
| 39 | 'onu-intf-id': self._intf_id} |