blob: 0de236fcd147b24c0e6288d83a993624f317360f [file] [log] [blame]
Chip Boling8e042f62019-02-12 16:14:34 -06001#
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#
16from voltha.extensions.omci.tasks.get_mds_task import GetMdsTask
17
18
19class AdtnGetMdsTask(GetMdsTask):
20 """
21 OpenOMCI Get MIB Data Sync value task - Adtran ONU
22
23 On successful completion, this task will call the 'callback' method of the
24 deferred returned by the start method and return the value of the MIB
25 Data Sync attribute of the ONT Data ME
26 """
27 name = "ADTN: Get MDS Task"
28
29 def __init__(self, omci_agent, device_id):
30 """
31 Class initialization
32
33 :param omci_agent: (OmciAdapterAgent) OMCI Adapter agent
34 :param device_id: (str) ONU Device ID
35 """
36 super(AdtnGetMdsTask, self).__init__(omci_agent, device_id)
37
38 self.name = AdtnGetMdsTask.name
39 self._device = omci_agent.get_device(device_id)
40 self._omci_managed = False # TODO: Look up capabilities/model number/check handler
41
42 def perform_get_mds(self):
43 """
44 Get the 'mib_data_sync' attribute of the ONU
45 """
46 self.log.info('perform-get-mds')
47
48 if self._omci_managed:
49 return super(AdtnGetMdsTask, self).perform_get_mds()
50
51 # Non-OMCI managed ADTN ONUs always return 0 for MDS, use the MIB
52 # sync value and depend on an accelerated mib resync to do the
53 # proper comparison
54
55 self.deferred.callback(self._device.mib_synchronizer.mib_data_sync)
56