Devmalya Paul | 0d3abf0 | 2019-07-31 18:34:27 -0400 | [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 EventCategory, EventSubCategory |
| 15 | from adapter_events import DeviceEventBase |
| 16 | |
| 17 | |
| 18 | class HeartbeatEvent(DeviceEventBase): |
| 19 | def __init__(self, event_mgr, raised_ts, object_type='olt', heartbeat_misses=0): |
| 20 | super(HeartbeatEvent, self).__init__(event_mgr, raised_ts, object_type, |
| 21 | event='Heartbeat', |
| 22 | category=EventCategory.EQUIPMENT, |
| 23 | sub_category=ventSubCategory.PON) |
| 24 | self._misses = heartbeat_misses |
| 25 | |
| 26 | def get_context_data(self): |
| 27 | return {'heartbeats-missed': self._misses} |