Matt Jeanneret | f1e9c5d | 2019-02-08 07:41:29 -0500 | [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 | import structlog |
| 17 | from twisted.internet import reactor |
Matt Jeanneret | 72f96fc | 2019-02-11 10:53:05 -0500 | [diff] [blame] | 18 | from pyvoltha.adapters.extensions.omci.state_machines.mib_sync import MibSynchronizer |
Matt Jeanneret | f1e9c5d | 2019-02-08 07:41:29 -0500 | [diff] [blame] | 19 | |
| 20 | log = structlog.get_logger() |
| 21 | |
| 22 | class BrcmMibSynchronizer(MibSynchronizer): |
| 23 | """ |
| 24 | OpenOMCI MIB Synchronizer state machine for Broadcom ONUs |
| 25 | """ |
| 26 | |
| 27 | def __init__(self, agent, device_id, mib_sync_tasks, db, |
| 28 | advertise_events=False): |
| 29 | """ |
| 30 | Class initialization |
| 31 | |
| 32 | :param agent: (OpenOmciAgent) Agent |
| 33 | :param device_id: (str) ONU Device ID |
| 34 | :param db: (MibDbVolatileDict) MIB Database |
| 35 | :param mib_sync_tasks: (dict) Tasks to run |
| 36 | :param advertise_events: (bool) Advertise events on OpenOMCI Event Bus |
| 37 | """ |
| 38 | self.log = structlog.get_logger(device_id=device_id) |
| 39 | self.log.debug('function-entry') |
| 40 | |
| 41 | super(BrcmMibSynchronizer, self).__init__(agent, device_id, mib_sync_tasks, db, |
| 42 | advertise_events=advertise_events) |
| 43 | |
| 44 | def on_enter_starting(self): |
| 45 | """ |
| 46 | Given resync and mib update is questionable (see below) flag the ONU as a new device which forces a mib |
| 47 | reset and a mib upload |
| 48 | """ |
| 49 | self.log.warn('db-sync-not-supported-forcing-reset') |
| 50 | self._last_mib_db_sync_value = None |
| 51 | super(BrcmMibSynchronizer, self).on_enter_starting() |
| 52 | |
| 53 | def on_enter_auditing(self): |
| 54 | """ |
| 55 | Perform a MIB Audit. Currently this is broken on BRCM based onu and its never in sync and continuously |
| 56 | retries. On disable/enable it never enables becaues its never in sync. Effectively disable the function so |
| 57 | disable/enable works and we can figure out whats going on |
| 58 | |
| 59 | Oddly enough this is only an issue with MibVolatileDict |
| 60 | """ |
| 61 | # TODO: Actually fix resync |
| 62 | self.log.warn('audit-resync-not-supported') |
| 63 | |
| 64 | self._deferred = reactor.callLater(0, self.success) |
| 65 | |
| 66 | def on_enter_examining_mds(self): |
| 67 | """ |
| 68 | Examine MIB difference counter between onu and voltha. Currently same problem as on_enter_auditing. |
| 69 | examine mds is always mismatched and causing disable/enable to fail |
| 70 | |
| 71 | Oddly enough this is only an issue with MibVolatileDict |
| 72 | """ |
| 73 | # TODO: Actually fix resync |
| 74 | self.log.warn('examine-mds-resync-not-supported') |
| 75 | |
| 76 | self._deferred = reactor.callLater(0, self.success) |
| 77 | |