blob: dc00b6a22bcf65bebcedb50c4c736591006ca485 [file] [log] [blame]
William Kurkian6f436d02019-02-06 16:25:01 -05001#
2# Copyright 2018 the original author or authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17import arrow
William Kurkian23047b92019-05-01 11:02:35 -040018
19from twisted.internet.defer import inlineCallbacks, returnValue
William Kurkian44cd7bb2019-02-11 16:39:12 -050020from pyvoltha.adapters.extensions.alarms.adapter_alarms import AdapterAlarms
21from pyvoltha.adapters.extensions.alarms.simulator.simulate_alarms import AdapterAlarmSimulator
22from pyvoltha.adapters.extensions.alarms.olt.olt_los_alarm import OltLosAlarm
23from pyvoltha.adapters.extensions.alarms.onu.onu_dying_gasp_alarm import OnuDyingGaspAlarm
24from pyvoltha.adapters.extensions.alarms.onu.onu_los_alarm import OnuLosAlarm
25from pyvoltha.adapters.extensions.alarms.onu.onu_lopc_miss_alarm import OnuLopcMissAlarm
26from pyvoltha.adapters.extensions.alarms.onu.onu_lopc_mic_error_alarm import OnuLopcMicErrorAlarm
27from pyvoltha.adapters.extensions.alarms.onu.onu_lob_alarm import OnuLobAlarm
William Kurkian6f436d02019-02-06 16:25:01 -050028
William Kurkian44cd7bb2019-02-11 16:39:12 -050029from pyvoltha.adapters.extensions.alarms.onu.onu_startup_alarm import OnuStartupAlarm
30from pyvoltha.adapters.extensions.alarms.onu.onu_signal_degrade_alarm import OnuSignalDegradeAlarm
31from pyvoltha.adapters.extensions.alarms.onu.onu_signal_fail_alarm import OnuSignalFailAlarm
32from pyvoltha.adapters.extensions.alarms.onu.onu_window_drift_alarm import OnuWindowDriftAlarm
33from pyvoltha.adapters.extensions.alarms.onu.onu_activation_fail_alarm import OnuActivationFailAlarm
William Kurkian6f436d02019-02-06 16:25:01 -050034
William Kurkian8b1690c2019-03-04 16:53:22 -050035import voltha_protos.openolt_pb2 as openolt_pb2
36import voltha_protos.device_pb2 as device_pb2
William Kurkian6f436d02019-02-06 16:25:01 -050037
38
39class OpenOltAlarmMgr(object):
William Kurkian23047b92019-05-01 11:02:35 -040040 def __init__(self, log, core_proxy, device_id, logical_device_id,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -070041 platform, serial_number):
William Kurkian6f436d02019-02-06 16:25:01 -050042 """
William Kurkian23047b92019-05-01 11:02:35 -040043 20180711 - Addition of core_proxy and device_id
William Kurkian6f436d02019-02-06 16:25:01 -050044 to facilitate alarm processing and kafka posting
45 :param log:
William Kurkian23047b92019-05-01 11:02:35 -040046 :param core_proxy:
William Kurkian6f436d02019-02-06 16:25:01 -050047 :param device_id:
48 """
49 self.log = log
William Kurkian23047b92019-05-01 11:02:35 -040050 self.core_proxy = core_proxy
William Kurkian6f436d02019-02-06 16:25:01 -050051 self.device_id = device_id
52 self.logical_device_id = logical_device_id
53 self.platform = platform
serkant.uluderyadcfc74d2019-03-17 23:41:42 -070054 self.serial_number = serial_number
William Kurkian6f436d02019-02-06 16:25:01 -050055 """
56 The following is added to reduce the continual posting of OLT LOS alarming
57 to Kafka. Set enable_alarm_suppress = true to enable otherwise the
58 current openolt bal will send continuous olt los alarm cleared messages
59 ONU disc raised counter is place holder for a future addition
60 """
61 self.enable_alarm_suppress = True
62 self.alarm_suppress = {"olt_los_clear": 0, "onu_disc_raised": []} # Keep count of alarms to limit.
63 try:
William Kurkian23047b92019-05-01 11:02:35 -040064 self.alarms = AdapterAlarms(self.core_proxy, self.device_id, self.logical_device_id, self.serial_number)
William Kurkian6f436d02019-02-06 16:25:01 -050065 self.simulator = AdapterAlarmSimulator(self.alarms)
66 except Exception as initerr:
67 self.log.exception("alarmhandler-init-error", errmsg=initerr.message)
68 raise Exception(initerr)
69
70 def process_alarms(self, alarm_ind):
71 try:
72 self.log.debug('alarm-indication', alarm=alarm_ind, device_id=self.device_id)
73 if alarm_ind.HasField('los_ind'):
74 self.los_indication(alarm_ind.los_ind)
75 elif alarm_ind.HasField('dying_gasp_ind'):
76 self.dying_gasp_indication(alarm_ind.dying_gasp_ind)
77 elif alarm_ind.HasField('onu_alarm_ind'):
78 self.onu_alarm_indication(alarm_ind.onu_alarm_ind)
79 elif alarm_ind.HasField('onu_startup_fail_ind'):
80 self.onu_startup_failure_indication(
81 alarm_ind.onu_startup_fail_ind)
82 elif alarm_ind.HasField('onu_signal_degrade_ind'):
83 self.onu_signal_degrade_indication(
84 alarm_ind.onu_signal_degrade_ind)
85 elif alarm_ind.HasField('onu_drift_of_window_ind'):
86 self.onu_drift_of_window_indication(
87 alarm_ind.onu_drift_of_window_ind)
88 elif alarm_ind.HasField('onu_loss_omci_ind'):
89 self.onu_loss_omci_indication(alarm_ind.onu_loss_omci_ind)
90 elif alarm_ind.HasField('onu_signals_fail_ind'):
91 self.onu_signals_failure_indication(
92 alarm_ind.onu_signals_fail_ind)
93 elif alarm_ind.HasField('onu_tiwi_ind'):
94 self.onu_transmission_interference_warning(
95 alarm_ind.onu_tiwi_ind)
96 elif alarm_ind.HasField('onu_activation_fail_ind'):
97 self.onu_activation_failure_indication(
98 alarm_ind.onu_activation_fail_ind)
99 elif alarm_ind.HasField('onu_processing_error_ind'):
100 self.onu_processing_error_indication(
101 alarm_ind.onu_processing_error_ind)
102 else:
103 self.log.warn('unknown alarm type', alarm=alarm_ind)
104
105 except Exception as e:
106 self.log.error('sorting of alarm went wrong', error=e,
107 alarm=alarm_ind)
108
109 def simulate_alarm(self, alarm):
110 self.simulator.simulate_alarm(alarm)
111
112 def los_indication(self, los_ind):
113
114 try:
115 self.log.debug('los indication received', los_ind=los_ind,
116 int_id=los_ind.intf_id, status=los_ind.status)
117 try:
118 port_type_name = self.platform.intf_id_to_port_type_name(los_ind.intf_id)
119 if los_ind.status == 1 or los_ind.status == "on":
120 # Zero out the suppression counter on OLT_LOS raise
121 self.alarm_suppress['olt_los_clear'] = 0
122 OltLosAlarm(self.alarms, intf_id=los_ind.intf_id, port_type_name=port_type_name).raise_alarm()
123 else:
124 """
125 Check if there has been more that one los clear following a previous los
126 """
127 if self.alarm_suppress['olt_los_clear'] == 0 and self.enable_alarm_suppress:
128 OltLosAlarm(self.alarms, intf_id=los_ind.intf_id, port_type_name=port_type_name).clear_alarm()
129 self.alarm_suppress['olt_los_clear'] += 1
130
131 except Exception as alarm_err:
132 self.log.error('los-indication', errmsg=alarm_err.message)
133 except Exception as e:
134 self.log.error('los-indication', errmsg=e.message)
135
136 def dying_gasp_indication(self, dying_gasp_ind):
137 try:
138 alarm_dgi = dying_gasp_ind
139 onu_id = alarm_dgi.onu_id
140 self.log.debug('openolt-alarmindication-dispatch-dying-gasp', int_id=alarm_dgi.intf_id,
141 onu_id=alarm_dgi.onu_id, status=alarm_dgi.status)
142 try:
143 """
144 Get the specific onu device information for the onu generating the alarm.
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700145 Extract the id.
William Kurkian6f436d02019-02-06 16:25:01 -0500146 """
147 onu_device_id = "unresolved"
148 onu_serial_number = "unresolved"
149 onu_device = self.resolve_onu_id(onu_id, port_intf_id=alarm_dgi.intf_id)
150 if onu_device != None:
151 onu_device_id = onu_device.id
152 onu_serial_number = onu_device.serial_number
153
154 if dying_gasp_ind.status == 1 or dying_gasp_ind.status == "on":
155 OnuDyingGaspAlarm(self.alarms, dying_gasp_ind.intf_id,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700156 onu_device_id, serial_number=onu_serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500157 else:
158 OnuDyingGaspAlarm(self.alarms, dying_gasp_ind.intf_id,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700159 onu_device_id, serial_number=onu_serial_number).clear_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500160 except Exception as alarm_err:
161 self.log.exception('dying-gasp-indication', errmsg=alarm_err.message)
162
163 except Exception as e:
164 self.log.error('dying_gasp_indication', error=e)
165
166 def onu_alarm_indication(self, onu_alarm_ind):
167 """
168 LOB = Los of burst
169 LOPC = Loss of PLOAM miss channel
170
171 :param onu_alarm_ind: Alarm indication which currently contains
172 onu_id:
173 los_status:
174 lob_status:
175 lopc_miss_status:
176 lopc_mic_error_status:
177 :return:
178 """
179 self.log.info('onu-alarm-indication')
180
181 try:
182 self.log.debug('onu alarm indication received', los_status=onu_alarm_ind.los_status,
183 onu_intf_id=onu_alarm_ind.onu_id,
184 lob_status=onu_alarm_ind.lob_status,
185 lopc_miss_status=onu_alarm_ind.lopc_miss_status,
186 lopc_mic_error_status=onu_alarm_ind.lopc_mic_error_status,
187 intf_id=onu_alarm_ind.intf_id
188 )
189
190 try:
191 """
192 Get the specific onu device information for the onu generating the alarm.
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700193 Extract the id.
William Kurkian6f436d02019-02-06 16:25:01 -0500194 """
195 onu_device_id = "unresolved"
196 serial_number = "unresolved"
197 onu_device = self.resolve_onu_id(onu_alarm_ind.onu_id, port_intf_id=onu_alarm_ind.intf_id)
198 if onu_device != None:
199 onu_device_id = onu_device.id
200 serial_number = onu_device.serial_number
201
202 if onu_alarm_ind.los_status == 1 or onu_alarm_ind.los_status == "on":
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700203 OnuLosAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id, serial_number=serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500204 elif onu_alarm_ind.los_status == 0 or onu_alarm_ind.los_status == "off":
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700205 OnuLosAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id, serial_number=serial_number).clear_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500206 else: # No Change
207 pass
208
209 if onu_alarm_ind.lopc_miss_status == 1 or onu_alarm_ind.lopc_miss_status == "on":
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700210 OnuLopcMissAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id, serial_number=serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500211 elif (onu_alarm_ind.lopc_miss_status == 0 or onu_alarm_ind.lopc_miss_status == "off"):
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700212 OnuLopcMissAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id, serial_number=serial_number).clear_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500213 else: # No Change
214 pass
215
216 if onu_alarm_ind.lopc_mic_error_status == 1 or onu_alarm_ind.lopc_mic_error_status == "on":
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700217 OnuLopcMicErrorAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id, serial_number=serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500218 elif onu_alarm_ind.lopc_mic_error_status == 0 or onu_alarm_ind.lopc_mic_error_status == "off":
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700219 OnuLopcMicErrorAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id, serial_number=serial_number).clear_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500220 else: # No Change
221 pass
222
223 if onu_alarm_ind.lob_status == 1 or onu_alarm_ind.lob_status == "on":
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700224 OnuLobAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id, serial_number=serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500225 elif onu_alarm_ind.lob_status == 0 or onu_alarm_ind.lob_status == "off":
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700226 OnuLobAlarm(self.alarms, onu_id=onu_device_id, intf_id=onu_alarm_ind.intf_id, serial_number=serial_number).clear_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500227 else: # No Change
228 pass
229 except Exception as alarm_err:
230 self.log.exception('onu-alarm-indication', errmsg=alarm_err.message)
231
232 except Exception as e:
233 self.log.exception('onu-alarm-indication', errmsg=e.message)
234
235 def onu_startup_failure_indication(self, onu_startup_fail_ind):
236 """
237 Current protobuf indicator:
238 message OnuStartupFailureIndication {
239 fixed32 intf_id = 1;
240 fixed32 onu_id = 2;
241 string status = 3;
242 }
243
244 :param onu_startup_fail_ind:
245 :return:
246 """
247 try:
248 ind = onu_startup_fail_ind
249 label = "onu-startup-failure-indication"
250 self.log.debug(label + " received", onu_startup_fail_ind=ind, int_id=ind.intf_id, onu_id=ind.onu_id, status=ind.status)
251 try:
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700252 """
253 Get the specific onu device information for the onu generating the alarm.
254 """
255 serial_number = "unresolved"
256 onu_device = self.resolve_onu_id(ind.onu_id, port_intf_id=ind.intf_id)
257 if onu_device != None:
258 serial_number = onu_device.serial_number
259
William Kurkian6f436d02019-02-06 16:25:01 -0500260 if ind.status == 1 or ind.status == "on":
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700261 OnuStartupAlarm(self.alarms, intf_id=ind.intf_id,onu_id=ind.onu_id, serial_number=serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500262 else:
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700263 OnuStartupAlarm(self.alarms, intf_id=ind.intf_id, onu_id=ind.onu_id, serial_number=serial_number).clear_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500264 except Exception as alarm_err:
265 self.log.exception(label, errmsg=alarm_err.message)
266
267 except Exception as e:
268 self.log.exception(label, errmsg=e.message)
269
270 def onu_signal_degrade_indication(self, onu_signal_degrade_ind):
271 """
272 Current protobuf indicator:
273 OnuSignalDegradeIndication {
274 fixed32 intf_id = 1;
275 fixed32 onu_id = 2;
276 string status = 3;
277 fixed32 inverse_bit_error_rate = 4;
278 }
279 :param onu_signal_degrade_ind:
280 :return:
281 """
282 try:
283 ind = onu_signal_degrade_ind
284 label = "onu-signal-degrade-indication"
285 self.log.debug(label + ' received',
286 onu_startup_fail_ind=ind,
287 int_id=ind.intf_id,
288 onu_id=ind.onu_id,
289 inverse_bit_error_rate=ind.inverse_bit_error_rate,
290 status=ind.status)
291 try:
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700292 """
293 Get the specific onu device information for the onu generating the alarm.
294 Extract the id. In the future extract the serial number as well
295 """
296 serial_number = "unresolved"
297 onu_device = self.resolve_onu_id(ind.onu_id, port_intf_id=ind.intf_id)
298 if onu_device != None:
299 serial_number = onu_device.serial_number
300
William Kurkian6f436d02019-02-06 16:25:01 -0500301 if ind.status == 1 or ind.status == "on":
302 OnuSignalDegradeAlarm(self.alarms, intf_id=ind.intf_id, onu_id=ind.onu_id,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700303 inverse_bit_error_rate=ind.inverse_bit_error_rate, serial_number=serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500304 else:
305 OnuSignalDegradeAlarm(self.alarms, intf_id=ind.intf_id, onu_id=ind.onu_id,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700306 inverse_bit_error_rate=ind.inverse_bit_error_rate, serial_number=serial_number).clear_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500307 except Exception as alarm_err:
308 self.log.exception(label, errmsg=alarm_err.message)
309
310 except Exception as e:
311 self.log.exception(label, errmsg=e.message)
312
313 def onu_drift_of_window_indication(self, onu_drift_of_window_ind):
314 """
315 Current protobuf indicator:
316 OnuDriftOfWindowIndication {
317 fixed32 intf_id = 1;
318 fixed32 onu_id = 2;
319 string status = 3;
320 fixed32 drift = 4;
321 fixed32 new_eqd = 5;
322 }
323
324 :param onu_drift_of_window_ind:
325 :return:
326 """
327 try:
328 ind = onu_drift_of_window_ind
329 label = "onu-window-drift-indication"
330
331 onu_device_id, onu_serial_number = self.resolve_onudev_id_onudev_serialnum(
332 self.resolve_onu_id(ind.onu_id, port_intf_id=ind.intf_id))
333
334 self.log.debug(label + ' received',
335 onu_drift_of_window_ind=ind,
336 int_id=ind.intf_id,
337 onu_id=ind.onu_id,
338 onu_device_id=onu_device_id,
339 drift=ind.drift,
340 new_eqd=ind.new_eqd,
341 status=ind.status)
342 try:
343 if ind.status == 1 or ind.status == "on":
344 OnuWindowDriftAlarm(self.alarms, intf_id=ind.intf_id,
345 onu_id=onu_device_id,
346 drift=ind.drift,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700347 new_eqd=ind.new_eqd,
348 serial_number=onu_serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500349 else:
350 OnuWindowDriftAlarm(self.alarms, intf_id=ind.intf_id,
351 onu_id=onu_device_id,
352 drift=ind.drift,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700353 new_eqd=ind.new_eqd,
354 serial_number=onu_serial_number).clear_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500355 except Exception as alarm_err:
356 self.log.exception(label, errmsg=alarm_err.message)
357
358 except Exception as e:
359 self.log.exception(label, errmsg=e.message)
360
361 def onu_loss_omci_indication(self, onu_loss_omci_ind):
362 self.log.info('not implemented yet')
363
364 def onu_signals_failure_indication(self, onu_signals_fail_ind):
365 """
366 Current protobuf indicator:
367 OnuSignalsFailureIndication {
368 fixed32 intf_id = 1;
369 fixed32 onu_id = 2;
370 string status = 3;
371 fixed32 inverse_bit_error_rate = 4;
372 }
373
374 :param onu_signals_fail_ind:
375 :return:
376 """
377 try:
378 ind = onu_signals_fail_ind
379 label = "onu-signal-failure-indication"
380
381 onu_device_id, onu_serial_number = self.resolve_onudev_id_onudev_serialnum(
382 self.resolve_onu_id(ind.onu_id, port_intf_id=ind.intf_id))
383
384 self.log.debug(label + ' received',
385 onu_startup_fail_ind=ind,
386 int_id=ind.intf_id,
387 onu_id=ind.onu_id,
388 onu_device_id=onu_device_id,
389 onu_serial_number=onu_serial_number,
390 inverse_bit_error_rate=ind.inverse_bit_error_rate,
391 status=ind.status)
392 try:
393 if ind.status == 1 or ind.status == "on":
394 OnuSignalFailAlarm(self.alarms, intf_id=ind.intf_id,
395 onu_id=onu_device_id,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700396 inverse_bit_error_rate=ind.inverse_bit_error_rate,
397 serial_number=onu_serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500398 else:
399 OnuSignalFailAlarm(self.alarms, intf_id=ind.intf_id,
400 onu_id=onu_device_id,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700401 inverse_bit_error_rate=ind.inverse_bit_error_rate,
402 serial_number=onu_serial_number).clear_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500403 except Exception as alarm_err:
404 self.log.exception(label, errmsg=alarm_err.message)
405
406 except Exception as e:
407 self.log.exception(label, errmsg=e.message)
408
409
410 def onu_transmission_interference_warning(self, onu_tiwi_ind):
411 self.log.info('not implemented yet')
412
413 def onu_activation_failure_indication(self, onu_activation_fail_ind):
414 """
415
416 No status is currently passed with this alarm. Consequently it will always just raise
417 :param onu_activation_fail_ind:
418 :return:
419 """
420 try:
421 ind = onu_activation_fail_ind
422 label = "onu-activation-failure-indication"
423
424 onu_device_id, onu_serial_number = self.resolve_onudev_id_onudev_serialnum(
425 self.resolve_onu_id(ind.onu_id, port_intf_id=ind.intf_id))
426
427 self.log.debug(label + ' received',
428 onu_startup_fail_ind=ind,
429 int_id=ind.intf_id,
430 onu_id=ind.onu_id,
431 onu_device_id=onu_device_id,
432 onu_serial_number=onu_serial_number)
433 try:
434
435 OnuActivationFailAlarm(self.alarms, intf_id=ind.intf_id,
serkant.uluderyadcfc74d2019-03-17 23:41:42 -0700436 onu_id=onu_device_id, serial_number=onu_serial_number).raise_alarm()
William Kurkian6f436d02019-02-06 16:25:01 -0500437 except Exception as alarm_err:
438 self.log.exception(label, errmsg=alarm_err.message)
439
440 except Exception as e:
441 self.log.exception(label, errmsg=e.message)
442
443 def onu_processing_error_indication(self, onu_processing_error_ind):
444 self.log.info('not implemented yet')
445
446 """
447 Helper Methods
448 """
449
450 def resolve_onudev_id_onudev_serialnum(self,onu_device):
451 """
452 Convenience wrapper to resolve device_id and serial number
453 :param onu_device:
454 :return: tuple: onu_device_id, onu_serial_number
455 """
456 try:
457 onu_device_id = "unresolved"
458 onu_serial_number = "unresolved"
459 if onu_device != None:
460 onu_device_id = onu_device.id
461 onu_serial_number = onu_device.serial_number
462 except Exception as err:
463 self.log.exception("openolt-alarms-resolve-onudev-id ", errmsg=err.message)
464 raise Exception(err)
465 return onu_device_id, onu_serial_number
466
William Kurkian23047b92019-05-01 11:02:35 -0400467 @inlineCallbacks
William Kurkian6f436d02019-02-06 16:25:01 -0500468 def resolve_onu_id(self, onu_id, port_intf_id):
469 """
470 Resolve the onu_device from the intf_id value and port. Uses the adapter agent to
471 resolve this..
472
473 Returns None if not found. Caller will have to test for None and act accordingly.
474 :param onu_id:
475 :param port_intf_id:
476 :return:
477 """
478
479 try:
480 onu_device = None
William Kurkian23047b92019-05-01 11:02:35 -0400481 onu_device = yield self.core_proxy.get_child_device(
William Kurkian6f436d02019-02-06 16:25:01 -0500482 self.device_id,
483 parent_port_no=self.platform.intf_id_to_port_no(
484 port_intf_id, device_pb2.Port.PON_OLT),
485 onu_id=onu_id)
William Kurkian6f436d02019-02-06 16:25:01 -0500486 except Exception as inner:
487 self.log.exception('resolve-onu-id', errmsg=inner.message)
488
William Kurkian23047b92019-05-01 11:02:35 -0400489 returnValue(onu_device)
William Kurkian6f436d02019-02-06 16:25:01 -0500490