Chip Boling | 8e042f6 | 2019-02-12 16:14:34 -0600 | [diff] [blame^] | 1 | # |
| 2 | # Copyright 2017 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 | from voltha.extensions.omci.tasks.mib_resync_task import MibResyncTask |
| 17 | from voltha.extensions.omci.omci_entities import GalEthernetProfile, GemPortNetworkCtp, \ |
| 18 | Ieee8021pMapperServiceProfile |
| 19 | |
| 20 | |
| 21 | class AdtnMibResyncTask(MibResyncTask): |
| 22 | """ |
| 23 | ADTRAN MIB resynchronization Task |
| 24 | |
| 25 | The ADTRAN IBONT 602 does not report the current value of the GAL Ethernet |
| 26 | Payload size, it is always 0. |
| 27 | |
| 28 | Also, the MEF EVC/EVC-MAP code monitors GEM Port CTP ME |
| 29 | """ |
| 30 | def __init__(self, omci_agent, device_id): |
| 31 | """ |
| 32 | Class initialization |
| 33 | |
| 34 | :param omci_agent: (OpenOMCIAgent) OMCI Adapter agent |
| 35 | :param device_id: (str) ONU Device ID |
| 36 | """ |
| 37 | super(AdtnMibResyncTask, self).__init__(omci_agent, device_id) |
| 38 | self.omci_fixed = False |
| 39 | |
| 40 | def compare_mibs(self, db_copy, db_active): |
| 41 | """ |
| 42 | Compare the our db_copy with the ONU's active copy |
| 43 | |
| 44 | :param db_copy: (dict) OpenOMCI's copy of the database |
| 45 | :param db_active: (dict) ONU's database snapshot |
| 46 | :return: (dict), (dict), (list) Differences |
| 47 | """ |
| 48 | on_olt_only, on_onu_only, attr_diffs = super(AdtnMibResyncTask, self).\ |
| 49 | compare_mibs(db_copy, db_active) |
| 50 | |
| 51 | if not self.omci_fixed: |
| 52 | # Exclude 'max_gem_payload_size' in GAL Ethernet Profile |
| 53 | attr_diffs = [attr for attr in attr_diffs |
| 54 | if attr[0] != GalEthernetProfile.class_id |
| 55 | or attr[2] != 'max_gem_payload_size'] |
| 56 | |
| 57 | # Exclude any changes to GEM Port Network CTP |
| 58 | attr_diffs = [attr for attr in attr_diffs |
| 59 | if attr[0] != GemPortNetworkCtp.class_id] |
| 60 | |
| 61 | if on_olt_only is not None: |
| 62 | # Exclude IEEE 8021.p Mapper Service Profile from OLT Only as not |
| 63 | # reported in current IBONT 602 software |
| 64 | on_olt_only = [(cid, eid) for cid, eid in on_olt_only |
| 65 | if cid != Ieee8021pMapperServiceProfile.class_id] |
| 66 | |
| 67 | return on_olt_only, on_onu_only, attr_diffs |