blob: 87bae89ddea4993b8b0c6940ded93bdf974bf369 [file] [log] [blame]
Devmalya Paul3fb6f742020-05-07 02:30:50 -04001# 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 __future__ import absolute_import
16from voltha_protos.events_pb2 import EventCategory, EventSubCategory, EventType
17from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
18
19
20class OnuDeletedEvent(DeviceEventBase):
21 def __init__(self, event_mgr, device_id, pon_id, onu_serial_number,
22 reg_id, olt_serial_number, raised_ts, ipv4_address=None,
23 onu_id=None):
24 super(OnuDeletedEvent, self).__init__(event_mgr, raised_ts, object_type='ONU',
25 event='ONU_DELETED',
26 resource_id=pon_id,
27 category=EventCategory.COMMUNICATION,
28 sub_category=EventSubCategory.PON,
29 )
30
31 self._pon_id = pon_id
32 self._onu_id = onu_id
33 self._onu_serial_number = onu_serial_number
34 self._device_id = device_id
35 self._olt_serial_number = olt_serial_number
36 self._host = ipv4_address
37 self._reg_id = reg_id
38
39 def get_context_data(self):
40 data = {
41 'pon-id': self._pon_id,
42 'onu-id': self._onu_id,
43 'serial-number': self._onu_serial_number,
44 'olt-serial-number': self._olt_serial_number,
45 'device-id': self._device_id,
46 'registration-id': self._reg_id
47 }
48 if self._host is not None:
49 data['host'] = self._host
50
51 return data