blob: a1398759c96c759fa1df1ffdb28399b6a2111314 [file] [log] [blame]
Chip Boling32aab302019-01-23 10:50:18 -06001# 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
15from voltha.extensions.alarms.adapter_alarms import AlarmBase
16from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
17
18
19class OnuActiveAlarm(AlarmBase):
20 def __init__(self, alarm_mgr, device_id, pon_id, onu_serial_number,
21 reg_id, olt_serial_number, ipv4_address=None):
22 super(OnuActiveAlarm, self).__init__(alarm_mgr, object_type='ONU',
23 alarm='ONU_ACTIVATED',
24 alarm_category=AlarmEventCategory.PON,
25 resource_id=pon_id,
26 alarm_type=AlarmEventType.EQUIPMENT,
27 alarm_severity=AlarmEventSeverity.CRITICAL)
28 self._pon_id = pon_id
29 self._onu_serial_number = onu_serial_number
30 self._device_id = device_id
31 self._olt_serial_number = olt_serial_number
32 self._host = ipv4_address
33 self._reg_id = reg_id
34
35 def get_context_data(self):
36 data = {
37 'pon-id': self._pon_id,
38 'serial-number': self._onu_serial_number,
39 'olt_serial_number': self._olt_serial_number,
40 'device_id': self._device_id,
41 'registration_id': self._reg_id
42 }
43 if self._host is not None:
44 data['host'] = self._host
45
46 return data
47
48 def clear_alarm(self):
49 raise NotImplementedError('ONU Active Alarms are auto-clear')
50