blob: 4f5f4f41f06816308e6da7cd4481e618510a9ff3 [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.
14from voltha.protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
15from adapter_alarms import AlarmBase
16
17
18class HeartbeatAlarm(AlarmBase):
19 def __init__(self, alarm_mgr, object_type='olt', heartbeat_misses=0):
20 super(HeartbeatAlarm, self).__init__(alarm_mgr, object_type,
21 alarm='Heartbeat',
22 alarm_category=AlarmEventCategory.PON,
23 alarm_type=AlarmEventType.EQUIPMENT,
24 alarm_severity=AlarmEventSeverity.CRITICAL)
25 self._misses = heartbeat_misses
26
27 def get_context_data(self):
28 return {'heartbeats-missed': self._misses}