Nicolas Palpacuer | 16138de | 2018-07-03 14:35:18 -0400 | [diff] [blame^] | 1 | # |
| 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 | |
| 17 | |
| 18 | |
| 19 | class OpenOltAlarmMgr(object): |
| 20 | def __init__(self, log): |
| 21 | self.log = log |
| 22 | |
| 23 | def process_alarms(self, alarm_ind): |
| 24 | self.log.debug('alarm indication', alarm=alarm_ind) |
| 25 | |
| 26 | try: |
| 27 | |
| 28 | if alarm_ind.HasField('los_ind'): |
| 29 | self.los_indication(alarm_ind.los_ind) |
| 30 | elif alarm_ind.HasField('dying_gasp_ind'): |
| 31 | self.dying_gasp_indication(alarm_ind.dying_gasp_ind) |
| 32 | elif alarm_ind.HasField('onu_alarm_ind'): |
| 33 | self.onu_alarm_indication(alarm_ind.onu_alarm_ind) |
| 34 | elif alarm_ind.HasField('onu_startup_fail_ind'): |
| 35 | self.onu_startup_failure_indication( |
| 36 | alarm_ind.onu_startup_fail_ind) |
| 37 | elif alarm_ind.HasField('onu_signal_degrade_ind'): |
| 38 | self.onu_signal_degrade_indication( |
| 39 | alarm_ind.onu_signal_degrade_ind) |
| 40 | elif alarm_ind.HasField('onu_drift_of_window_ind'): |
| 41 | self.onu_drift_of_window_indication( |
| 42 | alarm_ind.onu_drift_of_window_ind) |
| 43 | elif alarm_ind.HasField('onu_loss_omci_ind'): |
| 44 | self.onu_loss_omci_indication(alarm_ind.onu_loss_omci_ind) |
| 45 | elif alarm_ind.HasField('onu_signals_fail_ind'): |
| 46 | self.onu_signals_failure_indication( |
| 47 | alarm_ind.onu_signals_fail_ind) |
| 48 | elif alarm_ind.HasField('onu_tiwi_ind'): |
| 49 | self.onu_transmission_interference_warning( |
| 50 | alarm_ind.onu_tiwi_ind) |
| 51 | elif alarm_ind.HasField('onu_activation_fail_ind'): |
| 52 | self.onu_activation_failure_indication( |
| 53 | alarm_ind.onu_activation_fail_ind) |
| 54 | elif alarm_ind.HasField('onu_processing_error_ind'): |
| 55 | self.onu_processing_error_indication( |
| 56 | alarm_ind.onu_processing_error_ind) |
| 57 | else: |
| 58 | self.log.warn('unknow alarm type', alarm=alarm_ind) |
| 59 | |
| 60 | except Exception as e: |
| 61 | self.log.error('sorting of alarm went wrong', error=e, |
| 62 | alarm=alarm_ind) |
| 63 | |
| 64 | def los_indication(self, los_ind): |
| 65 | self.log.debug('los indication received', los_ind=los_ind) |
| 66 | try: |
| 67 | self.log.info('los indication', intf_id=los_ind.intf_id, |
| 68 | status=los_ind.status) |
| 69 | except Exception as e: |
| 70 | self.log.error('error parsing los indication', error=e) |
| 71 | |
| 72 | def dying_gasp_indication(self, dying_gasp_ind): |
| 73 | self.log.info('not implemented yet') |
| 74 | |
| 75 | def onu_alarm_indication(self, onu_alarm_ind): |
| 76 | self.log.info('not implemented yet') |
| 77 | |
| 78 | def onu_startup_failure_indication(self, onu_startup_fail_ind): |
| 79 | self.log.info('not implemented yet') |
| 80 | |
| 81 | def onu_signal_degrade_indication(self, onu_signal_degrade_ind): |
| 82 | self.log.info('not implemented yet') |
| 83 | |
| 84 | def onu_drift_of_window_indication(self, onu_drift_of_window_ind): |
| 85 | self.log.info('not implemented yet') |
| 86 | |
| 87 | def onu_loss_omci_indication(self, onu_loss_omci_ind): |
| 88 | self.log.info('not implemented yet') |
| 89 | |
| 90 | def onu_signals_failure_indication(self, onu_signals_fail_ind): |
| 91 | self.log.info('not implemented yet') |
| 92 | |
| 93 | def onu_transmission_interference_warning(self, onu_tiwi_ind): |
| 94 | self.log.info('not implemented yet') |
| 95 | |
| 96 | def onu_activation_failure_indication(self, onu_activation_fail_ind): |
| 97 | self.log.info('not implemented yet') |
| 98 | |
| 99 | def onu_processing_error_indication(self, onu_processing_error_ind): |
| 100 | self.log.info('not implemented yet') |